- (NSString *) depictionForPackage:(NSString *)package;
- (NSString *) supportForPackage:(NSString *)package;
+- (metaIndex *) metaIndex;
- (NSDictionary *) record;
- (BOOL) trusted;
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];
_end
_profile(Package$initWithVersion$Section)
- section_ = iterator.Section();
+ section_ = version_.Section();
_end
_profile(Package$initWithVersion$Flags)
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:
- std::string error;
- bool warning(!_error->PopMessage(error));
- lprintf("cache_.Open():[%s]\n", error.c_str());
-
- if (error == "dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem. ")
- [delegate_ repairWithSelector:@selector(configure)];
- else if (error == "The package lists or status file could not be parsed or opened.")
- [delegate_ repairWithSelector:@selector(update)];
- // else if (error == "Could not get lock /var/lib/dpkg/lock - open (35 Resource temporarily unavailable)")
- // else if (error == "Could not open lock file /var/lib/dpkg/lock - open (13 Permission denied)")
- // else if (error == "Malformed Status line")
- // else if (error == "The list of sources could not be read.")
- else {
+ open:
+ if (!cache_.Open(progress, true)) {
+ // XXX: what if there are errors, but Open() == true? this should be merged with popError:
+ while (!_error->empty()) {
+ std::string error;
+ bool warning(!_error->PopMessage(error));
+
+ lprintf("cache_.Open():[%s]\n", error.c_str());
+
[delegate_ addProgressEventOnMainThread:[CydiaProgressEvent eventWithMessage:[NSString stringWithUTF8String:error.c_str()] ofType:(warning ? kCydiaProgressEventTypeWarning : kCydiaProgressEventTypeError)] forTask:title];
- return;
+
+ SEL repair(NULL);
+ if (false);
+ else if (error == "dpkg was interrupted, you must manually run 'dpkg --configure -a' to correct the problem. ")
+ repair = @selector(configure);
+ //else if (error == "The package lists or status file could not be parsed or opened.")
+ // repair = @selector(update);
+ // else if (error == "Could not get lock /var/lib/dpkg/lock - open (35 Resource temporarily unavailable)")
+ // else if (error == "Could not open lock file /var/lib/dpkg/lock - open (13 Permission denied)")
+ // else if (error == "Malformed Status line")
+ // else if (error == "The list of sources could not be read.")
+
+ if (repair != NULL) {
+ _error->Discard();
+ [delegate_ repairWithSelector:repair];
+ goto open;
+ }
}
- if (warning)
- goto pop;
- _error->Discard();
+ return;
}
_trace();
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;
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) {
] autorelease];
}
-- (void) uicache {
- _trace();
- system("su -c /usr/bin/uicache mobile");
- _trace();
-}
-
- (void) invoke:(NSInvocation *)invocation withTitle:(NSString *)title {
UpdateExternalStatus(1);
case 4: [progress_ setFinish:UCLocalize("REBOOT_DEVICE")]; break;
}
- UIProgressHUD *hud([delegate_ addProgressHUD]);
- [hud setText:UCLocalize("LOADING")];
- [self yieldToSelector:@selector(uicache)];
- [delegate_ removeProgressHUD:hud];
-
UpdateExternalStatus(Finish_ == 0 ? 0 : 2);
[progress_ setRunning:false];
@synchronized (database_) {
era_ = [database_ era];
- pkgSourceList list;
- if ([database_ popErrorWithTitle:UCLocalize("SOURCES") forOperation:list.ReadMainList()])
- return;
-
sources_ = [NSMutableArray arrayWithCapacity:16];
[sources_ addObjectsFromArray:[database_ sources]];
_trace();
}
}
+- (void) _uicache {
+ _trace();
+ system("su -c /usr/bin/uicache mobile");
+ _trace();
+}
+
+- (void) uicache {
+ UIProgressHUD *hud([self addProgressHUD]);
+ [hud setText:UCLocalize("LOADING")];
+ [self yieldToSelector:@selector(_uicache)];
+ [self removeProgressHUD:hud];
+}
+
- (void) perform_ {
[database_ perform];
[self performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:YES];
+ [self performSelectorOnMainThread:@selector(uicache) withObject:nil waitUntilDone:YES];
}
- (void) confirmWithNavigationController:(UINavigationController *)navigation {