]> git.saurik.com Git - cydia.git/commitdiff
Parse APT sources before packages.
authorJay Freeman (saurik) <saurik@saurik.com>
Sat, 2 Apr 2011 05:30:43 +0000 (22:30 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Sat, 2 Apr 2011 05:30:43 +0000 (22:30 -0700)
MobileCydia.mm

index 34ca69bd1ad0bfb89c0c79c4baffd966582586ac..fe43e50053850556c2bff6ff8afd6ace88d1f225 100644 (file)
@@ -1338,6 +1338,7 @@ static void PackageImport(const void *key, const void *value, void *context) {
 - (NSString *) depictionForPackage:(NSString *)package;
 - (NSString *) supportForPackage:(NSString *)package;
 
+- (metaIndex *) metaIndex;
 - (NSDictionary *) record;
 - (BOOL) trusted;
 
@@ -1426,6 +1427,10 @@ static void PackageImport(const void *key, const void *value, void *context) {
     return ![[self _attributeKeys] containsObject:[NSString stringWithUTF8String:name]] && [super isKeyExcludedFromWebScript:name];
 }
 
+- (metaIndex *) metaIndex {
+    return index_;
+}
+
 - (void) setMetaIndex:(metaIndex *)index inPool:(apr_pool_t *)pool {
     [self _clear];
 
@@ -3539,6 +3544,15 @@ class CydiaLogCleaner :
 
     NSString *title(UCLocalize("DATABASE"));
 
+    list_ = new pkgSourceList();
+    if ([self popErrorWithTitle:title forOperation:list_->ReadMainList()])
+        return;
+
+    for (pkgSourceList::const_iterator source = list_->begin(); source != list_->end(); ++source) {
+        Source *object([[[Source alloc] initWithMetaIndex:*source forDatabase:self inPool:pool_] autorelease]);
+        [sourceList_ addObject:object];
+    }
+
     _trace();
     OpProgress progress;
     while (!cache_.Open(progress, true)) { pop:
@@ -3575,10 +3589,6 @@ class CydiaLogCleaner :
     fetcher_ = new pkgAcquire(&status_);
     lock_ = NULL;
 
-    list_ = new pkgSourceList();
-    if ([self popErrorWithTitle:title forOperation:list_->ReadMainList()])
-        return;
-
     if (cache_->DelCount() != 0 || cache_->InstCount() != 0) {
         [delegate_ addProgressEventOnMainThread:[CydiaProgressEvent eventWithMessage:UCLocalize("COUNTS_NONZERO_EX") ofType:kCydiaProgressEventTypeError] forTask:title];
         return;
@@ -3600,11 +3610,9 @@ class CydiaLogCleaner :
             return;
     }
 
-    for (pkgSourceList::const_iterator source = list_->begin(); source != list_->end(); ++source) {
-        Source *object([[[Source alloc] initWithMetaIndex:*source forDatabase:self inPool:pool_] autorelease]);
-        [sourceList_ addObject:object];
-
-        std::vector<pkgIndexFile *> *indices = (*source)->GetIndexFiles();
+    for (Source *object in (id) sourceList_) {
+        metaIndex *source([object metaIndex]);
+        std::vector<pkgIndexFile *> *indices = source->GetIndexFiles();
         for (std::vector<pkgIndexFile *>::const_iterator index = indices->begin(); index != indices->end(); ++index)
             // XXX: this could be more intelligent
             if (dynamic_cast<debPackagesIndex *>(*index) != NULL) {