diff options
author | Sam Bingner <sam@bingner.com> | 2018-08-02 20:58:23 -1000 |
---|---|---|
committer | Sam Bingner <sam@bingner.com> | 2018-08-02 20:58:23 -1000 |
commit | 398cdffcaf51b09400c726e7d0a9a07a182122c7 (patch) | |
tree | 35eb93246d73395e37817f0e35d613b4702af05a | |
parent | bea5ee0aadb0ac95f71eb858fdb7f02e748f50d7 (diff) |
Make Cydia packages report common arch first and fallback to other arches
-rw-r--r-- | MobileCydia.mm | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm index 76a3a3f..1961f5d 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; @@ -2749,10 +2751,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 } @@ -3479,11 +3486,11 @@ class CydiaLogCleaner : @synchronized (self) { if (static_cast<pkgDepCache *>(cache_) == NULL) return nil; - pkgCache::PkgIterator iterator(cache_->FindPkg([name UTF8String] -#ifdef __arm64__ - , "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]; } } @@ -9384,7 +9391,6 @@ int main(int argc, char *argv[]) { CydiaAddSource(@"http://apt.thebigboss.org/repofiles/cydia/", @"stable", [NSMutableArray arrayWithObject:@"main"]); CydiaAddSource(@"http://apt.modmyi.com/", @"stable", [NSMutableArray arrayWithObject:@"main"]); CydiaAddSource(@"http://cydia.zodttd.com/repo/cydia/", @"stable", [NSMutableArray arrayWithObject:@"main"]); - CydiaAddSource(@"http://repo666.ultrasn0w.com/", @"./"); Version_ = [NSNumber numberWithUnsignedInt:1]; @@ -9433,6 +9439,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); _config->Set("Dir::Bin::Methods::store", "/Applications/Cydia.app/store"); |