From 398cdffcaf51b09400c726e7d0a9a07a182122c7 Mon Sep 17 00:00:00 2001 From: Sam Bingner Date: Thu, 2 Aug 2018 20:58:23 -1000 Subject: Make Cydia packages report common arch first and fallback to other arches --- MobileCydia.mm | 27 ++++++++++++++++++--------- 1 file 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(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"); -- cgit v1.2.3