summaryrefslogtreecommitdiff
path: root/MobileCydia.mm
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2011-04-02 00:43:13 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2011-04-02 00:43:13 -0700
commit2b49cff9c356b460efefc1786a13002ad5f028c5 (patch)
treee7b68e40f9edf9db81366e3372a8046b27b3866a /MobileCydia.mm
parent17c763ff9de9b6a9051415b4cd56da5d55d51548 (diff)
Reorganize cache_.Open() to not lose errors.
Diffstat (limited to 'MobileCydia.mm')
-rw-r--r--MobileCydia.mm45
1 files changed, 27 insertions, 18 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 1ec3187..ea858e9 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -3555,27 +3555,36 @@ class CydiaLogCleaner :
_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();