From 419a9efd76f3a3b3065ef2c2a7f093ce8c6973a5 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Wed, 5 Aug 2009 22:04:13 +0000 Subject: [PATCH] Checkpoint. --- Cydia.app/Icon-Small.png | Bin 0 -> 5109 bytes Cydia.mm | 145 +++++++++++++++++++++++---------------- control | 2 +- 3 files changed, 87 insertions(+), 60 deletions(-) create mode 100644 Cydia.app/Icon-Small.png diff --git a/Cydia.app/Icon-Small.png b/Cydia.app/Icon-Small.png new file mode 100644 index 0000000000000000000000000000000000000000..9d591e73f8f4319ffa38b64ef5e38501dc6a9417 GIT binary patch literal 5109 zcmVOz@Z0f2-7z;ux~O9+4z06=<WDR*FRcSTFz- zW=q650N5=6FiBTtNC2?60Km==3$g$R3;-}uh=nNt1bYBr$Ri_o0EC$U6h`t_Jn<{8 z5a%iY0C<_QJh>z}MS)ugEpZ1|S1ukX&Pf+56gFW3VVXcL!g-k)GJ!M?;PcD?0HBc- z5#WRK{dmp}uFlRjj{U%*%WZ25jX z{P*?XzTzZ-GF^d31o+^>%=Ap99M6&ogks$0k4OBs3;+Bb(;~!4V!2o<6ys46agIcq zjPo+3B8fthDa9qy|77CdEc*jK-!%ZRYCZvbku9iQV*~a}ClFY4z~c7+0P?$U!PF=S z1Au6Q;m>#f??3%Vpd|o+W=WE9003S@Bra6Svp>fO002awfhw>;8}z{#EWidF!3EsG z3;bXU&9EIRU@z1_9W=mEXoiz;4lcq~xDGvV5BgyU zp1~-*fe8db$Osc*A=-!mVv1NJjtCc-h4>-CNCXm#Bp}I%6j35eku^v$Qi@a{RY)E3 zJ#qp$hg?Rwkvqr$GJ^buyhkyVfwECO)C{#lxu`c9ghrwZ&}4KmnvWKso6vH!8a<3Q zq36)6Xb;+tK10Vaz~~qUGsJ8#F2=(`u{bOVlVi)VBCHIn#u~6ztOL7=^<&SmcLWlF zMZgI*1b0FpVIDz9SWH+>*hr`#93(Um+6gxa1B6k+CnA%mOSC4s5&6UzVlpv@SV$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k*V38RBClbr#G@?_W|Z#c#cl1NuFf@$h%aWZfhic09zb3uh?TMwr;RiA@jhp~!L&pp@d#&pgAz z>+|GEic%V_6j};GB~d#kYERb!GpB?=DoI!hv3X9tG0Nj#e3nZm-(vOlb(WW|P_9&1 zzhyhimoM<(`#wl@be!7g7`HE9;P^{Nxq9YLB>g@|zVa_@+jD@Q{`Y^9M18EYIA_6o zln|(06ZNMnM$Ls`NV!}dzL8R}a(#&%2j zTDwPU`3@IP9cSg*RXWWTl4yW)j(E_gC@gUl{XZ!>>vf@mzE&E9Kx<7EH|=8bt4UVoLKRAy)n^|5(|D{{OCsT6V4r&Oupy{E`?j0q@LDsqmg5W-y3Y0Ne zTcDLDOB3)OJlLY3C~}mP7-PuNgmSHRA6PwUn&w34^y(CoX;q{IBco+sk zDv8n>@h9A&^T&mZwOm$ciGr zv(~+Pb)_{QrP+_2_h;V~1<=4Y0lR>ScRv>J9?%bw^lw-E?U?^Nb3F-g&BIxs1NgrJ Xp;V9brqtHq00000NkvXXu0mjfni#X# literal 0 HcmV?d00001 diff --git a/Cydia.mm b/Cydia.mm index bafa5e97..ff2a8120 100644 --- a/Cydia.mm +++ b/Cydia.mm @@ -1412,6 +1412,8 @@ typedef std::map< unsigned long, _H > SourceMap; - (void) upgrade; - (void) update; +- (void) setVisible; + - (NSString *) updateWithStatus:(Status &)status; - (void) setDelegate:(id)delegate; @@ -1490,6 +1492,11 @@ typedef std::map< unsigned long, _H > SourceMap; [host_ release]; host_ = nil; } + + if (authority_ != nil) { + [authority_ release]; + authority_ = nil; + } } - (void) dealloc { @@ -1557,7 +1564,16 @@ typedef std::map< unsigned long, _H > SourceMap; if (record_ != nil) record_ = [record_ retain]; - host_ = [[[[NSURL URLWithString:uri_] host] lowercaseString] retain]; + NSURL *url([NSURL URLWithString:uri_]); + + host_ = [url host]; + if (host_ != nil) + host_ = [[host_ lowercaseString] retain]; + + if (host_ != nil) + authority_ = [host_ retain]; + else + authority_ = [url path]; } - (Source *) initWithMetaIndex:(metaIndex *)index inPool:(apr_pool_t *)pool { @@ -1626,7 +1642,7 @@ typedef std::map< unsigned long, _H > SourceMap; } - (NSString *) name { - return origin_.empty() ? host_ : origin_; + return origin_.empty() ? authority_ : origin_; } - (NSString *) description { @@ -1634,7 +1650,7 @@ typedef std::map< unsigned long, _H > SourceMap; } - (NSString *) label { - return label_.empty() ? host_ : label_; + return label_.empty() ? authority_ : label_; } - (NSString *) origin { @@ -1703,6 +1719,7 @@ typedef std::map< unsigned long, _H > SourceMap; CYString section_; NSString *section$_; bool essential_; + bool required_; bool visible_; NSString *latest_; @@ -1721,6 +1738,7 @@ typedef std::map< unsigned long, _H > SourceMap; CYString author_; Address *author$_; + CYString bugs_; CYString support_; NSMutableArray *tags_; NSString *role_; @@ -1775,6 +1793,8 @@ typedef std::map< unsigned long, _H > SourceMap; - (BOOL) hasMode; - (NSString *) mode; +- (void) setVisible; + - (NSString *) id; - (NSString *) name; - (UIImage *) icon; @@ -2018,6 +2038,7 @@ struct PackageNameOrdering : {"depiction", &depiction_}, {"homepage", &homepage_}, {"website", &website}, + {"bugs", &bugs_}, {"support", &support_}, {"sponsor", &sponsor_}, {"author", &author_}, @@ -2056,6 +2077,10 @@ struct PackageNameOrdering : _end } +- (void) setVisible { + visible_ = required_ && [self hasSupportingRole] && [self unfiltered]; +} + - (Package *) initWithVersion:(pkgCache::VerIterator)version withZone:(NSZone *)zone inPool:(apr_pool_t *)pool database:(Database *)database { if ((self = [super init]) != nil) { _profile(Package$initWithVersion) @@ -2099,7 +2124,7 @@ struct PackageNameOrdering : _end } - visible_ = true; + required_ = true; _profile(Package$initWithVersion$Tags) pkgCache::TagIterator tag(iterator_.TagList()); @@ -2110,10 +2135,10 @@ struct PackageNameOrdering : [tags_ addObject:(NSString *)CFCString(name)]; if (role_ == nil && strncmp(name, "role::", 6) == 0 /*&& strcmp(name, "role::leaper") != 0*/) role_ = (NSString *) CFCString(name + 6); - if (visible_ && strncmp(name, "require::", 9) == 0 && ( + if (required_ && strncmp(name, "require::", 9) == 0 && ( true )) - visible_ = false; + required_ = false; ++tag; } while (!tag.end()); } @@ -2174,7 +2199,7 @@ struct PackageNameOrdering : _end essential_ = ((iterator_->Flags & pkgCache::Flag::Essential) == 0 ? NO : YES) || [self hasTag:@"cydia::essential"]; - visible_ = visible_ && [self hasSupportingRole] && [self unfiltered]; + [self setVisible]; } _end } return self; } @@ -2465,7 +2490,7 @@ struct PackageNameOrdering : } - (NSString *) support { - return !support_.empty() ? support_ : [[self source] supportForPackage:id_]; + return !bugs_.empty() ? bugs_ : [[self source] supportForPackage:id_]; } - (NSArray *) files { @@ -2506,6 +2531,7 @@ struct PackageNameOrdering : if (strcmp(name, "cydia") != 0) { bool cydia = false; + bool user = false; bool _private = false; bool stash = false; @@ -2515,6 +2541,8 @@ struct PackageNameOrdering : for (NSString *file in files) if (!cydia && [file isEqualToString:@"/Applications/Cydia.app"]) cydia = true; + else if (!user && [file isEqualToString:@"/User"]) + user = true; else if (!_private && [file isEqualToString:@"/private"]) _private = true; else if (!stash && [file isEqualToString:@"/var/stash"]) @@ -2523,6 +2551,8 @@ struct PackageNameOrdering : /* XXX: this is not sensitive enough. only some folders are valid. */ if (cydia && !repository) [warnings addObject:[NSString stringWithFormat:UCLocalize("FILES_INSTALLED_TO"), @"Cydia.app"]]; + if (user) + [warnings addObject:[NSString stringWithFormat:UCLocalize("FILES_INSTALLED_TO"), @"/User"]]; if (_private) [warnings addObject:[NSString stringWithFormat:UCLocalize("FILES_INSTALLED_TO"), @"/private"]]; if (stash) @@ -3414,6 +3444,11 @@ static NSArray *Finishes_; [self updateWithStatus:status_]; } +- (void) setVisible { + for (Package *package in packages_) + [package setVisible]; +} + - (NSString *) updateWithStatus:(Status &)status { pkgSourceList list; _assert(list.ReadMainList()); @@ -3421,7 +3456,7 @@ static NSArray *Finishes_; FileFd lock; lock.Fd(GetLock(_config->FindDir("Dir::State::Lists") + "lock")); - if (_error->PendingError()) { + if (_error->PendingError()) error: { std::string error; if (!_error->PopMessage(error)) _assert(false); @@ -3429,25 +3464,11 @@ static NSArray *Finishes_; return [NSString stringWithUTF8String:error.c_str()]; } - pkgAcquire fetcher(&status); - _assert(list.GetIndexes(&fetcher)); - - if (fetcher.Run(PulseInterval_) != pkgAcquire::Failed) { - bool failed = false; - for (pkgAcquire::ItemIterator item = fetcher.ItemsBegin(); item != fetcher.ItemsEnd(); item++) - if ((*item)->Status != pkgAcquire::Item::StatDone) { - (*item)->Finished(); - failed = true; - } - - if (!failed && _config->FindB("APT::Get::List-Cleanup", true) == true) { - _assert(fetcher.Clean(_config->FindDir("Dir::State::lists"))); - _assert(fetcher.Clean(_config->FindDir("Dir::State::lists") + "partial/")); - } + if (!ListUpdate(status, list, PulseInterval_)) + goto error; - [Metadata_ setObject:[NSDate date] forKey:@"LastUpdate"]; - Changed_ = true; - } + [Metadata_ setObject:[NSDate date] forKey:@"LastUpdate"]; + Changed_ = true; return nil; } @@ -5844,6 +5865,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { href_ = href; href_ = [href_ retain]; + trivial_bz2_ = [[self _requestHRef:[href_ stringByAppendingString:@"Packages"] method:@"HEAD"] retain]; trivial_bz2_ = [[self _requestHRef:[href_ stringByAppendingString:@"Packages.bz2"] method:@"HEAD"] retain]; trivial_gz_ = [[self _requestHRef:[href_ stringByAppendingString:@"Packages.gz"] method:@"HEAD"] retain]; //trivial_bz2_ = [[self _requestHRef:[href stringByAppendingString:@"dists/Release"] method:@"HEAD"] retain]; @@ -7556,6 +7578,39 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { } } +- (void) _saveConfig { + if (Changed_) { + _trace(); + NSString *error(nil); + if (NSData *data = [NSPropertyListSerialization dataFromPropertyList:Metadata_ format:NSPropertyListBinaryFormat_v1_0 errorDescription:&error]) { + _trace(); + NSError *error(nil); + if (![data writeToFile:@"/var/lib/cydia/metadata.plist" options:NSAtomicWrite error:&error]) + NSLog(@"failure to save metadata data: %@", error); + _trace(); + } else { + NSLog(@"failure to serialize metadata: %@", error); + return; + } + + Changed_ = false; + } +} + +- (void) _updateData { + [self _saveConfig]; + + /* XXX: this is just stupid */ + if (tag_ != 2 && sections_ != nil) + [sections_ reloadData]; + if (tag_ != 3 && changes_ != nil) + [changes_ reloadData]; + if (tag_ != 5 && search_ != nil) + [search_ reloadData]; + + [book_ reloadData]; +} + - (void) _reloadData { UIView *block(); @@ -7607,7 +7662,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { Queuing_ = false; [buttonbar_ setBadgeValue:nil forButton:4]; - [self updateData]; + [self _updateData]; // XXX: what is this line of code for? if ([packages count] == 0); @@ -7626,37 +7681,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { } } -- (void) _saveConfig { - if (Changed_) { - _trace(); - NSString *error(nil); - if (NSData *data = [NSPropertyListSerialization dataFromPropertyList:Metadata_ format:NSPropertyListBinaryFormat_v1_0 errorDescription:&error]) { - _trace(); - NSError *error(nil); - if (![data writeToFile:@"/var/lib/cydia/metadata.plist" options:NSAtomicWrite error:&error]) - NSLog(@"failure to save metadata data: %@", error); - _trace(); - } else { - NSLog(@"failure to serialize metadata: %@", error); - return; - } - - Changed_ = false; - } -} - - (void) updateData { - [self _saveConfig]; - - /* XXX: this is just stupid */ - if (tag_ != 2 && sections_ != nil) - [sections_ reloadData]; - if (tag_ != 3 && changes_ != nil) - [changes_ reloadData]; - if (tag_ != 5 && search_ != nil) - [search_ reloadData]; - - [book_ reloadData]; + [database_ setVisible]; + [self _updateData]; } - (void) update_ { @@ -8650,7 +8677,7 @@ int main(int argc, char *argv[]) { _pooled if (lang != NULL) _config->Set("APT::Acquire::Translation", lang); _config->Set("Acquire::http::Timeout", 15); - _config->Set("Acquire::http::MaxParallel", 4); + _config->Set("Acquire::http::MaxParallel", 3); /* Color Choices {{{ */ space_ = CGColorSpaceCreateDeviceRGB(); diff --git a/control b/control index 6b1e1bea..ed48a2c2 100644 --- a/control +++ b/control @@ -3,7 +3,7 @@ Priority: required Section: Packaging Maintainer: Jay Freeman (saurik) Architecture: iphoneos-arm -Version: 1.0.2944-1 +Version: 1.0.2978-1 Replaces: com.sosiphone.addcydia Depends: apr-lib, apt7-lib, apt7-key, darwintools, pcre, shell-cmds, system-cmds Pre-Depends: dpkg (>= 1.14.25-8) -- 2.47.2