]> git.saurik.com Git - cydia.git/commitdiff
Totally obsolete and replace the old source packages.
authorJay Freeman (saurik) <saurik@saurik.com>
Thu, 10 Mar 2011 06:10:37 +0000 (22:10 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 10 Mar 2011 06:10:37 +0000 (22:10 -0800)
MobileCydia.mm
Sources.list/saurik.list [new file with mode: 0644]
Trusted.gpg/bigboss.gpg [new file with mode: 0644]
Trusted.gpg/modmyi.gpg [new file with mode: 0644]
Trusted.gpg/saurik.gpg [new file with mode: 0644]
Trusted.gpg/zodttd.gpg [new file with mode: 0644]
cydia.control
makefile

index 7f784dbedf37e83f7265e7410343eafd197c8804..de34030badb12104fcc090a1f639410200c035bc 100644 (file)
@@ -700,6 +700,8 @@ static _transient NSMutableDictionary *Packages_;
 static _transient NSMutableDictionary *Values_;
 static _transient NSMutableDictionary *Sections_;
 static _transient NSMutableDictionary *Sources_;
+static _transient NSNumber *Version_;
+static _transient _H<NSString> CydiaSource_;
 static bool Changed_;
 static time_t now_;
 
@@ -721,6 +723,45 @@ static NSString *kCydiaProgressEventTypeStatus = @"Status";
 static NSString *kCydiaProgressEventTypeWarning = @"Warning";
 /* }}} */
 
+static void AddSource(NSDictionary *source) {
+    [Sources_ setObject:source forKey:[NSString stringWithFormat:@"%@:%@:%@", [source objectForKey:@"Type"], [source objectForKey:@"URI"], [source objectForKey:@"Distribution"]]];
+    Changed_ = true;
+}
+
+static void AddSource(NSString *href, NSString *distribution, NSArray *sections = nil) {
+    AddSource([NSMutableDictionary dictionaryWithObjectsAndKeys:
+        @"deb", @"Type",
+        href, @"URI",
+        distribution, @"Distribution",
+        sections ?: [NSMutableArray array], @"Sections",
+    nil]);
+}
+
+static void WriteSources() {
+    FILE *file(fopen("/etc/apt/sources.list.d/cydia.list", "w"));
+    _assert(file != NULL);
+
+    fprintf(file, "deb http://%s/ tangelo main\n",
+        [CydiaSource_ UTF8String]
+    );
+
+    for (NSString *key in [Sources_ allKeys]) {
+        NSDictionary *source([Sources_ objectForKey:key]);
+
+        NSArray *sections([source objectForKey:@"Sections"] ?: [NSArray array]);
+
+        fprintf(file, "%s %s %s%s%s\n",
+            [[source objectForKey:@"Type"] UTF8String],
+            [[source objectForKey:@"URI"] UTF8String],
+            [[source objectForKey:@"Distribution"] UTF8String],
+            [sections count] == 0 ? "" : " ",
+            [[sections componentsJoinedByString:@" "] UTF8String]
+        );
+    }
+
+    fclose(file);
+}
+
 /* Display Helpers {{{ */
 inline float Interpolate(float begin, float end, float fraction) {
     return (end - begin) * fraction + begin;
@@ -842,6 +883,7 @@ static NSString *CYHex(NSData *data, bool reverse = false) {
 - (void) loadData;
 - (void) updateData;
 - (void) syncData;
+- (void) addSource:(NSDictionary *)source;
 - (void) addTrivialSource:(NSString *)href;
 - (void) showSettings;
 - (UIProgressHUD *) addProgressHUD;
@@ -1335,6 +1377,22 @@ static void PackageImport(const void *key, const void *value, void *context) {
     authority_ = nil;
 }
 
++ (NSString *) webScriptNameForSelector:(SEL)selector {
+    if (false);
+    else if (selector == @selector(addSection:))
+        return @"addSection";
+    else if (selector == @selector(removeSection:))
+        return @"removeSection";
+    else if (selector == @selector(remove))
+        return @"remove";
+    else
+        return nil;
+}
+
++ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector {
+    return [self webScriptNameForSelector:selector] == nil;
+}
+
 + (NSArray *) _attributeKeys {
     return [NSArray arrayWithObjects:
         @"distribution",
@@ -1343,6 +1401,7 @@ static void PackageImport(const void *key, const void *value, void *context) {
         @"label",
         @"name",
         @"origin",
+        @"sections",
         @"shortDescription",
         @"trusted",
         @"type",
@@ -1456,6 +1515,62 @@ static void PackageImport(const void *key, const void *value, void *context) {
     return support_.empty() ? nil : [static_cast<id>(support_) stringByReplacingOccurrencesOfString:@"*" withString:package];
 }
 
+- (NSArray *) sections {
+    return record_ == nil ? (id) [NSNull null] : [record_ objectForKey:@"Sections"] ?: [NSArray array];
+}
+
+- (void) _addSection:(NSString *)section {
+    if (record_ == nil)
+        return;
+    else if (NSMutableArray *sections = [record_ objectForKey:@"Sections"]) {
+        if (![sections containsObject:section]) {
+            [sections addObject:section];
+            Changed_ = true;
+        }
+    } else {
+        [record_ setObject:[NSMutableArray arrayWithObject:section] forKey:@"Sections"];
+        Changed_ = true;
+    }
+}
+
+- (bool) addSection:(NSString *)section {
+    if (record_ == nil)
+        return false;
+
+    [self performSelectorOnMainThread:@selector(_addSection:) withObject:section waitUntilDone:NO];
+    return true;
+}
+
+- (void) _removeSection:(NSString *)section {
+    if (record_ == nil)
+        return;
+
+    if (NSMutableArray *sections = [record_ objectForKey:@"Sections"])
+        if ([sections containsObject:section]) {
+            [sections removeObject:section];
+            Changed_ = true;
+        }
+}
+
+- (bool) removeSection:(NSString *)section {
+    if (record_ == nil)
+        return false;
+
+    [self performSelectorOnMainThread:@selector(_removeSection:) withObject:section waitUntilDone:NO];
+    return true;
+}
+
+- (void) _remove {
+    [Sources_ removeObjectForKey:[self key]];
+    Changed_ = true;
+}
+
+- (bool) remove {
+    bool value(record_ != nil);
+    [self performSelectorOnMainThread:@selector(_remove) withObject:nil waitUntilDone:NO];
+    return value;
+}
+
 - (NSDictionary *) record {
     return record_;
 }
@@ -3769,6 +3884,7 @@ static _H<NSMutableSet> Diversions_;
 + (NSArray *) _attributeKeys {
     return [NSArray arrayWithObjects:
         @"bbsnum",
+        @"cydiaSource",
         @"device",
         @"ecid",
         @"firmware",
@@ -3849,6 +3965,8 @@ static _H<NSMutableSet> Diversions_;
         return @"addInternalRedirect";
     else if (selector == @selector(addPipelinedHost:scheme:))
         return @"addPipelinedHost";
+    else if (selector == @selector(addSource:::))
+        return @"addSource";
     else if (selector == @selector(addTokenHost:))
         return @"addTokenHost";
     else if (selector == @selector(addTrivialSource:))
@@ -3889,6 +4007,10 @@ static _H<NSMutableSet> Diversions_;
         return @"refreshSources";
     else if (selector == @selector(removeButton))
         return @"removeButton";
+    else if (selector == @selector(saveConfig))
+        return @"saveConfig";
+    else if (selector == @selector(setCydiaSource:))
+        return @"setCydiaSource";
     else if (selector == @selector(setMetadataValue::))
         return @"setMetadataValue";
     else if (selector == @selector(setSessionValue::))
@@ -3991,6 +4113,25 @@ static _H<NSMutableSet> Diversions_;
     return value;
 }
 
+- (void) _setCydiaSource:(NSString *)source {
+    @synchronized (HostConfig_) {
+        CydiaSource_ = source;
+        [Metadata_ setObject:source forKey:@"CydiaSource"];
+    }
+
+    Changed_ = true;
+}
+
+- (void) setCydiaSource:(NSString *)source {
+    [self performSelectorOnMainThread:@selector(_setCydiaSource:) withObject:source waitUntilDone:NO];
+}
+
+- (NSString *) cydiaSource {
+    @synchronized (HostConfig_) {
+        return (id) CydiaSource_ ?: [NSNull null];
+    }
+}
+
 - (id) getMetadataValue:(NSString *)key {
 @synchronized (Values_) {
     return [Values_ objectForKey:key];
@@ -3998,7 +4139,7 @@ static _H<NSMutableSet> Diversions_;
 
 - (void) setMetadataValue:(NSString *)key :(NSString *)value {
 @synchronized (Values_) {
-    if (value == (id) [WebUndefined undefined])
+    if (value == nil || value == (id) [WebUndefined undefined] || value == (id) [NSNull null])
         [Values_ removeObjectForKey:key];
     else
         [Values_ setObject:value forKey:key];
@@ -4048,6 +4189,20 @@ static _H<NSMutableSet> Diversions_;
     [indirect_ performSelectorOnMainThread:@selector(popViewControllerWithNumber:) withObject:value waitUntilDone:NO];
 }
 
+- (void) addSource:(NSString *)href :(NSString *)distribution :(WebScriptObject *)sections {
+    NSMutableArray *array([NSMutableArray arrayWithCapacity:[sections count]]);
+
+    for (NSString *section in sections)
+        [array addObject:section];
+
+    [delegate_ performSelectorOnMainThread:@selector(addSource:) withObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:
+        @"deb", @"Type",
+        href, @"URI",
+        distribution, @"Distribution",
+        array, @"Sections",
+    nil] waitUntilDone:NO];
+}
+
 - (void) addTrivialSource:(NSString *)href {
     [delegate_ performSelectorOnMainThread:@selector(addTrivialSource:) withObject:href waitUntilDone:NO];
 }
@@ -4056,6 +4211,10 @@ static _H<NSMutableSet> Diversions_;
     [delegate_ performSelectorOnMainThread:@selector(syncData) withObject:nil waitUntilDone:NO];
 }
 
+- (void) saveConfig {
+    [delegate_ performSelectorOnMainThread:@selector(_saveConfig) withObject:nil waitUntilDone:NO];
+}
+
 - (NSArray *) getAllSources {
     return [[Database sharedInstance] sources];
 }
@@ -8701,6 +8860,8 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
             NSLog(@"failure to serialize metadata: %@", error);
         }
     }
+
+    WriteSources();
 }
 
 // Navigation controller for the queuing badge.
@@ -8715,7 +8876,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 
 - (void) _updateData {
     [self _saveConfig];
-
     [self unloadData];
 
     UINavigationController *navigation = [self queueNavigationController];
@@ -8895,33 +9055,19 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 
 - (void) syncData {
     [self _saveConfig];
+    [self detachNewProgressSelector:@selector(update_) toTarget:self forController:nil title:@"UPDATING_SOURCES"];
+}
 
-    FILE *file(fopen("/etc/apt/sources.list.d/cydia.list", "w"));
-    _assert(file != NULL);
-
-    for (NSString *key in [Sources_ allKeys]) {
-        NSDictionary *source([Sources_ objectForKey:key]);
-
-        fprintf(file, "%s %s %s\n",
-            [[source objectForKey:@"Type"] UTF8String],
-            [[source objectForKey:@"URI"] UTF8String],
-            [[source objectForKey:@"Distribution"] UTF8String]
-        );
-    }
-
-    fclose(file);
+- (void) addSource:(NSDictionary *) source {
+    AddSource(source);
+}
 
-    [self detachNewProgressSelector:@selector(update_) toTarget:self forController:nil title:@"UPDATING_SOURCES"];
+- (void) addSource:(NSString *)href withDistribution:(NSString *)distribution andSections:(NSArray *)sections {
+    AddSource(href, distribution, sections);
 }
 
 - (void) addTrivialSource:(NSString *)href {
-    [Sources_ setObject:[NSDictionary dictionaryWithObjectsAndKeys:
-        @"deb", @"Type",
-        href, @"URI",
-        @"./", @"Distribution",
-    nil] forKey:[NSString stringWithFormat:@"deb:%@:./", href]];
-
-    Changed_ = true;
+    AddSource(href, @"./");
 }
 
 - (void) updateValues {
@@ -9894,7 +10040,7 @@ int main(int argc, char *argv[]) {
     ChipID_ = [CYHex((NSData *) CYIOGetValue("IODeviceTree:/chosen", @"unique-chip-id"), true) uppercaseString];
     BBSNum_ = CYHex((NSData *) CYIOGetValue("IOService:/AppleARMPE/baseband", @"snum"), false);
 
-    UniqueID_ = [[UIDevice currentDevice] uniqueIdentifier];
+    UniqueID_ = [device uniqueIdentifier];
 
     CFStringRef (*$CTSIMSupportCopyMobileSubscriberCountryCode)(CFAllocatorRef);
     $CTSIMSupportCopyMobileSubscriberCountryCode = reinterpret_cast<CFStringRef (*)(CFAllocatorRef)>(dlsym(RTLD_DEFAULT, "CTSIMSupportCopyMobileSubscriberCountryCode"));
@@ -9937,6 +10083,12 @@ int main(int argc, char *argv[]) {
         Sources_ = [Metadata_ objectForKey:@"Sources"];
 
         Token_ = [Metadata_ objectForKey:@"Token"];
+
+        Version_ = [Metadata_ objectForKey:@"Version"];
+
+        @synchronized (HostConfig_) {
+            CydiaSource_ = [Metadata_ objectForKey:@"CydiaSource"];
+        }
     }
 
     if (Settings_ != nil)
@@ -9956,8 +10108,34 @@ int main(int argc, char *argv[]) {
         Sources_ = [[[NSMutableDictionary alloc] initWithCapacity:0] autorelease];
         [Metadata_ setObject:Sources_ forKey:@"Sources"];
     }
+
+    if (Version_ == nil) {
+        Version_ = [NSNumber numberWithUnsignedInt:0];
+        [Metadata_ setObject:Version_ forKey:@"Version"];
+    }
+
+    @synchronized (HostConfig_) {
+        if (CydiaSource_ == nil) {
+            CydiaSource_ = @"apt.saurik.com";
+            [Metadata_ setObject:CydiaSource_ forKey:@"CydiaSource"];
+        }
+    }
+
+    if ([Version_ unsignedIntValue] == 0) {
+        AddSource(@"http://apt.thebigboss.org/repofiles/cydia/", @"stable", [NSMutableArray arrayWithObject:@"main"]);
+        AddSource(@"http://apt.modmyi.com/", @"stable", [NSMutableArray arrayWithObject:@"main"]);
+        AddSource(@"http://cydia.zodttd.com/repo/cydia/", @"stable", [NSMutableArray arrayWithObject:@"main"]);
+        AddSource(@"http://repo666.ultrasn0w.com/", @"./");
+
+        Version_ = [NSNumber numberWithUnsignedInt:1];
+        [Metadata_ setObject:Version_ forKey:@"Version"];
+
+        Changed_ = true;
+    }
     /* }}} */
 
+    WriteSources();
+
     _trace();
     MetaFile_.Open("/var/lib/cydia/metadata.cb0");
     _trace();
diff --git a/Sources.list/saurik.list b/Sources.list/saurik.list
new file mode 100644 (file)
index 0000000..a639f78
--- /dev/null
@@ -0,0 +1,2 @@
+# DO NOT EDIT | This is the story of a time long ago, A time of myth and legend, when the Earth was still young.
+# The ancient gods were petty and cruel, and they plagued mankind with suffering and beseiged them with terrors. 
diff --git a/Trusted.gpg/bigboss.gpg b/Trusted.gpg/bigboss.gpg
new file mode 100644 (file)
index 0000000..abaa254
Binary files /dev/null and b/Trusted.gpg/bigboss.gpg differ
diff --git a/Trusted.gpg/modmyi.gpg b/Trusted.gpg/modmyi.gpg
new file mode 100644 (file)
index 0000000..0e85663
Binary files /dev/null and b/Trusted.gpg/modmyi.gpg differ
diff --git a/Trusted.gpg/saurik.gpg b/Trusted.gpg/saurik.gpg
new file mode 100644 (file)
index 0000000..520c5e7
Binary files /dev/null and b/Trusted.gpg/saurik.gpg differ
diff --git a/Trusted.gpg/zodttd.gpg b/Trusted.gpg/zodttd.gpg
new file mode 100644 (file)
index 0000000..a9812b5
Binary files /dev/null and b/Trusted.gpg/zodttd.gpg differ
index c32b9129ecf2a12988bbf8e6197673be5f2c9e51..bb69a9a6b2269512fdcc3590a52ab591a35e3ebf 100644 (file)
@@ -4,12 +4,13 @@ Section: Packaging
 Maintainer: Jay Freeman (saurik) <saurik@saurik.com>
 Architecture: iphoneos-arm
 Version: 
-Replaces: com.sosiphone.addcydia
-Depends: apr-lib, apt7-lib, apt7-key, cydia-lproj, darwintools, pcre, sed, shell-cmds, system-cmds, uikittools (>= 1.1.0)
-Pre-Depends: dpkg (>= 1.14.25-8)
-Conflicts: com.sosiphone.addcydia
+Replaces: bigboss, com.sosiphone.addcydia, cydia-sources, ispazio.net, modmyifone, saurik, ste, yellowsn0w.com, zodttd
+Depends: apr-lib, apt7-lib, apt7-key, cydia-lproj, darwintools, debianutils, pcre, sed, shell-cmds, system-cmds, uikittools (>= 1.1.0)
+Conflicts: bigboss, com.sosiphone.addcydia, cydia-sources, ispazio.net, modmyifone, ste, yellowsn0w.com, zodttd
+Pre-Depends: debianutils
+Provides: cydia-sources
 Description: graphical iPhone front-end for APT
 Name: Cydia Installer
 Author: Jay Freeman (saurik) <saurik@saurik.com>
 Depiction: http://cydia.saurik.com/info/cydia/
-Tag: purpose::uikit, cydia::essential, role::enduser
+Tag: purpose::uikit, role::enduser
index 80a8fd2ab021a369fd82167f3463306c4392ffbd..8be707e4d8ce1e7b3f00bf68c297e78a7f39a712 100644 (file)
--- a/makefile
+++ b/makefile
@@ -129,10 +129,14 @@ MobileCydia: sysroot $(object)
 CydiaAppliance: CydiaAppliance.mm
        $(cycc) $(filter %.mm,$^) $(flags) -bundle $(link) $(backrow)
 
-debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia $(images) $(shell find MobileCydia.app)
+debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia $(images) $(shell find MobileCydia.app) cydia.control
        sudo rm -rf _
        mkdir -p _/var/lib/cydia
        
+       mkdir -p _/etc/apt
+       cp -a Trusted.gpg _/etc/apt/trusted.gpg.d
+       cp -a Sources.list _/etc/apt/sources.list.d
+       
        mkdir -p _/usr/libexec
        cp -a Library _/usr/libexec/cydia
        cp -a sysroot/usr/bin/du _/usr/libexec/cydia
@@ -169,7 +173,7 @@ debs/cydia_$(version)_iphoneos-arm.deb: MobileCydia $(images) $(shell find Mobil
        $(dpkg) -b _ Cydia.deb
        @echo "$$(stat -L -f "%z" Cydia.deb) $$(stat -f "%Y" Cydia.deb)"
 
-$(lproj_deb): $(shell find MobileCydia.app -name '*.strings')
+$(lproj_deb): $(shell find MobileCydia.app -name '*.strings') cydia-lproj.control
        sudo rm -rf __
        mkdir -p __/Applications/Cydia.app