Compare commits

..
Author SHA1 Message Date
Sparkle-Bot dda155c7d3 Update Package management files for version 2.3.2 2023-02-12 16:11:14 +00:00
Zorg fd629728d8 Update CHANGELOG for 2.3.2 2023-02-12 08:01:38 -08:00
Zorg 709968403d Don't construct appcast item if enclosure URL is invalid (#2317) 2023-02-12 07:51:03 -08:00
Lauri-Matti Parppei 4911fa9cce Finnish localization grammar fixes (#2311) 2023-02-12 07:50:03 -08:00
Zorg 4cfba2ada4 Add delegate method to hide showing version history option (#2303) 2023-02-12 07:49:30 -08:00
Sparkle-Bot 9d85a02fe7 Update Package management files for version 2.3.1 2022-12-23 05:10:20 +00:00
Zorg dbb50717f3 Update CHANGELOG for 2.3.1 2022-12-22 20:57:54 -08:00
Zorg 25953d28ee Log the URL that failed to download correctly (#2296) 2022-12-22 20:57:24 -08:00
Zorg e643e731c7 Fix update permission alert title text overlapping with question text (#2284)
This change adjusts the layout constraints between the title and message text to be more proper.

This issue is only noticeable in Russian, Spanish, Ukrainian, and Slovenian on my machine.

Issue has been present in Sparkle 1 as well.
2022-12-22 20:57:09 -08:00
Sam 4c4d3da310 Update Czech translation (#2275) 2022-12-22 20:56:16 -08:00
Bing Zheung 2ad242a58e Add zh_HK (Chinese, Hong Kong) localization (#2273) 2022-12-22 20:55:48 -08:00
256 changed files with 3738 additions and 5441 deletions

No files matched your search

+5 -5
View File
@@ -10,16 +10,16 @@ jobs:
build: build:
strategy: strategy:
matrix: matrix:
xcode: ['xcode14.2', 'xcode13.4.1'] xcode: ['xcode14.1', 'xcode13.4.1']
include: include:
- xcode: 'xcode13.4.1' - xcode: 'xcode13.4.1'
xcode-path: '/Applications/Xcode_13.4.1.app/Contents/Developer' xcode-path: '/Applications/Xcode_13.4.1.app/Contents/Developer'
upload-dist: false upload-dist: true
run-analyzer: true run-analyzer: true
macos: 'macos-12' macos: 'macos-12'
- xcode: 'xcode14.2' - xcode: 'xcode14.1'
xcode-path: '/Applications/Xcode_14.2.app/Contents/Developer' xcode-path: '/Applications/Xcode_14.1.app/Contents/Developer'
upload-dist: true upload-dist: false
run-analyzer: false run-analyzer: false
macos: 'macos-12' macos: 'macos-12'
+1 -1
View File
@@ -2,7 +2,7 @@ name: "Create Draft Release"
env: env:
BUILDDIR: "build" BUILDDIR: "build"
DEVELOPER_DIR: "/Applications/Xcode_14.2.app/Contents/Developer" DEVELOPER_DIR: "/Applications/Xcode_13.4.1.app/Contents/Developer"
on: on:
workflow_dispatch: workflow_dispatch:
+1 -1
View File
@@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
@protocol SPUInstallerAgentProtocol; @protocol SPUInstallerAgentProtocol;
SPU_OBJC_DIRECT_MEMBERS @interface AgentConnection : NSObject @interface AgentConnection : NSObject
- (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier delegate:(id<AgentConnectionDelegate>)delegate; - (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier delegate:(id<AgentConnectionDelegate>)delegate;
+25 -27
View File
@@ -16,16 +16,20 @@
@interface AgentConnection () <NSXPCListenerDelegate, SUInstallerAgentInitiationProtocol> @interface AgentConnection () <NSXPCListenerDelegate, SUInstallerAgentInitiationProtocol>
@property (nonatomic) NSXPCListener *xpcListener;
@property (nonatomic, nullable) NSXPCConnection *activeConnection;
@property (nonatomic, nullable) id<SPUInstallerAgentProtocol> agent;
@property (nonatomic, weak) id<AgentConnectionDelegate> delegate;
@property (nonatomic) BOOL connected;
@end @end
@implementation AgentConnection @implementation AgentConnection
{
NSXPCListener *_xpcListener;
NSXPCConnection *_activeConnection;
__weak id<AgentConnectionDelegate> _delegate;
}
@synthesize xpcListener = _xpcListener;
@synthesize activeConnection = _activeConnection;
@synthesize agent = _agent; @synthesize agent = _agent;
@synthesize delegate = _delegate;
@synthesize connected = _connected; @synthesize connected = _connected;
@synthesize invalidationError = _invalidationError; @synthesize invalidationError = _invalidationError;
@@ -44,23 +48,23 @@
- (void)startListener - (void)startListener
{ {
[_xpcListener resume]; [self.xpcListener resume];
} }
- (void)invalidate - (void)invalidate
{ {
_delegate = nil; self.delegate = nil;
[_activeConnection invalidate]; [self.activeConnection invalidate];
_activeConnection = nil; self.activeConnection = nil;
[_xpcListener invalidate]; [self.xpcListener invalidate];
_xpcListener = nil; self.xpcListener = nil;
} }
- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection - (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection
{ {
if (_activeConnection != nil) { if (self.activeConnection != nil) {
[newConnection invalidate]; [newConnection invalidate];
return NO; return NO;
} }
@@ -70,30 +74,24 @@
newConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SPUInstallerAgentProtocol)]; newConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SPUInstallerAgentProtocol)];
_activeConnection = newConnection; self.activeConnection = newConnection;
__weak __typeof__(self) weakSelf = self; __weak AgentConnection *weakSelf = self;
newConnection.interruptionHandler = ^{ newConnection.interruptionHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
__typeof__(self) strongSelf = weakSelf; [weakSelf.activeConnection invalidate];
if (strongSelf != nil) {
[strongSelf->_activeConnection invalidate];
}
}); });
}; };
newConnection.invalidationHandler = ^{ newConnection.invalidationHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
__typeof__(self) strongSelf = weakSelf; [weakSelf.delegate agentConnectionDidInvalidate];
if (strongSelf != nil) {
[strongSelf->_delegate agentConnectionDidInvalidate];
}
}); });
}; };
[newConnection resume]; [newConnection resume];
_agent = newConnection.remoteObjectProxy; self.agent = newConnection.remoteObjectProxy;
return YES; return YES;
} }
@@ -101,10 +99,10 @@
- (void)connectionDidInitiateWithReply:(void (^)(void))acknowledgement - (void)connectionDidInitiateWithReply:(void (^)(void))acknowledgement
{ {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
self->_connected = YES; self.connected = YES;
[self->_delegate agentConnectionDidInitiate]; [self.delegate agentConnectionDidInitiate];
self->_delegate = nil; self.delegate = nil;
}); });
acknowledgement(); acknowledgement();
@@ -113,7 +111,7 @@
- (void)connectionWillInvalidateWithError:(NSError *)error - (void)connectionWillInvalidateWithError:(NSError *)error
{ {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
self->_invalidationError = error; self.invalidationError = error;
}); });
} }
+1 -1
View File
@@ -11,7 +11,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
SPU_OBJC_DIRECT_MEMBERS @interface AppInstaller : NSObject @interface AppInstaller : NSObject
- (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName; - (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName;
+173 -151
View File
@@ -43,48 +43,73 @@
static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
@interface AppInstaller () <NSXPCListenerDelegate, SUInstallerCommunicationProtocol, AgentConnectionDelegate> @interface AppInstaller () <NSXPCListenerDelegate, SUInstallerCommunicationProtocol, AgentConnectionDelegate>
@property (nonatomic) NSXPCListener* xpcListener;
@property (nonatomic) NSXPCConnection *activeConnection;
@property (nonatomic) id<SUInstallerCommunicationProtocol> communicator;
@property (nonatomic) AgentConnection *agentConnection;
@property (nonatomic) BOOL receivedUpdaterPong;
@property (nonatomic, strong) TerminationListener *terminationListener;
@property (nonatomic) SUUpdateValidator *updateValidator;
@property (nonatomic, readonly, copy) NSString *hostBundleIdentifier;
@property (nonatomic, readonly) NSString *homeDirectory;
@property (nonatomic, readonly) NSString *userName;
@property (nonatomic) SUHost *host;
@property (nonatomic, copy) NSString *updateDirectoryPath;
@property (nonatomic, copy) NSString *downloadName;
@property (nonatomic, copy) NSString *decryptionPassword;
@property (nonatomic, strong) SUSignatures *signatures;
@property (nonatomic, copy) NSString *relaunchPath;
@property (nonatomic, copy) NSString *installationType;
@property (nonatomic, assign) BOOL shouldRelaunch;
@property (nonatomic, assign) BOOL shouldShowUI;
@property (nonatomic) id<SUInstallerProtocol> installer;
@property (nonatomic) BOOL willCompleteInstallation;
@property (nonatomic) BOOL receivedInstallationData;
@property (nonatomic) BOOL finishedValidation;
@property (nonatomic) BOOL agentInitiatedConnection;
@property (nonatomic) dispatch_queue_t installerQueue;
@property (nonatomic) BOOL performedStage1Installation;
@property (nonatomic) BOOL performedStage2Installation;
@property (nonatomic) BOOL performedStage3Installation;
@end @end
@implementation AppInstaller @implementation AppInstaller
{
NSXPCListener* _xpcListener;
NSXPCConnection *_activeConnection;
id<SUInstallerCommunicationProtocol> _communicator;
AgentConnection *_agentConnection;
TerminationListener *_terminationListener; @synthesize xpcListener = _xpcListener;
@synthesize activeConnection = _activeConnection;
SUUpdateValidator *_updateValidator; @synthesize communicator = _communicator;
@synthesize agentConnection = _agentConnection;
NSString *_hostBundleIdentifier; @synthesize receivedUpdaterPong = _receivedUpdaterPong;
NSString *_homeDirectory; @synthesize hostBundleIdentifier = _hostBundleIdentifier;
NSString *_userName; @synthesize homeDirectory = _homeDirectory;
SUHost *_host; @synthesize userName = _userName;
NSString *_updateDirectoryPath; @synthesize terminationListener = _terminationListener;
NSString *_downloadName; @synthesize updateValidator = _updateValidator;
NSString *_decryptionPassword; @synthesize host = _host;
SUSignatures *_signatures; @synthesize updateDirectoryPath = _updateDirectoryPath;
NSString *_relaunchPath; @synthesize downloadName = _downloadName;
NSString *_installationType; @synthesize decryptionPassword = _decryptionPassword;
@synthesize signatures = _signatures;
id<SUInstallerProtocol> _installer; @synthesize relaunchPath = _relaunchPath;
@synthesize installationType = _installationType;
dispatch_queue_t _installerQueue; @synthesize shouldRelaunch = _shouldRelaunch;
@synthesize shouldShowUI = _shouldShowUI;
BOOL _shouldRelaunch; @synthesize installer = _installer;
BOOL _shouldShowUI; @synthesize willCompleteInstallation = _willCompleteInstallation;
@synthesize receivedInstallationData = _receivedInstallationData;
BOOL _receivedUpdaterPong; @synthesize installerQueue = _installerQueue;
@synthesize performedStage1Installation = _performedStage1Installation;
BOOL _willCompleteInstallation; @synthesize performedStage2Installation = _performedStage2Installation;
BOOL _receivedInstallationData; @synthesize performedStage3Installation = _performedStage3Installation;
BOOL _finishedValidation; @synthesize finishedValidation = _finishedValidation;
BOOL _agentInitiatedConnection; @synthesize agentInitiatedConnection = _agentInitiatedConnection;
BOOL _performedStage1Installation;
BOOL _performedStage2Installation;
BOOL _performedStage3Installation;
}
- (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName - (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName
{ {
@@ -107,71 +132,68 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection - (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection
{ {
if (_activeConnection != nil) { if (self.activeConnection != nil) {
SULog(SULogLevelDefault, @"Rejecting multiple connections..."); SULog(SULogLevelDefault, @"Rejecting multiple connections...");
[newConnection invalidate]; [newConnection invalidate];
return NO; return NO;
} }
_activeConnection = newConnection; self.activeConnection = newConnection;
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)]; newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)];
newConnection.exportedObject = self; newConnection.exportedObject = self;
newConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)]; newConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)];
__weak __typeof__(self) weakSelf = self; __weak AppInstaller *weakSelf = self;
newConnection.interruptionHandler = ^{ newConnection.interruptionHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
__typeof__(self) strongSelf = weakSelf; [weakSelf.activeConnection invalidate];
if (strongSelf != nil) {
[strongSelf->_activeConnection invalidate];
}
}); });
}; };
newConnection.invalidationHandler = ^{ newConnection.invalidationHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
__typeof__(self) strongSelf = weakSelf; AppInstaller *strongSelf = weakSelf;
if (strongSelf != nil) { if (strongSelf != nil) {
if (strongSelf->_activeConnection != nil && !strongSelf->_willCompleteInstallation) { if (strongSelf.activeConnection != nil && !strongSelf.willCompleteInstallation) {
[strongSelf cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Invalidation on remote port being called, and installation is not close enough to completion!" }]]; [strongSelf cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Invalidation on remote port being called, and installation is not close enough to completion!" }]];
} }
strongSelf->_communicator = nil; strongSelf.communicator = nil;
strongSelf->_activeConnection = nil; strongSelf.activeConnection = nil;
} }
}); });
}; };
[newConnection resume]; [newConnection resume];
_communicator = newConnection.remoteObjectProxy; self.communicator = newConnection.remoteObjectProxy;
return YES; return YES;
} }
- (void)start - (void)start
{ {
[_xpcListener resume]; [self.xpcListener resume];
[_agentConnection startListener]; [self.agentConnection startListener];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(FIRST_UPDATER_MESSAGE_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(FIRST_UPDATER_MESSAGE_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (!self->_receivedInstallationData) { if (!self.receivedInstallationData) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Timeout: installation data was never received" }]]; [self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Timeout: installation data was never received" }]];
} }
if (!self->_agentConnection.connected) { if (!self.agentConnection.connected) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Timeout: agent connection was never initiated" }]]; [self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Timeout: agent connection was never initiated" }]];
} }
}); });
} }
- (void)extractAndInstallUpdate SPU_OBJC_DIRECT - (void)extractAndInstallUpdate
{ {
[_communicator handleMessageWithIdentifier:SPUExtractionStarted data:[NSData data]]; [self.communicator handleMessageWithIdentifier:SPUExtractionStarted data:[NSData data]];
NSString *archivePath = [_updateDirectoryPath stringByAppendingPathComponent:_downloadName]; NSString *archivePath = [self.updateDirectoryPath stringByAppendingPathComponent:self.downloadName];
id<SUUnarchiverProtocol> unarchiver = [SUUnarchiver unarchiverForPath:archivePath updatingHostBundlePath:_host.bundlePath decryptionPassword:_decryptionPassword expectingInstallationType:_installationType]; id<SUUnarchiverProtocol> unarchiver = [SUUnarchiver unarchiverForPath:archivePath updatingHostBundlePath:self.host.bundlePath decryptionPassword:self.decryptionPassword expectingInstallationType:self.installationType];
NSError *unarchiverError = nil; NSError *unarchiverError = nil;
BOOL success = NO; BOOL success = NO;
@@ -180,14 +202,14 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
success = NO; success = NO;
} else { } else {
_updateValidator = [[SUUpdateValidator alloc] initWithDownloadPath:archivePath signatures:_signatures host:_host]; self.updateValidator = [[SUUpdateValidator alloc] initWithDownloadPath:archivePath signatures:self.signatures host:self.host];
// Delta & package updates will require validation before extraction // Delta & package updates will require validation before extraction
// Normal application updates are a bit more lenient allowing developers to change one of apple dev ID or EdDSA keys // Normal application updates are a bit more lenient allowing developers to change one of apple dev ID or EdDSA keys
BOOL needsPrevalidation = [[unarchiver class] mustValidateBeforeExtraction] || ![_installationType isEqualToString:SPUInstallationTypeApplication]; BOOL needsPrevalidation = [[unarchiver class] mustValidateBeforeExtraction] || ![self.installationType isEqualToString:SPUInstallationTypeApplication];
if (needsPrevalidation) { if (needsPrevalidation) {
success = [_updateValidator validateDownloadPathWithError:&unarchiverError]; success = [self.updateValidator validateDownloadPathWithError:&unarchiverError];
} else { } else {
success = YES; success = YES;
} }
@@ -201,18 +223,18 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
if (error != nil) { if (error != nil) {
[self unarchiverDidFailWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to unarchive %@", archivePath], NSUnderlyingErrorKey: (NSError * _Nonnull)error }]]; [self unarchiverDidFailWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to unarchive %@", archivePath], NSUnderlyingErrorKey: (NSError * _Nonnull)error }]];
} else { } else {
[self->_communicator handleMessageWithIdentifier:SPUValidationStarted data:[NSData data]]; [self.communicator handleMessageWithIdentifier:SPUValidationStarted data:[NSData data]];
NSError *validationError = nil; NSError *validationError = nil;
BOOL validationSuccess = [self->_updateValidator validateWithUpdateDirectory:self->_updateDirectoryPath error:&validationError]; BOOL validationSuccess = [self.updateValidator validateWithUpdateDirectory:self.updateDirectoryPath error:&validationError];
if (!validationSuccess) { if (!validationSuccess) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Update validation was a failure", NSUnderlyingErrorKey: validationError }]]; [self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Update validation was a failure", NSUnderlyingErrorKey: validationError }]];
} else { } else {
[self->_communicator handleMessageWithIdentifier:SPUInstallationStartedStage1 data:[NSData data]]; [self.communicator handleMessageWithIdentifier:SPUInstallationStartedStage1 data:[NSData data]];
self->_finishedValidation = YES; self.finishedValidation = YES;
if (self->_agentInitiatedConnection) { if (self.agentInitiatedConnection) {
[self retrieveProcessIdentifierAndStartInstallation]; [self retrieveProcessIdentifierAndStartInstallation];
} }
} }
@@ -223,60 +245,60 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
uint64_t progressValue = CFSwapInt64HostToLittle(*(uint64_t *)&progress); uint64_t progressValue = CFSwapInt64HostToLittle(*(uint64_t *)&progress);
NSData *data = [NSData dataWithBytes:&progressValue length:sizeof(progressValue)]; NSData *data = [NSData dataWithBytes:&progressValue length:sizeof(progressValue)];
[self->_communicator handleMessageWithIdentifier:SPUExtractedArchiveWithProgress data:data]; [self.communicator handleMessageWithIdentifier:SPUExtractedArchiveWithProgress data:data];
} }
}]; }];
} }
} }
- (void)clearUpdateDirectory SPU_OBJC_DIRECT - (void)clearUpdateDirectory
{ {
if (_updateDirectoryPath != nil) { if (self.updateDirectoryPath != nil) {
NSError *theError = nil; NSError *theError = nil;
if (![[[SUFileManager alloc] init] removeItemAtURL:[NSURL fileURLWithPath:_updateDirectoryPath] error:&theError]) { if (![[[SUFileManager alloc] init] removeItemAtURL:[NSURL fileURLWithPath:self.updateDirectoryPath] error:&theError]) {
SULog(SULogLevelError, @"Couldn't remove update folder: %@.", theError); SULog(SULogLevelError, @"Couldn't remove update folder: %@.", theError);
} }
_updateDirectoryPath = nil; self.updateDirectoryPath = nil;
} }
} }
- (void)unarchiverDidFailWithError:(NSError *)error SPU_OBJC_DIRECT - (void)unarchiverDidFailWithError:(NSError *)error
{ {
SULog(SULogLevelError, @"Failed to unarchive file"); SULog(SULogLevelError, @"Failed to unarchive file");
SULogError(error); SULogError(error);
// No longer need update validator until next possible extraction (eg: if initial delta update fails) // No longer need update validator until next possible extraction (eg: if initial delta update fails)
_updateValidator = nil; self.updateValidator = nil;
// Client could try update again with different inputs // Client could try update again with different inputs
// Eg: one common case is if a delta update fails, client may want to fall back to regular update // Eg: one common case is if a delta update fails, client may want to fall back to regular update
// We really only need to set updateDirectoryPath to nil since that's the field we check if we've received installation data, // We really only need to set updateDirectoryPath to nil since that's the field we check if we've received installation data,
// but may as well set other fields to nil too // but may as well set other fields to nil too
[self clearUpdateDirectory]; [self clearUpdateDirectory];
_downloadName = nil; self.downloadName = nil;
_decryptionPassword = nil; self.decryptionPassword = nil;
_signatures = nil; self.signatures = nil;
_relaunchPath = nil; self.relaunchPath = nil;
_host = nil; self.host = nil;
NSData *archivedError = SPUArchiveRootObjectSecurely(error); NSData *archivedError = SPUArchiveRootObjectSecurely(error);
[_communicator handleMessageWithIdentifier:SPUArchiveExtractionFailed data:archivedError != nil ? archivedError : [NSData data]]; [self.communicator handleMessageWithIdentifier:SPUArchiveExtractionFailed data:archivedError != nil ? archivedError : [NSData data]];
} }
- (void)agentConnectionDidInitiate - (void)agentConnectionDidInitiate
{ {
_agentInitiatedConnection = YES; self.agentInitiatedConnection = YES;
if (_finishedValidation) { if (self.finishedValidation) {
[self retrieveProcessIdentifierAndStartInstallation]; [self retrieveProcessIdentifierAndStartInstallation];
} }
} }
- (void)agentConnectionDidInvalidate - (void)agentConnectionDidInvalidate
{ {
if (!_finishedValidation || !_agentInitiatedConnection) { if (!self.finishedValidation || !self.agentInitiatedConnection) {
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey: @"Error: Agent connection invalidated before installation began" }]; NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey: @"Error: Agent connection invalidated before installation began" }];
NSError *agentError = _agentConnection.invalidationError; NSError *agentError = self.agentConnection.invalidationError;
if (agentError != nil) { if (agentError != nil) {
userInfo[NSUnderlyingErrorKey] = agentError; userInfo[NSUnderlyingErrorKey] = agentError;
} }
@@ -285,21 +307,21 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
} }
} }
- (void)retrieveProcessIdentifierAndStartInstallation SPU_OBJC_DIRECT - (void)retrieveProcessIdentifierAndStartInstallation
{ {
// We use the relaunch path for the bundle to listen for termination instead of the host path // We use the relaunch path for the bundle to listen for termination instead of the host path
// For a plug-in this makes a big difference; we want to wait until the app hosting the plug-in terminates // For a plug-in this makes a big difference; we want to wait until the app hosting the plug-in terminates
// Otherwise for an app, the relaunch path and host path should be identical // Otherwise for an app, the relaunch path and host path should be identical
[_agentConnection.agent registerApplicationBundlePath:_relaunchPath reply:^(NSNumber * _Nullable processIdentifier) { [self.agentConnection.agent registerApplicationBundlePath:self.relaunchPath reply:^(NSNumber * _Nullable processIdentifier) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
self->_terminationListener = [[TerminationListener alloc] initWithProcessIdentifier:processIdentifier]; self.terminationListener = [[TerminationListener alloc] initWithProcessIdentifier:processIdentifier];
[self startInstallation]; [self startInstallation];
}); });
}]; }];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(RETRIEVE_PROCESS_IDENTIFIER_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(RETRIEVE_PROCESS_IDENTIFIER_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (self->_terminationListener == nil) { if (self.terminationListener == nil) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Timeout error: failed to retreive process identifier from agent" }]]; [self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Timeout error: failed to retreive process identifier from agent" }]];
} }
}); });
@@ -307,11 +329,11 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
- (void)handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data - (void)handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data
{ {
if (identifier == SPUInstallationData && _updateDirectoryPath == nil) { if (identifier == SPUInstallationData && self.updateDirectoryPath == nil) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
// Mark that we have received the installation data // Mark that we have received the installation data
// Do not rely on eg: self->_updateDirectoryPath != nil because we may set it to nil again if an early stage fails (i.e, archive extraction) // Do not rely on eg: self.updateDirectoryPath != nil because we may set it to nil again if an early stage fails (i.e, archive extraction)
self->_receivedInstallationData = YES; self.receivedInstallationData = YES;
SPUInstallationInputData *installationData = (SPUInstallationInputData *)SPUUnarchiveRootObjectSecurely(data, [SPUInstallationInputData class]); SPUInstallationInputData *installationData = (SPUInstallationInputData *)SPUUnarchiveRootObjectSecurely(data, [SPUInstallationInputData class]);
if (installationData == nil) { if (installationData == nil) {
@@ -328,8 +350,8 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
NSBundle *hostBundle = [NSBundle bundleWithPath:installationData.hostBundlePath]; NSBundle *hostBundle = [NSBundle bundleWithPath:installationData.hostBundlePath];
NSString *bundleIdentifier = hostBundle.bundleIdentifier; NSString *bundleIdentifier = hostBundle.bundleIdentifier;
if (bundleIdentifier == nil || ![bundleIdentifier isEqualToString:self->_hostBundleIdentifier]) { if (bundleIdentifier == nil || ![bundleIdentifier isEqualToString:self.hostBundleIdentifier]) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Error: Failed to match host bundle identifiers %@ and %@", self->_hostBundleIdentifier, bundleIdentifier] }]]; [self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Error: Failed to match host bundle identifiers %@ and %@", self.hostBundleIdentifier, bundleIdentifier] }]];
return; return;
} }
@@ -387,23 +409,23 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
// Carry these properities separately rather than using the SUInstallationInputData object // Carry these properities separately rather than using the SUInstallationInputData object
// Some of our properties may slightly differ than our input and we don't want to make the mistake of using one of those // Some of our properties may slightly differ than our input and we don't want to make the mistake of using one of those
self->_installationType = installationType; self.installationType = installationType;
self->_relaunchPath = installationData.relaunchPath; self.relaunchPath = installationData.relaunchPath;
self->_downloadName = installationData.downloadName; self.downloadName = installationData.downloadName;
self->_signatures = installationData.signatures; self.signatures = installationData.signatures;
self->_updateDirectoryPath = cacheInstallationPath; self.updateDirectoryPath = cacheInstallationPath;
self->_host = [[SUHost alloc] initWithBundle:hostBundle]; self.host = [[SUHost alloc] initWithBundle:hostBundle];
[self extractAndInstallUpdate]; [self extractAndInstallUpdate];
}); });
} else if (identifier == SPUSentUpdateAppcastItemData) { } else if (identifier == SPUSentUpdateAppcastItemData) {
SUAppcastItem *updateItem = (SUAppcastItem *)SPUUnarchiveRootObjectSecurely(data, [SUAppcastItem class]); SUAppcastItem *updateItem = (SUAppcastItem *)SPUUnarchiveRootObjectSecurely(data, [SUAppcastItem class]);
if (updateItem != nil) { if (updateItem != nil) {
SPUInstallationInfo *installationInfo = [[SPUInstallationInfo alloc] initWithAppcastItem:updateItem canSilentlyInstall:[_installer canInstallSilently]]; SPUInstallationInfo *installationInfo = [[SPUInstallationInfo alloc] initWithAppcastItem:updateItem canSilentlyInstall:[self.installer canInstallSilently]];
NSData *archivedData = SPUArchiveRootObjectSecurely(installationInfo); NSData *archivedData = SPUArchiveRootObjectSecurely(installationInfo);
if (archivedData != nil) { if (archivedData != nil) {
[_agentConnection.agent registerInstallationInfoData:archivedData]; [self.agentConnection.agent registerInstallationInfoData:archivedData];
} }
} }
} else if (identifier == SPUResumeInstallationToStage2 && data.length == sizeof(uint8_t) * 2) { } else if (identifier == SPUResumeInstallationToStage2 && data.length == sizeof(uint8_t) * 2) {
@@ -413,21 +435,21 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
// This flag has an impact on interactive type installations and showing UI progress during non-interactive installations // This flag has an impact on interactive type installations and showing UI progress during non-interactive installations
self->_shouldShowUI = (BOOL)showsUI; self.shouldShowUI = (BOOL)showsUI;
// Don't test if the application was alive initially, leave that to the progress agent if we decide to relaunch // Don't test if the application was alive initially, leave that to the progress agent if we decide to relaunch
self->_shouldRelaunch = (BOOL)relaunch; self.shouldRelaunch = (BOOL)relaunch;
if (self->_performedStage1Installation) { if (self.performedStage1Installation) {
// Resume the installation if we aren't done with stage 2 yet, and remind the client we are prepared to relaunch // Resume the installation if we aren't done with stage 2 yet, and remind the client we are prepared to relaunch
dispatch_async(self->_installerQueue, ^{ dispatch_async(self.installerQueue, ^{
if (!self->_performedStage2Installation) { if (!self.performedStage2Installation) {
[self performStage2Installation]; [self performStage2Installation];
} else if (!self->_performedStage3Installation) { } else if (!self.performedStage3Installation) {
// If we already performed the 2nd stage, re-purpose this request to re-try sending another termination signal // If we already performed the 2nd stage, re-purpose this request to re-try sending another termination signal
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
// Don't check if the target is already terminated, leave that to the progress agent // Don't check if the target is already terminated, leave that to the progress agent
// We could be slightly off if there were multiple instances running // We could be slightly off if there were multiple instances running
[self->_agentConnection.agent sendTerminationSignal]; [self.agentConnection.agent sendTerminationSignal];
}); });
} }
}); });
@@ -438,19 +460,19 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
[self cleanupAndExitWithStatus:0 error:nil]; [self cleanupAndExitWithStatus:0 error:nil];
}); });
} else if (identifier == SPUUpdaterAlivePong) { } else if (identifier == SPUUpdaterAlivePong) {
_receivedUpdaterPong = YES; self.receivedUpdaterPong = YES;
} }
} }
- (void)startInstallation SPU_OBJC_DIRECT - (void)startInstallation
{ {
_willCompleteInstallation = YES; self.willCompleteInstallation = YES;
_installerQueue = dispatch_queue_create("org.sparkle-project.sparkle.installer", DISPATCH_QUEUE_SERIAL); self.installerQueue = dispatch_queue_create("org.sparkle-project.sparkle.installer", DISPATCH_QUEUE_SERIAL);
dispatch_async(_installerQueue, ^{ dispatch_async(self.installerQueue, ^{
NSError *installerError = nil; NSError *installerError = nil;
id <SUInstallerProtocol> installer = [SUInstaller installerForHost:self->_host expectedInstallationType:self->_installationType updateDirectory:self->_updateDirectoryPath homeDirectory:self->_homeDirectory userName:self->_userName error:&installerError]; id <SUInstallerProtocol> installer = [SUInstaller installerForHost:self.host expectedInstallationType:self.installationType updateDirectory:self.updateDirectoryPath homeDirectory:self.homeDirectory userName:self.userName error:&installerError];
if (installer == nil) { if (installer == nil) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
@@ -461,7 +483,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
NSError *firstStageError = nil; NSError *firstStageError = nil;
if (![installer performInitialInstallation:&firstStageError]) { if (![installer performInitialInstallation:&firstStageError]) {
self->_installer = nil; self.installer = nil;
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to start installer", NSUnderlyingErrorKey: firstStageError }]]; [self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to start installer", NSUnderlyingErrorKey: firstStageError }]];
@@ -472,17 +494,17 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
uint8_t canPerformSilentInstall = (uint8_t)[installer canInstallSilently]; uint8_t canPerformSilentInstall = (uint8_t)[installer canInstallSilently];
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
self->_installer = installer; self.installer = installer;
uint8_t targetTerminated = (uint8_t)self->_terminationListener.terminated; uint8_t targetTerminated = (uint8_t)self.terminationListener.terminated;
uint8_t sendInformation[] = {canPerformSilentInstall, targetTerminated}; uint8_t sendInformation[] = {canPerformSilentInstall, targetTerminated};
NSData *sendData = [NSData dataWithBytes:sendInformation length:sizeof(sendInformation)]; NSData *sendData = [NSData dataWithBytes:sendInformation length:sizeof(sendInformation)];
[self->_communicator handleMessageWithIdentifier:SPUInstallationFinishedStage1 data:sendData]; [self.communicator handleMessageWithIdentifier:SPUInstallationFinishedStage1 data:sendData];
self->_performedStage1Installation = YES; self.performedStage1Installation = YES;
// Stage 2 can still be run before we finish installation // Stage 2 can still be run before we finish installation
// if the updater requests for it before the app is terminated // if the updater requests for it before the app is terminated
@@ -491,24 +513,24 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
}); });
} }
- (void)performStage2Installation SPU_OBJC_DIRECT - (void)performStage2Installation
{ {
BOOL canPerformSecondStage = _shouldShowUI || [_installer canInstallSilently]; BOOL canPerformSecondStage = self.shouldShowUI || [self.installer canInstallSilently];
if (canPerformSecondStage) { if (canPerformSecondStage) {
_performedStage2Installation = YES; self.performedStage2Installation = YES;
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
uint8_t targetTerminated = (uint8_t)self->_terminationListener.terminated; uint8_t targetTerminated = (uint8_t)self.terminationListener.terminated;
NSData *sendData = [NSData dataWithBytes:&targetTerminated length:sizeof(targetTerminated)]; NSData *sendData = [NSData dataWithBytes:&targetTerminated length:sizeof(targetTerminated)];
[self->_communicator handleMessageWithIdentifier:SPUInstallationFinishedStage2 data:sendData]; [self.communicator handleMessageWithIdentifier:SPUInstallationFinishedStage2 data:sendData];
// Don't check if the target is already terminated, leave that to the progress agent // Don't check if the target is already terminated, leave that to the progress agent
// We could be slightly off if there were multiple instances running // We could be slightly off if there were multiple instances running
[self->_agentConnection.agent sendTerminationSignal]; [self.agentConnection.agent sendTerminationSignal];
}); });
} else { } else {
_installer = nil; self.installer = nil;
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to resume installer on stage 2 because installation cannot be installed silently" }]]; [self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to resume installer on stage 2 because installation cannot be installed silently" }]];
@@ -516,9 +538,9 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
} }
} }
- (void)finishInstallationAfterHostTermination SPU_OBJC_DIRECT - (void)finishInstallationAfterHostTermination
{ {
[_terminationListener startListeningWithCompletion:^(BOOL success) { [self.terminationListener startListeningWithCompletion:^(BOOL success) {
if (!success) { if (!success) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to listen for application termination" }]]; [self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to listen for application termination" }]];
return; return;
@@ -527,38 +549,38 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
// Show our installer progress UI tool if only after a certain amount of time passes, // Show our installer progress UI tool if only after a certain amount of time passes,
// and if our installer is silent (i.e, doesn't show progress on its own) // and if our installer is silent (i.e, doesn't show progress on its own)
__block BOOL shouldShowUIProgress = YES; __block BOOL shouldShowUIProgress = YES;
if (self->_shouldShowUI && [self->_installer canInstallSilently]) { if (self.shouldShowUI && [self.installer canInstallSilently]) {
// Ask the updater if it is still alive // Ask the updater if it is still alive
// If they are, we will receive a pong response back // If they are, we will receive a pong response back
// Reset if we received a pong just to be on the safe side // Reset if we received a pong just to be on the safe side
self->_receivedUpdaterPong = NO; self.receivedUpdaterPong = NO;
[self->_communicator handleMessageWithIdentifier:SPUUpdaterAlivePing data:[NSData data]]; [self.communicator handleMessageWithIdentifier:SPUUpdaterAlivePing data:[NSData data]];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(SUDisplayProgressTimeDelay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(SUDisplayProgressTimeDelay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
// Make sure we're still eligible for showing the installer progress // Make sure we're still eligible for showing the installer progress
// Also if the updater process is still alive, showing the progress should not be our duty // Also if the updater process is still alive, showing the progress should not be our duty
// if the communicator object is nil, the updater definitely isn't alive. However, if it is not nil, // if the communicator object is nil, the updater definitely isn't alive. However, if it is not nil,
// this does not necessarily mean the updater is alive, so we should also check if we got a recent response back from the updater // this does not necessarily mean the updater is alive, so we should also check if we got a recent response back from the updater
if (shouldShowUIProgress && (!self->_receivedUpdaterPong || self->_communicator == nil)) { if (shouldShowUIProgress && (!self.receivedUpdaterPong || self.communicator == nil)) {
[self->_agentConnection.agent showProgress]; [self.agentConnection.agent showProgress];
} }
}); });
} }
dispatch_async(self->_installerQueue, ^{ dispatch_async(self.installerQueue, ^{
if (!self->_performedStage2Installation) { if (!self.performedStage2Installation) {
[self performStage2Installation]; [self performStage2Installation];
} }
if (!self->_performedStage2Installation) { if (!self.performedStage2Installation) {
// We failed and we're going to exit shortly // We failed and we're going to exit shortly
return; return;
} }
NSError *thirdStageError = nil; NSError *thirdStageError = nil;
if (![self->_installer performFinalInstallationProgressBlock:nil error:&thirdStageError]) { if (![self.installer performFinalInstallationProgressBlock:nil error:&thirdStageError]) {
[self->_installer performCleanup]; [self.installer performCleanup];
self->_installer = nil; self.installer = nil;
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to finalize installation", NSUnderlyingErrorKey: thirdStageError }]]; [self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to finalize installation", NSUnderlyingErrorKey: thirdStageError }]];
@@ -566,23 +588,23 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
return; return;
} }
self->_performedStage3Installation = YES; self.performedStage3Installation = YES;
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
// Make sure to stop our displayed progress before we move onto cleanup & relaunch // Make sure to stop our displayed progress before we move onto cleanup & relaunch
// This will also stop the agent from broadcasting the status info service, which we want to do before // This will also stop the agent from broadcasting the status info service, which we want to do before
// we relaunch the app because the relaunched app could check the service upon launch.. // we relaunch the app because the relaunched app could check the service upon launch..
[self->_agentConnection.agent stopProgress]; [self.agentConnection.agent stopProgress];
shouldShowUIProgress = NO; shouldShowUIProgress = NO;
[self->_communicator handleMessageWithIdentifier:SPUInstallationFinishedStage3 data:[NSData data]]; [self.communicator handleMessageWithIdentifier:SPUInstallationFinishedStage3 data:[NSData data]];
if (self->_shouldRelaunch) { if (self.shouldRelaunch) {
// This will also signal to the agent that it will terminate soon // This will also signal to the agent that it will terminate soon
[self->_agentConnection.agent relaunchApplication]; [self.agentConnection.agent relaunchApplication];
} }
[self->_installer performCleanup]; [self.installer performCleanup];
[self cleanupAndExitWithStatus:EXIT_SUCCESS error:nil]; [self cleanupAndExitWithStatus:EXIT_SUCCESS error:nil];
}); });
@@ -597,20 +619,20 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
NSData *errorData = SPUArchiveRootObjectSecurely((NSError * _Nonnull)error); NSData *errorData = SPUArchiveRootObjectSecurely((NSError * _Nonnull)error);
if (errorData != nil) { if (errorData != nil) {
[_communicator handleMessageWithIdentifier:SPUInstallerError data:errorData]; [self.communicator handleMessageWithIdentifier:SPUInstallerError data:errorData];
} }
} }
// It's nice to tell the other end we're invalidating // It's nice to tell the other end we're invalidating
[_activeConnection invalidate]; [self.activeConnection invalidate];
_activeConnection = nil; self.activeConnection = nil;
[_xpcListener invalidate]; [self.xpcListener invalidate];
_xpcListener = nil; self.xpcListener = nil;
[_agentConnection invalidate]; [self.agentConnection invalidate];
_agentConnection = nil; self.agentConnection = nil;
[self clearUpdateDirectory]; [self clearUpdateDirectory];
+6 -6
View File
@@ -23,7 +23,6 @@ id<SPUDeltaArchiveProtocol> SPUDeltaArchiveReadPatchAndHeader(NSString *patchFil
SPUDeltaArchiveHeader *header = [sparkleArchive readHeader]; SPUDeltaArchiveHeader *header = [sparkleArchive readHeader];
if (header == nil) { if (header == nil) {
#if SPARKLE_BUILD_LEGACY_DELTA_SUPPORT
NSError *archiveError = sparkleArchive.error; NSError *archiveError = sparkleArchive.error;
if (archiveError != nil && [archiveError.domain isEqualToString:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN] && archiveError.code == SPARKLE_DELTA_ARCHIVE_ERROR_CODE_BAD_MAGIC) { if (archiveError != nil && [archiveError.domain isEqualToString:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN] && archiveError.code == SPARKLE_DELTA_ARCHIVE_ERROR_CODE_BAD_MAGIC) {
// Retry with XAR archive if the magic value is unexpected // Retry with XAR archive if the magic value is unexpected
@@ -36,9 +35,7 @@ id<SPUDeltaArchiveProtocol> SPUDeltaArchiveReadPatchAndHeader(NSString *patchFil
*outHeader = xarHeader; *outHeader = xarHeader;
} }
return xarArchive; return xarArchive;
} else } else {
#endif
{
if (outHeader != NULL) { if (outHeader != NULL) {
*outHeader = nil; *outHeader = nil;
} }
@@ -59,9 +56,7 @@ id<SPUDeltaArchiveProtocol> SPUDeltaArchiveReadPatchAndHeader(NSString *patchFil
@synthesize clonedRelativePath = _clonedRelativePath; @synthesize clonedRelativePath = _clonedRelativePath;
@synthesize sourcePath = _sourcePath; @synthesize sourcePath = _sourcePath;
@synthesize commands = _commands; @synthesize commands = _commands;
#if SPARKLE_BUILD_LEGACY_DELTA_SUPPORT
@synthesize xarContext = _xarContext; @synthesize xarContext = _xarContext;
#endif
@synthesize mode = _mode; @synthesize mode = _mode;
@synthesize codedDataLength = _codedDataLength; @synthesize codedDataLength = _codedDataLength;
@@ -108,6 +103,9 @@ id<SPUDeltaArchiveProtocol> SPUDeltaArchiveReadPatchAndHeader(NSString *patchFil
return self; return self;
} }
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
- (unsigned char *)beforeTreeHash - (unsigned char *)beforeTreeHash
{ {
return _beforeTreeHash; return _beforeTreeHash;
@@ -118,4 +116,6 @@ id<SPUDeltaArchiveProtocol> SPUDeltaArchiveReadPatchAndHeader(NSString *patchFil
return _afterTreeHash; return _afterTreeHash;
} }
#pragma clang diagnostic pop
@end @end
+2 -4
View File
@@ -24,7 +24,7 @@ typedef NS_ENUM(uint8_t, SPUDeltaItemCommands) {
}; };
// Represents header for our archive // Represents header for our archive
SPU_OBJC_DIRECT_MEMBERS @interface SPUDeltaArchiveHeader : NSObject @interface SPUDeltaArchiveHeader : NSObject
- (instancetype)initWithCompression:(SPUDeltaCompressionMode)compression compressionLevel:(uint8_t)compressionLevel fileSystemCompression:(bool)fileSystemCompression majorVersion:(uint16_t)majorVersion minorVersion:(uint16_t)minorVersion beforeTreeHash:(const unsigned char *)beforeTreeHash afterTreeHash:(const unsigned char *)afterTreeHash; - (instancetype)initWithCompression:(SPUDeltaCompressionMode)compression compressionLevel:(uint8_t)compressionLevel fileSystemCompression:(bool)fileSystemCompression majorVersion:(uint16_t)majorVersion minorVersion:(uint16_t)minorVersion beforeTreeHash:(const unsigned char *)beforeTreeHash afterTreeHash:(const unsigned char *)afterTreeHash;
@@ -39,7 +39,7 @@ SPU_OBJC_DIRECT_MEMBERS @interface SPUDeltaArchiveHeader : NSObject
@end @end
// Represents an item we read or write to in our delta archive // Represents an item we read or write to in our delta archive
SPU_OBJC_DIRECT_MEMBERS @interface SPUDeltaArchiveItem : NSObject @interface SPUDeltaArchiveItem : NSObject
- (instancetype)initWithRelativeFilePath:(NSString *)relativeFilePath commands:(SPUDeltaItemCommands)commands mode:(uint16_t)mode; - (instancetype)initWithRelativeFilePath:(NSString *)relativeFilePath commands:(SPUDeltaItemCommands)commands mode:(uint16_t)mode;
@@ -58,10 +58,8 @@ SPU_OBJC_DIRECT_MEMBERS @interface SPUDeltaArchiveItem : NSObject
@property (nonatomic) uint16_t mode; @property (nonatomic) uint16_t mode;
// Private properties // Private properties
#if SPARKLE_BUILD_LEGACY_DELTA_SUPPORT
// xar_file context for Xar delta archiver // xar_file context for Xar delta archiver
@property (nonatomic, nullable) const void *xarContext; @property (nonatomic, nullable) const void *xarContext;
#endif
// Tracking length of item's data in data section, when encoding items and when extracting items // Tracking length of item's data in data section, when encoding items and when extracting items
@property (nonatomic) uint64_t codedDataLength; @property (nonatomic) uint64_t codedDataLength;
+1 -1
View File
@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
@class SUAppcastItem; @class SUAppcastItem;
SPU_OBJC_DIRECT_MEMBERS @interface SPUInstallationInfo : NSObject <NSSecureCoding> @interface SPUInstallationInfo : NSObject <NSSecureCoding>
- (instancetype)initWithAppcastItem:(SUAppcastItem *)appcastItem canSilentlyInstall:(BOOL)canSilentyInstall; - (instancetype)initWithAppcastItem:(SUAppcastItem *)appcastItem canSilentlyInstall:(BOOL)canSilentyInstall;
+3 -3
View File
@@ -52,9 +52,9 @@ static NSString *SUSystemDomainKey = @"SUSystemDomain";
- (void)encodeWithCoder:(NSCoder *)coder - (void)encodeWithCoder:(NSCoder *)coder
{ {
[coder encodeObject:_appcastItem forKey:SUAppcastItemKey]; [coder encodeObject:self.appcastItem forKey:SUAppcastItemKey];
[coder encodeBool:_canSilentlyInstall forKey:SUCanSilentlyInstallKey]; [coder encodeBool:self.canSilentlyInstall forKey:SUCanSilentlyInstallKey];
[coder encodeBool:_systemDomain forKey:SUSystemDomainKey]; [coder encodeBool:self.systemDomain forKey:SUSystemDomainKey];
} }
+ (BOOL)supportsSecureCoding + (BOOL)supportsSecureCoding
+1 -1
View File
@@ -12,7 +12,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
SPU_OBJC_DIRECT_MEMBERS @interface SPUInstallationInputData : NSObject <NSSecureCoding> @interface SPUInstallationInputData : NSObject <NSSecureCoding>
/* /*
* relaunchPath - path to application bundle to relaunch and listen for termination * relaunchPath - path to application bundle to relaunch and listen for termination
+8 -8
View File
@@ -87,14 +87,14 @@ static NSString *SUInstallationTypeKey = @"SUInstallationType";
- (void)encodeWithCoder:(NSCoder *)coder - (void)encodeWithCoder:(NSCoder *)coder
{ {
[coder encodeObject:_relaunchPath forKey:SURelaunchPathKey]; [coder encodeObject:self.relaunchPath forKey:SURelaunchPathKey];
[coder encodeObject:_hostBundlePath forKey:SUHostBundlePathKey]; [coder encodeObject:self.hostBundlePath forKey:SUHostBundlePathKey];
[coder encodeObject:_updateDirectoryPath forKey:SUUpdateDirectoryPathKey]; [coder encodeObject:self.updateDirectoryPath forKey:SUUpdateDirectoryPathKey];
[coder encodeObject:_installationType forKey:SUInstallationTypeKey]; [coder encodeObject:self.installationType forKey:SUInstallationTypeKey];
[coder encodeObject:_downloadName forKey:SUDownloadNameKey]; [coder encodeObject:self.downloadName forKey:SUDownloadNameKey];
[coder encodeObject:_signatures forKey:SUSignaturesKey]; [coder encodeObject:self.signatures forKey:SUSignaturesKey];
if (_decryptionPassword != nil) { if (self.decryptionPassword != nil) {
[coder encodeObject:_decryptionPassword forKey:SUDecryptionPasswordKey]; [coder encodeObject:self.decryptionPassword forKey:SUDecryptionPasswordKey];
} }
} }
+1 -1
View File
@@ -97,7 +97,7 @@ NS_ASSUME_NONNULL_BEGIN
(P number of blobs where P <= M commands) (P number of blobs where P <= M commands)
(Indexes for data blobs correspond to indexes for a filtered list of applicable commands (EXTRACT_FILE, BINARY_DIFF_FILE) that have data content) (Indexes for data blobs correspond to indexes for a filtered list of applicable commands (EXTRACT_FILE, BINARY_DIFF_FILE) that have data content)
*/ */
SPU_OBJC_DIRECT_MEMBERS @interface SPUSparkleDeltaArchive : NSObject <SPUDeltaArchiveProtocol> @interface SPUSparkleDeltaArchive : NSObject <SPUDeltaArchiveProtocol>
- (instancetype)initWithPatchFileForWriting:(NSString *)patchFile; - (instancetype)initWithPatchFileForWriting:(NSString *)patchFile;
- (instancetype)initWithPatchFileForReading:(NSString *)patchFile; - (instancetype)initWithPatchFileForReading:(NSString *)patchFile;
+166 -183
View File
@@ -7,15 +7,12 @@
// //
#import "SPUSparkleDeltaArchive.h" #import "SPUSparkleDeltaArchive.h"
#import <bzlib.h>
#import <sys/stat.h> #import <sys/stat.h>
#import <CommonCrypto/CommonDigest.h> #import <CommonCrypto/CommonDigest.h>
#import "SUBinaryDeltaCommon.h" #import "SUBinaryDeltaCommon.h"
#import <compression.h> #import <compression.h>
#if SPARKLE_BUILD_BZIP2_DELTA_SUPPORT
#import <bzlib.h>
#endif
#include "AppKitPrevention.h" #include "AppKitPrevention.h"
#define SPARKLE_DELTA_FORMAT_MAGIC "spk!" #define SPARKLE_DELTA_FORMAT_MAGIC "spk!"
@@ -31,26 +28,39 @@ typedef struct
bool fileSystemCompression : 1; bool fileSystemCompression : 1;
} SparkleDeltaArchiveMetadata; } SparkleDeltaArchiveMetadata;
@implementation SPUSparkleDeltaArchive @interface SPUSparkleDeltaArchive ()
{
FILE *_file;
#if SPARKLE_BUILD_BZIP2_DELTA_SUPPORT
BZFILE *_bzipFile;
#endif
NSString *_patchFile;
NSError *_error;
void *_partialChunkBuffer;
void *_compressionBuffer;
NSMutableArray<SPUDeltaArchiveItem *> *_writableItems;
compression_stream _compressionStream;
SPUDeltaCompressionMode _compression;
BOOL _initializedCompressionStream;
BOOL _writeMode;
}
@property (nonatomic) FILE *file;
@property (nonatomic) BZFILE *bzipFile;
@property (nonatomic) compression_stream compressionStream;
@property (nonatomic) BOOL initializedCompressionStream;
@property (nonatomic, readonly) NSString *patchFile;
@property (nonatomic) SPUDeltaCompressionMode compression;
@property (nonatomic, readonly) BOOL writeMode;
@property (nonatomic) NSError *error;
@property (nonatomic) void *partialChunkBuffer;
@property (nonatomic) void *compressionBuffer;
@property (nonatomic) NSMutableArray<SPUDeltaArchiveItem *> *writableItems;
@end
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
@implementation SPUSparkleDeltaArchive
@synthesize file = _file;
@synthesize bzipFile = _bzipFile;
@synthesize compressionStream = _compressionStream;
@synthesize initializedCompressionStream = _initializedCompressionStream;
@synthesize patchFile = _patchFile;
@synthesize compression = _compression;
@synthesize writeMode = _writeMode;
@synthesize writableItems = _writableItems;
@synthesize error = _error; @synthesize error = _error;
@synthesize partialChunkBuffer = _partialChunkBuffer;
@synthesize compressionBuffer = _compressionBuffer;
+ (BOOL)maySupportSafeExtraction + (BOOL)maySupportSafeExtraction
{ {
@@ -84,45 +94,42 @@ typedef struct
- (void)close - (void)close
{ {
#if SPARKLE_BUILD_BZIP2_DELTA_SUPPORT if (self.bzipFile != NULL) {
if (_bzipFile != NULL) { if (!self.writeMode) {
if (!_writeMode) {
int bzerror = 0; int bzerror = 0;
BZ2_bzReadClose(&bzerror, _bzipFile); BZ2_bzReadClose(&bzerror, self.bzipFile);
} }
_bzipFile = NULL; self.bzipFile = NULL;
} else } else if (self.initializedCompressionStream) {
#endif
if (_initializedCompressionStream) {
compression_stream_destroy(&_compressionStream); compression_stream_destroy(&_compressionStream);
_initializedCompressionStream = NO; self.initializedCompressionStream = NO;
} }
if (_file != NULL) { if (self.file != NULL) {
fclose(_file); fclose(self.file);
_file = NULL; self.file = NULL;
} }
free(_partialChunkBuffer); free(self.partialChunkBuffer);
_partialChunkBuffer = NULL; self.partialChunkBuffer = NULL;
free(_compressionBuffer); free(self.compressionBuffer);
_compressionBuffer = NULL; self.compressionBuffer = NULL;
} }
- (BOOL)createBuffers SPU_OBJC_DIRECT - (BOOL)createBuffers
{ {
_partialChunkBuffer = calloc(1, PARTIAL_IO_CHUNK_SIZE); self.partialChunkBuffer = calloc(1, PARTIAL_IO_CHUNK_SIZE);
if (_partialChunkBuffer == NULL) { if (self.partialChunkBuffer == NULL) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to calloc() %d bytes for partial chunk buffer.", PARTIAL_IO_CHUNK_SIZE] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to calloc() %d bytes for partial chunk buffer.", PARTIAL_IO_CHUNK_SIZE] }];
return NO; return NO;
} }
if (_initializedCompressionStream) { if (self.initializedCompressionStream) {
_compressionBuffer = calloc(1, COMPRESSION_BUFFER_SIZE); self.compressionBuffer = calloc(1, COMPRESSION_BUFFER_SIZE);
if (_compressionBuffer == NULL) { if (self.compressionBuffer == NULL) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to calloc() %d bytes for compression buffer.", COMPRESSION_BUFFER_SIZE] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to calloc() %d bytes for compression buffer.", COMPRESSION_BUFFER_SIZE] }];
return NO; return NO;
} }
} }
@@ -130,53 +137,48 @@ typedef struct
return YES; return YES;
} }
- (BOOL)_readBuffer:(void *)buffer length:(int32_t)length SPU_OBJC_DIRECT - (BOOL)_readBuffer:(void *)buffer length:(int32_t)length
{ {
if (_error != nil) { if (self.error != nil) {
return NO; return NO;
} }
switch (_compression) { switch (self.compression) {
case SPUDeltaCompressionModeNone: { case SPUDeltaCompressionModeNone: {
if (fread(buffer, (size_t)length, 1, _file) < 1) { if (fread(buffer, (size_t)length, 1, self.file) < 1) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to read %d uncompressed bytes from archive.", length] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to read %d uncompressed bytes from archive.", length] }];
return NO; return NO;
} else { } else {
return YES; return YES;
} }
} }
case SPUDeltaCompressionModeBzip2: case SPUDeltaCompressionModeBzip2: {
{
#if SPARKLE_BUILD_BZIP2_DELTA_SUPPORT
int bzerror = 0; int bzerror = 0;
int bytesRead = BZ2_bzRead(&bzerror, _bzipFile, buffer, length); int bytesRead = BZ2_bzRead(&bzerror, self.bzipFile, buffer, length);
switch (bzerror) { switch (bzerror) {
case BZ_OK: case BZ_OK:
case BZ_STREAM_END: case BZ_STREAM_END:
if (bytesRead < length) { if (bytesRead < length) {
_error = [NSError errorWithDomain:SPARKLE_BZIP2_ERROR_DOMAIN code:0 userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Only %d out of %d expected bytes were read from the bz2 archive.", bytesRead, length] }]; self.error = [NSError errorWithDomain:SPARKLE_BZIP2_ERROR_DOMAIN code:0 userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Only %d out of %d expected bytes were read from the bz2 archive.", bytesRead, length] }];
return NO; return NO;
} else { } else {
return YES; return YES;
} }
case BZ_IO_ERROR: case BZ_IO_ERROR:
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: @"Encountered unexpected IO error when reading compressed bytes from bz2 archive." }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: @"Encountered unexpected IO error when reading compressed bytes from bz2 archive." }];
return NO; return NO;
default: default:
_error = [NSError errorWithDomain:SPARKLE_BZIP2_ERROR_DOMAIN code:bzerror userInfo:@{ NSLocalizedDescriptionKey: @"Encountered unexpected error when reading compressed bytes from bz2 archive." }]; self.error = [NSError errorWithDomain:SPARKLE_BZIP2_ERROR_DOMAIN code:bzerror userInfo:@{ NSLocalizedDescriptionKey: @"Encountered unexpected error when reading compressed bytes from bz2 archive." }];
return NO; return NO;
} }
#else
return NO;
#endif
} }
case SPUDeltaCompressionModeLZMA: case SPUDeltaCompressionModeLZMA:
case SPUDeltaCompressionModeLZFSE: case SPUDeltaCompressionModeLZFSE:
case SPUDeltaCompressionModeLZ4: case SPUDeltaCompressionModeLZ4:
case SPUDeltaCompressionModeZLIB: { case SPUDeltaCompressionModeZLIB: {
FILE *file = _file; FILE *file = self.file;
void *compressionBuffer = _compressionBuffer; void *compressionBuffer = self.compressionBuffer;
_compressionStream.dst_ptr = buffer; _compressionStream.dst_ptr = buffer;
_compressionStream.dst_size = (size_t)length; _compressionStream.dst_size = (size_t)length;
@@ -188,7 +190,7 @@ typedef struct
size_t bytesRead = fread(compressionBuffer, 1, COMPRESSION_BUFFER_SIZE, file); size_t bytesRead = fread(compressionBuffer, 1, COMPRESSION_BUFFER_SIZE, file);
if (bytesRead < COMPRESSION_BUFFER_SIZE) { if (bytesRead < COMPRESSION_BUFFER_SIZE) {
if (feof(file) == 0) { if (feof(file) == 0) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to read %d compressed raw bytes from archive.", length] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to read %d compressed raw bytes from archive.", length] }];
return NO; return NO;
} }
} }
@@ -200,13 +202,13 @@ typedef struct
compression_status status = compression_stream_process(&_compressionStream, feof(file) != 0 ? COMPRESSION_STREAM_FINALIZE : 0); compression_status status = compression_stream_process(&_compressionStream, feof(file) != 0 ? COMPRESSION_STREAM_FINALIZE : 0);
if (status == COMPRESSION_STATUS_ERROR) { if (status == COMPRESSION_STATUS_ERROR) {
_error = [NSError errorWithDomain:SPARKLE_COMPRESSION_ERROR_DOMAIN code:COMPRESSION_STATUS_ERROR userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to read %d compressed bytes.", length] }]; self.error = [NSError errorWithDomain:SPARKLE_COMPRESSION_ERROR_DOMAIN code:COMPRESSION_STATUS_ERROR userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to read %d compressed bytes.", length] }];
return NO; return NO;
} }
if (status == COMPRESSION_STATUS_END && _compressionStream.dst_size > 0) { if (status == COMPRESSION_STATUS_END && _compressionStream.dst_size > 0) {
// We're expecting more bytes but we can't read any more bytes // We're expecting more bytes but we can't read any more bytes
_error = [NSError errorWithDomain:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN code:-1 userInfo:@{ NSLocalizedDescriptionKey: @"Failed to decompress and read bytes because we reached EOF" }]; self.error = [NSError errorWithDomain:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN code:-1 userInfo:@{ NSLocalizedDescriptionKey: @"Failed to decompress and read bytes because we reached EOF" }];
return NO; return NO;
} }
} }
@@ -237,44 +239,44 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
- (nullable SPUDeltaArchiveHeader *)readHeader - (nullable SPUDeltaArchiveHeader *)readHeader
{ {
NSString *patchFile = _patchFile; NSString *patchFile = self.patchFile;
char patchFilePath[PATH_MAX + 1] = {0}; char patchFilePath[PATH_MAX + 1] = {0};
if (![patchFile getFileSystemRepresentation:patchFilePath maxLength:sizeof(patchFilePath) - 1]) { if (![patchFile getFileSystemRepresentation:patchFilePath maxLength:sizeof(patchFilePath) - 1]) {
_error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to open and represent as a file system representation: %@", patchFile] }]; self.error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to open and represent as a file system representation: %@", patchFile] }];
return nil; return nil;
} }
FILE *file = fopen(patchFilePath, "rb"); FILE *file = fopen(patchFilePath, "rb");
if (file == NULL) { if (file == NULL) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to open patch file for writing value due to io error: %@", patchFile] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to open patch file for writing value due to io error: %@", patchFile] }];
return nil; return nil;
} }
_file = file; self.file = file;
char magic[5] = {0}; char magic[5] = {0};
if (fread(magic, sizeof(magic) - 1, 1, file) < 1) { if (fread(magic, sizeof(magic) - 1, 1, file) < 1) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to read magic value from patch file: %@", patchFile] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to read magic value from patch file: %@", patchFile] }];
return nil; return nil;
} }
if (strncmp(magic, SPARKLE_DELTA_FORMAT_MAGIC, sizeof(magic) - 1) != 0) { if (strncmp(magic, SPARKLE_DELTA_FORMAT_MAGIC, sizeof(magic) - 1) != 0) {
_error = [NSError errorWithDomain:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_ARCHIVE_ERROR_CODE_BAD_MAGIC userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Patch file does not have '%@' magic value", @SPARKLE_DELTA_FORMAT_MAGIC] }]; self.error = [NSError errorWithDomain:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_ARCHIVE_ERROR_CODE_BAD_MAGIC userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Patch file does not have '%@' magic value", @SPARKLE_DELTA_FORMAT_MAGIC] }];
return nil; return nil;
} }
SPUDeltaCompressionMode compression = 0; SPUDeltaCompressionMode compression = 0;
if (fread(&compression, sizeof(compression), 1, file) < 1) { if (fread(&compression, sizeof(compression), 1, file) < 1) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to read compression value from patch file: %@", patchFile] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to read compression value from patch file: %@", patchFile] }];
return nil; return nil;
} }
_compression = compression; self.compression = compression;
SparkleDeltaArchiveMetadata metadata = {0}; SparkleDeltaArchiveMetadata metadata = {0};
if (fread(&metadata, sizeof(metadata), 1, file) < 1) { if (fread(&metadata, sizeof(metadata), 1, file) < 1) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to read compression level value from patch file: %@", patchFile] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to read compression level value from patch file: %@", patchFile] }];
return nil; return nil;
} }
@@ -282,45 +284,40 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
case SPUDeltaCompressionModeNone: case SPUDeltaCompressionModeNone:
break; break;
case SPUDeltaCompressionModeBzip2: { case SPUDeltaCompressionModeBzip2: {
#if SPARKLE_BUILD_BZIP2_DELTA_SUPPORT
int bzerror = 0; int bzerror = 0;
BZFILE *bzipFile = BZ2_bzReadOpen(&bzerror, file, 0, 0, NULL, 0); BZFILE *bzipFile = BZ2_bzReadOpen(&bzerror, file, 0, 0, NULL, 0);
if (bzipFile == NULL) { if (bzipFile == NULL) {
switch (bzerror) { switch (bzerror) {
case BZ_IO_ERROR: case BZ_IO_ERROR:
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to open patch as bz2 file due to io error: %@", patchFile] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to open patch as bz2 file due to io error: %@", patchFile] }];
break; break;
default: default:
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:bzerror userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to open patch as bz2 file: %@", patchFile] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:bzerror userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to open patch as bz2 file: %@", patchFile] }];
break; break;
} }
return nil; return nil;
} }
_bzipFile = bzipFile; self.bzipFile = bzipFile;
break; break;
#else
_error = [NSError errorWithDomain:SPARKLE_BZIP2_ERROR_DOMAIN code:-1 userInfo:@{ NSLocalizedDescriptionKey: @"Failed to open patch as bz2 file because bzip2 support is disabled" }];
return nil;
#endif
} }
case SPUDeltaCompressionModeLZMA: case SPUDeltaCompressionModeLZMA:
case SPUDeltaCompressionModeLZFSE: case SPUDeltaCompressionModeLZFSE:
case SPUDeltaCompressionModeLZ4: case SPUDeltaCompressionModeLZ4:
case SPUDeltaCompressionModeZLIB: { case SPUDeltaCompressionModeZLIB: {
if (compression_stream_init(&_compressionStream, COMPRESSION_STREAM_DECODE, _compressionAlgorithmForMode(compression)) != COMPRESSION_STATUS_OK) { if (compression_stream_init(&_compressionStream, COMPRESSION_STREAM_DECODE, _compressionAlgorithmForMode(compression)) != COMPRESSION_STATUS_OK) {
_error = [NSError errorWithDomain:SPARKLE_COMPRESSION_ERROR_DOMAIN code:COMPRESSION_STATUS_ERROR userInfo:@{ NSLocalizedDescriptionKey: @"Failed to open compression stream for reading" }]; self.error = [NSError errorWithDomain:SPARKLE_COMPRESSION_ERROR_DOMAIN code:COMPRESSION_STATUS_ERROR userInfo:@{ NSLocalizedDescriptionKey: @"Failed to open compression stream for reading" }];
return nil; return nil;
} }
_initializedCompressionStream = YES; self.initializedCompressionStream = YES;
break; break;
} }
default: default:
_error = [NSError errorWithDomain:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_ARCHIVE_ERROR_CODE_BAD_COMPRESSION_VALUE userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Compression value read %d is not recognized.", compression] }]; self.error = [NSError errorWithDomain:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_ARCHIVE_ERROR_CODE_BAD_COMPRESSION_VALUE userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Compression value read %d is not recognized.", compression] }];
return nil; return nil;
} }
@@ -351,9 +348,9 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
return [[SPUDeltaArchiveHeader alloc] initWithCompression:compression compressionLevel:metadata.compressionLevel fileSystemCompression:metadata.fileSystemCompression majorVersion:majorVersion minorVersion:minorVersion beforeTreeHash:beforeTreeHash afterTreeHash:afterTreeHash]; return [[SPUDeltaArchiveHeader alloc] initWithCompression:compression compressionLevel:metadata.compressionLevel fileSystemCompression:metadata.fileSystemCompression majorVersion:majorVersion minorVersion:minorVersion beforeTreeHash:beforeTreeHash afterTreeHash:afterTreeHash];
} }
- (NSArray<NSString *> *)_readRelativeFilePaths SPU_OBJC_DIRECT - (NSArray<NSString *> *)_readRelativeFilePaths
{ {
if (_error != nil) { if (self.error != nil) {
return nil; return nil;
} }
@@ -369,7 +366,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
char *fileTableData = calloc(1, filePathSectionSize); char *fileTableData = calloc(1, filePathSectionSize);
if (fileTableData == NULL) { if (fileTableData == NULL) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to calloc() %llu bytes for relative file paths.", filePathSectionSize] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to calloc() %llu bytes for relative file paths.", filePathSectionSize] }];
return nil; return nil;
} }
@@ -396,7 +393,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
if (fileTableData[index] == '\0') { if (fileTableData[index] == '\0') {
NSString *relativePath = [fileManager stringWithFileSystemRepresentation:&fileTableData[currentStartIndex] length:index - currentStartIndex]; NSString *relativePath = [fileManager stringWithFileSystemRepresentation:&fileTableData[currentStartIndex] length:index - currentStartIndex];
if (relativePath == nil) { if (relativePath == nil) {
_error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Relative path cannot be decoded as a file system representation: %@", relativePath] }]; self.error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Relative path cannot be decoded as a file system representation: %@", relativePath] }];
free(fileTableData); free(fileTableData);
return nil; return nil;
@@ -428,7 +425,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
if (relativeFilePaths.count > UINT32_MAX) { if (relativeFilePaths.count > UINT32_MAX) {
// Very unlikely but we should guard against this // Very unlikely but we should guard against this
// Clones rely on 32-bit indexes // Clones rely on 32-bit indexes
_error = [NSError errorWithDomain:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_ARCHIVE_ERROR_CODE_TOO_MANY_FILES userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"There are too many file entries to apply a patch for (more than %u)", UINT32_MAX] }]; self.error = [NSError errorWithDomain:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_ARCHIVE_ERROR_CODE_TOO_MANY_FILES userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"There are too many file entries to apply a patch for (more than %u)", UINT32_MAX] }];
return; return;
} }
@@ -467,7 +464,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
} }
if ((NSUInteger)cloneRelativePathIndex >= relativeFilePaths.count) { if ((NSUInteger)cloneRelativePathIndex >= relativeFilePaths.count) {
_error = [NSError errorWithDomain:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_ARCHIVE_ERROR_CODE_BAD_CLONE_LOOKUP userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Index %u is past relative path table bounds of length %lu", cloneRelativePathIndex, (unsigned long)relativeFilePaths.count] }]; self.error = [NSError errorWithDomain:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_ARCHIVE_ERROR_CODE_BAD_CLONE_LOOKUP userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Index %u is past relative path table bounds of length %lu", cloneRelativePathIndex, (unsigned long)relativeFilePaths.count] }];
break; break;
} }
@@ -528,7 +525,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
} }
} }
if (_error != nil) { if (self.error != nil) {
return; return;
} }
@@ -566,13 +563,13 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
char itemFilePathString[PATH_MAX + 1] = {0}; char itemFilePathString[PATH_MAX + 1] = {0};
if (![itemFilePath getFileSystemRepresentation:itemFilePathString maxLength:sizeof(itemFilePathString) - 1]) { if (![itemFilePath getFileSystemRepresentation:itemFilePathString maxLength:sizeof(itemFilePathString) - 1]) {
_error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Path to extract cannot be decoded and expressed as a file system representation: %@", itemFilePath] }]; self.error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Path to extract cannot be decoded and expressed as a file system representation: %@", itemFilePath] }];
return NO; return NO;
} }
FILE *outputFile = fopen(itemFilePathString, "wb"); FILE *outputFile = fopen(itemFilePathString, "wb");
if (outputFile == NULL) { if (outputFile == NULL) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to fopen() %@", itemFilePath] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to fopen() %@", itemFilePath] }];
return NO; return NO;
} }
@@ -583,14 +580,14 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
while (bytesLeftoverToCopy > 0) { while (bytesLeftoverToCopy > 0) {
uint64_t currentBlockSize = (bytesLeftoverToCopy >= PARTIAL_IO_CHUNK_SIZE) ? PARTIAL_IO_CHUNK_SIZE : bytesLeftoverToCopy; uint64_t currentBlockSize = (bytesLeftoverToCopy >= PARTIAL_IO_CHUNK_SIZE) ? PARTIAL_IO_CHUNK_SIZE : bytesLeftoverToCopy;
void *tempBuffer = _partialChunkBuffer; void *tempBuffer = self.partialChunkBuffer;
if (![self _readBuffer:tempBuffer length:(int32_t)currentBlockSize]) { if (![self _readBuffer:tempBuffer length:(int32_t)currentBlockSize]) {
break; break;
} }
if (fwrite(tempBuffer, currentBlockSize, 1, outputFile) < 1) { if (fwrite(tempBuffer, currentBlockSize, 1, outputFile) < 1) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to fwrite() %llu bytes during extraction.", currentBlockSize] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to fwrite() %llu bytes during extraction.", currentBlockSize] }];
break; break;
} }
@@ -600,12 +597,12 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
fclose(outputFile); fclose(outputFile);
if (_error != nil) { if (self.error != nil) {
return NO; return NO;
} }
if ((commands & SPUDeltaItemCommandExtract) != 0 && chmod(itemFilePathString, mode) != 0) { if ((commands & SPUDeltaItemCommandExtract) != 0 && chmod(itemFilePathString, mode) != 0) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to chmod() mode %d on %@", mode, itemFilePath] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to chmod() mode %d on %@", mode, itemFilePath] }];
return NO; return NO;
} }
} else { } else {
@@ -613,13 +610,13 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
if (PARTIAL_IO_CHUNK_SIZE < decodedLength) { if (PARTIAL_IO_CHUNK_SIZE < decodedLength) {
// Something is seriously wrong // Something is seriously wrong
_error = [NSError errorWithDomain:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_ARCHIVE_ERROR_CODE_BAD_CHUNK_SIZE userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"PARTIAL_IO_CHUNK_SIZE (%d) < decodedLength (%llu)", PARTIAL_IO_CHUNK_SIZE, decodedLength] }]; self.error = [NSError errorWithDomain:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_ARCHIVE_ERROR_CODE_BAD_CHUNK_SIZE userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"PARTIAL_IO_CHUNK_SIZE (%d) < decodedLength (%llu)", PARTIAL_IO_CHUNK_SIZE, decodedLength] }];
return NO; return NO;
} }
if (decodedLength > PATH_MAX) { if (decodedLength > PATH_MAX) {
// Link is too long // Link is too long
_error = [NSError errorWithDomain:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_ARCHIVE_ERROR_CODE_LINK_TOO_LONG userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Decoded length for link (%llu) is too long.", decodedLength] }]; self.error = [NSError errorWithDomain:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_ARCHIVE_ERROR_CODE_LINK_TOO_LONG userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Decoded length for link (%llu) is too long.", decodedLength] }];
return NO; return NO;
} }
@@ -631,7 +628,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
NSString *destinationPath = [fileManager stringWithFileSystemRepresentation:buffer length:decodedLength]; NSString *destinationPath = [fileManager stringWithFileSystemRepresentation:buffer length:decodedLength];
if (destinationPath == nil) { if (destinationPath == nil) {
_error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Destination path for link %@ cannot be created in a file system representation: %@",itemFilePath, destinationPath] }]; self.error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Destination path for link %@ cannot be created in a file system representation: %@",itemFilePath, destinationPath] }];
return NO; return NO;
} }
@@ -639,13 +636,13 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
NSError *createLinkError = nil; NSError *createLinkError = nil;
if (![fileManager createSymbolicLinkAtPath:itemFilePath withDestinationPath:destinationPath error:&createLinkError]) { if (![fileManager createSymbolicLinkAtPath:itemFilePath withDestinationPath:destinationPath error:&createLinkError]) {
_error = createLinkError; self.error = createLinkError;
return NO; return NO;
} }
char itemFilePathString[PATH_MAX + 1] = {0}; char itemFilePathString[PATH_MAX + 1] = {0};
if (![itemFilePath getFileSystemRepresentation:itemFilePathString maxLength:sizeof(itemFilePathString) - 1]) { if (![itemFilePath getFileSystemRepresentation:itemFilePathString maxLength:sizeof(itemFilePathString) - 1]) {
_error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Link path to extract cannot be decoded and expressed as a file system representation: %@", itemFilePath] }]; self.error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Link path to extract cannot be decoded and expressed as a file system representation: %@", itemFilePath] }];
return NO; return NO;
} }
@@ -657,7 +654,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
} else if (S_ISDIR(mode)) { } else if (S_ISDIR(mode)) {
NSError *createDirectoryError = nil; NSError *createDirectoryError = nil;
if (![fileManager createDirectoryAtPath:itemFilePath withIntermediateDirectories:NO attributes:@{NSFilePosixPermissions: @(mode)} error:&createDirectoryError]) { if (![fileManager createDirectoryAtPath:itemFilePath withIntermediateDirectories:NO attributes:@{NSFilePosixPermissions: @(mode)} error:&createDirectoryError]) {
_error = createDirectoryError; self.error = createDirectoryError;
return NO; return NO;
} }
} }
@@ -665,39 +662,34 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
return YES; return YES;
} }
- (BOOL)_writeBuffer:(void *)buffer length:(int32_t)length SPU_OBJC_DIRECT - (BOOL)_writeBuffer:(void *)buffer length:(int32_t)length
{ {
if (_error != nil) { if (self.error != nil) {
return NO; return NO;
} }
switch (_compression) { switch (self.compression) {
case SPUDeltaCompressionModeNone: { case SPUDeltaCompressionModeNone: {
BOOL success = (fwrite(buffer, (size_t)length, 1, _file) == 1); BOOL success = (fwrite(buffer, (size_t)length, 1, self.file) == 1);
if (!success) { if (!success) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to write %d uncompressed bytes.", length] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to write %d uncompressed bytes.", length] }];
} }
return success; return success;
} }
case SPUDeltaCompressionModeBzip2: case SPUDeltaCompressionModeBzip2: {
{
#if SPARKLE_BUILD_BZIP2_DELTA_SUPPORT
int bzerror = 0; int bzerror = 0;
BZ2_bzWrite(&bzerror, _bzipFile, buffer, length); BZ2_bzWrite(&bzerror, self.bzipFile, buffer, length);
switch (bzerror) { switch (bzerror) {
case BZ_OK: case BZ_OK:
return YES; return YES;
case BZ_IO_ERROR: case BZ_IO_ERROR:
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to write %d compressed bz2 bytes due to io error.", length] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to write %d compressed bz2 bytes due to io error.", length] }];
return NO; return NO;
default: default:
_error = [NSError errorWithDomain:SPARKLE_BZIP2_ERROR_DOMAIN code:bzerror userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to write %d compressed bz2 bytes.", length] }]; self.error = [NSError errorWithDomain:SPARKLE_BZIP2_ERROR_DOMAIN code:bzerror userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to write %d compressed bz2 bytes.", length] }];
return NO; return NO;
} }
#else
return NO;
#endif
} }
case SPUDeltaCompressionModeLZMA: case SPUDeltaCompressionModeLZMA:
case SPUDeltaCompressionModeLZFSE: case SPUDeltaCompressionModeLZFSE:
@@ -706,21 +698,21 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
_compressionStream.src_ptr = buffer; _compressionStream.src_ptr = buffer;
_compressionStream.src_size = (size_t)length; _compressionStream.src_size = (size_t)length;
FILE *file = _file; FILE *file = self.file;
void *compressionBuffer = _compressionBuffer; void *compressionBuffer = self.compressionBuffer;
while (_compressionStream.src_size > 0) { while (_compressionStream.src_size > 0) {
// Reset destination buffer // Reset destination buffer
_compressionStream.dst_ptr = compressionBuffer; _compressionStream.dst_ptr = compressionBuffer;
_compressionStream.dst_size = COMPRESSION_BUFFER_SIZE; _compressionStream.dst_size = COMPRESSION_BUFFER_SIZE;
if (compression_stream_process(&_compressionStream, 0) == COMPRESSION_STATUS_ERROR) { if (compression_stream_process(&_compressionStream, 0) == COMPRESSION_STATUS_ERROR) {
_error = [NSError errorWithDomain:SPARKLE_COMPRESSION_ERROR_DOMAIN code:COMPRESSION_STATUS_ERROR userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to write %d compressed bytes.", length] }]; self.error = [NSError errorWithDomain:SPARKLE_COMPRESSION_ERROR_DOMAIN code:COMPRESSION_STATUS_ERROR userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to write %d compressed bytes.", length] }];
return NO; return NO;
} }
size_t compressedBytesWritten = (size_t)(_compressionStream.dst_ptr - (uint8_t *)compressionBuffer); size_t compressedBytesWritten = (size_t)(_compressionStream.dst_ptr - (uint8_t *)compressionBuffer);
if (compressedBytesWritten > 0 && fwrite(compressionBuffer, compressedBytesWritten, 1, file) < 1) { if (compressedBytesWritten > 0 && fwrite(compressionBuffer, compressedBytesWritten, 1, file) < 1) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to write %zu compressed bytes.", compressedBytesWritten] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to write %zu compressed bytes.", compressedBytesWritten] }];
return NO; return NO;
} }
} }
@@ -733,31 +725,31 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
- (void)writeHeader:(SPUDeltaArchiveHeader *)header - (void)writeHeader:(SPUDeltaArchiveHeader *)header
{ {
char patchFilePath[PATH_MAX + 1] = {0}; char patchFilePath[PATH_MAX + 1] = {0};
if (![_patchFile getFileSystemRepresentation:patchFilePath maxLength:sizeof(patchFilePath) - 1]) { if (![self.patchFile getFileSystemRepresentation:patchFilePath maxLength:sizeof(patchFilePath) - 1]) {
_error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to open header and represent as a file system representation: %@", _patchFile] }]; self.error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to open header and represent as a file system representation: %@", self.patchFile] }];
return; return;
} }
FILE *file = fopen(patchFilePath, "wb"); FILE *file = fopen(patchFilePath, "wb");
if (file == NULL) { if (file == NULL) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to open patch file for writing: %@", _patchFile] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to open patch file for writing: %@", self.patchFile] }];
return; return;
} }
_file = file; self.file = file;
char magic[] = SPARKLE_DELTA_FORMAT_MAGIC; char magic[] = SPARKLE_DELTA_FORMAT_MAGIC;
if (fwrite(magic, sizeof(magic) - 1, 1, file) < 1) { if (fwrite(magic, sizeof(magic) - 1, 1, file) < 1) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: @"Failed to write magic value due to io error" }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: @"Failed to write magic value due to io error" }];
return; return;
} }
SPUDeltaCompressionMode compression = (header.compression == SPUDeltaCompressionModeDefault) ? SPUDeltaCompressionModeLZMA : header.compression; SPUDeltaCompressionMode compression = (header.compression == SPUDeltaCompressionModeDefault) ? SPUDeltaCompressionModeLZMA : header.compression;
_compression = compression; self.compression = compression;
if (fwrite(&compression, sizeof(compression), 1, file) < 1) { if (fwrite(&compression, sizeof(compression), 1, file) < 1) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: @"Failed to write compression value due to io error" }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: @"Failed to write compression value due to io error" }];
return; return;
} }
@@ -765,19 +757,13 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
uint8_t compressionLevel = 0; uint8_t compressionLevel = 0;
switch (compression) { switch (compression) {
case SPUDeltaCompressionModeBzip2: case SPUDeltaCompressionModeBzip2:
#if SPARKLE_BUILD_BZIP2_DELTA_SUPPORT
// Only 1 - 9 are valid, 0 is a special case for using default 9 // Only 1 - 9 are valid, 0 is a special case for using default 9
if (header.compressionLevel <= 0 || header.compressionLevel > 9) { if (header.compressionLevel <= 0 || header.compressionLevel > 9) {
compressionLevel = 9; compressionLevel = 9;
} else { } else {
compressionLevel = header.compressionLevel; compressionLevel = header.compressionLevel;
} }
break; break;
#else
_error = [NSError errorWithDomain:SPARKLE_BZIP2_ERROR_DOMAIN code:-1 userInfo:@{ NSLocalizedDescriptionKey: @"Failed to write bzip2 patch because bzip2 support is disabled" }];
return;
#endif
// Some supported formats below have a documented level even though it's not customizable // Some supported formats below have a documented level even though it's not customizable
// Let's record them in the archive // Let's record them in the archive
case SPUDeltaCompressionModeLZMA: case SPUDeltaCompressionModeLZMA:
@@ -796,7 +782,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
SparkleDeltaArchiveMetadata metadata = {.compressionLevel = compressionLevel, .fileSystemCompression = header.fileSystemCompression}; SparkleDeltaArchiveMetadata metadata = {.compressionLevel = compressionLevel, .fileSystemCompression = header.fileSystemCompression};
if (fwrite(&metadata, sizeof(metadata), 1, file) < 1) { if (fwrite(&metadata, sizeof(metadata), 1, file) < 1) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: @"Failed to write metadata value due to io error" }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: @"Failed to write metadata value due to io error" }];
return; return;
} }
@@ -804,7 +790,6 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
case SPUDeltaCompressionModeNone: case SPUDeltaCompressionModeNone:
break; break;
case SPUDeltaCompressionModeBzip2: { case SPUDeltaCompressionModeBzip2: {
#if SPARKLE_BUILD_BZIP2_DELTA_SUPPORT
int bzerror = 0; int bzerror = 0;
// Compression level can be 1 - 9 // Compression level can be 1 - 9
int blockSize100k = (int)compressionLevel; int blockSize100k = (int)compressionLevel;
@@ -813,18 +798,17 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
if (bzipFile == NULL) { if (bzipFile == NULL) {
switch (bzerror) { switch (bzerror) {
case BZ_IO_ERROR: case BZ_IO_ERROR:
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: @"Failed to open bz2 stream for writing due to io error" }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: @"Failed to open bz2 stream for writing due to io error" }];
break; break;
default: default:
_error = [NSError errorWithDomain:SPARKLE_BZIP2_ERROR_DOMAIN code:bzerror userInfo:@{ NSLocalizedDescriptionKey: @"Failed to open bz2 stream for writing" }]; self.error = [NSError errorWithDomain:SPARKLE_BZIP2_ERROR_DOMAIN code:bzerror userInfo:@{ NSLocalizedDescriptionKey: @"Failed to open bz2 stream for writing" }];
break; break;
} }
return; return;
} }
_bzipFile = bzipFile; self.bzipFile = bzipFile;
#endif
break; break;
} }
@@ -833,12 +817,12 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
case SPUDeltaCompressionModeLZ4: case SPUDeltaCompressionModeLZ4:
case SPUDeltaCompressionModeZLIB: { case SPUDeltaCompressionModeZLIB: {
if (compression_stream_init(&_compressionStream, COMPRESSION_STREAM_ENCODE, _compressionAlgorithmForMode(compression)) != COMPRESSION_STATUS_OK) { if (compression_stream_init(&_compressionStream, COMPRESSION_STREAM_ENCODE, _compressionAlgorithmForMode(compression)) != COMPRESSION_STATUS_OK) {
_error = [NSError errorWithDomain:SPARKLE_COMPRESSION_ERROR_DOMAIN code:COMPRESSION_STATUS_ERROR userInfo:@{ NSLocalizedDescriptionKey: @"Failed to open compression stream for writing" }]; self.error = [NSError errorWithDomain:SPARKLE_COMPRESSION_ERROR_DOMAIN code:COMPRESSION_STATUS_ERROR userInfo:@{ NSLocalizedDescriptionKey: @"Failed to open compression stream for writing" }];
return; return;
} }
_initializedCompressionStream = YES; self.initializedCompressionStream = YES;
break; break;
} }
} }
@@ -859,16 +843,16 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
- (void)addItem:(SPUDeltaArchiveItem *)item - (void)addItem:(SPUDeltaArchiveItem *)item
{ {
[_writableItems addObject:item]; [self.writableItems addObject:item];
} }
- (void)finishEncodingItems - (void)finishEncodingItems
{ {
if (_error != nil) { if (self.error != nil) {
return; return;
} }
NSMutableArray<SPUDeltaArchiveItem *> *writableItems = _writableItems; NSMutableArray<SPUDeltaArchiveItem *> *writableItems = self.writableItems;
// Build relative path table for tracking file clones // Build relative path table for tracking file clones
NSMutableDictionary<NSString *, NSNumber *> *relativePathToIndexTable = [NSMutableDictionary dictionary]; NSMutableDictionary<NSString *, NSNumber *> *relativePathToIndexTable = [NSMutableDictionary dictionary];
@@ -900,7 +884,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
if (relativePathToIndexTable.count > UINT32_MAX) { if (relativePathToIndexTable.count > UINT32_MAX) {
// Very unlikely but we should guard against this // Very unlikely but we should guard against this
// Clones rely on 32-bit indexes // Clones rely on 32-bit indexes
_error = [NSError errorWithDomain:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_ARCHIVE_ERROR_CODE_TOO_MANY_FILES userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"There are too many file entries to create a patch for (more than %u)", UINT32_MAX] }]; self.error = [NSError errorWithDomain:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_ARCHIVE_ERROR_CODE_TOO_MANY_FILES userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"There are too many file entries to create a patch for (more than %u)", UINT32_MAX] }];
return; return;
} }
@@ -911,7 +895,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
char relativePathString[PATH_MAX + 1] = {0}; char relativePathString[PATH_MAX + 1] = {0};
if (![relativePath getFileSystemRepresentation:relativePathString maxLength:sizeof(relativePathString) - 1]) { if (![relativePath getFileSystemRepresentation:relativePathString maxLength:sizeof(relativePathString) - 1]) {
_error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Relative path cannot be retrieved and expressed as a file system representation: %@", relativePath] }]; self.error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Relative path cannot be retrieved and expressed as a file system representation: %@", relativePath] }];
break; break;
} }
@@ -920,14 +904,14 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
for (NSString *clonedPathEntry in newClonedPathEntries) { for (NSString *clonedPathEntry in newClonedPathEntries) {
char relativePathString[PATH_MAX + 1] = {0}; char relativePathString[PATH_MAX + 1] = {0};
if (![clonedPathEntry getFileSystemRepresentation:relativePathString maxLength:sizeof(relativePathString) - 1]) { if (![clonedPathEntry getFileSystemRepresentation:relativePathString maxLength:sizeof(relativePathString) - 1]) {
_error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Relative path for clone cannot be retrieved and expressed as a file system representation: %@", clonedPathEntry] }]; self.error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Relative path for clone cannot be retrieved and expressed as a file system representation: %@", clonedPathEntry] }];
break; break;
} }
totalPathLength += strlen(relativePathString) + 1; totalPathLength += strlen(relativePathString) + 1;
} }
if (_error != nil) { if (self.error != nil) {
return; return;
} }
@@ -942,7 +926,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
char pathBuffer[PATH_MAX + 1] = {0}; char pathBuffer[PATH_MAX + 1] = {0};
if (![relativePath getFileSystemRepresentation:pathBuffer maxLength:PATH_MAX]) { if (![relativePath getFileSystemRepresentation:pathBuffer maxLength:PATH_MAX]) {
_error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Relative path cannot be encoded and expressed as a file system representation: %@", relativePath] }]; self.error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Relative path cannot be encoded and expressed as a file system representation: %@", relativePath] }];
break; break;
} }
@@ -953,7 +937,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
for (NSString *clonedPathEntry in newClonedPathEntries) { for (NSString *clonedPathEntry in newClonedPathEntries) {
char pathBuffer[PATH_MAX + 1] = {0}; char pathBuffer[PATH_MAX + 1] = {0};
if (![clonedPathEntry getFileSystemRepresentation:pathBuffer maxLength:PATH_MAX]) { if (![clonedPathEntry getFileSystemRepresentation:pathBuffer maxLength:PATH_MAX]) {
_error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Relative path for clone cannot be encoded and expressed as a file system representation: %@", clonedPathEntry] }]; self.error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Relative path for clone cannot be encoded and expressed as a file system representation: %@", clonedPathEntry] }];
break; break;
} }
@@ -962,7 +946,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
} }
} }
if (_error != nil) { if (self.error != nil) {
return; return;
} }
@@ -985,13 +969,13 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
char sourcePathString[PATH_MAX + 1] = {0}; char sourcePathString[PATH_MAX + 1] = {0};
if (![sourcePath getFileSystemRepresentation:sourcePathString maxLength:sizeof(sourcePathString) - 1]) { if (![sourcePath getFileSystemRepresentation:sourcePathString maxLength:sizeof(sourcePathString) - 1]) {
_error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Path cannot be decoded and expressed as a file system representation while encoding cloned binary diff item: %@", sourcePath] }]; self.error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Path cannot be decoded and expressed as a file system representation while encoding cloned binary diff item: %@", sourcePath] }];
break; break;
} }
struct stat fileInfo = {0}; struct stat fileInfo = {0};
if (lstat(sourcePathString, &fileInfo) != 0) { if (lstat(sourcePathString, &fileInfo) != 0) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to lstat() on %@", sourcePath] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to lstat() on %@", sourcePath] }];
break; break;
} }
@@ -1018,7 +1002,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
NSNumber *relativePathIndex = relativePathToIndexTable[clonedRelativePath]; NSNumber *relativePathIndex = relativePathToIndexTable[clonedRelativePath];
if (relativePathIndex == nil) { if (relativePathIndex == nil) {
// We have quite a problem here // We have quite a problem here
_error = [NSError errorWithDomain:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_ARCHIVE_ERROR_CODE_BAD_CLONE_LOOKUP userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Relative file path index for %@ could not be located", clonedRelativePath] }]; self.error = [NSError errorWithDomain:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_ARCHIVE_ERROR_CODE_BAD_CLONE_LOOKUP userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Relative file path index for %@ could not be located", clonedRelativePath] }];
break; break;
} }
@@ -1033,13 +1017,13 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
char itemFilePathString[PATH_MAX + 1] = {0}; char itemFilePathString[PATH_MAX + 1] = {0};
if (![itemPath getFileSystemRepresentation:itemFilePathString maxLength:sizeof(itemFilePathString) - 1]) { if (![itemPath getFileSystemRepresentation:itemFilePathString maxLength:sizeof(itemFilePathString) - 1]) {
_error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Path cannot be decoded and expressed as a file system representation while encoding cloned binary diff item: %@", itemPath] }]; self.error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Path cannot be decoded and expressed as a file system representation while encoding cloned binary diff item: %@", itemPath] }];
break; break;
} }
struct stat fileInfo = {0}; struct stat fileInfo = {0};
if (lstat(itemFilePathString, &fileInfo) != 0) { if (lstat(itemFilePathString, &fileInfo) != 0) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to lstat() on %@", itemPath] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to lstat() on %@", itemPath] }];
break; break;
} }
@@ -1059,13 +1043,13 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
char sourceFilePathString[PATH_MAX + 1] = {0}; char sourceFilePathString[PATH_MAX + 1] = {0};
if (![sourcePath getFileSystemRepresentation:sourceFilePathString maxLength:sizeof(sourceFilePathString) - 1]) { if (![sourcePath getFileSystemRepresentation:sourceFilePathString maxLength:sizeof(sourceFilePathString) - 1]) {
_error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Path cannot be decoded and expressed as a file system representation while encoding items: %@", sourcePath] }]; self.error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Path cannot be decoded and expressed as a file system representation while encoding items: %@", sourcePath] }];
break; break;
} }
struct stat sourceFileInfo = {0}; struct stat sourceFileInfo = {0};
if (lstat(sourceFilePathString, &sourceFileInfo) != 0) { if (lstat(sourceFilePathString, &sourceFileInfo) != 0) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to lstat() on %@", sourcePath] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to lstat() on %@", sourcePath] }];
break; break;
} }
@@ -1101,13 +1085,13 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
char itemFilePathString[PATH_MAX + 1] = {0}; char itemFilePathString[PATH_MAX + 1] = {0};
if (![itemPath getFileSystemRepresentation:itemFilePathString maxLength:sizeof(itemFilePathString) - 1]) { if (![itemPath getFileSystemRepresentation:itemFilePathString maxLength:sizeof(itemFilePathString) - 1]) {
_error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Path cannot be decoded and expressed as a file system representation while encoding items: %@", itemPath] }]; self.error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Path cannot be decoded and expressed as a file system representation while encoding items: %@", itemPath] }];
break; break;
} }
struct stat itemFileInfo = {0}; struct stat itemFileInfo = {0};
if (lstat(itemFilePathString, &itemFileInfo) != 0) { if (lstat(itemFilePathString, &itemFileInfo) != 0) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to lstat() on %@", itemPath] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to lstat() on %@", itemPath] }];
break; break;
} }
@@ -1121,7 +1105,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
} else if (S_ISLNK(extractMode)) { } else if (S_ISLNK(extractMode)) {
off_t fileSize = itemFileInfo.st_size; off_t fileSize = itemFileInfo.st_size;
if (fileSize > UINT16_MAX) { if (fileSize > UINT16_MAX) {
_error = [NSError errorWithDomain:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_ARCHIVE_ERROR_CODE_LINK_TOO_LONG userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Link path has a destination that is too long: %llu bytes", fileSize] }]; self.error = [NSError errorWithDomain:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_ARCHIVE_ERROR_CODE_LINK_TOO_LONG userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Link path has a destination that is too long: %llu bytes", fileSize] }];
break; break;
} }
@@ -1141,7 +1125,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
} }
} }
if (_error != nil) { if (self.error != nil) {
return; return;
} }
@@ -1152,7 +1136,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
} }
// Encode all of our file contents // Encode all of our file contents
void *tempBuffer = _partialChunkBuffer; void *tempBuffer = self.partialChunkBuffer;
for (SPUDeltaArchiveItem *item in writableItems) { for (SPUDeltaArchiveItem *item in writableItems) {
SPUDeltaItemCommands commands = item.commands; SPUDeltaItemCommands commands = item.commands;
if ((commands & SPUDeltaItemCommandExtract) != 0 || (commands & SPUDeltaItemCommandBinaryDiff) != 0) { if ((commands & SPUDeltaItemCommandExtract) != 0 || (commands & SPUDeltaItemCommandBinaryDiff) != 0) {
@@ -1167,13 +1151,13 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
if (totalItemSize > 0) { if (totalItemSize > 0) {
char itemFilePathString[PATH_MAX + 1] = {0}; char itemFilePathString[PATH_MAX + 1] = {0};
if (![itemPath getFileSystemRepresentation:itemFilePathString maxLength:sizeof(itemFilePathString) - 1]) { if (![itemPath getFileSystemRepresentation:itemFilePathString maxLength:sizeof(itemFilePathString) - 1]) {
_error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Path to finish encoding cannot be decoded and expressed as a file system representation: %@", itemPath] }]; self.error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Path to finish encoding cannot be decoded and expressed as a file system representation: %@", itemPath] }];
break; break;
} }
FILE *inputFile = fopen(itemFilePathString, "rb"); FILE *inputFile = fopen(itemFilePathString, "rb");
if (inputFile == NULL) { if (inputFile == NULL) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to open file for reading while encoding items: %@", itemPath] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to open file for reading while encoding items: %@", itemPath] }];
break; break;
} }
@@ -1182,7 +1166,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
uint64_t currentBlockSize = (bytesLeftoverToCopy >= PARTIAL_IO_CHUNK_SIZE) ? PARTIAL_IO_CHUNK_SIZE : bytesLeftoverToCopy; uint64_t currentBlockSize = (bytesLeftoverToCopy >= PARTIAL_IO_CHUNK_SIZE) ? PARTIAL_IO_CHUNK_SIZE : bytesLeftoverToCopy;
if (fread(tempBuffer, currentBlockSize, 1, inputFile) < 1) { if (fread(tempBuffer, currentBlockSize, 1, inputFile) < 1) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to read %llu chunk bytes while encoding items", currentBlockSize] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to read %llu chunk bytes while encoding items", currentBlockSize] }];
break; break;
} }
@@ -1195,21 +1179,21 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
fclose(inputFile); fclose(inputFile);
if (_error != nil) { if (self.error != nil) {
break; break;
} }
} }
} else if (S_ISLNK(extractMode)) { } else if (S_ISLNK(extractMode)) {
char itemFilePathString[PATH_MAX + 1] = {0}; char itemFilePathString[PATH_MAX + 1] = {0};
if (![itemPath getFileSystemRepresentation:itemFilePathString maxLength:sizeof(itemFilePathString) - 1]) { if (![itemPath getFileSystemRepresentation:itemFilePathString maxLength:sizeof(itemFilePathString) - 1]) {
_error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Link path to finish encoding cannot be decoded and expressed as a file system representation: %@", itemPath] }]; self.error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Link path to finish encoding cannot be decoded and expressed as a file system representation: %@", itemPath] }];
break; break;
} }
char linkDestination[PATH_MAX + 1] = {0}; char linkDestination[PATH_MAX + 1] = {0};
ssize_t linkDestinationLength = readlink(itemFilePathString, linkDestination, PATH_MAX); ssize_t linkDestinationLength = readlink(itemFilePathString, linkDestination, PATH_MAX);
if (linkDestinationLength < 0) { if (linkDestinationLength < 0) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to readlink() file at %@", itemPath] }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to readlink() file at %@", itemPath] }];
break; break;
} }
@@ -1222,19 +1206,16 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
// Close up and write final data to compressed streams // Close up and write final data to compressed streams
#if SPARKLE_BUILD_BZIP2_DELTA_SUPPORT if (self.bzipFile != NULL) {
if (_bzipFile != NULL) {
int bzerror = 0; int bzerror = 0;
BZ2_bzWriteClose64(&bzerror, _bzipFile, 0, NULL, NULL, NULL, NULL); BZ2_bzWriteClose64(&bzerror, self.bzipFile, 0, NULL, NULL, NULL, NULL);
if (bzerror == BZ_IO_ERROR) { if (bzerror == BZ_IO_ERROR) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: @"Failed to write and close bzip2 file due to IO error" }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: @"Failed to write and close bzip2 file due to IO error" }];
return; return;
} }
} else } else if (self.initializedCompressionStream) {
#endif void *compressionBuffer = self.compressionBuffer;
if (_initializedCompressionStream) { FILE *file = self.file;
void *compressionBuffer = _compressionBuffer;
FILE *file = _file;
_compressionStream.src_size = 0; _compressionStream.src_size = 0;
@@ -1244,14 +1225,14 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
compression_status status = compression_stream_process(&_compressionStream, COMPRESSION_STREAM_FINALIZE); compression_status status = compression_stream_process(&_compressionStream, COMPRESSION_STREAM_FINALIZE);
if (status == COMPRESSION_STATUS_ERROR) { if (status == COMPRESSION_STATUS_ERROR) {
_error = [NSError errorWithDomain:SPARKLE_COMPRESSION_ERROR_DOMAIN code:COMPRESSION_STATUS_ERROR userInfo:@{ NSLocalizedDescriptionKey: @"Failed to write final bits of Compression based file" }]; self.error = [NSError errorWithDomain:SPARKLE_COMPRESSION_ERROR_DOMAIN code:COMPRESSION_STATUS_ERROR userInfo:@{ NSLocalizedDescriptionKey: @"Failed to write final bits of Compression based file" }];
return; return;
} }
size_t compressedBytesToWrite = (size_t)(_compressionStream.dst_ptr - (uint8_t *)compressionBuffer); size_t compressedBytesToWrite = (size_t)(_compressionStream.dst_ptr - (uint8_t *)compressionBuffer);
if (compressedBytesToWrite > 0) { if (compressedBytesToWrite > 0) {
if (fwrite(compressionBuffer, compressedBytesToWrite, 1, file) < 1) { if (fwrite(compressionBuffer, compressedBytesToWrite, 1, file) < 1) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: @"Failed to write and close Compression based file due to io error" }]; self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: @"Failed to write and close Compression based file due to io error" }];
return; return;
} }
} }
@@ -1265,3 +1246,5 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
} }
@end @end
#pragma clang diagnostic pop
+3 -7
View File
@@ -6,8 +6,6 @@
// Copyright © 2021 Sparkle Project. All rights reserved. // Copyright © 2021 Sparkle Project. All rights reserved.
// //
#if SPARKLE_BUILD_LEGACY_DELTA_SUPPORT
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "SPUDeltaArchiveProtocol.h" #import "SPUDeltaArchiveProtocol.h"
@@ -16,13 +14,11 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
// Legacy container format for binary delta archives // Legacy container format for binary delta archives
SPU_OBJC_DIRECT_MEMBERS @interface SPUXarDeltaArchive : NSObject <SPUDeltaArchiveProtocol> @interface SPUXarDeltaArchive : NSObject <SPUDeltaArchiveProtocol>
- (instancetype)initWithPatchFileForWriting:(NSString *)patchFile SPU_OBJC_DIRECT; - (instancetype)initWithPatchFileForWriting:(NSString *)patchFile;
- (instancetype)initWithPatchFileForReading:(NSString *)patchFile SPU_OBJC_DIRECT; - (instancetype)initWithPatchFileForReading:(NSString *)patchFile;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
#endif
+34 -31
View File
@@ -6,8 +6,6 @@
// Copyright © 2021 Sparkle Project. All rights reserved. // Copyright © 2021 Sparkle Project. All rights reserved.
// //
#if SPARKLE_BUILD_LEGACY_DELTA_SUPPORT
#import "SPUXarDeltaArchive.h" #import "SPUXarDeltaArchive.h"
#include <xar/xar.h> #include <xar/xar.h>
#include "SUBinaryDeltaCommon.h" #include "SUBinaryDeltaCommon.h"
@@ -47,15 +45,22 @@ extern char *xar_get_safe_path(xar_file_t f) __attribute__((weak_import));
#define SPARKLE_DELTA_XAR_ARCHIVE_ERROR_CODE_EXTRACT_FAILURE 3 #define SPARKLE_DELTA_XAR_ARCHIVE_ERROR_CODE_EXTRACT_FAILURE 3
#define SPARKLE_DELTA_XAR_ARCHIVE_ERROR_CODE_UNSUPPORTED_COMPRESSION_FAILURE 4 #define SPARKLE_DELTA_XAR_ARCHIVE_ERROR_CODE_UNSUPPORTED_COMPRESSION_FAILURE 4
@implementation SPUXarDeltaArchive @interface SPUXarDeltaArchive ()
{
NSMutableDictionary<NSString *, NSValue *> *_fileTable;
NSString *_patchFile;
xar_t _x;
int32_t _xarMode;
}
@property (nonatomic) xar_t x;
@property (nonatomic, readonly) int32_t xarMode;
@property (nonatomic, readonly) NSMutableDictionary<NSString *, NSValue *> *fileTable;
@property (nonatomic, readonly) NSString *patchFile;
@property (nonatomic) NSError *error;
@end
@implementation SPUXarDeltaArchive
@synthesize x = _x;
@synthesize xarMode = _xarMode;
@synthesize patchFile = _patchFile;
@synthesize fileTable = _fileTable;
@synthesize error = _error; @synthesize error = _error;
- (instancetype)initWithPatchFileForWriting:(NSString *)patchFile - (instancetype)initWithPatchFileForWriting:(NSString *)patchFile
@@ -86,9 +91,9 @@ extern char *xar_get_safe_path(xar_file_t f) __attribute__((weak_import));
- (void)close - (void)close
{ {
if (_x != NULL) { if (self.x != NULL) {
xar_close(_x); xar_close(self.x);
_x = NULL; self.x = NULL;
} }
} }
@@ -100,18 +105,18 @@ extern char *xar_get_safe_path(xar_file_t f) __attribute__((weak_import));
- (nullable SPUDeltaArchiveHeader *)readHeader - (nullable SPUDeltaArchiveHeader *)readHeader
{ {
NSString *patchFile = _patchFile; NSString *patchFile = self.patchFile;
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations" #pragma clang diagnostic ignored "-Wdeprecated-declarations"
// Sparkle's XAR delta archives have been superceded by Sparkle's own format // Sparkle's XAR delta archives have been superceded by Sparkle's own format
xar_t x = xar_open(patchFile.fileSystemRepresentation, READ); xar_t x = xar_open(patchFile.fileSystemRepresentation, READ);
#pragma clang diagnostic pop #pragma clang diagnostic pop
if (x == NULL) { if (x == NULL) {
_error = [NSError errorWithDomain:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_CODE_OPEN_FAILURE userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to xar_open() file for reading: %@", patchFile] }]; self.error = [NSError errorWithDomain:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_CODE_OPEN_FAILURE userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to xar_open() file for reading: %@", patchFile] }];
return nil; return nil;
} }
_x = x; self.x = x;
uint16_t majorDiffVersion = SUBinaryDeltaMajorVersionFirst; uint16_t majorDiffVersion = SUBinaryDeltaMajorVersionFirst;
uint16_t minorDiffVersion = 0; uint16_t minorDiffVersion = 0;
@@ -119,7 +124,7 @@ extern char *xar_get_safe_path(xar_file_t f) __attribute__((weak_import));
NSString *expectedAfterHash = nil; NSString *expectedAfterHash = nil;
xar_subdoc_t subdoc; xar_subdoc_t subdoc;
for (subdoc = xar_subdoc_first(_x); subdoc; subdoc = xar_subdoc_next(subdoc)) { for (subdoc = xar_subdoc_first(self.x); subdoc; subdoc = xar_subdoc_next(subdoc)) {
if (strcmp(xar_subdoc_name(subdoc), BINARY_DELTA_ATTRIBUTES_KEY) == 0) { if (strcmp(xar_subdoc_name(subdoc), BINARY_DELTA_ATTRIBUTES_KEY) == 0) {
{ {
// available in version 2.0 or later // available in version 2.0 or later
@@ -172,7 +177,7 @@ extern char *xar_get_safe_path(xar_file_t f) __attribute__((weak_import));
- (void)writeHeader:(SPUDeltaArchiveHeader *)header - (void)writeHeader:(SPUDeltaArchiveHeader *)header
{ {
NSString *patchFile = _patchFile; NSString *patchFile = self.patchFile;
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations" #pragma clang diagnostic ignored "-Wdeprecated-declarations"
@@ -180,11 +185,11 @@ extern char *xar_get_safe_path(xar_file_t f) __attribute__((weak_import));
xar_t x = xar_open(patchFile.fileSystemRepresentation, WRITE); xar_t x = xar_open(patchFile.fileSystemRepresentation, WRITE);
#pragma clang diagnostic pop #pragma clang diagnostic pop
if (x == NULL) { if (x == NULL) {
_error = [NSError errorWithDomain:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_CODE_OPEN_FAILURE userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to xar_open() file for writing: %@", patchFile] }]; self.error = [NSError errorWithDomain:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_CODE_OPEN_FAILURE userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to xar_open() file for writing: %@", patchFile] }];
return; return;
} }
_x = x; self.x = x;
SPUDeltaCompressionMode compression = (header.compression == SPUDeltaCompressionModeDefault ? SPUDeltaCompressionModeBzip2 : header.compression); SPUDeltaCompressionMode compression = (header.compression == SPUDeltaCompressionModeDefault ? SPUDeltaCompressionModeBzip2 : header.compression);
@@ -213,7 +218,7 @@ extern char *xar_get_safe_path(xar_file_t f) __attribute__((weak_import));
case SPUDeltaCompressionModeLZFSE: case SPUDeltaCompressionModeLZFSE:
case SPUDeltaCompressionModeLZ4: case SPUDeltaCompressionModeLZ4:
case SPUDeltaCompressionModeZLIB: { case SPUDeltaCompressionModeZLIB: {
_error = [NSError errorWithDomain:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_CODE_UNSUPPORTED_COMPRESSION_FAILURE userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Version 2 patches only support bzip2 compression."] }]; self.error = [NSError errorWithDomain:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_CODE_UNSUPPORTED_COMPRESSION_FAILURE userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Version 2 patches only support bzip2 compression."] }];
return; return;
} }
@@ -276,7 +281,7 @@ static xar_file_t _xarAddFile(NSMutableDictionary<NSString *, NSValue *> *fileTa
- (void)addItem:(SPUDeltaArchiveItem *)item - (void)addItem:(SPUDeltaArchiveItem *)item
{ {
if (_error != nil) { if (self.error != nil) {
return; return;
} }
@@ -285,9 +290,9 @@ static xar_file_t _xarAddFile(NSMutableDictionary<NSString *, NSValue *> *fileTa
SPUDeltaItemCommands commands = item.commands; SPUDeltaItemCommands commands = item.commands;
uint16_t mode = item.mode; uint16_t mode = item.mode;
xar_file_t newFile = _xarAddFile(_fileTable, _x, relativeFilePath, filePath); xar_file_t newFile = _xarAddFile(self.fileTable, self.x, relativeFilePath, filePath);
if (newFile == NULL) { if (newFile == NULL) {
_error = [NSError errorWithDomain:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_CODE_ADD_FAILURE userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to add xar file entry: %@", relativeFilePath] }]; self.error = [NSError errorWithDomain:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_CODE_ADD_FAILURE userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to add xar file entry: %@", relativeFilePath] }];
return; return;
} }
@@ -315,13 +320,13 @@ static xar_file_t _xarAddFile(NSMutableDictionary<NSString *, NSValue *> *fileTa
- (void)enumerateItems:(void (^)(SPUDeltaArchiveItem *, BOOL *))itemHandler - (void)enumerateItems:(void (^)(SPUDeltaArchiveItem *, BOOL *))itemHandler
{ {
if (_error != nil) { if (self.error != nil) {
return; return;
} }
BOOL exitedEarly = NO; BOOL exitedEarly = NO;
xar_iter_t iter = xar_iter_new(); xar_iter_t iter = xar_iter_new();
for (xar_file_t file = xar_file_first(_x, iter); file; file = xar_file_next(iter)) { for (xar_file_t file = xar_file_first(self.x, iter); file; file = xar_file_next(iter)) {
char *pathCString; char *pathCString;
#if HAS_XAR_GET_SAFE_PATH #if HAS_XAR_GET_SAFE_PATH
#pragma clang diagnostic push #pragma clang diagnostic push
@@ -392,7 +397,7 @@ static xar_file_t _xarAddFile(NSMutableDictionary<NSString *, NSValue *> *fileTa
- (BOOL)extractItem:(SPUDeltaArchiveItem *)item - (BOOL)extractItem:(SPUDeltaArchiveItem *)item
{ {
if (_error != nil) { if (self.error != nil) {
return NO; return NO;
} }
@@ -400,8 +405,8 @@ static xar_file_t _xarAddFile(NSMutableDictionary<NSString *, NSValue *> *fileTa
assert(item.xarContext != NULL); assert(item.xarContext != NULL);
xar_file_t file = item.xarContext; xar_file_t file = item.xarContext;
if (xar_extract_tofile(_x, file, item.itemFilePath.fileSystemRepresentation) != 0) { if (xar_extract_tofile(self.x, file, item.itemFilePath.fileSystemRepresentation) != 0) {
_error = [NSError errorWithDomain:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_CODE_EXTRACT_FAILURE userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to extract xar file entry to %@", item.itemFilePath] }]; self.error = [NSError errorWithDomain:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_CODE_EXTRACT_FAILURE userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to extract xar file entry to %@", item.itemFilePath] }];
return NO; return NO;
} }
@@ -409,5 +414,3 @@ static xar_file_t _xarAddFile(NSMutableDictionary<NSString *, NSValue *> *fileTa
} }
@end @end
#endif
+2 -3
View File
@@ -52,10 +52,9 @@ extern SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionLatest;
extern SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionFirst; extern SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionFirst;
extern SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionFirstSupported; extern SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionFirstSupported;
// Additional compression methods for version 3 patches that we have for debugging are zlib, bzip2, none #define COMPRESSION_METHOD_ARGUMENT_DESCRIPTION @"The compression method to use for generating delta updates. Supported methods for version 3 delta files are 'lzma', 'bzip2', 'zlib', 'lzfse', 'lz4', 'none', and 'default'. Note that version 2 delta files only support 'bzip2', 'none', and 'default' so other methods will be ignored if version 2 files are being generated. The 'default' compression for version 3 delta files is currently lzma."
#define COMPRESSION_METHOD_ARGUMENT_DESCRIPTION @"The compression method to use for generating delta updates. Supported methods for version 3 delta files are 'lzma' (best compression, slowest), 'lzfse' (good compression, fast), 'lz4' (worse compression, fastest), and 'default'. Note that version 2 delta files only support 'bzip2', and 'default' so other methods will be ignored if version 2 files are being generated. The 'default' compression for version 3 delta files is currently lzma."
//#define COMPRESSION_LEVEL_ARGUMENT_DESCRIPTION @"The compression level to use for generating delta updates. This only applies if the compression method used is bzip2 which accepts values from 1 - 9. A special value of 0 will use the default compression level." #define COMPRESSION_LEVEL_ARGUMENT_DESCRIPTION @"The compression level to use for generating delta updates. This only applies if the compression method used is bzip2 which accepts values from 1 - 9. A special value of 0 will use the default compression level."
SPUDeltaCompressionMode deltaCompressionModeFromDescription(NSString *description, BOOL *requestValid); SPUDeltaCompressionMode deltaCompressionModeFromDescription(NSString *description, BOOL *requestValid);
NSString *deltaCompressionStringFromMode(SPUDeltaCompressionMode mode); NSString *deltaCompressionStringFromMode(SPUDeltaCompressionMode mode);
+25 -41
View File
@@ -29,47 +29,42 @@
extern int bsdiff(int argc, const char **argv); extern int bsdiff(int argc, const char **argv);
@interface CreateBinaryDeltaOperation : NSOperation @interface CreateBinaryDeltaOperation : NSOperation
@property (copy) NSString *relativePath;
@property (nonatomic, copy, readonly) NSString *relativePath; @property (copy) NSString *clonedRelativePath;
@property (nonatomic, copy, readonly) NSString *clonedRelativePath; @property (strong) NSString *resultPath;
@property (nonatomic, readonly) NSString *resultPath; @property (strong) NSNumber *oldPermissions;
@property (nonatomic, readonly) NSNumber *oldPermissions; @property (strong) NSNumber *permissions;
@property (nonatomic, readonly) NSNumber *permissions; @property (nonatomic) BOOL changingPermissions;
@property (nonatomic, readonly) NSString *fromPath; @property (strong) NSString *_fromPath;
@property (nonatomic, readonly) BOOL changingPermissions; @property (strong) NSString *_toPath;
- (id)initWithRelativePath:(NSString *)relativePath clonedRelativePath:(NSString *)clonedRelativePath oldTree:(NSString *)oldTree newTree:(NSString *)newTree oldPermissions:(NSNumber *)oldPermissions newPermissions:(NSNumber *)permissions changingPermissions:(BOOL)changingPermissions;
- (id)initWithRelativePath:(NSString *)relativePath clonedRelativePath:(NSString *)clonedRelativePath oldTree:(NSString *)oldTree newTree:(NSString *)newTree oldPermissions:(NSNumber *)oldPermissions newPermissions:(NSNumber *)permissions changingPermissions:(BOOL)changingPermissions SPU_OBJC_DIRECT;
@end @end
@implementation CreateBinaryDeltaOperation @implementation CreateBinaryDeltaOperation
{
NSString *_toPath;
}
@synthesize relativePath = _relativePath; @synthesize relativePath = _relativePath;
@synthesize clonedRelativePath = _clonedRelativePath; @synthesize clonedRelativePath = _clonedRelativePath;
@synthesize resultPath = _resultPath; @synthesize resultPath = _resultPath;
@synthesize oldPermissions = _oldPermissions; @synthesize oldPermissions = _oldPermissions;
@synthesize permissions = _permissions; @synthesize permissions = _permissions;
@synthesize fromPath = _fromPath;
@synthesize changingPermissions = _changingPermissions; @synthesize changingPermissions = _changingPermissions;
@synthesize _fromPath = _fromPath;
@synthesize _toPath = _toPath;
- (id)initWithRelativePath:(NSString *)relativePath clonedRelativePath:(NSString *)clonedRelativePath oldTree:(NSString *)oldTree newTree:(NSString *)newTree oldPermissions:(NSNumber *)oldPermissions newPermissions:(NSNumber *)permissions changingPermissions:(BOOL)changingPermissions - (id)initWithRelativePath:(NSString *)relativePath clonedRelativePath:(NSString *)clonedRelativePath oldTree:(NSString *)oldTree newTree:(NSString *)newTree oldPermissions:(NSNumber *)oldPermissions newPermissions:(NSNumber *)permissions changingPermissions:(BOOL)changingPermissions
{ {
if ((self = [super init])) { if ((self = [super init])) {
_relativePath = [relativePath copy]; self.relativePath = relativePath;
_clonedRelativePath = [clonedRelativePath copy]; self.clonedRelativePath = clonedRelativePath;
_oldPermissions = oldPermissions; self.oldPermissions = oldPermissions;
_permissions = permissions; self.permissions = permissions;
_changingPermissions = changingPermissions; self.changingPermissions = changingPermissions;
if (clonedRelativePath == nil) { if (clonedRelativePath == nil) {
_fromPath = [oldTree stringByAppendingPathComponent:relativePath]; self._fromPath = [oldTree stringByAppendingPathComponent:relativePath];
} else { } else {
_fromPath = [oldTree stringByAppendingPathComponent:clonedRelativePath]; self._fromPath = [oldTree stringByAppendingPathComponent:clonedRelativePath];
} }
_toPath = [newTree stringByAppendingPathComponent:relativePath]; self._toPath = [newTree stringByAppendingPathComponent:relativePath];
} }
return self; return self;
} }
@@ -77,11 +72,10 @@ extern int bsdiff(int argc, const char **argv);
- (void)main - (void)main
{ {
NSString *temporaryFile = temporaryFilename(@"BinaryDelta"); NSString *temporaryFile = temporaryFilename(@"BinaryDelta");
const char *argv[] = { "/usr/bin/bsdiff", [_fromPath fileSystemRepresentation], [_toPath fileSystemRepresentation], [temporaryFile fileSystemRepresentation] }; const char *argv[] = { "/usr/bin/bsdiff", [self._fromPath fileSystemRepresentation], [self._toPath fileSystemRepresentation], [temporaryFile fileSystemRepresentation] };
int result = bsdiff(4, argv); int result = bsdiff(4, argv);
if (result == 0) { if (!result)
_resultPath = temporaryFile; self.resultPath = temporaryFile;
}
} }
@end @end
@@ -710,17 +704,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
if (majorVersion >= SUBinaryDeltaMajorVersion3) { if (majorVersion >= SUBinaryDeltaMajorVersion3) {
archive = [[SPUSparkleDeltaArchive alloc] initWithPatchFileForWriting:temporaryFile]; archive = [[SPUSparkleDeltaArchive alloc] initWithPatchFileForWriting:temporaryFile];
} else { } else {
#if SPARKLE_BUILD_LEGACY_DELTA_SUPPORT
archive = [[SPUXarDeltaArchive alloc] initWithPatchFileForWriting:temporaryFile]; archive = [[SPUXarDeltaArchive alloc] initWithPatchFileForWriting:temporaryFile];
#else
if (verbose) {
fprintf(stderr, "\n");
}
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: @"Support for creating legacy delta updates is disabled" }];
}
return NO;
#endif
} }
SPUDeltaArchiveHeader *header = [[SPUDeltaArchiveHeader alloc] initWithCompression:compression compressionLevel:compressionLevel fileSystemCompression:foundFilesystemCompression majorVersion:majorVersion minorVersion:minorVersion beforeTreeHash:beforeHash afterTreeHash:afterHash]; SPUDeltaArchiveHeader *header = [[SPUDeltaArchiveHeader alloc] initWithCompression:compression compressionLevel:compressionLevel fileSystemCompression:foundFilesystemCompression majorVersion:majorVersion minorVersion:minorVersion beforeTreeHash:beforeHash afterTreeHash:afterHash];
@@ -934,7 +918,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
BOOL deltaOperationsFailed = NO; BOOL deltaOperationsFailed = NO;
for (CreateBinaryDeltaOperation *operation in deltaOperations) { for (CreateBinaryDeltaOperation *operation in deltaOperations) {
NSString *resultPath = operation.resultPath; NSString *resultPath = [operation resultPath];
if (resultPath == nil) { if (resultPath == nil) {
if (verbose) { if (verbose) {
fprintf(stderr, "\n"); fprintf(stderr, "\n");
@@ -968,7 +952,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
SPUDeltaArchiveItem *item = [[SPUDeltaArchiveItem alloc] initWithRelativeFilePath:relativePath commands:commands mode:mode.unsignedShortValue]; SPUDeltaArchiveItem *item = [[SPUDeltaArchiveItem alloc] initWithRelativeFilePath:relativePath commands:commands mode:mode.unsignedShortValue];
item.itemFilePath = resultPath; item.itemFilePath = resultPath;
item.sourcePath = operation.fromPath; item.sourcePath = operation._fromPath;
item.clonedRelativePath = clonedRelativePath; item.clonedRelativePath = clonedRelativePath;
[archive addItem:item]; [archive addItem:item];
@@ -988,7 +972,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
// Clean up operations after the archive has finished encoding // Clean up operations after the archive has finished encoding
for (CreateBinaryDeltaOperation *operation in deltaOperations) { for (CreateBinaryDeltaOperation *operation in deltaOperations) {
NSString *resultPath = operation.resultPath; NSString *resultPath = [operation resultPath];
if (resultPath != nil) { if (resultPath != nil) {
unlink(resultPath.fileSystemRepresentation); unlink(resultPath.fileSystemRepresentation);
} }
-5
View File
@@ -14,15 +14,10 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
#ifndef BUILDING_SPARKLE_TESTS
SPU_OBJC_DIRECT_MEMBERS
#endif
@interface SUBinaryDeltaUnarchiver : NSObject <SUUnarchiverProtocol> @interface SUBinaryDeltaUnarchiver : NSObject <SUUnarchiverProtocol>
- (instancetype)initWithArchivePath:(NSString *)archivePath updateHostBundlePath:(NSString *)updateHostBundlePath; - (instancetype)initWithArchivePath:(NSString *)archivePath updateHostBundlePath:(NSString *)updateHostBundlePath;
+ (BOOL)canUnarchivePath:(NSString *)path;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
+15 -13
View File
@@ -16,11 +16,17 @@
#include "AppKitPrevention.h" #include "AppKitPrevention.h"
@interface SUBinaryDeltaUnarchiver ()
@property (nonatomic, copy, readonly) NSString *archivePath;
@property (nonatomic, copy, readonly) NSString *updateHostBundlePath;
@end
@implementation SUBinaryDeltaUnarchiver @implementation SUBinaryDeltaUnarchiver
{
NSString *_archivePath; @synthesize archivePath = _archivePath;
NSString *_updateHostBundlePath; @synthesize updateHostBundlePath = _updateHostBundlePath;
}
+ (BOOL)canUnarchivePath:(NSString *)path + (BOOL)canUnarchivePath:(NSString *)path
{ {
@@ -37,11 +43,7 @@
// We used to invoke mdimport on the bundle but this is not a very good approach. // We used to invoke mdimport on the bundle but this is not a very good approach.
// There's no need to do that for non-delta updates and for updates that contain no mdimporters. // There's no need to do that for non-delta updates and for updates that contain no mdimporters.
// Moreover, updating the timestamp on the mdimporter bundles is what developers have to do anyway when shipping their new update outside of Sparkle // Moreover, updating the timestamp on the mdimporter bundles is what developers have to do anyway when shipping their new update outside of Sparkle
// Note: this is used from unit tests
+ (void)updateSpotlightImportersAtBundlePath:(NSString *)targetPath + (void)updateSpotlightImportersAtBundlePath:(NSString *)targetPath
#ifndef BUILDING_SPARKLE_TESTS
SPU_OBJC_DIRECT
#endif
{ {
NSURL *targetURL = [NSURL fileURLWithPath:targetPath]; NSURL *targetURL = [NSURL fileURLWithPath:targetPath];
// Only recurse if it's actually a directory. Don't recurse into a // Only recurse if it's actually a directory. Don't recurse into a
@@ -93,17 +95,17 @@ SPU_OBJC_DIRECT
- (void)extractDeltaWithNotifier:(SUUnarchiverNotifier *)notifier - (void)extractDeltaWithNotifier:(SUUnarchiverNotifier *)notifier
{ {
NSString *sourcePath = _updateHostBundlePath; NSString *sourcePath = self.updateHostBundlePath;
NSString *targetPath = [[_archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:[sourcePath lastPathComponent]]; NSString *targetPath = [[self.archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:[sourcePath lastPathComponent]];
NSError *applyDiffError = nil; NSError *applyDiffError = nil;
BOOL success = applyBinaryDelta(sourcePath, targetPath, _archivePath, NO, ^(double progress){ BOOL success = applyBinaryDelta(sourcePath, targetPath, self.archivePath, NO, ^(double progress){
[notifier notifyProgress:progress]; [notifier notifyProgress:progress];
}, &applyDiffError); }, &applyDiffError);
if (success) { if (success) {
[SUBinaryDeltaUnarchiver updateSpotlightImportersAtBundlePath:targetPath]; [[self class] updateSpotlightImportersAtBundlePath:targetPath];
[notifier notifySuccess]; [notifier notifySuccess];
} }
else { else {
@@ -111,6 +113,6 @@ SPU_OBJC_DIRECT
} }
} }
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], _archivePath]; } - (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], self.archivePath]; }
@end @end
+1 -4
View File
@@ -11,12 +11,9 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#ifndef BUILDING_SPARKLE_TESTS
SPU_OBJC_DIRECT_MEMBERS
#endif
@interface SUCodeSigningVerifier : NSObject @interface SUCodeSigningVerifier : NSObject
+ (BOOL)codeSignatureIsValidAtBundleURL:(NSURL *)newBundleURL andMatchesSignatureAtBundleURL:(NSURL *)oldBundleURL error:(NSError **)error; + (BOOL)codeSignatureAtBundleURL:(NSURL *)oldBundleURL matchesSignatureAtBundleURL:(NSURL *)newBundleURL error:(NSError **)error;
+ (BOOL)codeSignatureIsValidAtBundleURL:(NSURL *)bundleURL checkNestedCode:(BOOL)checkNestedCode error:(NSError **)error; + (BOOL)codeSignatureIsValidAtBundleURL:(NSURL *)bundleURL checkNestedCode:(BOOL)checkNestedCode error:(NSError **)error;
+19 -6
View File
@@ -17,7 +17,7 @@
@implementation SUCodeSigningVerifier @implementation SUCodeSigningVerifier
+ (BOOL)codeSignatureIsValidAtBundleURL:(NSURL *)newBundleURL andMatchesSignatureAtBundleURL:(NSURL *)oldBundleURL error:(NSError * __autoreleasing *)error + (BOOL)codeSignatureAtBundleURL:(NSURL *)oldBundleURL matchesSignatureAtBundleURL:(NSURL *)newBundleURL error:(NSError * __autoreleasing *)error
{ {
OSStatus result; OSStatus result;
SecRequirementRef requirement = NULL; SecRequirementRef requirement = NULL;
@@ -148,7 +148,7 @@ finally:
goto finally; goto finally;
} }
// See in -codeSignatureIsValidAtBundleURL:andMatchesSignatureAtBundleURL:error: for why kSecCSCheckNestedCode is not always passed // See in -codeSignatureAtBundleURL:matchesSignatureAtBundleURL:error: for why kSecCSCheckNestedCode is not always passed
SecCSFlags flags = (SecCSFlags) (kSecCSDefaultFlags | kSecCSCheckAllArchitectures); SecCSFlags flags = (SecCSFlags) (kSecCSDefaultFlags | kSecCSCheckAllArchitectures);
if (checkNestedCode) { if (checkNestedCode) {
flags |= kSecCSCheckNestedCode; flags |= kSecCSCheckNestedCode;
@@ -209,8 +209,22 @@ static id valueOrNSNull(id value) {
return value ? value : [NSNull null]; return value ? value : [NSNull null];
} }
+ (NSDictionary *)codeSignatureInfoForCode:(SecStaticCodeRef)code SPU_OBJC_DIRECT + (NSDictionary *)codeSignatureInfoAtBundleURL:(NSURL *)bundlePath {
{ NSDictionary *info = nil;
SecStaticCodeRef code = NULL;
OSStatus result = SecStaticCodeCreateWithPath((__bridge CFURLRef)bundlePath, kSecCSDefaultFlags, &code);
if (result != noErr) {
SULog(SULogLevelError, @"Failed to get static code %d", result);
goto finally;
}
info = [self codeSignatureInfoForCode:code];
finally:
if (code) CFRelease(code);
return info;
}
+ (NSDictionary *)codeSignatureInfoForCode:(SecStaticCodeRef)code {
CFDictionaryRef signingInfo = nil; CFDictionaryRef signingInfo = nil;
const SecCSFlags flags = (SecCSFlags) (kSecCSSigningInformation | kSecCSRequirementInformation | kSecCSDynamicInformation | kSecCSContentInformation); const SecCSFlags flags = (SecCSFlags) (kSecCSSigningInformation | kSecCSRequirementInformation | kSecCSDynamicInformation | kSecCSContentInformation);
if (SecCodeCopySigningInformation(code, flags, &signingInfo) == noErr) { if (SecCodeCopySigningInformation(code, flags, &signingInfo) == noErr) {
@@ -227,8 +241,7 @@ static id valueOrNSNull(id value) {
return nil; return nil;
} }
+ (NSDictionary *)logSigningInfoForCode:(SecStaticCodeRef)code label:(NSString*)label SPU_OBJC_DIRECT + (NSDictionary *)logSigningInfoForCode:(SecStaticCodeRef)code label:(NSString*)label {
{
NSDictionary *relevantInfo = [self codeSignatureInfoForCode:code]; NSDictionary *relevantInfo = [self codeSignatureInfoForCode:code];
SULog(SULogLevelDefault, @"%@: %@", label, relevantInfo); SULog(SULogLevelDefault, @"%@: %@", label, relevantInfo);
return relevantInfo; return relevantInfo;
+1 -7
View File
@@ -6,8 +6,6 @@
// Copyright 2008 Andy Matuschak. All rights reserved. // Copyright 2008 Andy Matuschak. All rights reserved.
// //
#if SPARKLE_BUILD_DMG_SUPPORT
#ifndef SUDISKIMAGEUNARCHIVER_H #ifndef SUDISKIMAGEUNARCHIVER_H
#define SUDISKIMAGEUNARCHIVER_H #define SUDISKIMAGEUNARCHIVER_H
@@ -16,16 +14,12 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
SPU_OBJC_DIRECT_MEMBERS @interface SUDiskImageUnarchiver : NSObject <SUUnarchiverProtocol> @interface SUDiskImageUnarchiver : NSObject <SUUnarchiverProtocol>
- (instancetype)initWithArchivePath:(NSString *)archivePath decryptionPassword:(nullable NSString *)decryptionPassword; - (instancetype)initWithArchivePath:(NSString *)archivePath decryptionPassword:(nullable NSString *)decryptionPassword;
+ (BOOL)canUnarchivePath:(NSString *)path;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
#endif #endif
#endif
+18 -20
View File
@@ -6,8 +6,6 @@
// Copyright 2008 Andy Matuschak. All rights reserved. // Copyright 2008 Andy Matuschak. All rights reserved.
// //
#if SPARKLE_BUILD_DMG_SUPPORT
#import "SUDiskImageUnarchiver.h" #import "SUDiskImageUnarchiver.h"
#import "SUUnarchiverNotifier.h" #import "SUUnarchiverNotifier.h"
#import "SULog.h" #import "SULog.h"
@@ -15,11 +13,17 @@
#include "AppKitPrevention.h" #include "AppKitPrevention.h"
@interface SUDiskImageUnarchiver ()
@property (nonatomic, copy, readonly) NSString *archivePath;
@property (nullable, nonatomic, copy, readonly) NSString *decryptionPassword;
@end
@implementation SUDiskImageUnarchiver @implementation SUDiskImageUnarchiver
{
NSString *_archivePath; @synthesize archivePath = _archivePath;
NSString *_decryptionPassword; @synthesize decryptionPassword = _decryptionPassword;
}
+ (BOOL)canUnarchivePath:(NSString *)path + (BOOL)canUnarchivePath:(NSString *)path
{ {
@@ -50,7 +54,7 @@
} }
// Called on a non-main thread. // Called on a non-main thread.
- (void)extractDMGWithNotifier:(SUUnarchiverNotifier *)notifier SPU_OBJC_DIRECT - (void)extractDMGWithNotifier:(SUUnarchiverNotifier *)notifier
{ {
@autoreleasepool { @autoreleasepool {
BOOL mountedSuccessfully = NO; BOOL mountedSuccessfully = NO;
@@ -80,10 +84,10 @@
NSData *promptData = [NSData dataWithBytes:"yes\n" length:4]; NSData *promptData = [NSData dataWithBytes:"yes\n" length:4];
NSMutableArray *arguments = [@[@"attach", _archivePath, @"-mountpoint", mountPoint, /*@"-noverify",*/ @"-nobrowse", @"-noautoopen"] mutableCopy]; NSMutableArray *arguments = [@[@"attach", self.archivePath, @"-mountpoint", mountPoint, /*@"-noverify",*/ @"-nobrowse", @"-noautoopen"] mutableCopy];
if (_decryptionPassword) { if (self.decryptionPassword) {
NSMutableData *passwordData = [[_decryptionPassword dataUsingEncoding:NSUTF8StringEncoding] mutableCopy]; NSMutableData *passwordData = [[self.decryptionPassword dataUsingEncoding:NSUTF8StringEncoding] mutableCopy];
// From the hdiutil docs: // From the hdiutil docs:
// read a null-terminated passphrase from standard input // read a null-terminated passphrase from standard input
// //
@@ -136,17 +140,13 @@
if (![inputPipe.fileHandleForWriting writeData:promptData error:&error]) { if (![inputPipe.fileHandleForWriting writeData:promptData error:&error]) {
goto reportError; goto reportError;
} }
} } else {
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_15
else
{
@try { @try {
[inputPipe.fileHandleForWriting writeData:promptData]; [inputPipe.fileHandleForWriting writeData:promptData];
} @catch (NSException *) { } @catch (NSException *) {
goto reportError; goto reportError;
} }
} }
#endif
[inputPipe.fileHandleForWriting closeFile]; [inputPipe.fileHandleForWriting closeFile];
@@ -181,7 +181,7 @@
for (NSString *item in contents) for (NSString *item in contents)
{ {
NSString *fromPath = [mountPoint stringByAppendingPathComponent:item]; NSString *fromPath = [mountPoint stringByAppendingPathComponent:item];
NSString *toPath = [[_archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:item]; NSString *toPath = [[self.archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:item];
itemsCopied += 1.0; itemsCopied += 1.0;
[notifier notifyProgress:0.5 + itemsCopied/(totalItems*2.0)]; [notifier notifyProgress:0.5 + itemsCopied/(totalItems*2.0)];
@@ -219,13 +219,11 @@
SULog(SULogLevelError, @"Error: %@", launchCleanupError); SULog(SULogLevelError, @"Error: %@", launchCleanupError);
} }
} else { } else {
SULog(SULogLevelError, @"Can't mount DMG %@", _archivePath); SULog(SULogLevelError, @"Can't mount DMG %@", self.archivePath);
} }
} }
} }
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], _archivePath]; } - (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], self.archivePath]; }
@end @end
#endif
+1 -7
View File
@@ -6,22 +6,16 @@
// Copyright © 2021 Sparkle Project. All rights reserved. // Copyright © 2021 Sparkle Project. All rights reserved.
// //
#if SPARKLE_BUILD_PACKAGE_SUPPORT
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "SUUnarchiverProtocol.h" #import "SUUnarchiverProtocol.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
// An unarchiver for flat packages that doesn't really do any unarchiving // An unarchiver for flat packages that doesn't really do any unarchiving
SPU_OBJC_DIRECT_MEMBERS @interface SUFlatPackageUnarchiver : NSObject <SUUnarchiverProtocol> @interface SUFlatPackageUnarchiver : NSObject <SUUnarchiverProtocol>
- (instancetype)initWithFlatPackagePath:(NSString *)flatPackagePath expectingInstallationType:(NSString *)installationType; - (instancetype)initWithFlatPackagePath:(NSString *)flatPackagePath expectingInstallationType:(NSString *)installationType;
+ (BOOL)canUnarchivePath:(NSString *)path;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
#endif
+15 -13
View File
@@ -6,8 +6,6 @@
// Copyright © 2021 Sparkle Project. All rights reserved. // Copyright © 2021 Sparkle Project. All rights reserved.
// //
#if SPARKLE_BUILD_PACKAGE_SUPPORT
#import "SUFlatPackageUnarchiver.h" #import "SUFlatPackageUnarchiver.h"
#import "SUUnarchiverNotifier.h" #import "SUUnarchiverNotifier.h"
#import "SPUInstallationType.h" #import "SPUInstallationType.h"
@@ -16,11 +14,17 @@
#include "AppKitPrevention.h" #include "AppKitPrevention.h"
@interface SUFlatPackageUnarchiver ()
@property (nonatomic, readonly) NSString *flatPackagePath;
@property (nonatomic, readonly) NSString *expectedInstallationType;
@end
@implementation SUFlatPackageUnarchiver @implementation SUFlatPackageUnarchiver
{
NSString *_flatPackagePath; @synthesize flatPackagePath = _flatPackagePath;
NSString *_expectedInstallationType; @synthesize expectedInstallationType = _expectedInstallationType;
}
+ (BOOL)canUnarchivePath:(NSString *)path + (BOOL)canUnarchivePath:(NSString *)path
{ {
@@ -48,18 +52,16 @@
// Flat packages must use guided package installs, not interactive // Flat packages must use guided package installs, not interactive
BOOL isDirectory = NO; BOOL isDirectory = NO;
if (![_expectedInstallationType isEqualToString:SPUInstallationTypeGuidedPackage]) { if (![self.expectedInstallationType isEqualToString:SPUInstallationTypeGuidedPackage]) {
[notifier notifyFailureWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Flat package does not have guided installation type but %@ instead", _expectedInstallationType]}]]; [notifier notifyFailureWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Flat package does not have guided installation type but %@ instead", self.expectedInstallationType]}]];
} else if (![[NSFileManager defaultManager] fileExistsAtPath:_flatPackagePath isDirectory:&isDirectory] || isDirectory) { } else if (![[NSFileManager defaultManager] fileExistsAtPath:self.flatPackagePath isDirectory:&isDirectory] || isDirectory) {
[notifier notifyFailureWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Flat package does not exist at %@", _flatPackagePath]}]]; [notifier notifyFailureWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Flat package does not exist at %@", self.flatPackagePath]}]];
} else { } else {
[notifier notifyProgress:1.0]; [notifier notifyProgress:1.0];
[notifier notifySuccess]; [notifier notifySuccess];
} }
} }
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], _flatPackagePath]; } - (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], self.flatPackagePath]; }
@end @end
#endif
+1 -5
View File
@@ -16,15 +16,11 @@ The installer package is installed using macOS's built-in command line installer
A guided installation can be started by applications other than the application being replaced. This is particularly useful where helper applications or agents are used. A guided installation can be started by applications other than the application being replaced. This is particularly useful where helper applications or agents are used.
*/ */
#if SPARKLE_BUILD_PACKAGE_SUPPORT
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "SUInstallerProtocol.h" #import "SUInstallerProtocol.h"
SPU_OBJC_DIRECT_MEMBERS @interface SUGuidedPackageInstaller : NSObject <SUInstallerProtocol> @interface SUGuidedPackageInstaller : NSObject <SUInstallerProtocol>
- (instancetype)initWithPackagePath:(NSString *)packagePath homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName; - (instancetype)initWithPackagePath:(NSString *)packagePath homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName;
@end @end
#endif
+14 -11
View File
@@ -6,8 +6,6 @@
// Copyright 2010 Dragon Systems Software Limited. All rights reserved. // Copyright 2010 Dragon Systems Software Limited. All rights reserved.
// //
#if SPARKLE_BUILD_PACKAGE_SUPPORT
#import <sys/stat.h> #import <sys/stat.h>
#import "SUGuidedPackageInstaller.h" #import "SUGuidedPackageInstaller.h"
#import "SUErrors.h" #import "SUErrors.h"
@@ -15,12 +13,19 @@
#include "AppKitPrevention.h" #include "AppKitPrevention.h"
@interface SUGuidedPackageInstaller ()
@property (nonatomic, readonly, copy) NSString *packagePath;
@property (nonatomic, readonly, copy) NSString *homeDirectory;
@property (nonatomic, readonly, copy) NSString *userName;
@end
@implementation SUGuidedPackageInstaller @implementation SUGuidedPackageInstaller
{
NSString *_packagePath; @synthesize packagePath = _packagePath;
NSString *_homeDirectory; @synthesize homeDirectory = _homeDirectory;
NSString *_userName; @synthesize userName = _userName;
}
- (instancetype)initWithPackagePath:(NSString *)packagePath homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName - (instancetype)initWithPackagePath:(NSString *)packagePath homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName
{ {
@@ -45,9 +50,9 @@
NSTask *task = [[NSTask alloc] init]; NSTask *task = [[NSTask alloc] init];
task.launchPath = installerPath; task.launchPath = installerPath;
task.arguments = @[@"-pkg", _packagePath, @"-target", @"/"]; task.arguments = @[@"-pkg", self.packagePath, @"-target", @"/"];
// Set the $HOME and $USER variables so pre/post install scripts reference the correct user environment // Set the $HOME and $USER variables so pre/post install scripts reference the correct user environment
task.environment = @{@"HOME": _homeDirectory, @"USER": _userName}; task.environment = @{@"HOME": self.homeDirectory, @"USER": self.userName};
task.standardError = nil; task.standardError = nil;
task.standardOutput = nil; task.standardOutput = nil;
@@ -88,5 +93,3 @@
} }
@end @end
#endif
+2 -6
View File
@@ -13,15 +13,11 @@ NS_ASSUME_NONNULL_BEGIN
@class SUHost; @class SUHost;
SPU_OBJC_DIRECT_MEMBERS @interface SUInstaller : NSObject @interface SUInstaller : NSObject
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName error:(NSError **)error; + (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName error:(NSError **)error;
+ (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host + (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(nullable BOOL *)isGuidedPtr;
#if SPARKLE_BUILD_PACKAGE_SUPPORT
isPackage:(BOOL *)isPackagePtr isGuided:(nullable BOOL *)isGuidedPtr
#endif
;
@end @end
+6 -39
View File
@@ -22,7 +22,7 @@
@implementation SUInstaller @implementation SUInstaller
+ (BOOL)isAliasFolderAtPath:(NSString *)path SPU_OBJC_DIRECT + (BOOL)isAliasFolderAtPath:(NSString *)path
{ {
NSNumber *aliasFlag = nil; NSNumber *aliasFlag = nil;
[[NSURL fileURLWithPath:path] getResourceValue:&aliasFlag forKey:NSURLIsAliasFileKey error:nil]; [[NSURL fileURLWithPath:path] getResourceValue:&aliasFlag forKey:NSURLIsAliasFileKey error:nil];
@@ -31,10 +31,7 @@
return aliasFlag.boolValue && directoryFlag.boolValue; return aliasFlag.boolValue && directoryFlag.boolValue;
} }
+ (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host + (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(BOOL *)isGuidedPtr
#if SPARKLE_BUILD_PACKAGE_SUPPORT
isPackage:(BOOL *)isPackagePtr isGuided:(BOOL *)isGuidedPtr
#endif
{ {
NSParameterAssert(inUpdateFolder); NSParameterAssert(inUpdateFolder);
NSParameterAssert(host); NSParameterAssert(host);
@@ -44,31 +41,23 @@
*newAppDownloadPath = nil, *newAppDownloadPath = nil,
*bundleFileName = [[host bundlePath] lastPathComponent], *bundleFileName = [[host bundlePath] lastPathComponent],
*alternateBundleFileName = [[host name] stringByAppendingPathExtension:[[host bundlePath] pathExtension]]; *alternateBundleFileName = [[host name] stringByAppendingPathExtension:[[host bundlePath] pathExtension]];
#if SPARKLE_BUILD_PACKAGE_SUPPORT
NSString *fallbackPackagePath = nil;
BOOL isPackage = NO; BOOL isPackage = NO;
BOOL isGuided = YES; BOOL isGuided = YES;
#endif NSString *fallbackPackagePath = nil;
NSDirectoryEnumerator *dirEnum = [[NSFileManager defaultManager] enumeratorAtPath:inUpdateFolder]; NSDirectoryEnumerator *dirEnum = [[NSFileManager defaultManager] enumeratorAtPath:inUpdateFolder];
NSString *bundleFileNameNoExtension = [bundleFileName stringByDeletingPathExtension]; NSString *bundleFileNameNoExtension = [bundleFileName stringByDeletingPathExtension];
while ((currentFile = [dirEnum nextObject])) { while ((currentFile = [dirEnum nextObject])) {
NSString *currentPath = [inUpdateFolder stringByAppendingPathComponent:currentFile]; NSString *currentPath = [inUpdateFolder stringByAppendingPathComponent:currentFile];
NSString *currentFilename = [currentFile lastPathComponent]; NSString *currentFilename = [currentFile lastPathComponent];
#if SPARKLE_BUILD_PACKAGE_SUPPORT
NSString *currentExtension = [currentFile pathExtension]; NSString *currentExtension = [currentFile pathExtension];
NSString *currentFilenameNoExtension = [currentFilename stringByDeletingPathExtension]; NSString *currentFilenameNoExtension = [currentFilename stringByDeletingPathExtension];
#endif
if ([currentFilename isEqualToString:bundleFileName] || if ([currentFilename isEqualToString:bundleFileName] ||
[currentFilename isEqualToString:alternateBundleFileName]) // We found one! [currentFilename isEqualToString:alternateBundleFileName]) // We found one!
{ {
#if SPARKLE_BUILD_PACKAGE_SUPPORT
isPackage = NO; isPackage = NO;
#endif
newAppDownloadPath = currentPath; newAppDownloadPath = currentPath;
break; break;
#if SPARKLE_BUILD_PACKAGE_SUPPORT
} else if ([currentExtension isEqualToString:@"pkg"] || } else if ([currentExtension isEqualToString:@"pkg"] ||
[currentExtension isEqualToString:@"mpkg"]) { [currentExtension isEqualToString:@"mpkg"]) {
if ([currentFilenameNoExtension isEqualToString:bundleFileNameNoExtension]) { if ([currentFilenameNoExtension isEqualToString:bundleFileNameNoExtension]) {
@@ -79,15 +68,12 @@
// Remember any other non-matching packages we have seen should we need to use one of them as a fallback. // Remember any other non-matching packages we have seen should we need to use one of them as a fallback.
fallbackPackagePath = currentPath; fallbackPackagePath = currentPath;
} }
#endif
} else { } else {
// Try matching on bundle identifiers in case the user has changed the name of the host app // Try matching on bundle identifiers in case the user has changed the name of the host app
NSBundle *incomingBundle = [NSBundle bundleWithPath:currentPath]; NSBundle *incomingBundle = [NSBundle bundleWithPath:currentPath];
NSString *hostBundleIdentifier = host.bundle.bundleIdentifier; NSString *hostBundleIdentifier = host.bundle.bundleIdentifier;
if (incomingBundle && [incomingBundle.bundleIdentifier isEqualToString:hostBundleIdentifier]) { if (incomingBundle && [incomingBundle.bundleIdentifier isEqualToString:hostBundleIdentifier]) {
#if SPARKLE_BUILD_PACKAGE_SUPPORT
isPackage = NO; isPackage = NO;
#endif
newAppDownloadPath = currentPath; newAppDownloadPath = currentPath;
break; break;
} }
@@ -98,7 +84,6 @@
[dirEnum skipDescendents]; [dirEnum skipDescendents];
} }
#if SPARKLE_BUILD_PACKAGE_SUPPORT
// We don't have a valid path. Try to use the fallback package. // We don't have a valid path. Try to use the fallback package.
if (newAppDownloadPath == nil && fallbackPackagePath != nil) { if (newAppDownloadPath == nil && fallbackPackagePath != nil) {
@@ -120,33 +105,18 @@
*isPackagePtr = isPackage; *isPackagePtr = isPackage;
if (isGuidedPtr) if (isGuidedPtr)
*isGuidedPtr = isGuided; *isGuidedPtr = isGuided;
#endif
if (!newAppDownloadPath) { if (!newAppDownloadPath) {
SULog(SULogLevelError, @"Searched %@ for %@.(app%@)", inUpdateFolder, bundleFileNameNoExtension, SULog(SULogLevelError, @"Searched %@ for %@.(app|pkg)", inUpdateFolder, bundleFileNameNoExtension);
#if SPARKLE_BUILD_PACKAGE_SUPPORT
@"|pkg"
#else
@""
#endif
);
} }
return newAppDownloadPath; return newAppDownloadPath;
} }
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName error:(NSError * __autoreleasing *)error + (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName error:(NSError * __autoreleasing *)error
{ {
#if SPARKLE_BUILD_PACKAGE_SUPPORT
BOOL isPackage = NO; BOOL isPackage = NO;
BOOL isGuided = NO; BOOL isGuided = NO;
#endif NSString *newDownloadPath = [self installSourcePathInUpdateFolder:updateDirectory forHost:host isPackage:&isPackage isGuided:&isGuided];
NSString *newDownloadPath = [self installSourcePathInUpdateFolder:updateDirectory forHost:host
#if SPARKLE_BUILD_PACKAGE_SUPPORT
isPackage:&isPackage isGuided:&isGuided
#endif
];
if (newDownloadPath == nil) { if (newDownloadPath == nil) {
if (error != NULL) { if (error != NULL) {
@@ -159,7 +129,6 @@
// We shouldn't implicitly trust the installation type fed into here from the appcast because the installation type helps us determine // We shouldn't implicitly trust the installation type fed into here from the appcast because the installation type helps us determine
// ahead of time whether or not this installer tool should be ran as root or not // ahead of time whether or not this installer tool should be ran as root or not
id <SUInstallerProtocol> installer = nil; id <SUInstallerProtocol> installer = nil;
#if SPARKLE_BUILD_PACKAGE_SUPPORT
if (isPackage && isGuided) { if (isPackage && isGuided) {
if (![expectedInstallationType isEqualToString:SPUInstallationTypeGuidedPackage]) { if (![expectedInstallationType isEqualToString:SPUInstallationTypeGuidedPackage]) {
if (error != NULL) { if (error != NULL) {
@@ -176,9 +145,7 @@
} else { } else {
installer = [[SUPackageInstaller alloc] initWithPackagePath:newDownloadPath]; installer = [[SUPackageInstaller alloc] initWithPackagePath:newDownloadPath];
} }
} else } else {
#endif
{
if (![expectedInstallationType isEqualToString:SPUInstallationTypeApplication]) { if (![expectedInstallationType isEqualToString:SPUInstallationTypeApplication]) {
if (error != NULL) { if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Found regular application update but expected '%@=%@' from the appcast item enclosure instead", SUAppcastAttributeInstallationType, expectedInstallationType] }]; *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Found regular application update but expected '%@=%@' from the appcast item enclosure instead", SUAppcastAttributeInstallationType, expectedInstallationType] }];
+1 -5
View File
@@ -6,18 +6,14 @@
// Copyright 2008 Andy Matuschak. All rights reserved. // Copyright 2008 Andy Matuschak. All rights reserved.
// //
#if SPARKLE_BUILD_PACKAGE_SUPPORT
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "SUInstallerProtocol.h" #import "SUInstallerProtocol.h"
// This is the deprecated package installation type, aka the "interactive" package installer // This is the deprecated package installation type, aka the "interactive" package installer
// For a more supported package installation, see SUGuidedPackageInstaller // For a more supported package installation, see SUGuidedPackageInstaller
SPU_OBJC_DIRECT_MEMBERS @interface SUPackageInstaller : NSObject <SUInstallerProtocol> @interface SUPackageInstaller : NSObject <SUInstallerProtocol>
- (instancetype)initWithPackagePath:(NSString *)packagePath; - (instancetype)initWithPackagePath:(NSString *)packagePath;
@end @end
#endif
+9 -8
View File
@@ -6,8 +6,6 @@
// Copyright 2008 Andy Matuschak. All rights reserved. // Copyright 2008 Andy Matuschak. All rights reserved.
// //
#if SPARKLE_BUILD_PACKAGE_SUPPORT
#import "SUPackageInstaller.h" #import "SUPackageInstaller.h"
#import "SUConstants.h" #import "SUConstants.h"
#import "SUErrors.h" #import "SUErrors.h"
@@ -16,13 +14,18 @@
#include "AppKitPrevention.h" #include "AppKitPrevention.h"
@interface SUPackageInstaller ()
@property (nonatomic, readonly, copy) NSString *packagePath;
@end
@implementation SUPackageInstaller @implementation SUPackageInstaller
{
NSString *_packagePath;
}
static NSString *SUOpenUtilityPath = @"/usr/bin/open"; static NSString *SUOpenUtilityPath = @"/usr/bin/open";
@synthesize packagePath = _packagePath;
- (instancetype)initWithPackagePath:(NSString *)packagePath - (instancetype)initWithPackagePath:(NSString *)packagePath
{ {
self = [super init]; self = [super init];
@@ -49,7 +52,7 @@ static NSString *SUOpenUtilityPath = @"/usr/bin/open";
// -W = wait until the app has quit. // -W = wait until the app has quit.
// -n = Open another instance if already open. // -n = Open another instance if already open.
// -b = app bundle identifier // -b = app bundle identifier
NSArray *args = @[@"-W", @"-n", @"-b", @"com.apple.installer", _packagePath]; NSArray *args = @[@"-W", @"-n", @"-b", @"com.apple.installer", self.packagePath];
// Known bug: if the installation fails or is canceled, Sparkle goes ahead and restarts, thinking everything is fine. // Known bug: if the installation fails or is canceled, Sparkle goes ahead and restarts, thinking everything is fine.
@try { @try {
@@ -77,5 +80,3 @@ static NSString *SUOpenUtilityPath = @"/usr/bin/open";
} }
@end @end
#endif
+1 -3
View File
@@ -14,12 +14,10 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
SPU_OBJC_DIRECT_MEMBERS @interface SUPipedUnarchiver : NSObject <SUUnarchiverProtocol> @interface SUPipedUnarchiver : NSObject <SUUnarchiverProtocol>
- (instancetype)initWithArchivePath:(NSString *)archivePath; - (instancetype)initWithArchivePath:(NSString *)archivePath;
+ (BOOL)canUnarchivePath:(NSString *)path;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
+37 -50
View File
@@ -14,12 +14,17 @@
#include "AppKitPrevention.h" #include "AppKitPrevention.h"
@implementation SUPipedUnarchiver @interface SUPipedUnarchiver ()
{
NSString *_archivePath;
}
static NSArray <NSString *> * _Nullable _commandAndArgumentsConformingToTypeOfPath(NSString *path) @property (nonatomic, copy, readonly) NSString *archivePath;
@end
@implementation SUPipedUnarchiver
@synthesize archivePath = _archivePath;
+ (nullable NSArray <NSString *> *)commandAndArgumentsConformingToTypeOfPath:(NSString *)path
{ {
NSArray <NSString *> *extractTGZ = @[@"/usr/bin/tar", @"-zxC"]; NSArray <NSString *> *extractTGZ = @[@"/usr/bin/tar", @"-zxC"];
NSArray <NSString *> *extractTBZ = @[@"/usr/bin/tar", @"-jxC"]; NSArray <NSString *> *extractTBZ = @[@"/usr/bin/tar", @"-jxC"];
@@ -50,7 +55,7 @@ static NSArray <NSString *> * _Nullable _commandAndArgumentsConformingToTypeOfPa
+ (BOOL)canUnarchivePath:(NSString *)path + (BOOL)canUnarchivePath:(NSString *)path
{ {
return _commandAndArgumentsConformingToTypeOfPath(path) != nil; return ([self commandAndArgumentsConformingToTypeOfPath:path] != nil);
} }
+ (BOOL)mustValidateBeforeExtraction + (BOOL)mustValidateBeforeExtraction
@@ -69,7 +74,7 @@ static NSArray <NSString *> * _Nullable _commandAndArgumentsConformingToTypeOfPa
- (void)unarchiveWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock - (void)unarchiveWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock
{ {
NSArray <NSString *> *commandAndArguments = _commandAndArgumentsConformingToTypeOfPath(_archivePath); NSArray <NSString *> *commandAndArguments = [[self class] commandAndArgumentsConformingToTypeOfPath:self.archivePath];
assert(commandAndArguments != nil); assert(commandAndArguments != nil);
NSString *command = commandAndArguments.firstObject; NSString *command = commandAndArguments.firstObject;
@@ -84,26 +89,26 @@ static NSArray <NSString *> * _Nullable _commandAndArgumentsConformingToTypeOfPa
} }
// This method abstracts the types that use a command line tool piping data from stdin. // This method abstracts the types that use a command line tool piping data from stdin.
- (void)extractArchivePipingDataToCommand:(NSString *)command arguments:(NSArray*)args notifier:(SUUnarchiverNotifier *)notifier SPU_OBJC_DIRECT - (void)extractArchivePipingDataToCommand:(NSString *)command arguments:(NSArray*)args notifier:(SUUnarchiverNotifier *)notifier
{ {
// *** GETS CALLED ON NON-MAIN THREAD!!! // *** GETS CALLED ON NON-MAIN THREAD!!!
@autoreleasepool { @autoreleasepool {
NSString *destination = [_archivePath stringByDeletingLastPathComponent]; NSString *destination = [self.archivePath stringByDeletingLastPathComponent];
SULog(SULogLevelDefault, @"Extracting using '%@' '%@' < '%@' '%@'", command, [args componentsJoinedByString:@"' '"], _archivePath, destination); SULog(SULogLevelDefault, @"Extracting using '%@' '%@' < '%@' '%@'", command, [args componentsJoinedByString:@"' '"], self.archivePath, destination);
// Get the file size. // Get the file size.
NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:_archivePath error:nil]; NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:self.archivePath error:nil];
NSUInteger expectedLength = [(NSNumber *)[attributes objectForKey:NSFileSize] unsignedIntegerValue]; NSUInteger expectedLength = [(NSNumber *)[attributes objectForKey:NSFileSize] unsignedIntegerValue];
if (expectedLength == 0) { if (expectedLength == 0) {
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, archive '%@' is empty", _archivePath]}]; NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, archive '%@' is empty", self.archivePath]}];
[notifier notifyFailureWithError:error]; [notifier notifyFailureWithError:error];
return; return;
} }
NSFileHandle *archiveInput = [NSFileHandle fileHandleForReadingAtPath:_archivePath]; NSFileHandle *archiveInput = [NSFileHandle fileHandleForReadingAtPath:self.archivePath];
NSPipe *pipe = [NSPipe pipe]; NSPipe *pipe = [NSPipe pipe];
NSTask *task = [[NSTask alloc] init]; NSTask *task = [[NSTask alloc] init];
@@ -122,29 +127,16 @@ static NSArray <NSString *> * _Nullable _commandAndArgumentsConformingToTypeOfPa
NSFileHandle *archiveOutput = [pipe fileHandleForWriting]; NSFileHandle *archiveOutput = [pipe fileHandleForWriting];
NSUInteger bytesWritten = 0; NSUInteger bytesWritten = 0;
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_15
BOOL hasIOErrorMethods; BOOL hasIOErrorMethods;
if (@available(macOS 10.15, *)) { if (@available(macOS 10.15, *)) {
hasIOErrorMethods = YES; hasIOErrorMethods = YES;
} else { } else {
hasIOErrorMethods = NO; hasIOErrorMethods = NO;
} }
#endif
do { do {
NSData *data; NSData *data;
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_15 if (hasIOErrorMethods) {
if (!hasIOErrorMethods) {
@try {
data = [archiveInput readDataOfLength:256*1024];
} @catch (NSException *exception) {
SULog(SULogLevelError, @"Failed to read data from archive with exception reason %@", exception.reason);
data = nil;
}
}
else
#endif
{
NSError *readError = nil; NSError *readError = nil;
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpartial-availability" #pragma clang diagnostic ignored "-Wpartial-availability"
@@ -153,6 +145,13 @@ static NSArray <NSString *> * _Nullable _commandAndArgumentsConformingToTypeOfPa
if (data == nil) { if (data == nil) {
SULog(SULogLevelError, @"Failed to read data from archive with error %@", readError); SULog(SULogLevelError, @"Failed to read data from archive with error %@", readError);
} }
} else {
@try {
data = [archiveInput readDataOfLength:256*1024];
} @catch (NSException *exception) {
SULog(SULogLevelError, @"Failed to read data from archive with exception reason %@", exception.reason);
data = nil;
}
} }
NSUInteger len = [data length]; NSUInteger len = [data length];
@@ -161,18 +160,7 @@ static NSArray <NSString *> * _Nullable _commandAndArgumentsConformingToTypeOfPa
} }
NSError *writeError = nil; NSError *writeError = nil;
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_15 if (hasIOErrorMethods) {
if (!hasIOErrorMethods) {
@try {
[archiveOutput writeData:data];
} @catch (NSException *exception) {
SULog(SULogLevelError, @"Failed to write data to pipe with exception reason %@", exception.reason);
break;
}
}
else
#endif
{
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpartial-availability" #pragma clang diagnostic ignored "-Wpartial-availability"
if (![archiveOutput writeData:data error:&writeError]) { if (![archiveOutput writeData:data error:&writeError]) {
@@ -180,6 +168,13 @@ static NSArray <NSString *> * _Nullable _commandAndArgumentsConformingToTypeOfPa
SULog(SULogLevelError, @"Failed to write data to pipe with error %@", writeError); SULog(SULogLevelError, @"Failed to write data to pipe with error %@", writeError);
break; break;
} }
} else {
@try {
[archiveOutput writeData:data];
} @catch (NSException *exception) {
SULog(SULogLevelError, @"Failed to write data to pipe with exception reason %@", exception.reason);
break;
}
} }
bytesWritten += len; bytesWritten += len;
@@ -193,26 +188,18 @@ static NSArray <NSString *> * _Nullable _commandAndArgumentsConformingToTypeOfPa
if (![archiveOutput closeAndReturnError:&archiveOutputCloseError]) { if (![archiveOutput closeAndReturnError:&archiveOutputCloseError]) {
SULog(SULogLevelError, @"Failed to close pipe with error %@", archiveOutputCloseError); SULog(SULogLevelError, @"Failed to close pipe with error %@", archiveOutputCloseError);
} }
} } else {
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_15
else
{
[archiveOutput closeFile]; [archiveOutput closeFile];
} }
#endif
if (@available(macOS 10.15, *)) { if (@available(macOS 10.15, *)) {
NSError *archiveInputCloseError = nil; NSError *archiveInputCloseError = nil;
if (![archiveInput closeAndReturnError:&archiveInputCloseError]) { if (![archiveInput closeAndReturnError:&archiveInputCloseError]) {
SULog(SULogLevelError, @"Failed to close archive input with error %@", archiveInputCloseError); SULog(SULogLevelError, @"Failed to close archive input with error %@", archiveInputCloseError);
} }
} } else {
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_15
else
{
[archiveInput closeFile]; [archiveInput closeFile];
} }
#endif
[task waitUntilExit]; [task waitUntilExit];
@@ -234,6 +221,6 @@ static NSArray <NSString *> * _Nullable _commandAndArgumentsConformingToTypeOfPa
} }
} }
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], _archivePath]; } - (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], self.archivePath]; }
@end @end
+1 -1
View File
@@ -12,7 +12,7 @@
@class SUHost; @class SUHost;
@protocol SUVersionComparison; @protocol SUVersionComparison;
SPU_OBJC_DIRECT_MEMBERS @interface SUPlainInstaller : NSObject <SUInstallerProtocol> @interface SUPlainInstaller : NSObject <SUInstallerProtocol>
/** /**
@param host The current (old) bundle host @param host The current (old) bundle host
+44 -18
View File
@@ -18,15 +18,25 @@
#include "AppKitPrevention.h" #include "AppKitPrevention.h"
@interface SUPlainInstaller ()
@property (nonatomic, readonly) SUHost *host;
@property (nonatomic, copy, readonly) NSString *bundlePath;
@property (nonatomic, copy, readonly) NSString *installationPath;
@property (nonatomic) NSURL *temporaryOldDirectory;
// We get an obj-c warning if we use 'newTemporaryDirectory' name about new + ownership stuff, so use 'temporaryNewDirectory' instead
@property (nonatomic) NSURL *temporaryNewDirectory;
@end
@implementation SUPlainInstaller @implementation SUPlainInstaller
{
SUHost *_host; @synthesize host = _host;
NSString *_bundlePath; @synthesize bundlePath = _bundlePath;
NSString *_installationPath; @synthesize installationPath = _installationPath;
NSURL *_temporaryOldDirectory; @synthesize temporaryOldDirectory = _temporaryOldDirectory;
// We get an obj-c warning if we use 'newTemporaryDirectory' name about new + ownership stuff, so use 'temporaryNewDirectory' instead @synthesize temporaryNewDirectory = _temporaryNewDirectory;
NSURL *_temporaryNewDirectory;
}
- (instancetype)initWithHost:(SUHost *)host bundlePath:(NSString *)bundlePath installationPath:(NSString *)installationPath - (instancetype)initWithHost:(SUHost *)host bundlePath:(NSString *)bundlePath installationPath:(NSString *)installationPath
{ {
@@ -39,7 +49,23 @@
return self; return self;
} }
- (BOOL)startInstallationToURL:(NSURL *)installationURL fromUpdateAtURL:(NSURL *)newURL withHost:(SUHost *)host progressBlock:(nullable void(^)(double))progress error:(NSError * __autoreleasing *)error SPU_OBJC_DIRECT // Returns the bundle version from the specified host that is appropriate to use as a filename, or nil if we're unable to retrieve one
- (NSString *)bundleVersionAppropriateForFilenameFromHost:(SUHost *)host
{
NSString *bundleVersion = [host objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
NSString *trimmedVersion = @"";
if (bundleVersion != nil) {
NSMutableCharacterSet *validCharacters = [NSMutableCharacterSet alphanumericCharacterSet];
[validCharacters formUnionWithCharacterSet:[NSCharacterSet characterSetWithCharactersInString:@".-()"]];
trimmedVersion = [bundleVersion stringByTrimmingCharactersInSet:[validCharacters invertedSet]];
}
return trimmedVersion.length > 0 ? trimmedVersion : nil;
}
- (BOOL)startInstallationToURL:(NSURL *)installationURL fromUpdateAtURL:(NSURL *)newURL withHost:(SUHost *)host progressBlock:(nullable void(^)(double))progress error:(NSError * __autoreleasing *)error
{ {
if (installationURL == nil || newURL == nil) { if (installationURL == nil || newURL == nil) {
// this really shouldn't happen but just in case // this really shouldn't happen but just in case
@@ -97,7 +123,7 @@
return NO; return NO;
} }
_temporaryNewDirectory = tempNewDirectoryURL; self.temporaryNewDirectory = tempNewDirectoryURL;
if (progress) { if (progress) {
progress(3/10.0); progress(3/10.0);
@@ -196,7 +222,7 @@
return NO; return NO;
} }
_temporaryOldDirectory = tempOldDirectoryURL; self.temporaryOldDirectory = tempOldDirectoryURL;
if (progress) { if (progress) {
progress(9/10.0); progress(9/10.0);
@@ -263,9 +289,9 @@
{ {
// Prevent malicious downgrades // Prevent malicious downgrades
// Note that we may not be able to do this for package installations, hence this code being done here // Note that we may not be able to do this for package installations, hence this code being done here
NSString *hostVersion = [_host version]; NSString *hostVersion = [self.host version];
NSBundle *bundle = [NSBundle bundleWithPath:_bundlePath]; NSBundle *bundle = [NSBundle bundleWithPath:self.bundlePath];
SUHost *updateHost = [[SUHost alloc] initWithBundle:bundle]; SUHost *updateHost = [[SUHost alloc] initWithBundle:bundle];
NSString *updateVersion = [updateHost objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey]; NSString *updateVersion = [updateHost objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
@@ -288,19 +314,19 @@
{ {
// Note: we must do most installation work in the third stage due to relying on our application sitting in temporary directories. // Note: we must do most installation work in the third stage due to relying on our application sitting in temporary directories.
// It must not be possible for our update to sit in temporary directories for a very long time. // It must not be possible for our update to sit in temporary directories for a very long time.
return [self startInstallationToURL:[NSURL fileURLWithPath:_installationPath] fromUpdateAtURL:[NSURL fileURLWithPath:_bundlePath] withHost:_host progressBlock:cb error:error]; return [self startInstallationToURL:[NSURL fileURLWithPath:self.installationPath] fromUpdateAtURL:[NSURL fileURLWithPath:self.bundlePath] withHost:self.host progressBlock:cb error:error];
} }
- (void)performCleanup - (void)performCleanup
{ {
SUFileManager *fileManager = [[SUFileManager alloc] init]; SUFileManager *fileManager = [[SUFileManager alloc] init];
if (_temporaryNewDirectory != nil) { if (self.temporaryNewDirectory != nil) {
[fileManager removeItemAtURL:_temporaryNewDirectory error:NULL]; [fileManager removeItemAtURL:self.temporaryNewDirectory error:NULL];
} }
if (_temporaryOldDirectory != nil) { if (self.temporaryOldDirectory != nil) {
[fileManager removeItemAtURL:_temporaryOldDirectory error:NULL]; [fileManager removeItemAtURL:self.temporaryOldDirectory error:NULL];
} }
} }
+1 -1
View File
@@ -19,7 +19,7 @@
@class SUSignatures; @class SUSignatures;
@class SUPublicKeys; @class SUPublicKeys;
SPU_OBJC_DIRECT_MEMBERS @interface SUSignatureVerifier : NSObject @interface SUSignatureVerifier : NSObject
+ (BOOL)validatePath:(NSString *)path withSignatures:(SUSignatures *)signatures withPublicKeys:(SUPublicKeys *)pkeys error:(NSError * __autoreleasing *)error; + (BOOL)validatePath:(NSString *)path withSignatures:(SUSignatures *)signatures withPublicKeys:(SUPublicKeys *)pkeys error:(NSError * __autoreleasing *)error;
+18 -38
View File
@@ -16,19 +16,21 @@
#import "SULog.h" #import "SULog.h"
#import "SUSignatures.h" #import "SUSignatures.h"
#import "SUErrors.h" #import "SUErrors.h"
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
#include <CommonCrypto/CommonDigest.h> #include <CommonCrypto/CommonDigest.h>
#endif
#import "ed25519.h" #import "ed25519.h"
#include "AppKitPrevention.h" #include "AppKitPrevention.h"
@implementation SUSignatureVerifier @interface SUSignatureVerifier ()
{ @property (readonly) SUPublicKeys *pubKeys;
SUPublicKeys *_pubKeys; @end
@implementation SUSignatureVerifier {
} }
@synthesize pubKeys = _pubKeys;
+ (BOOL)validatePath:(NSString *)path withSignatures:(SUSignatures *)signatures withPublicKeys:(SUPublicKeys *)pkeys error:(NSError * __autoreleasing *)error + (BOOL)validatePath:(NSString *)path withSignatures:(SUSignatures *)signatures withPublicKeys:(SUPublicKeys *)pkeys error:(NSError * __autoreleasing *)error
{ {
SUSignatureVerifier *verifier = [(SUSignatureVerifier *)[self alloc] initWithPublicKeys:pkeys]; SUSignatureVerifier *verifier = [(SUSignatureVerifier *)[self alloc] initWithPublicKeys:pkeys];
@@ -52,10 +54,9 @@
return self; return self;
} }
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT - (SecKeyRef)dsaSecKeyRef {
- (SecKeyRef)dsaSecKeyRef SPU_OBJC_DIRECT
{ NSData *data = [self.pubKeys.dsaPubKey dataUsingEncoding:NSASCIIStringEncoding];
NSData *data = [_pubKeys.dsaPubKey dataUsingEncoding:NSASCIIStringEncoding];
if (!self || !data.length) { if (!self || !data.length) {
SULog(SULogLevelError, @"Could not read public DSA key"); SULog(SULogLevelError, @"Could not read public DSA key");
return nil; return nil;
@@ -88,7 +89,6 @@
CFRelease(items); CFRelease(items);
return dsaPubKeySecKey; return dsaPubKeySecKey;
} }
#endif
- (BOOL)verifyFileAtPath:(NSString *)path signatures:(SUSignatures *)signatures error:(NSError * __autoreleasing *)error - (BOOL)verifyFileAtPath:(NSString *)path signatures:(SUSignatures *)signatures error:(NSError * __autoreleasing *)error
{ {
@@ -106,7 +106,7 @@
return NO; return NO;
} }
switch (_pubKeys.ed25519PubKeyStatus) { switch (self.pubKeys.ed25519PubKeyStatus) {
case SUSigningInputStatusAbsent: case SUSigningInputStatusAbsent:
if (signatures.ed25519SignatureStatus != SUSigningInputStatusAbsent) { if (signatures.ed25519SignatureStatus != SUSigningInputStatusAbsent) {
SULog(SULogLevelDefault, @"The update has an EdDSA signature, but it won't be used, because the old app doesn't have an EdDSA public key"); SULog(SULogLevelDefault, @"The update has an EdDSA signature, but it won't be used, because the old app doesn't have an EdDSA public key");
@@ -165,14 +165,11 @@
return NO; return NO;
} }
if (ed25519_verify(signatures.ed25519Signature, data.bytes, data.length, _pubKeys.ed25519PubKey)) { if (ed25519_verify(signatures.ed25519Signature, data.bytes, data.length, self.pubKeys.ed25519PubKey)) {
SULog(SULogLevelDefault, @"OK: EdDSA signature is correct"); SULog(SULogLevelDefault, @"OK: EdDSA signature is correct");
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
// No need to check DSA when EdDSA verification succeeded, unless a DSA signature is provided and it's // No need to check DSA when EdDSA verification succeeded, unless a DSA signature is provided and it's
// erroneously invalid // erroneously invalid
if (signatures.dsaSignatureStatus != SUSigningInputStatusInvalid) if (signatures.dsaSignatureStatus != SUSigningInputStatusInvalid) {
#endif
{
return YES; return YES;
} }
} else { } else {
@@ -180,11 +177,9 @@
SULog(SULogLevelError, @"%@", message); SULog(SULogLevelError, @"%@", message);
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
if (signatures.dsaSignatureStatus != SUSigningInputStatusAbsent) { if (signatures.dsaSignatureStatus != SUSigningInputStatusAbsent) {
SULog(SULogLevelDefault, @"DSA signature won't be checked, because EdDSA verification has already failed"); SULog(SULogLevelDefault, @"DSA signature won't be checked, because EdDSA verification has already failed");
} }
#endif
if (error != NULL) { if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: message }]; *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: message }];
@@ -197,8 +192,7 @@
break; break;
} }
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT switch (self.pubKeys.dsaPubKeyStatus) {
switch (_pubKeys.dsaPubKeyStatus) {
case SUSigningInputStatusAbsent: case SUSigningInputStatusAbsent:
if (signatures.dsaSignatureStatus != SUSigningInputStatusAbsent) { if (signatures.dsaSignatureStatus != SUSigningInputStatusAbsent) {
SULog(SULogLevelDefault, @"The update has a DSA signature, but it can't be used, because the old app doesn't have a DSA public key"); SULog(SULogLevelDefault, @"The update has a DSA signature, but it can't be used, because the old app doesn't have a DSA public key");
@@ -241,21 +235,6 @@
} }
} }
} }
#else
switch (_pubKeys.dsaPubKeyStatus) {
case SUSigningInputStatusAbsent:
break;
case SUSigningInputStatusInvalid:
// We don't keep track of DSA signatures, so we will ignore this mistake and treat it as if it were absent
break;
case SUSigningInputStatusPresent:
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: @"The old app has a DSA public key but DSA support is disabled, and the old app does not have an EdDSA public key." }];
}
return NO;
}
#endif
if (error != NULL) { if (error != NULL) {
// Use generic failure // Use generic failure
@@ -265,8 +244,7 @@
return NO; return NO;
} }
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT - (BOOL)verifyDSASignatureOfStream:(NSInputStream *)stream dsaSignature:(NSData *)dsaSignature error:(NSError * __autoreleasing *)outError
- (BOOL)verifyDSASignatureOfStream:(NSInputStream *)stream dsaSignature:(NSData *)dsaSignature error:(NSError * __autoreleasing *)outError SPU_OBJC_DIRECT
{ {
if (!stream || !dsaSignature) { if (!stream || !dsaSignature) {
SULog(SULogLevelError, @"Invalid arguments to verifyStream"); SULog(SULogLevelError, @"Invalid arguments to verifyStream");
@@ -323,7 +301,10 @@
return cleanup(); return cleanup();
} }
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
dataVerifyTransform = SecVerifyTransformCreate(dsaPubKeySecKey, (__bridge CFDataRef)dsaSignature, &error); dataVerifyTransform = SecVerifyTransformCreate(dsaPubKeySecKey, (__bridge CFDataRef)dsaSignature, &error);
#pragma clang diagnostic pop
if (!dataVerifyTransform) { if (!dataVerifyTransform) {
SULog(SULogLevelError, @"Could not understand format of the signature: %@; Signature data: %@", error, dsaSignature); SULog(SULogLevelError, @"Could not understand format of the signature: %@; Signature data: %@", error, dsaSignature);
if (outError != NULL) { if (outError != NULL) {
@@ -387,6 +368,5 @@
cleanup(); cleanup();
return result.boolValue; return result.boolValue;
} }
#endif
@end @end
+1 -1
View File
@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
@protocol SUUnarchiverProtocol; @protocol SUUnarchiverProtocol;
SPU_OBJC_DIRECT_MEMBERS @interface SUUnarchiver : NSObject @interface SUUnarchiver : NSObject
+ (nullable id <SUUnarchiverProtocol>)unarchiverForPath:(NSString *)path updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword expectingInstallationType:(NSString *)installationType; + (nullable id <SUUnarchiverProtocol>)unarchiverForPath:(NSString *)path updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword expectingInstallationType:(NSString *)installationType;
+3 -10
View File
@@ -23,24 +23,17 @@
if ([SUPipedUnarchiver canUnarchivePath:path]) { if ([SUPipedUnarchiver canUnarchivePath:path]) {
return [[SUPipedUnarchiver alloc] initWithArchivePath:path]; return [[SUPipedUnarchiver alloc] initWithArchivePath:path];
} } else if ([SUDiskImageUnarchiver canUnarchivePath:path]) {
#if SPARKLE_BUILD_DMG_SUPPORT
else if ([SUDiskImageUnarchiver canUnarchivePath:path]) {
return [[SUDiskImageUnarchiver alloc] initWithArchivePath:path decryptionPassword:decryptionPassword]; return [[SUDiskImageUnarchiver alloc] initWithArchivePath:path decryptionPassword:decryptionPassword];
} } else if ([SUBinaryDeltaUnarchiver canUnarchivePath:path]) {
#endif
else if ([SUBinaryDeltaUnarchiver canUnarchivePath:path]) {
assert(hostPath != nil); assert(hostPath != nil);
NSString *nonNullHostPath = hostPath; NSString *nonNullHostPath = hostPath;
return [[SUBinaryDeltaUnarchiver alloc] initWithArchivePath:path updateHostBundlePath:nonNullHostPath]; return [[SUBinaryDeltaUnarchiver alloc] initWithArchivePath:path updateHostBundlePath:nonNullHostPath];
} } else if ([SUFlatPackageUnarchiver canUnarchivePath:path]) {
#if SPARKLE_BUILD_PACKAGE_SUPPORT
else if ([SUFlatPackageUnarchiver canUnarchivePath:path]) {
// Flat packages are only supported for guided packaage installs // Flat packages are only supported for guided packaage installs
return [[SUFlatPackageUnarchiver alloc] initWithFlatPackagePath:path expectingInstallationType:installationType]; return [[SUFlatPackageUnarchiver alloc] initWithFlatPackagePath:path expectingInstallationType:installationType];
} }
#endif
return nil; return nil;
} }
+1 -1
View File
@@ -10,7 +10,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
SPU_OBJC_DIRECT_MEMBERS @interface SUUnarchiverNotifier : NSObject @interface SUUnarchiverNotifier : NSObject
- (instancetype)initWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock; - (instancetype)initWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock;
+15 -9
View File
@@ -13,11 +13,17 @@
#include "AppKitPrevention.h" #include "AppKitPrevention.h"
@interface SUUnarchiverNotifier ()
@property (nonatomic, readonly, copy) void (^completionBlock)(NSError * _Nullable);
@property (nonatomic, readonly, copy) void (^ _Nullable progressBlock)(double);
@end
@implementation SUUnarchiverNotifier @implementation SUUnarchiverNotifier
{
void (^_completionBlock)(NSError * _Nullable); @synthesize completionBlock = _completionBlock;
void (^ _Nullable _progressBlock)(double); @synthesize progressBlock = _progressBlock;
}
- (instancetype)initWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock - (instancetype)initWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock
{ {
@@ -34,13 +40,13 @@
- (void)notifySuccess - (void)notifySuccess
{ {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
self->_completionBlock(nil); self.completionBlock(nil);
}); });
} }
- (void)notifyFailureWithError:(NSError * _Nullable)reason - (void)notifyFailureWithError:(NSError * _Nullable)reason
{ {
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithObject:@"An error occurred while extracting the archive. Please try again later." forKey:NSLocalizedDescriptionKey]; NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithObject:SULocalizedString(@"An error occurred while extracting the archive. Please try again later.", nil) forKey:NSLocalizedDescriptionKey];
if (reason) { if (reason) {
[userInfo setObject:(NSError * _Nonnull)reason forKey:NSUnderlyingErrorKey]; [userInfo setObject:(NSError * _Nonnull)reason forKey:NSUnderlyingErrorKey];
} }
@@ -48,15 +54,15 @@
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:userInfo]; NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:userInfo];
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
self->_completionBlock(error); self.completionBlock(error);
}); });
} }
- (void)notifyProgress:(double)progress - (void)notifyProgress:(double)progress
{ {
if (_progressBlock != nil) { if (self.progressBlock != nil) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
self->_progressBlock(progress); self.progressBlock(progress);
}); });
} }
} }
+2
View File
@@ -12,6 +12,8 @@ NS_ASSUME_NONNULL_BEGIN
@protocol SUUnarchiverProtocol <NSObject> @protocol SUUnarchiverProtocol <NSObject>
+ (BOOL)canUnarchivePath:(NSString *)path;
+ (BOOL)mustValidateBeforeExtraction; + (BOOL)mustValidateBeforeExtraction;
- (void)unarchiveWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock; - (void)unarchiveWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock;
+1 -1
View File
@@ -11,7 +11,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
SPU_OBJC_DIRECT_MEMBERS @interface StatusInfo : NSObject <SUStatusInfoProtocol> @interface StatusInfo : NSObject <SUStatusInfoProtocol>
- (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier; - (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier;
-1
View File
@@ -21,7 +21,6 @@
{ {
NSXPCListener *_xpcListener; NSXPCListener *_xpcListener;
NSMutableDictionary *_pendingReplies; NSMutableDictionary *_pendingReplies;
NSUInteger _pendingReplyCounter; NSUInteger _pendingReplyCounter;
} }
+1 -1
View File
@@ -10,7 +10,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
SPU_OBJC_DIRECT_MEMBERS @interface TerminationListener : NSObject @interface TerminationListener : NSObject
- (instancetype)initWithProcessIdentifier:(NSNumber * _Nullable)processIdentifier; - (instancetype)initWithProcessIdentifier:(NSNumber * _Nullable)processIdentifier;
+21 -16
View File
@@ -16,14 +16,19 @@
#include "AppKitPrevention.h" #include "AppKitPrevention.h"
@interface TerminationListener ()
@property (nonatomic, readonly, nullable) NSNumber *processIdentifier;
@property (nonatomic) BOOL watchedTermination;
@property (nonatomic, copy) void (^completionBlock)(BOOL);
@end
@implementation TerminationListener @implementation TerminationListener
{
NSNumber *_processIdentifier; @synthesize completionBlock = _completionBlock;
@synthesize processIdentifier = _processIdentifier;
void (^_completionBlock)(BOOL); @synthesize watchedTermination = _watchedTermination;
BOOL _watchedTermination;
}
- (instancetype)initWithProcessIdentifier:(NSNumber * _Nullable)processIdentifier - (instancetype)initWithProcessIdentifier:(NSNumber * _Nullable)processIdentifier
{ {
@@ -37,22 +42,22 @@
- (BOOL)terminated - (BOOL)terminated
{ {
return (_watchedTermination || _processIdentifier == nil) ? YES : (kill(_processIdentifier.intValue, 0) != 0); return (self.watchedTermination || self.processIdentifier == nil) ? YES : (kill(self.processIdentifier.intValue, 0) != 0);
} }
- (void)invokeCompletionWithSuccess:(BOOL)success SPU_OBJC_DIRECT - (void)invokeCompletionWithSuccess:(BOOL)success
{ {
if (_completionBlock != nil) { if (self.completionBlock != nil) {
_completionBlock(success); self.completionBlock(success);
_completionBlock = nil; self.completionBlock = nil;
} }
} }
- (void)startListeningWithCompletion:(void (^)(BOOL))completionBlock - (void)startListeningWithCompletion:(void (^)(BOOL))completionBlock
{ {
_completionBlock = [completionBlock copy]; self.completionBlock = completionBlock;
if (_processIdentifier == nil) { if (self.processIdentifier == nil) {
[self invokeCompletionWithSuccess:YES]; [self invokeCompletionWithSuccess:YES];
return; return;
} }
@@ -61,7 +66,7 @@
// As described in https://developer.apple.com/library/mac/technotes/tn2050/_index.html#//apple_ref/doc/uid/DTS10003081-CH1-SUBSECTION10 // As described in https://developer.apple.com/library/mac/technotes/tn2050/_index.html#//apple_ref/doc/uid/DTS10003081-CH1-SUBSECTION10
// By using kqueues, we can stay away from using AppKit in case we ever decide to abandon it // By using kqueues, we can stay away from using AppKit in case we ever decide to abandon it
pid_t processIdentifier = _processIdentifier.intValue; pid_t processIdentifier = self.processIdentifier.intValue;
int queue = kqueue(); int queue = kqueue();
if (queue == -1) { if (queue == -1) {
SULog(SULogLevelError, @"Failed to create kqueue() due to error %d: %@", errno, @(strerror(errno))); SULog(SULogLevelError, @"Failed to create kqueue() due to error %d: %@", errno, @(strerror(errno)));
@@ -119,7 +124,7 @@ static void noteExitKQueueCallback(CFFileDescriptorRef file, CFOptionFlags __unu
kevent(CFFileDescriptorGetNativeDescriptor(file), NULL, 0, &event, 1, NULL); kevent(CFFileDescriptorGetNativeDescriptor(file), NULL, 0, &event, 1, NULL);
TerminationListener *self = CFBridgingRelease(info); TerminationListener *self = CFBridgingRelease(info);
self->_watchedTermination = YES; self.watchedTermination = YES;
[self invokeCompletionWithSuccess:YES]; [self invokeCompletionWithSuccess:YES];
} }
+1 -1
View File
@@ -20,7 +20,7 @@ struct Create: ParsableCommand {
@Option(name: .long, help: ArgumentHelp(COMPRESSION_METHOD_ARGUMENT_DESCRIPTION, valueName: "compression")) @Option(name: .long, help: ArgumentHelp(COMPRESSION_METHOD_ARGUMENT_DESCRIPTION, valueName: "compression"))
var compression: String = "default" var compression: String = "default"
@Option(name: .long, help: .hidden) @Option(name: .long, help: ArgumentHelp(COMPRESSION_LEVEL_ARGUMENT_DESCRIPTION, valueName: "compression-level"))
var compressionLevel: UInt8 = 0 var compressionLevel: UInt8 = 0
@Argument(help: ArgumentHelp("Path to original bundle to create a patch from.")) @Argument(help: ArgumentHelp("Path to original bundle to create a patch from."))
-17
View File
@@ -1,20 +1,3 @@
# 2.4.0
* Reduce code size
* Enable deployment postprocessing in Release to properly strip debug symbols and strip all non-global symbols (#2286, #2305) (Zorg)
* Remove duplicate Sparkle localization strings in Updater app (#2288) (Zorg)
* Optimize codebase for generated code size (less properties, direct methods, etc) (#2305) (Zorg)
* Add additional settings to `ConfigCommon.xcconfig` for disabling features
* Ask permission for automatically downloading and installing new updates (#2285) (Zorg)
* Add support for plain text release notes view that does not use web view (#2315) (Zorg)
* Update `SUVersionDisplay` to better customize and display how versions are shown (#2321) (Zorg)
* Add deprecations/warnings for incorrect background update checking usage (#2295) (Zorg)
* Deprecate `-[SPUUpdater setFeedURL:]` API and add `-[SPUUpdater clearFeedURLFromUserDefaults]` for migrating away from `-[SPUUpdater setFeedURL:]` (#2295)
* Trigger a new update check in `-[SPUUpdater resetUpdateCycle]` if the updater's feed or allowed channels have changed (#2324) (Zorg)
* Exit with an error if generate_appcast cannot sign an update that must be signed (#2322) (Zorg)
* Remove a redundant Apple code signing check when verifying new updates (#2341) (Zorg)
* Turn off auto-linking for XPC targets to alleviate circular dependency issues (#2332) (Daniel Jalkut)
# 2.3.2 # 2.3.2
* Fix potential crash during download if appcast item includes invalid enclosure URL (#2317) (Zorg) * Fix potential crash during download if appcast item includes invalid enclosure URL (#2317) (Zorg)
+1 -1
View File
@@ -1 +1 @@
{"1.27.1": "https://github.com/sparkle-project/Sparkle/releases/download/1.27.1/Sparkle-1.27.1.tar.xz", "2.0.0-beta.6": "https://github.com/sparkle-project/Sparkle/releases/download/2.0.0-beta.6/Sparkle-2.0.0-beta.6.tar.xz", "2.0.0-rc.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.0.0-rc.1/Sparkle-2.0.0-rc.1.tar.xz", "2.0.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.0.0/Sparkle-2.0.0.tar.xz", "2.1.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0-beta.1/Sparkle-2.1.0-beta.1.tar.xz", "2.1.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0-beta.2/Sparkle-2.1.0-beta.2.tar.xz", "2.1.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0/Sparkle-2.1.0.tar.xz", "2.2.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0-beta.1/Sparkle-2.2.0-beta.1.tar.xz", "2.2.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0-beta.2/Sparkle-2.2.0-beta.2.tar.xz", "2.2.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0/Sparkle-2.2.0.tar.xz", "2.2.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.1/Sparkle-2.2.1.tar.xz", "2.2.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.2/Sparkle-2.2.2.tar.xz", "2.3.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.0-beta.1/Sparkle-2.3.0-beta.1.tar.xz", "2.3.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.0-beta.2/Sparkle-2.3.0-beta.2.tar.xz", "2.3.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.0/Sparkle-2.3.0.tar.xz", "2.3.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.1/Sparkle-2.3.1.tar.xz", "2.3.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.2/Sparkle-2.3.2.tar.xz", "2.4.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.0-beta.1/Sparkle-2.4.0-beta.1.tar.xz", "2.4.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.0-beta.2/Sparkle-2.4.0-beta.2.tar.xz", "2.4.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.0/Sparkle-2.4.0.tar.xz"} {"1.27.1": "https://github.com/sparkle-project/Sparkle/releases/download/1.27.1/Sparkle-1.27.1.tar.xz", "2.0.0-beta.6": "https://github.com/sparkle-project/Sparkle/releases/download/2.0.0-beta.6/Sparkle-2.0.0-beta.6.tar.xz", "2.0.0-rc.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.0.0-rc.1/Sparkle-2.0.0-rc.1.tar.xz", "2.0.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.0.0/Sparkle-2.0.0.tar.xz", "2.1.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0-beta.1/Sparkle-2.1.0-beta.1.tar.xz", "2.1.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0-beta.2/Sparkle-2.1.0-beta.2.tar.xz", "2.1.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0/Sparkle-2.1.0.tar.xz", "2.2.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0-beta.1/Sparkle-2.2.0-beta.1.tar.xz", "2.2.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0-beta.2/Sparkle-2.2.0-beta.2.tar.xz", "2.2.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0/Sparkle-2.2.0.tar.xz", "2.2.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.1/Sparkle-2.2.1.tar.xz", "2.2.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.2/Sparkle-2.2.2.tar.xz", "2.3.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.0-beta.1/Sparkle-2.3.0-beta.1.tar.xz", "2.3.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.0-beta.2/Sparkle-2.3.0-beta.2.tar.xz", "2.3.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.0/Sparkle-2.3.0.tar.xz", "2.3.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.1/Sparkle-2.3.1.tar.xz", "2.3.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.2/Sparkle-2.3.2.tar.xz"}
@@ -3,4 +3,4 @@
#include "ConfigSwift.xcconfig" #include "ConfigSwift.xcconfig"
SWIFT_OBJC_BRIDGING_HEADER = $(PRODUCT_NAME)/Bridging-Header.h SWIFT_OBJC_BRIDGING_HEADER = $(PRODUCT_NAME)/Bridging-Header.h
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_EXTERNALLY=1 GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE_TOOL=1
+19 -62
View File
@@ -1,66 +1,15 @@
// Common // Common
// Set to 1 or 0 to build and bundle the provided XPC Services in Sparkle framework
// (Note for testing purposes for sandboxed apps, disabling all XPC services and then re-enabling them
// may not work on the same login session due to a system caching issue. See comments for setting FRAMEWORK_VERSION for more info)
SPARKLE_EMBED_INSTALLER_LAUNCHER_XPC_SERVICE = 1
// Embedding the downloader service also enables building legacy WebKit1 support
SPARKLE_EMBED_DOWNLOADER_XPC_SERVICE = 1
SPARKLE_EMBED_INSTALLER_STATUS_XPC_SERVICE = 0
SPARKLE_EMBED_INSTALLER_CONNECTION_XPC_SERVICE = 0
// Set to 0 to disable building legacy 1.x SUUpdater stub
SPARKLE_BUILD_LEGACY_SUUPDATER = 1
// Set to 0 to not build legacy DSA signing support
// Don't disable this if you haven't migrated to EdDSA yet or if you support updating
// other developer's applications that haven't migrated to EdDSA yet
// If this is disabled, this requires an update to OTHER_SWIFT_FLAGS_COMMON below
SPARKLE_BUILD_LEGACY_DSA_SUPPORT = 1
// Set to 0 to not build legacy DSA signing support for generate_appcast
// Don't disable this if you still have items in your appcast feed that still need DSA signatures
// If this is disabled, this requires an update to OTHER_SWIFT_FLAGS_COMMON below
GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT = 1
// Set to 0 to not build legacy / xar based delta update support
SPARKLE_BUILD_LEGACY_DELTA_SUPPORT = 1
// Set to 0 to not build bzip2 support for version 3 delta based updates
SPARKLE_BUILD_BZIP2_DELTA_SUPPORT = 1
// Set to 0 to not build support for package (pkg) based installations
// If this is disabled, this requires an update to OTHER_SWIFT_FLAGS_COMMON below
SPARKLE_BUILD_PACKAGE_SUPPORT = 1
// Set to 0 to not build support for extracting updates from disk images (dmgs)
// If this is disabled, this requires an update to OTHER_SWIFT_FLAGS_COMMON below
SPARKLE_BUILD_DMG_SUPPORT = 1
// Set to 0 to only build all non-UI bits (which means client uses a custom SPUUserDriver)
SPARKLE_BUILD_UI_BITS = 1
// Set to 0 to not use and copy localization / string files to framework
SPARKLE_COPY_LOCALIZATIONS = 1
// Compilation flags for Swift tools and unit tests
// If SPARKLE_BUILD_LEGACY_DELTA_SUPPORT is set to 0, remove -DSPARKLE_BUILD_LEGACY_DSA_SUPPORT
// If GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT is set to 0, remove -DGENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT
// If SPARKLE_BUILD_PACKAGE_SUPPORT is set to 0, remove -DSPARKLE_BUILD_PACKAGE_SUPPORT
// If SPARKLE_BUILD_DMG_SUPPORT is set to 0, remove -DSPARKLE_BUILD_DMG_SUPPORT
OTHER_SWIFT_FLAGS_COMMON = -DSPARKLE_BUILD_LEGACY_DSA_SUPPORT -DGENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT -DSPARKLE_BUILD_PACKAGE_SUPPORT -DSPARKLE_BUILD_DMG_SUPPORT
// Minimum supported macOS version
MACOSX_DEPLOYMENT_TARGET = 10.13
// Supported architectures
ARCHS = $(ARCHS_STANDARD)
// Default Sparkle names
SPARKLE_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle SPARKLE_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle
SPARKLE_RELAUNCH_TOOL_NAME = Autoupdate SPARKLE_RELAUNCH_TOOL_NAME = Autoupdate
SPARKLE_INSTALLER_PROGRESS_TOOL_NAME = Updater SPARKLE_INSTALLER_PROGRESS_TOOL_NAME = Updater
// Set to 1 or 0 to bundle or not bundle provided XPC Services in Sparkle framework
SPARKLE_EMBED_INSTALLER_LAUNCHER_XPC_SERVICE = 1
SPARKLE_EMBED_DOWNLOADER_XPC_SERVICE = 1
SPARKLE_EMBED_INSTALLER_STATUS_XPC_SERVICE = 0
SPARKLE_EMBED_INSTALLER_CONNECTION_XPC_SERVICE = 0
// Set these if you want to use custom name for the XPC Services // Set these if you want to use custom name for the XPC Services
// For the Installer one in particular, this name may show up in an authorization prompt // For the Installer one in particular, this name may show up in an authorization prompt
// when installing an update that requires authorization. // when installing an update that requires authorization.
@@ -77,6 +26,9 @@ INSTALLER_STATUS_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.InstallerStatus
INSTALLER_LAUNCHER_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.InstallerLauncher INSTALLER_LAUNCHER_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.InstallerLauncher
DOWNLOADER_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.Downloader DOWNLOADER_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.Downloader
// Set to 0 to only build all non-UI bits
SPARKLE_BUILD_UI_BITS = 1
// If your app file on disk is named "MyApp 1.1b4", Sparkle usually updates it // If your app file on disk is named "MyApp 1.1b4", Sparkle usually updates it
// in place, giving you an app named 1.1b4 that is actually 1.2. Turn the // in place, giving you an app named 1.1b4 that is actually 1.2. Turn the
// following on to always reset the name back to "MyApp" // following on to always reset the name back to "MyApp"
@@ -90,23 +42,25 @@ SPARKLE_ICON_NAME = AppIcon
// If you change any of these version details, you must increase CURRENT_PROJECT_VERSION // If you change any of these version details, you must increase CURRENT_PROJECT_VERSION
// These variables must have a space after the '=' too // These variables must have a space after the '=' too
SPARKLE_VERSION_MAJOR = 2 SPARKLE_VERSION_MAJOR = 2
SPARKLE_VERSION_MINOR = 4 SPARKLE_VERSION_MINOR = 3
SPARKLE_VERSION_PATCH = 0 SPARKLE_VERSION_PATCH = 2
// This should be in SemVer format or empty, ie. "-beta.1" // This should be in SemVer format or empty, ie. "-beta.1"
// These variables must have a space after the '=' too // These variables must have a space after the '=' too
SPARKLE_VERSION_SUFFIX = SPARKLE_VERSION_SUFFIX =
CURRENT_PROJECT_VERSION = 2025 CURRENT_PROJECT_VERSION = 2021.2
MARKETING_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)$(SPARKLE_VERSION_SUFFIX) MARKETING_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)$(SPARKLE_VERSION_SUFFIX)
ALWAYS_SEARCH_USER_PATHS = NO ALWAYS_SEARCH_USER_PATHS = NO
ENABLE_STRICT_OBJC_MSGSEND = YES ENABLE_STRICT_OBJC_MSGSEND = YES
GCC_SYMBOLS_PRIVATE_EXTERN = YES GCC_SYMBOLS_PRIVATE_EXTERN = YES
GCC_INLINES_ARE_PRIVATE_EXTERN = YES GCC_INLINES_ARE_PRIVATE_EXTERN = YES
ARCHS = $(ARCHS_STANDARD)
MACOSX_DEPLOYMENT_TARGET = 10.13
PRODUCT_NAME = ${TARGET_NAME} PRODUCT_NAME = ${TARGET_NAME}
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle.${PRODUCT_NAME:rfc1034identifier} PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle.${PRODUCT_NAME:rfc1034identifier}
GCC_PREPROCESSOR_DEFINITIONS_COMMON = SPU_OBJC_DIRECT=__attribute__((objc_direct)) SPU_OBJC_DIRECT_MEMBERS=__attribute__((objc_direct_members)) SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=$(SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) SPARKLE_BUILD_UI_BITS=$(SPARKLE_BUILD_UI_BITS) SPARKLE_COPY_LOCALIZATIONS=$(SPARKLE_COPY_LOCALIZATIONS) SPARKLE_BUILD_LEGACY_SUUPDATER=$(SPARKLE_BUILD_LEGACY_SUUPDATER) SPARKLE_BUILD_PACKAGE_SUPPORT=$(SPARKLE_BUILD_PACKAGE_SUPPORT) SPARKLE_BUILD_DMG_SUPPORT=$(SPARKLE_BUILD_DMG_SUPPORT) SPARKLE_BUILD_LEGACY_DELTA_SUPPORT=$(SPARKLE_BUILD_LEGACY_DELTA_SUPPORT) SPARKLE_BUILD_BZIP2_DELTA_SUPPORT=$(SPARKLE_BUILD_BZIP2_DELTA_SUPPORT) SPARKLE_BUILD_LEGACY_DSA_SUPPORT=$(SPARKLE_BUILD_LEGACY_DSA_SUPPORT) GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT=$(GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT) SPARKLE_BUNDLE_IDENTIFIER=\"$(SPARKLE_BUNDLE_IDENTIFIER)\" CURRENT_PROJECT_VERSION=\"$(CURRENT_PROJECT_VERSION)\" MARKETING_VERSION=\"$(MARKETING_VERSION)\" SPARKLE_RELAUNCH_TOOL_NAME=\"$(SPARKLE_RELAUNCH_TOOL_NAME)\" SPARKLE_INSTALLER_PROGRESS_TOOL_NAME=\"$(SPARKLE_INSTALLER_PROGRESS_TOOL_NAME)\" SPARKLE_ICON_NAME=\"$(SPARKLE_ICON_NAME)\" INSTALLER_LAUNCHER_NAME=\"${INSTALLER_LAUNCHER_NAME}\" INSTALLER_LAUNCHER_BUNDLE_ID=\"${INSTALLER_LAUNCHER_BUNDLE_ID}\" INSTALLER_LAUNCHER_XPC_SERVICE_EMBEDDED=$(SPARKLE_EMBED_INSTALLER_LAUNCHER_XPC_SERVICE) INSTALLER_CONNECTION_NAME=\"${INSTALLER_CONNECTION_NAME}\" INSTALLER_CONNECTION_BUNDLE_ID=\"${INSTALLER_CONNECTION_BUNDLE_ID}\" INSTALLER_CONNECTION_XPC_SERVICE_EMBEDDED=$(SPARKLE_EMBED_INSTALLER_CONNECTION_XPC_SERVICE) INSTALLER_STATUS_NAME=\"${INSTALLER_STATUS_NAME}\" INSTALLER_STATUS_BUNDLE_ID=\"${INSTALLER_STATUS_BUNDLE_ID}\" INSTALLER_STATUS_XPC_SERVICE_EMBEDDED=$(SPARKLE_EMBED_INSTALLER_STATUS_XPC_SERVICE) DOWNLOADER_NAME=\"${DOWNLOADER_NAME}\" DOWNLOADER_BUNDLE_ID=\"${DOWNLOADER_BUNDLE_ID}\" DOWNLOADER_XPC_SERVICE_EMBEDDED=$(SPARKLE_EMBED_DOWNLOADER_XPC_SERVICE) GCC_PREPROCESSOR_DEFINITIONS_COMMON = SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=$(SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) SPARKLE_BUILD_UI_BITS=$(SPARKLE_BUILD_UI_BITS) SPARKLE_BUNDLE_IDENTIFIER=\"$(SPARKLE_BUNDLE_IDENTIFIER)\" CURRENT_PROJECT_VERSION=\"$(CURRENT_PROJECT_VERSION)\" MARKETING_VERSION=\"$(MARKETING_VERSION)\" SPARKLE_RELAUNCH_TOOL_NAME=\"$(SPARKLE_RELAUNCH_TOOL_NAME)\" SPARKLE_INSTALLER_PROGRESS_TOOL_NAME=\"$(SPARKLE_INSTALLER_PROGRESS_TOOL_NAME)\" SPARKLE_ICON_NAME=\"$(SPARKLE_ICON_NAME)\" INSTALLER_LAUNCHER_NAME=\"${INSTALLER_LAUNCHER_NAME}\" INSTALLER_LAUNCHER_BUNDLE_ID=\"${INSTALLER_LAUNCHER_BUNDLE_ID}\" INSTALLER_CONNECTION_NAME=\"${INSTALLER_CONNECTION_NAME}\" INSTALLER_CONNECTION_BUNDLE_ID=\"${INSTALLER_CONNECTION_BUNDLE_ID}\" INSTALLER_STATUS_NAME=\"${INSTALLER_STATUS_NAME}\" INSTALLER_STATUS_BUNDLE_ID=\"${INSTALLER_STATUS_BUNDLE_ID}\" DOWNLOADER_NAME=\"${DOWNLOADER_NAME}\" DOWNLOADER_BUNDLE_ID=\"${DOWNLOADER_BUNDLE_ID}\"
CODE_SIGN_IDENTITY = - CODE_SIGN_IDENTITY = -
SDKROOT = macosx SDKROOT = macosx
@@ -160,5 +114,8 @@ GCC_WARN_UNUSED_LABEL = YES
GCC_WARN_UNUSED_PARAMETER = YES GCC_WARN_UNUSED_PARAMETER = YES
GCC_WARN_UNUSED_VARIABLE = YES GCC_WARN_UNUSED_VARIABLE = YES
// These should be removed once the conversion to ARC is complete
WARNING_CFLAGS_EXTRA = -Wno-custom-atomic-properties -Wno-implicit-atomic-properties
// Turn on all warnings, then disable a few which are almost impossible to avoid // Turn on all warnings, then disable a few which are almost impossible to avoid
WARNING_CFLAGS = -Wall -Weverything -Wno-unused-macros -Wno-gnu-statement-expression -Wno-auto-import -Wno-gnu-zero-variadic-macro-arguments -Wno-format-non-iso -Wno-direct-ivar-access -Wno-declaration-after-statement -Werror=undef WARNING_CFLAGS = -Wall -Weverything -Wno-unused-macros -Wno-gnu-statement-expression -Wno-arc-repeated-use-of-weak -Wno-auto-import -Wno-gnu-zero-variadic-macro-arguments -Wno-format-non-iso -Wno-direct-ivar-access $(WARNING_CFLAGS_EXTRA)
@@ -1,7 +1,6 @@
#include "ConfigCommonDebug.xcconfig" #include "ConfigCommonDebug.xcconfig"
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_COMMON) GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_COMMON)
OTHER_SWIFT_FLAGS = $(OTHER_SWIFT_FLAGS_COMMON)
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES; CLANG_WARN_COMMA = YES;
@@ -13,6 +13,5 @@ DEBUG_INFORMATION_FORMAT = dwarf
ENABLE_TESTABILITY = YES ENABLE_TESTABILITY = YES
GCC_GENERATE_DEBUGGING_SYMBOLS = YES GCC_GENERATE_DEBUGGING_SYMBOLS = YES
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_COMMON) DEBUG=1 GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_COMMON) DEBUG=1
OTHER_SWIFT_FLAGS = $(OTHER_SWIFT_FLAGS_COMMON)
ONLY_ACTIVE_ARCH = YES ONLY_ACTIVE_ARCH = YES
COPY_PHASE_STRIP = NO COPY_PHASE_STRIP = NO
@@ -12,9 +12,7 @@ GCC_OPTIMIZATION_LEVEL = s
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
GCC_GENERATE_DEBUGGING_SYMBOLS = YES GCC_GENERATE_DEBUGGING_SYMBOLS = YES
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_COMMON) DEBUG=0 GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_COMMON) DEBUG=0
OTHER_SWIFT_FLAGS = $(OTHER_SWIFT_FLAGS_COMMON)
DEAD_CODE_STRIPPING = YES DEAD_CODE_STRIPPING = YES
GCC_TREAT_WARNINGS_AS_ERRORS = NO GCC_TREAT_WARNINGS_AS_ERRORS = NO
GCC_WARN_UNINITIALIZED_AUTOS = YES GCC_WARN_UNINITIALIZED_AUTOS = YES
COPY_PHASE_STRIP = NO COPY_PHASE_STRIP = NO
DEPLOYMENT_POSTPROCESSING = YES
+1 -2
View File
@@ -5,5 +5,4 @@ WRAPPER_EXTENSION = xpc
PRODUCT_BUNDLE_IDENTIFIER = ${DOWNLOADER_BUNDLE_ID} PRODUCT_BUNDLE_IDENTIFIER = ${DOWNLOADER_BUNDLE_ID}
PRODUCT_NAME = ${DOWNLOADER_NAME} PRODUCT_NAME = ${DOWNLOADER_NAME}
CODE_SIGN_ENTITLEMENTS = Downloader/${DOWNLOADER_BUNDLE_ID}.entitlements CODE_SIGN_ENTITLEMENTS = Downloader/${DOWNLOADER_BUNDLE_ID}.entitlements
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE_SOURCES_EXTERNALLY=1 GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE_DOWNLOADER_SERVICE=1
CLANG_MODULES_AUTOLINK = NO
@@ -1,4 +0,0 @@
#include "ConfigFramework.xcconfig"
// Strip all non-global symbols (including debug symbols)
STRIP_STYLE = non-global
@@ -4,5 +4,3 @@ INFOPLIST_FILE = InstallerConnection/Info.plist
WRAPPER_EXTENSION = xpc WRAPPER_EXTENSION = xpc
PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_CONNECTION_BUNDLE_ID} PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_CONNECTION_BUNDLE_ID}
PRODUCT_NAME = ${INSTALLER_CONNECTION_NAME} PRODUCT_NAME = ${INSTALLER_CONNECTION_NAME}
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE_SOURCES_EXTERNALLY=1
CLANG_MODULES_AUTOLINK = NO
@@ -4,5 +4,3 @@ INFOPLIST_FILE = InstallerLauncher/Info.plist
WRAPPER_EXTENSION = xpc WRAPPER_EXTENSION = xpc
PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_LAUNCHER_BUNDLE_ID} PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_LAUNCHER_BUNDLE_ID}
PRODUCT_NAME = ${INSTALLER_LAUNCHER_NAME} PRODUCT_NAME = ${INSTALLER_LAUNCHER_NAME}
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE_SOURCES_EXTERNALLY=1
CLANG_MODULES_AUTOLINK = NO
@@ -2,6 +2,6 @@
INFOPLIST_FILE = Sparkle/InstallerProgress/InstallerProgress-Info.plist INFOPLIST_FILE = Sparkle/InstallerProgress/InstallerProgress-Info.plist
PRODUCT_NAME = $(SPARKLE_INSTALLER_PROGRESS_TOOL_NAME) PRODUCT_NAME = $(SPARKLE_INSTALLER_PROGRESS_TOOL_NAME)
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE=0 BUILDING_SPARKLE_SOURCES_EXTERNALLY=1 GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE=0
SKIP_INSTALL = YES SKIP_INSTALL = YES
CLANG_ENABLE_MODULES = NO CLANG_ENABLE_MODULES = NO
@@ -4,5 +4,3 @@ INFOPLIST_FILE = InstallerStatus/Info.plist
WRAPPER_EXTENSION = xpc WRAPPER_EXTENSION = xpc
PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_STATUS_BUNDLE_ID} PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_STATUS_BUNDLE_ID}
PRODUCT_NAME = ${INSTALLER_STATUS_NAME} PRODUCT_NAME = ${INSTALLER_STATUS_NAME}
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE=0 BUILDING_SPARKLE_SOURCES_EXTERNALLY=1
CLANG_MODULES_AUTOLINK = NO
-1
View File
@@ -3,4 +3,3 @@
PRODUCT_NAME = $(SPARKLE_RELAUNCH_TOOL_NAME) PRODUCT_NAME = $(SPARKLE_RELAUNCH_TOOL_NAME)
SKIP_INSTALL = YES SKIP_INSTALL = YES
CLANG_ENABLE_MODULES = NO CLANG_ENABLE_MODULES = NO
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE_SOURCES_EXTERNALLY=1
+1 -1
View File
@@ -11,4 +11,4 @@ FRAMEWORK_SEARCH_PATHS = $(inherited) $(DEVELOPER_FRAMEWORKS_DIR)
LD_RUNPATH_SEARCH_PATHS = @loader_path/../Frameworks LD_RUNPATH_SEARCH_PATHS = @loader_path/../Frameworks
CLANG_ENABLE_MODULES = YES CLANG_ENABLE_MODULES = YES
SWIFT_OBJC_BRIDGING_HEADER = Tests/Sparkle Unit Tests-Bridging-Header.h SWIFT_OBJC_BRIDGING_HEADER = Tests/Sparkle Unit Tests-Bridging-Header.h
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE_TESTS=1 BUILDING_SPARKLE_SOURCES_EXTERNALLY=1 GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE_TESTS=1
-58
View File
@@ -1,58 +0,0 @@
#!/bin/sh
FRAMEWORK_PATH="${TARGET_BUILD_DIR}"/"${FULL_PRODUCT_NAME}"
# Remove any unused XPC Services
removedservices=0
if [[ "$SPARKLE_EMBED_INSTALLER_LAUNCHER_XPC_SERVICE" -eq 0 ]]; then
rm -rf "${FRAMEWORK_PATH}"/"Versions/"${FRAMEWORK_VERSION}"/XPCServices"/"${INSTALLER_LAUNCHER_NAME}.xpc"
removedservices=$((removedservices+1))
fi
if [[ "$SPARKLE_EMBED_DOWNLOADER_XPC_SERVICE" -eq 0 ]]; then
rm -rf "${FRAMEWORK_PATH}"/"Versions/"${FRAMEWORK_VERSION}"/XPCServices"/"${DOWNLOADER_NAME}.xpc"
removedservices=$((removedservices+1))
fi
if [[ "$SPARKLE_EMBED_INSTALLER_STATUS_XPC_SERVICE" -eq 0 ]]; then
rm -rf "${FRAMEWORK_PATH}"/"Versions/"${FRAMEWORK_VERSION}"/XPCServices"/"${INSTALLER_STATUS_NAME}.xpc"
removedservices=$((removedservices+1))
fi
if [[ "$SPARKLE_EMBED_INSTALLER_CONNECTION_XPC_SERVICE" -eq 0 ]]; then
rm -rf "${FRAMEWORK_PATH}"/"Versions/"${FRAMEWORK_VERSION}"/XPCServices"/"${INSTALLER_CONNECTION_NAME}.xpc"
removedservices=$((removedservices+1))
fi
if [[ "$removedservices" -eq 4 ]]; then
rm -rf "${FRAMEWORK_PATH}"/"Versions/"${FRAMEWORK_VERSION}"/XPCServices"
rm -rf "${FRAMEWORK_PATH}"/"XPCServices"
fi
# Remove any unused nibs
if [[ "$SPARKLE_BUILD_UI_BITS" -eq 0 ]]; then
rm -rf "${FRAMEWORK_PATH}"/"Versions/"${FRAMEWORK_VERSION}"/Resources"/"SUStatus.nib"
rm -rf "${FRAMEWORK_PATH}"/"Versions/"${FRAMEWORK_VERSION}"/Resources"/"Base.lproj/SUUpdateAlert.nib"
rm -rf "${FRAMEWORK_PATH}"/"Versions/"${FRAMEWORK_VERSION}"/Resources"/"Base.lproj/SUUpdatePermissionPrompt.nib"
rm -rf "${FRAMEWORK_PATH}"/"Versions/"${FRAMEWORK_VERSION}"/Resources"/"ReleaseNotesColorStyle.css"
fi
# Remove localization files if requested
if [[ "$SPARKLE_COPY_LOCALIZATIONS" -eq 0 ]]; then
for dir in "${FRAMEWORK_PATH}"/"Versions/"${FRAMEWORK_VERSION}"/Resources"/*; do
base=$(basename "$dir")
if [[ "$base" =~ .*".lproj" ]]; then
if [[ "$base" = "Base.lproj" ]]; then
rm -rf "$dir/Sparkle.strings"
# Remove Base.lproj if it's empty and the nibs have been stripped out already
rmdir "$dir"
else
rm -rf "$dir"
fi
fi
done
fi
+30
View File
@@ -0,0 +1,30 @@
#!/bin/sh
FRAMEWORK_PATH="${TARGET_BUILD_DIR}"/"${FULL_PRODUCT_NAME}"
removedservices=0
if [[ "$SPARKLE_EMBED_INSTALLER_LAUNCHER_XPC_SERVICE" -eq 0 ]]; then
rm -rf "${FRAMEWORK_PATH}"/"Versions/"${FRAMEWORK_VERSION}"/XPCServices"/"${INSTALLER_LAUNCHER_NAME}.xpc"
removedservices=$((removedservices+1))
fi
if [[ "$SPARKLE_EMBED_DOWNLOADER_XPC_SERVICE" -eq 0 ]]; then
rm -rf "${FRAMEWORK_PATH}"/"Versions/"${FRAMEWORK_VERSION}"/XPCServices"/"${DOWNLOADER_NAME}.xpc"
removedservices=$((removedservices+1))
fi
if [[ "$SPARKLE_EMBED_INSTALLER_STATUS_XPC_SERVICE" -eq 0 ]]; then
rm -rf "${FRAMEWORK_PATH}"/"Versions/"${FRAMEWORK_VERSION}"/XPCServices"/"${INSTALLER_STATUS_NAME}.xpc"
removedservices=$((removedservices+1))
fi
if [[ "$SPARKLE_EMBED_INSTALLER_CONNECTION_XPC_SERVICE" -eq 0 ]]; then
rm -rf "${FRAMEWORK_PATH}"/"Versions/"${FRAMEWORK_VERSION}"/XPCServices"/"${INSTALLER_CONNECTION_NAME}.xpc"
removedservices=$((removedservices+1))
fi
if [[ "$removedservices" -eq 4 ]]; then
rm -rf "${FRAMEWORK_PATH}"/"Versions/"${FRAMEWORK_VERSION}"/XPCServices"
rm -rf "${FRAMEWORK_PATH}"/"XPCServices"
fi
+2 -8
View File
@@ -36,12 +36,6 @@ Two software components should not directly know about each other. Preferrably t
See `Documentation/graph-of-sparkle.png` for a graph of how the code looks like currently. This was generated via [objc_dep](https://github.com/nst/objc_dep) (great tool). Note that there are no red edges which would mean that two nodes know of each other. See `Documentation/graph-of-sparkle.png` for a graph of how the code looks like currently. This was generated via [objc_dep](https://github.com/nst/objc_dep) (great tool). Note that there are no red edges which would mean that two nodes know of each other.
## Attributes & Code Size ## Attributes
Instance variables and instance variable access should be used for private members (declared in `@implementation` block) whenever possible over properties. Preferring instance variables over properties for internal usage can significantly reduce code size. Instance variables should also be ordered by having the larger sized data members declared first. `nonatomic` should really be used wherever possible with regards to obj-c properties (`atomic` is a bad default). `readonly` should be used wherever possible as well, which also implies that only ivar access should be used in initializers. `NS_ASSUME_NONNULL_BEGIN` and `NS_ASSUME_NONNULL_END` should be used around new headers whenever possible. AppKit prevention guards should be used for any non-UI class whenever possible.
`SPU_OBJC_DIRECT_MEMBERS` should be used for any internal class in Sparkle and `SPU_OBJC_DIRECT` should be used for any other internal methods to Sparkle that doesn't need to utilize the Obj-C runtime to reduce code size. Note these attributes should not be used for *any* class or method that is exported to the developer (this includes private headers / APIs we carefully decided to expose too). For internal methods and classes that are also used by our Swift tools or unit tests, we may not expose them as direct specifically when building for those targets.
`nonatomic` should really be used wherever possible with regards to obj-c properties (`atomic` is a bad default). `readonly` should be used wherever possible as well, which also implies that only ivar access should be used in initializers. `NS_ASSUME_NONNULL_BEGIN` and `NS_ASSUME_NONNULL_END` should be used around new headers whenever possible. AppKit prevention guards should be used for any non-UI class whenever possible.
Sparkle has several feature flags in ConfigCommon.xcconfig (e.g. `SPARKLE_BUILD_LEGACY_SUUPDATER`, `SPARKLE_BUILD_LEGACY_DSA_SUPPORT`, `SPARKLE_BUILD_UI_BITS`, etc). This allows disabling any combination of these features and building Sparkle with a more minimal feature set. These flags (with the exception for stripping UI bits, localizations, or XPC Services) are for disabling features that are legacy or not recommended to use for most applications. Note when altering these flags, `OTHER_SWIFT_FLAGS_COMMON` may need to be updated appropriately too.
+1 -1
View File
@@ -12,7 +12,7 @@
@protocol SPUDownloaderDelegate; @protocol SPUDownloaderDelegate;
// This object implements the protocol which we have defined. It provides the actual behavior for the service. It is 'exported' by the service to make it available to the process hosting the service over an NSXPCConnection. // This object implements the protocol which we have defined. It provides the actual behavior for the service. It is 'exported' by the service to make it available to the process hosting the service over an NSXPCConnection.
SPU_OBJC_DIRECT_MEMBERS @interface SPUDownloader : NSObject <SPUDownloaderProtocol> @interface SPUDownloader : NSObject <SPUDownloaderProtocol>
// Due to XPC remote object reasons, this delegate is strongly referenced // Due to XPC remote object reasons, this delegate is strongly referenced
// Invoke cleanup when done with this instance // Invoke cleanup when done with this instance
+79 -72
View File
@@ -25,24 +25,31 @@ typedef NS_ENUM(NSUInteger, SPUDownloadMode)
static NSString *SUDownloadingReason = @"Downloading update related file"; static NSString *SUDownloadingReason = @"Downloading update related file";
@interface SPUDownloader () <NSURLSessionDownloadDelegate> @interface SPUDownloader () <NSURLSessionDownloadDelegate>
// Delegate is intentionally strongly referenced; see header
@property (nonatomic) id <SPUDownloaderDelegate> delegate;
@property (nonatomic) NSURLSessionDownloadTask *download;
@property (nonatomic) NSURLSession *downloadSession;
@property (nonatomic, copy) NSString *bundleIdentifier;
@property (nonatomic, copy) NSString *desiredFilename;
@property (nonatomic, copy) NSString *downloadFilename;
@property (nonatomic) BOOL disabledAutomaticTermination;
@property (nonatomic) SPUDownloadMode mode;
@property (nonatomic) BOOL receivedExpectedBytes;
@end @end
@implementation SPUDownloader @implementation SPUDownloader
{
NSURLSessionDownloadTask *_download; @synthesize delegate = _delegate;
NSURLSession *_downloadSession; @synthesize download = _download;
NSString *_bundleIdentifier; @synthesize downloadSession = _downloadSession;
NSString *_desiredFilename; @synthesize bundleIdentifier = _bundleIdentifier;
NSString *_downloadFilename; @synthesize desiredFilename = _desiredFilename;
@synthesize downloadFilename = _downloadFilename;
// Delegate is intentionally strongly referenced; see header @synthesize disabledAutomaticTermination = _disabledAutomaticTermination;
id <SPUDownloaderDelegate> _delegate; @synthesize mode = _mode;
@synthesize receivedExpectedBytes = _receivedExpectedBytes;
SPUDownloadMode _mode;
BOOL _disabledAutomaticTermination;
BOOL _receivedExpectedBytes;
}
- (instancetype)initWithDelegate:(id <SPUDownloaderDelegate>)delegate - (instancetype)initWithDelegate:(id <SPUDownloaderDelegate>)delegate
{ {
@@ -53,14 +60,14 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
return self; return self;
} }
- (void)startDownloadWithRequest:(NSURLRequest *)request SPU_OBJC_DIRECT - (void)startDownloadWithRequest:(NSURLRequest *)request
{ {
_downloadSession = [NSURLSession self.downloadSession = [NSURLSession
sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration] sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]
delegate:self delegate:self
delegateQueue:[NSOperationQueue mainQueue]]; delegateQueue:[NSOperationQueue mainQueue]];
_download = [_downloadSession downloadTaskWithRequest:request]; self.download = [self.downloadSession downloadTaskWithRequest:request];
[_download resume]; [self.download resume];
} }
// Don't implement dealloc - make the client call cleanup, which is the only way to remove the reference cycle from the delegate anyway // Don't implement dealloc - make the client call cleanup, which is the only way to remove the reference cycle from the delegate anyway
@@ -68,14 +75,14 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
- (void)startPersistentDownloadWithRequest:(NSURLRequest *)request bundleIdentifier:(NSString *)bundleIdentifier desiredFilename:(NSString *)desiredFilename - (void)startPersistentDownloadWithRequest:(NSURLRequest *)request bundleIdentifier:(NSString *)bundleIdentifier desiredFilename:(NSString *)desiredFilename
{ {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if (self->_download == nil && self->_delegate != nil) { if (self.download == nil && self.delegate != nil) {
// Prevent service from automatically terminating while downloading the update asynchronously without any reply blocks // Prevent service from automatically terminating while downloading the update asynchronously without any reply blocks
[[NSProcessInfo processInfo] disableAutomaticTermination:SUDownloadingReason]; [[NSProcessInfo processInfo] disableAutomaticTermination:SUDownloadingReason];
self->_disabledAutomaticTermination = YES; self.disabledAutomaticTermination = YES;
self->_mode = SPUDownloadModePersistent; self.mode = SPUDownloadModePersistent;
self->_desiredFilename = desiredFilename; self.desiredFilename = desiredFilename;
self->_bundleIdentifier = [bundleIdentifier copy]; self.bundleIdentifier = bundleIdentifier;
[self startDownloadWithRequest:request]; [self startDownloadWithRequest:request];
} }
@@ -85,26 +92,26 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
- (void)startTemporaryDownloadWithRequest:(NSURLRequest *)request - (void)startTemporaryDownloadWithRequest:(NSURLRequest *)request
{ {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if (self->_download == nil && self->_delegate != nil) { if (self.download == nil && self.delegate != nil) {
// Prevent service from automatically terminating while downloading the update asynchronously without any reply blocks // Prevent service from automatically terminating while downloading the update asynchronously without any reply blocks
[[NSProcessInfo processInfo] disableAutomaticTermination:SUDownloadingReason]; [[NSProcessInfo processInfo] disableAutomaticTermination:SUDownloadingReason];
self->_disabledAutomaticTermination = YES; self.disabledAutomaticTermination = YES;
self->_mode = SPUDownloadModeTemporary; self.mode = SPUDownloadModeTemporary;
[self startDownloadWithRequest:request]; [self startDownloadWithRequest:request];
} }
}); });
} }
- (void)enableAutomaticTermination SPU_OBJC_DIRECT - (void)enableAutomaticTermination
{ {
if (_disabledAutomaticTermination) { if (self.disabledAutomaticTermination) {
[[NSProcessInfo processInfo] enableAutomaticTermination:SUDownloadingReason]; [[NSProcessInfo processInfo] enableAutomaticTermination:SUDownloadingReason];
_disabledAutomaticTermination = NO; self.disabledAutomaticTermination = NO;
} }
} }
- (NSString *)rootPersistentDownloadCachePathForBundleIdentifier:(NSString *)bundleIdentifier SPU_OBJC_DIRECT - (NSString *)rootPersistentDownloadCachePathForBundleIdentifier:(NSString *)bundleIdentifier
{ {
return [[SPULocalCacheDirectory cachePathForBundleIdentifier:bundleIdentifier] stringByAppendingPathComponent:@"PersistentDownloads"]; return [[SPULocalCacheDirectory cachePathForBundleIdentifier:bundleIdentifier] stringByAppendingPathComponent:@"PersistentDownloads"];
} }
@@ -126,19 +133,19 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
}); });
} }
- (void)_cleanup SPU_OBJC_DIRECT - (void)_cleanup
{ {
[self enableAutomaticTermination]; [self enableAutomaticTermination];
[_download cancel]; [self.download cancel];
[_downloadSession finishTasksAndInvalidate]; [self.downloadSession finishTasksAndInvalidate];
_download = nil; self.download = nil;
_downloadSession = nil; self.downloadSession = nil;
_delegate = nil; self.delegate = nil;
if (_mode == SPUDownloadModeTemporary && _downloadFilename != nil) if (self.mode == SPUDownloadModeTemporary && self.downloadFilename != nil)
{ {
[[NSFileManager defaultManager] removeItemAtPath:_downloadFilename error:NULL]; [[NSFileManager defaultManager] removeItemAtPath:self.downloadFilename error:NULL];
_downloadFilename = nil; self.downloadFilename = nil;
} }
} }
@@ -158,17 +165,17 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
{ {
NSString *message = [NSString stringWithFormat:@"A network error occurred while downloading %@. %@ (%ld)", downloadTask.originalRequest.URL.absoluteString, [NSHTTPURLResponse localizedStringForStatusCode:statusCode], (long)statusCode]; NSString *message = [NSString stringWithFormat:@"A network error occurred while downloading %@. %@ (%ld)", downloadTask.originalRequest.URL.absoluteString, [NSHTTPURLResponse localizedStringForStatusCode:statusCode], (long)statusCode];
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUDownloadError userInfo:@{ NSLocalizedDescriptionKey: message }]; NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUDownloadError userInfo:@{ NSLocalizedDescriptionKey: message }];
[_delegate downloaderDidFailWithError:error]; [self.delegate downloaderDidFailWithError:error];
} }
else if (_mode == SPUDownloadModeTemporary) else if (self.mode == SPUDownloadModeTemporary)
{ {
_downloadFilename = location.path; self.downloadFilename = location.path;
[self downloadDidFinish]; // file is already in a system temp dir [self downloadDidFinish]; // file is already in a system temp dir
} }
else else
{ {
// Remove our old caches path so we don't start accumulating files in there // Remove our old caches path so we don't start accumulating files in there
NSString *rootPersistentDownloadCachePath = [self rootPersistentDownloadCachePathForBundleIdentifier:_bundleIdentifier]; NSString *rootPersistentDownloadCachePath = [self rootPersistentDownloadCachePathForBundleIdentifier:self.bundleIdentifier];
[SPULocalCacheDirectory removeOldItemsInDirectory:rootPersistentDownloadCachePath]; [SPULocalCacheDirectory removeOldItemsInDirectory:rootPersistentDownloadCachePath];
@@ -176,23 +183,23 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
if (tempDir == nil) if (tempDir == nil)
{ {
// Okay, something's really broken with this user's file structure. // Okay, something's really broken with this user's file structure.
[_download cancel]; [self.download cancel];
_download = nil; self.download = nil;
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUTemporaryDirectoryError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Can't make a temporary directory for the update download at %@.", tempDir] }]; NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUTemporaryDirectoryError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Can't make a temporary directory for the update download at %@.", tempDir] }];
[_delegate downloaderDidFailWithError:error]; [self.delegate downloaderDidFailWithError:error];
} else { } else {
NSString *downloadFileName = _desiredFilename; NSString *downloadFileName = self.desiredFilename;
NSString *downloadFileNameDirectory = [tempDir stringByAppendingPathComponent:downloadFileName]; NSString *downloadFileNameDirectory = [tempDir stringByAppendingPathComponent:downloadFileName];
NSError *createError = nil; NSError *createError = nil;
if (![[NSFileManager defaultManager] createDirectoryAtPath:downloadFileNameDirectory withIntermediateDirectories:NO attributes:nil error:&createError]) { if (![[NSFileManager defaultManager] createDirectoryAtPath:downloadFileNameDirectory withIntermediateDirectories:NO attributes:nil error:&createError]) {
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUTemporaryDirectoryError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Can't make a download file name %@ directory inside temporary directory for the update download at %@.", downloadFileName, downloadFileNameDirectory] }]; NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUTemporaryDirectoryError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Can't make a download file name %@ directory inside temporary directory for the update download at %@.", downloadFileName, downloadFileNameDirectory] }];
[_delegate downloaderDidFailWithError:error]; [self.delegate downloaderDidFailWithError:error];
} else { } else {
NSString *name = _download.response.suggestedFilename; NSString *name = self.download.response.suggestedFilename;
if (!name) { if (!name) {
name = location.lastPathComponent; // This likely contains nothing useful to identify the file (e.g. CFNetworkDownload_87LVIz.tmp) name = location.lastPathComponent; // This likely contains nothing useful to identify the file (e.g. CFNetworkDownload_87LVIz.tmp)
} }
@@ -200,11 +207,11 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
NSString *fromPath = location.path; // suppress moveItemAtPath: non-null warning NSString *fromPath = location.path; // suppress moveItemAtPath: non-null warning
NSError *error = nil; NSError *error = nil;
if ([[NSFileManager defaultManager] moveItemAtPath:fromPath toPath:toPath error:&error]) { if ([[NSFileManager defaultManager] moveItemAtPath:fromPath toPath:toPath error:&error]) {
_downloadFilename = toPath; self.downloadFilename = toPath;
[_delegate downloaderDidSetDestinationName:name temporaryDirectory:downloadFileNameDirectory]; [self.delegate downloaderDidSetDestinationName:name temporaryDirectory:downloadFileNameDirectory];
[self downloadDidFinish]; [self downloadDidFinish];
} else { } else {
[_delegate downloaderDidFailWithError:error]; [self.delegate downloaderDidFailWithError:error];
} }
} }
} }
@@ -214,33 +221,33 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
- (void)URLSession:(NSURLSession *)__unused session downloadTask:(NSURLSessionDownloadTask *)__unused downloadTask didWriteData:(int64_t)bytesWritten totalBytesWritten:(int64_t)__unused totalBytesWritten totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite - (void)URLSession:(NSURLSession *)__unused session downloadTask:(NSURLSessionDownloadTask *)__unused downloadTask didWriteData:(int64_t)bytesWritten totalBytesWritten:(int64_t)__unused totalBytesWritten totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite
{ {
if (_mode == SPUDownloadModePersistent && totalBytesExpectedToWrite > 0 && !_receivedExpectedBytes) { if (self.mode == SPUDownloadModePersistent && totalBytesExpectedToWrite > 0 && !self.receivedExpectedBytes) {
_receivedExpectedBytes = YES; self.receivedExpectedBytes = YES;
[_delegate downloaderDidReceiveExpectedContentLength:totalBytesExpectedToWrite]; [self.delegate downloaderDidReceiveExpectedContentLength:totalBytesExpectedToWrite];
} }
if (_mode == SPUDownloadModePersistent && bytesWritten >= 0) { if (self.mode == SPUDownloadModePersistent && bytesWritten >= 0) {
[_delegate downloaderDidReceiveDataOfLength:(uint64_t)bytesWritten]; [self.delegate downloaderDidReceiveDataOfLength:(uint64_t)bytesWritten];
} }
} }
- (void)downloadDidFinish SPU_OBJC_DIRECT - (void)downloadDidFinish
{ {
assert(_downloadFilename != nil); assert(self.downloadFilename != nil);
SPUDownloadData *downloadData = nil; SPUDownloadData *downloadData = nil;
if (_mode == SPUDownloadModeTemporary) { if (self.mode == SPUDownloadModeTemporary) {
NSData *data = [NSData dataWithContentsOfFile:_downloadFilename]; NSData *data = [NSData dataWithContentsOfFile:self.downloadFilename];
if (data != nil) { if (data != nil) {
NSURLResponse *response = _download.response; NSURLResponse *response = self.download.response;
assert(response != nil); assert(response != nil);
NSURL *responseURL = response.URL; NSURL *responseURL = response.URL;
if (responseURL == nil) { if (responseURL == nil) {
responseURL = _download.currentRequest.URL; responseURL = self.download.currentRequest.URL;
} }
if (responseURL == nil) { if (responseURL == nil) {
responseURL = _download.originalRequest.URL; responseURL = self.download.originalRequest.URL;
} }
assert(responseURL != nil); assert(responseURL != nil);
@@ -248,29 +255,29 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
} }
} }
_download = nil; self.download = nil;
switch (_mode) { switch (self.mode) {
case SPUDownloadModeTemporary: case SPUDownloadModeTemporary:
if (downloadData != nil) { if (downloadData != nil) {
[_delegate downloaderDidFinishWithTemporaryDownloadData:downloadData]; [self.delegate downloaderDidFinishWithTemporaryDownloadData:downloadData];
} else { } else {
[_delegate downloaderDidFailWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUDownloadError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to read temporary downloaded data from %@", _downloadFilename]}]]; [self.delegate downloaderDidFailWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUDownloadError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to read temporary downloaded data from %@", self.downloadFilename]}]];
} }
[self _cleanup]; [self _cleanup];
break; break;
case SPUDownloadModePersistent: case SPUDownloadModePersistent:
[_delegate downloaderDidFinishWithTemporaryDownloadData:nil]; [self.delegate downloaderDidFinishWithTemporaryDownloadData:nil];
break; break;
} }
} }
- (void)URLSession:(NSURLSession *)__unused session task:(NSURLSessionTask *)__unused task didCompleteWithError:(NSError *)error - (void)URLSession:(NSURLSession *)__unused session task:(NSURLSessionTask *)__unused task didCompleteWithError:(NSError *)error
{ {
_download = nil; self.download = nil;
if (error != nil) { if (error != nil) {
[_delegate downloaderDidFailWithError:error]; [self.delegate downloaderDidFailWithError:error];
} }
} }
+1 -1
View File
@@ -12,7 +12,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
// This object implements the protocol which we have defined. It provides the actual behavior for the service. It is 'exported' by the service to make it available to the process hosting the service over an NSXPCConnection. // This object implements the protocol which we have defined. It provides the actual behavior for the service. It is 'exported' by the service to make it available to the process hosting the service over an NSXPCConnection.
SPU_OBJC_DIRECT_MEMBERS @interface SUInstallerConnection : NSObject <SUInstallerConnectionProtocol> @interface SUInstallerConnection : NSObject <SUInstallerConnectionProtocol>
// Due to XPC reasons, this delegate is strongly referenced, until it's invalidated // Due to XPC reasons, this delegate is strongly referenced, until it's invalidated
- (instancetype)initWithDelegate:(id<SUInstallerCommunicationProtocol>)delegate remote:(BOOL)remote; - (instancetype)initWithDelegate:(id<SUInstallerCommunicationProtocol>)delegate remote:(BOOL)remote;
+37 -34
View File
@@ -14,20 +14,26 @@
static NSString *SUInstallerConnectionKeepAliveReason = @"Installer Connection Keep Alive"; static NSString *SUInstallerConnectionKeepAliveReason = @"Installer Connection Keep Alive";
@interface SUInstallerConnection () <SUInstallerCommunicationProtocol> @interface SUInstallerConnection () <SUInstallerCommunicationProtocol>
// Intentionally not weak for XPC reasons
@property (nonatomic) id<SUInstallerCommunicationProtocol> delegate;
@property (nonatomic) BOOL disabledAutomaticTermination;
@property (nonatomic, copy) void (^invalidationBlock)(void);
@property (nonatomic) NSXPCConnection *connection;
@end @end
@implementation SUInstallerConnection @implementation SUInstallerConnection
{ {
NSXPCConnection *_connection;
// Intentionally not weak for XPC reasons
id<SUInstallerCommunicationProtocol> _delegate;
void (^_invalidationBlock)(void);
BOOL _disabledAutomaticTermination;
BOOL _remote; BOOL _remote;
} }
@synthesize delegate = _delegate;
@synthesize disabledAutomaticTermination = _disabledAutomaticTermination;
@synthesize invalidationBlock = _invalidationBlock;
@synthesize connection = _connection;
- (instancetype)initWithDelegate:(id<SUInstallerCommunicationProtocol>)delegate remote:(BOOL)remote - (instancetype)initWithDelegate:(id<SUInstallerCommunicationProtocol>)delegate remote:(BOOL)remote
{ {
self = [super init]; self = [super init];
@@ -44,17 +50,17 @@ static NSString *SUInstallerConnectionKeepAliveReason = @"Installer Connection K
return self; return self;
} }
- (void)enableAutomaticTermination SPU_OBJC_DIRECT - (void)enableAutomaticTermination
{ {
if (_disabledAutomaticTermination) { if (self.disabledAutomaticTermination) {
[[NSProcessInfo processInfo] enableAutomaticTermination:SUInstallerConnectionKeepAliveReason]; [[NSProcessInfo processInfo] enableAutomaticTermination:SUInstallerConnectionKeepAliveReason];
_disabledAutomaticTermination = NO; self.disabledAutomaticTermination = NO;
} }
} }
- (void)_setInvalidationHandler:(void (^)(void))invalidationHandler SPU_OBJC_DIRECT - (void)_setInvalidationHandler:(void (^)(void))invalidationHandler
{ {
_invalidationBlock = [invalidationHandler copy]; self.invalidationBlock = invalidationHandler;
// No longer needed because of invalidation callback // No longer needed because of invalidation callback
[self enableAutomaticTermination]; [self enableAutomaticTermination];
@@ -71,39 +77,36 @@ static NSString *SUInstallerConnectionKeepAliveReason = @"Installer Connection K
} }
} }
- (void)_setServiceName:(NSString *)serviceName systemDomain:(BOOL)systemDomain SPU_OBJC_DIRECT - (void)_setServiceName:(NSString *)serviceName systemDomain:(BOOL)systemDomain
{ {
NSXPCConnectionOptions options = systemDomain ? NSXPCConnectionPrivileged : 0; NSXPCConnectionOptions options = systemDomain ? NSXPCConnectionPrivileged : 0;
NSXPCConnection *connection = [[NSXPCConnection alloc] initWithMachServiceName:serviceName options:options]; NSXPCConnection *connection = [[NSXPCConnection alloc] initWithMachServiceName:serviceName options:options];
connection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)]; connection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)];
connection.exportedObject = _delegate; connection.exportedObject = self.delegate;
connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)]; connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)];
_connection = connection; self.connection = connection;
__weak __typeof__(self) weakSelf = self; __weak SUInstallerConnection *weakSelf = self;
_connection.interruptionHandler = ^{ self.connection.interruptionHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
__typeof__(self) strongSelf = weakSelf; [weakSelf.connection invalidate];
if (strongSelf != nil) {
[strongSelf->_connection invalidate];
}
}); });
}; };
_connection.invalidationHandler = ^{ self.connection.invalidationHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
__typeof__(self) strongSelf = weakSelf; SUInstallerConnection *strongSelf = weakSelf;
if (strongSelf != nil) { if (strongSelf != nil) {
strongSelf->_connection = nil; strongSelf.connection = nil;
[strongSelf _invalidate]; [strongSelf _invalidate];
} }
}); });
}; };
[_connection resume]; [self.connection resume];
} }
- (void)setServiceName:(NSString *)serviceName systemDomain:(BOOL)systemDomain - (void)setServiceName:(NSString *)serviceName systemDomain:(BOOL)systemDomain
@@ -121,22 +124,22 @@ static NSString *SUInstallerConnectionKeepAliveReason = @"Installer Connection K
{ {
if (_remote) { if (_remote) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[(id<SUInstallerCommunicationProtocol>)self->_connection.remoteObjectProxy handleMessageWithIdentifier:identifier data:data]; [(id<SUInstallerCommunicationProtocol>)self.connection.remoteObjectProxy handleMessageWithIdentifier:identifier data:data];
}); });
} else { } else {
[(id<SUInstallerCommunicationProtocol>)_connection.remoteObjectProxy handleMessageWithIdentifier:identifier data:data]; [(id<SUInstallerCommunicationProtocol>)self.connection.remoteObjectProxy handleMessageWithIdentifier:identifier data:data];
} }
} }
- (void)_invalidate SPU_OBJC_DIRECT - (void)_invalidate
{ {
if (_invalidationBlock != nil) { if (self.invalidationBlock != nil) {
_invalidationBlock(); self.invalidationBlock();
_invalidationBlock = nil; self.invalidationBlock = nil;
} }
// Break the retain cycle // Break the retain cycle
_delegate = nil; self.delegate = nil;
[self enableAutomaticTermination]; [self enableAutomaticTermination];
} }
@@ -145,8 +148,8 @@ static NSString *SUInstallerConnectionKeepAliveReason = @"Installer Connection K
- (void)invalidate - (void)invalidate
{ {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self->_connection invalidate]; [self.connection invalidate];
self->_connection = nil; self.connection = nil;
[self _invalidate]; [self _invalidate];
}); });
@@ -6,14 +6,12 @@
// Copyright © 2016 Sparkle Project. All rights reserved. // Copyright © 2016 Sparkle Project. All rights reserved.
// //
#if INSTALLER_CONNECTION_XPC_SERVICE_EMBEDDED
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "SUInstallerConnectionProtocol.h" #import "SUInstallerConnectionProtocol.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
SPU_OBJC_DIRECT_MEMBERS @interface SUXPCInstallerConnection : NSObject <SUInstallerConnectionProtocol> @interface SUXPCInstallerConnection : NSObject <SUInstallerConnectionProtocol>
// Due to XPC reasons, this delegate is strongly referenced, until it's invalidated // Due to XPC reasons, this delegate is strongly referenced, until it's invalidated
- (instancetype)initWithDelegate:(id<SUInstallerCommunicationProtocol>)delegate; - (instancetype)initWithDelegate:(id<SUInstallerCommunicationProtocol>)delegate;
@@ -21,5 +19,3 @@ SPU_OBJC_DIRECT_MEMBERS @interface SUXPCInstallerConnection : NSObject <SUInstal
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
#endif
+28 -30
View File
@@ -6,21 +6,24 @@
// Copyright © 2016 Sparkle Project. All rights reserved. // Copyright © 2016 Sparkle Project. All rights reserved.
// //
#if INSTALLER_CONNECTION_XPC_SERVICE_EMBEDDED
#import "SUXPCInstallerConnection.h" #import "SUXPCInstallerConnection.h"
#include "AppKitPrevention.h" #include "AppKitPrevention.h"
@interface SUXPCInstallerConnection ()
@property (nonatomic) NSXPCConnection *connection;
@property (nonatomic) id<SUInstallerCommunicationProtocol> delegate; // intentionally not weak for XPC reasons
@property (nonatomic, copy) void (^invalidationBlock)(void);
@end
@implementation SUXPCInstallerConnection @implementation SUXPCInstallerConnection
{
NSXPCConnection *_connection; @synthesize connection = _connection;
// Intentionally not weak for XPC reasons @synthesize delegate = _delegate;
id<SUInstallerCommunicationProtocol> _delegate; @synthesize invalidationBlock = _invalidationBlock;
void (^_invalidationBlock)(void);
}
- (instancetype)initWithDelegate:(id<SUInstallerCommunicationProtocol>)delegate - (instancetype)initWithDelegate:(id<SUInstallerCommunicationProtocol>)delegate
{ {
@@ -29,17 +32,14 @@
_connection = [[NSXPCConnection alloc] initWithServiceName:@INSTALLER_CONNECTION_BUNDLE_ID]; _connection = [[NSXPCConnection alloc] initWithServiceName:@INSTALLER_CONNECTION_BUNDLE_ID];
_connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerConnectionProtocol)]; _connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerConnectionProtocol)];
__weak __typeof__(self) weakSelf = self; __weak SUXPCInstallerConnection *weakSelf = self;
_connection.invalidationHandler = ^{ _connection.invalidationHandler = ^{
[weakSelf invokeInvalidation]; [weakSelf invokeInvalidation];
}; };
_connection.interruptionHandler = ^{ _connection.interruptionHandler = ^{
__typeof__(self) strongSelf = weakSelf; [weakSelf invokeInvalidation];
if (strongSelf != nil) { [weakSelf.connection invalidate];
[strongSelf invokeInvalidation];
[strongSelf->_connection invalidate];
}
}; };
_delegate = delegate; _delegate = delegate;
@@ -54,41 +54,39 @@
- (void)setInvalidationHandler:(void (^)(void))invalidationHandler - (void)setInvalidationHandler:(void (^)(void))invalidationHandler
{ {
_invalidationBlock = [invalidationHandler copy]; self.invalidationBlock = invalidationHandler;
__weak __typeof__(self) weakSelf = self; __weak SUXPCInstallerConnection *weakSelf = self;
[(id<SUInstallerConnectionProtocol>)_connection.remoteObjectProxy setInvalidationHandler:^{ [(id<SUInstallerConnectionProtocol>)self.connection.remoteObjectProxy setInvalidationHandler:^{
[weakSelf invokeInvalidation]; [weakSelf invokeInvalidation];
}]; }];
} }
- (void)setServiceName:(NSString *)serviceName systemDomain:(BOOL)systemDomain - (void)setServiceName:(NSString *)serviceName systemDomain:(BOOL)systemDomain
{ {
[(id<SUInstallerConnectionProtocol>)_connection.remoteObjectProxy setServiceName:serviceName systemDomain:systemDomain]; [(id<SUInstallerConnectionProtocol>)self.connection.remoteObjectProxy setServiceName:serviceName systemDomain:systemDomain];
} }
- (void)handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data - (void)handleMessageWithIdentifier:(int32_t)identifier data:(NSData *)data
{ {
[(id<SUInstallerConnectionProtocol>)_connection.remoteObjectProxy handleMessageWithIdentifier:identifier data:data]; [(id<SUInstallerConnectionProtocol>)self.connection.remoteObjectProxy handleMessageWithIdentifier:identifier data:data];
} }
- (void)invalidate - (void)invalidate
{ {
[(id<SUInstallerConnectionProtocol>)_connection.remoteObjectProxy invalidate]; [(id<SUInstallerConnectionProtocol>)self.connection.remoteObjectProxy invalidate];
[_connection invalidate]; [self.connection invalidate];
_connection = nil; self.connection = nil;
} }
- (void)invokeInvalidation SPU_OBJC_DIRECT - (void)invokeInvalidation
{ {
if (_invalidationBlock != nil) { if (self.invalidationBlock != nil) {
_invalidationBlock(); self.invalidationBlock();
_invalidationBlock = nil; self.invalidationBlock = nil;
} }
// Break our retain cycle // Break our retain cycle
_delegate = nil; self.delegate = nil;
} }
@end @end
#endif
@@ -9,18 +9,10 @@
#ifndef SUInstallerLauncher_Private_h #ifndef SUInstallerLauncher_Private_h
#define SUInstallerLauncher_Private_h #define SUInstallerLauncher_Private_h
#if defined(BUILDING_SPARKLE_SOURCES_EXTERNALLY)
// Ignore incorrect warning
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
#import "SUExport.h"
#import "SPUInstallationType.h"
#pragma clang diagnostic pop
#else
#import <Sparkle/SUExport.h> #import <Sparkle/SUExport.h>
// Chances are clients will need this too // Chances are clients will need this too
#import <Sparkle/SPUInstallationType.h> #import <Sparkle/SPUInstallationType.h>
#endif
@class NSString; @class NSString;
+10 -22
View File
@@ -25,7 +25,7 @@
@implementation SUInstallerLauncher @implementation SUInstallerLauncher
- (BOOL)submitProgressToolAtPath:(NSString *)progressToolPath withHostBundle:(NSBundle *)hostBundle inSystemDomainForInstaller:(BOOL)inSystemDomainForInstaller SPU_OBJC_DIRECT - (BOOL)submitProgressToolAtPath:(NSString *)progressToolPath withHostBundle:(NSBundle *)hostBundle inSystemDomainForInstaller:(BOOL)inSystemDomainForInstaller
{ {
SUFileManager *fileManager = [[SUFileManager alloc] init]; SUFileManager *fileManager = [[SUFileManager alloc] init];
@@ -106,7 +106,7 @@
return (submittedJob == true); return (submittedJob == true);
} }
- (SUInstallerLauncherStatus)submitInstallerAtPath:(NSString *)installerPath withHostBundle:(NSBundle *)hostBundle updaterIdentifier:(NSString *)updaterIdentifier userName:(NSString *)userName homeDirectory:(NSString *)homeDirectory authorizationPrompt:(NSString *)authorizationPrompt inSystemDomain:(BOOL)systemDomain rootUser:(BOOL)rootUser SPU_OBJC_DIRECT - (SUInstallerLauncherStatus)submitInstallerAtPath:(NSString *)installerPath withHostBundle:(NSBundle *)hostBundle updaterIdentifier:(NSString *)updaterIdentifier userName:(NSString *)userName homeDirectory:(NSString *)homeDirectory authorizationPrompt:(NSString *)authorizationPrompt inSystemDomain:(BOOL)systemDomain rootUser:(BOOL)rootUser
{ {
SUFileManager *fileManager = [[SUFileManager alloc] init]; SUFileManager *fileManager = [[SUFileManager alloc] init];
@@ -211,13 +211,12 @@
if (@available(macOS 11, *)) { if (@available(macOS 11, *)) {
CFStringRef uti = (__bridge CFStringRef)[UTTypePNG identifier]; CFStringRef uti = (__bridge CFStringRef)[UTTypePNG identifier];
imageDestination = CGImageDestinationCreateWithURL((CFURLRef)tempIconDestinationURL, uti, 1, NULL); imageDestination = CGImageDestinationCreateWithURL((CFURLRef)tempIconDestinationURL, uti, 1, NULL);
} } else {
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_VERSION_11_0 #pragma clang diagnostic push
else #pragma clang diagnostic ignored "-Wdeprecated-declarations"
{
imageDestination = CGImageDestinationCreateWithURL((CFURLRef)tempIconDestinationURL, kUTTypePNG, 1, NULL); imageDestination = CGImageDestinationCreateWithURL((CFURLRef)tempIconDestinationURL, kUTTypePNG, 1, NULL);
#pragma clang diagnostic pop
} }
#endif
if (imageDestination != NULL) { if (imageDestination != NULL) {
CGImageDestinationAddImageFromSource(imageDestination, imageSource, imageIndex, (CFDictionaryRef)@{}); CGImageDestinationAddImageFromSource(imageDestination, imageSource, imageIndex, (CFDictionaryRef)@{});
if (CGImageDestinationFinalize(imageDestination)) { if (CGImageDestinationFinalize(imageDestination)) {
@@ -311,7 +310,7 @@
return status; return status;
} }
- (NSString *)pathForBundledTool:(NSString *)toolName extension:(NSString *)extension fromBundle:(NSBundle *)bundle SPU_OBJC_DIRECT - (NSString *)pathForBundledTool:(NSString *)toolName extension:(NSString *)extension fromBundle:(NSBundle *)bundle
{ {
// If the path extension is empty, we don't want to add a "." at the end // If the path extension is empty, we don't want to add a "." at the end
NSString *nameWithExtension = (extension.length > 0) ? [toolName stringByAppendingPathExtension:extension] : toolName; NSString *nameWithExtension = (extension.length > 0) ? [toolName stringByAppendingPathExtension:extension] : toolName;
@@ -371,21 +370,14 @@ BOOL SPUSystemNeedsAuthorizationAccessForBundlePath(NSString *bundlePath)
return needsAuthorization; return needsAuthorization;
} }
static BOOL SPUUsesSystemDomainForBundlePath(NSString *path, BOOL rootUser static BOOL SPUUsesSystemDomainForBundlePath(NSString *path, NSString *installationType, BOOL rootUser)
#if SPARKLE_BUILD_PACKAGE_SUPPORT
, NSString *installationType
#endif
)
{ {
if (!rootUser) { if (!rootUser) {
#if SPARKLE_BUILD_PACKAGE_SUPPORT
if ([installationType isEqualToString:SPUInstallationTypeGuidedPackage]) { if ([installationType isEqualToString:SPUInstallationTypeGuidedPackage]) {
return YES; return YES;
} else if ([installationType isEqualToString:SPUInstallationTypeInteractivePackage]) { } else if ([installationType isEqualToString:SPUInstallationTypeInteractivePackage]) {
return NO; return NO;
} else } else {
#endif
{
return SPUSystemNeedsAuthorizationAccessForBundlePath(path); return SPUSystemNeedsAuthorizationAccessForBundlePath(path);
} }
} else { } else {
@@ -404,11 +396,7 @@ static BOOL SPUUsesSystemDomainForBundlePath(NSString *path, BOOL rootUser
// and that is not necessarily related to a preflight test. It's more related to being ran under a root / different user from the active GUI session // and that is not necessarily related to a preflight test. It's more related to being ran under a root / different user from the active GUI session
BOOL rootUser = (geteuid() == 0); BOOL rootUser = (geteuid() == 0);
BOOL inSystemDomain = SPUUsesSystemDomainForBundlePath(hostBundlePath, rootUser BOOL inSystemDomain = SPUUsesSystemDomainForBundlePath(hostBundlePath, installationType, rootUser);
#if SPARKLE_BUILD_PACKAGE_SUPPORT
, installationType
#endif
);
NSBundle *hostBundle = [NSBundle bundleWithPath:hostBundlePath]; NSBundle *hostBundle = [NSBundle bundleWithPath:hostBundlePath];
if (hostBundle == nil) { if (hostBundle == nil) {
+1 -1
View File
@@ -10,7 +10,7 @@
#import "SUInstallerStatusProtocol.h" #import "SUInstallerStatusProtocol.h"
// This object implements the protocol which we have defined. It provides the actual behavior for the service. It is 'exported' by the service to make it available to the process hosting the service over an NSXPCConnection. // This object implements the protocol which we have defined. It provides the actual behavior for the service. It is 'exported' by the service to make it available to the process hosting the service over an NSXPCConnection.
SPU_OBJC_DIRECT_MEMBERS @interface SUInstallerStatus : NSObject <SUInstallerStatusProtocol> @interface SUInstallerStatus : NSObject <SUInstallerStatusProtocol>
- (instancetype)initWithRemote:(BOOL)remote; - (instancetype)initWithRemote:(BOOL)remote;
+31 -28
View File
@@ -11,15 +11,21 @@
#include "AppKitPrevention.h" #include "AppKitPrevention.h"
@interface SUInstallerStatus ()
@property (nonatomic, copy) void (^invalidationBlock)(void);
@property (nonatomic) NSXPCConnection *connection;
@end
@implementation SUInstallerStatus @implementation SUInstallerStatus
{ {
NSXPCConnection *_connection;
void (^_invalidationBlock)(void);
BOOL _remote; BOOL _remote;
} }
@synthesize invalidationBlock = _invalidationBlock;
@synthesize connection = _connection;
- (instancetype)initWithRemote:(BOOL)remote - (instancetype)initWithRemote:(BOOL)remote
{ {
self = [super init]; self = [super init];
@@ -33,42 +39,39 @@
{ {
if (_remote) { if (_remote) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
self->_invalidationBlock = [invalidationHandler copy]; self.invalidationBlock = invalidationHandler;
}); });
} else { } else {
_invalidationBlock = [invalidationHandler copy]; self.invalidationBlock = invalidationHandler;
} }
} }
- (void)_setServiceName:(NSString *)serviceName SPU_OBJC_DIRECT - (void)_setServiceName:(NSString *)serviceName
{ {
NSXPCConnection *connection = [[NSXPCConnection alloc] initWithMachServiceName:serviceName options:(NSXPCConnectionOptions)0]; NSXPCConnection *connection = [[NSXPCConnection alloc] initWithMachServiceName:serviceName options:(NSXPCConnectionOptions)0];
connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUStatusInfoProtocol)]; connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUStatusInfoProtocol)];
_connection = connection; self.connection = connection;
__weak __typeof__(self) weakSelf = self; __weak SUInstallerStatus *weakSelf = self;
_connection.interruptionHandler = ^{ self.connection.interruptionHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
__typeof__(self) strongSelf = weakSelf; [weakSelf.connection invalidate];
if (strongSelf != nil) {
[strongSelf->_connection invalidate];
}
}); });
}; };
_connection.invalidationHandler = ^{ self.connection.invalidationHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
__typeof__(self) strongSelf = weakSelf; SUInstallerStatus *strongSelf = weakSelf;
if (strongSelf != nil) { if (strongSelf != nil) {
strongSelf->_connection = nil; strongSelf.connection = nil;
[strongSelf _invokeInvalidationBlock]; [strongSelf _invokeInvalidationBlock];
} }
}); });
}; };
[_connection resume]; [self.connection resume];
} }
- (void)setServiceName:(NSString *)serviceName - (void)setServiceName:(NSString *)serviceName
@@ -86,10 +89,10 @@
{ {
if (_remote) { if (_remote) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[(id<SUStatusInfoProtocol>)self->_connection.remoteObjectProxy probeStatusInfoWithReply:reply]; [(id<SUStatusInfoProtocol>)self.connection.remoteObjectProxy probeStatusInfoWithReply:reply];
}); });
} else { } else {
[(id<SUStatusInfoProtocol>)_connection.remoteObjectProxy probeStatusInfoWithReply:reply]; [(id<SUStatusInfoProtocol>)self.connection.remoteObjectProxy probeStatusInfoWithReply:reply];
} }
} }
@@ -97,18 +100,18 @@
{ {
if (_remote) { if (_remote) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[(id<SUStatusInfoProtocol>)self->_connection.remoteObjectProxy probeStatusConnectivityWithReply:reply]; [(id<SUStatusInfoProtocol>)self.connection.remoteObjectProxy probeStatusConnectivityWithReply:reply];
}); });
} else { } else {
[(id<SUStatusInfoProtocol>)_connection.remoteObjectProxy probeStatusConnectivityWithReply:reply]; [(id<SUStatusInfoProtocol>)self.connection.remoteObjectProxy probeStatusConnectivityWithReply:reply];
} }
} }
- (void)_invokeInvalidationBlock SPU_OBJC_DIRECT - (void)_invokeInvalidationBlock
{ {
if (_invalidationBlock != nil) { if (self.invalidationBlock != nil) {
_invalidationBlock(); self.invalidationBlock();
_invalidationBlock = nil; self.invalidationBlock = nil;
} }
} }
@@ -116,8 +119,8 @@
- (void)invalidate - (void)invalidate
{ {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self->_connection invalidate]; [self.connection invalidate];
self->_connection = nil; self.connection = nil;
[self _invokeInvalidationBlock]; [self _invokeInvalidationBlock];
}); });
-4
View File
@@ -6,13 +6,9 @@
// Copyright © 2016 Sparkle Project. All rights reserved. // Copyright © 2016 Sparkle Project. All rights reserved.
// //
#if INSTALLER_STATUS_XPC_SERVICE_EMBEDDED
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "SUInstallerStatusProtocol.h" #import "SUInstallerStatusProtocol.h"
@interface SUXPCInstallerStatus : NSObject <SUInstallerStatusProtocol> @interface SUXPCInstallerStatus : NSObject <SUInstallerStatusProtocol>
@end @end
#endif
+25 -27
View File
@@ -6,19 +6,22 @@
// Copyright © 2016 Sparkle Project. All rights reserved. // Copyright © 2016 Sparkle Project. All rights reserved.
// //
#if INSTALLER_STATUS_XPC_SERVICE_EMBEDDED
#import "SUXPCInstallerStatus.h" #import "SUXPCInstallerStatus.h"
#include "AppKitPrevention.h" #include "AppKitPrevention.h"
@interface SUXPCInstallerStatus ()
@property (nonatomic) NSXPCConnection *connection;
@property (nonatomic, copy) void (^invalidationBlock)(void);
@end
@implementation SUXPCInstallerStatus @implementation SUXPCInstallerStatus
{
NSXPCConnection *_connection; @synthesize connection = _connection;
@synthesize invalidationBlock = _invalidationBlock;
void (^_invalidationBlock)(void);
}
- (instancetype)init - (instancetype)init
{ {
@@ -27,17 +30,14 @@
_connection = [[NSXPCConnection alloc] initWithServiceName:@INSTALLER_STATUS_BUNDLE_ID]; _connection = [[NSXPCConnection alloc] initWithServiceName:@INSTALLER_STATUS_BUNDLE_ID];
_connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerStatusProtocol)]; _connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerStatusProtocol)];
__weak __typeof__(self) weakSelf = self; __weak SUXPCInstallerStatus *weakSelf = self;
_connection.invalidationHandler = ^{ _connection.invalidationHandler = ^{
[weakSelf invokeInvalidation]; [weakSelf invokeInvalidation];
}; };
_connection.interruptionHandler = ^{ _connection.interruptionHandler = ^{
__typeof__(self) strongSelf = weakSelf; [weakSelf invokeInvalidation];
if (strongSelf != nil) { [weakSelf.connection invalidate];
[strongSelf invokeInvalidation];
[strongSelf->_connection invalidate];
}
}; };
[_connection resume]; [_connection resume];
@@ -47,44 +47,42 @@
- (void)setInvalidationHandler:(void (^)(void))invalidationHandler - (void)setInvalidationHandler:(void (^)(void))invalidationHandler
{ {
_invalidationBlock = [invalidationHandler copy]; self.invalidationBlock = invalidationHandler;
__weak __typeof__(self) weakSelf = self; __weak SUXPCInstallerStatus *weakSelf = self;
[(id<SUInstallerStatusProtocol>)_connection.remoteObjectProxy setInvalidationHandler:^{ [(id<SUInstallerStatusProtocol>)self.connection.remoteObjectProxy setInvalidationHandler:^{
[weakSelf invokeInvalidation]; [weakSelf invokeInvalidation];
}]; }];
} }
- (void)setServiceName:(NSString *)serviceName - (void)setServiceName:(NSString *)serviceName
{ {
[(id<SUInstallerStatusProtocol>)_connection.remoteObjectProxy setServiceName:serviceName]; [(id<SUInstallerStatusProtocol>)self.connection.remoteObjectProxy setServiceName:serviceName];
} }
- (void)probeStatusInfoWithReply:(void (^)(NSData * _Nullable installationInfoData))reply - (void)probeStatusInfoWithReply:(void (^)(NSData * _Nullable installationInfoData))reply
{ {
[(id<SUInstallerStatusProtocol>)_connection.remoteObjectProxy probeStatusInfoWithReply:reply]; [(id<SUInstallerStatusProtocol>)self.connection.remoteObjectProxy probeStatusInfoWithReply:reply];
} }
- (void)probeStatusConnectivityWithReply:(void (^)(void))reply - (void)probeStatusConnectivityWithReply:(void (^)(void))reply
{ {
[(id<SUInstallerStatusProtocol>)_connection.remoteObjectProxy probeStatusConnectivityWithReply:reply]; [(id<SUInstallerStatusProtocol>)self.connection.remoteObjectProxy probeStatusConnectivityWithReply:reply];
} }
- (void)invalidate - (void)invalidate
{ {
[(id<SUInstallerStatusProtocol>)_connection.remoteObjectProxy invalidate]; [(id<SUInstallerStatusProtocol>)self.connection.remoteObjectProxy invalidate];
[_connection invalidate]; [self.connection invalidate];
_connection = nil; self.connection = nil;
} }
- (void)invokeInvalidation - (void)invokeInvalidation
{ {
if (_invalidationBlock != nil) { if (self.invalidationBlock != nil) {
_invalidationBlock(); self.invalidationBlock();
_invalidationBlock = nil; self.invalidationBlock = nil;
} }
} }
@end @end
#endif
+3 -3
View File
@@ -2,10 +2,10 @@
import PackageDescription import PackageDescription
// Version is technically not required here, SPM doesn't check // Version is technically not required here, SPM doesn't check
let version = "2.4.0" let version = "2.3.2"
// Tag is required to point towards the right asset. SPM requires the tag to follow semantic versioning to be able to resolve it. // Tag is required to point towards the right asset. SPM requires the tag to follow semantic versioning to be able to resolve it.
let tag = "2.4.0" let tag = "2.3.2"
let checksum = "44c1a2da814ab922aaf754ed53cd9acb183fe61d43615d1ee83b5744d1533263" let checksum = "cc8042a914d562d0903d488cbd5e6d1c0d3e8735574ad80cc1d3b2901f791b1d"
let url = "https://github.com/sparkle-project/Sparkle/releases/download/\(tag)/Sparkle-for-Swift-Package-Manager.zip" let url = "https://github.com/sparkle-project/Sparkle/releases/download/\(tag)/Sparkle-for-Swift-Package-Manager.zip"
let package = Package( let package = Package(
+2 -4
View File
@@ -35,7 +35,7 @@ Please visit [Sparkle's website](http://sparkle-project.org) for up to date docu
## Usage ## Usage
See [getting started guide](https://sparkle-project.org/documentation/). No code is necessary, but a bit of configuration is required. See [getting started guide](https://sparkle-project.org/documentation/). No code is necessary, but a bit of Xcode configuration is required.
### Troubleshooting ### Troubleshooting
@@ -52,9 +52,7 @@ If you are adding a symbol to the public API you must decorate the declaration w
### Building the distribution package ### Building the distribution package
You do not usually need to build a Sparkle distribution unless you're making changes to Sparkle itself. `cd` to the root of the Sparkle source tree and run `make release`. Sparkle-*VERSION*.tar.xz (or .bz2) will be created in a temporary directory and revealed in Finder after the build has completed.
To build a Sparkle distribution, `cd` to the root of the Sparkle source tree and run `make release`. Sparkle-*VERSION*.tar.xz (or .bz2) will be created in a temporary directory and revealed in Finder after the build has completed.
Alternatively, build the Distribution scheme in the Xcode UI. Alternatively, build the Distribution scheme in the Xcode UI.
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = "Sparkle" s.name = "Sparkle"
s.version = "2.4.0" s.version = "2.3.2"
s.summary = "A software update framework for macOS" s.summary = "A software update framework for macOS"
s.description = "Sparkle is an easy-to-use software update framework for macOS." s.description = "Sparkle is an easy-to-use software update framework for macOS."
s.homepage = "https://sparkle-project.org" s.homepage = "https://sparkle-project.org"
+33 -83
View File
@@ -105,12 +105,6 @@
61B5FCDF09C52A9F00B25A18 /* SUUpdateAlert.h in Headers */ = {isa = PBXBuildFile; fileRef = 61B5FCA009C5228F00B25A18 /* SUUpdateAlert.h */; settings = {ATTRIBUTES = (); }; }; 61B5FCDF09C52A9F00B25A18 /* SUUpdateAlert.h in Headers */ = {isa = PBXBuildFile; fileRef = 61B5FCA009C5228F00B25A18 /* SUUpdateAlert.h */; settings = {ATTRIBUTES = (); }; };
61EF67560E25B58D00F754E0 /* SUHost.m in Sources */ = {isa = PBXBuildFile; fileRef = 61EF67550E25B58D00F754E0 /* SUHost.m */; }; 61EF67560E25B58D00F754E0 /* SUHost.m in Sources */ = {isa = PBXBuildFile; fileRef = 61EF67550E25B58D00F754E0 /* SUHost.m */; };
61EF67590E25C5B400F754E0 /* SUHost.h in Headers */ = {isa = PBXBuildFile; fileRef = 61EF67580E25C5B400F754E0 /* SUHost.h */; }; 61EF67590E25C5B400F754E0 /* SUHost.h in Headers */ = {isa = PBXBuildFile; fileRef = 61EF67580E25C5B400F754E0 /* SUHost.h */; };
654F352529B1548700B10EEB /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B5F8F609C4CEB300B25A18 /* Security.framework */; };
654F352729B154AE00B10EEB /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 654F352629B154AE00B10EEB /* ImageIO.framework */; };
654F352829B154B500B10EEB /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55C14F31136EFC2400649790 /* SystemConfiguration.framework */; };
654F352929B154BB00B10EEB /* ServiceManagement.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 724BB3B51D35AAC3005D534A /* ServiceManagement.framework */; };
654F352C29B154E900B10EEB /* UniformTypeIdentifiers.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F6D399502814387000A8C0DA /* UniformTypeIdentifiers.framework */; };
654F352D29B1551000B10EEB /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 721BC20A1D17A5AD002BC71E /* CoreServices.framework */; };
7202DC9A269ABD3500737EC4 /* testappcast_phasedRollout.xml in Resources */ = {isa = PBXBuildFile; fileRef = 7202DC99269ABD3500737EC4 /* testappcast_phasedRollout.xml */; }; 7202DC9A269ABD3500737EC4 /* testappcast_phasedRollout.xml in Resources */ = {isa = PBXBuildFile; fileRef = 7202DC99269ABD3500737EC4 /* testappcast_phasedRollout.xml */; };
72045CE026FEE535004F96E5 /* Downloader.xpc in Copy XPC Services */ = {isa = PBXBuildFile; fileRef = 726E07EF1CAF37BD001A286B /* Downloader.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 72045CE026FEE535004F96E5 /* Downloader.xpc in Copy XPC Services */ = {isa = PBXBuildFile; fileRef = 726E07EF1CAF37BD001A286B /* Downloader.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
72045CE126FEE535004F96E5 /* InstallerConnection.xpc in Copy XPC Services */ = {isa = PBXBuildFile; fileRef = 724BB36C1D31D0B7005D534A /* InstallerConnection.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 72045CE126FEE535004F96E5 /* InstallerConnection.xpc in Copy XPC Services */ = {isa = PBXBuildFile; fileRef = 724BB36C1D31D0B7005D534A /* InstallerConnection.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
@@ -171,12 +165,6 @@
721D8A861D4ADFEB0032E472 /* SPULocalCacheDirectory.m in Sources */ = {isa = PBXBuildFile; fileRef = 721BC20D1D1CDE55002BC71E /* SPULocalCacheDirectory.m */; }; 721D8A861D4ADFEB0032E472 /* SPULocalCacheDirectory.m in Sources */ = {isa = PBXBuildFile; fileRef = 721BC20D1D1CDE55002BC71E /* SPULocalCacheDirectory.m */; };
721D8A871D4C5BF10032E472 /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14F05136EF6DB00649790 /* SULog.m */; }; 721D8A871D4C5BF10032E472 /* SULog.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C14F05136EF6DB00649790 /* SULog.m */; };
722545B626805FF80036465C /* testappcast_info_updates.xml in Resources */ = {isa = PBXBuildFile; fileRef = 722545B526805FF80036465C /* testappcast_info_updates.xml */; }; 722545B626805FF80036465C /* testappcast_info_updates.xml in Resources */ = {isa = PBXBuildFile; fileRef = 722545B526805FF80036465C /* testappcast_info_updates.xml */; };
72266A872946359600645376 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5E41D3D90AA00D1BF90 /* SUFileManager.m */; };
72266A88294635BA00645376 /* SUAppcastDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 72B767C91C9B707000A07552 /* SUAppcastDriver.m */; };
72266A89294636FB00645376 /* SUStandardVersionComparator.m in Sources */ = {isa = PBXBuildFile; fileRef = 61A225A30D1C4AC000430CCD /* SUStandardVersionComparator.m */; };
72266A8A2946493C00645376 /* SUCodeSigningVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5991D3D8A5A00D1BF90 /* SUCodeSigningVerifier.m */; };
72266A8B29464CEA00645376 /* SUHost.m in Sources */ = {isa = PBXBuildFile; fileRef = 61EF67550E25B58D00F754E0 /* SUHost.m */; };
72266A8C29464D0200645376 /* SUSignatures.m in Sources */ = {isa = PBXBuildFile; fileRef = EA1E286D22B665E8004AA304 /* SUSignatures.m */; };
7229E1B61C97C91100CB50D0 /* SPUUpdateDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 7229E1B51C97C91100CB50D0 /* SPUUpdateDriver.h */; }; 7229E1B61C97C91100CB50D0 /* SPUUpdateDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 7229E1B51C97C91100CB50D0 /* SPUUpdateDriver.h */; };
7229E1B91C97CC4D00CB50D0 /* SPUScheduledUpdateDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 7229E1B71C97CC4D00CB50D0 /* SPUScheduledUpdateDriver.h */; }; 7229E1B91C97CC4D00CB50D0 /* SPUScheduledUpdateDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 7229E1B71C97CC4D00CB50D0 /* SPUScheduledUpdateDriver.h */; };
7229E1BA1C97CC4D00CB50D0 /* SPUScheduledUpdateDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7229E1B81C97CC4D00CB50D0 /* SPUScheduledUpdateDriver.m */; }; 7229E1BA1C97CC4D00CB50D0 /* SPUScheduledUpdateDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7229E1B81C97CC4D00CB50D0 /* SPUScheduledUpdateDriver.m */; };
@@ -191,13 +179,13 @@
723ABD6C259A9CBC00BDB4FA /* SUUpdatePermissionPrompt.xib in Resources */ = {isa = PBXBuildFile; fileRef = 723ABD6A259A9CBB00BDB4FA /* SUUpdatePermissionPrompt.xib */; }; 723ABD6C259A9CBC00BDB4FA /* SUUpdatePermissionPrompt.xib in Resources */ = {isa = PBXBuildFile; fileRef = 723ABD6A259A9CBB00BDB4FA /* SUUpdatePermissionPrompt.xib */; };
723ABDDB259A9E8600BDB4FA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 723ABDD9259A9E8600BDB4FA /* InfoPlist.strings */; }; 723ABDDB259A9E8600BDB4FA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 723ABDD9259A9E8600BDB4FA /* InfoPlist.strings */; };
723ABE02259A9E9E00BDB4FA /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 723ABE00259A9E9E00BDB4FA /* MainMenu.xib */; }; 723ABE02259A9E9E00BDB4FA /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 723ABE00259A9E9E00BDB4FA /* MainMenu.xib */; };
723ABF1B259D055E00BDB4FA /* SUReleaseNotesView.h in Headers */ = {isa = PBXBuildFile; fileRef = 723ABF1A259D055E00BDB4FA /* SUReleaseNotesView.h */; }; 723ABF1B259D055E00BDB4FA /* SUWebView.h in Headers */ = {isa = PBXBuildFile; fileRef = 723ABF1A259D055E00BDB4FA /* SUWebView.h */; };
723ABF30259D062F00BDB4FA /* SULegacyWebView.h in Headers */ = {isa = PBXBuildFile; fileRef = 723ABF2E259D062F00BDB4FA /* SULegacyWebView.h */; }; 723ABF30259D062F00BDB4FA /* SULegacyWebView.h in Headers */ = {isa = PBXBuildFile; fileRef = 723ABF2E259D062F00BDB4FA /* SULegacyWebView.h */; };
723ABF31259D062F00BDB4FA /* SULegacyWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = 723ABF2F259D062F00BDB4FA /* SULegacyWebView.m */; }; 723ABF31259D062F00BDB4FA /* SULegacyWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = 723ABF2F259D062F00BDB4FA /* SULegacyWebView.m */; };
723ABFC4259D4CB300BDB4FA /* SUWKWebView.h in Headers */ = {isa = PBXBuildFile; fileRef = 723ABFC2259D4CB300BDB4FA /* SUWKWebView.h */; }; 723ABFC4259D4CB300BDB4FA /* SUWKWebView.h in Headers */ = {isa = PBXBuildFile; fileRef = 723ABFC2259D4CB300BDB4FA /* SUWKWebView.h */; };
723ABFC5259D4CB300BDB4FA /* SUWKWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = 723ABFC3259D4CB300BDB4FA /* SUWKWebView.m */; }; 723ABFC5259D4CB300BDB4FA /* SUWKWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = 723ABFC3259D4CB300BDB4FA /* SUWKWebView.m */; };
723AC010259DBDAA00BDB4FA /* SUReleaseNotesCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 723AC00E259DBDAA00BDB4FA /* SUReleaseNotesCommon.h */; }; 723AC010259DBDAA00BDB4FA /* SUWebViewCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 723AC00E259DBDAA00BDB4FA /* SUWebViewCommon.h */; };
723AC011259DBDAA00BDB4FA /* SUReleaseNotesCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 723AC00F259DBDAA00BDB4FA /* SUReleaseNotesCommon.m */; }; 723AC011259DBDAA00BDB4FA /* SUWebViewCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 723AC00F259DBDAA00BDB4FA /* SUWebViewCommon.m */; };
723AD12F29922B5F006BB02F /* test-dangerous-link.xml in Resources */ = {isa = PBXBuildFile; fileRef = 723AD12E29922B5F006BB02F /* test-dangerous-link.xml */; }; 723AD12F29922B5F006BB02F /* test-dangerous-link.xml in Resources */ = {isa = PBXBuildFile; fileRef = 723AD12E29922B5F006BB02F /* test-dangerous-link.xml */; };
723B5DA71CF7AB0100365F95 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 723B5DA01CF7AB0100365F95 /* main.m */; }; 723B5DA71CF7AB0100365F95 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 723B5DA01CF7AB0100365F95 /* main.m */; };
723B5DA91CF7AB0100365F95 /* SPUDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 723B5DA31CF7AB0100365F95 /* SPUDownloader.m */; }; 723B5DA91CF7AB0100365F95 /* SPUDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 723B5DA31CF7AB0100365F95 /* SPUDownloader.m */; };
@@ -207,6 +195,8 @@
723C8A561E2D60DB00C14942 /* SUTouchBarButtonGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 723C8A531E2D60DB00C14942 /* SUTouchBarButtonGroup.m */; }; 723C8A561E2D60DB00C14942 /* SUTouchBarButtonGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = 723C8A531E2D60DB00C14942 /* SUTouchBarButtonGroup.m */; };
723EDC3F26885A8E000BCBA4 /* testappcast_channels.xml in Resources */ = {isa = PBXBuildFile; fileRef = 723EDC3E26885A8E000BCBA4 /* testappcast_channels.xml */; }; 723EDC3F26885A8E000BCBA4 /* testappcast_channels.xml in Resources */ = {isa = PBXBuildFile; fileRef = 723EDC3E26885A8E000BCBA4 /* testappcast_channels.xml */; };
72464F701E1F31E000FB341C /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; }; 72464F701E1F31E000FB341C /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; };
72464F711E1F326A00FB341C /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; };
72464F721E1F327C00FB341C /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; };
72464F7C1E2097F600FB341C /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; }; 72464F7C1E2097F600FB341C /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; };
72464F7E1E21ED8C00FB341C /* SUHost.m in Sources */ = {isa = PBXBuildFile; fileRef = 61EF67550E25B58D00F754E0 /* SUHost.m */; }; 72464F7E1E21ED8C00FB341C /* SUHost.m in Sources */ = {isa = PBXBuildFile; fileRef = 61EF67550E25B58D00F754E0 /* SUHost.m */; };
7246E0A31C83B685003B4E75 /* SPUStandardUpdaterController.h in Headers */ = {isa = PBXBuildFile; fileRef = 7246E0A11C83B685003B4E75 /* SPUStandardUpdaterController.h */; settings = {ATTRIBUTES = (Public, ); }; }; 7246E0A31C83B685003B4E75 /* SPUStandardUpdaterController.h in Headers */ = {isa = PBXBuildFile; fileRef = 7246E0A11C83B685003B4E75 /* SPUStandardUpdaterController.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -223,6 +213,7 @@
724BB3AA1D3347C2005D534A /* SUInstallerStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3971D333832005D534A /* SUInstallerStatus.m */; }; 724BB3AA1D3347C2005D534A /* SUInstallerStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3971D333832005D534A /* SUInstallerStatus.m */; };
724BB3B71D35ABA8005D534A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B5F8F609C4CEB300B25A18 /* Security.framework */; }; 724BB3B71D35ABA8005D534A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B5F8F609C4CEB300B25A18 /* Security.framework */; };
724F76F91D6EAD0D00ECD062 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 525A278F133D6AE900FD8D70 /* Cocoa.framework */; }; 724F76F91D6EAD0D00ECD062 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 525A278F133D6AE900FD8D70 /* Cocoa.framework */; };
725264A91D5FBD9100CD6400 /* Sparkle.strings in Resources */ = {isa = PBXBuildFile; fileRef = 61AAE8220A321A7F00D8810D /* Sparkle.strings */; };
725602D51C83551C00DAA70E /* SUApplicationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 725602D31C83551C00DAA70E /* SUApplicationInfo.h */; }; 725602D51C83551C00DAA70E /* SUApplicationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 725602D31C83551C00DAA70E /* SUApplicationInfo.h */; };
725602D61C83551C00DAA70E /* SUApplicationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 725602D41C83551C00DAA70E /* SUApplicationInfo.m */; }; 725602D61C83551C00DAA70E /* SUApplicationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 725602D41C83551C00DAA70E /* SUApplicationInfo.m */; };
725B3A82263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml in Resources */ = {isa = PBXBuildFile; fileRef = 725B3A81263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml */; }; 725B3A82263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml in Resources */ = {isa = PBXBuildFile; fileRef = 725B3A81263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml */; };
@@ -343,8 +334,6 @@
728337A61C9E6FF40085AA99 /* SPUProbeInstallStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = 728337A41C9E6FF40085AA99 /* SPUProbeInstallStatus.h */; }; 728337A61C9E6FF40085AA99 /* SPUProbeInstallStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = 728337A41C9E6FF40085AA99 /* SPUProbeInstallStatus.h */; };
728337A71C9E6FF40085AA99 /* SPUProbeInstallStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 728337A51C9E6FF40085AA99 /* SPUProbeInstallStatus.m */; }; 728337A71C9E6FF40085AA99 /* SPUProbeInstallStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 728337A51C9E6FF40085AA99 /* SPUProbeInstallStatus.m */; };
728638ED1CAF50CE00783084 /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; }; 728638ED1CAF50CE00783084 /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; };
7286EE5F28CEC84900163C1D /* SUPlainTextReleaseNotesView.h in Headers */ = {isa = PBXBuildFile; fileRef = 7286EE5D28CEC84900163C1D /* SUPlainTextReleaseNotesView.h */; };
7286EE6028CEC84900163C1D /* SUPlainTextReleaseNotesView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7286EE5E28CEC84900163C1D /* SUPlainTextReleaseNotesView.m */; };
728ED34A277DA23400D9238F /* SPUSparkleDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 728ED349277DA23400D9238F /* SPUSparkleDeltaArchive.m */; }; 728ED34A277DA23400D9238F /* SPUSparkleDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 728ED349277DA23400D9238F /* SPUSparkleDeltaArchive.m */; };
728ED34B277DA23400D9238F /* SPUSparkleDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 728ED349277DA23400D9238F /* SPUSparkleDeltaArchive.m */; }; 728ED34B277DA23400D9238F /* SPUSparkleDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 728ED349277DA23400D9238F /* SPUSparkleDeltaArchive.m */; };
728ED34C277DA23400D9238F /* SPUSparkleDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 728ED349277DA23400D9238F /* SPUSparkleDeltaArchive.m */; }; 728ED34C277DA23400D9238F /* SPUSparkleDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 728ED349277DA23400D9238F /* SPUSparkleDeltaArchive.m */; };
@@ -366,10 +355,6 @@
72AC6B2A1B9AAF3A00F62325 /* SparkleTestCodeSignApp.tar.bz2 in Resources */ = {isa = PBXBuildFile; fileRef = 72AC6B291B9AAF3A00F62325 /* SparkleTestCodeSignApp.tar.bz2 */; }; 72AC6B2A1B9AAF3A00F62325 /* SparkleTestCodeSignApp.tar.bz2 in Resources */ = {isa = PBXBuildFile; fileRef = 72AC6B291B9AAF3A00F62325 /* SparkleTestCodeSignApp.tar.bz2 */; };
72AC6B2C1B9AB0EE00F62325 /* SparkleTestCodeSignApp.tar.xz in Resources */ = {isa = PBXBuildFile; fileRef = 72AC6B2B1B9AB0EE00F62325 /* SparkleTestCodeSignApp.tar.xz */; }; 72AC6B2C1B9AB0EE00F62325 /* SparkleTestCodeSignApp.tar.xz in Resources */ = {isa = PBXBuildFile; fileRef = 72AC6B2B1B9AB0EE00F62325 /* SparkleTestCodeSignApp.tar.xz */; };
72AC6B2E1B9B218C00F62325 /* SparkleTestCodeSignApp.dmg in Resources */ = {isa = PBXBuildFile; fileRef = 72AC6B2D1B9B218C00F62325 /* SparkleTestCodeSignApp.dmg */; }; 72AC6B2E1B9B218C00F62325 /* SparkleTestCodeSignApp.dmg in Resources */ = {isa = PBXBuildFile; fileRef = 72AC6B2D1B9B218C00F62325 /* SparkleTestCodeSignApp.dmg */; };
72AEB1D429A1A74E0033883E /* SPUStandardVersionDisplay.h in Headers */ = {isa = PBXBuildFile; fileRef = 72AEB1D229A1A74E0033883E /* SPUStandardVersionDisplay.h */; };
72AEB1D529A1A74E0033883E /* SPUStandardVersionDisplay.m in Sources */ = {isa = PBXBuildFile; fileRef = 72AEB1D329A1A74E0033883E /* SPUStandardVersionDisplay.m */; };
72AEB1D829A1CB510033883E /* SPUNoUpdateFoundInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 72AEB1D629A1CB510033883E /* SPUNoUpdateFoundInfo.h */; };
72AEB1D929A1CB510033883E /* SPUNoUpdateFoundInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 72AEB1D729A1CB510033883E /* SPUNoUpdateFoundInfo.m */; };
72B3DEC91E23472200457642 /* SPUDownloadedUpdate.h in Headers */ = {isa = PBXBuildFile; fileRef = 72B3DEC71E23472200457642 /* SPUDownloadedUpdate.h */; }; 72B3DEC91E23472200457642 /* SPUDownloadedUpdate.h in Headers */ = {isa = PBXBuildFile; fileRef = 72B3DEC71E23472200457642 /* SPUDownloadedUpdate.h */; };
72B3DECA1E23472200457642 /* SPUDownloadedUpdate.m in Sources */ = {isa = PBXBuildFile; fileRef = 72B3DEC81E23472200457642 /* SPUDownloadedUpdate.m */; }; 72B3DECA1E23472200457642 /* SPUDownloadedUpdate.m in Sources */ = {isa = PBXBuildFile; fileRef = 72B3DEC81E23472200457642 /* SPUDownloadedUpdate.m */; };
72B3DECD1E23479000457642 /* SPUInformationalUpdate.h in Headers */ = {isa = PBXBuildFile; fileRef = 72B3DECB1E23479000457642 /* SPUInformationalUpdate.h */; }; 72B3DECD1E23479000457642 /* SPUInformationalUpdate.h in Headers */ = {isa = PBXBuildFile; fileRef = 72B3DECB1E23479000457642 /* SPUInformationalUpdate.h */; };
@@ -407,8 +392,6 @@
72E45CF81B640DAE005C701A /* SUUpdateSettingsWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 72E45CF61B640DAE005C701A /* SUUpdateSettingsWindowController.xib */; }; 72E45CF81B640DAE005C701A /* SUUpdateSettingsWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 72E45CF61B640DAE005C701A /* SUUpdateSettingsWindowController.xib */; };
72E45CFC1B641961005C701A /* sparkletestcast.xml in Resources */ = {isa = PBXBuildFile; fileRef = 72E45CFB1B641961005C701A /* sparkletestcast.xml */; }; 72E45CFC1B641961005C701A /* sparkletestcast.xml in Resources */ = {isa = PBXBuildFile; fileRef = 72E45CFB1B641961005C701A /* sparkletestcast.xml */; };
72E539121D68C3FA0092CE5E /* SPUDownloadData.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F9EC431D5E9ED8004AC8B6 /* SPUDownloadData.m */; }; 72E539121D68C3FA0092CE5E /* SPUDownloadData.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F9EC431D5E9ED8004AC8B6 /* SPUDownloadData.m */; };
72EB735F29BE981300FBCEE7 /* DevSignedApp.zip in Resources */ = {isa = PBXBuildFile; fileRef = 72EB735E29BE981300FBCEE7 /* DevSignedApp.zip */; };
72EB736129BEB36100FBCEE7 /* DevSignedAppVersion2.zip in Resources */ = {isa = PBXBuildFile; fileRef = 72EB736029BEB36100FBCEE7 /* DevSignedAppVersion2.zip */; };
72EB87EA1CB8798800C37F42 /* ShowInstallerProgress.m in Sources */ = {isa = PBXBuildFile; fileRef = 72EB87E91CB8798800C37F42 /* ShowInstallerProgress.m */; }; 72EB87EA1CB8798800C37F42 /* ShowInstallerProgress.m in Sources */ = {isa = PBXBuildFile; fileRef = 72EB87E91CB8798800C37F42 /* ShowInstallerProgress.m */; };
72EB87EB1CB8859100C37F42 /* Updater.app in Copy Tools */ = {isa = PBXBuildFile; fileRef = 721C24451CB753E6005440CB /* Updater.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 72EB87EB1CB8859100C37F42 /* Updater.app in Copy Tools */ = {isa = PBXBuildFile; fileRef = 721C24451CB753E6005440CB /* Updater.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
72EB87EC1CB8887E00C37F42 /* SUStatus.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55C14BD8136EF00C00649790 /* SUStatus.xib */; }; 72EB87EC1CB8887E00C37F42 /* SUStatus.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55C14BD8136EF00C00649790 /* SUStatus.xib */; };
@@ -439,6 +422,8 @@
72F94F5A1CC450DE002DEE68 /* SUInstallerLauncher.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E07B11CAF08D6001A286B /* SUInstallerLauncher.m */; }; 72F94F5A1CC450DE002DEE68 /* SUInstallerLauncher.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E07B11CAF08D6001A286B /* SUInstallerLauncher.m */; };
72F9EBE21D517E2F004AC8B6 /* SUUpdater.h in Headers */ = {isa = PBXBuildFile; fileRef = 72F9EBE01D517E2F004AC8B6 /* SUUpdater.h */; settings = {ATTRIBUTES = (Public, ); }; }; 72F9EBE21D517E2F004AC8B6 /* SUUpdater.h in Headers */ = {isa = PBXBuildFile; fileRef = 72F9EBE01D517E2F004AC8B6 /* SUUpdater.h */; settings = {ATTRIBUTES = (Public, ); }; };
72F9EBE31D517E2F004AC8B6 /* SUUpdater.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F9EBE11D517E2F004AC8B6 /* SUUpdater.m */; }; 72F9EBE31D517E2F004AC8B6 /* SUUpdater.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F9EBE11D517E2F004AC8B6 /* SUUpdater.m */; };
72F9EC341D5BF542004AC8B6 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5E41D3D90AA00D1BF90 /* SUFileManager.m */; };
72F9EC351D5BF54E004AC8B6 /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5E41D3D90AA00D1BF90 /* SUFileManager.m */; };
72F9EC3F1D5E823F004AC8B6 /* SPUUpdaterTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 72F9EC3D1D5E823F004AC8B6 /* SPUUpdaterTimer.h */; }; 72F9EC3F1D5E823F004AC8B6 /* SPUUpdaterTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 72F9EC3D1D5E823F004AC8B6 /* SPUUpdaterTimer.h */; };
72F9EC401D5E823F004AC8B6 /* SPUUpdaterTimer.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F9EC3E1D5E823F004AC8B6 /* SPUUpdaterTimer.m */; }; 72F9EC401D5E823F004AC8B6 /* SPUUpdaterTimer.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F9EC3E1D5E823F004AC8B6 /* SPUUpdaterTimer.m */; };
72F9EC441D5E9ED8004AC8B6 /* SPUDownloadData.h in Headers */ = {isa = PBXBuildFile; fileRef = 72F9EC421D5E9ED8004AC8B6 /* SPUDownloadData.h */; settings = {ATTRIBUTES = (Public, ); }; }; 72F9EC441D5E9ED8004AC8B6 /* SPUDownloadData.h in Headers */ = {isa = PBXBuildFile; fileRef = 72F9EC421D5E9ED8004AC8B6 /* SPUDownloadData.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -1019,9 +1004,8 @@
61EF67580E25C5B400F754E0 /* SUHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUHost.h; sourceTree = "<group>"; }; 61EF67580E25C5B400F754E0 /* SUHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUHost.h; sourceTree = "<group>"; };
61F3AC1215C22D4A00260CA2 /* th */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = th; path = th.lproj/Sparkle.strings; sourceTree = "<group>"; }; 61F3AC1215C22D4A00260CA2 /* th */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = th; path = th.lproj/Sparkle.strings; sourceTree = "<group>"; };
61F614540E24A12D009F47E7 /* it */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Sparkle.strings; sourceTree = "<group>"; }; 61F614540E24A12D009F47E7 /* it */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Sparkle.strings; sourceTree = "<group>"; };
654F352629B154AE00B10EEB /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; };
7202DC99269ABD3500737EC4 /* testappcast_phasedRollout.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = testappcast_phasedRollout.xml; sourceTree = "<group>"; }; 7202DC99269ABD3500737EC4 /* testappcast_phasedRollout.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = testappcast_phasedRollout.xml; sourceTree = "<group>"; };
72045CE426FEE708004F96E5 /* strip-framework.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "strip-framework.sh"; sourceTree = "<group>"; }; 72045CE426FEE708004F96E5 /* strip-xpc-services.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "strip-xpc-services.sh"; sourceTree = "<group>"; };
7205C43E1E13049400E370AE /* generate_appcast */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = generate_appcast; sourceTree = BUILT_PRODUCTS_DIR; }; 7205C43E1E13049400E370AE /* generate_appcast */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = generate_appcast; sourceTree = BUILT_PRODUCTS_DIR; };
7205C4401E13049400E370AE /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; }; 7205C4401E13049400E370AE /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
7205C4461E1304C300E370AE /* Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Bridging-Header.h"; sourceTree = "<group>"; }; 7205C4461E1304C300E370AE /* Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Bridging-Header.h"; sourceTree = "<group>"; };
@@ -1181,13 +1165,13 @@
723ABE37259A9F2900BDB4FA /* th */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = th; path = th.lproj/MainMenu.strings; sourceTree = "<group>"; }; 723ABE37259A9F2900BDB4FA /* th */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = th; path = th.lproj/MainMenu.strings; sourceTree = "<group>"; };
723ABE38259A9F2B00BDB4FA /* tr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = tr; path = tr.lproj/MainMenu.strings; sourceTree = "<group>"; }; 723ABE38259A9F2B00BDB4FA /* tr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = tr; path = tr.lproj/MainMenu.strings; sourceTree = "<group>"; };
723ABE39259A9F2E00BDB4FA /* uk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/MainMenu.strings; sourceTree = "<group>"; }; 723ABE39259A9F2E00BDB4FA /* uk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/MainMenu.strings; sourceTree = "<group>"; };
723ABF1A259D055E00BDB4FA /* SUReleaseNotesView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUReleaseNotesView.h; sourceTree = "<group>"; }; 723ABF1A259D055E00BDB4FA /* SUWebView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUWebView.h; sourceTree = "<group>"; };
723ABF2E259D062F00BDB4FA /* SULegacyWebView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SULegacyWebView.h; sourceTree = "<group>"; }; 723ABF2E259D062F00BDB4FA /* SULegacyWebView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SULegacyWebView.h; sourceTree = "<group>"; };
723ABF2F259D062F00BDB4FA /* SULegacyWebView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SULegacyWebView.m; sourceTree = "<group>"; }; 723ABF2F259D062F00BDB4FA /* SULegacyWebView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SULegacyWebView.m; sourceTree = "<group>"; };
723ABFC2259D4CB300BDB4FA /* SUWKWebView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUWKWebView.h; sourceTree = "<group>"; }; 723ABFC2259D4CB300BDB4FA /* SUWKWebView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUWKWebView.h; sourceTree = "<group>"; };
723ABFC3259D4CB300BDB4FA /* SUWKWebView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SUWKWebView.m; sourceTree = "<group>"; }; 723ABFC3259D4CB300BDB4FA /* SUWKWebView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SUWKWebView.m; sourceTree = "<group>"; };
723AC00E259DBDAA00BDB4FA /* SUReleaseNotesCommon.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUReleaseNotesCommon.h; sourceTree = "<group>"; }; 723AC00E259DBDAA00BDB4FA /* SUWebViewCommon.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUWebViewCommon.h; sourceTree = "<group>"; };
723AC00F259DBDAA00BDB4FA /* SUReleaseNotesCommon.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SUReleaseNotesCommon.m; sourceTree = "<group>"; }; 723AC00F259DBDAA00BDB4FA /* SUWebViewCommon.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SUWebViewCommon.m; sourceTree = "<group>"; };
723AD12E29922B5F006BB02F /* test-dangerous-link.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "test-dangerous-link.xml"; sourceTree = "<group>"; }; 723AD12E29922B5F006BB02F /* test-dangerous-link.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "test-dangerous-link.xml"; sourceTree = "<group>"; };
723B5D9F1CF7AB0100365F95 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Downloader/Info.plist; sourceTree = SOURCE_ROOT; }; 723B5D9F1CF7AB0100365F95 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Downloader/Info.plist; sourceTree = SOURCE_ROOT; };
723B5DA01CF7AB0100365F95 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Downloader/main.m; sourceTree = SOURCE_ROOT; }; 723B5DA01CF7AB0100365F95 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Downloader/main.m; sourceTree = SOURCE_ROOT; };
@@ -1332,8 +1316,6 @@
728337A41C9E6FF40085AA99 /* SPUProbeInstallStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUProbeInstallStatus.h; sourceTree = "<group>"; }; 728337A41C9E6FF40085AA99 /* SPUProbeInstallStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUProbeInstallStatus.h; sourceTree = "<group>"; };
728337A51C9E6FF40085AA99 /* SPUProbeInstallStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUProbeInstallStatus.m; sourceTree = "<group>"; }; 728337A51C9E6FF40085AA99 /* SPUProbeInstallStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUProbeInstallStatus.m; sourceTree = "<group>"; };
728638EE1CAF589C00783084 /* ConfigDownloader.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigDownloader.xcconfig; sourceTree = "<group>"; }; 728638EE1CAF589C00783084 /* ConfigDownloader.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigDownloader.xcconfig; sourceTree = "<group>"; };
7286EE5D28CEC84900163C1D /* SUPlainTextReleaseNotesView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUPlainTextReleaseNotesView.h; sourceTree = "<group>"; };
7286EE5E28CEC84900163C1D /* SUPlainTextReleaseNotesView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SUPlainTextReleaseNotesView.m; sourceTree = "<group>"; };
728ED348277DA23400D9238F /* SPUSparkleDeltaArchive.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SPUSparkleDeltaArchive.h; path = Autoupdate/SPUSparkleDeltaArchive.h; sourceTree = SOURCE_ROOT; }; 728ED348277DA23400D9238F /* SPUSparkleDeltaArchive.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SPUSparkleDeltaArchive.h; path = Autoupdate/SPUSparkleDeltaArchive.h; sourceTree = SOURCE_ROOT; };
728ED349277DA23400D9238F /* SPUSparkleDeltaArchive.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SPUSparkleDeltaArchive.m; path = Autoupdate/SPUSparkleDeltaArchive.m; sourceTree = SOURCE_ROOT; }; 728ED349277DA23400D9238F /* SPUSparkleDeltaArchive.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SPUSparkleDeltaArchive.m; path = Autoupdate/SPUSparkleDeltaArchive.m; sourceTree = SOURCE_ROOT; };
729924921DF4A45000DBCDF5 /* SUUpdateValidator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUUpdateValidator.h; path = Sparkle/SUUpdateValidator.h; sourceTree = SOURCE_ROOT; }; 729924921DF4A45000DBCDF5 /* SUUpdateValidator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUUpdateValidator.h; path = Sparkle/SUUpdateValidator.h; sourceTree = SOURCE_ROOT; };
@@ -1345,7 +1327,6 @@
729F7EAD273F1840004592DC /* SPUUserAgent+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SPUUserAgent+Private.h"; sourceTree = "<group>"; }; 729F7EAD273F1840004592DC /* SPUUserAgent+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SPUUserAgent+Private.h"; sourceTree = "<group>"; };
729F7EAE273F1840004592DC /* SPUUserAgent+Private.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "SPUUserAgent+Private.m"; sourceTree = "<group>"; }; 729F7EAE273F1840004592DC /* SPUUserAgent+Private.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "SPUUserAgent+Private.m"; sourceTree = "<group>"; };
729F7ECD27409076004592DC /* SparkleTestCodeSignApp_bad_extraneous.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = SparkleTestCodeSignApp_bad_extraneous.zip; sourceTree = "<group>"; }; 729F7ECD27409076004592DC /* SparkleTestCodeSignApp_bad_extraneous.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = SparkleTestCodeSignApp_bad_extraneous.zip; sourceTree = "<group>"; };
72A40F082956120D007C7DD5 /* ConfigFrameworkRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigFrameworkRelease.xcconfig; sourceTree = "<group>"; };
72A450511C69A68900D67EEA /* SUUpdatePermissionResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUpdatePermissionResponse.h; sourceTree = "<group>"; }; 72A450511C69A68900D67EEA /* SUUpdatePermissionResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUUpdatePermissionResponse.h; sourceTree = "<group>"; };
72A450521C69A68900D67EEA /* SUUpdatePermissionResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUpdatePermissionResponse.m; sourceTree = "<group>"; }; 72A450521C69A68900D67EEA /* SUUpdatePermissionResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUpdatePermissionResponse.m; sourceTree = "<group>"; };
72A4A23F1BB6567D00E7820D /* SUFileManagerTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SUFileManagerTest.swift; sourceTree = "<group>"; }; 72A4A23F1BB6567D00E7820D /* SUFileManagerTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SUFileManagerTest.swift; sourceTree = "<group>"; };
@@ -1355,10 +1336,6 @@
72AC6B291B9AAF3A00F62325 /* SparkleTestCodeSignApp.tar.bz2 */ = {isa = PBXFileReference; lastKnownFileType = file; path = SparkleTestCodeSignApp.tar.bz2; sourceTree = "<group>"; }; 72AC6B291B9AAF3A00F62325 /* SparkleTestCodeSignApp.tar.bz2 */ = {isa = PBXFileReference; lastKnownFileType = file; path = SparkleTestCodeSignApp.tar.bz2; sourceTree = "<group>"; };
72AC6B2B1B9AB0EE00F62325 /* SparkleTestCodeSignApp.tar.xz */ = {isa = PBXFileReference; lastKnownFileType = file; path = SparkleTestCodeSignApp.tar.xz; sourceTree = "<group>"; }; 72AC6B2B1B9AB0EE00F62325 /* SparkleTestCodeSignApp.tar.xz */ = {isa = PBXFileReference; lastKnownFileType = file; path = SparkleTestCodeSignApp.tar.xz; sourceTree = "<group>"; };
72AC6B2D1B9B218C00F62325 /* SparkleTestCodeSignApp.dmg */ = {isa = PBXFileReference; lastKnownFileType = file; path = SparkleTestCodeSignApp.dmg; sourceTree = "<group>"; }; 72AC6B2D1B9B218C00F62325 /* SparkleTestCodeSignApp.dmg */ = {isa = PBXFileReference; lastKnownFileType = file; path = SparkleTestCodeSignApp.dmg; sourceTree = "<group>"; };
72AEB1D229A1A74E0033883E /* SPUStandardVersionDisplay.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SPUStandardVersionDisplay.h; sourceTree = "<group>"; };
72AEB1D329A1A74E0033883E /* SPUStandardVersionDisplay.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SPUStandardVersionDisplay.m; sourceTree = "<group>"; };
72AEB1D629A1CB510033883E /* SPUNoUpdateFoundInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SPUNoUpdateFoundInfo.h; sourceTree = "<group>"; };
72AEB1D729A1CB510033883E /* SPUNoUpdateFoundInfo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SPUNoUpdateFoundInfo.m; sourceTree = "<group>"; };
72AFC6121B9A944200F6B565 /* Sparkle Unit Tests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Sparkle Unit Tests-Bridging-Header.h"; sourceTree = "<group>"; }; 72AFC6121B9A944200F6B565 /* Sparkle Unit Tests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Sparkle Unit Tests-Bridging-Header.h"; sourceTree = "<group>"; };
72B09CE91CEA18900052EF9E /* bscommon.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bscommon.c; sourceTree = "<group>"; }; 72B09CE91CEA18900052EF9E /* bscommon.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bscommon.c; sourceTree = "<group>"; };
72B09CEA1CEA18900052EF9E /* bscommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bscommon.h; sourceTree = "<group>"; }; 72B09CEA1CEA18900052EF9E /* bscommon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bscommon.h; sourceTree = "<group>"; };
@@ -1412,8 +1389,6 @@
72E45CF51B640DAE005C701A /* SUUpdateSettingsWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUpdateSettingsWindowController.m; sourceTree = "<group>"; }; 72E45CF51B640DAE005C701A /* SUUpdateSettingsWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUpdateSettingsWindowController.m; sourceTree = "<group>"; };
72E45CF61B640DAE005C701A /* SUUpdateSettingsWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SUUpdateSettingsWindowController.xib; sourceTree = "<group>"; }; 72E45CF61B640DAE005C701A /* SUUpdateSettingsWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SUUpdateSettingsWindowController.xib; sourceTree = "<group>"; };
72E45CFB1B641961005C701A /* sparkletestcast.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = sparkletestcast.xml; sourceTree = "<group>"; }; 72E45CFB1B641961005C701A /* sparkletestcast.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = sparkletestcast.xml; sourceTree = "<group>"; };
72EB735E29BE981300FBCEE7 /* DevSignedApp.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = DevSignedApp.zip; sourceTree = "<group>"; };
72EB736029BEB36100FBCEE7 /* DevSignedAppVersion2.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = DevSignedAppVersion2.zip; sourceTree = "<group>"; };
72EB87E91CB8798800C37F42 /* ShowInstallerProgress.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ShowInstallerProgress.m; path = Sparkle/InstallerProgress/ShowInstallerProgress.m; sourceTree = SOURCE_ROOT; }; 72EB87E91CB8798800C37F42 /* ShowInstallerProgress.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ShowInstallerProgress.m; path = Sparkle/InstallerProgress/ShowInstallerProgress.m; sourceTree = SOURCE_ROOT; };
72EE17FA26D1CBC000C58B19 /* SUInstallerLauncher+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SUInstallerLauncher+Private.h"; sourceTree = "<group>"; }; 72EE17FA26D1CBC000C58B19 /* SUInstallerLauncher+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SUInstallerLauncher+Private.h"; sourceTree = "<group>"; };
72EE181826DAE6E100C58B19 /* SPUUpdateCheck.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SPUUpdateCheck.h; sourceTree = "<group>"; }; 72EE181826DAE6E100C58B19 /* SPUUpdateCheck.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SPUUpdateCheck.h; sourceTree = "<group>"; };
@@ -1589,12 +1564,6 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
654F352D29B1551000B10EEB /* CoreServices.framework in Frameworks */,
654F352C29B154E900B10EEB /* UniformTypeIdentifiers.framework in Frameworks */,
654F352929B154BB00B10EEB /* ServiceManagement.framework in Frameworks */,
654F352829B154B500B10EEB /* SystemConfiguration.framework in Frameworks */,
654F352729B154AE00B10EEB /* ImageIO.framework in Frameworks */,
654F352529B1548700B10EEB /* Security.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@@ -1724,7 +1693,6 @@
0867D69AFE84028FC02AAC07 /* Frameworks */ = { 0867D69AFE84028FC02AAC07 /* Frameworks */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
654F352629B154AE00B10EEB /* ImageIO.framework */,
725B81F92781AEA40041746F /* libcompression.tbd */, 725B81F92781AEA40041746F /* libcompression.tbd */,
0867D6A5FE840307C02AAC07 /* AppKit.framework */, 0867D6A5FE840307C02AAC07 /* AppKit.framework */,
721BC2081D17A553002BC71E /* Carbon.framework */, 721BC2081D17A553002BC71E /* Carbon.framework */,
@@ -1851,8 +1819,6 @@
729F7ECD27409076004592DC /* SparkleTestCodeSignApp_bad_extraneous.zip */, 729F7ECD27409076004592DC /* SparkleTestCodeSignApp_bad_extraneous.zip */,
72CCDEBD27421FD500B53718 /* SparkleTestCodeSignApp_bad_header.zip */, 72CCDEBD27421FD500B53718 /* SparkleTestCodeSignApp_bad_header.zip */,
F8761EB21ADC50EB000C9034 /* SparkleTestCodeSignApp.zip */, F8761EB21ADC50EB000C9034 /* SparkleTestCodeSignApp.zip */,
72EB735E29BE981300FBCEE7 /* DevSignedApp.zip */,
72EB736029BEB36100FBCEE7 /* DevSignedAppVersion2.zip */,
14958C6C19AEBC610061B14F /* test-pubkey.pem */, 14958C6C19AEBC610061B14F /* test-pubkey.pem */,
5AF6C74E1AEA46D10014A3AB /* test.pkg */, 5AF6C74E1AEA46D10014A3AB /* test.pkg */,
5AD0FA7E1C73F2E2004BCEFF /* testappcast.xml */, 5AD0FA7E1C73F2E2004BCEFF /* testappcast.xml */,
@@ -1998,11 +1964,12 @@
6196CFE409C71ADE000DC222 /* SUStatusController.m */, 6196CFE409C71ADE000DC222 /* SUStatusController.m */,
61B5FCA009C5228F00B25A18 /* SUUpdateAlert.h */, 61B5FCA009C5228F00B25A18 /* SUUpdateAlert.h */,
61B5FCA109C5228F00B25A18 /* SUUpdateAlert.m */, 61B5FCA109C5228F00B25A18 /* SUUpdateAlert.m */,
723AC036259DBF1B00BDB4FA /* Release Notes Views */, 723AC036259DBF1B00BDB4FA /* Web View */,
612DCBAD0D488BC60015DBEA /* SUUpdatePermissionPrompt.h */, 612DCBAD0D488BC60015DBEA /* SUUpdatePermissionPrompt.h */,
612DCBAE0D488BC60015DBEA /* SUUpdatePermissionPrompt.m */, 612DCBAE0D488BC60015DBEA /* SUUpdatePermissionPrompt.m */,
723C8A521E2D60DB00C14942 /* SUTouchBarButtonGroup.h */, 723C8A521E2D60DB00C14942 /* SUTouchBarButtonGroup.h */,
723C8A531E2D60DB00C14942 /* SUTouchBarButtonGroup.m */, 723C8A531E2D60DB00C14942 /* SUTouchBarButtonGroup.m */,
3772FEA813DE0B6B00F79537 /* SUVersionDisplayProtocol.h */,
); );
name = "User Interface"; name = "User Interface";
sourceTree = "<group>"; sourceTree = "<group>";
@@ -2053,11 +2020,6 @@
727F340A2605321D00020E85 /* SULog+NSError.m */, 727F340A2605321D00020E85 /* SULog+NSError.m */,
726F2CE31BC9C33D001971A4 /* SUOperatingSystem.h */, 726F2CE31BC9C33D001971A4 /* SUOperatingSystem.h */,
726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */, 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */,
3772FEA813DE0B6B00F79537 /* SUVersionDisplayProtocol.h */,
72AEB1D229A1A74E0033883E /* SPUStandardVersionDisplay.h */,
72AEB1D329A1A74E0033883E /* SPUStandardVersionDisplay.m */,
72AEB1D629A1CB510033883E /* SPUNoUpdateFoundInfo.h */,
72AEB1D729A1CB510033883E /* SPUNoUpdateFoundInfo.m */,
); );
includeInIndex = 1; includeInIndex = 1;
name = "Other Sources"; name = "Other Sources";
@@ -2198,20 +2160,18 @@
name = Internal; name = Internal;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
723AC036259DBF1B00BDB4FA /* Release Notes Views */ = { 723AC036259DBF1B00BDB4FA /* Web View */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
723ABF1A259D055E00BDB4FA /* SUReleaseNotesView.h */, 723ABF1A259D055E00BDB4FA /* SUWebView.h */,
723AC00E259DBDAA00BDB4FA /* SUReleaseNotesCommon.h */, 723AC00E259DBDAA00BDB4FA /* SUWebViewCommon.h */,
723AC00F259DBDAA00BDB4FA /* SUReleaseNotesCommon.m */, 723AC00F259DBDAA00BDB4FA /* SUWebViewCommon.m */,
723ABFC2259D4CB300BDB4FA /* SUWKWebView.h */, 723ABFC2259D4CB300BDB4FA /* SUWKWebView.h */,
723ABFC3259D4CB300BDB4FA /* SUWKWebView.m */, 723ABFC3259D4CB300BDB4FA /* SUWKWebView.m */,
723ABF2E259D062F00BDB4FA /* SULegacyWebView.h */, 723ABF2E259D062F00BDB4FA /* SULegacyWebView.h */,
723ABF2F259D062F00BDB4FA /* SULegacyWebView.m */, 723ABF2F259D062F00BDB4FA /* SULegacyWebView.m */,
7286EE5D28CEC84900163C1D /* SUPlainTextReleaseNotesView.h */,
7286EE5E28CEC84900163C1D /* SUPlainTextReleaseNotesView.m */,
); );
name = "Release Notes Views"; name = "Web View";
sourceTree = "<group>"; sourceTree = "<group>";
}; };
724BB36D1D31D0B7005D534A /* InstallerConnection */ = { 724BB36D1D31D0B7005D534A /* InstallerConnection */ = {
@@ -2466,7 +2426,6 @@
72F94ED61CC344A7002DEE68 /* ConfigDownloaderDebug.xcconfig */, 72F94ED61CC344A7002DEE68 /* ConfigDownloaderDebug.xcconfig */,
FA1941D10D94A70100DD942E /* ConfigFramework.xcconfig */, FA1941D10D94A70100DD942E /* ConfigFramework.xcconfig */,
FA1941CA0D94A70100DD942E /* ConfigFrameworkDebug.xcconfig */, FA1941CA0D94A70100DD942E /* ConfigFrameworkDebug.xcconfig */,
72A40F082956120D007C7DD5 /* ConfigFrameworkRelease.xcconfig */,
724BB37E1D31D1EA005D534A /* ConfigInstallerConnection.xcconfig */, 724BB37E1D31D1EA005D534A /* ConfigInstallerConnection.xcconfig */,
724BB37F1D31D1EA005D534A /* ConfigInstallerConnectionDebug.xcconfig */, 724BB37F1D31D1EA005D534A /* ConfigInstallerConnectionDebug.xcconfig */,
726E07C11CAF1E79001A286B /* ConfigInstallerLauncher.xcconfig */, 726E07C11CAF1E79001A286B /* ConfigInstallerLauncher.xcconfig */,
@@ -2496,7 +2455,7 @@
EA1E285922B6622E004AA304 /* ed25519-Shared.xcconfig */, EA1E285922B6622E004AA304 /* ed25519-Shared.xcconfig */,
14732BC91960F70A00593899 /* make-release-package.sh */, 14732BC91960F70A00593899 /* make-release-package.sh */,
14652F7919A93E5F00959E44 /* set-git-version-info.sh */, 14652F7919A93E5F00959E44 /* set-git-version-info.sh */,
72045CE426FEE708004F96E5 /* strip-framework.sh */, 72045CE426FEE708004F96E5 /* strip-xpc-services.sh */,
720C192827127A3800740C8E /* release-move-tag.sh */, 720C192827127A3800740C8E /* release-move-tag.sh */,
720B4C2325EBFAFD005A0592 /* link-tools.sh */, 720B4C2325EBFAFD005A0592 /* link-tools.sh */,
146EC84E19A68CF8004A50C5 /* Sparkle.podspec */, 146EC84E19A68CF8004A50C5 /* Sparkle.podspec */,
@@ -2517,7 +2476,6 @@
72B767E21C9CE90A00A07552 /* SPUCoreBasedUpdateDriver.h in Headers */, 72B767E21C9CE90A00A07552 /* SPUCoreBasedUpdateDriver.h in Headers */,
72F9EC441D5E9ED8004AC8B6 /* SPUDownloadData.h in Headers */, 72F9EC441D5E9ED8004AC8B6 /* SPUDownloadData.h in Headers */,
72EF30C12675CF38008CE987 /* SPUAppcastItemState.h in Headers */, 72EF30C12675CF38008CE987 /* SPUAppcastItemState.h in Headers */,
72AEB1D429A1A74E0033883E /* SPUStandardVersionDisplay.h in Headers */,
7229E1BD1C98EFF200CB50D0 /* SPUDownloadDriver.h in Headers */, 7229E1BD1C98EFF200CB50D0 /* SPUDownloadDriver.h in Headers */,
7267E5FD1D3DD1B700D1BF90 /* SPUResumableUpdate.h in Headers */, 7267E5FD1D3DD1B700D1BF90 /* SPUResumableUpdate.h in Headers */,
7267E5B61D3D8AEE00D1BF90 /* SPUInstallationInfo.h in Headers */, 7267E5B61D3D8AEE00D1BF90 /* SPUInstallationInfo.h in Headers */,
@@ -2527,7 +2485,6 @@
721BC20E1D1CDE55002BC71E /* SPULocalCacheDirectory.h in Headers */, 721BC20E1D1CDE55002BC71E /* SPULocalCacheDirectory.h in Headers */,
7267E5B11D3D8AD500D1BF90 /* SPUMessageTypes.h in Headers */, 7267E5B11D3D8AD500D1BF90 /* SPUMessageTypes.h in Headers */,
728337A61C9E6FF40085AA99 /* SPUProbeInstallStatus.h in Headers */, 728337A61C9E6FF40085AA99 /* SPUProbeInstallStatus.h in Headers */,
7286EE5F28CEC84900163C1D /* SUPlainTextReleaseNotesView.h in Headers */,
723C8A541E2D60DB00C14942 /* SUTouchBarButtonGroup.h in Headers */, 723C8A541E2D60DB00C14942 /* SUTouchBarButtonGroup.h in Headers */,
72B767D21C9C7B9300A07552 /* SPUProbingUpdateDriver.h in Headers */, 72B767D21C9C7B9300A07552 /* SPUProbingUpdateDriver.h in Headers */,
7229E1B91C97CC4D00CB50D0 /* SPUScheduledUpdateDriver.h in Headers */, 7229E1B91C97CC4D00CB50D0 /* SPUScheduledUpdateDriver.h in Headers */,
@@ -2554,7 +2511,6 @@
72F9EC3F1D5E823F004AC8B6 /* SPUUpdaterTimer.h in Headers */, 72F9EC3F1D5E823F004AC8B6 /* SPUUpdaterTimer.h in Headers */,
7269E494264798200088C213 /* SPUSkippedUpdate.h in Headers */, 7269E494264798200088C213 /* SPUSkippedUpdate.h in Headers */,
723ABFC4259D4CB300BDB4FA /* SUWKWebView.h in Headers */, 723ABFC4259D4CB300BDB4FA /* SUWKWebView.h in Headers */,
72AEB1D829A1CB510033883E /* SPUNoUpdateFoundInfo.h in Headers */,
725CB9571C7120410064365A /* SPUUserDriver.h in Headers */, 725CB9571C7120410064365A /* SPUUserDriver.h in Headers */,
72B767DE1C9CDB9700A07552 /* SPUUserInitiatedUpdateDriver.h in Headers */, 72B767DE1C9CDB9700A07552 /* SPUUserInitiatedUpdateDriver.h in Headers */,
72F94F581CC44DE1002DEE68 /* SPUXPCServiceInfo.h in Headers */, 72F94F581CC44DE1002DEE68 /* SPUXPCServiceInfo.h in Headers */,
@@ -2568,11 +2524,11 @@
7267E5E51D3D90AA00D1BF90 /* SUFileManager.h in Headers */, 7267E5E51D3D90AA00D1BF90 /* SUFileManager.h in Headers */,
72B3DEC91E23472200457642 /* SPUDownloadedUpdate.h in Headers */, 72B3DEC91E23472200457642 /* SPUDownloadedUpdate.h in Headers */,
61EF67590E25C5B400F754E0 /* SUHost.h in Headers */, 61EF67590E25C5B400F754E0 /* SUHost.h in Headers */,
723AC010259DBDAA00BDB4FA /* SUReleaseNotesCommon.h in Headers */, 723AC010259DBDAA00BDB4FA /* SUWebViewCommon.h in Headers */,
72162B081C82C9600013C1C5 /* SULocalizations.h in Headers */, 72162B081C82C9600013C1C5 /* SULocalizations.h in Headers */,
55C14F06136EF6DB00649790 /* SULog.h in Headers */, 55C14F06136EF6DB00649790 /* SULog.h in Headers */,
EA1E286E22B665F0004AA304 /* SUSignatures.h in Headers */, EA1E286E22B665F0004AA304 /* SUSignatures.h in Headers */,
723ABF1B259D055E00BDB4FA /* SUReleaseNotesView.h in Headers */, 723ABF1B259D055E00BDB4FA /* SUWebView.h in Headers */,
72B3DECD1E23479000457642 /* SPUInformationalUpdate.h in Headers */, 72B3DECD1E23479000457642 /* SPUInformationalUpdate.h in Headers */,
726F2CE51BC9C33D001971A4 /* SUOperatingSystem.h in Headers */, 726F2CE51BC9C33D001971A4 /* SUOperatingSystem.h in Headers */,
61A225A40D1C4AC000430CCD /* SUStandardVersionComparator.h in Headers */, 61A225A40D1C4AC000430CCD /* SUStandardVersionComparator.h in Headers */,
@@ -2874,7 +2830,7 @@
8DC2EF520486A6940098B216 /* Resources */, 8DC2EF520486A6940098B216 /* Resources */,
142E0E0319A6A24100E4312B /* Copy Tools */, 142E0E0319A6A24100E4312B /* Copy Tools */,
72045CDF26FEE51D004F96E5 /* Copy XPC Services */, 72045CDF26FEE51D004F96E5 /* Copy XPC Services */,
72045CE626FEE8CC004F96E5 /* Strip Framework */, 72045CE626FEE8CC004F96E5 /* Strip XPC Services */,
8DC2EF540486A6940098B216 /* Sources */, 8DC2EF540486A6940098B216 /* Sources */,
8DC2EF560486A6940098B216 /* Frameworks */, 8DC2EF560486A6940098B216 /* Frameworks */,
6131B1910DDCDE32005215F0 /* Run Script: Set Git Version Info */, 6131B1910DDCDE32005215F0 /* Run Script: Set Git Version Info */,
@@ -3145,7 +3101,6 @@
725B3A82263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml in Resources */, 725B3A82263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml in Resources */,
14958C6E19AEBC950061B14F /* signed-test-file.txt in Resources */, 14958C6E19AEBC950061B14F /* signed-test-file.txt in Resources */,
723AD12F29922B5F006BB02F /* test-dangerous-link.xml in Resources */, 723AD12F29922B5F006BB02F /* test-dangerous-link.xml in Resources */,
72EB736129BEB36100FBCEE7 /* DevSignedAppVersion2.zip in Resources */,
723EDC3F26885A8E000BCBA4 /* testappcast_channels.xml in Resources */, 723EDC3F26885A8E000BCBA4 /* testappcast_channels.xml in Resources */,
720DC50427A51A6500DFF3EC /* testappcast_minimumAutoupdateVersionSkipping.xml in Resources */, 720DC50427A51A6500DFF3EC /* testappcast_minimumAutoupdateVersionSkipping.xml in Resources */,
72AC6B2E1B9B218C00F62325 /* SparkleTestCodeSignApp.dmg in Resources */, 72AC6B2E1B9B218C00F62325 /* SparkleTestCodeSignApp.dmg in Resources */,
@@ -3160,7 +3115,6 @@
5A5DD40424958B000045EB3E /* SUUpdateValidatorTest in Resources */, 5A5DD40424958B000045EB3E /* SUUpdateValidatorTest in Resources */,
14958C6F19AEBC980061B14F /* test-pubkey.pem in Resources */, 14958C6F19AEBC980061B14F /* test-pubkey.pem in Resources */,
5AF6C74F1AEA46D10014A3AB /* test.pkg in Resources */, 5AF6C74F1AEA46D10014A3AB /* test.pkg in Resources */,
72EB735F29BE981300FBCEE7 /* DevSignedApp.zip in Resources */,
72BC6C3D275027BF0083F14B /* SparkleTestCodeSign_apfs.dmg in Resources */, 72BC6C3D275027BF0083F14B /* SparkleTestCodeSign_apfs.dmg in Resources */,
720DC50627A62CDC00DFF3EC /* testappcast_minimumAutoupdateVersionSkipping2.xml in Resources */, 720DC50627A62CDC00DFF3EC /* testappcast_minimumAutoupdateVersionSkipping2.xml in Resources */,
5AD0FA7F1C73F2E2004BCEFF /* testappcast.xml in Resources */, 5AD0FA7F1C73F2E2004BCEFF /* testappcast.xml in Resources */,
@@ -3191,6 +3145,7 @@
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
725264A91D5FBD9100CD6400 /* Sparkle.strings in Resources */,
72EB87EC1CB8887E00C37F42 /* SUStatus.xib in Resources */, 72EB87EC1CB8887E00C37F42 /* SUStatus.xib in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
@@ -3268,7 +3223,7 @@
shellScript = "\"$SRCROOT/Configurations/set-git-version-info.sh\"\n"; shellScript = "\"$SRCROOT/Configurations/set-git-version-info.sh\"\n";
showEnvVarsInLog = 0; showEnvVarsInLog = 0;
}; };
72045CE626FEE8CC004F96E5 /* Strip Framework */ = { 72045CE626FEE8CC004F96E5 /* Strip XPC Services */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1; alwaysOutOfDate = 1;
buildActionMask = 2147483647; buildActionMask = 2147483647;
@@ -3278,14 +3233,14 @@
); );
inputPaths = ( inputPaths = (
); );
name = "Strip Framework"; name = "Strip XPC Services";
outputFileListPaths = ( outputFileListPaths = (
); );
outputPaths = ( outputPaths = (
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "\"$SRCROOT/Configurations/strip-framework.sh\"\n"; shellScript = "\"$SRCROOT/Configurations/strip-xpc-services.sh\"\n";
}; };
720B4C2125EBFAA5005A0592 /* Run Script: Link Tools */ = { 720B4C2125EBFAA5005A0592 /* Run Script: Link Tools */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
@@ -3347,12 +3302,6 @@
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
72266A8C29464D0200645376 /* SUSignatures.m in Sources */,
72266A8B29464CEA00645376 /* SUHost.m in Sources */,
72266A8A2946493C00645376 /* SUCodeSigningVerifier.m in Sources */,
72266A89294636FB00645376 /* SUStandardVersionComparator.m in Sources */,
72266A88294635BA00645376 /* SUAppcastDriver.m in Sources */,
72266A872946359600645376 /* SUFileManager.m in Sources */,
725EE488277D398100D820CE /* SPUDeltaArchive.m in Sources */, 725EE488277D398100D820CE /* SPUDeltaArchive.m in Sources */,
725EE483277C767A00D820CE /* SPUXarDeltaArchive.m in Sources */, 725EE483277C767A00D820CE /* SPUXarDeltaArchive.m in Sources */,
7269E4982648D3460088C213 /* SPUSkippedUpdate.m in Sources */, 7269E4982648D3460088C213 /* SPUSkippedUpdate.m in Sources */,
@@ -3474,6 +3423,7 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
724BB3731D31D0B7005D534A /* main.m in Sources */, 724BB3731D31D0B7005D534A /* main.m in Sources */,
72F9EC341D5BF542004AC8B6 /* SUFileManager.m in Sources */,
724BB3711D31D0B7005D534A /* SUInstallerConnection.m in Sources */, 724BB3711D31D0B7005D534A /* SUInstallerConnection.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
@@ -3483,6 +3433,7 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
724BB39A1D333832005D534A /* main.m in Sources */, 724BB39A1D333832005D534A /* main.m in Sources */,
72F9EC351D5BF54E004AC8B6 /* SUFileManager.m in Sources */,
724BB3981D333832005D534A /* SUInstallerStatus.m in Sources */, 724BB3981D333832005D534A /* SUInstallerStatus.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
@@ -3500,6 +3451,7 @@
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
72464F7E1E21ED8C00FB341C /* SUHost.m in Sources */, 72464F7E1E21ED8C00FB341C /* SUHost.m in Sources */,
72464F711E1F326A00FB341C /* SUOperatingSystem.m in Sources */,
726E07B41CAF08D6001A286B /* main.m in Sources */, 726E07B41CAF08D6001A286B /* main.m in Sources */,
721D8A7B1D4963190032E472 /* SPULocalCacheDirectory.m in Sources */, 721D8A7B1D4963190032E472 /* SPULocalCacheDirectory.m in Sources */,
7267E5E11D3D901600D1BF90 /* SPUMessageTypes.m in Sources */, 7267E5E11D3D901600D1BF90 /* SPUMessageTypes.m in Sources */,
@@ -3516,6 +3468,7 @@
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
72464F721E1F327C00FB341C /* SUOperatingSystem.m in Sources */,
723B5DA71CF7AB0100365F95 /* main.m in Sources */, 723B5DA71CF7AB0100365F95 /* main.m in Sources */,
72E539121D68C3FA0092CE5E /* SPUDownloadData.m in Sources */, 72E539121D68C3FA0092CE5E /* SPUDownloadData.m in Sources */,
723B5DA91CF7AB0100365F95 /* SPUDownloader.m in Sources */, 723B5DA91CF7AB0100365F95 /* SPUDownloader.m in Sources */,
@@ -3623,7 +3576,6 @@
72EF30C02675CF38008CE987 /* SPUAppcastItemStateResolver.m in Sources */, 72EF30C02675CF38008CE987 /* SPUAppcastItemStateResolver.m in Sources */,
61B5F8EE09C4CE3C00B25A18 /* SPUUpdater.m in Sources */, 61B5F8EE09C4CE3C00B25A18 /* SPUUpdater.m in Sources */,
720E217C1D0D00BF003A311C /* SPUUpdaterCycle.m in Sources */, 720E217C1D0D00BF003A311C /* SPUUpdaterCycle.m in Sources */,
72AEB1D529A1A74E0033883E /* SPUStandardVersionDisplay.m in Sources */,
726E078E1CA891E9001A286B /* SPUUpdaterSettings.m in Sources */, 726E078E1CA891E9001A286B /* SPUUpdaterSettings.m in Sources */,
721D588F25BE59F900D23BEA /* SUPhasedUpdateGroupInfo.m in Sources */, 721D588F25BE59F900D23BEA /* SUPhasedUpdateGroupInfo.m in Sources */,
72F9EC401D5E823F004AC8B6 /* SPUUpdaterTimer.m in Sources */, 72F9EC401D5E823F004AC8B6 /* SPUUpdaterTimer.m in Sources */,
@@ -3648,10 +3600,8 @@
61A225A50D1C4AC000430CCD /* SUStandardVersionComparator.m in Sources */, 61A225A50D1C4AC000430CCD /* SUStandardVersionComparator.m in Sources */,
727F340B2605321D00020E85 /* SULog+NSError.m in Sources */, 727F340B2605321D00020E85 /* SULog+NSError.m in Sources */,
EA1E287022B66621004AA304 /* SUSignatures.m in Sources */, EA1E287022B66621004AA304 /* SUSignatures.m in Sources */,
7286EE6028CEC84900163C1D /* SUPlainTextReleaseNotesView.m in Sources */,
6196CFFA09C72149000DC222 /* SUStatusController.m in Sources */, 6196CFFA09C72149000DC222 /* SUStatusController.m in Sources */,
72B3DECA1E23472200457642 /* SPUDownloadedUpdate.m in Sources */, 72B3DECA1E23472200457642 /* SPUDownloadedUpdate.m in Sources */,
72AEB1D929A1CB510033883E /* SPUNoUpdateFoundInfo.m in Sources */,
61A2279D0D1CEE7600430CCD /* SUSystemProfiler.m in Sources */, 61A2279D0D1CEE7600430CCD /* SUSystemProfiler.m in Sources */,
61B5FCDE09C52A9F00B25A18 /* SUUpdateAlert.m in Sources */, 61B5FCDE09C52A9F00B25A18 /* SUUpdateAlert.m in Sources */,
612DCBB00D488BC60015DBEA /* SUUpdatePermissionPrompt.m in Sources */, 612DCBB00D488BC60015DBEA /* SUUpdatePermissionPrompt.m in Sources */,
@@ -3660,7 +3610,7 @@
72F9EBE31D517E2F004AC8B6 /* SUUpdater.m in Sources */, 72F9EBE31D517E2F004AC8B6 /* SUUpdater.m in Sources */,
724BB3881D32A167005D534A /* SUXPCInstallerConnection.m in Sources */, 724BB3881D32A167005D534A /* SUXPCInstallerConnection.m in Sources */,
724BB3A91D33461B005D534A /* SUXPCInstallerStatus.m in Sources */, 724BB3A91D33461B005D534A /* SUXPCInstallerStatus.m in Sources */,
723AC011259DBDAA00BDB4FA /* SUReleaseNotesCommon.m in Sources */, 723AC011259DBDAA00BDB4FA /* SUWebViewCommon.m in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@@ -4168,7 +4118,7 @@
}; };
1DEB91AF08733DA50010E9CD /* Release */ = { 1DEB91AF08733DA50010E9CD /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 72A40F082956120D007C7DD5 /* ConfigFrameworkRelease.xcconfig */; baseConfigurationReference = FA1941D10D94A70100DD942E /* ConfigFramework.xcconfig */;
buildSettings = { buildSettings = {
}; };
name = Release; name = Release;
+9 -9
View File
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21208.1" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies> <dependencies>
<deployment identifier="macosx"/> <deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/> <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21208.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<objects> <objects>
<customObject id="-2" userLabel="File's Owner" customClass="SUUpdateAlert"> <customObject id="-2" userLabel="File's Owner" customClass="SUUpdateAlert">
<connections> <connections>
<outlet property="_automaticallyInstallUpdatesButton" destination="117" id="IBi-aO-qkM"/> <outlet property="automaticallyInstallUpdatesButton" destination="117" id="o2H-xw-Qv8"/>
<outlet property="_descriptionField" destination="101" id="JkK-Xy-kns"/> <outlet property="descriptionField" destination="101" id="9oA-2S-eXN"/>
<outlet property="_installButton" destination="76" id="GVS-sG-rgG"/> <outlet property="installButton" destination="76" id="176"/>
<outlet property="_laterButton" destination="22" id="dk6-u6-yYI"/> <outlet property="laterButton" destination="22" id="177"/>
<outlet property="_releaseNotesBoxView" destination="89" id="kwH-2g-hlh"/> <outlet property="releaseNotesBoxView" destination="89" id="FhX-K4-uzH"/>
<outlet property="_releaseNotesContainerView" destination="fKC-QA-GZa" id="j3k-Pl-zNb"/> <outlet property="releaseNotesContainerView" destination="fKC-QA-GZa" id="BYw-MA-Z5h"/>
<outlet property="_skipButton" destination="23" id="PPe-jC-Pvc"/> <outlet property="skipButton" destination="23" id="178"/>
<outlet property="window" destination="5" id="69"/> <outlet property="window" destination="5" id="69"/>
</connections> </connections>
</customObject> </customObject>
+20 -58
View File
@@ -8,17 +8,16 @@
<objects> <objects>
<customObject id="-2" userLabel="File's Owner" customClass="SUUpdatePermissionPrompt"> <customObject id="-2" userLabel="File's Owner" customClass="SUUpdatePermissionPrompt">
<connections> <connections>
<outlet property="_anonymousInfoDisclosureButton" destination="JW6-0z-Ud3" id="grm-Uj-KJs"/> <outlet property="anonymousInfoDisclosureButton" destination="JW6-0z-Ud3" id="8Ac-kJ-T5e"/>
<outlet property="_automaticallyDownloadUpdatesView" destination="37T-Ef-DtX" id="Ojd-zE-6Kd"/> <outlet property="cancelButton" destination="cFC-wV-H3j" id="L2P-Ux-4Vn"/>
<outlet property="_cancelButton" destination="cFC-wV-H3j" id="B1o-H0-cr1"/> <outlet property="checkButton" destination="sMh-ha-r7R" id="2O6-G4-etk"/>
<outlet property="_checkButton" destination="sMh-ha-r7R" id="2Oc-EC-EcG"/> <outlet property="infoChoiceView" destination="ov1-yV-Uol" id="A1X-Y9-Hnh"/>
<outlet property="_infoChoiceView" destination="ov1-yV-Uol" id="RSd-bn-7bu"/> <outlet property="moreInfoView" destination="39" id="127"/>
<outlet property="_moreInfoView" destination="39" id="ceJ-4H-FHd"/> <outlet property="placeholderHeightLayoutConstraint" destination="yis-HR-OIe" id="odJ-KG-SRB"/>
<outlet property="_placeholderHeightLayoutConstraint" destination="yis-HR-OIe" id="npL-hg-wRq"/> <outlet property="placeholderView" destination="AGr-V0-0al" id="piB-Wg-PJx"/>
<outlet property="_placeholderView" destination="AGr-V0-0al" id="UnQ-rl-QSS"/> <outlet property="promptView" destination="Yrl-Dt-Qvb" id="2a4-nD-uDx"/>
<outlet property="_promptView" destination="Yrl-Dt-Qvb" id="qbO-fw-1YD"/> <outlet property="responseView" destination="0CP-x7-YFK" id="fE5-5k-8Uf"/>
<outlet property="_responseView" destination="0CP-x7-YFK" id="AcW-Md-hSP"/> <outlet property="stackView" destination="qNw-uD-4Bg" id="DxM-SL-1Xl"/>
<outlet property="_stackView" destination="qNw-uD-4Bg" id="EIt-kn-pJ0"/>
<outlet property="window" destination="5" id="126"/> <outlet property="window" destination="5" id="126"/>
</connections> </connections>
</customObject> </customObject>
@@ -276,16 +275,17 @@ Gw
<point key="canvasLocation" x="-291" y="554"/> <point key="canvasLocation" x="-291" y="554"/>
</customView> </customView>
<customView id="ov1-yV-Uol" userLabel="Anonymous Info View"> <customView id="ov1-yV-Uol" userLabel="Anonymous Info View">
<rect key="frame" x="0.0" y="0.0" width="437" height="25"/> <rect key="frame" x="0.0" y="0.0" width="437" height="27"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews> <subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="a0k-dW-Jhx" userLabel="View"> <customView translatesAutoresizingMaskIntoConstraints="NO" id="a0k-dW-Jhx" userLabel="View">
<rect key="frame" x="0.0" y="-26" width="437" height="64"/> <rect key="frame" x="0.0" y="-26" width="437" height="66"/>
<subviews> <subviews>
<button focusRingType="none" translatesAutoresizingMaskIntoConstraints="NO" id="a90-Iq-FgS" userLabel="IncludeInfoButton"> <button focusRingType="none" translatesAutoresizingMaskIntoConstraints="NO" id="a90-Iq-FgS" userLabel="IncludeInfoButton">
<rect key="frame" x="104" y="25" width="200" height="16"/> <rect key="frame" x="104" y="25" width="313" height="16"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="14" id="STF-87-eYy"/> <constraint firstAttribute="height" constant="14" id="MvK-K5-kxt"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="14" id="STF-87-eYy"/>
</constraints> </constraints>
<buttonCell key="cell" type="check" title="Include anonymous system profile" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" state="on" focusRingType="none" inset="2" id="gz7-LM-gNf"> <buttonCell key="cell" type="check" title="Include anonymous system profile" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" state="on" focusRingType="none" inset="2" id="gz7-LM-gNf">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/> <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
@@ -321,12 +321,12 @@ Gw
</button> </button>
</subviews> </subviews>
<constraints> <constraints>
<constraint firstItem="JW6-0z-Ud3" firstAttribute="leading" secondItem="a0k-dW-Jhx" secondAttribute="leading" constant="85" id="6Y1-s7-g6r"/>
<constraint firstItem="a90-Iq-FgS" firstAttribute="centerY" secondItem="JW6-0z-Ud3" secondAttribute="centerY" id="BNJ-xV-faQ"/> <constraint firstItem="a90-Iq-FgS" firstAttribute="centerY" secondItem="JW6-0z-Ud3" secondAttribute="centerY" id="BNJ-xV-faQ"/>
<constraint firstItem="a90-Iq-FgS" firstAttribute="leading" secondItem="a0k-dW-Jhx" secondAttribute="leading" constant="105" id="ILg-Qu-R6M"/> <constraint firstItem="a90-Iq-FgS" firstAttribute="leading" secondItem="a0k-dW-Jhx" secondAttribute="leading" constant="105" id="ILg-Qu-R6M"/>
<constraint firstItem="a90-Iq-FgS" firstAttribute="top" secondItem="a0k-dW-Jhx" secondAttribute="top" constant="24" id="Mh6-5L-xqM"/> <constraint firstItem="a90-Iq-FgS" firstAttribute="top" secondItem="a0k-dW-Jhx" secondAttribute="top" constant="26" id="Mh6-5L-xqM"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="a90-Iq-FgS" secondAttribute="trailing" constant="20" id="U4G-Eh-HPu"/> <constraint firstAttribute="trailing" secondItem="a90-Iq-FgS" secondAttribute="trailing" constant="20" id="U4G-Eh-HPu"/>
<constraint firstItem="a90-Iq-FgS" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="JW6-0z-Ud3" secondAttribute="trailing" constant="4" id="axA-s0-uGg"/> <constraint firstItem="JW6-0z-Ud3" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="a0k-dW-Jhx" secondAttribute="leading" constant="20" symbolic="YES" id="V3P-iz-aJ9"/>
<constraint firstItem="a90-Iq-FgS" firstAttribute="leading" secondItem="JW6-0z-Ud3" secondAttribute="trailing" constant="4" id="axA-s0-uGg"/>
<constraint firstAttribute="width" constant="437" id="iUc-Zs-h9S"/> <constraint firstAttribute="width" constant="437" id="iUc-Zs-h9S"/>
<constraint firstAttribute="bottom" secondItem="a90-Iq-FgS" secondAttribute="bottom" constant="26" id="qij-uH-6Yl"/> <constraint firstAttribute="bottom" secondItem="a90-Iq-FgS" secondAttribute="bottom" constant="26" id="qij-uH-6Yl"/>
</constraints> </constraints>
@@ -338,45 +338,7 @@ Gw
<constraint firstAttribute="trailing" secondItem="a0k-dW-Jhx" secondAttribute="trailing" id="rAn-bJ-Mp6"/> <constraint firstAttribute="trailing" secondItem="a0k-dW-Jhx" secondAttribute="trailing" id="rAn-bJ-Mp6"/>
<constraint firstAttribute="bottom" secondItem="a0k-dW-Jhx" secondAttribute="bottom" constant="-26" id="xw5-bj-VOd"/> <constraint firstAttribute="bottom" secondItem="a0k-dW-Jhx" secondAttribute="bottom" constant="-26" id="xw5-bj-VOd"/>
</constraints> </constraints>
<point key="canvasLocation" x="-135.5" y="242.5"/> <point key="canvasLocation" x="-113" y="145.5"/>
</customView>
<customView id="37T-Ef-DtX" userLabel="Automatic Download View">
<rect key="frame" x="0.0" y="0.0" width="437" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="MEW-2n-kJE" userLabel="View">
<rect key="frame" x="0.0" y="-26" width="437" height="64"/>
<subviews>
<button focusRingType="none" translatesAutoresizingMaskIntoConstraints="NO" id="BId-kb-eYW" userLabel="automaticallyDownloadUpdatesButton">
<rect key="frame" x="104" y="25" width="248" height="16"/>
<constraints>
<constraint firstAttribute="height" constant="14" id="kJy-g7-0Un"/>
</constraints>
<buttonCell key="cell" type="check" title="Automatically download and install updates" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" focusRingType="none" inset="2" id="AUc-33-qGN">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="smallSystem"/>
</buttonCell>
<connections>
<binding destination="-2" name="value" keyPath="automaticallyDownloadUpdates" id="5Me-7t-mMu"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="BId-kb-eYW" firstAttribute="leading" secondItem="MEW-2n-kJE" secondAttribute="leading" constant="105" id="MnW-AM-QzP"/>
<constraint firstAttribute="bottom" secondItem="BId-kb-eYW" secondAttribute="bottom" constant="26" id="QXK-90-kUJ"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="BId-kb-eYW" secondAttribute="trailing" constant="20" id="Vk3-CH-cXd"/>
<constraint firstItem="BId-kb-eYW" firstAttribute="top" secondItem="MEW-2n-kJE" secondAttribute="top" constant="24" id="YrX-aL-LAq"/>
<constraint firstAttribute="width" constant="437" id="n4W-Z4-w9i"/>
</constraints>
</customView>
</subviews>
<constraints>
<constraint firstAttribute="bottom" secondItem="MEW-2n-kJE" secondAttribute="bottom" constant="-26" id="4iq-ZN-n9x"/>
<constraint firstItem="MEW-2n-kJE" firstAttribute="top" secondItem="37T-Ef-DtX" secondAttribute="top" constant="-13" id="FCe-KY-rHW"/>
<constraint firstItem="MEW-2n-kJE" firstAttribute="leading" secondItem="37T-Ef-DtX" secondAttribute="leading" id="dsv-fP-ffg"/>
<constraint firstAttribute="trailing" secondItem="MEW-2n-kJE" secondAttribute="trailing" id="puT-Df-xgH"/>
</constraints>
<point key="canvasLocation" x="-136" y="181"/>
</customView> </customView>
<customView hidden="YES" translatesAutoresizingMaskIntoConstraints="NO" id="AGr-V0-0al" userLabel="Placeholder View"> <customView hidden="YES" translatesAutoresizingMaskIntoConstraints="NO" id="AGr-V0-0al" userLabel="Placeholder View">
<rect key="frame" x="0.0" y="0.0" width="437" height="205"/> <rect key="frame" x="0.0" y="0.0" width="437" height="205"/>
-38
View File
@@ -28,44 +28,6 @@
<string>$(MACOSX_DEPLOYMENT_TARGET)</string> <string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>LSUIElement</key> <key>LSUIElement</key>
<string>1</string> <string>1</string>
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>ca</string>
<string>ar</string>
<string>cs</string>
<string>da</string>
<string>de</string>
<string>el</string>
<string>en</string>
<string>es</string>
<string>fa</string>
<string>fi</string>
<string>fr</string>
<string>he</string>
<string>hr</string>
<string>hu</string>
<string>is</string>
<string>it</string>
<string>ja</string>
<string>ko</string>
<string>nb</string>
<string>nl</string>
<string>pl</string>
<string>pt-BR</string>
<string>pt-PT</string>
<string>ro</string>
<string>ru</string>
<string>sk</string>
<string>sl</string>
<string>sv</string>
<string>th</string>
<string>tr</string>
<string>uk</string>
<string>zh_CN</string>
<string>zh_HK</string>
<string>zh_TW</string>
</array>
<key>NSPrincipalClass</key> <key>NSPrincipalClass</key>
<string>NSApplication</string> <string>NSApplication</string>
</dict> </dict>
+1 -1
View File
@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
@protocol InstallerProgressDelegate; @protocol InstallerProgressDelegate;
SPU_OBJC_DIRECT_MEMBERS @interface InstallerProgressAppController : NSObject <NSApplicationDelegate> @interface InstallerProgressAppController : NSObject <NSApplicationDelegate>
- (instancetype)initWithApplication:(NSApplication *)application arguments:(NSArray<NSString *> *)arguments delegate:(id<InstallerProgressDelegate>)delegate; - (instancetype)initWithApplication:(NSApplication *)application arguments:(NSArray<NSString *> *)arguments delegate:(id<InstallerProgressDelegate>)delegate;
+78 -69
View File
@@ -30,30 +30,44 @@
static const NSTimeInterval SUTerminationTimeDelay = 0.3; static const NSTimeInterval SUTerminationTimeDelay = 0.3;
@interface InstallerProgressAppController () <NSApplicationDelegate, SPUInstallerAgentProtocol> @interface InstallerProgressAppController () <NSApplicationDelegate, SPUInstallerAgentProtocol>
@property (nonatomic, readonly) NSApplication *application;
@property (nonatomic, weak) id<InstallerProgressDelegate> delegate;
@property (nonatomic, readonly) NSXPCConnection *connection;
@property (nonatomic) BOOL connected;
@property (nonatomic) BOOL repliedToRegistration;
@property (nonatomic, readonly) SUHost *oldHost;
@property (nonatomic, readonly) BOOL shouldRelaunchHostBundle;
@property (nonatomic, readonly) NSString *oldHostBundlePath;
@property (nonatomic, readonly) BOOL systemDomain;
@property (nonatomic) StatusInfo *statusInfo;
@property (nonatomic) BOOL submittedLauncherJob;
@property (nonatomic) BOOL willTerminate;
@property (nonatomic) BOOL applicationInitiallyAlive;
@property (nonatomic) NSBundle *applicationBundle;
@property (nonatomic) NSString *normalizedPath;
@end @end
#define CONNECTION_ACKNOWLEDGEMENT_TIMEOUT 7ull #define CONNECTION_ACKNOWLEDGEMENT_TIMEOUT 7ull
@implementation InstallerProgressAppController @implementation InstallerProgressAppController
{
NSApplication *_application; @synthesize application = _application;
NSXPCConnection *_connection; @synthesize delegate = _delegate;
SUHost *_oldHost; @synthesize connection = _connection;
NSString *_oldHostBundlePath; @synthesize connected = _connected;
StatusInfo *_statusInfo; @synthesize repliedToRegistration = _repliedToRegistration;
NSBundle *_applicationBundle; @synthesize oldHost = _oldHost;
NSString *_normalizedPath; @synthesize shouldRelaunchHostBundle = _shouldRelaunchHostBundle;
@synthesize oldHostBundlePath = _oldHostBundlePath;
__weak id<InstallerProgressDelegate> _delegate; @synthesize systemDomain = _systemDomain;
@synthesize statusInfo = _statusInfo;
BOOL _connected; @synthesize submittedLauncherJob = _submittedLauncherJob;
BOOL _repliedToRegistration; @synthesize willTerminate = _willTerminate;
BOOL _shouldRelaunchHostBundle; @synthesize applicationInitiallyAlive = _applicationInitiallyAlive;
BOOL _systemDomain; @synthesize applicationBundle = _applicationBundle;
BOOL _submittedLauncherJob; @synthesize normalizedPath = _normalizedPath;
BOOL _willTerminate;
BOOL _applicationInitiallyAlive;
}
- (instancetype)initWithApplication:(NSApplication *)application arguments:(NSArray<NSString *> *)arguments delegate:(id<InstallerProgressDelegate>)delegate - (instancetype)initWithApplication:(NSApplication *)application arguments:(NSArray<NSString *> *)arguments delegate:(id<InstallerProgressDelegate>)delegate
{ {
@@ -105,35 +119,30 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
_application = application; _application = application;
_delegate = delegate; _delegate = delegate;
[delegate loadLocalizationStringsFromHost:host];
_connection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SPUInstallerAgentProtocol)]; _connection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SPUInstallerAgentProtocol)];
_connection.exportedObject = self; _connection.exportedObject = self;
_connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerAgentInitiationProtocol)]; _connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerAgentInitiationProtocol)];
__weak __typeof__(self) weakSelf = self; __weak InstallerProgressAppController *weakSelf = self;
_connection.interruptionHandler = ^{ _connection.interruptionHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
__typeof__(self) strongSelf = weakSelf; [weakSelf.connection invalidate];
if (strongSelf != nil) {
[strongSelf->_connection invalidate];
}
}); });
}; };
_connection.invalidationHandler = ^{ _connection.invalidationHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
__typeof__(self) strongSelf = weakSelf; InstallerProgressAppController *strongSelf = weakSelf;
if (strongSelf != nil) { if (strongSelf != nil) {
int exitStatus = (strongSelf->_repliedToRegistration ? EXIT_SUCCESS : EXIT_FAILURE); int exitStatus = (strongSelf.repliedToRegistration ? EXIT_SUCCESS : EXIT_FAILURE);
NSError *registrationError; NSError *registrationError;
if (!strongSelf->_repliedToRegistration) { if (!strongSelf.repliedToRegistration) {
registrationError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAgentInvalidationError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Agent Invalidating without having the chance to reply to installer" }]; registrationError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUAgentInvalidationError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Agent Invalidating without having the chance to reply to installer" }];
} else { } else {
registrationError = nil; registrationError = nil;
} }
if (!strongSelf->_willTerminate) { if (!strongSelf.willTerminate) {
[strongSelf cleanupAndExitWithStatus:exitStatus error:registrationError]; [strongSelf cleanupAndExitWithStatus:exitStatus error:registrationError];
} }
} }
@@ -145,22 +154,22 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
- (void)run - (void)run
{ {
[_application run]; [self.application run];
} }
- (void)startConnection SPU_OBJC_DIRECT - (void)startConnection
{ {
[_statusInfo startListener]; [self.statusInfo startListener];
[_connection resume]; [self.connection resume];
[(id<SUInstallerAgentInitiationProtocol>)_connection.remoteObjectProxy connectionDidInitiateWithReply:^{ [(id<SUInstallerAgentInitiationProtocol>)self.connection.remoteObjectProxy connectionDidInitiateWithReply:^{
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
self->_connected = YES; self.connected = YES;
}); });
}]; }];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(CONNECTION_ACKNOWLEDGEMENT_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(CONNECTION_ACKNOWLEDGEMENT_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (!self->_connected) { if (!self.connected) {
SULog(SULogLevelError, @"Timeout error: failed to receive acknowledgement from installer"); SULog(SULogLevelError, @"Timeout error: failed to receive acknowledgement from installer");
[self cleanupAndExitWithStatus:EXIT_FAILURE error:nil]; [self cleanupAndExitWithStatus:EXIT_FAILURE error:nil];
} }
@@ -178,11 +187,11 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
SULog(SULogLevelError, @"Agent failed.."); SULog(SULogLevelError, @"Agent failed..");
SULogError(error); SULogError(error);
[(id<SUInstallerAgentInitiationProtocol>)_connection.remoteObjectProxy connectionWillInvalidateWithError:error]; [(id<SUInstallerAgentInitiationProtocol>)self.connection.remoteObjectProxy connectionWillInvalidateWithError:error];
} }
[_statusInfo invalidate]; [self.statusInfo invalidate];
[_connection invalidate]; [self.connection invalidate];
// Remove the agent bundle; it is assumed this bundle is in a temporary/cache/support directory // Remove the agent bundle; it is assumed this bundle is in a temporary/cache/support directory
NSError *theError = nil; NSError *theError = nil;
@@ -206,7 +215,7 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
exit(status); exit(status);
} }
- (NSArray<NSRunningApplication *> *)runningApplicationsWithBundle:(NSBundle *)bundle SPU_OBJC_DIRECT - (NSArray<NSRunningApplication *> *)runningApplicationsWithBundle:(NSBundle *)bundle
{ {
// Resolve symlinks otherwise when we compare file paths, we may not realize two paths that are represented differently are the same // Resolve symlinks otherwise when we compare file paths, we may not realize two paths that are represented differently are the same
NSArray<NSString *> *bundlePathComponents = bundle.bundlePath.stringByResolvingSymlinksInPath.pathComponents; NSArray<NSString *> *bundlePathComponents = bundle.bundlePath.stringByResolvingSymlinksInPath.pathComponents;
@@ -251,7 +260,7 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
- (void)registerApplicationBundlePath:(NSString *)applicationBundlePath reply:(void (^)(NSNumber *))reply - (void)registerApplicationBundlePath:(NSString *)applicationBundlePath reply:(void (^)(NSNumber *))reply
{ {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if (applicationBundlePath != nil && !self->_willTerminate) { if (applicationBundlePath != nil && !self.willTerminate) {
NSBundle *applicationBundle = [NSBundle bundleWithPath:applicationBundlePath]; NSBundle *applicationBundle = [NSBundle bundleWithPath:applicationBundlePath];
if (applicationBundle == nil) { if (applicationBundle == nil) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SUAgentInvalidationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Error: Encountered invalid path for waiting termination: %@", applicationBundlePath] }]]; [self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SUAgentInvalidationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Error: Encountered invalid path for waiting termination: %@", applicationBundlePath] }]];
@@ -260,12 +269,12 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
// Compute normalized path that we may use later for relaunching the application // Compute normalized path that we may use later for relaunching the application
// We compute normalized path from progress agent instead of trusting or having the installer // We compute normalized path from progress agent instead of trusting or having the installer
// pass it to us // pass it to us
if (SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME && [applicationBundle.bundlePath isEqualToString:self->_oldHostBundlePath]) { if (SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME && [applicationBundle.bundlePath isEqualToString:self.oldHostBundlePath]) {
NSString *normalizedPath = SUNormalizedInstallationPath(self->_oldHost); NSString *normalizedPath = SUNormalizedInstallationPath(self.oldHost);
// We only use normalized path if it doesn't already exist // We only use normalized path if it doesn't already exist
// Check the installer which has the same logic // Check the installer which has the same logic
if (![[NSFileManager defaultManager] fileExistsAtPath:normalizedPath]) { if (![[NSFileManager defaultManager] fileExistsAtPath:normalizedPath]) {
self->_normalizedPath = SUNormalizedInstallationPath(self->_oldHost); self.normalizedPath = SUNormalizedInstallationPath(self.oldHost);
} }
} }
@@ -282,9 +291,9 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
reply(processIdentifier); reply(processIdentifier);
self->_repliedToRegistration = YES; self.repliedToRegistration = YES;
self->_applicationBundle = applicationBundle; self.applicationBundle = applicationBundle;
self->_applicationInitiallyAlive = (processIdentifier != nil); self.applicationInitiallyAlive = (processIdentifier != nil);
} else { } else {
assert(false); assert(false);
} }
@@ -294,12 +303,12 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
- (void)registerInstallationInfoData:(NSData *)installationInfoData - (void)registerInstallationInfoData:(NSData *)installationInfoData
{ {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if (self->_statusInfo.installationInfoData == nil && installationInfoData != nil) { if (self.statusInfo.installationInfoData == nil && installationInfoData != nil) {
SPUInstallationInfo *installationInfo = (SPUInstallationInfo *)SPUUnarchiveRootObjectSecurely(installationInfoData, [SPUInstallationInfo class]); SPUInstallationInfo *installationInfo = (SPUInstallationInfo *)SPUUnarchiveRootObjectSecurely(installationInfoData, [SPUInstallationInfo class]);
if (installationInfo != nil) { if (installationInfo != nil) {
installationInfo.systemDomain = self->_systemDomain; installationInfo.systemDomain = self.systemDomain;
self->_statusInfo.installationInfoData = SPUArchiveRootObjectSecurely(installationInfo); self.statusInfo.installationInfoData = SPUArchiveRootObjectSecurely(installationInfo);
} else { } else {
SULog(SULogLevelError, @"Error: Failed to decode initial installation info from installer: %@", installationInfoData); SULog(SULogLevelError, @"Error: Failed to decode initial installation info from installer: %@", installationInfoData);
} }
@@ -310,9 +319,9 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
- (void)sendTerminationSignal - (void)sendTerminationSignal
{ {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if (!self->_willTerminate && self->_applicationBundle != nil) { if (!self.willTerminate && self.applicationBundle != nil) {
// Note we are sending an Apple quit event, which gives the application or user a chance to delay or cancel the request, which is what we desire // Note we are sending an Apple quit event, which gives the application or user a chance to delay or cancel the request, which is what we desire
for (NSRunningApplication *runningApplication in [self runningApplicationsWithBundle:self->_applicationBundle]) { for (NSRunningApplication *runningApplication in [self runningApplicationsWithBundle:self.applicationBundle]) {
[runningApplication terminate]; [runningApplication terminate];
} }
} }
@@ -322,15 +331,15 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
- (void)relaunchApplication - (void)relaunchApplication
{ {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if (!self->_willTerminate && self->_applicationBundle != nil && self->_applicationInitiallyAlive) { if (!self.willTerminate && self.applicationBundle != nil && self.applicationInitiallyAlive) {
NSString *pathToRelaunch; NSString *pathToRelaunch;
if (self->_normalizedPath != nil) { if (self.normalizedPath != nil) {
pathToRelaunch = self->_normalizedPath; pathToRelaunch = self.normalizedPath;
} else if (self->_shouldRelaunchHostBundle) { } else if (self.shouldRelaunchHostBundle) {
// Use self->_oldHostBundlePath because it was computed before self->_oldHost could have been removed // Use self.oldHostBundlePath because it was computed before self.oldHost could have been removed
pathToRelaunch = self->_oldHostBundlePath; pathToRelaunch = self.oldHostBundlePath;
} else { } else {
pathToRelaunch = self->_applicationBundle.bundlePath; pathToRelaunch = self.applicationBundle.bundlePath;
} }
// We should at least make sure we're opening a bundle // We should at least make sure we're opening a bundle
@@ -347,7 +356,7 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
// Delay termination for a little bit to better increase the chance the updated application when relaunched will be the frontmost application // Delay termination for a little bit to better increase the chance the updated application when relaunched will be the frontmost application
// This is related to macOS activation issues when terminating a frontmost application happens right before launching another app // This is related to macOS activation issues when terminating a frontmost application happens right before launching another app
self->_willTerminate = YES; self.willTerminate = YES;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(SUTerminationTimeDelay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(SUTerminationTimeDelay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self cleanupAndExitWithStatus:EXIT_SUCCESS error:nil]; [self cleanupAndExitWithStatus:EXIT_SUCCESS error:nil];
}); });
@@ -358,18 +367,18 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
- (void)showProgress - (void)showProgress
{ {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
if (!self->_willTerminate) { if (!self.willTerminate) {
// Show app icon in the dock // Show app icon in the dock
ProcessSerialNumber psn = { 0, kCurrentProcess }; ProcessSerialNumber psn = { 0, kCurrentProcess };
TransformProcessType(&psn, kProcessTransformToForegroundApplication); TransformProcessType(&psn, kProcessTransformToForegroundApplication);
// Note: the application icon needs to be set after showing the icon in the dock // Note: the application icon needs to be set after showing the icon in the dock
self->_application.applicationIconImage = [SUApplicationInfo bestIconForHost:self->_oldHost]; self.application.applicationIconImage = [SUApplicationInfo bestIconForHost:self.oldHost];
// Activate ourselves otherwise we will probably be in the background // Activate ourselves otherwise we will probably be in the background
[self->_application activateIgnoringOtherApps:YES]; [self.application activateIgnoringOtherApps:YES];
[self->_delegate installerProgressShouldDisplayWithHost:self->_oldHost]; [self.delegate installerProgressShouldDisplayWithHost:self.oldHost];
} }
}); });
} }
@@ -378,13 +387,13 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
{ {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
// Dismiss any UI immediately // Dismiss any UI immediately
[self->_delegate installerProgressShouldStop]; [self.delegate installerProgressShouldStop];
self->_delegate = nil; self.delegate = nil;
// No need to broadcast status service anymore // No need to broadcast status service anymore
// In fact we shouldn't when we decide to relaunch the update // In fact we shouldn't when we decide to relaunch the update
[self->_statusInfo invalidate]; [self.statusInfo invalidate];
self->_statusInfo = nil; self.statusInfo = nil;
}); });
} }
-1
View File
@@ -14,7 +14,6 @@ NS_ASSUME_NONNULL_BEGIN
@protocol InstallerProgressDelegate <NSObject> @protocol InstallerProgressDelegate <NSObject>
- (void)loadLocalizationStringsFromHost:(SUHost *)host;
- (void)installerProgressShouldDisplayWithHost:(SUHost *)host; - (void)installerProgressShouldDisplayWithHost:(SUHost *)host;
- (void)installerProgressShouldStop; - (void)installerProgressShouldStop;
+14 -86
View File
@@ -12,101 +12,29 @@
#import "SUHost.h" #import "SUHost.h"
#import "SULocalizations.h" #import "SULocalizations.h"
@implementation ShowInstallerProgress @interface ShowInstallerProgress ()
{
SUStatusController *_statusController;
NSString *_updatingString;
NSString *_cancelUpdateTitle;
NSString *_installingUpdateTitle;
}
- (void)loadLocalizationStringsFromHost:(SUHost *)host @property (nonatomic) SUStatusController *statusController;
{
// Try to retrieve localization strings from the old bundle if possible @end
// We won't display these strings until installerProgressShouldDisplayWithHost:
// (which will be after the update is trusted) @implementation ShowInstallerProgress
// If we fail to load localizations in any way, we default to English
@synthesize statusController = _statusController;
#if SPARKLE_COPY_LOCALIZATIONS
NSBundle *hostSparkleBundle;
{
NSURL *hostSparkleURL = [host.bundle.privateFrameworksURL URLByAppendingPathComponent:@"Sparkle.framework" isDirectory:YES];
if (hostSparkleURL == nil) {
hostSparkleBundle = nil;
} else {
hostSparkleBundle = [NSBundle bundleWithURL:hostSparkleURL];
}
}
#endif
NSString *updatingString;
{
NSString *hostNameFromBundle = host.name;
NSString *hostName = (hostNameFromBundle != nil) ? hostNameFromBundle : @"";
#if SPARKLE_COPY_LOCALIZATIONS
{
NSString *updatingFormatStringFromBundle = (hostSparkleBundle != nil) ? SULocalizedStringFromTableInBundle(@"Updating %@", @"Sparkle", hostSparkleBundle, nil) : nil;
if (updatingFormatStringFromBundle != nil) {
// Replacing the %@ will be a bit safer than using +[NSString stringWithFormat:]
updatingString = [updatingFormatStringFromBundle stringByReplacingOccurrencesOfString:@"%@" withString:hostName];
} else {
updatingString = [@"Updating " stringByAppendingString:hostName];
}
}
#else
{
updatingString = [@"Updating " stringByAppendingString:hostName];
}
#endif
}
_updatingString = updatingString;
NSString *cancelUpdateTitle;
#if SPARKLE_COPY_LOCALIZATIONS
{
NSString *cancelUpdateTitleFromBundle = (hostSparkleBundle != nil) ? SULocalizedStringFromTableInBundle(@"Cancel Update", @"Sparkle", hostSparkleBundle, @"") : nil;
cancelUpdateTitle = (cancelUpdateTitleFromBundle != nil) ? cancelUpdateTitleFromBundle : @"Cancel Update";
}
#else
{
cancelUpdateTitle = @"Cancel Update";
}
#endif
_cancelUpdateTitle = cancelUpdateTitle;
NSString *installingUpdateTitle;
#if SPARKLE_COPY_LOCALIZATIONS
{
NSString *installingUpdateTitleFromBundle = (hostSparkleBundle != nil) ? SULocalizedStringFromTableInBundle(@"Installing update…", @"Sparkle", hostSparkleBundle, @"") : nil;
installingUpdateTitle = (installingUpdateTitleFromBundle != nil) ? installingUpdateTitleFromBundle : @"Installing update…";
}
#else
{
installingUpdateTitle = @"Installing update…";
}
#endif
_installingUpdateTitle = installingUpdateTitle;
}
- (void)installerProgressShouldDisplayWithHost:(SUHost *)host - (void)installerProgressShouldDisplayWithHost:(SUHost *)host
{ {
_statusController = [[SUStatusController alloc] initWithHost:host windowTitle:_updatingString centerPointValue:nil minimizable:NO closable:NO]; self.statusController = [[SUStatusController alloc] initWithHost:host centerPointValue:nil minimizable:NO closable:NO];
[_statusController setButtonTitle:_cancelUpdateTitle target:nil action:nil isDefault:NO]; [self.statusController setButtonTitle:SULocalizedString(@"Cancel Update", @"") target:nil action:nil isDefault:NO];
[self.statusController beginActionWithTitle:SULocalizedString(@"Installing update…", @"") maxProgressValue:0 statusText:@""];
[_statusController beginActionWithTitle:_installingUpdateTitle maxProgressValue:0 statusText:@""]; [self.statusController showWindow:self];
[_statusController showWindow:self];
} }
- (void)installerProgressShouldStop - (void)installerProgressShouldStop
{ {
[_statusController close]; [self.statusController close];
_statusController = nil; self.statusController = nil;
} }
@end @end
+1 -1
View File
@@ -11,7 +11,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
// Appcast Item state that contains properties that depends on a host // Appcast Item state that contains properties that depends on a host
SPU_OBJC_DIRECT_MEMBERS @interface SPUAppcastItemState : NSObject @interface SPUAppcastItemState : NSObject
- (instancetype)init NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE;
+5 -5
View File
@@ -48,11 +48,11 @@
- (void)encodeWithCoder:(NSCoder *)encoder - (void)encodeWithCoder:(NSCoder *)encoder
{ {
[encoder encodeBool:_majorUpgrade forKey:SPUAppcastItemStateMajorUpgradeKey]; [encoder encodeBool:self.majorUpgrade forKey:SPUAppcastItemStateMajorUpgradeKey];
[encoder encodeBool:_criticalUpdate forKey:SPUAppcastItemStateCriticalUpdateKey]; [encoder encodeBool:self.criticalUpdate forKey:SPUAppcastItemStateCriticalUpdateKey];
[encoder encodeBool:_informationalUpdate forKey:SPUAppcastItemStateInformationalUpdateKey]; [encoder encodeBool:self.informationalUpdate forKey:SPUAppcastItemStateInformationalUpdateKey];
[encoder encodeBool:_minimumOperatingSystemVersionIsOK forKey:SPUAppcastItemStateMinimumOperatingSystemVersionIsOKKey]; [encoder encodeBool:self.minimumOperatingSystemVersionIsOK forKey:SPUAppcastItemStateMinimumOperatingSystemVersionIsOKKey];
[encoder encodeBool:_maximumOperatingSystemVersionIsOK forKey:SPUAppcastItemStateMaximumOperatingSystemVersionIsOKKey]; [encoder encodeBool:self.maximumOperatingSystemVersionIsOK forKey:SPUAppcastItemStateMaximumOperatingSystemVersionIsOKKey];
} }
- (instancetype)initWithCoder:(NSCoder *)decoder - (instancetype)initWithCoder:(NSCoder *)decoder
-8
View File
@@ -8,15 +8,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#if defined(BUILDING_SPARKLE_SOURCES_EXTERNALLY)
// Ignore incorrect warning
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
#import "SUExport.h"
#pragma clang diagnostic pop
#else
#import <Sparkle/SUExport.h> #import <Sparkle/SUExport.h>
#endif
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
+18 -11
View File
@@ -17,12 +17,19 @@
#include "AppKitPrevention.h" #include "AppKitPrevention.h"
@interface SPUAppcastItemStateResolver ()
@property (nonatomic, readonly) NSString *hostVersion;
@property (nonatomic, readonly) id<SUVersionComparison> applicationVersionComparator;
@property (nonatomic, readonly) SUStandardVersionComparator *standardVersionComparator;
@end
@implementation SPUAppcastItemStateResolver @implementation SPUAppcastItemStateResolver
{
NSString *_hostVersion; @synthesize hostVersion = _hostVersion;
id<SUVersionComparison> _applicationVersionComparator; @synthesize applicationVersionComparator = _applicationVersionComparator;
SUStandardVersionComparator *_standardVersionComparator; @synthesize standardVersionComparator = _standardVersionComparator;
}
- (instancetype)initWithHostVersion:(NSString *)hostVersion applicationVersionComparator:(id<SUVersionComparison>)applicationVersionComparator standardVersionComparator:(SUStandardVersionComparator *)standardVersionComparator - (instancetype)initWithHostVersion:(NSString *)hostVersion applicationVersionComparator:(id<SUVersionComparison>)applicationVersionComparator standardVersionComparator:(SUStandardVersionComparator *)standardVersionComparator
{ {
@@ -39,7 +46,7 @@
{ {
BOOL minimumVersionOK = YES; BOOL minimumVersionOK = YES;
if (minimumSystemVersion != nil && ![minimumSystemVersion isEqualToString:@""]) { if (minimumSystemVersion != nil && ![minimumSystemVersion isEqualToString:@""]) {
minimumVersionOK = [_standardVersionComparator compareVersion:(NSString * _Nonnull)minimumSystemVersion toVersion:[SUOperatingSystem systemVersionString]] != NSOrderedDescending; minimumVersionOK = [self.standardVersionComparator compareVersion:(NSString * _Nonnull)minimumSystemVersion toVersion:[SUOperatingSystem systemVersionString]] != NSOrderedDescending;
} }
return minimumVersionOK; return minimumVersionOK;
} }
@@ -48,7 +55,7 @@
{ {
BOOL maximumVersionOK = YES; BOOL maximumVersionOK = YES;
if (maximumSystemVersion != nil && ![maximumSystemVersion isEqualToString:@""]) { if (maximumSystemVersion != nil && ![maximumSystemVersion isEqualToString:@""]) {
maximumVersionOK = [_standardVersionComparator compareVersion:(NSString * _Nonnull)maximumSystemVersion toVersion:[SUOperatingSystem systemVersionString]] != NSOrderedAscending; maximumVersionOK = [self.standardVersionComparator compareVersion:(NSString * _Nonnull)maximumSystemVersion toVersion:[SUOperatingSystem systemVersionString]] != NSOrderedAscending;
} }
return maximumVersionOK; return maximumVersionOK;
} }
@@ -60,7 +67,7 @@
- (BOOL)isMinimumAutoupdateVersionOK:(NSString * _Nullable)minimumAutoupdateVersion - (BOOL)isMinimumAutoupdateVersionOK:(NSString * _Nullable)minimumAutoupdateVersion
{ {
return [[self class] isMinimumAutoupdateVersionOK:minimumAutoupdateVersion hostVersion:_hostVersion versionComparator:_applicationVersionComparator]; return [[self class] isMinimumAutoupdateVersionOK:minimumAutoupdateVersion hostVersion:self.hostVersion versionComparator:self.applicationVersionComparator];
} }
- (BOOL)isCriticalUpdateWithCriticalUpdateDictionary:(NSDictionary * _Nullable)criticalUpdateDictionary - (BOOL)isCriticalUpdateWithCriticalUpdateDictionary:(NSDictionary * _Nullable)criticalUpdateDictionary
@@ -77,7 +84,7 @@
} }
// Update is only critical when coming from previous versions // Update is only critical when coming from previous versions
return ([_applicationVersionComparator compareVersion:_hostVersion toVersion:criticalVersion] == NSOrderedAscending); return ([self.applicationVersionComparator compareVersion:self.hostVersion toVersion:criticalVersion] == NSOrderedAscending);
} }
- (BOOL)isInformationalUpdateWithInformationalUpdateVersions:(NSSet<NSString *> * _Nullable)informationalUpdateVersions - (BOOL)isInformationalUpdateWithInformationalUpdateVersions:(NSSet<NSString *> * _Nullable)informationalUpdateVersions
@@ -91,7 +98,7 @@
return YES; return YES;
} }
NSString *hostVersion = _hostVersion; NSString *hostVersion = self.hostVersion;
// Informational update only for a set of host versions we're updating from // Informational update only for a set of host versions we're updating from
if ([informationalUpdateVersions containsObject:hostVersion]) { if ([informationalUpdateVersions containsObject:hostVersion]) {
@@ -101,7 +108,7 @@
// If an informational update version has a '<' prefix, this is an informational update if // If an informational update version has a '<' prefix, this is an informational update if
// hostVersion < this info update version // hostVersion < this info update version
for (NSString *informationalUpdateVersion in informationalUpdateVersions) { for (NSString *informationalUpdateVersion in informationalUpdateVersions) {
if ([informationalUpdateVersion hasPrefix:@"<"] && [_applicationVersionComparator compareVersion:hostVersion toVersion:[informationalUpdateVersion substringFromIndex:1]] == NSOrderedAscending) { if ([informationalUpdateVersion hasPrefix:@"<"] && [self.applicationVersionComparator compareVersion:hostVersion toVersion:[informationalUpdateVersion substringFromIndex:1]] == NSOrderedAscending) {
return YES; return YES;
} }
} }
+1 -1
View File
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
@class SUHost; @class SUHost;
@protocol SPUUpdaterDelegate, SPUUserDriver; @protocol SPUUpdaterDelegate, SPUUserDriver;
SPU_OBJC_DIRECT_MEMBERS @interface SPUAutomaticUpdateDriver : NSObject <SPUUpdateDriver> @interface SPUAutomaticUpdateDriver : NSObject <SPUUpdateDriver>
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate; - (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate;
+29 -27
View File
@@ -20,19 +20,24 @@
#include "AppKitPrevention.h" #include "AppKitPrevention.h"
@interface SPUAutomaticUpdateDriver () <SPUCoreBasedUpdateDriverDelegate> @interface SPUAutomaticUpdateDriver () <SPUCoreBasedUpdateDriverDelegate>
@property (nonatomic, readonly, weak) id updater;
@property (nonatomic, readonly, weak) id<SPUUserDriver> userDriver;
@property (nonatomic, readonly, weak, nullable) id updaterDelegate;
@property (nonatomic, readonly) SPUCoreBasedUpdateDriver *coreDriver;
@property (nonatomic) SUAppcastItem* updateItem;
@property (nonatomic) BOOL willInstallSilently;
@end @end
@implementation SPUAutomaticUpdateDriver @implementation SPUAutomaticUpdateDriver
{
SPUCoreBasedUpdateDriver *_coreDriver; @synthesize updater = _updater;
SUAppcastItem* _updateItem; @synthesize userDriver = _userDriver;
@synthesize updaterDelegate = _updaterDelegate;
__weak id _updater; @synthesize coreDriver = _coreDriver;
__weak id<SPUUserDriver> _userDriver; @synthesize updateItem = _updateItem;
__weak id _updaterDelegate; @synthesize willInstallSilently = _willInstallSilently;
BOOL _willInstallSilently;
}
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate - (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle updater:(id)updater userDriver:(id <SPUUserDriver>)userDriver updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate
{ {
@@ -49,7 +54,7 @@
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock - (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock
{ {
[_coreDriver setCompletionHandler:completionBlock]; [self.coreDriver setCompletionHandler:completionBlock];
} }
- (void)setUpdateShownHandler:(void (^)(void))updateShownHandler - (void)setUpdateShownHandler:(void (^)(void))updateShownHandler
@@ -58,12 +63,12 @@
- (void)setUpdateWillInstallHandler:(void (^)(void))updateWillInstallHandler - (void)setUpdateWillInstallHandler:(void (^)(void))updateWillInstallHandler
{ {
[_coreDriver setUpdateWillInstallHandler:updateWillInstallHandler]; [self.coreDriver setUpdateWillInstallHandler:updateWillInstallHandler];
} }
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders - (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders
{ {
[_coreDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:YES requiresSilentInstall:YES]; [self.coreDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:YES requiresSilentInstall:YES];
} }
- (void)resumeInstallingUpdate - (void)resumeInstallingUpdate
@@ -80,13 +85,13 @@
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem - (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem
{ {
_updateItem = updateItem; self.updateItem = updateItem;
if (updateItem.isInformationOnlyUpdate || updateItem.majorUpgrade) { if (updateItem.isInformationOnlyUpdate || updateItem.majorUpgrade) {
[_coreDriver deferInformationalUpdate:updateItem secondaryUpdate:secondaryUpdateItem]; [self.coreDriver deferInformationalUpdate:updateItem secondaryUpdate:secondaryUpdateItem];
[self abortUpdate]; [self abortUpdate];
} else { } else {
[_coreDriver downloadUpdateFromAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem inBackground:YES]; [self.coreDriver downloadUpdateFromAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem inBackground:YES];
} }
} }
@@ -97,19 +102,16 @@
- (void)installerDidFinishPreparationAndWillInstallImmediately:(BOOL)willInstallImmediately silently:(BOOL)willInstallSilently - (void)installerDidFinishPreparationAndWillInstallImmediately:(BOOL)willInstallImmediately silently:(BOOL)willInstallSilently
{ {
_willInstallSilently = willInstallSilently; self.willInstallSilently = willInstallSilently;
if (!willInstallImmediately) { if (!willInstallImmediately) {
BOOL installationHandledByDelegate = NO; BOOL installationHandledByDelegate = NO;
id<SPUUpdaterDelegate> updaterDelegate = _updaterDelegate; id<SPUUpdaterDelegate> updaterDelegate = self.updaterDelegate;
if (_willInstallSilently && [updaterDelegate respondsToSelector:@selector(updater:willInstallUpdateOnQuit:immediateInstallationBlock:)]) { if (self.willInstallSilently && [updaterDelegate respondsToSelector:@selector(updater:willInstallUpdateOnQuit:immediateInstallationBlock:)]) {
__weak __typeof__(self) weakSelf = self; __weak SPUAutomaticUpdateDriver *weakSelf = self;
installationHandledByDelegate = [updaterDelegate updater:_updater willInstallUpdateOnQuit:_updateItem immediateInstallationBlock:^{ installationHandledByDelegate = [updaterDelegate updater:self.updater willInstallUpdateOnQuit:self.updateItem immediateInstallationBlock:^{
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
__typeof__(self) strongSelf = weakSelf; [weakSelf.coreDriver finishInstallationWithResponse:SPUUserUpdateChoiceInstall displayingUserInterface:NO];
if (strongSelf != nil) {
[strongSelf->_coreDriver finishInstallationWithResponse:SPUUserUpdateChoiceInstall displayingUserInterface:NO];
}
}); });
}]; }];
} }
@@ -139,9 +141,9 @@
- (void)abortUpdateWithError:(NSError *)error - (void)abortUpdateWithError:(NSError *)error
{ {
BOOL showNextUpdateImmediately = (error == nil || error.code == SUInstallationAuthorizeLaterError) && (!_willInstallSilently || _updateItem.criticalUpdate || _updateItem.isInformationOnlyUpdate); BOOL showNextUpdateImmediately = (error == nil || error.code == SUInstallationAuthorizeLaterError) && (!self.willInstallSilently || self.updateItem.criticalUpdate || self.updateItem.isInformationOnlyUpdate);
[_coreDriver abortUpdateAndShowNextUpdateImmediately:showNextUpdateImmediately error:error]; [self.coreDriver abortUpdateAndShowNextUpdateImmediately:showNextUpdateImmediately error:error];
} }
@end @end
+1 -1
View File
@@ -27,7 +27,7 @@ NS_ASSUME_NONNULL_BEGIN
@end @end
SPU_OBJC_DIRECT_MEMBERS @interface SPUBasicUpdateDriver : NSObject @interface SPUBasicUpdateDriver : NSObject
- (instancetype)initWithHost:(SUHost *)host updateCheck:(SPUUpdateCheck)updateCheck updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id <SPUBasicUpdateDriverDelegate>)delegate; - (instancetype)initWithHost:(SUHost *)host updateCheck:(SPUUpdateCheck)updateCheck updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id <SPUBasicUpdateDriverDelegate>)delegate;
+80 -94
View File
@@ -19,32 +19,35 @@
#import "SPUAppcastItemState.h" #import "SPUAppcastItemState.h"
#import "SUAppcastItem+Private.h" #import "SUAppcastItem+Private.h"
#import "SPUInstallationType.h" #import "SPUInstallationType.h"
#import "SUVersionDisplayProtocol.h"
#import "SPUStandardVersionDisplay.h"
#import "SPUNoUpdateFoundInfo.h"
#include "AppKitPrevention.h" #include "AppKitPrevention.h"
@interface SPUBasicUpdateDriver () <SUAppcastDriverDelegate> @interface SPUBasicUpdateDriver () <SUAppcastDriverDelegate>
@property (nonatomic, weak, readonly) id<SPUBasicUpdateDriverDelegate> delegate;
@property (nonatomic, readonly) SUAppcastDriver *appcastDriver;
@property (nonatomic, copy) SPUUpdateDriverCompletion completionBlock;
@property (nonatomic, readonly) SUHost *host;
@property (nonatomic, readonly) SPUUpdateCheck updateCheck;
@property (nonatomic, readonly, weak) id updater; // if we didn't have legacy support, I'd remove this..
@property (nullable, nonatomic, readonly, weak) id <SPUUpdaterDelegate>updaterDelegate;
@property (nonatomic) BOOL aborted;
@end @end
@implementation SPUBasicUpdateDriver @implementation SPUBasicUpdateDriver
{
SUAppcastDriver *_appcastDriver; @synthesize host = _host;
SUHost *_host; @synthesize updateCheck = _updateCheck;
@synthesize updater = _updater;
SPUUpdateDriverCompletion _completionBlock; @synthesize updaterDelegate = _updaterDelegate;
@synthesize delegate = _delegate;
SPUUpdateCheck _updateCheck; @synthesize appcastDriver = _appcastDriver;
@synthesize completionBlock = _completionBlock;
__weak id _updater; @synthesize aborted = _aborted;
__weak id <SPUUpdaterDelegate> _updaterDelegate;
__weak id<SPUBasicUpdateDriverDelegate> _delegate;
BOOL _aborted;
}
- (instancetype)initWithHost:(SUHost *)host updateCheck:(SPUUpdateCheck)updateCheck updater:(id)updater updaterDelegate:(id <SPUUpdaterDelegate>)updaterDelegate delegate:(id <SPUBasicUpdateDriverDelegate>)delegate - (instancetype)initWithHost:(SUHost *)host updateCheck:(SPUUpdateCheck)updateCheck updater:(id)updater updaterDelegate:(id <SPUUpdaterDelegate>)updaterDelegate delegate:(id <SPUBasicUpdateDriverDelegate>)delegate
{ {
@@ -63,31 +66,27 @@
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock - (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock
{ {
_completionBlock = [completionBlock copy]; self.completionBlock = completionBlock;
} }
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background - (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background
{ {
if ([_host isRunningOnReadOnlyVolume]) { if ([self.host isRunningOnReadOnlyVolume]) {
NSString *hostName = _host.name; NSString *hostName = self.host.name;
id<SPUBasicUpdateDriverDelegate> delegate = _delegate; if ([self.host isRunningTranslocated]) {
#if SPARKLE_COPY_LOCALIZATIONS [self.delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURunningTranslocated userInfo:@{ NSLocalizedRecoverySuggestionErrorKey: [NSString stringWithFormat:SULocalizedString(@"Quit %1$@, move it into your Applications folder, relaunch it from there and try again.", nil), hostName], NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedString(@"%1$@ can’t be updated if it’s running from the location it was downloaded to.", nil), hostName], }]];
NSBundle *sparkleBundle = SUSparkleBundle();
#endif
if ([_host isRunningTranslocated]) {
[delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURunningTranslocated userInfo:@{ NSLocalizedRecoverySuggestionErrorKey: [NSString stringWithFormat:SULocalizedStringFromTableInBundle(@"Quit %1$@, move it into your Applications folder, relaunch it from there and try again.", SPARKLE_TABLE, sparkleBundle, nil), hostName], NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedStringFromTableInBundle(@"%1$@ can’t be updated if it’s running from the location it was downloaded to.", SPARKLE_TABLE, sparkleBundle, nil), hostName], }]];
} else { } else {
[delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURunningFromDiskImageError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedStringFromTableInBundle(@"%1$@ can’t be updated, because it was opened from a read-only or a temporary location.", SPARKLE_TABLE, sparkleBundle, nil), hostName], NSLocalizedRecoverySuggestionErrorKey: [NSString stringWithFormat:SULocalizedStringFromTableInBundle(@"Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again.", SPARKLE_TABLE, sparkleBundle, nil), hostName] }]]; [self.delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURunningFromDiskImageError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedString(@"%1$@ can’t be updated, because it was opened from a read-only or a temporary location.", nil), hostName], NSLocalizedRecoverySuggestionErrorKey: [NSString stringWithFormat:SULocalizedString(@"Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again.", nil), hostName] }]];
} }
} else { } else {
[_appcastDriver loadAppcastFromURL:appcastURL userAgent:userAgent httpHeaders:httpHeaders inBackground:background]; [self.appcastDriver loadAppcastFromURL:appcastURL userAgent:userAgent httpHeaders:httpHeaders inBackground:background];
} }
} }
- (void)notifyResumableUpdateItem:(SUAppcastItem *)updateItem secondaryUpdateItem:(SUAppcastItem * _Nullable)secondaryUpdateItem systemDomain:(NSNumber * _Nullable)systemDomain SPU_OBJC_DIRECT - (void)notifyResumableUpdateItem:(SUAppcastItem *)updateItem secondaryUpdateItem:(SUAppcastItem * _Nullable)secondaryUpdateItem systemDomain:(NSNumber * _Nullable)systemDomain
{ {
if (updateItem == nil) { if (updateItem == nil) {
[_delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUResumeAppcastError userInfo:@{ NSLocalizedDescriptionKey: SULocalizedStringFromTableInBundle(@"Failed to resume installing update.", SPARKLE_TABLE, SUSparkleBundle(), nil) }]]; [self.delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUResumeAppcastError userInfo:@{ NSLocalizedDescriptionKey: SULocalizedString(@"Failed to resume installing update.", nil) }]];
} else { } else {
// Kind of lying, but triggering the notification so drivers can know when to stop showing initial fetching progress // Kind of lying, but triggering the notification so drivers can know when to stop showing initial fetching progress
[self notifyFinishLoadingAppcast]; [self notifyFinishLoadingAppcast];
@@ -99,7 +98,7 @@
- (void)resumeInstallingUpdate - (void)resumeInstallingUpdate
{ {
NSString *hostBundleIdentifier = _host.bundle.bundleIdentifier; NSString *hostBundleIdentifier = self.host.bundle.bundleIdentifier;
assert(hostBundleIdentifier != nil); assert(hostBundleIdentifier != nil);
[SPUProbeInstallStatus probeInstallerUpdateItemForHostBundleIdentifier:hostBundleIdentifier completion:^(SPUInstallationInfo * _Nullable installationInfo) { [SPUProbeInstallStatus probeInstallerUpdateItemForHostBundleIdentifier:hostBundleIdentifier completion:^(SPUInstallationInfo * _Nullable installationInfo) {
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
@@ -115,66 +114,57 @@
- (void)didFailToFetchAppcastWithError:(NSError *)error - (void)didFailToFetchAppcastWithError:(NSError *)error
{ {
if (!_aborted) { if (!self.aborted) {
[_delegate basicDriverIsRequestingAbortUpdateWithError:error]; [self.delegate basicDriverIsRequestingAbortUpdateWithError:error];
} }
} }
- (void)notifyFinishLoadingAppcast SPU_OBJC_DIRECT - (void)notifyFinishLoadingAppcast
{ {
id<SPUBasicUpdateDriverDelegate> delegate = _delegate; if ([self.delegate respondsToSelector:@selector(basicDriverDidFinishLoadingAppcast)]) {
if ([delegate respondsToSelector:@selector(basicDriverDidFinishLoadingAppcast)]) { [self.delegate basicDriverDidFinishLoadingAppcast];
[delegate basicDriverDidFinishLoadingAppcast];
} }
} }
- (void)didFinishLoadingAppcast:(SUAppcast *)appcast - (void)didFinishLoadingAppcast:(SUAppcast *)appcast
{ {
if (!_aborted) { if (!self.aborted) {
id <SPUUpdaterDelegate> updaterDelegate = _updaterDelegate; if ([self.updaterDelegate respondsToSelector:@selector((updater:didFinishLoadingAppcast:))]) {
if ([updaterDelegate respondsToSelector:@selector((updater:didFinishLoadingAppcast:))]) { [self.updaterDelegate updater:self.updater didFinishLoadingAppcast:appcast];
[updaterDelegate updater:_updater didFinishLoadingAppcast:appcast];
} }
[self notifyFinishLoadingAppcast]; [self notifyFinishLoadingAppcast];
} }
} }
- (void)notifyFoundValidUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem systemDomain:(NSNumber * _Nullable)systemDomain resuming:(BOOL)resuming SPU_OBJC_DIRECT - (void)notifyFoundValidUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem systemDomain:(NSNumber * _Nullable)systemDomain resuming:(BOOL)resuming
{ {
if (!_aborted) { if (!self.aborted) {
id<SPUBasicUpdateDriverDelegate> delegate = _delegate;
id <SPUUpdaterDelegate> updaterDelegate = _updaterDelegate;
id updater = _updater;
if (!resuming) { if (!resuming) {
#if SPARKLE_BUILD_PACKAGE_SUPPORT
// interactive pkg based updates are not supported under root user // interactive pkg based updates are not supported under root user
if ([updateItem.installationType isEqualToString:SPUInstallationTypeInteractivePackage] && geteuid() == 0) { if ([updateItem.installationType isEqualToString:SPUInstallationTypeInteractivePackage] && geteuid() == 0) {
[delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationRootInteractiveError userInfo:@{ NSLocalizedDescriptionKey: SULocalizedStringFromTableInBundle(@"Interactive based packages cannot be installed as the root user.", SPARKLE_TABLE, SUSparkleBundle(), nil) }]]; [self.delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationRootInteractiveError userInfo:@{ NSLocalizedDescriptionKey: SULocalizedString(@"Interactive based packages cannot be installed as the root user.", nil) }]];
return; return;
} else } else {
#endif
{
// Give the delegate a chance to bail // Give the delegate a chance to bail
NSError *shouldNotProceedError = nil; NSError *shouldNotProceedError = nil;
if ([updaterDelegate respondsToSelector:@selector(updater:shouldProceedWithUpdate:updateCheck:error:)] && ![updaterDelegate updater:updater shouldProceedWithUpdate:updateItem updateCheck:_updateCheck error:&shouldNotProceedError]) { if ([self.updaterDelegate respondsToSelector:@selector(updater:shouldProceedWithUpdate:updateCheck:error:)] && ![self.updaterDelegate updater:self.updater shouldProceedWithUpdate:updateItem updateCheck:self.updateCheck error:&shouldNotProceedError]) {
[delegate basicDriverIsRequestingAbortUpdateWithError:shouldNotProceedError]; [self.delegate basicDriverIsRequestingAbortUpdateWithError:shouldNotProceedError];
return; return;
} }
} }
} }
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidFindValidUpdateNotification [[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidFindValidUpdateNotification
object:updater object:self.updater
userInfo:@{ SUUpdaterAppcastItemNotificationKey: updateItem }]; userInfo:@{ SUUpdaterAppcastItemNotificationKey: updateItem }];
if ([updaterDelegate respondsToSelector:@selector((updater:didFindValidUpdate:))]) { if ([self.updaterDelegate respondsToSelector:@selector((updater:didFindValidUpdate:))]) {
[updaterDelegate updater:updater didFindValidUpdate:updateItem]; [self.updaterDelegate updater:self.updater didFindValidUpdate:updateItem];
} }
[delegate basicDriverDidFindUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem systemDomain:systemDomain]; [self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem systemDomain:systemDomain];
} }
} }
@@ -185,27 +175,26 @@
- (void)didNotFindUpdateWithLatestAppcastItem:(nullable SUAppcastItem *)latestAppcastItem hostToLatestAppcastItemComparisonResult:(NSComparisonResult)hostToLatestAppcastItemComparisonResult background:(BOOL)background - (void)didNotFindUpdateWithLatestAppcastItem:(nullable SUAppcastItem *)latestAppcastItem hostToLatestAppcastItemComparisonResult:(NSComparisonResult)hostToLatestAppcastItemComparisonResult background:(BOOL)background
{ {
if (!_aborted) { if (!self.aborted) {
NSString *localizedDescription; NSString *localizedDescription;
NSString *recoverySuggestion;
#if SPARKLE_COPY_LOCALIZATIONS
NSBundle *sparkleBundle = SUSparkleBundle();
#else
NSBundle *sparkleBundle = nil;
#endif
SPUNoUpdateFoundReason reason; SPUNoUpdateFoundReason reason;
if (latestAppcastItem != nil) { if (latestAppcastItem != nil) {
switch (hostToLatestAppcastItemComparisonResult) { switch (hostToLatestAppcastItemComparisonResult) {
case NSOrderedDescending: case NSOrderedDescending:
// This means the user is a 'newer than latest' version. give a slight hint to the user instead of wrongly claiming this version is identical to the latest feed version. // This means the user is a 'newer than latest' version. give a slight hint to the user instead of wrongly claiming this version is identical to the latest feed version.
localizedDescription = SULocalizedStringFromTableInBundle(@"You’re up-to-date!", SPARKLE_TABLE, sparkleBundle, "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates."); localizedDescription = SULocalizedString(@"You’re up-to-date!", "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates.");
recoverySuggestion = [NSString stringWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.\n(You are currently running version %@.)", nil), [self.host name], latestAppcastItem.displayVersionString, [self.host displayVersion]];
reason = SPUNoUpdateFoundReasonOnNewerThanLatestVersion; reason = SPUNoUpdateFoundReasonOnNewerThanLatestVersion;
break; break;
case NSOrderedSame: case NSOrderedSame:
// No new update is available and we're on the latest // No new update is available and we're on the latest
localizedDescription = SULocalizedStringFromTableInBundle(@"You’re up-to-date!", SPARKLE_TABLE, sparkleBundle, "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates."); localizedDescription = SULocalizedString(@"You’re up-to-date!", "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates.");
recoverySuggestion = [NSString stringWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.", nil), [self.host name], [self.host displayVersion]];
reason = SPUNoUpdateFoundReasonOnLatestVersion; reason = SPUNoUpdateFoundReasonOnLatestVersion;
break; break;
@@ -213,16 +202,22 @@
// A new update is available but cannot be installed // A new update is available but cannot be installed
if (!latestAppcastItem.minimumOperatingSystemVersionIsOK) { if (!latestAppcastItem.minimumOperatingSystemVersionIsOK) {
localizedDescription = SULocalizedStringFromTableInBundle(@"Your macOS version is too old", SPARKLE_TABLE, sparkleBundle, nil); localizedDescription = SULocalizedString(@"Your macOS version is too old", nil);
recoverySuggestion = [NSString stringWithFormat:SULocalizedString(@"%1$@ %2$@ is available but your macOS version is too old to install it. At least macOS %3$@ is required.", nil), [self.host name], latestAppcastItem.displayVersionString, latestAppcastItem.minimumSystemVersion];
reason = SPUNoUpdateFoundReasonSystemIsTooOld; reason = SPUNoUpdateFoundReasonSystemIsTooOld;
} else if (!latestAppcastItem.maximumOperatingSystemVersionIsOK) { } else if (!latestAppcastItem.maximumOperatingSystemVersionIsOK) {
localizedDescription = SULocalizedStringFromTableInBundle(@"Your macOS version is too new", SPARKLE_TABLE, sparkleBundle, nil); localizedDescription = SULocalizedString(@"Your macOS version is too new", nil);
recoverySuggestion = [NSString stringWithFormat:SULocalizedString(@"%1$@ %2$@ is available but your macOS version is too new for this update. This update only supports up to macOS %3$@.", nil), [self.host name], latestAppcastItem.displayVersionString, latestAppcastItem.maximumSystemVersion];
reason = SPUNoUpdateFoundReasonSystemIsTooNew; reason = SPUNoUpdateFoundReasonSystemIsTooNew;
} else { } else {
// We shouldn't realistically get here // We shouldn't realistically get here
localizedDescription = SULocalizedStringFromTableInBundle(@"You’re up-to-date!", SPARKLE_TABLE, sparkleBundle, "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates."); localizedDescription = SULocalizedString(@"You’re up-to-date!", "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates.");
recoverySuggestion = [NSString stringWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.", nil), [self.host name], [self.host displayVersion]];
reason = SPUNoUpdateFoundReasonUnknown; reason = SPUNoUpdateFoundReasonUnknown;
} }
@@ -233,17 +228,13 @@
// We will need to assume the user is up to date if the feed doen't have any applicable update items // We will need to assume the user is up to date if the feed doen't have any applicable update items
// There could be update items on channels the updater is not subscribed to for example. But we can't tell the user about them. // There could be update items on channels the updater is not subscribed to for example. But we can't tell the user about them.
// There could also only be update items available for other platforms or none at all. // There could also only be update items available for other platforms or none at all.
localizedDescription = SULocalizedStringFromTableInBundle(@"You’re up-to-date!", SPARKLE_TABLE, sparkleBundle, "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates."); localizedDescription = SULocalizedString(@"You’re up-to-date!", "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates.");
recoverySuggestion = [NSString stringWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.", nil), [self.host name], [self.host displayVersion]];
reason = SPUNoUpdateFoundReasonOnLatestVersion; reason = SPUNoUpdateFoundReasonOnLatestVersion;
} }
// We use the standard version displayer here to construct a reason string, NSString *recoveryOption = SULocalizedString(@"OK", nil);
// but it's possible for the user driver to override this before displaying if they wish
id<SUVersionDisplay> versionDisplayer = [SPUStandardVersionDisplay standardVersionDisplay];
NSString *recoverySuggestion = SPUNoUpdateFoundRecoverySuggestion(reason, latestAppcastItem, _host, versionDisplayer, sparkleBundle);
NSString *recoveryOption = SULocalizedStringFromTableInBundle(@"OK", SPARKLE_TABLE, sparkleBundle, nil);
NSMutableDictionary *userInfo = NSMutableDictionary *userInfo =
[NSMutableDictionary dictionaryWithDictionary:@{ [NSMutableDictionary dictionaryWithDictionary:@{
@@ -264,31 +255,26 @@
code:SUNoUpdateError code:SUNoUpdateError
userInfo:[userInfo copy]]; userInfo:[userInfo copy]];
id <SPUUpdaterDelegate> updaterDelegate = _updaterDelegate; if ([self.updaterDelegate respondsToSelector:@selector((updaterDidNotFindUpdate:error:))]) {
id updater = _updater; [self.updaterDelegate updaterDidNotFindUpdate:self.updater error:notFoundError];
} else if ([self.updaterDelegate respondsToSelector:@selector((updaterDidNotFindUpdate:))]) {
if (updater != nil) { [self.updaterDelegate updaterDidNotFindUpdate:self.updater];
if ([updaterDelegate respondsToSelector:@selector((updaterDidNotFindUpdate:error:))]) {
[updaterDelegate updaterDidNotFindUpdate:updater error:notFoundError];
} else if ([updaterDelegate respondsToSelector:@selector((updaterDidNotFindUpdate:))]) {
[updaterDelegate updaterDidNotFindUpdate:updater];
}
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidNotFindUpdateNotification object:updater userInfo:userInfo];
} }
[_delegate basicDriverIsRequestingAbortUpdateWithError:notFoundError]; [[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidNotFindUpdateNotification object:self.updater userInfo:userInfo];
[self.delegate basicDriverIsRequestingAbortUpdateWithError:notFoundError];
} }
} }
- (void)abortUpdateAndShowNextUpdateImmediately:(BOOL)shouldShowUpdateImmediately resumableUpdate:(id<SPUResumableUpdate> _Nullable)resumableUpdate error:(nullable NSError *)error - (void)abortUpdateAndShowNextUpdateImmediately:(BOOL)shouldShowUpdateImmediately resumableUpdate:(id<SPUResumableUpdate> _Nullable)resumableUpdate error:(nullable NSError *)error
{ {
_aborted = YES; self.aborted = YES;
[_appcastDriver cleanup:^{ [self.appcastDriver cleanup:^{
if (self->_completionBlock != nil) { if (self.completionBlock != nil) {
self->_completionBlock(shouldShowUpdateImmediately, resumableUpdate, error); self.completionBlock(shouldShowUpdateImmediately, resumableUpdate, error);
self->_completionBlock = nil; self.completionBlock = nil;
} }
}]; }];
} }
+1 -1
View File
@@ -46,7 +46,7 @@ NS_ASSUME_NONNULL_BEGIN
@end @end
SPU_OBJC_DIRECT_MEMBERS @interface SPUCoreBasedUpdateDriver : NSObject @interface SPUCoreBasedUpdateDriver : NSObject
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle updateCheck:(SPUUpdateCheck)updateCheck updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SPUCoreBasedUpdateDriverDelegate>)delegate; - (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle updateCheck:(SPUUpdateCheck)updateCheck updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SPUCoreBasedUpdateDriverDelegate>)delegate;
+124 -130
View File
@@ -27,28 +27,43 @@
#include "AppKitPrevention.h" #include "AppKitPrevention.h"
@interface SPUCoreBasedUpdateDriver () <SPUBasicUpdateDriverDelegate, SPUDownloadDriverDelegate, SPUInstallerDriverDelegate> @interface SPUCoreBasedUpdateDriver () <SPUBasicUpdateDriverDelegate, SPUDownloadDriverDelegate, SPUInstallerDriverDelegate>
@property (nonatomic, readonly) SPUBasicUpdateDriver *basicDriver;
@property (nonatomic) SPUDownloadDriver *downloadDriver;
@property (nonatomic, readonly) SPUInstallerDriver *installerDriver;
@property (nonatomic, weak, readonly) id<SPUCoreBasedUpdateDriverDelegate> delegate;
@property (nonatomic) SUAppcastItem *updateItem;
@property (nonatomic, nullable) SUAppcastItem *secondaryUpdateItem;
@property (nonatomic) id<SPUResumableUpdate> resumableUpdate;
@property (nonatomic) SPUDownloadedUpdate *downloadedUpdateForRemoval;
@property (nonatomic, readonly) SUHost *host;
@property (nonatomic) BOOL resumingInstallingUpdate;
@property (nonatomic) BOOL silentInstall;
@property (nonatomic, readonly, weak) id updater; // if we didn't have legacy support, I'd remove this..
@property (nullable, nonatomic, readonly, weak) id <SPUUpdaterDelegate>updaterDelegate;
@property (nonatomic) NSString *userAgent;
@property (nonatomic, nullable) NSDictionary *httpHeaders;
@end @end
@implementation SPUCoreBasedUpdateDriver @implementation SPUCoreBasedUpdateDriver
{
SPUBasicUpdateDriver *_basicDriver; @synthesize basicDriver = _basicDriver;
SPUDownloadDriver *_downloadDriver; @synthesize downloadDriver = _downloadDriver;
SPUInstallerDriver *_installerDriver; @synthesize installerDriver = _installerDriver;
SUAppcastItem *_updateItem; @synthesize delegate = _delegate;
SUAppcastItem * _Nullable _secondaryUpdateItem; @synthesize updateItem = _updateItem;
id<SPUResumableUpdate> _resumableUpdate; @synthesize secondaryUpdateItem = _secondaryUpdateItem;
SPUDownloadedUpdate *_downloadedUpdateForRemoval; @synthesize host = _host;
SUHost *_host; @synthesize resumingInstallingUpdate = _resumingInstallingUpdate;
NSString *_userAgent; @synthesize silentInstall = _silentInstall;
NSDictionary * _Nullable _httpHeaders; @synthesize updater = _updater;
@synthesize updaterDelegate = _updaterDelegate;
__weak id _updater; // if we didn't have legacy support, I'd remove this.. @synthesize userAgent = _userAgent;
__weak id <SPUUpdaterDelegate> _updaterDelegate; @synthesize httpHeaders = _httpHeaders;
__weak id<SPUCoreBasedUpdateDriverDelegate> _delegate; @synthesize resumableUpdate = _resumableUpdate;
@synthesize downloadedUpdateForRemoval = _downloadedUpdateForRemoval;
BOOL _resumingInstallingUpdate;
BOOL _silentInstall;
}
- (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle updateCheck:(SPUUpdateCheck)updateCheck updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SPUCoreBasedUpdateDriverDelegate>)delegate - (instancetype)initWithHost:(SUHost *)host applicationBundle:(NSBundle *)applicationBundle updateCheck:(SPUUpdateCheck)updateCheck updater:(id)updater updaterDelegate:(nullable id <SPUUpdaterDelegate>)updaterDelegate delegate:(id<SPUCoreBasedUpdateDriverDelegate>)delegate
{ {
@@ -71,95 +86,90 @@
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock - (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock
{ {
[_basicDriver setCompletionHandler:completionBlock]; [self.basicDriver setCompletionHandler:completionBlock];
} }
- (void)setUpdateWillInstallHandler:(void (^)(void))updateWillInstallHandler - (void)setUpdateWillInstallHandler:(void (^)(void))updateWillInstallHandler
{ {
[_installerDriver setUpdateWillInstallHandler:updateWillInstallHandler]; [self.installerDriver setUpdateWillInstallHandler:updateWillInstallHandler];
} }
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background requiresSilentInstall:(BOOL)silentInstall - (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background requiresSilentInstall:(BOOL)silentInstall
{ {
_userAgent = [userAgent copy]; self.userAgent = userAgent;
_httpHeaders = httpHeaders; self.httpHeaders = httpHeaders;
_silentInstall = silentInstall; self.silentInstall = silentInstall;
[_basicDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:background]; [self.basicDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:background];
} }
- (void)resumeInstallingUpdate - (void)resumeInstallingUpdate
{ {
_resumingInstallingUpdate = YES; self.resumingInstallingUpdate = YES;
_silentInstall = NO; self.silentInstall = NO;
[_basicDriver resumeInstallingUpdate]; [self.basicDriver resumeInstallingUpdate];
} }
- (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate - (void)resumeUpdate:(id<SPUResumableUpdate>)resumableUpdate
{ {
_resumableUpdate = resumableUpdate; self.resumableUpdate = resumableUpdate;
_silentInstall = NO; self.silentInstall = NO;
[_basicDriver resumeUpdate:resumableUpdate]; [self.basicDriver resumeUpdate:resumableUpdate];
} }
- (void)basicDriverDidFinishLoadingAppcast - (void)basicDriverDidFinishLoadingAppcast
{ {
id<SPUCoreBasedUpdateDriverDelegate> delegate = _delegate; if ([self.delegate respondsToSelector:@selector(basicDriverDidFinishLoadingAppcast)]) {
if ([delegate respondsToSelector:@selector(basicDriverDidFinishLoadingAppcast)]) { [self.delegate basicDriverDidFinishLoadingAppcast];
[delegate basicDriverDidFinishLoadingAppcast];
} }
} }
- (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem systemDomain:(NSNumber * _Nullable)systemDomain - (void)basicDriverDidFindUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem systemDomain:(NSNumber * _Nullable)systemDomain
{ {
_updateItem = updateItem; self.updateItem = updateItem;
_secondaryUpdateItem = secondaryUpdateItem; self.secondaryUpdateItem = secondaryUpdateItem;
if (_resumingInstallingUpdate) { if (self.resumingInstallingUpdate) {
assert(systemDomain != nil); assert(systemDomain != nil);
[_installerDriver resumeInstallingUpdateWithUpdateItem:updateItem systemDomain:systemDomain.boolValue]; [self.installerDriver resumeInstallingUpdateWithUpdateItem:updateItem systemDomain:systemDomain.boolValue];
} }
[_delegate basicDriverDidFindUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem]; [self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem];
} }
- (void)downloadUpdateFromAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem inBackground:(BOOL)background SPU_OBJC_DIRECT - (void)downloadUpdateFromAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem inBackground:(BOOL)background
{ {
_downloadDriver = [[SPUDownloadDriver alloc] initWithUpdateItem:updateItem secondaryUpdateItem:secondaryUpdateItem host:_host userAgent:_userAgent httpHeaders:_httpHeaders inBackground:background delegate:self]; self.downloadDriver = [[SPUDownloadDriver alloc] initWithUpdateItem:updateItem secondaryUpdateItem:secondaryUpdateItem host:self.host userAgent:self.userAgent httpHeaders:self.httpHeaders inBackground:background delegate:self];
id updater = _updater; if ([self.updaterDelegate respondsToSelector:@selector((updater:willDownloadUpdate:withRequest:))]) {
id<SPUUpdaterDelegate> updaterDelegate = _updaterDelegate; [self.updaterDelegate updater:self.updater
willDownloadUpdate:updateItem
if (updater != nil && [updaterDelegate respondsToSelector:@selector((updater:willDownloadUpdate:withRequest:))]) { withRequest:self.downloadDriver.request];
[updaterDelegate updater:updater willDownloadUpdate:updateItem withRequest:_downloadDriver.request];
} }
[_downloadDriver downloadFile]; [self.downloadDriver downloadFile];
} }
- (void)downloadDriverWillBeginDownload - (void)downloadDriverWillBeginDownload
{ {
id<SPUCoreBasedUpdateDriverDelegate> delegate = _delegate; if ([self.delegate respondsToSelector:@selector(downloadDriverWillBeginDownload)]) {
if ([delegate respondsToSelector:@selector(downloadDriverWillBeginDownload)]) { [self.delegate downloadDriverWillBeginDownload];
[delegate downloadDriverWillBeginDownload];
} }
} }
- (void)downloadDriverDidReceiveExpectedContentLength:(uint64_t)expectedContentLength - (void)downloadDriverDidReceiveExpectedContentLength:(uint64_t)expectedContentLength
{ {
id<SPUCoreBasedUpdateDriverDelegate> delegate = _delegate; if ([self.delegate respondsToSelector:@selector(downloadDriverDidReceiveExpectedContentLength:)]) {
if ([delegate respondsToSelector:@selector(downloadDriverDidReceiveExpectedContentLength:)]) { [self.delegate downloadDriverDidReceiveExpectedContentLength:expectedContentLength];
[delegate downloadDriverDidReceiveExpectedContentLength:expectedContentLength];
} }
} }
- (void)downloadDriverDidReceiveDataOfLength:(uint64_t)length - (void)downloadDriverDidReceiveDataOfLength:(uint64_t)length
{ {
id<SPUCoreBasedUpdateDriverDelegate> delegate = _delegate; if ([self.delegate respondsToSelector:@selector(downloadDriverDidReceiveDataOfLength:)]) {
if ([delegate respondsToSelector:@selector(downloadDriverDidReceiveDataOfLength:)]) { [self.delegate downloadDriverDidReceiveDataOfLength:length];
[delegate downloadDriverDidReceiveDataOfLength:length];
} }
} }
@@ -169,80 +179,73 @@
// We could restrict this to when the appcast was downloaded in the background, // We could restrict this to when the appcast was downloaded in the background,
// but it shouldn't matter. // but it shouldn't matter.
if (downloadedUpdate.updateItem.phasedRolloutInterval != nil) { if (downloadedUpdate.updateItem.phasedRolloutInterval != nil) {
[SUPhasedUpdateGroupInfo setNewUpdateGroupIdentifierForHost:_host]; [SUPhasedUpdateGroupInfo setNewUpdateGroupIdentifierForHost:self.host];
} }
id updater = _updater; if ([self.updaterDelegate respondsToSelector:@selector(updater:didDownloadUpdate:)]) {
id<SPUUpdaterDelegate> updaterDelegate = _updaterDelegate; [self.updaterDelegate updater:self.updater didDownloadUpdate:self.updateItem];
if (updater != nil && [updaterDelegate respondsToSelector:@selector(updater:didDownloadUpdate:)]) {
[updaterDelegate updater:updater didDownloadUpdate:_updateItem];
} }
_resumableUpdate = downloadedUpdate; self.resumableUpdate = downloadedUpdate;
[self extractUpdate:downloadedUpdate]; [self extractUpdate:downloadedUpdate];
} }
- (void)deferInformationalUpdate:(SUAppcastItem *)updateItem secondaryUpdate:(SUAppcastItem * _Nullable)secondaryUpdateItem - (void)deferInformationalUpdate:(SUAppcastItem *)updateItem secondaryUpdate:(SUAppcastItem * _Nullable)secondaryUpdateItem
{ {
_resumableUpdate = [[SPUInformationalUpdate alloc] initWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem]; self.resumableUpdate = [[SPUInformationalUpdate alloc] initWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem];
} }
- (void)extractDownloadedUpdate - (void)extractDownloadedUpdate
{ {
assert(_resumableUpdate != nil); assert(self.resumableUpdate != nil);
[self extractUpdate:_resumableUpdate]; [self extractUpdate:self.resumableUpdate];
} }
- (void)clearDownloadedUpdate - (void)clearDownloadedUpdate
{ {
id<NSObject> downloadedUpdateObject = (_resumableUpdate != nil) ? _resumableUpdate : _downloadedUpdateForRemoval; id<NSObject> downloadedUpdateObject = (self.resumableUpdate != nil) ? self.resumableUpdate : self.downloadedUpdateForRemoval;
assert(downloadedUpdateObject != nil); assert(downloadedUpdateObject != nil);
if (downloadedUpdateObject != nil && [downloadedUpdateObject isKindOfClass:[SPUDownloadedUpdate class]]) { if (downloadedUpdateObject != nil && [downloadedUpdateObject isKindOfClass:[SPUDownloadedUpdate class]]) {
if (_downloadDriver == nil) { if (self.downloadDriver == nil) {
_downloadDriver = [[SPUDownloadDriver alloc] initWithHost:_host]; self.downloadDriver = [[SPUDownloadDriver alloc] initWithHost:self.host];
} }
SPUDownloadedUpdate *downloadedUpdate = (SPUDownloadedUpdate *)downloadedUpdateObject; SPUDownloadedUpdate *downloadedUpdate = (SPUDownloadedUpdate *)downloadedUpdateObject;
[_downloadDriver removeDownloadedUpdate:downloadedUpdate]; [self.downloadDriver removeDownloadedUpdate:downloadedUpdate];
} }
// Clear any type of resumable update // Clear any type of resumable update
_resumableUpdate = nil; self.resumableUpdate = nil;
} }
- (void)extractUpdate:(SPUDownloadedUpdate *)downloadedUpdate SPU_OBJC_DIRECT - (void)extractUpdate:(SPUDownloadedUpdate *)downloadedUpdate
{ {
id updater = _updater; if ([self.updaterDelegate respondsToSelector:@selector(updater:willExtractUpdate:)]) {
id<SPUUpdaterDelegate> updaterDelegate = _updaterDelegate; [self.updaterDelegate updater:self.updater willExtractUpdate:self.updateItem];
if (updater != nil && [updaterDelegate respondsToSelector:@selector(updater:willExtractUpdate:)]) {
[updaterDelegate updater:updater willExtractUpdate:_updateItem];
} }
// Now we have to extract the downloaded archive. // Now we have to extract the downloaded archive.
id<SPUCoreBasedUpdateDriverDelegate> delegate = _delegate; if ([self.delegate respondsToSelector:@selector(coreDriverDidStartExtractingUpdate)]) {
if ([delegate respondsToSelector:@selector(coreDriverDidStartExtractingUpdate)]) { [self.delegate coreDriverDidStartExtractingUpdate];
[delegate coreDriverDidStartExtractingUpdate];
} }
[_installerDriver extractDownloadedUpdate:downloadedUpdate silently:_silentInstall completion:^(NSError * _Nullable error) { [self.installerDriver extractDownloadedUpdate:downloadedUpdate silently:self.silentInstall completion:^(NSError * _Nullable error) {
if (error != nil) { if (error != nil) {
if (error.code != SUInstallationAuthorizeLaterError) { if (error.code != SUInstallationAuthorizeLaterError) {
[self clearDownloadedUpdate]; [self clearDownloadedUpdate];
} }
[self->_delegate coreDriverIsRequestingAbortUpdateWithError:error]; [self.delegate coreDriverIsRequestingAbortUpdateWithError:error];
} else { } else {
// If the installer started properly, we can't use the downloaded update archive anymore // If the installer started properly, we can't use the downloaded update archive anymore
// Especially if the installer fails later and we try resuming the update with a missing archive file // Especially if the installer fails later and we try resuming the update with a missing archive file
// We must clear the download after the installer begins using it however (in -installerDidStartInstalling) // We must clear the download after the installer begins using it however (in -installerDidStartInstalling)
self->_downloadedUpdateForRemoval = downloadedUpdate; self.downloadedUpdateForRemoval = downloadedUpdate;
self->_resumableUpdate = nil; self.resumableUpdate = nil;
if (updater != nil && [updaterDelegate respondsToSelector:@selector(updater:didExtractUpdate:)]) { if ([self.updaterDelegate respondsToSelector:@selector(updater:didExtractUpdate:)]) {
[updaterDelegate updater:updater didExtractUpdate:self->_updateItem]; [self.updaterDelegate updater:self.updater didExtractUpdate:self.updateItem];
} }
} }
}]; }];
@@ -250,33 +253,31 @@
- (void)downloadDriverDidFailToDownloadFileWithError:(NSError *)error - (void)downloadDriverDidFailToDownloadFileWithError:(NSError *)error
{ {
if ([_updateItem isDeltaUpdate]) { if ([self.updateItem isDeltaUpdate]) {
SULog(SULogLevelError, @"Failed to download delta update. Falling back to regular update..."); SULog(SULogLevelError, @"Failed to download delta update. Falling back to regular update...");
SULogError(error); SULogError(error);
[self fallBackAndDownloadRegularUpdate]; [self fallBackAndDownloadRegularUpdate];
} else { } else {
id updater = _updater; if ([self.updaterDelegate respondsToSelector:@selector((updater:failedToDownloadUpdate:error:))]) {
id<SPUUpdaterDelegate> updaterDelegate = _updaterDelegate;
if (updater != nil && [updaterDelegate respondsToSelector:@selector((updater:failedToDownloadUpdate:error:))]) {
NSError *errorToReport = [error.userInfo objectForKey:NSUnderlyingErrorKey]; NSError *errorToReport = [error.userInfo objectForKey:NSUnderlyingErrorKey];
if (errorToReport == nil) { if (errorToReport == nil) {
errorToReport = error; errorToReport = error;
} }
[updaterDelegate updater:updater failedToDownloadUpdate:_updateItem error:errorToReport]; [self.updaterDelegate updater:self.updater
failedToDownloadUpdate:self.updateItem
error:errorToReport];
} }
[_delegate coreDriverIsRequestingAbortUpdateWithError:error]; [self.delegate coreDriverIsRequestingAbortUpdateWithError:error];
} }
} }
- (void)installerDidStartInstallingWithApplicationTerminated:(BOOL)applicationTerminated - (void)installerDidStartInstallingWithApplicationTerminated:(BOOL)applicationTerminated
{ {
id<SPUCoreBasedUpdateDriverDelegate> delegate = _delegate; if ([self.delegate respondsToSelector:@selector(installerDidStartInstallingWithApplicationTerminated:)]) {
if ([delegate respondsToSelector:@selector(installerDidStartInstallingWithApplicationTerminated:)]) { [self.delegate installerDidStartInstallingWithApplicationTerminated:applicationTerminated];
[delegate installerDidStartInstallingWithApplicationTerminated:applicationTerminated];
} }
} }
@@ -288,56 +289,49 @@
- (void)installerDidExtractUpdateWithProgress:(double)progress - (void)installerDidExtractUpdateWithProgress:(double)progress
{ {
id<SPUCoreBasedUpdateDriverDelegate> delegate = _delegate; if ([self.delegate respondsToSelector:@selector(installerDidExtractUpdateWithProgress:)]) {
if ([delegate respondsToSelector:@selector(installerDidExtractUpdateWithProgress:)]) { [self.delegate installerDidExtractUpdateWithProgress:progress];
[delegate installerDidExtractUpdateWithProgress:progress];
} }
} }
- (void)installerDidFinishPreparationAndWillInstallImmediately:(BOOL)willInstallImmediately silently:(BOOL)willInstallSilently - (void)installerDidFinishPreparationAndWillInstallImmediately:(BOOL)willInstallImmediately silently:(BOOL)willInstallSilently
{ {
[_delegate installerDidFinishPreparationAndWillInstallImmediately:willInstallImmediately silently:willInstallSilently]; [self.delegate installerDidFinishPreparationAndWillInstallImmediately:willInstallImmediately silently:willInstallSilently];
} }
- (void)finishInstallationWithResponse:(SPUUserUpdateChoice)response displayingUserInterface:(BOOL)displayingUserInterface - (void)finishInstallationWithResponse:(SPUUserUpdateChoice)response displayingUserInterface:(BOOL)displayingUserInterface
{ {
switch (response) { switch (response) {
case SPUUserUpdateChoiceDismiss: case SPUUserUpdateChoiceDismiss:
[_delegate coreDriverIsRequestingAbortUpdateWithError:nil]; [self.delegate coreDriverIsRequestingAbortUpdateWithError:nil];
break; break;
case SPUUserUpdateChoiceSkip: case SPUUserUpdateChoiceSkip:
[_installerDriver cancelUpdate]; [self.installerDriver cancelUpdate];
break; break;
case SPUUserUpdateChoiceInstall: case SPUUserUpdateChoiceInstall:
[_installerDriver installWithToolAndRelaunch:YES displayingUserInterface:displayingUserInterface]; [self.installerDriver installWithToolAndRelaunch:YES displayingUserInterface:displayingUserInterface];
break; break;
} }
} }
- (void)installerWillFinishInstallationAndRelaunch:(BOOL)relaunch - (void)installerWillFinishInstallationAndRelaunch:(BOOL)relaunch
{ {
id updater = _updater; if ([self.updaterDelegate respondsToSelector:@selector((updater:willInstallUpdate:))]) {
id<SPUUpdaterDelegate> updaterDelegate = _updaterDelegate; [self.updaterDelegate updater:self.updater willInstallUpdate:self.updateItem];
}
if (updater != nil) { if (relaunch) {
if ([updaterDelegate respondsToSelector:@selector((updater:willInstallUpdate:))]) { [[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterWillRestartNotification object:self];
[updaterDelegate updater:updater willInstallUpdate:_updateItem]; if ([self.updaterDelegate respondsToSelector:@selector((updaterWillRelaunchApplication:))]) {
} [self.updaterDelegate updaterWillRelaunchApplication:self.updater];
if (relaunch) {
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterWillRestartNotification object:updater];
if ([updaterDelegate respondsToSelector:@selector((updaterWillRelaunchApplication:))]) {
[updaterDelegate updaterWillRelaunchApplication:updater];
}
} }
} }
} }
- (void)installerDidFinishInstallationAndRelaunched:(BOOL)relaunched acknowledgement:(void(^)(void))acknowledgement - (void)installerDidFinishInstallationAndRelaunched:(BOOL)relaunched acknowledgement:(void(^)(void))acknowledgement
{ {
id<SPUCoreBasedUpdateDriverDelegate> delegate = _delegate; if ([self.delegate respondsToSelector:@selector(installerDidFinishInstallationAndRelaunched:acknowledgement:)]) {
if ([delegate respondsToSelector:@selector(installerDidFinishInstallationAndRelaunched:acknowledgement:)]) { [self.delegate installerDidFinishInstallationAndRelaunched:relaunched acknowledgement:acknowledgement];
[delegate installerDidFinishInstallationAndRelaunched:relaunched acknowledgement:acknowledgement];
} else { } else {
acknowledgement(); acknowledgement();
} }
@@ -345,25 +339,25 @@
- (void)installerIsRequestingAbortInstallWithError:(nullable NSError *)error - (void)installerIsRequestingAbortInstallWithError:(nullable NSError *)error
{ {
[_delegate coreDriverIsRequestingAbortUpdateWithError:error]; [self.delegate coreDriverIsRequestingAbortUpdateWithError:error];
} }
- (void)basicDriverIsRequestingAbortUpdateWithError:(nullable NSError *)error - (void)basicDriverIsRequestingAbortUpdateWithError:(nullable NSError *)error
{ {
// A delegate may want to handle this type of error specially // A delegate may want to handle this type of error specially
[_delegate basicDriverIsRequestingAbortUpdateWithError:error]; [self.delegate basicDriverIsRequestingAbortUpdateWithError:error];
} }
- (void)fallBackAndDownloadRegularUpdate SPU_OBJC_DIRECT - (void)fallBackAndDownloadRegularUpdate
{ {
SUAppcastItem *secondaryUpdateItem = _secondaryUpdateItem; SUAppcastItem *secondaryUpdateItem = self.secondaryUpdateItem;
assert(secondaryUpdateItem != nil); assert(secondaryUpdateItem != nil);
BOOL backgroundDownload = _downloadDriver.inBackground; BOOL backgroundDownload = self.downloadDriver.inBackground;
// Fall back to the non-delta update. Note that we don't want to trigger another update was found event. // Fall back to the non-delta update. Note that we don't want to trigger another update was found event.
_updateItem = secondaryUpdateItem; self.updateItem = secondaryUpdateItem;
_secondaryUpdateItem = nil; self.secondaryUpdateItem = nil;
[self downloadUpdateFromAppcastItem:secondaryUpdateItem secondaryAppcastItem:nil inBackground:backgroundDownload]; [self downloadUpdateFromAppcastItem:secondaryUpdateItem secondaryAppcastItem:nil inBackground:backgroundDownload];
} }
@@ -377,16 +371,16 @@
- (void)abortUpdateAndShowNextUpdateImmediately:(BOOL)shouldShowUpdateImmediately error:(nullable NSError *)error - (void)abortUpdateAndShowNextUpdateImmediately:(BOOL)shouldShowUpdateImmediately error:(nullable NSError *)error
{ {
[_installerDriver abortInstall]; [self.installerDriver abortInstall];
void (^basicDriverAbort)(void) = ^{ void (^basicDriverAbort)(void) = ^{
id<SPUResumableUpdate> resumableUpdate = (error == nil || error.code == SUInstallationAuthorizeLaterError) ? self->_resumableUpdate : nil; id<SPUResumableUpdate> resumableUpdate = (error == nil || error.code == SUInstallationAuthorizeLaterError) ? self.resumableUpdate : nil;
[self->_basicDriver abortUpdateAndShowNextUpdateImmediately:shouldShowUpdateImmediately resumableUpdate:resumableUpdate error:error]; [self.basicDriver abortUpdateAndShowNextUpdateImmediately:shouldShowUpdateImmediately resumableUpdate:resumableUpdate error:error];
}; };
if (_downloadDriver != nil) { if (self.downloadDriver != nil) {
[_downloadDriver cleanup:^{ [self.downloadDriver cleanup:^{
basicDriverAbort(); basicDriverAbort();
}]; }];
} else { } else {
+1 -1
View File
@@ -8,7 +8,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#if defined(BUILDING_SPARKLE_SOURCES_EXTERNALLY) #ifdef BUILDING_SPARKLE_DOWNLOADER_SERVICE
// Ignore incorrect warning // Ignore incorrect warning
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wquoted-include-in-framework-header" #pragma clang diagnostic ignored "-Wquoted-include-in-framework-header"
Loaded 100 of 256 files, more files were not shown because too many files have changed in this diff. Show more