summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Bingner <sam@bingner.com>2018-08-02 20:58:23 -1000
committerSam Bingner <sam@bingner.com>2019-05-27 14:16:11 -1000
commitd25b4eee0cafb763b8281da78f2476fcab2fa27c (patch)
treebc2eef9c0412046dd096f4bd3f7bda8c3fe2d7a5
parent8409d378c8b5c4bac7e59354b22bd03583db2378 (diff)
Make Cydia packages report common arch first and fallback to other arches
-rw-r--r--MobileCydia.mm26
1 files changed, 18 insertions, 8 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 4b82efb..dcfb7a3 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -118,6 +118,8 @@ extern "C" {
#include "Cydia/ProgressEvent.h"
/* }}} */
+const char *common_arch=NULL;
+
/* Profiler {{{ */
struct timeval _ltv;
bool _itv;
@@ -2745,10 +2747,15 @@ struct PackageNameOrdering :
- (BOOL) upgradableAndEssential:(BOOL)essential {
_profile(Package$upgradableAndEssential)
pkgCache::VerIterator current(iterator_.CurrentVer());
- if (current.end())
- return essential && essential_;
- else
+ if (current.end()) {
+ if (essential && essential_) {
+ return (strcmp(version_.Arch(), common_arch)==0);
+ } else {
+ return false;
+ }
+ } else {
return version_ != current;
+ }
_end
}
@@ -3475,11 +3482,11 @@ class CydiaLogCleaner :
@synchronized (self) {
if (static_cast<pkgDepCache *>(cache_) == NULL)
return nil;
- pkgCache::PkgIterator iterator(cache_->FindPkg([name UTF8String]
-#ifndef __arm__
- , "any"
-#endif
- ));
+ pkgCache::PkgIterator iterator;
+ // try common arch first
+ iterator = cache_->FindPkg([name UTF8String], common_arch);
+ if (iterator.end())
+ iterator = cache_->FindPkg([name UTF8String], "any");
return iterator.end() ? nil : [[Package newPackageWithIterator:iterator withZone:NULL inPool:NULL database:self] autorelease];
} }
@@ -9458,6 +9465,9 @@ int main(int argc, char *argv[]) {
_assert(pkgInitConfig(*_config));
_assert(pkgInitSystem(*_config, _system));
+ const Configuration::Item *arch = _config->Tree("APT::Architecture");
+ NSLog(@"Common Arch: %s\n", arch->Value.c_str());
+ common_arch = arch->Value.c_str();
_config->Set("Acquire::AllowInsecureRepositories", true);
_config->Set("Acquire::Check-Valid-Until", false);