summaryrefslogtreecommitdiff
path: root/MobileCydia.mm
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2014-05-17 01:51:07 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2014-05-17 01:51:07 -0700
commit81bf46849a82a9e7fa6e27cea6d506dd1e567d65 (patch)
treeffc866378dd9b4f64104e24c79cc62800d011b8f /MobileCydia.mm
parentac5f7cb30c6a09d809e2d9fea2824b100c8093d4 (diff)
Calculate last-update time for installed packages.
Diffstat (limited to 'MobileCydia.mm')
-rw-r--r--MobileCydia.mm17
1 files changed, 13 insertions, 4 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index e207fa3..386ac11 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -1970,6 +1970,7 @@ struct ParsedPackage {
CYString latest_;
CYString installed_;
+ time_t updated_;
const char *section_;
_transient NSString *section$_;
@@ -2458,13 +2459,21 @@ struct PackageNameOrdering :
_profile(Package$initWithVersion$Metadata)
const char *mixed(iterator.Name());
size_t size(strlen(mixed));
- char lower[size + 1];
+ static const size_t prefix(sizeof("/var/lib/dpkg/info/") - 1);
+ char lower[prefix + size + 5 + 1];
for (size_t i(0); i != size; ++i)
- lower[i] = mixed[i] | 0x20;
- lower[size] = '\0';
+ lower[prefix + i] = mixed[i] | 0x20;
+
+ if (!installed_.empty()) {
+ memcpy(lower, "/var/lib/dpkg/info/", prefix);
+ memcpy(lower + prefix + size, ".list", 6);
+ struct stat info;
+ if (stat(lower, &info) != -1)
+ updated_ = info.st_birthtime;
+ }
- PackageValue *metadata(PackageFind(lower, size));
+ PackageValue *metadata(PackageFind(lower + prefix, size));
metadata_ = metadata;
id_.set(NULL, metadata->name_, size);