diff --git a/Autoupdate/SUPipedUnarchiver.m b/Autoupdate/SUPipedUnarchiver.m index ba55ea37..78d040e6 100644 --- a/Autoupdate/SUPipedUnarchiver.m +++ b/Autoupdate/SUPipedUnarchiver.m @@ -27,8 +27,8 @@ static NSArray * _Nullable _commandAndArgumentsConformingToTypeOfPa NSArray *extractTXZ = extractTGZ; // Note: keep this list in sync with generate_appcast's unarchiveUpdates() - NSDictionary *> *extractCommandDictionary = - @{ + NSMutableDictionary *> *extractCommandDictionary = + [@{ @".zip" : @[@"/usr/bin/ditto", @"-x",@"-k",@"-"], @".tar" : @[@"/usr/bin/tar", @"-xC"], @".tar.gz" : extractTGZ, @@ -37,8 +37,28 @@ static NSArray * _Nullable _commandAndArgumentsConformingToTypeOfPa @".tbz" : extractTBZ, @".tar.xz" : extractTXZ, @".txz" : extractTXZ, - @".tar.lzma" : extractTXZ - }; + @".tar.lzma" : extractTXZ, + } mutableCopy]; + + // At least the latest versions of 10.15 understand how to extract aar files + // Versions before 10.15 do not understand extracting newly created aar files + // Note encrypted aea files are supported in macOS 12 onwards, if we ever want to support those one day + if (@available(macOS 10.15.7, *)) { + NSString *appleArchiveCommand; + if (@available(macOS 11, *)) { + appleArchiveCommand = @"/usr/bin/aa"; + } else { + // In 10.15 the utility was named yaa, which was later renamed to aar + appleArchiveCommand = @"/usr/bin/yaa"; + } + + NSArray *extractAppleArchive = @[appleArchiveCommand, @"extract", @"-d"]; + + [extractCommandDictionary addEntriesFromDictionary:@{ + @".aar" : extractAppleArchive, + @".yaa" : extractAppleArchive, + }]; + } NSString *lastPathComponent = [path lastPathComponent]; for (NSString *currentType in extractCommandDictionary) @@ -93,10 +113,12 @@ static NSArray * _Nullable _commandAndArgumentsConformingToTypeOfPa @autoreleasepool { NSString *destination = _extractionDirectory; + NSFileManager *fileManager = [NSFileManager defaultManager]; + SULog(SULogLevelDefault, @"Extracting using '%@' '%@' < '%@' '%@'", command, [args componentsJoinedByString:@"' '"], _archivePath, destination); // Get the file size. - NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:_archivePath error:nil]; + NSDictionary *attributes = [fileManager attributesOfItemAtPath:_archivePath error:nil]; NSUInteger expectedLength = [(NSNumber *)[attributes objectForKey:NSFileSize] unsignedIntegerValue]; if (expectedLength == 0) { diff --git a/Configurations/ConfigCommon.xcconfig b/Configurations/ConfigCommon.xcconfig index fa561f69..7e4d688a 100644 --- a/Configurations/ConfigCommon.xcconfig +++ b/Configurations/ConfigCommon.xcconfig @@ -98,13 +98,13 @@ SPARKLE_ICON_NAME = AppIcon // If you change any of these version details, you must increase CURRENT_PROJECT_VERSION // These variables must have a space after the '=' too SPARKLE_VERSION_MAJOR = 2 -SPARKLE_VERSION_MINOR = 6 -SPARKLE_VERSION_PATCH = 3 +SPARKLE_VERSION_MINOR = 7 +SPARKLE_VERSION_PATCH = 0 // This should be in SemVer format or empty, ie. "-beta.1" // These variables must have a space after the '=' too -SPARKLE_VERSION_SUFFIX = -CURRENT_PROJECT_VERSION = 2039 +SPARKLE_VERSION_SUFFIX = -beta.1 +CURRENT_PROJECT_VERSION = 2040 MARKETING_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)$(SPARKLE_VERSION_SUFFIX) ALWAYS_SEARCH_USER_PATHS = NO diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index 3fb3241b..04afdb88 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -335,6 +335,8 @@ 726F2CE61BC9C33D001971A4 /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; }; 726F2CE81BC9C48F001971A4 /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; }; 726F2CEB1BC9C733001971A4 /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; }; + 726FC0362C1E787A00177986 /* SparkleTestCodeSignApp.aar in Resources */ = {isa = PBXBuildFile; fileRef = 726FC0352C1E787A00177986 /* SparkleTestCodeSignApp.aar */; }; + 726FC0382C1E96AA00177986 /* SparkleTestCodeSignApp.enc.aar in Resources */ = {isa = PBXBuildFile; fileRef = 726FC0372C1E96AA00177986 /* SparkleTestCodeSignApp.enc.aar */; }; 727DBAE526B5BBFD00111F0C /* ArgumentParser in Frameworks */ = {isa = PBXBuildFile; productRef = 727DBAE426B5BBFD00111F0C /* ArgumentParser */; }; 727DBAE726B5C47800111F0C /* ArgumentParser in Frameworks */ = {isa = PBXBuildFile; productRef = 727DBAE626B5C47800111F0C /* ArgumentParser */; }; 727DBAE926B5C48A00111F0C /* ArgumentParser in Frameworks */ = {isa = PBXBuildFile; productRef = 727DBAE826B5C48A00111F0C /* ArgumentParser */; }; @@ -1330,6 +1332,8 @@ 726E4A361C89116000C57C6A /* SPUStandardUserDriverDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUStandardUserDriverDelegate.h; sourceTree = ""; }; 726F2CE31BC9C33D001971A4 /* SUOperatingSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUOperatingSystem.h; sourceTree = ""; }; 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUOperatingSystem.m; sourceTree = ""; }; + 726FC0352C1E787A00177986 /* SparkleTestCodeSignApp.aar */ = {isa = PBXFileReference; lastKnownFileType = file; path = SparkleTestCodeSignApp.aar; sourceTree = ""; }; + 726FC0372C1E96AA00177986 /* SparkleTestCodeSignApp.enc.aar */ = {isa = PBXFileReference; lastKnownFileType = file; path = SparkleTestCodeSignApp.enc.aar; sourceTree = ""; }; 726FD2CB25F4BE5F00123BC6 /* fa */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fa; path = fa.lproj/MainMenu.strings; sourceTree = ""; }; 726FD2CC25F4BE5F00123BC6 /* fa */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fa; path = fa.lproj/Sparkle.strings; sourceTree = ""; }; 727F340A2605321D00020E85 /* SULog+NSError.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "SULog+NSError.m"; sourceTree = ""; }; @@ -1868,6 +1872,8 @@ 729F7ECD27409076004592DC /* SparkleTestCodeSignApp_bad_extraneous.zip */, 72CCDEBD27421FD500B53718 /* SparkleTestCodeSignApp_bad_header.zip */, F8761EB21ADC50EB000C9034 /* SparkleTestCodeSignApp.zip */, + 726FC0352C1E787A00177986 /* SparkleTestCodeSignApp.aar */, + 726FC0372C1E96AA00177986 /* SparkleTestCodeSignApp.enc.aar */, 72EB735E29BE981300FBCEE7 /* DevSignedApp.zip */, 72EB736029BEB36100FBCEE7 /* DevSignedAppVersion2.zip */, 14958C6C19AEBC610061B14F /* test-pubkey.pem */, @@ -3191,10 +3197,12 @@ 5AF6C74F1AEA46D10014A3AB /* test.pkg in Resources */, 72EB735F29BE981300FBCEE7 /* DevSignedApp.zip in Resources */, 72BC6C3D275027BF0083F14B /* SparkleTestCodeSign_apfs.dmg in Resources */, + 726FC0382C1E96AA00177986 /* SparkleTestCodeSignApp.enc.aar in Resources */, 720DC50627A62CDC00DFF3EC /* testappcast_minimumAutoupdateVersionSkipping2.xml in Resources */, 5AD0FA7F1C73F2E2004BCEFF /* testappcast.xml in Resources */, FA30773D24CBC295007BA37D /* testlocalizedreleasenotesappcast.xml in Resources */, 72CCDEBE27421FD500B53718 /* SparkleTestCodeSignApp_bad_header.zip in Resources */, + 726FC0362C1E787A00177986 /* SparkleTestCodeSignApp.aar in Resources */, 722545B626805FF80036465C /* testappcast_info_updates.xml in Resources */, 7202DC9A269ABD3500737EC4 /* testappcast_phasedRollout.xml in Resources */, 5F1510A21C96E591006E1629 /* testnamespaces.xml in Resources */, diff --git a/Tests/Resources/SparkleTestCodeSignApp.aar b/Tests/Resources/SparkleTestCodeSignApp.aar new file mode 100644 index 00000000..d158f1ef Binary files /dev/null and b/Tests/Resources/SparkleTestCodeSignApp.aar differ diff --git a/Tests/Resources/SparkleTestCodeSignApp.enc.aar b/Tests/Resources/SparkleTestCodeSignApp.enc.aar new file mode 100644 index 00000000..1f6e35e9 Binary files /dev/null and b/Tests/Resources/SparkleTestCodeSignApp.enc.aar differ diff --git a/Tests/SUUnarchiverTest.swift b/Tests/SUUnarchiverTest.swift index c7849157..0a369d2d 100644 --- a/Tests/SUUnarchiverTest.swift +++ b/Tests/SUUnarchiverTest.swift @@ -157,4 +157,18 @@ class SUUnarchiverTest: XCTestCase self.unarchiveTestAppWithExtension("pkg", resourceName: "test", expectingInstallationType: SPUInstallationTypeApplication, expectingSuccess: false) } #endif + + func testUnarchivingAppleArchive() { + self.unarchiveTestAppWithExtension("aar", resourceName: "SparkleTestCodeSignApp") + } + + // If we support encrypted archives one day we will use "aea" file extension + // Password to this archive is whatisgoingonforeveroneday! + func testUnarchivingEncryptedAppleArchiveWithoutPassword() { + signal(SIGPIPE, SIG_IGN) + + self.unarchiveTestAppWithExtension("enc.aar", resourceName: "SparkleTestCodeSignApp", expectingSuccess: false) + + signal(SIGPIPE, SIG_DFL) + } } diff --git a/generate_appcast/Unarchive.swift b/generate_appcast/Unarchive.swift index bd75c1cb..bf02f579 100644 --- a/generate_appcast/Unarchive.swift +++ b/generate_appcast/Unarchive.swift @@ -52,7 +52,7 @@ func unarchiveUpdates(archivesSourceDir: URL, archivesDestDir: URL, disableNeste let itemURL = archivesSourceDir.appendingPathComponent(item) let fileExtension = itemURL.pathExtension // Note: keep this list in sync with SUPipedUnarchiver - guard ["zip", "tar", "gz", "tgz", "bz2", "tbz", "xz", "txz", "lzma", "dmg"].contains(fileExtension) else { + guard ["zip", "tar", "gz", "tgz", "bz2", "tbz", "xz", "txz", "lzma", "dmg", "aar", "yaa"].contains(fileExtension) else { continue }