Compare commits

..
9 Commits
Author SHA1 Message Date
Sparkle-Bot 8e27997de0 Update Package management files for version 2.2.2 2022-08-29 05:46:13 +00:00
Zorg ff6418d3cd Update CHANGELOG for 2.2.2 2022-08-28 22:36:14 -07:00
Sparkle-Bot c263b969c0 Update Package management files for version 2.2.2 2022-08-29 05:12:58 +00:00
Zorg 3c0ebbf570 Update 2.2.2-dev branch name 2022-08-28 22:03:41 -07:00
Zorg 743e15cce8 Add 2.2.2 to test on CI 2022-08-28 16:00:35 -07:00
Chiahong 77bf6ad890 Update zh_TW localization (#2246) 2022-08-28 15:35:01 -07:00
Kent Sutherland f6b7693b75 Update Portuguese localization (#2224) 2022-08-28 15:30:02 -07:00
Zorg f410960ac0 Wait for a threshold amount of time before replying with status info data (#2230)
Without this, critical update alerts may not show up as promptly as they should when automatically installing them.

This fixes a potential race issue where sometimes the automatic update driver on completion would sometimes not trigger to prompt an update alert immediately for critical updates. Note in this case, the update would still be installed on app termination and would still be scheduled to alert the user on the regular update check interval, so this issue is not severe.
2022-08-28 15:26:48 -07:00
Zorg 0b0a751d82 Remove module imports from framework headers (#2217)
Framework headers should not be using them. The warning these aim to suppress (-Wauto-import) is also going away.
2022-08-28 15:23:48 -07:00
350 changed files with 5195 additions and 13817 deletions

No files matched your search

@@ -29,4 +29,4 @@ https://github.com/sparkle-project/Sparkle#troubleshooting
## Version
[please specify versions of Sparkle this is applicable to]
[please specify versions of Sparkle this is applicable to; note the old 1.x (master) branch is only taking fixes to regressions and security fixes now.]
@@ -1,7 +1,8 @@
---
name: Sparkle doesn't work in my app
about: Problems with integration, unexpected errors using Sparkle
name: Sparkle 2.x doesn't work in my app
about: Problems with integration, unexpected errors using Sparkle 2
title: ''
labels: '2.x'
assignees: ''
---
@@ -0,0 +1,36 @@
---
name: Sparkle 1.x doesn't work in my app
about: Problems with integration, unexpected errors using Sparkle 1
title: ''
labels: '1.x'
assignees: ''
---
<!--
The answer to your issue is probably already in Console.app on your computer.
Please use Console.app and search for Sparkle.
Please try troubleshooting steps:
https://github.com/sparkle-project/Sparkle#troubleshooting
-->
### Description of the problem
### Do you use Sandboxing in your app?
### Version of `Sparkle.framework` in the latest version of your app
### Version of `Sparkle.framework` in the old version of app that your users have (or N/A)
### Sparkle's output from Console.app
```
```
### Steps to reproduce the behavior
[The more information provided and pasted verbatim, the easier it will be to diagnose an issue. If you can provide the affected application/binary and XML feed to reproduce an issue, share them]
+2
View File
@@ -7,6 +7,8 @@ Fixes # (issue)
- [ ] My change requires a documentation update on [Sparkle's website repository](https://github.com/sparkle-project/sparkle-project.github.io)
- [ ] My change requires changes to generate_appcast, generate_keys, or sign_update
Only bug fixes to regressions or security fixes are being backported to the 1.x (master) branch now. If you believe your change is significant enough to backport, please also create a separate pull request against the master branch.
## Testing
I tested and verified my change by using one or multiple of these methods:
+11 -11
View File
@@ -2,26 +2,26 @@ name: Build & Tests
on:
push:
branches: [ 2.x, master ]
branches: [ 2.x, 2.2.2-dev, master ]
pull_request:
branches: [ 2.x, master ]
branches: [ 2.x, 2.2.2-dev, master ]
jobs:
build:
strategy:
matrix:
xcode: ['xcode14.3.1', 'xcode15']
xcode: ['xcode12.5.1', 'xcode13.3.1']
include:
- xcode: 'xcode15'
xcode-path: '/Applications/Xcode_15.0.app/Contents/Developer'
upload-dist: false
run-analyzer: true
macos: 'macos-13'
- xcode: 'xcode14.3.1'
xcode-path: '/Applications/Xcode_14.3.1.app/Contents/Developer'
- xcode: 'xcode13.3.1'
xcode-path: '/Applications/Xcode_13.3.1.app/Contents/Developer'
upload-dist: true
run-analyzer: true
macos: 'macos-12'
- xcode: 'xcode12.5.1'
xcode-path: '/Applications/Xcode_12.5.1.app/Contents/Developer'
upload-dist: false
run-analyzer: false
macos: 'macos-13'
macos: 'macos-11'
name: Build and Test Sparkle
runs-on: ${{ matrix.macos }}
+3 -4
View File
@@ -2,7 +2,7 @@ name: "Create Draft Release"
env:
BUILDDIR: "build"
DEVELOPER_DIR: "/Applications/Xcode_14.3.1.app/Contents/Developer"
DEVELOPER_DIR: "/Applications/Xcode_13.3.1.app/Contents/Developer"
on:
workflow_dispatch:
@@ -29,11 +29,11 @@ concurrency:
jobs:
release:
name: "Publish binaries for release"
runs-on: macos-13
runs-on: macos-12
steps:
- name: "Checkout sources"
uses: actions/checkout@v3
uses: actions/checkout@v2
with:
token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
submodules: true
@@ -90,7 +90,6 @@ jobs:
with:
draft: true
prerelease: ${{ env.PRERELEASE_VERSION }}
target_commitish: ${{ github.ref_name }}
name: "${{ github.event.inputs.marketingVersion }}${{ github.event.inputs.prereleaseSuffix }}"
tag_name: "${{ github.event.inputs.marketingVersion }}${{ github.event.inputs.prereleaseSuffix }}"
fail_on_unmatched_files: true
+3
View File
@@ -0,0 +1,3 @@
[submodule "Vendor/ed25519"]
path = Vendor/ed25519
url = https://github.com/orlp/ed25519
+1 -1
View File
@@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
@protocol SPUInstallerAgentProtocol;
SPU_OBJC_DIRECT_MEMBERS @interface AgentConnection : NSObject
@interface AgentConnection : NSObject
- (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier delegate:(id<AgentConnectionDelegate>)delegate;
+25 -26
View File
@@ -16,16 +16,20 @@
@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
@implementation AgentConnection
{
NSXPCListener *_xpcListener;
NSXPCConnection *_activeConnection;
__weak id<AgentConnectionDelegate> _delegate;
}
@synthesize xpcListener = _xpcListener;
@synthesize activeConnection = _activeConnection;
@synthesize agent = _agent;
@synthesize delegate = _delegate;
@synthesize connected = _connected;
@synthesize invalidationError = _invalidationError;
@@ -44,23 +48,23 @@
- (void)startListener
{
[_xpcListener resume];
[self.xpcListener resume];
}
- (void)invalidate
{
_delegate = nil;
self.delegate = nil;
[_activeConnection invalidate];
_activeConnection = nil;
[self.activeConnection invalidate];
self.activeConnection = nil;
[_xpcListener invalidate];
_xpcListener = nil;
[self.xpcListener invalidate];
self.xpcListener = nil;
}
- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection
{
if (_activeConnection != nil) {
if (self.activeConnection != nil) {
[newConnection invalidate];
return NO;
}
@@ -70,30 +74,24 @@
newConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SPUInstallerAgentProtocol)];
_activeConnection = newConnection;
self.activeConnection = newConnection;
__weak __typeof__(self) weakSelf = self;
__weak AgentConnection *weakSelf = self;
newConnection.interruptionHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{
__typeof__(self) strongSelf = weakSelf;
if (strongSelf != nil) {
[strongSelf->_activeConnection invalidate];
}
[weakSelf.activeConnection invalidate];
});
};
newConnection.invalidationHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{
__typeof__(self) strongSelf = weakSelf;
if (strongSelf != nil) {
[strongSelf->_delegate agentConnectionDidInvalidate];
}
[weakSelf.delegate agentConnectionDidInvalidate];
});
};
[newConnection resume];
_agent = newConnection.remoteObjectProxy;
self.agent = newConnection.remoteObjectProxy;
return YES;
}
@@ -101,9 +99,10 @@
- (void)connectionDidInitiateWithReply:(void (^)(void))acknowledgement
{
dispatch_async(dispatch_get_main_queue(), ^{
self->_connected = YES;
self.connected = YES;
[self->_delegate agentConnectionDidInitiate];
[self.delegate agentConnectionDidInitiate];
self.delegate = nil;
});
acknowledgement();
@@ -112,7 +111,7 @@
- (void)connectionWillInvalidateWithError:(NSError *)error
{
dispatch_async(dispatch_get_main_queue(), ^{
self->_invalidationError = error;
self.invalidationError = error;
});
}
+1 -1
View File
@@ -11,7 +11,7 @@
NS_ASSUME_NONNULL_BEGIN
SPU_OBJC_DIRECT_MEMBERS @interface AppInstaller : NSObject
@interface AppInstaller : NSObject
- (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName;
+227 -267
View File
@@ -7,6 +7,7 @@
//
#import "AppInstaller.h"
#import "TerminationListener.h"
#import "SUInstaller.h"
#import "SUUpdateValidator.h"
#import "SULog.h"
@@ -42,48 +43,73 @@
static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
@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
@implementation AppInstaller
{
NSXPCListener* _xpcListener;
NSXPCConnection *_activeConnection;
id<SUInstallerCommunicationProtocol> _communicator;
AgentConnection *_agentConnection;
SUUpdateValidator *_updateValidator;
NSString *_hostBundleIdentifier;
NSString *_homeDirectory;
NSString *_userName;
SUHost *_host;
NSString *_updateDirectoryPath;
NSString *_downloadName;
NSString *_decryptionPassword;
SUSignatures *_signatures;
NSString *_relaunchPath;
NSString *_installationType;
id<SUInstallerProtocol> _installer;
dispatch_queue_t _installerQueue;
BOOL _shouldRelaunch;
BOOL _shouldShowUI;
BOOL _receivedUpdaterPong;
BOOL _willCompleteInstallation;
BOOL _receivedInstallationData;
BOOL _finishedValidation;
BOOL _agentInitiatedConnection;
BOOL _performedStage1Installation;
BOOL _performedStage2Installation;
BOOL _performedStage3Installation;
BOOL _targetTerminated;
}
@synthesize xpcListener = _xpcListener;
@synthesize activeConnection = _activeConnection;
@synthesize communicator = _communicator;
@synthesize agentConnection = _agentConnection;
@synthesize receivedUpdaterPong = _receivedUpdaterPong;
@synthesize hostBundleIdentifier = _hostBundleIdentifier;
@synthesize homeDirectory = _homeDirectory;
@synthesize userName = _userName;
@synthesize terminationListener = _terminationListener;
@synthesize updateValidator = _updateValidator;
@synthesize host = _host;
@synthesize updateDirectoryPath = _updateDirectoryPath;
@synthesize downloadName = _downloadName;
@synthesize decryptionPassword = _decryptionPassword;
@synthesize signatures = _signatures;
@synthesize relaunchPath = _relaunchPath;
@synthesize installationType = _installationType;
@synthesize shouldRelaunch = _shouldRelaunch;
@synthesize shouldShowUI = _shouldShowUI;
@synthesize installer = _installer;
@synthesize willCompleteInstallation = _willCompleteInstallation;
@synthesize receivedInstallationData = _receivedInstallationData;
@synthesize installerQueue = _installerQueue;
@synthesize performedStage1Installation = _performedStage1Installation;
@synthesize performedStage2Installation = _performedStage2Installation;
@synthesize performedStage3Installation = _performedStage3Installation;
@synthesize finishedValidation = _finishedValidation;
@synthesize agentInitiatedConnection = _agentInitiatedConnection;
- (instancetype)initWithHostBundleIdentifier:(NSString *)hostBundleIdentifier homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName
{
@@ -106,71 +132,68 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection
{
if (_activeConnection != nil) {
if (self.activeConnection != nil) {
SULog(SULogLevelDefault, @"Rejecting multiple connections...");
[newConnection invalidate];
return NO;
}
_activeConnection = newConnection;
self.activeConnection = newConnection;
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)];
newConnection.exportedObject = self;
newConnection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)];
__weak __typeof__(self) weakSelf = self;
__weak AppInstaller *weakSelf = self;
newConnection.interruptionHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{
__typeof__(self) strongSelf = weakSelf;
if (strongSelf != nil) {
[strongSelf->_activeConnection invalidate];
}
[weakSelf.activeConnection invalidate];
});
};
newConnection.invalidationHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{
__typeof__(self) strongSelf = weakSelf;
AppInstaller *strongSelf = weakSelf;
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->_communicator = nil;
strongSelf->_activeConnection = nil;
strongSelf.communicator = nil;
strongSelf.activeConnection = nil;
}
});
};
[newConnection resume];
_communicator = newConnection.remoteObjectProxy;
self.communicator = newConnection.remoteObjectProxy;
return YES;
}
- (void)start
{
[_xpcListener resume];
[_agentConnection startListener];
[self.xpcListener resume];
[self.agentConnection startListener];
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" }]];
}
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" }]];
}
});
}
- (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];
id<SUUnarchiverProtocol> unarchiver = [SUUnarchiver unarchiverForPath:archivePath updatingHostBundlePath:_host.bundlePath decryptionPassword:_decryptionPassword expectingInstallationType:_installationType];
NSString *archivePath = [self.updateDirectoryPath stringByAppendingPathComponent:self.downloadName];
id<SUUnarchiverProtocol> unarchiver = [SUUnarchiver unarchiverForPath:archivePath updatingHostBundlePath:self.host.bundlePath decryptionPassword:self.decryptionPassword expectingInstallationType:self.installationType];
NSError *unarchiverError = nil;
BOOL success = NO;
@@ -179,14 +202,14 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
success = NO;
} 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
// 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) {
success = [_updateValidator validateDownloadPathWithError:&unarchiverError];
success = [self.updateValidator validateDownloadPathWithError:&unarchiverError];
} else {
success = YES;
}
@@ -200,18 +223,18 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
if (error != nil) {
[self unarchiverDidFailWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to unarchive %@", archivePath], NSUnderlyingErrorKey: (NSError * _Nonnull)error }]];
} else {
[self->_communicator handleMessageWithIdentifier:SPUValidationStarted data:[NSData data]];
[self.communicator handleMessageWithIdentifier:SPUValidationStarted data:[NSData data]];
NSError *validationError = nil;
BOOL validationSuccess = [self->_updateValidator validateWithUpdateDirectory:self->_updateDirectoryPath error:&validationError];
BOOL validationSuccess = [self.updateValidator validateWithUpdateDirectory:self.updateDirectoryPath error:&validationError];
if (!validationSuccess) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Update validation was a failure", NSUnderlyingErrorKey: validationError }]];
} else {
[self->_communicator handleMessageWithIdentifier:SPUInstallationStartedStage1 data:[NSData data]];
[self.communicator handleMessageWithIdentifier:SPUInstallationStartedStage1 data:[NSData data]];
self->_finishedValidation = YES;
if (self->_agentInitiatedConnection) {
self.finishedValidation = YES;
if (self.agentInitiatedConnection) {
[self retrieveProcessIdentifierAndStartInstallation];
}
}
@@ -222,60 +245,60 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
uint64_t progressValue = CFSwapInt64HostToLittle(*(uint64_t *)&progress);
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;
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);
}
_updateDirectoryPath = nil;
self.updateDirectoryPath = nil;
}
}
- (void)unarchiverDidFailWithError:(NSError *)error SPU_OBJC_DIRECT
- (void)unarchiverDidFailWithError:(NSError *)error
{
SULog(SULogLevelError, @"Failed to unarchive file");
SULogError(error);
// 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
// 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,
// but may as well set other fields to nil too
[self clearUpdateDirectory];
_downloadName = nil;
_decryptionPassword = nil;
_signatures = nil;
_relaunchPath = nil;
_host = nil;
self.downloadName = nil;
self.decryptionPassword = nil;
self.signatures = nil;
self.relaunchPath = nil;
self.host = nil;
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
{
_agentInitiatedConnection = YES;
if (_finishedValidation) {
self.agentInitiatedConnection = YES;
if (self.finishedValidation) {
[self retrieveProcessIdentifierAndStartInstallation];
}
}
- (void)agentConnectionDidInvalidate
{
if (!_finishedValidation || !_agentInitiatedConnection || !_targetTerminated) {
if (!self.finishedValidation || !self.agentInitiatedConnection) {
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey: @"Error: Agent connection invalidated before installation began" }];
NSError *agentError = _agentConnection.invalidationError;
NSError *agentError = self.agentConnection.invalidationError;
if (agentError != nil) {
userInfo[NSUnderlyingErrorKey] = agentError;
}
@@ -284,37 +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
// 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
__block BOOL receivedResponse = NO;
[_agentConnection.agent registerApplicationBundlePath:_relaunchPath reply:^(BOOL targetTerminated) {
[self.agentConnection.agent registerApplicationBundlePath:self.relaunchPath reply:^(NSNumber * _Nullable processIdentifier) {
dispatch_async(dispatch_get_main_queue(), ^{
receivedResponse = YES;
if (!targetTerminated) {
[self->_agentConnection.agent listenForTerminationWithCompletion:^{
dispatch_async(dispatch_get_main_queue(), ^{
self->_targetTerminated = YES;
if (self->_performedStage1Installation) {
[self finishInstallationAfterHostTermination];
}
});
}];
} else {
self->_targetTerminated = YES;
}
self.terminationListener = [[TerminationListener alloc] initWithProcessIdentifier:processIdentifier];
[self startInstallation];
});
}];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(RETRIEVE_PROCESS_IDENTIFIER_TIMEOUT * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (!receivedResponse) {
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" }]];
}
});
@@ -322,11 +329,11 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
- (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(), ^{
// 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)
self->_receivedInstallationData = YES;
// 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;
SPUInstallationInputData *installationData = (SPUInstallationInputData *)SPUUnarchiveRootObjectSecurely(data, [SPUInstallationInputData class]);
if (installationData == nil) {
@@ -343,8 +350,8 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
NSBundle *hostBundle = [NSBundle bundleWithPath:installationData.hostBundlePath];
NSString *bundleIdentifier = hostBundle.bundleIdentifier;
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] }]];
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] }]];
return;
}
@@ -365,55 +372,12 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
return;
}
// Resolve the bookmark data for the downloaded update
// See "Share file access between processes with URL bookmarks" in https://developer.apple.com/documentation/security/app_sandbox/accessing_files_from_the_macos_app_sandbox
BOOL isStale = NO;
NSError *bookmarkError = nil;
NSURL *downloadURL = [NSURL URLByResolvingBookmarkData:installationData.updateURLBookmarkData options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:&isStale error:&bookmarkError];
if (downloadURL == nil) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to resolve bookmark data from downloaded update", NSUnderlyingErrorKey: bookmarkError }]];
return;
}
// Validate the download URL before moving it
{
NSArray<NSString *> *downloadURLPathComponents = downloadURL.URLByResolvingSymlinksInPath.pathComponents;
if (downloadURLPathComponents == nil) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to retrieve path components from download URL" }]];
return;
}
if ([downloadURLPathComponents containsObject:@".."]) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: download URL path components contains '..' which is unsafe" }]];
return;
}
if (![downloadURLPathComponents containsObject:@SPARKLE_BUNDLE_IDENTIFIER] || ![downloadURLPathComponents containsObject:@"PersistentDownloads"]) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: download URL path components does not contain PersistentDownloads or "@SPARKLE_BUNDLE_IDENTIFIER }]];
return;
}
}
if (!isStale) {
SULog(SULogLevelError, @"Error: bookmark data for update download is stale.. but still continuing.");
}
NSString *downloadName = downloadURL.lastPathComponent;
if (downloadName == nil) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to retrieve download name from download URL" }]];
return;
}
// Move the download archive to somewhere where probably only we will be touching it
// This prevents eg: if a bug exists in the updater that removes files we are trying to install
// When this tool is ran as root, we are moving it into a directory that only root will have access to
NSURL *downloadURL = [[NSURL fileURLWithPath:installationData.updateDirectoryPath] URLByAppendingPathComponent:installationData.downloadName];
NSURL *downloadDestinationURL = [[NSURL fileURLWithPath:cacheInstallationPath] URLByAppendingPathComponent:downloadName];
NSURL *downloadDestinationURL = [[NSURL fileURLWithPath:cacheInstallationPath] URLByAppendingPathComponent:installationData.downloadName];
NSError *moveError = nil;
if (![[[SUFileManager alloc] init] moveItemAtURL:downloadURL toURL:downloadDestinationURL error:&moveError]) {
@@ -445,23 +409,23 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
// 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
self->_installationType = installationType;
self->_relaunchPath = installationData.relaunchPath;
self->_downloadName = downloadName;
self->_signatures = installationData.signatures;
self->_updateDirectoryPath = cacheInstallationPath;
self->_host = [[SUHost alloc] initWithBundle:hostBundle];
self.installationType = installationType;
self.relaunchPath = installationData.relaunchPath;
self.downloadName = installationData.downloadName;
self.signatures = installationData.signatures;
self.updateDirectoryPath = cacheInstallationPath;
self.host = [[SUHost alloc] initWithBundle:hostBundle];
[self extractAndInstallUpdate];
});
} else if (identifier == SPUSentUpdateAppcastItemData) {
SUAppcastItem *updateItem = (SUAppcastItem *)SPUUnarchiveRootObjectSecurely(data, [SUAppcastItem class]);
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);
if (archivedData != nil) {
[_agentConnection.agent registerInstallationInfoData:archivedData];
[self.agentConnection.agent registerInstallationInfoData:archivedData];
}
}
} else if (identifier == SPUResumeInstallationToStage2 && data.length == sizeof(uint8_t) * 2) {
@@ -471,23 +435,14 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
dispatch_async(dispatch_get_main_queue(), ^{
// 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
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
dispatch_async(self->_installerQueue, ^{
if (!self->_performedStage2Installation) {
[self performStage2Installation];
} else if (!self->_performedStage3Installation) {
// If we already performed the 2nd stage, re-purpose this request to re-try sending another termination signal
dispatch_async(dispatch_get_main_queue(), ^{
// 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
[self->_agentConnection.agent sendTerminationSignal];
});
}
dispatch_async(self.installerQueue, ^{
[self performStage2InstallationIfNeeded];
});
}
});
@@ -496,21 +451,19 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
[self cleanupAndExitWithStatus:0 error:nil];
});
} else if (identifier == SPUUpdaterAlivePong) {
_receivedUpdaterPong = YES;
self.receivedUpdaterPong = YES;
}
}
- (void)startInstallation SPU_OBJC_DIRECT
- (void)startInstallation
{
_willCompleteInstallation = YES;
self.willCompleteInstallation = YES;
dispatch_queue_attr_t queuePriority = dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_USER_INITIATED, 0);
self.installerQueue = dispatch_queue_create("org.sparkle-project.sparkle.installer", DISPATCH_QUEUE_SERIAL);
_installerQueue = dispatch_queue_create("org.sparkle-project.sparkle.installer", queuePriority);
dispatch_async(_installerQueue, ^{
dispatch_async(self.installerQueue, ^{
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) {
dispatch_async(dispatch_get_main_queue(), ^{
@@ -521,7 +474,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
NSError *firstStageError = nil;
if (![installer performInitialInstallation:&firstStageError]) {
self->_installer = nil;
self.installer = nil;
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 }]];
@@ -532,43 +485,47 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
uint8_t canPerformSilentInstall = (uint8_t)[installer canInstallSilently];
dispatch_async(dispatch_get_main_queue(), ^{
self->_installer = installer;
self.installer = installer;
uint8_t sendInformation[] = {canPerformSilentInstall, (uint8_t)self->_targetTerminated};
uint8_t targetTerminated = (uint8_t)self.terminationListener.terminated;
uint8_t sendInformation[] = {canPerformSilentInstall, targetTerminated};
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;
if (self->_targetTerminated) {
// Stage 2 can still be run before we finish installation
// if the updater requests for it before the app is terminated
[self finishInstallationAfterHostTermination];
}
// Stage 2 can still be run before we finish installation
// if the updater requests for it before the app is terminated
[self finishInstallationAfterHostTermination];
});
});
}
- (void)performStage2Installation SPU_OBJC_DIRECT
- (void)performStage2InstallationIfNeeded
{
BOOL canPerformSecondStage = _shouldShowUI || [_installer canInstallSilently];
if (canPerformSecondStage) {
_performedStage2Installation = YES;
if (self.performedStage2Installation) {
return;
}
BOOL performedSecondStage = self.shouldShowUI || [self.installer canInstallSilently];
if (performedSecondStage) {
self.performedStage2Installation = YES;
dispatch_async(dispatch_get_main_queue(), ^{
uint8_t targetTerminated = (uint8_t)self->_targetTerminated;
uint8_t targetTerminated = (uint8_t)self.terminationListener.terminated;
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
// We could be slightly off if there were multiple instances running
[self->_agentConnection.agent sendTerminationSignal];
[self.agentConnection.agent sendTerminationSignal];
});
} else {
_installer = nil;
self.installer = nil;
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" }]];
@@ -576,73 +533,76 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
}
}
- (void)finishInstallationAfterHostTermination SPU_OBJC_DIRECT
- (void)finishInstallationAfterHostTermination
{
assert(self->_targetTerminated);
// 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)
__block BOOL shouldShowUIProgress = YES;
if (self->_shouldShowUI && [self->_installer canInstallSilently]) {
// Ask the updater if it is still alive
// If they are, we will receive a pong response back
// Reset if we received a pong just to be on the safe side
self->_receivedUpdaterPong = NO;
[self->_communicator handleMessageWithIdentifier:SPUUpdaterAlivePing data:[NSData data]];
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
// 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,
// 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)) {
[self->_agentConnection.agent showProgress];
}
});
}
dispatch_async(self->_installerQueue, ^{
if (!self->_performedStage2Installation) {
[self performStage2Installation];
}
if (!self->_performedStage2Installation) {
// We failed and we're going to exit shortly
[self.terminationListener startListeningWithCompletion:^(BOOL success) {
if (!success) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to listen for application termination" }]];
return;
}
NSError *thirdStageError = nil;
if (![self->_installer performFinalInstallationProgressBlock:nil error:&thirdStageError]) {
[self->_installer performCleanup];
self->_installer = nil;
// 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)
__block BOOL shouldShowUIProgress = YES;
if (self.shouldShowUI && [self.installer canInstallSilently]) {
// Ask the updater if it is still alive
// If they are, we will receive a pong response back
// Reset if we received a pong just to be on the safe side
self.receivedUpdaterPong = NO;
[self.communicator handleMessageWithIdentifier:SPUUpdaterAlivePing data:[NSData data]];
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
// 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,
// 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)) {
[self.agentConnection.agent showProgress];
}
});
}
dispatch_async(self.installerQueue, ^{
[self performStage2InstallationIfNeeded];
if (!self.performedStage2Installation) {
// We failed and we're going to exit shortly
return;
}
NSError *thirdStageError = nil;
if (![self.installer performFinalInstallationProgressBlock:nil error:&thirdStageError]) {
[self.installer performCleanup];
self.installer = nil;
dispatch_async(dispatch_get_main_queue(), ^{
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to finalize installation", NSUnderlyingErrorKey: thirdStageError }]];
});
return;
}
self.performedStage3Installation = YES;
dispatch_async(dispatch_get_main_queue(), ^{
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to finalize installation", NSUnderlyingErrorKey: thirdStageError }]];
// 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
// we relaunch the app because the relaunched app could check the service upon launch..
[self.agentConnection.agent stopProgress];
shouldShowUIProgress = NO;
[self.communicator handleMessageWithIdentifier:SPUInstallationFinishedStage3 data:[NSData data]];
if (self.shouldRelaunch) {
// This will also signal to the agent that it will terminate soon
[self.agentConnection.agent relaunchApplication];
}
[self.installer performCleanup];
[self cleanupAndExitWithStatus:EXIT_SUCCESS error:nil];
});
return;
}
self->_performedStage3Installation = YES;
dispatch_async(dispatch_get_main_queue(), ^{
// 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
// we relaunch the app because the relaunched app could check the service upon launch..
[self->_agentConnection.agent stopProgress];
shouldShowUIProgress = NO;
[self->_communicator handleMessageWithIdentifier:SPUInstallationFinishedStage3 data:[NSData data]];
if (self->_shouldRelaunch) {
// This will also signal to the agent that it will terminate soon
[self->_agentConnection.agent relaunchApplication];
}
[self->_installer performCleanup];
[self cleanupAndExitWithStatus:EXIT_SUCCESS error:nil];
});
});
}];
}
- (void)cleanupAndExitWithStatus:(int)status error:(NSError * _Nullable)error __attribute__((noreturn))
@@ -652,20 +612,20 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
NSData *errorData = SPUArchiveRootObjectSecurely((NSError * _Nonnull)error);
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
[_activeConnection invalidate];
_activeConnection = nil;
[self.activeConnection invalidate];
self.activeConnection = nil;
[_xpcListener invalidate];
_xpcListener = nil;
[self.xpcListener invalidate];
self.xpcListener = nil;
[_agentConnection invalidate];
_agentConnection = nil;
[self.agentConnection invalidate];
self.agentConnection = nil;
[self clearUpdateDirectory];
+6 -6
View File
@@ -23,7 +23,6 @@ id<SPUDeltaArchiveProtocol> SPUDeltaArchiveReadPatchAndHeader(NSString *patchFil
SPUDeltaArchiveHeader *header = [sparkleArchive readHeader];
if (header == nil) {
#if SPARKLE_BUILD_LEGACY_DELTA_SUPPORT
NSError *archiveError = sparkleArchive.error;
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
@@ -36,9 +35,7 @@ id<SPUDeltaArchiveProtocol> SPUDeltaArchiveReadPatchAndHeader(NSString *patchFil
*outHeader = xarHeader;
}
return xarArchive;
} else
#endif
{
} else {
if (outHeader != NULL) {
*outHeader = nil;
}
@@ -59,9 +56,7 @@ id<SPUDeltaArchiveProtocol> SPUDeltaArchiveReadPatchAndHeader(NSString *patchFil
@synthesize clonedRelativePath = _clonedRelativePath;
@synthesize sourcePath = _sourcePath;
@synthesize commands = _commands;
#if SPARKLE_BUILD_LEGACY_DELTA_SUPPORT
@synthesize xarContext = _xarContext;
#endif
@synthesize mode = _mode;
@synthesize codedDataLength = _codedDataLength;
@@ -108,6 +103,9 @@ id<SPUDeltaArchiveProtocol> SPUDeltaArchiveReadPatchAndHeader(NSString *patchFil
return self;
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
- (unsigned char *)beforeTreeHash
{
return _beforeTreeHash;
@@ -118,4 +116,6 @@ id<SPUDeltaArchiveProtocol> SPUDeltaArchiveReadPatchAndHeader(NSString *patchFil
return _afterTreeHash;
}
#pragma clang diagnostic pop
@end
+2 -4
View File
@@ -24,7 +24,7 @@ typedef NS_ENUM(uint8_t, SPUDeltaItemCommands) {
};
// 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;
@@ -39,7 +39,7 @@ SPU_OBJC_DIRECT_MEMBERS @interface SPUDeltaArchiveHeader : NSObject
@end
// 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;
@@ -58,10 +58,8 @@ SPU_OBJC_DIRECT_MEMBERS @interface SPUDeltaArchiveItem : NSObject
@property (nonatomic) uint16_t mode;
// Private properties
#if SPARKLE_BUILD_LEGACY_DELTA_SUPPORT
// xar_file context for Xar delta archiver
@property (nonatomic, nullable) const void *xarContext;
#endif
// Tracking length of item's data in data section, when encoding items and when extracting items
@property (nonatomic) uint64_t codedDataLength;
+1 -1
View File
@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
@class SUAppcastItem;
SPU_OBJC_DIRECT_MEMBERS @interface SPUInstallationInfo : NSObject <NSSecureCoding>
@interface SPUInstallationInfo : NSObject <NSSecureCoding>
- (instancetype)initWithAppcastItem:(SUAppcastItem *)appcastItem canSilentlyInstall:(BOOL)canSilentyInstall;
+3 -3
View File
@@ -52,9 +52,9 @@ static NSString *SUSystemDomainKey = @"SUSystemDomain";
- (void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeObject:_appcastItem forKey:SUAppcastItemKey];
[coder encodeBool:_canSilentlyInstall forKey:SUCanSilentlyInstallKey];
[coder encodeBool:_systemDomain forKey:SUSystemDomainKey];
[coder encodeObject:self.appcastItem forKey:SUAppcastItemKey];
[coder encodeBool:self.canSilentlyInstall forKey:SUCanSilentlyInstallKey];
[coder encodeBool:self.systemDomain forKey:SUSystemDomainKey];
}
+ (BOOL)supportsSecureCoding
+4 -3
View File
@@ -12,7 +12,7 @@
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
@@ -22,11 +22,12 @@ SPU_OBJC_DIRECT_MEMBERS @interface SPUInstallationInputData : NSObject <NSSecure
* signatures - signatures for the update that came from the appcast item
* decryptionPassword - optional decryption password for dmg archives
*/
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateURLBookmarkData:(NSData *)updateURLBookmarkData installationType:(NSString *)installationType signatures:(SUSignatures * _Nullable)signatures decryptionPassword:(nullable NSString *)decryptionPassword;
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName installationType:(NSString *)installationType signatures:(SUSignatures * _Nullable)signatures decryptionPassword:(nullable NSString *)decryptionPassword;
@property (nonatomic, copy, readonly) NSString *relaunchPath;
@property (nonatomic, copy, readonly) NSString *hostBundlePath;
@property (nonatomic, copy, readonly) NSData *updateURLBookmarkData;
@property (nonatomic, copy, readonly) NSString *updateDirectoryPath;
@property (nonatomic, copy, readonly) NSString *downloadName;
@property (nonatomic, copy, readonly) NSString *installationType;
@property (nonatomic, readonly, nullable) SUSignatures *signatures; // nullable because although not using signatures is deprecated, it's still supported
@property (nonatomic, copy, readonly, nullable) NSString *decryptionPassword;
+23 -14
View File
@@ -14,7 +14,8 @@
static NSString *SURelaunchPathKey = @"SURelaunchPath";
static NSString *SUHostBundlePathKey = @"SUHostBundlePath";
static NSString *SUUpdateURLBookmarkDataKey = @"SUUpdateURLBookmarkData";
static NSString *SUUpdateDirectoryPathKey = @"SUUpdateDirectoryPath";
static NSString *SUDownloadNameKey = @"SUDownloadName";
static NSString *SUSignaturesKey = @"SUSignatures";
static NSString *SUDecryptionPasswordKey = @"SUDecryptionPassword";
static NSString *SUInstallationTypeKey = @"SUInstallationType";
@@ -23,18 +24,20 @@ static NSString *SUInstallationTypeKey = @"SUInstallationType";
@synthesize relaunchPath = _relaunchPath;
@synthesize hostBundlePath = _hostBundlePath;
@synthesize updateURLBookmarkData = _updateURLBookmarkData;
@synthesize updateDirectoryPath = _updateDirectoryPath;
@synthesize downloadName = _downloadName;
@synthesize signatures = _signatures;
@synthesize decryptionPassword = _decryptionPassword;
@synthesize installationType = _installationType;
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateURLBookmarkData:(NSData *)updateURLBookmarkData installationType:(NSString *)installationType signatures:(SUSignatures * _Nullable)signatures decryptionPassword:(nullable NSString *)decryptionPassword
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName installationType:(NSString *)installationType signatures:(SUSignatures * _Nullable)signatures decryptionPassword:(nullable NSString *)decryptionPassword
{
self = [super init];
if (self != nil) {
_relaunchPath = [relaunchPath copy];
_hostBundlePath = [hostBundlePath copy];
_updateURLBookmarkData = updateURLBookmarkData;
_updateDirectoryPath = [updateDirectoryPath copy];
_downloadName = [downloadName copy];
_installationType = [installationType copy];
assert(SPUValidInstallationType(_installationType));
@@ -57,8 +60,13 @@ static NSString *SUInstallationTypeKey = @"SUInstallationType";
return nil;
}
NSData *updateURLBookmarkData = [decoder decodeObjectOfClass:[NSData class] forKey:SUUpdateURLBookmarkDataKey];
if (updateURLBookmarkData == nil) {
NSString *updateDirectoryPath = [decoder decodeObjectOfClass:[NSString class] forKey:SUUpdateDirectoryPathKey];
if (updateDirectoryPath == nil) {
return nil;
}
NSString *downloadName = [decoder decodeObjectOfClass:[NSString class] forKey:SUDownloadNameKey];
if (downloadName == nil) {
return nil;
}
@@ -74,18 +82,19 @@ static NSString *SUInstallationTypeKey = @"SUInstallationType";
NSString *decryptionPassword = [decoder decodeObjectOfClass:[NSString class] forKey:SUDecryptionPasswordKey];
return [self initWithRelaunchPath:relaunchPath hostBundlePath:hostBundlePath updateURLBookmarkData:updateURLBookmarkData installationType:installationType signatures:signatures decryptionPassword:decryptionPassword];
return [self initWithRelaunchPath:relaunchPath hostBundlePath:hostBundlePath updateDirectoryPath:updateDirectoryPath downloadName:downloadName installationType:installationType signatures:signatures decryptionPassword:decryptionPassword];
}
- (void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeObject:_relaunchPath forKey:SURelaunchPathKey];
[coder encodeObject:_hostBundlePath forKey:SUHostBundlePathKey];
[coder encodeObject:_updateURLBookmarkData forKey:SUUpdateURLBookmarkDataKey];
[coder encodeObject:_installationType forKey:SUInstallationTypeKey];
[coder encodeObject:_signatures forKey:SUSignaturesKey];
if (_decryptionPassword != nil) {
[coder encodeObject:_decryptionPassword forKey:SUDecryptionPasswordKey];
[coder encodeObject:self.relaunchPath forKey:SURelaunchPathKey];
[coder encodeObject:self.hostBundlePath forKey:SUHostBundlePathKey];
[coder encodeObject:self.updateDirectoryPath forKey:SUUpdateDirectoryPathKey];
[coder encodeObject:self.installationType forKey:SUInstallationTypeKey];
[coder encodeObject:self.downloadName forKey:SUDownloadNameKey];
[coder encodeObject:self.signatures forKey:SUSignaturesKey];
if (self.decryptionPassword != nil) {
[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)
(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)initWithPatchFileForReading:(NSString *)patchFile;
+166 -185
View File
@@ -7,15 +7,12 @@
//
#import "SPUSparkleDeltaArchive.h"
#import <bzlib.h>
#import <sys/stat.h>
#import <CommonCrypto/CommonDigest.h>
#import "SUBinaryDeltaCommon.h"
#import <compression.h>
#if SPARKLE_BUILD_BZIP2_DELTA_SUPPORT
#import <bzlib.h>
#endif
#include "AppKitPrevention.h"
#define SPARKLE_DELTA_FORMAT_MAGIC "spk!"
@@ -31,26 +28,39 @@ typedef struct
bool fileSystemCompression : 1;
} SparkleDeltaArchiveMetadata;
@implementation 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;
}
@interface SPUSparkleDeltaArchive ()
@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 partialChunkBuffer = _partialChunkBuffer;
@synthesize compressionBuffer = _compressionBuffer;
+ (BOOL)maySupportSafeExtraction
{
@@ -84,45 +94,42 @@ typedef struct
- (void)close
{
#if SPARKLE_BUILD_BZIP2_DELTA_SUPPORT
if (_bzipFile != NULL) {
if (!_writeMode) {
if (self.bzipFile != NULL) {
if (!self.writeMode) {
int bzerror = 0;
BZ2_bzReadClose(&bzerror, _bzipFile);
BZ2_bzReadClose(&bzerror, self.bzipFile);
}
_bzipFile = NULL;
} else
#endif
if (_initializedCompressionStream) {
self.bzipFile = NULL;
} else if (self.initializedCompressionStream) {
compression_stream_destroy(&_compressionStream);
_initializedCompressionStream = NO;
self.initializedCompressionStream = NO;
}
if (_file != NULL) {
fclose(_file);
_file = NULL;
if (self.file != NULL) {
fclose(self.file);
self.file = NULL;
}
free(_partialChunkBuffer);
_partialChunkBuffer = NULL;
free(self.partialChunkBuffer);
self.partialChunkBuffer = NULL;
free(_compressionBuffer);
_compressionBuffer = NULL;
free(self.compressionBuffer);
self.compressionBuffer = NULL;
}
- (BOOL)createBuffers SPU_OBJC_DIRECT
- (BOOL)createBuffers
{
_partialChunkBuffer = calloc(1, PARTIAL_IO_CHUNK_SIZE);
if (_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.partialChunkBuffer = calloc(1, PARTIAL_IO_CHUNK_SIZE);
if (self.partialChunkBuffer == NULL) {
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;
}
if (_initializedCompressionStream) {
_compressionBuffer = calloc(1, COMPRESSION_BUFFER_SIZE);
if (_compressionBuffer == NULL) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to calloc() %d bytes for compression buffer.", COMPRESSION_BUFFER_SIZE] }];
if (self.initializedCompressionStream) {
self.compressionBuffer = calloc(1, COMPRESSION_BUFFER_SIZE);
if (self.compressionBuffer == NULL) {
self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to calloc() %d bytes for compression buffer.", COMPRESSION_BUFFER_SIZE] }];
return NO;
}
}
@@ -130,53 +137,48 @@ typedef struct
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;
}
switch (_compression) {
switch (self.compression) {
case SPUDeltaCompressionModeNone: {
if (fread(buffer, (size_t)length, 1, _file) < 1) {
_error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to read %d uncompressed bytes from archive.", length] }];
if (fread(buffer, (size_t)length, 1, self.file) < 1) {
self.error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to read %d uncompressed bytes from archive.", length] }];
return NO;
} else {
return YES;
}
}
case SPUDeltaCompressionModeBzip2:
{
#if SPARKLE_BUILD_BZIP2_DELTA_SUPPORT
case SPUDeltaCompressionModeBzip2: {
int bzerror = 0;
int bytesRead = BZ2_bzRead(&bzerror, _bzipFile, buffer, length);
int bytesRead = BZ2_bzRead(&bzerror, self.bzipFile, buffer, length);
switch (bzerror) {
case BZ_OK:
case BZ_STREAM_END:
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;
} else {
return YES;
}
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;
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;
}
#else
return NO;
#endif
}
case SPUDeltaCompressionModeLZMA:
case SPUDeltaCompressionModeLZFSE:
case SPUDeltaCompressionModeLZ4:
case SPUDeltaCompressionModeZLIB: {
FILE *file = _file;
void *compressionBuffer = _compressionBuffer;
FILE *file = self.file;
void *compressionBuffer = self.compressionBuffer;
_compressionStream.dst_ptr = buffer;
_compressionStream.dst_size = (size_t)length;
@@ -188,7 +190,7 @@ typedef struct
size_t bytesRead = fread(compressionBuffer, 1, COMPRESSION_BUFFER_SIZE, file);
if (bytesRead < COMPRESSION_BUFFER_SIZE) {
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;
}
}
@@ -200,13 +202,13 @@ typedef struct
compression_status status = compression_stream_process(&_compressionStream, feof(file) != 0 ? COMPRESSION_STREAM_FINALIZE : 0);
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;
}
if (status == COMPRESSION_STATUS_END && _compressionStream.dst_size > 0) {
// 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;
}
}
@@ -237,44 +239,44 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
- (nullable SPUDeltaArchiveHeader *)readHeader
{
NSString *patchFile = _patchFile;
NSString *patchFile = self.patchFile;
char patchFilePath[PATH_MAX + 1] = {0};
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;
}
FILE *file = fopen(patchFilePath, "rb");
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;
}
_file = file;
self.file = file;
char magic[5] = {0};
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;
}
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;
}
SPUDeltaCompressionMode compression = 0;
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;
}
_compression = compression;
self.compression = compression;
SparkleDeltaArchiveMetadata metadata = {0};
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;
}
@@ -282,45 +284,40 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
case SPUDeltaCompressionModeNone:
break;
case SPUDeltaCompressionModeBzip2: {
#if SPARKLE_BUILD_BZIP2_DELTA_SUPPORT
int bzerror = 0;
BZFILE *bzipFile = BZ2_bzReadOpen(&bzerror, file, 0, 0, NULL, 0);
if (bzipFile == NULL) {
switch (bzerror) {
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;
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;
}
return nil;
}
_bzipFile = bzipFile;
self.bzipFile = bzipFile;
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 SPUDeltaCompressionModeLZFSE:
case SPUDeltaCompressionModeLZ4:
case SPUDeltaCompressionModeZLIB: {
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;
}
_initializedCompressionStream = YES;
self.initializedCompressionStream = YES;
break;
}
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;
}
@@ -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];
}
- (NSArray<NSString *> *)_readRelativeFilePaths SPU_OBJC_DIRECT
- (NSArray<NSString *> *)_readRelativeFilePaths
{
if (_error != nil) {
if (self.error != nil) {
return nil;
}
@@ -369,7 +366,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
char *fileTableData = calloc(1, filePathSectionSize);
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;
}
@@ -396,7 +393,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
if (fileTableData[index] == '\0') {
NSString *relativePath = [fileManager stringWithFileSystemRepresentation:&fileTableData[currentStartIndex] length:index - currentStartIndex];
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);
return nil;
@@ -428,7 +425,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
if (relativeFilePaths.count > UINT32_MAX) {
// Very unlikely but we should guard against this
// 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;
}
@@ -467,7 +464,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
}
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;
}
@@ -528,7 +525,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
}
}
if (_error != nil) {
if (self.error != nil) {
return;
}
@@ -562,17 +559,15 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
if ((commands & SPUDeltaItemCommandBinaryDiff) != 0 || S_ISREG(mode)) {
// Regular files
[fileManager removeItemAtPath:itemFilePath error:NULL];
char itemFilePathString[PATH_MAX + 1] = {0};
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;
}
FILE *outputFile = fopen(itemFilePathString, "wb");
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;
}
@@ -583,14 +578,14 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
while (bytesLeftoverToCopy > 0) {
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]) {
break;
}
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;
}
@@ -600,12 +595,12 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
fclose(outputFile);
if (_error != nil) {
if (self.error != nil) {
return NO;
}
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;
}
} else {
@@ -613,13 +608,13 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
if (PARTIAL_IO_CHUNK_SIZE < decodedLength) {
// 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;
}
if (decodedLength > PATH_MAX) {
// 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;
}
@@ -631,7 +626,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
NSString *destinationPath = [fileManager stringWithFileSystemRepresentation:buffer length:decodedLength];
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;
}
@@ -639,13 +634,13 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
NSError *createLinkError = nil;
if (![fileManager createSymbolicLinkAtPath:itemFilePath withDestinationPath:destinationPath error:&createLinkError]) {
_error = createLinkError;
self.error = createLinkError;
return NO;
}
char itemFilePathString[PATH_MAX + 1] = {0};
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;
}
@@ -657,7 +652,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
} else if (S_ISDIR(mode)) {
NSError *createDirectoryError = nil;
if (![fileManager createDirectoryAtPath:itemFilePath withIntermediateDirectories:NO attributes:@{NSFilePosixPermissions: @(mode)} error:&createDirectoryError]) {
_error = createDirectoryError;
self.error = createDirectoryError;
return NO;
}
}
@@ -665,39 +660,34 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
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;
}
switch (_compression) {
switch (self.compression) {
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) {
_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;
}
case SPUDeltaCompressionModeBzip2:
{
#if SPARKLE_BUILD_BZIP2_DELTA_SUPPORT
case SPUDeltaCompressionModeBzip2: {
int bzerror = 0;
BZ2_bzWrite(&bzerror, _bzipFile, buffer, length);
BZ2_bzWrite(&bzerror, self.bzipFile, buffer, length);
switch (bzerror) {
case BZ_OK:
return YES;
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;
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;
}
#else
return NO;
#endif
}
case SPUDeltaCompressionModeLZMA:
case SPUDeltaCompressionModeLZFSE:
@@ -706,21 +696,21 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
_compressionStream.src_ptr = buffer;
_compressionStream.src_size = (size_t)length;
FILE *file = _file;
void *compressionBuffer = _compressionBuffer;
FILE *file = self.file;
void *compressionBuffer = self.compressionBuffer;
while (_compressionStream.src_size > 0) {
// Reset destination buffer
_compressionStream.dst_ptr = compressionBuffer;
_compressionStream.dst_size = COMPRESSION_BUFFER_SIZE;
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;
}
size_t compressedBytesWritten = (size_t)(_compressionStream.dst_ptr - (uint8_t *)compressionBuffer);
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;
}
}
@@ -733,31 +723,31 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
- (void)writeHeader:(SPUDeltaArchiveHeader *)header
{
char patchFilePath[PATH_MAX + 1] = {0};
if (![_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] }];
if (![self.patchFile getFileSystemRepresentation:patchFilePath maxLength:sizeof(patchFilePath) - 1]) {
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;
}
FILE *file = fopen(patchFilePath, "wb");
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;
}
_file = file;
self.file = file;
char magic[] = SPARKLE_DELTA_FORMAT_MAGIC;
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;
}
SPUDeltaCompressionMode compression = (header.compression == SPUDeltaCompressionModeDefault) ? SPUDeltaCompressionModeLZMA : header.compression;
_compression = compression;
self.compression = compression;
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;
}
@@ -765,19 +755,13 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
uint8_t compressionLevel = 0;
switch (compression) {
case SPUDeltaCompressionModeBzip2:
#if SPARKLE_BUILD_BZIP2_DELTA_SUPPORT
// Only 1 - 9 are valid, 0 is a special case for using default 9
if (header.compressionLevel <= 0 || header.compressionLevel > 9) {
compressionLevel = 9;
} else {
compressionLevel = header.compressionLevel;
}
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
// Let's record them in the archive
case SPUDeltaCompressionModeLZMA:
@@ -796,7 +780,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
SparkleDeltaArchiveMetadata metadata = {.compressionLevel = compressionLevel, .fileSystemCompression = header.fileSystemCompression};
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;
}
@@ -804,7 +788,6 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
case SPUDeltaCompressionModeNone:
break;
case SPUDeltaCompressionModeBzip2: {
#if SPARKLE_BUILD_BZIP2_DELTA_SUPPORT
int bzerror = 0;
// Compression level can be 1 - 9
int blockSize100k = (int)compressionLevel;
@@ -813,18 +796,17 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
if (bzipFile == NULL) {
switch (bzerror) {
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;
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;
}
return;
}
_bzipFile = bzipFile;
#endif
self.bzipFile = bzipFile;
break;
}
@@ -833,12 +815,12 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
case SPUDeltaCompressionModeLZ4:
case SPUDeltaCompressionModeZLIB: {
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;
}
_initializedCompressionStream = YES;
self.initializedCompressionStream = YES;
break;
}
}
@@ -859,16 +841,16 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
- (void)addItem:(SPUDeltaArchiveItem *)item
{
[_writableItems addObject:item];
[self.writableItems addObject:item];
}
- (void)finishEncodingItems
{
if (_error != nil) {
if (self.error != nil) {
return;
}
NSMutableArray<SPUDeltaArchiveItem *> *writableItems = _writableItems;
NSMutableArray<SPUDeltaArchiveItem *> *writableItems = self.writableItems;
// Build relative path table for tracking file clones
NSMutableDictionary<NSString *, NSNumber *> *relativePathToIndexTable = [NSMutableDictionary dictionary];
@@ -900,7 +882,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
if (relativePathToIndexTable.count > UINT32_MAX) {
// Very unlikely but we should guard against this
// 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;
}
@@ -911,7 +893,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
char relativePathString[PATH_MAX + 1] = {0};
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;
}
@@ -920,14 +902,14 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
for (NSString *clonedPathEntry in newClonedPathEntries) {
char relativePathString[PATH_MAX + 1] = {0};
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;
}
totalPathLength += strlen(relativePathString) + 1;
}
if (_error != nil) {
if (self.error != nil) {
return;
}
@@ -942,7 +924,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
char pathBuffer[PATH_MAX + 1] = {0};
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;
}
@@ -953,7 +935,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
for (NSString *clonedPathEntry in newClonedPathEntries) {
char pathBuffer[PATH_MAX + 1] = {0};
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;
}
@@ -962,7 +944,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
}
}
if (_error != nil) {
if (self.error != nil) {
return;
}
@@ -985,13 +967,13 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
char sourcePathString[PATH_MAX + 1] = {0};
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;
}
struct stat 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;
}
@@ -1018,7 +1000,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
NSNumber *relativePathIndex = relativePathToIndexTable[clonedRelativePath];
if (relativePathIndex == nil) {
// 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;
}
@@ -1033,13 +1015,13 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
char itemFilePathString[PATH_MAX + 1] = {0};
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;
}
struct stat 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;
}
@@ -1059,13 +1041,13 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
char sourceFilePathString[PATH_MAX + 1] = {0};
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;
}
struct stat 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;
}
@@ -1101,13 +1083,13 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
char itemFilePathString[PATH_MAX + 1] = {0};
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;
}
struct stat 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;
}
@@ -1121,7 +1103,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
} else if (S_ISLNK(extractMode)) {
off_t fileSize = itemFileInfo.st_size;
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;
}
@@ -1141,7 +1123,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
}
}
if (_error != nil) {
if (self.error != nil) {
return;
}
@@ -1152,7 +1134,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
}
// Encode all of our file contents
void *tempBuffer = _partialChunkBuffer;
void *tempBuffer = self.partialChunkBuffer;
for (SPUDeltaArchiveItem *item in writableItems) {
SPUDeltaItemCommands commands = item.commands;
if ((commands & SPUDeltaItemCommandExtract) != 0 || (commands & SPUDeltaItemCommandBinaryDiff) != 0) {
@@ -1167,13 +1149,13 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
if (totalItemSize > 0) {
char itemFilePathString[PATH_MAX + 1] = {0};
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;
}
FILE *inputFile = fopen(itemFilePathString, "rb");
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;
}
@@ -1182,7 +1164,7 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
uint64_t currentBlockSize = (bytesLeftoverToCopy >= PARTIAL_IO_CHUNK_SIZE) ? PARTIAL_IO_CHUNK_SIZE : bytesLeftoverToCopy;
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;
}
@@ -1195,21 +1177,21 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
fclose(inputFile);
if (_error != nil) {
if (self.error != nil) {
break;
}
}
} else if (S_ISLNK(extractMode)) {
char itemFilePathString[PATH_MAX + 1] = {0};
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;
}
char linkDestination[PATH_MAX + 1] = {0};
ssize_t linkDestinationLength = readlink(itemFilePathString, linkDestination, PATH_MAX);
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;
}
@@ -1222,19 +1204,16 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
// Close up and write final data to compressed streams
#if SPARKLE_BUILD_BZIP2_DELTA_SUPPORT
if (_bzipFile != NULL) {
if (self.bzipFile != NULL) {
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) {
_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;
}
} else
#endif
if (_initializedCompressionStream) {
void *compressionBuffer = _compressionBuffer;
FILE *file = _file;
} else if (self.initializedCompressionStream) {
void *compressionBuffer = self.compressionBuffer;
FILE *file = self.file;
_compressionStream.src_size = 0;
@@ -1244,14 +1223,14 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
compression_status status = compression_stream_process(&_compressionStream, COMPRESSION_STREAM_FINALIZE);
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;
}
size_t compressedBytesToWrite = (size_t)(_compressionStream.dst_ptr - (uint8_t *)compressionBuffer);
if (compressedBytesToWrite > 0) {
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;
}
}
@@ -1265,3 +1244,5 @@ static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMod
}
@end
#pragma clang diagnostic pop
+3 -7
View File
@@ -6,8 +6,6 @@
// Copyright © 2021 Sparkle Project. All rights reserved.
//
#if SPARKLE_BUILD_LEGACY_DELTA_SUPPORT
#import <Foundation/Foundation.h>
#import "SPUDeltaArchiveProtocol.h"
@@ -16,13 +14,11 @@
NS_ASSUME_NONNULL_BEGIN
// 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)initWithPatchFileForReading:(NSString *)patchFile SPU_OBJC_DIRECT;
- (instancetype)initWithPatchFileForWriting:(NSString *)patchFile;
- (instancetype)initWithPatchFileForReading:(NSString *)patchFile;
@end
NS_ASSUME_NONNULL_END
#endif
+34 -31
View File
@@ -6,8 +6,6 @@
// Copyright © 2021 Sparkle Project. All rights reserved.
//
#if SPARKLE_BUILD_LEGACY_DELTA_SUPPORT
#import "SPUXarDeltaArchive.h"
#include <xar/xar.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_UNSUPPORTED_COMPRESSION_FAILURE 4
@implementation SPUXarDeltaArchive
{
NSMutableDictionary<NSString *, NSValue *> *_fileTable;
NSString *_patchFile;
xar_t _x;
int32_t _xarMode;
}
@interface SPUXarDeltaArchive ()
@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;
- (instancetype)initWithPatchFileForWriting:(NSString *)patchFile
@@ -86,9 +91,9 @@ extern char *xar_get_safe_path(xar_file_t f) __attribute__((weak_import));
- (void)close
{
if (_x != NULL) {
xar_close(_x);
_x = NULL;
if (self.x != NULL) {
xar_close(self.x);
self.x = NULL;
}
}
@@ -100,18 +105,18 @@ extern char *xar_get_safe_path(xar_file_t f) __attribute__((weak_import));
- (nullable SPUDeltaArchiveHeader *)readHeader
{
NSString *patchFile = _patchFile;
NSString *patchFile = self.patchFile;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// Sparkle's XAR delta archives have been superceded by Sparkle's own format
xar_t x = xar_open(patchFile.fileSystemRepresentation, READ);
#pragma clang diagnostic pop
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;
}
_x = x;
self.x = x;
uint16_t majorDiffVersion = SUBinaryDeltaMajorVersionFirst;
uint16_t minorDiffVersion = 0;
@@ -119,7 +124,7 @@ extern char *xar_get_safe_path(xar_file_t f) __attribute__((weak_import));
NSString *expectedAfterHash = nil;
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) {
{
// 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
{
NSString *patchFile = _patchFile;
NSString *patchFile = self.patchFile;
#pragma clang diagnostic push
#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);
#pragma clang diagnostic pop
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;
}
_x = x;
self.x = x;
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 SPUDeltaCompressionModeLZ4:
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;
}
@@ -276,7 +281,7 @@ static xar_file_t _xarAddFile(NSMutableDictionary<NSString *, NSValue *> *fileTa
- (void)addItem:(SPUDeltaArchiveItem *)item
{
if (_error != nil) {
if (self.error != nil) {
return;
}
@@ -285,9 +290,9 @@ static xar_file_t _xarAddFile(NSMutableDictionary<NSString *, NSValue *> *fileTa
SPUDeltaItemCommands commands = item.commands;
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) {
_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;
}
@@ -315,13 +320,13 @@ static xar_file_t _xarAddFile(NSMutableDictionary<NSString *, NSValue *> *fileTa
- (void)enumerateItems:(void (^)(SPUDeltaArchiveItem *, BOOL *))itemHandler
{
if (_error != nil) {
if (self.error != nil) {
return;
}
BOOL exitedEarly = NO;
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;
#if HAS_XAR_GET_SAFE_PATH
#pragma clang diagnostic push
@@ -392,7 +397,7 @@ static xar_file_t _xarAddFile(NSMutableDictionary<NSString *, NSValue *> *fileTa
- (BOOL)extractItem:(SPUDeltaArchiveItem *)item
{
if (_error != nil) {
if (self.error != nil) {
return NO;
}
@@ -400,8 +405,8 @@ static xar_file_t _xarAddFile(NSMutableDictionary<NSString *, NSValue *> *fileTa
assert(item.xarContext != NULL);
xar_file_t file = item.xarContext;
if (xar_extract_tofile(_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] }];
if (xar_extract_tofile(self.x, file, item.itemFilePath.fileSystemRepresentation) != 0) {
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;
}
@@ -409,5 +414,3 @@ static xar_file_t _xarAddFile(NSMutableDictionary<NSString *, NSValue *> *fileTa
}
@end
#endif
+27 -22
View File
@@ -282,21 +282,6 @@ BOOL applyBinaryDelta(NSString *source, NSString *finalDestination, NSString *pa
clonedRelativePath = nil;
}
// Decide if we need to preserve original file permissions from the original file
// applyBinaryDeltaToFile() normally preserves file permissions on the file it's replacing.
// However this is not possible if the destination file we're patching is not writable.
// We also need to preserve permissions for clones except when we'll be changing permissions later anyway.
BOOL needsToCopyFilePermissions;
if (![fileManager isWritableFileAtPath:destinationFilePath]) {
// Remove the file non-writable we're patching that may cause issues
[fileManager removeItemAtPath:destinationFilePath error:NULL];
// We will need to preserve permissons if there is no need to make permission changes later on
needsToCopyFilePermissions = (commands & SPUDeltaItemCommandModifyPermissions) == 0;
} else {
needsToCopyFilePermissions = ((commands & SPUDeltaItemCommandClone) != 0) && ((commands & SPUDeltaItemCommandModifyPermissions) == 0);
}
if (!applyBinaryDeltaToFile(tempDiffFile, sourceDiffFilePath, destinationFilePath)) {
if (verbose) {
fprintf(stderr, "\n");
@@ -308,7 +293,12 @@ BOOL applyBinaryDelta(NSString *source, NSString *finalDestination, NSString *pa
return;
}
if (needsToCopyFilePermissions) {
// Preserve original file permissions from the original file
// Only necessary for clones because applyBinaryDeltaToFile() otherwise preserves
// file permissions on the file it's replacing. Also not necessary if we're going to
// change permissions later
if ((commands & SPUDeltaItemCommandClone) != 0 && (commands & SPUDeltaItemCommandModifyPermissions) == 0) {
struct stat sourceFileInfo = {0};
if (lstat(sourceDiffFilePath.fileSystemRepresentation, &sourceFileInfo) != 0) {
if (verbose) {
@@ -408,17 +398,32 @@ BOOL applyBinaryDelta(NSString *source, NSString *finalDestination, NSString *pa
NSTask *dittoTask = [[NSTask alloc] init];
dittoTask.executableURL = [NSURL fileURLWithPath:@"/usr/bin/ditto" isDirectory:NO];
if (@available(macOS 10.13, *)) {
dittoTask.executableURL = [NSURL fileURLWithPath:@"/usr/bin/ditto" isDirectory:NO];
} else {
dittoTask.launchPath = @"/usr/bin/ditto";
}
dittoTask.arguments = @[@"--hfsCompression", destination, finalDestination];
// If we fail to apply file system compression, we will try falling back to not doing this
BOOL failedToApplyFileSystemCompression = NO;
NSError *launchError = nil;
if (![dittoTask launchAndReturnError:&launchError]) {
failedToApplyFileSystemCompression = YES;
fprintf(stderr, "\nWarning: failed to launch ditto task for file compression: %s", launchError.localizedDescription.UTF8String);
if (@available(macOS 10.13, *)) {
NSError *launchError = nil;
if (![dittoTask launchAndReturnError:&launchError]) {
failedToApplyFileSystemCompression = YES;
fprintf(stderr, "\nWarning: failed to launch ditto task for file compression: %s", launchError.localizedDescription.UTF8String);
}
} else {
@try {
[dittoTask launch];
} @catch (NSException *exception) {
failedToApplyFileSystemCompression = YES;
fprintf(stderr, "\nWarning: failed to launch ditto task for file compression: %s", exception.reason.UTF8String);
}
}
if (!failedToApplyFileSystemCompression) {
+2 -3
View File
@@ -52,10 +52,9 @@ extern SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionLatest;
extern SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionFirst;
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' (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_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_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);
NSString *deltaCompressionStringFromMode(SPUDeltaCompressionMode mode);
+27 -43
View File
@@ -29,47 +29,42 @@
extern int bsdiff(int argc, const char **argv);
@interface CreateBinaryDeltaOperation : NSOperation
@property (nonatomic, copy, readonly) NSString *relativePath;
@property (nonatomic, copy, readonly) NSString *clonedRelativePath;
@property (nonatomic, readonly) NSString *resultPath;
@property (nonatomic, readonly) NSNumber *oldPermissions;
@property (nonatomic, readonly) NSNumber *permissions;
@property (nonatomic, readonly) NSString *fromPath;
@property (nonatomic, readonly) 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;
@property (copy) NSString *relativePath;
@property (copy) NSString *clonedRelativePath;
@property (strong) NSString *resultPath;
@property (strong) NSNumber *oldPermissions;
@property (strong) NSNumber *permissions;
@property (nonatomic) BOOL changingPermissions;
@property (strong) NSString *_fromPath;
@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;
@end
@implementation CreateBinaryDeltaOperation
{
NSString *_toPath;
}
@synthesize relativePath = _relativePath;
@synthesize clonedRelativePath = _clonedRelativePath;
@synthesize resultPath = _resultPath;
@synthesize oldPermissions = _oldPermissions;
@synthesize permissions = _permissions;
@synthesize fromPath = _fromPath;
@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
{
if ((self = [super init])) {
_relativePath = [relativePath copy];
_clonedRelativePath = [clonedRelativePath copy];
_oldPermissions = oldPermissions;
_permissions = permissions;
_changingPermissions = changingPermissions;
self.relativePath = relativePath;
self.clonedRelativePath = clonedRelativePath;
self.oldPermissions = oldPermissions;
self.permissions = permissions;
self.changingPermissions = changingPermissions;
if (clonedRelativePath == nil) {
_fromPath = [oldTree stringByAppendingPathComponent:relativePath];
self._fromPath = [oldTree stringByAppendingPathComponent:relativePath];
} else {
_fromPath = [oldTree stringByAppendingPathComponent:clonedRelativePath];
self._fromPath = [oldTree stringByAppendingPathComponent:clonedRelativePath];
}
_toPath = [newTree stringByAppendingPathComponent:relativePath];
self._toPath = [newTree stringByAppendingPathComponent:relativePath];
}
return self;
}
@@ -77,11 +72,10 @@ extern int bsdiff(int argc, const char **argv);
- (void)main
{
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);
if (result == 0) {
_resultPath = temporaryFile;
}
if (!result)
self.resultPath = temporaryFile;
}
@end
@@ -498,7 +492,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
fprintf(stderr, "\n");
}
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Diffing code signed extended attributes are not supported. Detected extended attribute in before-tree on file %@. For removing code signed extended attributes and improving your bundle's structure, please see https://developer.apple.com/documentation/bundleresources/placing_content_in_a_bundle", @(ent->fts_path)] }];
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Diffing code signed extended attributes are not supported. Detected extended attribute in before-tree on file %@", @(ent->fts_path)] }];
}
return NO;
}
@@ -616,7 +610,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
fprintf(stderr, "\n");
}
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Diffing code signed extended attributes are not supported. Detected extended attribute in after-tree on file %@. For removing code signed extended attributes and improving your bundle's structure, please see https://developer.apple.com/documentation/bundleresources/placing_content_in_a_bundle", @(ent->fts_path)] }];
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Diffing code signed extended attributes are not supported. Detected extended attribute in after-tree on file %@", @(ent->fts_path)] }];
}
return NO;
}
@@ -710,17 +704,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
if (majorVersion >= SUBinaryDeltaMajorVersion3) {
archive = [[SPUSparkleDeltaArchive alloc] initWithPatchFileForWriting:temporaryFile];
} else {
#if SPARKLE_BUILD_LEGACY_DELTA_SUPPORT
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];
@@ -934,7 +918,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
BOOL deltaOperationsFailed = NO;
for (CreateBinaryDeltaOperation *operation in deltaOperations) {
NSString *resultPath = operation.resultPath;
NSString *resultPath = [operation resultPath];
if (resultPath == nil) {
if (verbose) {
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];
item.itemFilePath = resultPath;
item.sourcePath = operation.fromPath;
item.sourcePath = operation._fromPath;
item.clonedRelativePath = clonedRelativePath;
[archive addItem:item];
@@ -988,7 +972,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
// Clean up operations after the archive has finished encoding
for (CreateBinaryDeltaOperation *operation in deltaOperations) {
NSString *resultPath = operation.resultPath;
NSString *resultPath = [operation resultPath];
if (resultPath != nil) {
unlink(resultPath.fileSystemRepresentation);
}
-5
View File
@@ -14,15 +14,10 @@
NS_ASSUME_NONNULL_BEGIN
#ifndef BUILDING_SPARKLE_TESTS
SPU_OBJC_DIRECT_MEMBERS
#endif
@interface SUBinaryDeltaUnarchiver : NSObject <SUUnarchiverProtocol>
- (instancetype)initWithArchivePath:(NSString *)archivePath updateHostBundlePath:(NSString *)updateHostBundlePath;
+ (BOOL)canUnarchivePath:(NSString *)path;
@end
NS_ASSUME_NONNULL_END
+15 -13
View File
@@ -16,11 +16,17 @@
#include "AppKitPrevention.h"
@interface SUBinaryDeltaUnarchiver ()
@property (nonatomic, copy, readonly) NSString *archivePath;
@property (nonatomic, copy, readonly) NSString *updateHostBundlePath;
@end
@implementation SUBinaryDeltaUnarchiver
{
NSString *_archivePath;
NSString *_updateHostBundlePath;
}
@synthesize archivePath = _archivePath;
@synthesize updateHostBundlePath = _updateHostBundlePath;
+ (BOOL)canUnarchivePath:(NSString *)path
{
@@ -37,11 +43,7 @@
// 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.
// 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
#ifndef BUILDING_SPARKLE_TESTS
SPU_OBJC_DIRECT
#endif
{
NSURL *targetURL = [NSURL fileURLWithPath:targetPath];
// Only recurse if it's actually a directory. Don't recurse into a
@@ -93,17 +95,17 @@ SPU_OBJC_DIRECT
- (void)extractDeltaWithNotifier:(SUUnarchiverNotifier *)notifier
{
NSString *sourcePath = _updateHostBundlePath;
NSString *targetPath = [[_archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:[sourcePath lastPathComponent]];
NSString *sourcePath = self.updateHostBundlePath;
NSString *targetPath = [[self.archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:[sourcePath lastPathComponent]];
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];
}, &applyDiffError);
if (success) {
[SUBinaryDeltaUnarchiver updateSpotlightImportersAtBundlePath:targetPath];
[[self class] updateSpotlightImportersAtBundlePath:targetPath];
[notifier notifySuccess];
}
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
+1 -4
View File
@@ -11,12 +11,9 @@
#import <Foundation/Foundation.h>
#ifndef BUILDING_SPARKLE_TESTS
SPU_OBJC_DIRECT_MEMBERS
#endif
@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;
+19 -6
View File
@@ -17,7 +17,7 @@
@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;
SecRequirementRef requirement = NULL;
@@ -148,7 +148,7 @@ 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);
if (checkNestedCode) {
flags |= kSecCSCheckNestedCode;
@@ -209,8 +209,22 @@ static id valueOrNSNull(id value) {
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;
const SecCSFlags flags = (SecCSFlags) (kSecCSSigningInformation | kSecCSRequirementInformation | kSecCSDynamicInformation | kSecCSContentInformation);
if (SecCodeCopySigningInformation(code, flags, &signingInfo) == noErr) {
@@ -227,8 +241,7 @@ static id valueOrNSNull(id value) {
return nil;
}
+ (NSDictionary *)logSigningInfoForCode:(SecStaticCodeRef)code label:(NSString*)label SPU_OBJC_DIRECT
{
+ (NSDictionary *)logSigningInfoForCode:(SecStaticCodeRef)code label:(NSString*)label {
NSDictionary *relevantInfo = [self codeSignatureInfoForCode:code];
SULog(SULogLevelDefault, @"%@: %@", label, relevantInfo);
return relevantInfo;
+1 -7
View File
@@ -6,8 +6,6 @@
// Copyright 2008 Andy Matuschak. All rights reserved.
//
#if SPARKLE_BUILD_DMG_SUPPORT
#ifndef SUDISKIMAGEUNARCHIVER_H
#define SUDISKIMAGEUNARCHIVER_H
@@ -16,16 +14,12 @@
NS_ASSUME_NONNULL_BEGIN
SPU_OBJC_DIRECT_MEMBERS @interface SUDiskImageUnarchiver : NSObject <SUUnarchiverProtocol>
@interface SUDiskImageUnarchiver : NSObject <SUUnarchiverProtocol>
- (instancetype)initWithArchivePath:(NSString *)archivePath decryptionPassword:(nullable NSString *)decryptionPassword;
+ (BOOL)canUnarchivePath:(NSString *)path;
@end
NS_ASSUME_NONNULL_END
#endif
#endif
+54 -28
View File
@@ -6,8 +6,6 @@
// Copyright 2008 Andy Matuschak. All rights reserved.
//
#if SPARKLE_BUILD_DMG_SUPPORT
#import "SUDiskImageUnarchiver.h"
#import "SUUnarchiverNotifier.h"
#import "SULog.h"
@@ -15,11 +13,17 @@
#include "AppKitPrevention.h"
@interface SUDiskImageUnarchiver ()
@property (nonatomic, copy, readonly) NSString *archivePath;
@property (nullable, nonatomic, copy, readonly) NSString *decryptionPassword;
@end
@implementation SUDiskImageUnarchiver
{
NSString *_archivePath;
NSString *_decryptionPassword;
}
@synthesize archivePath = _archivePath;
@synthesize decryptionPassword = _decryptionPassword;
+ (BOOL)canUnarchivePath:(NSString *)path
{
@@ -50,7 +54,7 @@
}
// Called on a non-main thread.
- (void)extractDMGWithNotifier:(SUUnarchiverNotifier *)notifier SPU_OBJC_DIRECT
- (void)extractDMGWithNotifier:(SUUnarchiverNotifier *)notifier
{
@autoreleasepool {
BOOL mountedSuccessfully = NO;
@@ -62,18 +66,28 @@
NSArray *contents = nil;
do
{
NSString *uuidString = [[NSUUID UUID] UUIDString];
mountPoint = [@"/Volumes" stringByAppendingPathComponent:uuidString];
// Using NSUUID would make creating UUIDs be done in Cocoa,
// and thus managed under ARC. Sadly, the class is in 10.8 and later.
CFUUIDRef uuid = CFUUIDCreate(NULL);
if (uuid)
{
NSString *uuidString = CFBridgingRelease(CFUUIDCreateString(NULL, uuid));
if (uuidString)
{
mountPoint = [@"/Volumes" stringByAppendingPathComponent:uuidString];
}
CFRelease(uuid);
}
}
// Note: this check does not follow symbolic links, which is what we want
while ([[NSURL fileURLWithPath:mountPoint] checkResourceIsReachableAndReturnError:NULL]);
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) {
NSMutableData *passwordData = [[_decryptionPassword dataUsingEncoding:NSUTF8StringEncoding] mutableCopy];
if (self.decryptionPassword) {
NSMutableData *passwordData = [[self.decryptionPassword dataUsingEncoding:NSUTF8StringEncoding] mutableCopy];
// From the hdiutil docs:
// read a null-terminated passphrase from standard input
//
@@ -114,8 +128,16 @@
dispatch_semaphore_signal(terminationSemaphore);
};
if (![task launchAndReturnError:&error]) {
goto reportError;
if (@available(macOS 10.13, *)) {
if (![task launchAndReturnError:&error]) {
goto reportError;
}
} else {
@try {
[task launch];
} @catch (NSException *) {
goto reportError;
}
}
[notifier notifyProgress:0.125];
@@ -126,17 +148,13 @@
if (![inputPipe.fileHandleForWriting writeData:promptData error:&error]) {
goto reportError;
}
}
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_15
else
{
} else {
@try {
[inputPipe.fileHandleForWriting writeData:promptData];
} @catch (NSException *) {
goto reportError;
}
}
#endif
[inputPipe.fileHandleForWriting closeFile];
@@ -171,7 +189,7 @@
for (NSString *item in contents)
{
NSString *fromPath = [mountPoint stringByAppendingPathComponent:item];
NSString *toPath = [[_archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:item];
NSString *toPath = [[self.archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:item];
itemsCopied += 1.0;
[notifier notifyProgress:0.5 + itemsCopied/(totalItems*2.0)];
@@ -203,19 +221,27 @@
task.standardOutput = [NSPipe pipe];
task.standardError = [NSPipe pipe];
NSError *launchCleanupError = nil;
if (![task launchAndReturnError:&launchCleanupError]) {
SULog(SULogLevelError, @"Failed to unmount %@", mountPoint);
SULog(SULogLevelError, @"Error: %@", launchCleanupError);
if (@available(macOS 10.13, *)) {
NSError *launchCleanupError = nil;
if (![task launchAndReturnError:&launchCleanupError]) {
SULog(SULogLevelError, @"Failed to unmount %@", mountPoint);
SULog(SULogLevelError, @"Error: %@", launchCleanupError);
}
} else {
@try {
[task launch];
} @catch (NSException *exception) {
SULog(SULogLevelError, @"Failed to unmount %@", mountPoint);
SULog(SULogLevelError, @"Exception: %@", exception);
}
}
} 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
#endif
+1 -7
View File
@@ -6,22 +6,16 @@
// Copyright © 2021 Sparkle Project. All rights reserved.
//
#if SPARKLE_BUILD_PACKAGE_SUPPORT
#import <Foundation/Foundation.h>
#import "SUUnarchiverProtocol.h"
NS_ASSUME_NONNULL_BEGIN
// 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;
+ (BOOL)canUnarchivePath:(NSString *)path;
@end
NS_ASSUME_NONNULL_END
#endif
+15 -13
View File
@@ -6,8 +6,6 @@
// Copyright © 2021 Sparkle Project. All rights reserved.
//
#if SPARKLE_BUILD_PACKAGE_SUPPORT
#import "SUFlatPackageUnarchiver.h"
#import "SUUnarchiverNotifier.h"
#import "SPUInstallationType.h"
@@ -16,11 +14,17 @@
#include "AppKitPrevention.h"
@interface SUFlatPackageUnarchiver ()
@property (nonatomic, readonly) NSString *flatPackagePath;
@property (nonatomic, readonly) NSString *expectedInstallationType;
@end
@implementation SUFlatPackageUnarchiver
{
NSString *_flatPackagePath;
NSString *_expectedInstallationType;
}
@synthesize flatPackagePath = _flatPackagePath;
@synthesize expectedInstallationType = _expectedInstallationType;
+ (BOOL)canUnarchivePath:(NSString *)path
{
@@ -48,18 +52,16 @@
// Flat packages must use guided package installs, not interactive
BOOL isDirectory = NO;
if (![_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]}]];
} else if (![[NSFileManager defaultManager] fileExistsAtPath:_flatPackagePath isDirectory:&isDirectory] || isDirectory) {
[notifier notifyFailureWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Flat package does not exist at %@", _flatPackagePath]}]];
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", self.expectedInstallationType]}]];
} 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 %@", self.flatPackagePath]}]];
} else {
[notifier notifyProgress:1.0];
[notifier notifySuccess];
}
}
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], _flatPackagePath]; }
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], self.flatPackagePath]; }
@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.
*/
#if SPARKLE_BUILD_PACKAGE_SUPPORT
#import <Foundation/Foundation.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;
@end
#endif
+35 -20
View File
@@ -6,8 +6,6 @@
// Copyright 2010 Dragon Systems Software Limited. All rights reserved.
//
#if SPARKLE_BUILD_PACKAGE_SUPPORT
#import <sys/stat.h>
#import "SUGuidedPackageInstaller.h"
#import "SUErrors.h"
@@ -15,12 +13,19 @@
#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
{
NSString *_packagePath;
NSString *_homeDirectory;
NSString *_userName;
}
@synthesize packagePath = _packagePath;
@synthesize homeDirectory = _homeDirectory;
@synthesize userName = _userName;
- (instancetype)initWithPackagePath:(NSString *)packagePath homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName
{
@@ -45,24 +50,36 @@
NSTask *task = [[NSTask alloc] init];
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
task.environment = @{@"HOME": _homeDirectory, @"USER": _userName};
task.environment = @{@"HOME": self.homeDirectory, @"USER": self.userName};
task.standardError = nil;
task.standardOutput = nil;
NSError *launchError = nil;
if (![task launchAndReturnError:&launchError]) {
if (error != NULL) {
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey: @"Guided package installer failed to launch" }];
if (launchError != nil) {
userInfo[NSUnderlyingErrorKey] = launchError;
if (@available(macOS 10.13, *)) {
NSError *launchError = nil;
if (![task launchAndReturnError:&launchError]) {
if (error != NULL) {
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey: @"Guided package installer failed to launch" }];
if (launchError != nil) {
userInfo[NSUnderlyingErrorKey] = launchError;
}
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:userInfo];
}
return NO;
}
} else {
@try {
[task launch];
} @catch (NSException *) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: @"Guided package installer task threw an exception" }];
}
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:userInfo];
return NO;
}
return NO;
}
[task waitUntilExit];
@@ -88,5 +105,3 @@
}
@end
#endif
+2 -6
View File
@@ -13,15 +13,11 @@ NS_ASSUME_NONNULL_BEGIN
@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 NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host
#if SPARKLE_BUILD_PACKAGE_SUPPORT
isPackage:(BOOL *)isPackagePtr isGuided:(nullable BOOL *)isGuidedPtr
#endif
;
+ (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(nullable BOOL *)isGuidedPtr;
@end
+6 -39
View File
@@ -22,7 +22,7 @@
@implementation SUInstaller
+ (BOOL)isAliasFolderAtPath:(NSString *)path SPU_OBJC_DIRECT
+ (BOOL)isAliasFolderAtPath:(NSString *)path
{
NSNumber *aliasFlag = nil;
[[NSURL fileURLWithPath:path] getResourceValue:&aliasFlag forKey:NSURLIsAliasFileKey error:nil];
@@ -31,10 +31,7 @@
return aliasFlag.boolValue && directoryFlag.boolValue;
}
+ (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host
#if SPARKLE_BUILD_PACKAGE_SUPPORT
isPackage:(BOOL *)isPackagePtr isGuided:(BOOL *)isGuidedPtr
#endif
+ (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(BOOL *)isGuidedPtr
{
NSParameterAssert(inUpdateFolder);
NSParameterAssert(host);
@@ -44,31 +41,23 @@
*newAppDownloadPath = nil,
*bundleFileName = [[host bundlePath] lastPathComponent],
*alternateBundleFileName = [[host name] stringByAppendingPathExtension:[[host bundlePath] pathExtension]];
#if SPARKLE_BUILD_PACKAGE_SUPPORT
NSString *fallbackPackagePath = nil;
BOOL isPackage = NO;
BOOL isGuided = YES;
#endif
NSString *fallbackPackagePath = nil;
NSDirectoryEnumerator *dirEnum = [[NSFileManager defaultManager] enumeratorAtPath:inUpdateFolder];
NSString *bundleFileNameNoExtension = [bundleFileName stringByDeletingPathExtension];
while ((currentFile = [dirEnum nextObject])) {
NSString *currentPath = [inUpdateFolder stringByAppendingPathComponent:currentFile];
NSString *currentFilename = [currentFile lastPathComponent];
#if SPARKLE_BUILD_PACKAGE_SUPPORT
NSString *currentExtension = [currentFile pathExtension];
NSString *currentFilenameNoExtension = [currentFilename stringByDeletingPathExtension];
#endif
if ([currentFilename isEqualToString:bundleFileName] ||
[currentFilename isEqualToString:alternateBundleFileName]) // We found one!
{
#if SPARKLE_BUILD_PACKAGE_SUPPORT
isPackage = NO;
#endif
newAppDownloadPath = currentPath;
break;
#if SPARKLE_BUILD_PACKAGE_SUPPORT
} else if ([currentExtension isEqualToString:@"pkg"] ||
[currentExtension isEqualToString:@"mpkg"]) {
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.
fallbackPackagePath = currentPath;
}
#endif
} else {
// Try matching on bundle identifiers in case the user has changed the name of the host app
NSBundle *incomingBundle = [NSBundle bundleWithPath:currentPath];
NSString *hostBundleIdentifier = host.bundle.bundleIdentifier;
if (incomingBundle && [incomingBundle.bundleIdentifier isEqualToString:hostBundleIdentifier]) {
#if SPARKLE_BUILD_PACKAGE_SUPPORT
isPackage = NO;
#endif
newAppDownloadPath = currentPath;
break;
}
@@ -98,7 +84,6 @@
[dirEnum skipDescendents];
}
#if SPARKLE_BUILD_PACKAGE_SUPPORT
// We don't have a valid path. Try to use the fallback package.
if (newAppDownloadPath == nil && fallbackPackagePath != nil) {
@@ -120,33 +105,18 @@
*isPackagePtr = isPackage;
if (isGuidedPtr)
*isGuidedPtr = isGuided;
#endif
if (!newAppDownloadPath) {
SULog(SULogLevelError, @"Searched %@ for %@.(app%@)", inUpdateFolder, bundleFileNameNoExtension,
#if SPARKLE_BUILD_PACKAGE_SUPPORT
@"|pkg"
#else
@""
#endif
);
SULog(SULogLevelError, @"Searched %@ for %@.(app|pkg)", inUpdateFolder, bundleFileNameNoExtension);
}
return newAppDownloadPath;
}
+ (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 isGuided = NO;
#endif
NSString *newDownloadPath = [self installSourcePathInUpdateFolder:updateDirectory forHost:host
#if SPARKLE_BUILD_PACKAGE_SUPPORT
isPackage:&isPackage isGuided:&isGuided
#endif
];
NSString *newDownloadPath = [self installSourcePathInUpdateFolder:updateDirectory forHost:host isPackage:&isPackage isGuided:&isGuided];
if (newDownloadPath == nil) {
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
// ahead of time whether or not this installer tool should be ran as root or not
id <SUInstallerProtocol> installer = nil;
#if SPARKLE_BUILD_PACKAGE_SUPPORT
if (isPackage && isGuided) {
if (![expectedInstallationType isEqualToString:SPUInstallationTypeGuidedPackage]) {
if (error != NULL) {
@@ -176,9 +145,7 @@
} else {
installer = [[SUPackageInstaller alloc] initWithPackagePath:newDownloadPath];
}
} else
#endif
{
} else {
if (![expectedInstallationType isEqualToString:SPUInstallationTypeApplication]) {
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] }];
+1 -5
View File
@@ -6,18 +6,14 @@
// Copyright 2008 Andy Matuschak. All rights reserved.
//
#if SPARKLE_BUILD_PACKAGE_SUPPORT
#import <Foundation/Foundation.h>
#import "SUInstallerProtocol.h"
// This is the deprecated package installation type, aka the "interactive" package installer
// For a more supported package installation, see SUGuidedPackageInstaller
SPU_OBJC_DIRECT_MEMBERS @interface SUPackageInstaller : NSObject <SUInstallerProtocol>
@interface SUPackageInstaller : NSObject <SUInstallerProtocol>
- (instancetype)initWithPackagePath:(NSString *)packagePath;
@end
#endif
+9 -8
View File
@@ -6,8 +6,6 @@
// Copyright 2008 Andy Matuschak. All rights reserved.
//
#if SPARKLE_BUILD_PACKAGE_SUPPORT
#import "SUPackageInstaller.h"
#import "SUConstants.h"
#import "SUErrors.h"
@@ -16,13 +14,18 @@
#include "AppKitPrevention.h"
@interface SUPackageInstaller ()
@property (nonatomic, readonly, copy) NSString *packagePath;
@end
@implementation SUPackageInstaller
{
NSString *_packagePath;
}
static NSString *SUOpenUtilityPath = @"/usr/bin/open";
@synthesize packagePath = _packagePath;
- (instancetype)initWithPackagePath:(NSString *)packagePath
{
self = [super init];
@@ -49,7 +52,7 @@ static NSString *SUOpenUtilityPath = @"/usr/bin/open";
// -W = wait until the app has quit.
// -n = Open another instance if already open.
// -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.
@try {
@@ -77,5 +80,3 @@ static NSString *SUOpenUtilityPath = @"/usr/bin/open";
}
@end
#endif
+1 -3
View File
@@ -14,12 +14,10 @@
NS_ASSUME_NONNULL_BEGIN
SPU_OBJC_DIRECT_MEMBERS @interface SUPipedUnarchiver : NSObject <SUUnarchiverProtocol>
@interface SUPipedUnarchiver : NSObject <SUUnarchiverProtocol>
- (instancetype)initWithArchivePath:(NSString *)archivePath;
+ (BOOL)canUnarchivePath:(NSString *)path;
@end
NS_ASSUME_NONNULL_END
+50 -54
View File
@@ -14,18 +14,22 @@
#include "AppKitPrevention.h"
@implementation SUPipedUnarchiver
{
NSString *_archivePath;
}
@interface SUPipedUnarchiver ()
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 *> *extractTBZ = @[@"/usr/bin/tar", @"-jxC"];
NSArray <NSString *> *extractTXZ = extractTGZ;
// Note: keep this list in sync with generate_appcast's unarchiveUpdates()
NSDictionary <NSString *, NSArray<NSString *> *> *extractCommandDictionary =
@{
@".zip" : @[@"/usr/bin/ditto", @"-x",@"-k",@"-"],
@@ -51,7 +55,7 @@ static NSArray <NSString *> * _Nullable _commandAndArgumentsConformingToTypeOfPa
+ (BOOL)canUnarchivePath:(NSString *)path
{
return _commandAndArgumentsConformingToTypeOfPath(path) != nil;
return ([self commandAndArgumentsConformingToTypeOfPath:path] != nil);
}
+ (BOOL)mustValidateBeforeExtraction
@@ -70,7 +74,7 @@ static NSArray <NSString *> * _Nullable _commandAndArgumentsConformingToTypeOfPa
- (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);
NSString *command = commandAndArguments.firstObject;
@@ -85,26 +89,26 @@ static NSArray <NSString *> * _Nullable _commandAndArgumentsConformingToTypeOfPa
}
// 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!!!
@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.
NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:_archivePath error:nil];
NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:self.archivePath error:nil];
NSUInteger expectedLength = [(NSNumber *)[attributes objectForKey:NSFileSize] unsignedIntegerValue];
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];
return;
}
NSFileHandle *archiveInput = [NSFileHandle fileHandleForReadingAtPath:_archivePath];
NSFileHandle *archiveInput = [NSFileHandle fileHandleForReadingAtPath:self.archivePath];
NSPipe *pipe = [NSPipe pipe];
NSTask *task = [[NSTask alloc] init];
@@ -115,37 +119,34 @@ static NSArray <NSString *> * _Nullable _commandAndArgumentsConformingToTypeOfPa
[task setArguments:[args arrayByAddingObject:destination]];
NSError *launchError = nil;
if (![task launchAndReturnError:&launchError]) {
[notifier notifyFailureWithError:launchError];
return;
if (@available(macOS 10.13, *)) {
if (![task launchAndReturnError:&launchError]) {
[notifier notifyFailureWithError:launchError];
return;
}
} else {
@try {
[task launch];
} @catch (NSException *e) {
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Extraction failed, -[NSTask launch] threw exception '%@'", e.description]}];
[notifier notifyFailureWithError:error];
return;
}
}
NSFileHandle *archiveOutput = [pipe fileHandleForWriting];
NSUInteger bytesWritten = 0;
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_15
BOOL hasIOErrorMethods;
if (@available(macOS 10.15, *)) {
hasIOErrorMethods = YES;
} else {
hasIOErrorMethods = NO;
}
#endif
do {
NSData *data;
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_15
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
{
if (hasIOErrorMethods) {
NSError *readError = nil;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpartial-availability"
@@ -154,6 +155,13 @@ static NSArray <NSString *> * _Nullable _commandAndArgumentsConformingToTypeOfPa
if (data == nil) {
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];
@@ -162,18 +170,7 @@ static NSArray <NSString *> * _Nullable _commandAndArgumentsConformingToTypeOfPa
}
NSError *writeError = nil;
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_15
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
{
if (hasIOErrorMethods) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpartial-availability"
if (![archiveOutput writeData:data error:&writeError]) {
@@ -181,6 +178,13 @@ static NSArray <NSString *> * _Nullable _commandAndArgumentsConformingToTypeOfPa
SULog(SULogLevelError, @"Failed to write data to pipe with error %@", writeError);
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;
@@ -194,26 +198,18 @@ static NSArray <NSString *> * _Nullable _commandAndArgumentsConformingToTypeOfPa
if (![archiveOutput closeAndReturnError:&archiveOutputCloseError]) {
SULog(SULogLevelError, @"Failed to close pipe with error %@", archiveOutputCloseError);
}
}
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_15
else
{
} else {
[archiveOutput closeFile];
}
#endif
if (@available(macOS 10.15, *)) {
NSError *archiveInputCloseError = nil;
if (![archiveInput closeAndReturnError:&archiveInputCloseError]) {
SULog(SULogLevelError, @"Failed to close archive input with error %@", archiveInputCloseError);
}
}
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_15
else
{
} else {
[archiveInput closeFile];
}
#endif
[task waitUntilExit];
@@ -235,6 +231,6 @@ static NSArray <NSString *> * _Nullable _commandAndArgumentsConformingToTypeOfPa
}
}
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], _archivePath]; }
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], self.archivePath]; }
@end
+1 -1
View File
@@ -12,7 +12,7 @@
@class SUHost;
@protocol SUVersionComparison;
SPU_OBJC_DIRECT_MEMBERS @interface SUPlainInstaller : NSObject <SUInstallerProtocol>
@interface SUPlainInstaller : NSObject <SUInstallerProtocol>
/**
@param host The current (old) bundle host
+130 -134
View File
@@ -18,17 +18,25 @@
#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
{
SUHost *_host;
NSString *_bundlePath;
NSString *_installationPath;
NSURL *_temporaryOldDirectory;
// We get an obj-c warning if we use 'newTemporaryDirectory' name about new + ownership stuff, so use 'temporaryNewDirectory' instead
NSURL *_temporaryNewDirectory;
BOOL _newAndOldBundlesOnSameVolume;
}
@synthesize host = _host;
@synthesize bundlePath = _bundlePath;
@synthesize installationPath = _installationPath;
@synthesize temporaryOldDirectory = _temporaryOldDirectory;
@synthesize temporaryNewDirectory = _temporaryNewDirectory;
- (instancetype)initWithHost:(SUHost *)host bundlePath:(NSString *)bundlePath installationPath:(NSString *)installationPath
{
@@ -41,57 +49,23 @@
return self;
}
- (void)_performInitialInstallationWithFileManager:(SUFileManager *)fileManager oldBundleURL:(NSURL *)oldBundleURL newBundleURL:(NSURL *)newBundleURL progressBlock:(nullable void(^)(double))progress 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
{
// Release our new app from quarantine
NSError *quarantineError = nil;
if (![fileManager releaseItemFromQuarantineAtRootURL:newBundleURL error:&quarantineError]) {
// Not big enough of a deal to fail the entire installation
SULog(SULogLevelError, @"Failed to release quarantine at %@ with error %@", newBundleURL.path, quarantineError);
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]];
}
if (progress) {
progress(5/11.0);
}
// Try to preserve Finder Tags
NSArray *resourceTags = nil;
BOOL retrievedResourceTags = [oldBundleURL getResourceValue:&resourceTags forKey:NSURLTagNamesKey error:NULL];
if (retrievedResourceTags && resourceTags.count > 0) {
[newBundleURL setResourceValue:resourceTags forKey:NSURLTagNamesKey error:NULL];
}
if (progress) {
progress(6/11.0);
}
// Update owner and group (if possible)
NSError *changeOwnerAndGroupError = nil;
if (![fileManager changeOwnerAndGroupOfItemAtRootURL:newBundleURL toMatchURL:oldBundleURL error:&changeOwnerAndGroupError]) {
// Not a fatal error
SULog(SULogLevelError, @"Failed to change owner and group of new app at %@ to match old app at %@", newBundleURL.path, oldBundleURL.path);
SULog(SULogLevelError, @"Error: %@", changeOwnerAndGroupError);
}
if (progress) {
progress(7/11.0);
}
// Register the new bundle with LaunchServices and the system
NSError *touchError = nil;
if (![fileManager updateModificationAndAccessTimeOfItemAtURL:newBundleURL error:&touchError]) {
// Not a fatal error, but a pretty unfortunate one
SULog(SULogLevelError, @"Failed to update modification and access time of new app at %@", newBundleURL.path);
SULog(SULogLevelError, @"Error: %@", touchError);
}
if (progress) {
progress(8/11.0);
}
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 SPU_OBJC_DIRECT
- (BOOL)startInstallationToURL:(NSURL *)installationURL fromUpdateAtURL:(NSURL *)newURL withHost:(SUHost *)host progressBlock:(nullable void(^)(double))progress error:(NSError * __autoreleasing *)error
{
if (installationURL == nil || newURL == nil) {
// this really shouldn't happen but just in case
@@ -103,7 +77,7 @@
}
if (progress) {
progress(1/11.0);
progress(1/10.0);
}
SUFileManager *fileManager = [[SUFileManager alloc] init];
@@ -112,21 +86,19 @@
// The system periodically cleans up files by looking at the mod & access times, so we have to make sure they're up to date
// They could be potentially be preserved when archiving an application, but also an update could just be sitting on the system for a long time
// before being installed
if (!_newAndOldBundlesOnSameVolume) {
NSError *accessTimeError = nil;
if (![fileManager updateAccessTimeOfItemAtRootURL:newURL error:&accessTimeError]) {
if (error != NULL) {
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey: @"Failed to recursively update new application's modification time before moving into temporary directory" }];
if (accessTimeError != nil) {
userInfo[NSUnderlyingErrorKey] = accessTimeError;
}
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:userInfo];
NSError *accessTimeError = nil;
if (![fileManager updateAccessTimeOfItemAtRootURL:newURL error:&accessTimeError]) {
if (error != NULL) {
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey: @"Failed to recursively update new application's modification time before moving into temporary directory" }];
if (accessTimeError != nil) {
userInfo[NSUnderlyingErrorKey] = accessTimeError;
}
return NO;
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:userInfo];
}
return NO;
}
NSURL *oldURL = [NSURL fileURLWithPath:host.bundlePath];
@@ -140,72 +112,105 @@
}
if (progress) {
progress(2/11.0);
progress(2/10.0);
}
NSURL *tempNewDirectoryURL;
if (!_newAndOldBundlesOnSameVolume) {
// Create a temporary directory for our new app that resides on our destination's volume
// We use oldURL here instead of installationURL because in the case of normalization, installationURL may not exist
// And we don't want to use either of the URL's parent directories because the parent directory could be on a different volume
tempNewDirectoryURL = [fileManager makeTemporaryDirectoryAppropriateForDirectoryURL:oldURL error:error];
if (tempNewDirectoryURL == nil) {
return NO;
}
_temporaryNewDirectory = tempNewDirectoryURL;
} else {
tempNewDirectoryURL = nil;
// Create a temporary directory for our new app that resides on our destination's volume
// We use oldURL here instead of installationURL because in the case of normalization, installationURL may not exist
// And we don't want to use either of the URL's parent directories because the parent directory could be on a different volume
NSURL *tempNewDirectoryURL = [fileManager makeTemporaryDirectoryAppropriateForDirectoryURL:oldURL error:error];
if (tempNewDirectoryURL == nil) {
return NO;
}
self.temporaryNewDirectory = tempNewDirectoryURL;
if (progress) {
progress(3/11.0);
progress(3/10.0);
}
// Move the new app to our temporary directory if needed
NSURL *newFinalURL;
if (!_newAndOldBundlesOnSameVolume) {
NSString *newURLLastPathComponent = newURL.lastPathComponent;
newFinalURL = [tempNewDirectoryURL URLByAppendingPathComponent:newURLLastPathComponent];
NSError *newTempMoveError = nil;
if (![fileManager moveItemAtURL:newURL toURL:newFinalURL error:&newTempMoveError]) {
if (error != NULL) {
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to move the new app from %@ to its temp directory at %@", newURL.path, newFinalURL.path] }];
if (newTempMoveError != nil) {
userInfo[NSUnderlyingErrorKey] = newTempMoveError;
}
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:userInfo];
// Move the new app to our temporary directory
NSString *newURLLastPathComponent = newURL.lastPathComponent;
NSURL *newTempURL = [tempNewDirectoryURL URLByAppendingPathComponent:newURLLastPathComponent];
NSError *newTempMoveError = nil;
if (![fileManager moveItemAtURL:newURL toURL:newTempURL error:&newTempMoveError]) {
if (error != NULL) {
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to move the new app from %@ to its temp directory at %@", newURL.path, newTempURL.path] }];
if (newTempMoveError != nil) {
userInfo[NSUnderlyingErrorKey] = newTempMoveError;
}
return NO;
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:userInfo];
}
} else {
newFinalURL = newURL;
return NO;
}
if (progress) {
progress(4/11.0);
progress(4/10.0);
}
// Release our new app from quarantine
NSError *quarantineError = nil;
if (![fileManager releaseItemFromQuarantineAtRootURL:newTempURL error:&quarantineError]) {
// Not big enough of a deal to fail the entire installation
SULog(SULogLevelError, @"Failed to release quarantine at %@ with error %@", newTempURL.path, quarantineError);
}
if (progress) {
progress(5/10.0);
}
if (!_newAndOldBundlesOnSameVolume) {
[self _performInitialInstallationWithFileManager:fileManager oldBundleURL:oldURL newBundleURL:newFinalURL progressBlock:progress];
// Try to preserve Finder Tags
NSArray *resourceTags = nil;
BOOL retrievedResourceTags = [oldURL getResourceValue:&resourceTags forKey:NSURLTagNamesKey error:NULL];
if (retrievedResourceTags && resourceTags.count > 0) {
[newTempURL setResourceValue:resourceTags forKey:NSURLTagNamesKey error:NULL];
}
if (progress) {
progress(6/10.0);
}
// We must leave moving the app to its destination as the final step in installing it, so that
// it's not possible our new app can be left in an incomplete state at the final destination
NSError *changeOwnerAndGroupError = nil;
if (![fileManager changeOwnerAndGroupOfItemAtRootURL:newTempURL toMatchURL:oldURL error:&changeOwnerAndGroupError]) {
// Not a fatal error
SULog(SULogLevelError, @"Failed to change owner and group of new app at %@ to match old app at %@", newTempURL.path, oldURL.path);
SULog(SULogLevelError, @"Error: %@", changeOwnerAndGroupError);
}
if (progress) {
progress(9/11.0);
progress(7/10.0);
}
NSError *touchError = nil;
if (![fileManager updateModificationAndAccessTimeOfItemAtURL:newTempURL error:&touchError]) {
// Not a fatal error, but a pretty unfortunate one
SULog(SULogLevelError, @"Failed to update modification and access time of new app at %@", newTempURL.path);
SULog(SULogLevelError, @"Error: %@", touchError);
}
if (progress) {
progress(8/10.0);
}
// First try swapping the application atomically
NSError *swapError = nil;
BOOL swappedApp;
// If the app is normalized and the installation path differs, go through the old swap path
if (SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME && ![oldURL.path isEqual:installationURL.path]) {
swappedApp = NO;
if (@available(macOS 10.13, *)) {
// If the app is normalized and the installation path differs, go through the old swap path
if (SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME && ![oldURL.path isEqual:installationURL.path]) {
swappedApp = NO;
} else {
// We will be cleaning up the temporary directory later in -performCleanup:
// We don't want to clean it up now because it can take some time
swappedApp = [fileManager swapItemAtURL:installationURL withItemAtURL:newTempURL error:&swapError];
}
} else {
// We will be cleaning up the temporary directory later in -performCleanup:
// We don't want to clean it up now because it can take some time
swappedApp = [fileManager swapItemAtURL:installationURL withItemAtURL:newFinalURL error:&swapError];
swappedApp = NO;
}
if (!swappedApp) {
@@ -221,10 +226,10 @@
return NO;
}
_temporaryOldDirectory = tempOldDirectoryURL;
self.temporaryOldDirectory = tempOldDirectoryURL;
if (progress) {
progress(10/11.0);
progress(9/10.0);
}
NSString *oldURLFilename = oldURL.lastPathComponent;
@@ -254,14 +259,14 @@
}
if (progress) {
progress(10.5/11.0);
progress(9.5/10.0);
}
// Move the new app to its final destination
NSError *installMoveError = nil;
if (![fileManager moveItemAtURL:newFinalURL toURL:installationURL error:&installMoveError]) {
if (![fileManager moveItemAtURL:newTempURL toURL:installationURL error:&installMoveError]) {
if (error != NULL) {
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to move new app at %@ to final destination %@", newFinalURL.path, installationURL.path] }];
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to move new app at %@ to final destination %@", newTempURL.path, installationURL.path] }];
if (installMoveError != nil) {
userInfo[NSUnderlyingErrorKey] = installMoveError;
@@ -278,7 +283,7 @@
}
if (progress) {
progress(11/11.0);
progress(10/10.0);
}
return YES;
@@ -288,9 +293,9 @@
{
// Prevent malicious downgrades
// 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];
NSString *updateVersion = [updateHost objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
@@ -306,15 +311,6 @@
return NO;
}
SUFileManager *fileManager = [[SUFileManager alloc] init];
_newAndOldBundlesOnSameVolume = [fileManager itemAtURL:bundle.bundleURL isOnSameVolumeItemAsURL:_host.bundle.bundleURL];
// We can do a lot of the installation work ahead of time if the new app update does not need to be copied to another volume
if (_newAndOldBundlesOnSameVolume) {
[self _performInitialInstallationWithFileManager:fileManager oldBundleURL:_host.bundle.bundleURL newBundleURL:bundle.bundleURL progressBlock:NULL];
}
return YES;
}
@@ -322,19 +318,19 @@
{
// 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.
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
{
SUFileManager *fileManager = [[SUFileManager alloc] init];
if (_temporaryNewDirectory != nil) {
[fileManager removeItemAtURL:_temporaryNewDirectory error:NULL];
if (self.temporaryNewDirectory != nil) {
[fileManager removeItemAtURL:self.temporaryNewDirectory error:NULL];
}
if (_temporaryOldDirectory != nil) {
[fileManager removeItemAtURL:_temporaryOldDirectory error:NULL];
if (self.temporaryOldDirectory != nil) {
[fileManager removeItemAtURL:self.temporaryOldDirectory error:NULL];
}
}
+1 -1
View File
@@ -19,7 +19,7 @@
@class SUSignatures;
@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;
+19 -39
View File
@@ -16,19 +16,21 @@
#import "SULog.h"
#import "SUSignatures.h"
#import "SUErrors.h"
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
#include <CommonCrypto/CommonDigest.h>
#endif
#import "ed25519.h"
#import "ed25519.h" // Run `git submodule update --init` if you get an error here
#include "AppKitPrevention.h"
@implementation SUSignatureVerifier
{
SUPublicKeys *_pubKeys;
@interface SUSignatureVerifier ()
@property (readonly) SUPublicKeys *pubKeys;
@end
@implementation SUSignatureVerifier {
}
@synthesize pubKeys = _pubKeys;
+ (BOOL)validatePath:(NSString *)path withSignatures:(SUSignatures *)signatures withPublicKeys:(SUPublicKeys *)pkeys error:(NSError * __autoreleasing *)error
{
SUSignatureVerifier *verifier = [(SUSignatureVerifier *)[self alloc] initWithPublicKeys:pkeys];
@@ -52,10 +54,9 @@
return self;
}
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
- (SecKeyRef)dsaSecKeyRef SPU_OBJC_DIRECT
{
NSData *data = [_pubKeys.dsaPubKey dataUsingEncoding:NSASCIIStringEncoding];
- (SecKeyRef)dsaSecKeyRef {
NSData *data = [self.pubKeys.dsaPubKey dataUsingEncoding:NSASCIIStringEncoding];
if (!self || !data.length) {
SULog(SULogLevelError, @"Could not read public DSA key");
return nil;
@@ -88,7 +89,6 @@
CFRelease(items);
return dsaPubKeySecKey;
}
#endif
- (BOOL)verifyFileAtPath:(NSString *)path signatures:(SUSignatures *)signatures error:(NSError * __autoreleasing *)error
{
@@ -106,7 +106,7 @@
return NO;
}
switch (_pubKeys.ed25519PubKeyStatus) {
switch (self.pubKeys.ed25519PubKeyStatus) {
case 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");
@@ -165,14 +165,11 @@
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");
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
// No need to check DSA when EdDSA verification succeeded, unless a DSA signature is provided and it's
// erroneously invalid
if (signatures.dsaSignatureStatus != SUSigningInputStatusInvalid)
#endif
{
if (signatures.dsaSignatureStatus != SUSigningInputStatusInvalid) {
return YES;
}
} else {
@@ -180,11 +177,9 @@
SULog(SULogLevelError, @"%@", message);
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
if (signatures.dsaSignatureStatus != SUSigningInputStatusAbsent) {
SULog(SULogLevelDefault, @"DSA signature won't be checked, because EdDSA verification has already failed");
}
#endif
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: message }];
@@ -197,8 +192,7 @@
break;
}
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
switch (_pubKeys.dsaPubKeyStatus) {
switch (self.pubKeys.dsaPubKeyStatus) {
case 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");
@@ -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) {
// Use generic failure
@@ -265,8 +244,7 @@
return NO;
}
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
- (BOOL)verifyDSASignatureOfStream:(NSInputStream *)stream dsaSignature:(NSData *)dsaSignature error:(NSError * __autoreleasing *)outError SPU_OBJC_DIRECT
- (BOOL)verifyDSASignatureOfStream:(NSInputStream *)stream dsaSignature:(NSData *)dsaSignature error:(NSError * __autoreleasing *)outError
{
if (!stream || !dsaSignature) {
SULog(SULogLevelError, @"Invalid arguments to verifyStream");
@@ -323,7 +301,10 @@
return cleanup();
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
dataVerifyTransform = SecVerifyTransformCreate(dsaPubKeySecKey, (__bridge CFDataRef)dsaSignature, &error);
#pragma clang diagnostic pop
if (!dataVerifyTransform) {
SULog(SULogLevelError, @"Could not understand format of the signature: %@; Signature data: %@", error, dsaSignature);
if (outError != NULL) {
@@ -387,6 +368,5 @@
cleanup();
return result.boolValue;
}
#endif
@end
+1 -1
View File
@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
@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;
+3 -10
View File
@@ -23,24 +23,17 @@
if ([SUPipedUnarchiver canUnarchivePath:path]) {
return [[SUPipedUnarchiver alloc] initWithArchivePath:path];
}
#if SPARKLE_BUILD_DMG_SUPPORT
else if ([SUDiskImageUnarchiver canUnarchivePath:path]) {
} else if ([SUDiskImageUnarchiver canUnarchivePath:path]) {
return [[SUDiskImageUnarchiver alloc] initWithArchivePath:path decryptionPassword:decryptionPassword];
}
#endif
else if ([SUBinaryDeltaUnarchiver canUnarchivePath:path]) {
} else if ([SUBinaryDeltaUnarchiver canUnarchivePath:path]) {
assert(hostPath != nil);
NSString *nonNullHostPath = hostPath;
return [[SUBinaryDeltaUnarchiver alloc] initWithArchivePath:path updateHostBundlePath:nonNullHostPath];
}
#if SPARKLE_BUILD_PACKAGE_SUPPORT
else if ([SUFlatPackageUnarchiver canUnarchivePath:path]) {
} else if ([SUFlatPackageUnarchiver canUnarchivePath:path]) {
// Flat packages are only supported for guided packaage installs
return [[SUFlatPackageUnarchiver alloc] initWithFlatPackagePath:path expectingInstallationType:installationType];
}
#endif
return nil;
}
+1 -1
View File
@@ -10,7 +10,7 @@
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;
+15 -9
View File
@@ -13,11 +13,17 @@
#include "AppKitPrevention.h"
@interface SUUnarchiverNotifier ()
@property (nonatomic, readonly, copy) void (^completionBlock)(NSError * _Nullable);
@property (nonatomic, readonly, copy) void (^ _Nullable progressBlock)(double);
@end
@implementation SUUnarchiverNotifier
{
void (^_completionBlock)(NSError * _Nullable);
void (^ _Nullable _progressBlock)(double);
}
@synthesize completionBlock = _completionBlock;
@synthesize progressBlock = _progressBlock;
- (instancetype)initWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock
{
@@ -34,13 +40,13 @@
- (void)notifySuccess
{
dispatch_async(dispatch_get_main_queue(), ^{
self->_completionBlock(nil);
self.completionBlock(nil);
});
}
- (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) {
[userInfo setObject:(NSError * _Nonnull)reason forKey:NSUnderlyingErrorKey];
}
@@ -48,15 +54,15 @@
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:userInfo];
dispatch_async(dispatch_get_main_queue(), ^{
self->_completionBlock(error);
self.completionBlock(error);
});
}
- (void)notifyProgress:(double)progress
{
if (_progressBlock != nil) {
if (self.progressBlock != nil) {
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>
+ (BOOL)canUnarchivePath:(NSString *)path;
+ (BOOL)mustValidateBeforeExtraction;
- (void)unarchiveWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock;
+1 -1
View File
@@ -11,7 +11,7 @@
NS_ASSUME_NONNULL_BEGIN
SPU_OBJC_DIRECT_MEMBERS @interface StatusInfo : NSObject <SUStatusInfoProtocol>
@interface StatusInfo : NSObject <SUStatusInfoProtocol>
- (instancetype)initWithHostBundleIdentifier:(NSString *)bundleIdentifier;
-1
View File
@@ -21,7 +21,6 @@
{
NSXPCListener *_xpcListener;
NSMutableDictionary *_pendingReplies;
NSUInteger _pendingReplyCounter;
}
+24
View File
@@ -0,0 +1,24 @@
//
// TerminationListener.h
// Sparkle
//
// Created by Mayur Pawashe on 3/7/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface TerminationListener : NSObject
- (instancetype)initWithProcessIdentifier:(NSNumber * _Nullable)processIdentifier;
@property (nonatomic, readonly) BOOL terminated;
// If the process identifier provided was nil, then the completion block will invoke immediately with a YES success
- (void)startListeningWithCompletion:(void (^)(BOOL success))completionBlock;
@end
NS_ASSUME_NONNULL_END
+131
View File
@@ -0,0 +1,131 @@
//
// TerminationListener.m
// Sparkle
//
// Created by Mayur Pawashe on 3/7/16.
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#import "TerminationListener.h"
#import "SULog.h"
#include <sys/types.h>
#include <sys/event.h>
#include <sys/time.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
@synthesize completionBlock = _completionBlock;
@synthesize processIdentifier = _processIdentifier;
@synthesize watchedTermination = _watchedTermination;
- (instancetype)initWithProcessIdentifier:(NSNumber * _Nullable)processIdentifier
{
self = [super init];
if (self != nil) {
_processIdentifier = processIdentifier;
}
return self;
}
- (BOOL)terminated
{
return (self.watchedTermination || self.processIdentifier == nil) ? YES : (kill(self.processIdentifier.intValue, 0) != 0);
}
- (void)invokeCompletionWithSuccess:(BOOL)success
{
if (self.completionBlock != nil) {
self.completionBlock(success);
self.completionBlock = nil;
}
}
- (void)startListeningWithCompletion:(void (^)(BOOL))completionBlock
{
self.completionBlock = completionBlock;
if (self.processIdentifier == nil) {
[self invokeCompletionWithSuccess:YES];
return;
}
// Use kqueues to determine when the process will terminate
// 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
pid_t processIdentifier = self.processIdentifier.intValue;
int queue = kqueue();
if (queue == -1) {
SULog(SULogLevelError, @"Failed to create kqueue() due to error %d: %@", errno, @(strerror(errno)));
[self invokeCompletionWithSuccess:NO];
return;
}
struct kevent changes;
EV_SET(&changes, processIdentifier, EVFILT_PROC, EV_ADD | EV_RECEIPT, NOTE_EXIT, 0, NULL);
if (kevent(queue, &changes, 1, &changes, 1, NULL) == -1) {
SULog(SULogLevelError, @"Failed to invoke kevent() due to error %d: %@", errno, @(strerror(errno)));
[self invokeCompletionWithSuccess:NO];
return;
}
// We will assume this terminationListener will never be deallocated
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-qual"
CFFileDescriptorContext context = { 0, (void *)CFBridgingRetain(self), NULL, NULL, NULL };
#pragma clang diagnostic pop
CFFileDescriptorRef noteExitKQueueRef = CFFileDescriptorCreate(NULL, queue, true, noteExitKQueueCallback, &context);
if (noteExitKQueueRef == NULL) {
SULog(SULogLevelError, @"Failed to create file descriptor via CFFileDescriptorCreate()");
CFRelease((__bridge CFTypeRef)(self));
[self invokeCompletionWithSuccess:NO];
return;
}
CFRunLoopSourceRef runLoopSource = CFFileDescriptorCreateRunLoopSource(NULL, noteExitKQueueRef, 0);
if (runLoopSource == NULL) {
SULog(SULogLevelError, @"Failed to create runLoopSource via CFFileDescriptorCreateRunLoopSource()");
CFRelease((__bridge CFTypeRef)(self));
[self invokeCompletionWithSuccess:NO];
return;
}
CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopDefaultMode);
CFRelease(runLoopSource);
CFFileDescriptorEnableCallBacks(noteExitKQueueRef, kCFFileDescriptorReadCallBack);
// Make sure we didn't set the listener callback to a dead PID
// If we did, we could hang forever. To avoid this, we check if the process has terminated *after* we set up the callback
// If we tried to do this check before setting the callback, we could run into an issue where the process can terminate after our check
// but before setting the callback
if ([self terminated]) {
[self invokeCompletionWithSuccess:YES];
}
}
static void noteExitKQueueCallback(CFFileDescriptorRef file, CFOptionFlags __unused callBackTypes, void *info)
{
struct kevent event;
kevent(CFFileDescriptorGetNativeDescriptor(file), NULL, 0, &event, 1, NULL);
TerminationListener *self = CFBridgingRelease(info);
self.watchedTermination = YES;
[self invokeCompletionWithSuccess:YES];
}
@end
+1 -5
View File
@@ -28,11 +28,7 @@ int main(int __unused argc, const char __unused *argv[])
dispatch_source_t sigtermSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_SIGNAL, SIGTERM, 0, dispatch_get_main_queue());
dispatch_source_set_event_handler(sigtermSource, ^{
// Don't clear the update directory because the installer may be in middle of installing an update
// We still need to set an event handler for receiving SIGTERM though, otherwise our job may not terminate
// (This is also recommended from the developer documentation).
// Simply exit with SIGTERM if we recieve this signal
exit(SIGTERM);
[appInstaller cleanupAndExitWithStatus:SIGTERM error:nil];
});
dispatch_resume(sigtermSource);
+1 -1
View File
@@ -20,7 +20,7 @@ struct Create: ParsableCommand {
@Option(name: .long, help: ArgumentHelp(COMPRESSION_METHOD_ARGUMENT_DESCRIPTION, valueName: "compression"))
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
@Argument(help: ArgumentHelp("Path to original bundle to create a patch from."))
-103
View File
@@ -1,106 +1,3 @@
# 2.5.2
* Don't clean up update directory when Autoupdate receives SIGTERM (#2479) (Zorg)
* Update Japanese localization (#2475) (1024jp)
* Improve Turkish translations (#2464) (Emir SARI)
* Update Spanish translation for 'You are currently running version %@.' and 'Version History' (#2463) (Billy Gray)
# 2.5.1
* Default to English for XML nodes when no xml:lang is present (#2440) (Zorg)
* Filter for archive files in generate_appcast more intelligently (#2448) (Zorg)
* Use correct entitlements and dsym files when using custom bundle id and XPC names in ConfigCommon (#2446) (floorish)
# 2.5.0
* Add ability to adapt release notes based on the currently installed version (#2373) (Nathan Manceaux-Panot)
* Allow developers to use custom URL schemes in the release notes view (#2393) (Zorg)
* Adopt cooperative app activation APIs in macOS 14 Sonoma (#2409) (Zorg)
* Improve permission prompt layout (#2420) (Zorg)
* Remove hyphenation in "You're up to date" message (#2425) (Zorg, Dom Neill)
* Pre-warm installs before relaunch and resolve sporadic failures in CI (#2421) (Zorg)
* Fix make release not building distribution successfully (#2430) (Zorg)
* Fix Updater app not starting when running Sparkle as root (e.g. from CLI with sudo or a daemon) on macOS 14 Sonoma (#2432) (Zorg)
* Fix KVO usage for updaterController.updater.* (#2404) (Zorg)
* Replace CFUUID* with NSUUID (#2395) (Eitot)
* Report an error when detecting duplicate updates in generate_appcast (#2407) (Zorg)
* Improve error for rejecting xattr based code signing for delta updates (#2408) (Zorg)
* Fail gracefully when auxiliary tool cannot be located (#2436) (Zorg)
# 2.4.2
* Ignore release notes download when we shouldn't show release notes (#2381) (Zorg)
* Fix NSKeyedUnarchiver warning for not specifying keyed NSString class (#2381) (Zorg)
* Harden verification of Sparkle update download (#2392) (Zorg)
# 2.4.1
* Remove auxiliary apps and relocate symbols in SPM package to resolve missing AvailableLibraries warnings (#2356) (Zorg)
* Add -Wno-declaration-after-statement to silence warnings that only apply to pre-C99 (#2345) (Kent Sutherland)
* Fix compile error when setting SPARKLE_EMBED_DOWNLOADER_XPC_SERVICE=0 (#2346) (Zorg)
* Improve how downloaded update is passed to the installer (#2359) (Zorg)
# 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
* Fix potential crash during download if appcast item includes invalid enclosure URL (#2317) (Zorg)
* Add delegate method to hide showing version history option (#2303) (Zorg)
* Finnish localization grammar fixes (#2311) (Lauri-Matti Parppei)
# 2.3.1
* Fix update permission alert title text overlapping with question text in some languages (#2284) (Zorg)
* Log the URL that failed to download correctly (#2296) (Zorg)
* Update Czech translation (#2275) (Sam)
* Add zh_HK (Chinese, Hong Kong) localization (#2273) (Bing Zheung)
# 2.3.0
* Bump minimum deployment target to macOS 10.13 (#2196) (Zorg)
* Remove and preserve necessary updates in generate_appcast (#2218) (Zorg)
* Move old update files no longer needed to old_updates/ in archive directory in generate_appcast (#2228) (Zorg)
* Expose maximum-versions option (per branch) in generate_appcast to preserve in the feed (#2259) (Zorg)
* Add -p option to sign_update to only print the signed signature (#2268) (Zorg)
* Hide automatic install check box when allowsAutomaticUpdates is disabled (#2202) (Jie)
* Allow developer to always force allowing automatic updates (#2266) (Zorg)
* Fix update window going haywire during resize when release notes are hidden by disabling resizing (#2200) (Zorg)
* Allow user to re-try installing/relaunching application when quit is delayed/cancelled (#2234) (Zorg)
* Add delta update attributes for validating an app hasn't been stripped from removed localizations or architectures (#2219) (Zorg)
* Fix delta patches not applying edge case if files from source that need to be diffed are not writeable (#2211) (Zorg)
* Add delegate callback when user makes choice to install, dismiss, or skip an update (#2250) (Zorg)
* Reject serving updates with DSA only and no EdDSA (#2167) (Zorg)
* Find potential matching running apps that are translocated in the updater agent (#2233) (Zorg)
* Expose -[SPUStandardUserDriver activeUpdateAlert] as private API (#2255) (Zorg)
* Add zh_CN l10n for "Version History" (#2247) (kakaiikaka)
* Update zh_TW localization (#2271) (Chiahong)
* Remove ed25519 git submodule in favor of including the dependency directly (#2244) (Zorg)
* Clean up left-over code (#2243) (Eitot)
* Update Package.resolved (#2245) (Zorg)
* Remove model translation table for system profiling (#2188) (Zorg)
* Improve documentation usage for SPUUpdater properties (#2256) (Zorg)
This release improves generate_appcast by automatically removing updates that are no longer needed in the generated appcast, and moving old update files to old_updates/ in the archives directory. New delta update attributes are also added to let Sparkle know when to skip downloading delta updates if the application has been stripped.
macOS 10.13 or later is now required (due to Xcode 14 dropping support for deploying to older OS versions).
If you're not generating appcasts automatically, remember to add `<sparkle:minimumSystemVersion>10.13</sparkle:minimumSystemVersion>` element to `<item>`s in your appcast.
# 2.2.2
* Critical update alerts may not show up as promptly as they should when they are being automatically installed (#2230) (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", "2.4.1-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.1-beta.1/Sparkle-2.4.1-beta.1.tar.xz", "2.4.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.1/Sparkle-2.4.1.tar.xz", "2.4.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.2/Sparkle-2.4.2.tar.xz", "2.5.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.0-beta.1/Sparkle-2.5.0-beta.1.tar.xz", "2.5.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.0-beta.2/Sparkle-2.5.0-beta.2.tar.xz", "2.5.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.0/Sparkle-2.5.0.tar.xz", "2.5.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.1/Sparkle-2.5.1.tar.xz", "2.5.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.2/Sparkle-2.5.2.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"}
@@ -3,4 +3,4 @@
#include "ConfigSwift.xcconfig"
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
+18 -62
View File
@@ -1,66 +1,14 @@
// 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_RELAUNCH_TOOL_NAME = Autoupdate
SPARKLE_INSTALLER_PROGRESS_TOOL_NAME = Updater
SPARKLE_INSTALLER_PROGRESS_TOOL_BUNDLE_ID = $(SPARKLE_BUNDLE_IDENTIFIER).$(SPARKLE_INSTALLER_PROGRESS_TOOL_NAME)
// 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
// For the Installer one in particular, this name may show up in an authorization prompt
@@ -78,6 +26,9 @@ INSTALLER_STATUS_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.InstallerStatus
INSTALLER_LAUNCHER_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.InstallerLauncher
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
// 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"
@@ -91,23 +42,25 @@ SPARKLE_ICON_NAME = AppIcon
// If you change any of these version details, you must increase CURRENT_PROJECT_VERSION
// These variables must have a space after the '=' too
SPARKLE_VERSION_MAJOR = 2
SPARKLE_VERSION_MINOR = 5
SPARKLE_VERSION_MINOR = 2
SPARKLE_VERSION_PATCH = 2
// This should be in SemVer format or empty, ie. "-beta.1"
// These variables must have a space after the '=' too
SPARKLE_VERSION_SUFFIX =
CURRENT_PROJECT_VERSION = 2033
CURRENT_PROJECT_VERSION = 2017.1
MARKETING_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)$(SPARKLE_VERSION_SUFFIX)
ALWAYS_SEARCH_USER_PATHS = NO
ENABLE_STRICT_OBJC_MSGSEND = YES
GCC_SYMBOLS_PRIVATE_EXTERN = YES
GCC_INLINES_ARE_PRIVATE_EXTERN = YES
ARCHS = $(ARCHS_STANDARD)
MACOSX_DEPLOYMENT_TARGET = 10.11
PRODUCT_NAME = ${TARGET_NAME}
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_INSTALLER_PROGRESS_TOOL_BUNDLE_ID=\"$(SPARKLE_INSTALLER_PROGRESS_TOOL_BUNDLE_ID)\" 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 = -
SDKROOT = macosx
@@ -161,5 +114,8 @@ GCC_WARN_UNUSED_LABEL = YES
GCC_WARN_UNUSED_PARAMETER = 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
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"
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_COMMON)
OTHER_SWIFT_FLAGS = $(OTHER_SWIFT_FLAGS_COMMON)
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES;
@@ -13,6 +13,5 @@ DEBUG_INFORMATION_FORMAT = dwarf
ENABLE_TESTABILITY = YES
GCC_GENERATE_DEBUGGING_SYMBOLS = YES
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_COMMON) DEBUG=1
OTHER_SWIFT_FLAGS = $(OTHER_SWIFT_FLAGS_COMMON)
ONLY_ACTIVE_ARCH = YES
COPY_PHASE_STRIP = NO
@@ -12,9 +12,7 @@ GCC_OPTIMIZATION_LEVEL = s
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
GCC_GENERATE_DEBUGGING_SYMBOLS = YES
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_COMMON) DEBUG=0
OTHER_SWIFT_FLAGS = $(OTHER_SWIFT_FLAGS_COMMON)
DEAD_CODE_STRIPPING = YES
GCC_TREAT_WARNINGS_AS_ERRORS = NO
GCC_WARN_UNINITIALIZED_AUTOS = YES
COPY_PHASE_STRIP = NO
DEPLOYMENT_POSTPROCESSING = YES
+2 -3
View File
@@ -4,6 +4,5 @@ INFOPLIST_FILE = Downloader/Info.plist
WRAPPER_EXTENSION = xpc
PRODUCT_BUNDLE_IDENTIFIER = ${DOWNLOADER_BUNDLE_ID}
PRODUCT_NAME = ${DOWNLOADER_NAME}
CODE_SIGN_ENTITLEMENTS = Downloader/org.sparkle-project.Downloader.entitlements
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE_SOURCES_EXTERNALLY=1
CLANG_MODULES_AUTOLINK = NO
CODE_SIGN_ENTITLEMENTS = Downloader/${DOWNLOADER_BUNDLE_ID}.entitlements
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE_DOWNLOADER_SERVICE=1
@@ -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
PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_CONNECTION_BUNDLE_ID}
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
PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_LAUNCHER_BUNDLE_ID}
PRODUCT_NAME = ${INSTALLER_LAUNCHER_NAME}
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE_SOURCES_EXTERNALLY=1
CLANG_MODULES_AUTOLINK = NO
@@ -2,7 +2,6 @@
INFOPLIST_FILE = Sparkle/InstallerProgress/InstallerProgress-Info.plist
PRODUCT_NAME = $(SPARKLE_INSTALLER_PROGRESS_TOOL_NAME)
PRODUCT_BUNDLE_IDENTIFIER = $(SPARKLE_INSTALLER_PROGRESS_TOOL_BUNDLE_ID)
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
CLANG_ENABLE_MODULES = NO
@@ -4,5 +4,3 @@ INFOPLIST_FILE = InstallerStatus/Info.plist
WRAPPER_EXTENSION = xpc
PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_STATUS_BUNDLE_ID}
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)
SKIP_INSTALL = YES
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
CLANG_ENABLE_MODULES = YES
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
+35 -52
View File
@@ -5,7 +5,6 @@ set -e
# This guards against our archives being corrupt / created incorrectly.
function verify_code_signatures() {
verification_directory="$1"
check_aux_apps="$2"
if [[ -z "$verification_directory" ]]; then
echo "Provided verification directory does not exist" >&2
@@ -14,11 +13,8 @@ function verify_code_signatures() {
# Search the current directory for all instances of the framework to verify them (XCFrameworks can have multiple copies of a framework for different platforms).
find "${verification_directory}" -name "Sparkle.framework" -type d -exec codesign --verify -vvv --deep {} \;
if [ "$check_aux_apps" = true ] ; then
codesign --verify -vvv --deep "${verification_directory}/sparkle.app"
codesign --verify -vvv --deep "${verification_directory}/Sparkle Test App.app"
fi
codesign --verify -vvv --deep "${verification_directory}/sparkle.app"
codesign --verify -vvv --deep "${verification_directory}/Sparkle Test App.app"
codesign --verify -vvv --deep "${verification_directory}/bin/BinaryDelta"
codesign --verify -vvv --deep "${verification_directory}/bin/generate_appcast"
codesign --verify -vvv --deep "${verification_directory}/bin/sign_update"
@@ -42,7 +38,9 @@ if [ "$ACTION" = "" ] ; then
cp "$CONFIGURATION_BUILD_DIR/generate_keys" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp "$CONFIGURATION_BUILD_DIR/sign_update" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app" "$CONFIGURATION_BUILD_DIR/staging-spm"
cp -R "$CONFIGURATION_BUILD_DIR/sparkle.app" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/sparkle.app" "$CONFIGURATION_BUILD_DIR/staging-spm"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.framework" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.xcframework" "$CONFIGURATION_BUILD_DIR/staging-spm"
@@ -60,28 +58,19 @@ if [ "$ACTION" = "" ] ; then
# because missing dSYMs in a release build SHOULD trigger a build failure
if [ "$CONFIGURATION" = "Release" ] ; then
cp -R "$CONFIGURATION_BUILD_DIR/BinaryDelta.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/generate_appcast.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/generate_keys.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/sign_update.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/sparkle.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.framework.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/Autoupdate.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/Updater.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/${INSTALLER_LAUNCHER_NAME}.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/${DOWNLOADER_NAME}.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
fi
cp -R "$CONFIGURATION_BUILD_DIR/staging/bin" "$CONFIGURATION_BUILD_DIR/staging-spm"
cp -R "$CONFIGURATION_BUILD_DIR/staging/Symbols" "$CONFIGURATION_BUILD_DIR/staging-spm"
cd "$CONFIGURATION_BUILD_DIR/staging"
@@ -113,51 +102,45 @@ if [ "$ACTION" = "" ] ; then
# Test code signing validity of the extracted products
# This guards against our archives being corrupt / created incorrectly
verify_code_signatures "/tmp/sparkle-extract" true
verify_code_signatures "/tmp/sparkle-extract"
rm -rf "/tmp/sparkle-extract"
rm -rf "$CONFIGURATION_BUILD_DIR/staging"
# Generate zip containing the xcframework for SPM
rm -rf "/tmp/sparkle-spm-extract"
mkdir -p "/tmp/sparkle-spm-extract"
cd "$CONFIGURATION_BUILD_DIR/staging-spm"
# rm -rf "$CONFIGURATION_BUILD_DIR/Sparkle.xcarchive"
ditto -c -k --zlibCompressionLevel 9 --rsrc . "../Sparkle-for-Swift-Package-Manager.zip"
# Test code signing validity of the extracted Swift package
# This guards against our archives being corrupt / created incorrectly
ditto -x -k "../Sparkle-for-Swift-Package-Manager.zip" "/tmp/sparkle-spm-extract"
verify_code_signatures "/tmp/sparkle-spm-extract"
rm -rf "/tmp/sparkle-spm-extract"
rm -rf "$CONFIGURATION_BUILD_DIR/staging-spm"
# Get latest git tag
cd "$SRCROOT"
latest_git_tag=$( git describe --tags --abbrev=0 || true )
latest_git_tag=$(git describe --tags --abbrev=0)
if [ -n "$latest_git_tag" ] ; then
# Generate zip containing the xcframework for SPM
rm -rf "/tmp/sparkle-spm-extract"
mkdir -p "/tmp/sparkle-spm-extract"
cd "$CONFIGURATION_BUILD_DIR/staging-spm"
# rm -rf "$CONFIGURATION_BUILD_DIR/Sparkle.xcarchive"
ditto -c -k --zlibCompressionLevel 9 --rsrc . "../Sparkle-for-Swift-Package-Manager.zip"
# Test code signing validity of the extracted Swift package
# This guards against our archives being corrupt / created incorrectly
ditto -x -k "../Sparkle-for-Swift-Package-Manager.zip" "/tmp/sparkle-spm-extract"
verify_code_signatures "/tmp/sparkle-spm-extract" false
rm -rf "/tmp/sparkle-spm-extract"
rm -rf "$CONFIGURATION_BUILD_DIR/staging-spm"
cd "$SRCROOT"
# Check semantic versioning
if [[ $latest_git_tag =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$ ]]; then
echo "Tag $latest_git_tag follows semantic versioning"
else
echo "ERROR: Tag $latest_git_tag does not follow semantic versioning! SPM will not be able to resolve the repository" >&2
exit 1
fi
# Generate new Package manifest, podspec, and carthage files
cd "$CONFIGURATION_BUILD_DIR"
cp "$SRCROOT/Package.swift" "$CONFIGURATION_BUILD_DIR"
cp "$SRCROOT/Sparkle.podspec" "$CONFIGURATION_BUILD_DIR"
cp "$SRCROOT/Carthage-dev.json" "$CONFIGURATION_BUILD_DIR"
# Check semantic versioning
if [[ $latest_git_tag =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$ ]]; then
echo "Tag $latest_git_tag follows semantic versioning"
else
echo "ERROR: Tag $latest_git_tag does not follow semantic versioning! SPM will not be able to resolve the repository" >&2
exit 1
fi
# Generate new Package manifest, podspec, and carthage files
cd "$CONFIGURATION_BUILD_DIR"
cp "$SRCROOT/Package.swift" "$CONFIGURATION_BUILD_DIR"
cp "$SRCROOT/Sparkle.podspec" "$CONFIGURATION_BUILD_DIR"
cp "$SRCROOT/Carthage-dev.json" "$CONFIGURATION_BUILD_DIR"
if [ -z "$latest_git_tag" ] ; then
echo "warning: No git repository found so skipping updating package management files"
elif [ "$XCODE_VERSION_MAJOR" -ge "1200" ]; then
if [ "$XCODE_VERSION_MAJOR" -ge "1200" ]; then
# is equivalent to shasum -a 256 FILE
spm_checksum=$(swift package compute-checksum "Sparkle-for-Swift-Package-Manager.zip")
rm -rf ".build"
-15
View File
@@ -1,15 +0,0 @@
#!/bin/bash
# Deleting old products
rm -rd "$BUILT_PRODUCTS_DIR/Sparkle.xcarchive"
rm -rd "$BUILT_PRODUCTS_DIR/Sparkle.xcframework"
xcodebuild archive -scheme Sparkle -archivePath "$BUILT_PRODUCTS_DIR/Sparkle.xcarchive" BUILD_LIBRARY_FOR_DISTRIBUTION=YES SKIP_INSTALL=NO
if [ $XCODE_VERSION_MAJOR -ge "1200" ]; then
xcodebuild -create-xcframework -framework "$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/Products/Library/Frameworks/Sparkle.framework" -debug-symbols "$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/dSYMs/Sparkle.framework.dSYM" -debug-symbols "$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/dSYMs/Autoupdate.dSYM" -debug-symbols "$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/dSYMs/Updater.app.dSYM" -debug-symbols "$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/dSYMs/$INSTALLER_LAUNCHER_NAME.xpc.dSYM" -debug-symbols "$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/dSYMs/$DOWNLOADER_NAME.xpc.dSYM" -output "$BUILT_PRODUCTS_DIR/Sparkle.xcframework"
else
echo "warning: Your Xcode version does not support bundling dSYMs in XCFrameworks directly. You should copy them manually into the XCFramework."
echo "note: cp '$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/dSYMs/Sparkle.framework.dSYM' '$BUILT_PRODUCTS_DIR/Sparkle.xcframework/your_architecture/dSYMs'"
xcodebuild -create-xcframework -framework "$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/Products/Library/Frameworks/Sparkle.framework" -output "$BUILT_PRODUCTS_DIR/Sparkle.xcframework"
fi
+1 -5
View File
@@ -2,11 +2,7 @@
set -e
# Convenience script to automatically commit Package.swift after updating the checksum and move the latest tag
latest_git_tag=$( git describe --tags --abbrev=0 || true ) # gets the latest tag name
if [ -z "$latest_git_tag" ] ; then
exit 0
fi
latest_git_tag=$(git describe --tags --abbrev=0) # gets the latest tag name
commits_since_tag=$(git rev-list ${latest_git_tag}.. --count)
function move_tag() {
-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.
## 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.
`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.
`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.
+2 -4
View File
@@ -73,7 +73,7 @@ The installer figures out what kind of installer to use (regular, guided pkg, in
Once the type of installer is found, the first stage of installation is performed:
* Regular application installer 1st stage: Makes sure this update is not a downgrade and do all initial installation work if possible (such as clearing quarantine, changing owner/group, updating modification date, invoking GateKeeper scan). This initial work is not done if the bundle has to transfer to another volume; in this case, this work will be done in a later stage.
* Regular application installer 1st stage: Makes sure this update is not a downgrade.
* Guided Package installer 1st stage: Does nothing.
* Interactive Package installer (deprecated) 1st stage: Makes sure /usr/bin/open utility is available.
@@ -105,13 +105,11 @@ If the 2nd stage succeeds, the installer sends a `SPUInstallationFinishedStage2`
The updater receives a `SPUInstallationFinishedStage2` message, and reads if the target application had already been terminated. If the target application has not already terminated, the updater tells the user driver to show that the application is being sent a termination request.
In the case termination of the application is delayed or canceled, the user driver may re-try sending a `SPUResumeInstallationToStage2` message to the installer. This time the installer will recognize it already completed stage 2. If it hasn't proceeded onto stage 3 it will send another quit event to the application. This re-try can be done multiple times.
### Showing Progress
When the target application is terminated, if the updater allowed the installer to show UI progress and the installation type doesn't show progress on its own (only interactive package installer shows progress on its own), then the installer sends a `SPUUpdaterAlivePing` message to the updater. If the updater is still alive by now and receives the message, the updater will then send back a `SPUUpdaterAlivePong` message. This lets the installer know that the updater is still active after the target application is terminated, and whether the installer should later be responsible for displaying updater progress or not if a short time passes by, and the installation is still not finished. If the updater is still not alive, then the installer should be responsible for showing progress if otherwise allowed.
If the installer decides to show progress, it sends a message to the progress agent to show progress UI. Under most circumstances, the installation will finish faster than this point is reached however (exceptions may be guided package installers and updates over a remote network mount). If the connection to the updater is still connected after this short time passes (eg: like with sparkle-cli), then it's the updater's job to show progress instead.
If the installer decides to show progress, it sends a message to the progress agent to show progress UI. Under most circumstances, the installation will finish faster than this point is reached however (exceptions may be potentially large updates with many scattered files, guided package installers, and updates over a remote network mount). If the connection to the updater is still connected after this short time passes (eg: like with sparkle-cli), then it's the updater's job to show progress instead.
### Finishing the Installation
The installer starts stage 3 of the installation after the target application is terminated as well. The third stage does the final installation for updating and replacing the new updated bundle.
+1 -1
View File
@@ -12,7 +12,7 @@
@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.
SPU_OBJC_DIRECT_MEMBERS @interface SPUDownloader : NSObject <SPUDownloaderProtocol>
@interface SPUDownloader : NSObject <SPUDownloaderProtocol>
// Due to XPC remote object reasons, this delegate is strongly referenced
// Invoke cleanup when done with this instance
+86 -95
View File
@@ -25,24 +25,31 @@ typedef NS_ENUM(NSUInteger, SPUDownloadMode)
static NSString *SUDownloadingReason = @"Downloading update related file";
@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
@implementation SPUDownloader
{
NSURLSessionDownloadTask *_download;
NSURLSession *_downloadSession;
NSString *_bundleIdentifier;
NSString *_desiredFilename;
NSString *_downloadFilename;
// Delegate is intentionally strongly referenced; see header
id <SPUDownloaderDelegate> _delegate;
SPUDownloadMode _mode;
BOOL _disabledAutomaticTermination;
BOOL _receivedExpectedBytes;
}
@synthesize delegate = _delegate;
@synthesize download = _download;
@synthesize downloadSession = _downloadSession;
@synthesize bundleIdentifier = _bundleIdentifier;
@synthesize desiredFilename = _desiredFilename;
@synthesize downloadFilename = _downloadFilename;
@synthesize disabledAutomaticTermination = _disabledAutomaticTermination;
@synthesize mode = _mode;
@synthesize receivedExpectedBytes = _receivedExpectedBytes;
- (instancetype)initWithDelegate:(id <SPUDownloaderDelegate>)delegate
{
@@ -53,14 +60,14 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
return self;
}
- (void)startDownloadWithRequest:(NSURLRequest *)request SPU_OBJC_DIRECT
- (void)startDownloadWithRequest:(NSURLRequest *)request
{
_downloadSession = [NSURLSession
self.downloadSession = [NSURLSession
sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]
delegate:self
delegateQueue:[NSOperationQueue mainQueue]];
_download = [_downloadSession downloadTaskWithRequest:request];
[_download resume];
self.download = [self.downloadSession downloadTaskWithRequest:request];
[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
@@ -68,14 +75,14 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
- (void)startPersistentDownloadWithRequest:(NSURLRequest *)request bundleIdentifier:(NSString *)bundleIdentifier desiredFilename:(NSString *)desiredFilename
{
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
[[NSProcessInfo processInfo] disableAutomaticTermination:SUDownloadingReason];
self->_disabledAutomaticTermination = YES;
self.disabledAutomaticTermination = YES;
self->_mode = SPUDownloadModePersistent;
self->_desiredFilename = desiredFilename;
self->_bundleIdentifier = [bundleIdentifier copy];
self.mode = SPUDownloadModePersistent;
self.desiredFilename = desiredFilename;
self.bundleIdentifier = bundleIdentifier;
[self startDownloadWithRequest:request];
}
@@ -85,61 +92,60 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
- (void)startTemporaryDownloadWithRequest:(NSURLRequest *)request
{
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
[[NSProcessInfo processInfo] disableAutomaticTermination:SUDownloadingReason];
self->_disabledAutomaticTermination = YES;
self.disabledAutomaticTermination = YES;
self->_mode = SPUDownloadModeTemporary;
self.mode = SPUDownloadModeTemporary;
[self startDownloadWithRequest:request];
}
});
}
- (void)enableAutomaticTermination SPU_OBJC_DIRECT
- (void)enableAutomaticTermination
{
if (_disabledAutomaticTermination) {
if (self.disabledAutomaticTermination) {
[[NSProcessInfo processInfo] enableAutomaticTermination:SUDownloadingReason];
_disabledAutomaticTermination = NO;
self.disabledAutomaticTermination = NO;
}
}
- (NSString *)rootPersistentDownloadCachePathForBundleIdentifier:(NSString *)bundleIdentifier SPU_OBJC_DIRECT
- (NSString *)rootPersistentDownloadCachePathForBundleIdentifier:(NSString *)bundleIdentifier
{
// Note: The installer verifies this "PersistentDownloads" path component
return [[SPULocalCacheDirectory cachePathForBundleIdentifier:bundleIdentifier] stringByAppendingPathComponent:@"PersistentDownloads"];
}
- (void)removeDownloadDirectoryWithDownloadToken:(NSString *)downloadToken bundleIdentifier:(NSString *)bundleIdentifier
- (void)removeDownloadDirectory:(NSString *)directoryName bundleIdentifier:(NSString *)bundleIdentifier
{
// Only take the directory name (from the download token) and compute most of the base path ourselves
// Only take the directory name and compute most of the base path ourselves
// This way we do not have to send/trust an absolute path
// The downloader instance that creates this temp directory isn't necessarily the same as the one
// that clears it (eg upon skipping an already downloaded update), so we can't just preserve it here too
dispatch_async(dispatch_get_main_queue(), ^{
NSString *rootPersistentDownloadCachePath = [self rootPersistentDownloadCachePathForBundleIdentifier:bundleIdentifier];
if (rootPersistentDownloadCachePath != nil) {
NSString *sanitizedDownloadToken = downloadToken.lastPathComponent;
NSString *tempDir = [rootPersistentDownloadCachePath stringByAppendingPathComponent:sanitizedDownloadToken];
NSString *sanitizedDirectoryName = directoryName.lastPathComponent;
NSString *tempDir = [rootPersistentDownloadCachePath stringByAppendingPathComponent:sanitizedDirectoryName];
[[NSFileManager defaultManager] removeItemAtPath:tempDir error:NULL];
}
});
}
- (void)_cleanup SPU_OBJC_DIRECT
- (void)_cleanup
{
[self enableAutomaticTermination];
[_download cancel];
[_downloadSession finishTasksAndInvalidate];
_download = nil;
_downloadSession = nil;
_delegate = nil;
[self.download cancel];
[self.downloadSession finishTasksAndInvalidate];
self.download = nil;
self.downloadSession = nil;
self.delegate = nil;
if (_mode == SPUDownloadModeTemporary && _downloadFilename != nil)
if (self.mode == SPUDownloadModeTemporary && self.downloadFilename != nil)
{
[[NSFileManager defaultManager] removeItemAtPath:_downloadFilename error:NULL];
_downloadFilename = nil;
[[NSFileManager defaultManager] removeItemAtPath:self.downloadFilename error:NULL];
self.downloadFilename = nil;
}
}
@@ -152,24 +158,24 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
});
}
- (void)URLSession:(NSURLSession *)__unused session downloadTask:(NSURLSessionDownloadTask *)downloadTask didFinishDownloadingToURL:(NSURL *)location
- (void)URLSession:(NSURLSession *)__unused session downloadTask:(NSURLSessionDownloadTask *) downloadTask didFinishDownloadingToURL:(NSURL *)location
{
NSInteger statusCode = [downloadTask.response isKindOfClass:[NSHTTPURLResponse class]] ? ((NSHTTPURLResponse *)downloadTask.response).statusCode : 200;
if ((statusCode < 200) || (statusCode >= 400))
{
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 the update. %@ (%ld)", [NSHTTPURLResponse localizedStringForStatusCode:statusCode], (long)statusCode];
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
}
else
{
// 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];
@@ -177,23 +183,23 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
if (tempDir == nil)
{
// Okay, something's really broken with this user's file structure.
[_download cancel];
_download = nil;
[self.download cancel];
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] }];
[_delegate downloaderDidFailWithError:error];
[self.delegate downloaderDidFailWithError:error];
} else {
NSString *downloadFileName = _desiredFilename;
NSString *downloadFileName = self.desiredFilename;
NSString *downloadFileNameDirectory = [tempDir stringByAppendingPathComponent:downloadFileName];
NSError *createError = nil;
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] }];
[_delegate downloaderDidFailWithError:error];
[self.delegate downloaderDidFailWithError:error];
} else {
NSString *name = _download.response.suggestedFilename;
NSString *name = self.download.response.suggestedFilename;
if (!name) {
name = location.lastPathComponent; // This likely contains nothing useful to identify the file (e.g. CFNetworkDownload_87LVIz.tmp)
}
@@ -201,26 +207,11 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
NSString *fromPath = location.path; // suppress moveItemAtPath: non-null warning
NSError *error = nil;
if ([[NSFileManager defaultManager] moveItemAtPath:fromPath toPath:toPath error:&error]) {
_downloadFilename = toPath;
// Create a bookmark for the download
// Don't pass any options (we don't want a persistent security scoped bookmark)
NSURL *downloadURL = [NSURL fileURLWithPath:toPath isDirectory:NO];
NSError *bookmarkError = nil;
NSData *bookmarkData = [downloadURL bookmarkDataWithOptions:0 includingResourceValuesForKeys:@[] relativeToURL:nil error:&bookmarkError];
if (bookmarkData == nil) {
[_delegate downloaderDidFailWithError:bookmarkError];
} else {
// The download token may be provided later to the downloader for removing a download
// and its temporary directory
NSString *downloadToken = tempDir.lastPathComponent;
[_delegate downloaderDidSetDownloadBookmarkData:bookmarkData downloadToken:downloadToken];
[self downloadDidFinish];
}
self.downloadFilename = toPath;
[self.delegate downloaderDidSetDestinationName:name temporaryDirectory:downloadFileNameDirectory];
[self downloadDidFinish];
} else {
[_delegate downloaderDidFailWithError:error];
[self.delegate downloaderDidFailWithError:error];
}
}
}
@@ -230,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
{
if (_mode == SPUDownloadModePersistent && totalBytesExpectedToWrite > 0 && !_receivedExpectedBytes) {
_receivedExpectedBytes = YES;
[_delegate downloaderDidReceiveExpectedContentLength:totalBytesExpectedToWrite];
if (self.mode == SPUDownloadModePersistent && totalBytesExpectedToWrite > 0 && !self.receivedExpectedBytes) {
self.receivedExpectedBytes = YES;
[self.delegate downloaderDidReceiveExpectedContentLength:totalBytesExpectedToWrite];
}
if (_mode == SPUDownloadModePersistent && bytesWritten >= 0) {
[_delegate downloaderDidReceiveDataOfLength:(uint64_t)bytesWritten];
if (self.mode == SPUDownloadModePersistent && bytesWritten >= 0) {
[self.delegate downloaderDidReceiveDataOfLength:(uint64_t)bytesWritten];
}
}
- (void)downloadDidFinish SPU_OBJC_DIRECT
- (void)downloadDidFinish
{
assert(_downloadFilename != nil);
assert(self.downloadFilename != nil);
SPUDownloadData *downloadData = nil;
if (_mode == SPUDownloadModeTemporary) {
NSData *data = [NSData dataWithContentsOfFile:_downloadFilename];
if (self.mode == SPUDownloadModeTemporary) {
NSData *data = [NSData dataWithContentsOfFile:self.downloadFilename];
if (data != nil) {
NSURLResponse *response = _download.response;
NSURLResponse *response = self.download.response;
assert(response != nil);
NSURL *responseURL = response.URL;
if (responseURL == nil) {
responseURL = _download.currentRequest.URL;
responseURL = self.download.currentRequest.URL;
}
if (responseURL == nil) {
responseURL = _download.originalRequest.URL;
responseURL = self.download.originalRequest.URL;
}
assert(responseURL != nil);
@@ -264,29 +255,29 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
}
}
_download = nil;
self.download = nil;
switch (_mode) {
switch (self.mode) {
case SPUDownloadModeTemporary:
if (downloadData != nil) {
[_delegate downloaderDidFinishWithTemporaryDownloadData:downloadData];
[self.delegate downloaderDidFinishWithTemporaryDownloadData:downloadData];
} 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];
break;
case SPUDownloadModePersistent:
[_delegate downloaderDidFinishWithTemporaryDownloadData:nil];
[self.delegate downloaderDidFinishWithTemporaryDownloadData:nil];
break;
}
}
- (void)URLSession:(NSURLSession *)__unused session task:(NSURLSessionTask *)__unused task didCompleteWithError:(NSError *)error
{
_download = nil;
self.download = nil;
if (error != nil) {
[_delegate downloaderDidFailWithError:error];
[self.delegate downloaderDidFailWithError:error];
}
}
+1 -1
View File
@@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
@protocol SPUDownloaderDelegate <NSObject>
// This is only invoked for persistent downloads
- (void)downloaderDidSetDownloadBookmarkData:(NSData *)downloadBookmarkData downloadToken:(NSString *)downloadToken;
- (void)downloaderDidSetDestinationName:(NSString *)destinationName temporaryDirectory:(NSString *)temporaryDirectory;
// Under rare cases, this may be called more than once, in which case the current progress should be reset back to 0
// This is only invoked for persistent downloads
+1 -1
View File
@@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)startTemporaryDownloadWithRequest:(NSURLRequest *)request;
- (void)removeDownloadDirectoryWithDownloadToken:(NSString *)downloadToken bundleIdentifier:(NSString *)bundleIdentifier;
- (void)removeDownloadDirectory:(NSString *)directoryName bundleIdentifier:(NSString *)bundleIdentifier;
- (void)cleanup:(void (^)(void))completionHandler;
+1 -1
View File
@@ -12,7 +12,7 @@
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.
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
- (instancetype)initWithDelegate:(id<SUInstallerCommunicationProtocol>)delegate remote:(BOOL)remote;
+37 -34
View File
@@ -14,20 +14,26 @@
static NSString *SUInstallerConnectionKeepAliveReason = @"Installer Connection Keep Alive";
@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
@implementation SUInstallerConnection
{
NSXPCConnection *_connection;
// Intentionally not weak for XPC reasons
id<SUInstallerCommunicationProtocol> _delegate;
void (^_invalidationBlock)(void);
BOOL _disabledAutomaticTermination;
BOOL _remote;
}
@synthesize delegate = _delegate;
@synthesize disabledAutomaticTermination = _disabledAutomaticTermination;
@synthesize invalidationBlock = _invalidationBlock;
@synthesize connection = _connection;
- (instancetype)initWithDelegate:(id<SUInstallerCommunicationProtocol>)delegate remote:(BOOL)remote
{
self = [super init];
@@ -44,17 +50,17 @@ static NSString *SUInstallerConnectionKeepAliveReason = @"Installer Connection K
return self;
}
- (void)enableAutomaticTermination SPU_OBJC_DIRECT
- (void)enableAutomaticTermination
{
if (_disabledAutomaticTermination) {
if (self.disabledAutomaticTermination) {
[[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
[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;
NSXPCConnection *connection = [[NSXPCConnection alloc] initWithMachServiceName:serviceName options:options];
connection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)];
connection.exportedObject = _delegate;
connection.exportedObject = self.delegate;
connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)];
_connection = connection;
self.connection = connection;
__weak __typeof__(self) weakSelf = self;
_connection.interruptionHandler = ^{
__weak SUInstallerConnection *weakSelf = self;
self.connection.interruptionHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{
__typeof__(self) strongSelf = weakSelf;
if (strongSelf != nil) {
[strongSelf->_connection invalidate];
}
[weakSelf.connection invalidate];
});
};
_connection.invalidationHandler = ^{
self.connection.invalidationHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{
__typeof__(self) strongSelf = weakSelf;
SUInstallerConnection *strongSelf = weakSelf;
if (strongSelf != nil) {
strongSelf->_connection = nil;
strongSelf.connection = nil;
[strongSelf _invalidate];
}
});
};
[_connection resume];
[self.connection resume];
}
- (void)setServiceName:(NSString *)serviceName systemDomain:(BOOL)systemDomain
@@ -121,22 +124,22 @@ static NSString *SUInstallerConnectionKeepAliveReason = @"Installer Connection K
{
if (_remote) {
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 {
[(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) {
_invalidationBlock();
_invalidationBlock = nil;
if (self.invalidationBlock != nil) {
self.invalidationBlock();
self.invalidationBlock = nil;
}
// Break the retain cycle
_delegate = nil;
self.delegate = nil;
[self enableAutomaticTermination];
}
@@ -145,8 +148,8 @@ static NSString *SUInstallerConnectionKeepAliveReason = @"Installer Connection K
- (void)invalidate
{
dispatch_async(dispatch_get_main_queue(), ^{
[self->_connection invalidate];
self->_connection = nil;
[self.connection invalidate];
self.connection = nil;
[self _invalidate];
});
@@ -6,14 +6,12 @@
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#if INSTALLER_CONNECTION_XPC_SERVICE_EMBEDDED
#import <Foundation/Foundation.h>
#import "SUInstallerConnectionProtocol.h"
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
- (instancetype)initWithDelegate:(id<SUInstallerCommunicationProtocol>)delegate;
@@ -21,5 +19,3 @@ SPU_OBJC_DIRECT_MEMBERS @interface SUXPCInstallerConnection : NSObject <SUInstal
@end
NS_ASSUME_NONNULL_END
#endif
+28 -30
View File
@@ -6,21 +6,24 @@
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#if INSTALLER_CONNECTION_XPC_SERVICE_EMBEDDED
#import "SUXPCInstallerConnection.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
{
NSXPCConnection *_connection;
// Intentionally not weak for XPC reasons
id<SUInstallerCommunicationProtocol> _delegate;
void (^_invalidationBlock)(void);
}
@synthesize connection = _connection;
@synthesize delegate = _delegate;
@synthesize invalidationBlock = _invalidationBlock;
- (instancetype)initWithDelegate:(id<SUInstallerCommunicationProtocol>)delegate
{
@@ -29,17 +32,14 @@
_connection = [[NSXPCConnection alloc] initWithServiceName:@INSTALLER_CONNECTION_BUNDLE_ID];
_connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerConnectionProtocol)];
__weak __typeof__(self) weakSelf = self;
__weak SUXPCInstallerConnection *weakSelf = self;
_connection.invalidationHandler = ^{
[weakSelf invokeInvalidation];
};
_connection.interruptionHandler = ^{
__typeof__(self) strongSelf = weakSelf;
if (strongSelf != nil) {
[strongSelf invokeInvalidation];
[strongSelf->_connection invalidate];
}
[weakSelf invokeInvalidation];
[weakSelf.connection invalidate];
};
_delegate = delegate;
@@ -54,41 +54,39 @@
- (void)setInvalidationHandler:(void (^)(void))invalidationHandler
{
_invalidationBlock = [invalidationHandler copy];
self.invalidationBlock = invalidationHandler;
__weak __typeof__(self) weakSelf = self;
[(id<SUInstallerConnectionProtocol>)_connection.remoteObjectProxy setInvalidationHandler:^{
__weak SUXPCInstallerConnection *weakSelf = self;
[(id<SUInstallerConnectionProtocol>)self.connection.remoteObjectProxy setInvalidationHandler:^{
[weakSelf invokeInvalidation];
}];
}
- (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
{
[(id<SUInstallerConnectionProtocol>)_connection.remoteObjectProxy handleMessageWithIdentifier:identifier data:data];
[(id<SUInstallerConnectionProtocol>)self.connection.remoteObjectProxy handleMessageWithIdentifier:identifier data:data];
}
- (void)invalidate
{
[(id<SUInstallerConnectionProtocol>)_connection.remoteObjectProxy invalidate];
[_connection invalidate];
_connection = nil;
[(id<SUInstallerConnectionProtocol>)self.connection.remoteObjectProxy invalidate];
[self.connection invalidate];
self.connection = nil;
}
- (void)invokeInvalidation SPU_OBJC_DIRECT
- (void)invokeInvalidation
{
if (_invalidationBlock != nil) {
_invalidationBlock();
_invalidationBlock = nil;
if (self.invalidationBlock != nil) {
self.invalidationBlock();
self.invalidationBlock = nil;
}
// Break our retain cycle
_delegate = nil;
self.delegate = nil;
}
@end
#endif
@@ -9,18 +9,10 @@
#ifndef 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>
// Chances are clients will need this too
#import <Sparkle/SPUInstallationType.h>
#endif
@class NSString;
+34 -62
View File
@@ -25,7 +25,7 @@
@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];
@@ -106,7 +106,7 @@
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];
@@ -211,13 +211,12 @@
if (@available(macOS 11, *)) {
CFStringRef uti = (__bridge CFStringRef)[UTTypePNG identifier];
imageDestination = CGImageDestinationCreateWithURL((CFURLRef)tempIconDestinationURL, uti, 1, NULL);
}
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_VERSION_11_0
else
{
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
imageDestination = CGImageDestinationCreateWithURL((CFURLRef)tempIconDestinationURL, kUTTypePNG, 1, NULL);
#pragma clang diagnostic pop
}
#endif
if (imageDestination != NULL) {
CGImageDestinationAddImageFromSource(imageDestination, imageSource, imageIndex, (CFDictionaryRef)@{});
if (CGImageDestinationFinalize(imageDestination)) {
@@ -311,7 +310,7 @@
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
NSString *nameWithExtension = (extension.length > 0) ? [toolName stringByAppendingPathExtension:extension] : toolName;
@@ -326,17 +325,10 @@
} else {
auxiliaryToolURL = [bundle URLForAuxiliaryExecutable:nameWithExtension];
}
if (auxiliaryToolURL == nil) {
SULog(SULogLevelError, @"Error: Cannot retrieve path for auxiliary tool: %@", nameWithExtension);
return nil;
}
assert(auxiliaryToolURL != nil);
NSURL *resolvedAuxiliaryToolURL = [auxiliaryToolURL URLByResolvingSymlinksInPath];
if (resolvedAuxiliaryToolURL == nil) {
SULog(SULogLevelError, @"Error: Cannot retrieve resolved path for auxiliary tool path: %@", auxiliaryToolURL.path);
return nil;
}
assert(resolvedAuxiliaryToolURL != nil);
return resolvedAuxiliaryToolURL.path;
}
@@ -378,21 +370,14 @@ BOOL SPUSystemNeedsAuthorizationAccessForBundlePath(NSString *bundlePath)
return needsAuthorization;
}
static BOOL SPUUsesSystemDomainForBundlePath(NSString *path, BOOL rootUser
#if SPARKLE_BUILD_PACKAGE_SUPPORT
, NSString *installationType
#endif
)
static BOOL SPUUsesSystemDomainForBundlePath(NSString *path, NSString *installationType, BOOL rootUser)
{
if (!rootUser) {
#if SPARKLE_BUILD_PACKAGE_SUPPORT
if ([installationType isEqualToString:SPUInstallationTypeGuidedPackage]) {
return YES;
} else if ([installationType isEqualToString:SPUInstallationTypeInteractivePackage]) {
return NO;
} else
#endif
{
} else {
return SPUSystemNeedsAuthorizationAccessForBundlePath(path);
}
} else {
@@ -411,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
BOOL rootUser = (geteuid() == 0);
BOOL inSystemDomain = SPUUsesSystemDomainForBundlePath(hostBundlePath, rootUser
#if SPARKLE_BUILD_PACKAGE_SUPPORT
, installationType
#endif
);
BOOL inSystemDomain = SPUUsesSystemDomainForBundlePath(hostBundlePath, installationType, rootUser);
NSBundle *hostBundle = [NSBundle bundleWithPath:hostBundlePath];
if (hostBundle == nil) {
@@ -456,10 +437,26 @@ static BOOL SPUUsesSystemDomainForBundlePath(NSString *path, BOOL rootUser
return;
}
// It may be tempting here to validate/match the signature of the installer and progress tool, however this is not very reliable
// We can't compare the signature of this framework/XPC service (depending how it's run) to the host bundle because
// they could be different (eg: take a look at sparkle-cli). We also can't easily tell if the signature of the service/framework is the same as the bundle it's inside.
// The service/framework also need not even be signed in the first place. We'll just assume for now the original bundle hasn't been tampered with
NSString *rootLauncherCachePath = [[SPULocalCacheDirectory cachePathForBundleIdentifier:hostBundleIdentifier] stringByAppendingPathComponent:@"Launcher"];
[SPULocalCacheDirectory removeOldItemsInDirectory:rootLauncherCachePath];
NSString *launcherCachePath = [SPULocalCacheDirectory createUniqueDirectoryInDirectory:rootLauncherCachePath];
if (launcherCachePath == nil) {
SULog(SULogLevelError, @"Failed to create cache directory for progress tool in %@", rootLauncherCachePath);
completionHandler(SUInstallerLauncherFailure, inSystemDomain);
return;
}
SUFileManager *fileManager = [[SUFileManager alloc] init];
NSString *userName;
NSString *homeDirectory;
uid_t uid = 0;
gid_t gid = 0;
if (!rootUser) {
// Normal path
homeDirectory = NSHomeDirectory();
@@ -470,6 +467,9 @@ static BOOL SPUUsesSystemDomainForBundlePath(NSString *path, BOOL rootUser
} else {
// As the root user we need to obtain the user name and home directory reflecting
// the user's console session.
uid_t uid = 0;
gid_t gid = 0;
CFStringRef userNameRef = SCDynamicStoreCopyConsoleUser(NULL, &uid, &gid);
if (userNameRef == NULL) {
SULog(SULogLevelError, @"Failed to retrieve user name from the console user");
@@ -485,35 +485,7 @@ static BOOL SPUUsesSystemDomainForBundlePath(NSString *path, BOOL rootUser
completionHandler(SUInstallerLauncherFailure, inSystemDomain);
return;
}
}
// It may be tempting here to validate/match the signature of the installer and progress tool, however this is not very reliable
// We can't compare the signature of this framework/XPC service (depending how it's run) to the host bundle because
// they could be different (eg: take a look at sparkle-cli). We also can't easily tell if the signature of the service/framework is the same as the bundle it's inside.
// The service/framework also need not even be signed in the first place. We'll just assume for now the original bundle hasn't been tampered with
NSString *cachePath = rootUser ?
[SPULocalCacheDirectory cachePathForBundleIdentifier:hostBundleIdentifier userName:userName] :
[SPULocalCacheDirectory cachePathForBundleIdentifier:hostBundleIdentifier];
NSString *rootLauncherCachePath = [cachePath stringByAppendingPathComponent:@"Launcher"];
[SPULocalCacheDirectory removeOldItemsInDirectory:rootLauncherCachePath];
NSDictionary<NSFileAttributeKey, id> *fileAttributes = rootUser ?
@{NSFileOwnerAccountID: @(uid), NSFileGroupOwnerAccountID: @(gid)} :
nil;
NSString *launcherCachePath = [SPULocalCacheDirectory createUniqueDirectoryInDirectory:rootLauncherCachePath intermediateDirectoryFileAttributes:fileAttributes];
if (launcherCachePath == nil) {
SULog(SULogLevelError, @"Failed to create cache directory for progress tool in %@", rootLauncherCachePath);
completionHandler(SUInstallerLauncherFailure, inSystemDomain);
return;
}
SUFileManager *fileManager = [[SUFileManager alloc] init];
if (rootUser) {
// Ensure the console user has ownership of the launcher cache directory
// Otherwise the updater may not launch and not be able to clean up itself
NSError *changeOwnerAndGroupError = nil;
+1 -1
View File
@@ -10,7 +10,7 @@
#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.
SPU_OBJC_DIRECT_MEMBERS @interface SUInstallerStatus : NSObject <SUInstallerStatusProtocol>
@interface SUInstallerStatus : NSObject <SUInstallerStatusProtocol>
- (instancetype)initWithRemote:(BOOL)remote;
+31 -28
View File
@@ -11,15 +11,21 @@
#include "AppKitPrevention.h"
@interface SUInstallerStatus ()
@property (nonatomic, copy) void (^invalidationBlock)(void);
@property (nonatomic) NSXPCConnection *connection;
@end
@implementation SUInstallerStatus
{
NSXPCConnection *_connection;
void (^_invalidationBlock)(void);
BOOL _remote;
}
@synthesize invalidationBlock = _invalidationBlock;
@synthesize connection = _connection;
- (instancetype)initWithRemote:(BOOL)remote
{
self = [super init];
@@ -33,42 +39,39 @@
{
if (_remote) {
dispatch_async(dispatch_get_main_queue(), ^{
self->_invalidationBlock = [invalidationHandler copy];
self.invalidationBlock = invalidationHandler;
});
} 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];
connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUStatusInfoProtocol)];
_connection = connection;
self.connection = connection;
__weak __typeof__(self) weakSelf = self;
_connection.interruptionHandler = ^{
__weak SUInstallerStatus *weakSelf = self;
self.connection.interruptionHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{
__typeof__(self) strongSelf = weakSelf;
if (strongSelf != nil) {
[strongSelf->_connection invalidate];
}
[weakSelf.connection invalidate];
});
};
_connection.invalidationHandler = ^{
self.connection.invalidationHandler = ^{
dispatch_async(dispatch_get_main_queue(), ^{
__typeof__(self) strongSelf = weakSelf;
SUInstallerStatus *strongSelf = weakSelf;
if (strongSelf != nil) {
strongSelf->_connection = nil;
strongSelf.connection = nil;
[strongSelf _invokeInvalidationBlock];
}
});
};
[_connection resume];
[self.connection resume];
}
- (void)setServiceName:(NSString *)serviceName
@@ -86,10 +89,10 @@
{
if (_remote) {
dispatch_async(dispatch_get_main_queue(), ^{
[(id<SUStatusInfoProtocol>)self->_connection.remoteObjectProxy probeStatusInfoWithReply:reply];
[(id<SUStatusInfoProtocol>)self.connection.remoteObjectProxy probeStatusInfoWithReply:reply];
});
} else {
[(id<SUStatusInfoProtocol>)_connection.remoteObjectProxy probeStatusInfoWithReply:reply];
[(id<SUStatusInfoProtocol>)self.connection.remoteObjectProxy probeStatusInfoWithReply:reply];
}
}
@@ -97,18 +100,18 @@
{
if (_remote) {
dispatch_async(dispatch_get_main_queue(), ^{
[(id<SUStatusInfoProtocol>)self->_connection.remoteObjectProxy probeStatusConnectivityWithReply:reply];
[(id<SUStatusInfoProtocol>)self.connection.remoteObjectProxy probeStatusConnectivityWithReply:reply];
});
} else {
[(id<SUStatusInfoProtocol>)_connection.remoteObjectProxy probeStatusConnectivityWithReply:reply];
[(id<SUStatusInfoProtocol>)self.connection.remoteObjectProxy probeStatusConnectivityWithReply:reply];
}
}
- (void)_invokeInvalidationBlock SPU_OBJC_DIRECT
- (void)_invokeInvalidationBlock
{
if (_invalidationBlock != nil) {
_invalidationBlock();
_invalidationBlock = nil;
if (self.invalidationBlock != nil) {
self.invalidationBlock();
self.invalidationBlock = nil;
}
}
@@ -116,8 +119,8 @@
- (void)invalidate
{
dispatch_async(dispatch_get_main_queue(), ^{
[self->_connection invalidate];
self->_connection = nil;
[self.connection invalidate];
self.connection = nil;
[self _invokeInvalidationBlock];
});
-4
View File
@@ -6,13 +6,9 @@
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#if INSTALLER_STATUS_XPC_SERVICE_EMBEDDED
#import <Foundation/Foundation.h>
#import "SUInstallerStatusProtocol.h"
@interface SUXPCInstallerStatus : NSObject <SUInstallerStatusProtocol>
@end
#endif
+25 -27
View File
@@ -6,19 +6,22 @@
// Copyright © 2016 Sparkle Project. All rights reserved.
//
#if INSTALLER_STATUS_XPC_SERVICE_EMBEDDED
#import "SUXPCInstallerStatus.h"
#include "AppKitPrevention.h"
@interface SUXPCInstallerStatus ()
@property (nonatomic) NSXPCConnection *connection;
@property (nonatomic, copy) void (^invalidationBlock)(void);
@end
@implementation SUXPCInstallerStatus
{
NSXPCConnection *_connection;
void (^_invalidationBlock)(void);
}
@synthesize connection = _connection;
@synthesize invalidationBlock = _invalidationBlock;
- (instancetype)init
{
@@ -27,17 +30,14 @@
_connection = [[NSXPCConnection alloc] initWithServiceName:@INSTALLER_STATUS_BUNDLE_ID];
_connection.remoteObjectInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerStatusProtocol)];
__weak __typeof__(self) weakSelf = self;
__weak SUXPCInstallerStatus *weakSelf = self;
_connection.invalidationHandler = ^{
[weakSelf invokeInvalidation];
};
_connection.interruptionHandler = ^{
__typeof__(self) strongSelf = weakSelf;
if (strongSelf != nil) {
[strongSelf invokeInvalidation];
[strongSelf->_connection invalidate];
}
[weakSelf invokeInvalidation];
[weakSelf.connection invalidate];
};
[_connection resume];
@@ -47,44 +47,42 @@
- (void)setInvalidationHandler:(void (^)(void))invalidationHandler
{
_invalidationBlock = [invalidationHandler copy];
self.invalidationBlock = invalidationHandler;
__weak __typeof__(self) weakSelf = self;
[(id<SUInstallerStatusProtocol>)_connection.remoteObjectProxy setInvalidationHandler:^{
__weak SUXPCInstallerStatus *weakSelf = self;
[(id<SUInstallerStatusProtocol>)self.connection.remoteObjectProxy setInvalidationHandler:^{
[weakSelf invokeInvalidation];
}];
}
- (void)setServiceName:(NSString *)serviceName
{
[(id<SUInstallerStatusProtocol>)_connection.remoteObjectProxy setServiceName:serviceName];
[(id<SUInstallerStatusProtocol>)self.connection.remoteObjectProxy setServiceName:serviceName];
}
- (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
{
[(id<SUInstallerStatusProtocol>)_connection.remoteObjectProxy probeStatusConnectivityWithReply:reply];
[(id<SUInstallerStatusProtocol>)self.connection.remoteObjectProxy probeStatusConnectivityWithReply:reply];
}
- (void)invalidate
{
[(id<SUInstallerStatusProtocol>)_connection.remoteObjectProxy invalidate];
[_connection invalidate];
_connection = nil;
[(id<SUInstallerStatusProtocol>)self.connection.remoteObjectProxy invalidate];
[self.connection invalidate];
self.connection = nil;
}
- (void)invokeInvalidation
{
if (_invalidationBlock != nil) {
_invalidationBlock();
_invalidationBlock = nil;
if (self.invalidationBlock != nil) {
self.invalidationBlock();
self.invalidationBlock = nil;
}
}
@end
#endif
+1 -1
View File
@@ -3,7 +3,7 @@
all: build
ifndef BUILDDIR
BUILDDIR := $(shell mkdir -p "build" && mktemp -d "build/Sparkle.XXXXXX")
BUILDDIR := $(shell mktemp -d "$(TMPDIR)/Sparkle.XXXXXX")
endif
localizable-strings:
+3 -3
View File
@@ -2,10 +2,10 @@
import PackageDescription
// Version is technically not required here, SPM doesn't check
let version = "2.5.2"
let version = "2.2.2"
// 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.5.2"
let checksum = "48ffac5d4477bf8be814c369b5c1b5a6b35e05f5e4fa473bd5b5c41d90846a99"
let tag = "2.2.2"
let checksum = "aafce90805ca50d099c32e744636b2524a7382629f8f7e14ff21c84634125a44"
let url = "https://github.com/sparkle-project/Sparkle/releases/download/\(tag)/Sparkle-for-Swift-Package-Manager.zip"
let package = Package(
+10 -5
View File
@@ -29,13 +29,20 @@ Please visit [Sparkle's website](http://sparkle-project.org) for up to date docu
## Requirements
* Runtime: macOS 10.13 or greater for 2.3, macOS 10.11 or greater for 2.2.x
* Runtime: macOS 10.11 or greater
* Build: Latest major Xcode (stable or beta, whichever is latest) and one major version less.
* HTTPS server for serving updates (see [App Transport Security](http://sparkle-project.org/documentation/app-transport-security/))
## 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.
## Development
This repository uses git submodules, and will not build unless you clone recursively. Also, GitHub-provided ZIP/tar archives are broken due to GitHub not supporting git submodules properly.
git clone https://github.com/sparkle-project/Sparkle
git submodule update --init --recursive
### Troubleshooting
@@ -52,9 +59,7 @@ If you are adding a symbol to the public API you must decorate the declaration w
### Building the distribution package
You do not usually need to build a Sparkle distribution unless you're making changes to Sparkle itself.
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 and revealed in Finder after the build has completed.
`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.
+314
View File
@@ -0,0 +1,314 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ADP2,1</key>
<string>Developer Transition Kit</string>
<key>iMac1,1</key>
<string>iMac G3 (Rev A-D)</string>
<key>iMac4,1</key>
<string>iMac (Core Duo)</string>
<key>iMac4,2</key>
<string>iMac for Education (17 inch, Core Duo)</string>
<key>iMac5,1</key>
<string>iMac (Core 2 Duo, 17 or 20 inch, SuperDrive)</string>
<key>iMac5,2</key>
<string>iMac (Core 2 Duo, 17 inch, Combo Drive)</string>
<key>iMac6,1</key>
<string>iMac (Core 2 Duo, 24 inch, SuperDrive)</string>
<key>iMac7,1</key>
<string>iMac Intel Core 2 Duo (aluminum enclosure)</string>
<key>iMac8,1</key>
<string>iMac (Core 2 Duo, 20 or 24 inch, Early 2008 )</string>
<key>iMac9,1</key>
<string>iMac (Core 2 Duo, 20 or 24 inch, Early or Mid 2009 )</string>
<key>iMac10,1</key>
<string>iMac (Core 2 Duo, 21.5 or 27 inch, Late 2009 )</string>
<key>iMac11,1</key>
<string>iMac (Core i5 or i7, 27 inch Late 2009)</string>
<key>iMac11,2</key>
<string>21.5&quot; iMac (mid 2010)</string>
<key>iMac11,3</key>
<string>iMac (Core i5 or i7, 27 inch Mid 2010)</string>
<key>iMac12,1</key>
<string>iMac (Core i3 or i5 or i7, 21.5 inch Mid 2010 or Late 2011)</string>
<key>iMac12,2</key>
<string>iMac (Core i5 or i7, 27 inch Mid 2011)</string>
<key>iMac13,1</key>
<string>iMac (Core i3 or i5 or i7, 21.5 inch Late 2012 or Early 2013)</string>
<key>iMac13,2</key>
<string>iMac (Core i5 or i7, 27 inch Late 2012)</string>
<key>iMac14,1</key>
<string>iMac (Core i5, 21.5 inch Late 2013)</string>
<key>iMac14,2</key>
<string>iMac (Core i5 or i7, 27 inch Late 2013)</string>
<key>iMac14,3</key>
<string>iMac (Core i5 or i7, 21.5 inch Late 2013)</string>
<key>iMac14,4</key>
<string>iMac (Core i5, 21.5 inch Mid 2014)</string>
<key>iMac15,1</key>
<string>iMac (Retina 5K Core i5 or i7, 27 inch Late 2014 or Mid 2015)</string>
<key>iMac16,1</key>
<string>iMac (Core i5, 21,5 inch Late 2015)</string>
<key>iMac16,2</key>
<string>iMac (Retina 4K Core i5 or i7, 21.5 inch Late 2015)</string>
<key>iMac17,1</key>
<string>iMac (Retina 5K Core i5 or i7, 27 inch Late 2015)</string>
<key>MacBook1,1</key>
<string>MacBook (Core Duo)</string>
<key>MacBook2,1</key>
<string>MacBook (Core 2 Duo)</string>
<key>MacBook4,1</key>
<string>MacBook (Core 2 Duo Feb 2008)</string>
<key>MacBook5,1</key>
<string>MacBook (Core 2 Duo, Late 2008, Unibody)</string>
<key>MacBook5,2</key>
<string>MacBook (Core 2 Duo, Early 2009, White)</string>
<key>MacBook6,1</key>
<string>MacBook (Core 2 Duo, Late 2009, Unibody)</string>
<key>MacBook7,1</key>
<string>MacBook (Core 2 Duo, Mid 2010, White)</string>
<key>MacBook8,1</key>
<string>MacBook (Core M, 12 inch, Early 2015)</string>
<key>MacBookAir1,1</key>
<string>MacBook Air (Core 2 Duo, 13 inch, Early 2008)</string>
<key>MacBookAir2,1</key>
<string>MacBook Air (Core 2 Duo, 13 inch, Mid 2009)</string>
<key>MacBookAir3,1</key>
<string>MacBook Air (Core 2 Duo, 11 inch, Late 2010)</string>
<key>MacBookAir3,2</key>
<string>MacBook Air (Core 2 Duo, 13 inch, Late 2010)</string>
<key>MacBookAir4,1</key>
<string>MacBook Air (Core i5 or i7, 11 inch, Mid 2011)</string>
<key>MacBookAir4,2</key>
<string>MacBook Air (Core i5 or i7, 13 inch, Mid 2011)</string>
<key>MacBookAir5,1</key>
<string>MacBook Air (Core i5 or i7, 11 inch, Mid 2012)</string>
<key>MacBookAir5,2</key>
<string>MacBook Air (Core i5 or i7, 13 inch, Mid 2012)</string>
<key>MacBookAir6,1</key>
<string>MacBook Air (Core i5 or i7, 11 inch, Mid 2013 or Early 2014)</string>
<key>MacBookAir6,2</key>
<string>MacBook Air (Core i5 or i7, 13 inch, Mid 2013 or Early 2014)</string>
<key>MacBookAir7,1</key>
<string>MacBook Air (Core i5 or i7, 11 inch, Early 2015)</string>
<key>MacBookAir7,2</key>
<string>MacBook Air (Core i5 or i7, 13 inch, Early 2015)</string>
<key>MacBookPro1,1</key>
<string>MacBook Pro Core Duo (15-inch)</string>
<key>MacBookPro1,2</key>
<string>MacBook Pro Core Duo (17-inch)</string>
<key>MacBookPro2,1</key>
<string>MacBook Pro Core 2 Duo (17-inch)</string>
<key>MacBookPro2,2</key>
<string>MacBook Pro Core 2 Duo (15-inch)</string>
<key>MacBookPro3,1</key>
<string>MacBook Pro Core 2 Duo (15-inch LED, Core 2 Duo)</string>
<key>MacBookPro3,2</key>
<string>MacBook Pro Core 2 Duo (17-inch HD, Core 2 Duo)</string>
<key>MacBookPro4,1</key>
<string>MacBook Pro (Core 2 Duo Feb 2008)</string>
<key>MacBookPro5,1</key>
<string>MacBook Pro Intel Core 2 Duo (aluminum unibody)</string>
<key>MacBookPro5,2</key>
<string>MacBook Pro Intel Core 2 Duo (aluminum unibody)</string>
<key>MacBookPro5,3</key>
<string>MacBook Pro Intel Core 2 Duo (aluminum unibody)</string>
<key>MacBookPro5,4</key>
<string>MacBook Pro Intel Core 2 Duo (aluminum unibody)</string>
<key>MacBookPro5,5</key>
<string>MacBook Pro Intel Core 2 Duo (aluminum unibody)</string>
<key>MacBookPro6,1</key>
<string>MacBook Pro Intel Core i5, Intel Core i7 (mid 2010)</string>
<key>MacBookPro6,2</key>
<string>MacBook Pro Intel Core i5, Intel Core i7 (mid 2010)</string>
<key>MacBookPro7,1</key>
<string>MacBook Pro Intel Core 2 Duo (mid 2010)</string>
<key>MacBookPro8,1</key>
<string>MacBook Pro Intel Core i5, Intel Core i7, 13&quot; (early 2011)</string>
<key>MacBookPro8,2</key>
<string>MacBook Pro Intel Core i7, 15&quot; (early 2011)</string>
<key>MacBookPro8,3</key>
<string>MacBook Pro Intel Core i7, 17&quot; (early 2011)</string>
<key>MacBookPro9,1</key>
<string>MacBook Pro (15-inch, Mid 2012)</string>
<key>MacBookPro9,2</key>
<string>MacBook Pro (13-inch, Mid 2012)</string>
<key>MacBookPro10,1</key>
<string>MacBook Pro (Retina, Mid 2012)</string>
<key>MacBookPro10,2</key>
<string>MacBook Pro (Retina, 13-inch, Late 2012)</string>
<key>MacBookPro11,1</key>
<string>MacBook Pro (Retina, 13-inch, Late 2013)</string>
<key>MacBookPro11,2</key>
<string>MacBook Pro (Retina, 15-inch, Late 2013)</string>
<key>MacBookPro11,3</key>
<string>MacBook Pro (Retina, 15-inch, Late 2013)</string>
<key>MacbookPro11,4</key>
<string>MacBook Pro (Retina, 15-inch, Mid 2015)</string>
<key>MacbookPro11,5</key>
<string>MacBook Pro (Retina, 15-inch, Mid 2015)</string>
<key>MacbookPro12,1 </key>
<string>MacBook Pro (Retina, 13-inch, Early 2015)</string>
<key>Macmini1,1</key>
<string>Mac Mini (Core Solo/Duo)</string>
<key>Macmini2,1</key>
<string>Mac mini Intel Core</string>
<key>Macmini3,1</key>
<string>Mac mini Intel Core</string>
<key>Macmini4,1</key>
<string>Mac mini Intel Core (Mid 2010)</string>
<key>Macmini5,1</key>
<string>Mac mini (Core i5, Mid 2011)</string>
<key>Macmini5,2</key>
<string>Mac mini (Core i5 or Core i7, Mid 2011)</string>
<key>Macmini5,3</key>
<string>Mac mini (Core i7, Server, Mid 2011)</string>
<key>Macmini6,1</key>
<string>Mac mini (Core i5, Late 2012)</string>
<key>Macmini6,2</key>
<string>Mac mini (Core i7, Normal or Server, Late 2012)</string>
<key>Macmini7,1</key>
<string>Mac mini (Core i5 or Core i7, Late 2014)</string>
<key>MacPro1,1,Quad</key>
<string>Mac Pro</string>
<key>MacPro1,1</key>
<string>Mac Pro (four-core)</string>
<key>MacPro2,1</key>
<string>Mac Pro (eight-core)</string>
<key>MacPro3,1</key>
<string>Mac Pro (January 2008 4- or 8- core &quot;Harpertown&quot;)</string>
<key>MacPro4,1</key>
<string>Mac Pro (March 2009)</string>
<key>MacPro5,1</key>
<string>Mac Pro (2010 or 2012)</string>
<key>MacPro6,1</key>
<string>Mac Pro (Late 2013)</string>
<key>PowerBook1,1</key>
<string>PowerBook G3</string>
<key>PowerBook2,1</key>
<string>iBook G3</string>
<key>PowerBook2,2</key>
<string>iBook G3 (FireWire)</string>
<key>PowerBook2,3</key>
<string>iBook G3</string>
<key>PowerBook2,4</key>
<string>iBook G3</string>
<key>PowerBook3,1</key>
<string>PowerBook G3 (FireWire)</string>
<key>PowerBook3,2</key>
<string>PowerBook G4</string>
<key>PowerBook3,3</key>
<string>PowerBook G4 (Gigabit Ethernet)</string>
<key>PowerBook3,4</key>
<string>PowerBook G4 (DVI)</string>
<key>PowerBook3,5</key>
<string>PowerBook G4 (1GHz / 867MHz)</string>
<key>PowerBook4,1</key>
<string>iBook G3 (Dual USB, Late 2001)</string>
<key>PowerBook4,2</key>
<string>iBook G3 (16MB VRAM)</string>
<key>PowerBook4,3</key>
<string>iBook G3 Opaque 16MB VRAM, 32MB VRAM, Early 2003)</string>
<key>PowerBook5,1</key>
<string>PowerBook G4 (17 inch)</string>
<key>PowerBook5,2</key>
<string>PowerBook G4 (15 inch FW 800)</string>
<key>PowerBook5,3</key>
<string>PowerBook G4 (17-inch 1.33GHz)</string>
<key>PowerBook5,4</key>
<string>PowerBook G4 (15 inch 1.5/1.33GHz)</string>
<key>PowerBook5,5</key>
<string>PowerBook G4 (17-inch 1.5GHz)</string>
<key>PowerBook5,6</key>
<string>PowerBook G4 (15 inch 1.67GHz/1.5GHz)</string>
<key>PowerBook5,7</key>
<string>PowerBook G4 (17-inch 1.67GHz)</string>
<key>PowerBook5,8</key>
<string>PowerBook G4 (Double layer SD, 15 inch)</string>
<key>PowerBook5,9</key>
<string>PowerBook G4 (Double layer SD, 17 inch)</string>
<key>PowerBook6,1</key>
<string>PowerBook G4 (12 inch)</string>
<key>PowerBook6,2</key>
<string>PowerBook G4 (12 inch, DVI)</string>
<key>PowerBook6,3</key>
<string>iBook G4</string>
<key>PowerBook6,4</key>
<string>PowerBook G4 (12 inch 1.33GHz)</string>
<key>PowerBook6,5</key>
<string>iBook G4 (Early-Late 2004)</string>
<key>PowerBook6,7</key>
<string>iBook G4 (Mid 2005)</string>
<key>PowerBook6,8</key>
<string>PowerBook G4 (12 inch 1.5GHz)</string>
<key>PowerMac1,1</key>
<string>Power Macintosh G3 (Blue &amp; White)</string>
<key>PowerMac1,2</key>
<string>Power Macintosh G4 (PCI Graphics)</string>
<key>PowerMac2,1</key>
<string>iMac G3 (Slot-loading CD-ROM)</string>
<key>PowerMac2,2</key>
<string>iMac G3 (Summer 2000)</string>
<key>PowerMac3,1</key>
<string>Power Macintosh G4 (AGP Graphics)</string>
<key>PowerMac3,2</key>
<string>Power Macintosh G4 (AGP Graphics)</string>
<key>PowerMac3,3</key>
<string>Power Macintosh G4 (Gigabit Ethernet)</string>
<key>PowerMac3,4</key>
<string>Power Macintosh G4 (Digital Audio)</string>
<key>PowerMac3,5</key>
<string>Power Macintosh G4 (Quick Silver)</string>
<key>PowerMac3,6</key>
<string>Power Macintosh G4 (Mirrored Drive Door)</string>
<key>PowerMac4,1</key>
<string>iMac G3 (Early/Summer 2001)</string>
<key>PowerMac4,2</key>
<string>iMac G4 (Flat Panel)</string>
<key>PowerMac4,4</key>
<string>eMac</string>
<key>PowerMac4,5</key>
<string>iMac G4 (17-inch Flat Panel)</string>
<key>PowerMac5,1</key>
<string>Power Macintosh G4 Cube</string>
<key>PowerMac5,2</key>
<string>Power Mac G4 Cube</string>
<key>PowerMac6,1</key>
<string>iMac G4 (USB 2.0)</string>
<key>PowerMac6,3</key>
<string>iMac G4 (20-inch Flat Panel)</string>
<key>PowerMac6,4</key>
<string>eMac (USB 2.0, 2005)</string>
<key>PowerMac7,2</key>
<string>Power Macintosh G5</string>
<key>PowerMac7,3</key>
<string>Power Macintosh G5</string>
<key>PowerMac8,1</key>
<string>iMac G5</string>
<key>PowerMac8,2</key>
<string>iMac G5 (Ambient Light Sensor)</string>
<key>PowerMac9,1</key>
<string>Power Macintosh G5 (Late 2005)</string>
<key>PowerMac10,1</key>
<string>Mac Mini G4</string>
<key>PowerMac10,2</key>
<string>Mac Mini (Late 2005)</string>
<key>PowerMac11,2</key>
<string>Power Macintosh G5 (Late 2005)</string>
<key>PowerMac12,1</key>
<string>iMac G5 (iSight)</string>
<key>RackMac1,1</key>
<string>Xserve G4</string>
<key>RackMac1,2</key>
<string>Xserve G4 (slot-loading, cluster node)</string>
<key>RackMac3,1</key>
<string>Xserve G5</string>
<key>Xserve1,1</key>
<string>Xserve (Intel Xeon)</string>
<key>Xserve2,1</key>
<string>Xserve (January 2008 quad-core)</string>
<key>Xserve3,1</key>
<string>Xserve (early 2009)</string>
</dict>
</plist>
+3 -3
View File
@@ -16,7 +16,7 @@
</sparkle:fullReleaseNotesLink>
<pubDate>Wed, 09 Jan 2006 19:20:11 +0000</pubDate>
<enclosure url="https://you.com/app/Your%20Great%20App%202.0.zip" length="1623481" type="application/octet-stream" sparkle:edSignature="WVyVJpOx+a5+vNWJVY79TRjFKveNk+VhGJf2iti4CZtJsJewIUGvh/1AKKEAFbH1qUwx+vro1ECuzOsMmumoBA==" />
<sparkle:minimumSystemVersion>10.13</sparkle:minimumSystemVersion>
<sparkle:minimumSystemVersion>10.11</sparkle:minimumSystemVersion>
</item>
<item>
@@ -31,7 +31,7 @@
</sparkle:fullReleaseNotesLink>
<pubDate>Wed, 01 Jan 2006 12:20:11 +0000</pubDate>
<enclosure url="https://you.com/app/Your%20Great%20App%201.5.zip" length="1472893" type="application/octet-stream" sparkle:edSignature="pNFd7KbcQSu+Mq7UYrbQXTPq82luht2ACXm/r2utp1u/Uv/5hWqctdT2jwQgMejW7DRoeV/hVr6J4VdZYdwWDw==" />
<sparkle:minimumSystemVersion>10.13</sparkle:minimumSystemVersion>
<sparkle:minimumSystemVersion>10.11</sparkle:minimumSystemVersion>
</item>
<!-- Now here's an example of a version with a weird internal version number (like an SVN revision) but a human-readable external one. -->
@@ -48,7 +48,7 @@
<sparkle:shortVersionString>1.4</sparkle:shortVersionString>
<pubDate>Wed, 25 Dec 2005 12:20:11 +0000</pubDate>
<enclosure url="https://you.com/app/Your%20Great%20App%201.4.zip" sparkle:edSignature="Ody3D/ybSMH4T+P/oNj3LN4F0SA8RJGLEr1TI4UemrBAiJ9aEcDnYV3u58P75AbcFjI13jPYmHDUHXMSTFQbDw==" length="1472349" type="application/octet-stream" />
<sparkle:minimumSystemVersion>10.13</sparkle:minimumSystemVersion>
<sparkle:minimumSystemVersion>10.11</sparkle:minimumSystemVersion>
</item>
</channel>
</rss>
+2 -2
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Sparkle"
s.version = "2.5.2"
s.version = "2.2.2"
s.summary = "A software update framework for macOS"
s.description = "Sparkle is an easy-to-use software update framework for macOS."
s.homepage = "https://sparkle-project.org"
@@ -18,7 +18,7 @@ Pod::Spec.new do |s|
'Andy Matuschak' => 'andy@andymatuschak.org',
}
s.platform = :osx, '10.13'
s.platform = :osx, '10.11'
s.source = { :http => "https://github.com/sparkle-project/Sparkle/releases/download/#{s.version}/Sparkle-#{s.version}.tar.xz" }
s.source_files = 'Sparkle.framework/Versions/B/Headers/*.h'
+45 -195
View File
@@ -85,6 +85,7 @@
61299A6009CA6EB100B7442F /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; };
61299B3609CB04E000B7442F /* Sparkle.h in Headers */ = {isa = PBXBuildFile; fileRef = 61299B3509CB04E000B7442F /* Sparkle.h */; settings = {ATTRIBUTES = (Public, ); }; };
612DCBB00D488BC60015DBEA /* SUUpdatePermissionPrompt.m in Sources */ = {isa = PBXBuildFile; fileRef = 612DCBAE0D488BC60015DBEA /* SUUpdatePermissionPrompt.m */; };
615AE3D00D64DC40001CA7BD /* SUModelTranslation.plist in Resources */ = {isa = PBXBuildFile; fileRef = 615AE3CF0D64DC40001CA7BD /* SUModelTranslation.plist */; };
6196CFF909C72148000DC222 /* SUStatusController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6196CFE309C71ADE000DC222 /* SUStatusController.h */; settings = {ATTRIBUTES = (); }; };
6196CFFA09C72149000DC222 /* SUStatusController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6196CFE409C71ADE000DC222 /* SUStatusController.m */; };
61A2259E0D1C495D00430CCD /* SUVersionComparisonProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 61A2259C0D1C495D00430CCD /* SUVersionComparisonProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -105,12 +106,6 @@
61B5FCDF09C52A9F00B25A18 /* SUUpdateAlert.h in Headers */ = {isa = PBXBuildFile; fileRef = 61B5FCA009C5228F00B25A18 /* SUUpdateAlert.h */; settings = {ATTRIBUTES = (); }; };
61EF67560E25B58D00F754E0 /* SUHost.m in Sources */ = {isa = PBXBuildFile; fileRef = 61EF67550E25B58D00F754E0 /* SUHost.m */; };
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 */; };
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, ); }; };
@@ -171,12 +166,6 @@
721D8A861D4ADFEB0032E472 /* SPULocalCacheDirectory.m in Sources */ = {isa = PBXBuildFile; fileRef = 721BC20D1D1CDE55002BC71E /* SPULocalCacheDirectory.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 */; };
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 */; };
7229E1B91C97CC4D00CB50D0 /* SPUScheduledUpdateDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 7229E1B71C97CC4D00CB50D0 /* SPUScheduledUpdateDriver.h */; };
7229E1BA1C97CC4D00CB50D0 /* SPUScheduledUpdateDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7229E1B81C97CC4D00CB50D0 /* SPUScheduledUpdateDriver.m */; };
@@ -191,14 +180,13 @@
723ABD6C259A9CBC00BDB4FA /* SUUpdatePermissionPrompt.xib in Resources */ = {isa = PBXBuildFile; fileRef = 723ABD6A259A9CBB00BDB4FA /* SUUpdatePermissionPrompt.xib */; };
723ABDDB259A9E8600BDB4FA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 723ABDD9259A9E8600BDB4FA /* InfoPlist.strings */; };
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 */; };
723ABF31259D062F00BDB4FA /* SULegacyWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = 723ABF2F259D062F00BDB4FA /* SULegacyWebView.m */; };
723ABFC4259D4CB300BDB4FA /* SUWKWebView.h in Headers */ = {isa = PBXBuildFile; fileRef = 723ABFC2259D4CB300BDB4FA /* SUWKWebView.h */; };
723ABFC5259D4CB300BDB4FA /* SUWKWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = 723ABFC3259D4CB300BDB4FA /* SUWKWebView.m */; };
723AC010259DBDAA00BDB4FA /* SUReleaseNotesCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 723AC00E259DBDAA00BDB4FA /* SUReleaseNotesCommon.h */; };
723AC011259DBDAA00BDB4FA /* SUReleaseNotesCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 723AC00F259DBDAA00BDB4FA /* SUReleaseNotesCommon.m */; };
723AD12F29922B5F006BB02F /* test-dangerous-link.xml in Resources */ = {isa = PBXBuildFile; fileRef = 723AD12E29922B5F006BB02F /* test-dangerous-link.xml */; };
723AC010259DBDAA00BDB4FA /* SUWebViewCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 723AC00E259DBDAA00BDB4FA /* SUWebViewCommon.h */; };
723AC011259DBDAA00BDB4FA /* SUWebViewCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 723AC00F259DBDAA00BDB4FA /* SUWebViewCommon.m */; };
723B5DA71CF7AB0100365F95 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 723B5DA01CF7AB0100365F95 /* main.m */; };
723B5DA91CF7AB0100365F95 /* SPUDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 723B5DA31CF7AB0100365F95 /* SPUDownloader.m */; };
723B5DAA1CF7AB6A00365F95 /* 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 */; };
723EDC3F26885A8E000BCBA4 /* testappcast_channels.xml in Resources */ = {isa = PBXBuildFile; fileRef = 723EDC3E26885A8E000BCBA4 /* testappcast_channels.xml */; };
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 */; };
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, ); }; };
@@ -223,6 +213,7 @@
724BB3AA1D3347C2005D534A /* SUInstallerStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3971D333832005D534A /* SUInstallerStatus.m */; };
724BB3B71D35ABA8005D534A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B5F8F609C4CEB300B25A18 /* Security.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 */; };
725602D61C83551C00DAA70E /* SUApplicationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 725602D41C83551C00DAA70E /* SUApplicationInfo.m */; };
725B3A82263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml in Resources */ = {isa = PBXBuildFile; fileRef = 725B3A81263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml */; };
@@ -262,6 +253,7 @@
7267E59F1D3D8A6F00D1BF90 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E59E1D3D8A6F00D1BF90 /* main.m */; };
7267E5A21D3D8A7E00D1BF90 /* AppInstaller.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5A11D3D8A7E00D1BF90 /* AppInstaller.m */; };
7267E5A81D3D8A9900D1BF90 /* AgentConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5A71D3D8A9900D1BF90 /* AgentConnection.m */; };
7267E5AB1D3D8AA800D1BF90 /* TerminationListener.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5AA1D3D8AA800D1BF90 /* TerminationListener.m */; };
7267E5AE1D3D8AB700D1BF90 /* SPUInstallationInputData.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5AD1D3D8AB700D1BF90 /* SPUInstallationInputData.m */; };
7267E5B11D3D8AD500D1BF90 /* SPUMessageTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 7267E5AF1D3D8AD500D1BF90 /* SPUMessageTypes.h */; };
7267E5B21D3D8AD500D1BF90 /* SPUMessageTypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5B01D3D8AD500D1BF90 /* SPUMessageTypes.m */; };
@@ -342,8 +334,6 @@
728337A61C9E6FF40085AA99 /* SPUProbeInstallStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = 728337A41C9E6FF40085AA99 /* SPUProbeInstallStatus.h */; };
728337A71C9E6FF40085AA99 /* SPUProbeInstallStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 728337A51C9E6FF40085AA99 /* SPUProbeInstallStatus.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 */; };
728ED34B277DA23400D9238F /* SPUSparkleDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 728ED349277DA23400D9238F /* SPUSparkleDeltaArchive.m */; };
728ED34C277DA23400D9238F /* SPUSparkleDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 728ED349277DA23400D9238F /* SPUSparkleDeltaArchive.m */; };
@@ -365,10 +355,6 @@
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 */; };
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 */; };
72B3DECA1E23472200457642 /* SPUDownloadedUpdate.m in Sources */ = {isa = PBXBuildFile; fileRef = 72B3DEC81E23472200457642 /* SPUDownloadedUpdate.m */; };
72B3DECD1E23479000457642 /* SPUInformationalUpdate.h in Headers */ = {isa = PBXBuildFile; fileRef = 72B3DECB1E23479000457642 /* SPUInformationalUpdate.h */; };
@@ -392,7 +378,6 @@
72BC6C3D275027BF0083F14B /* SparkleTestCodeSign_apfs.dmg in Resources */ = {isa = PBXBuildFile; fileRef = 72BC6C3C275027BF0083F14B /* SparkleTestCodeSign_apfs.dmg */; };
72BEBFEF1D7287570019146B /* SUSpotlightImporterTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 72BEBFEE1D7287560019146B /* SUSpotlightImporterTest.swift */; };
72CCDEBE27421FD500B53718 /* SparkleTestCodeSignApp_bad_header.zip in Resources */ = {isa = PBXBuildFile; fileRef = 72CCDEBD27421FD500B53718 /* SparkleTestCodeSignApp_bad_header.zip */; };
72D60CD928C2BAE900189AB8 /* SPUStandardUserDriver+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 72D60CD828C2BA2100189AB8 /* SPUStandardUserDriver+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
72D954811CBACC35006F28BD /* InstallerProgressAppController.m in Sources */ = {isa = PBXBuildFile; fileRef = 72D954801CBACC35006F28BD /* InstallerProgressAppController.m */; };
72D954831CBAD34F006F28BD /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 72D954821CBAD34F006F28BD /* main.m */; };
72D954A21CBB415C006F28BD /* SPUCommandLineDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 72D954A11CBB415C006F28BD /* SPUCommandLineDriver.m */; };
@@ -406,8 +391,6 @@
72E45CF81B640DAE005C701A /* SUUpdateSettingsWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 72E45CF61B640DAE005C701A /* SUUpdateSettingsWindowController.xib */; };
72E45CFC1B641961005C701A /* sparkletestcast.xml in Resources */ = {isa = PBXBuildFile; fileRef = 72E45CFB1B641961005C701A /* sparkletestcast.xml */; };
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 */; };
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 */; };
@@ -438,6 +421,8 @@
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, ); }; };
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 */; };
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, ); }; };
@@ -669,55 +654,6 @@
remoteGlobalIDString = 72B398D11D3D879300EE297F;
remoteInfo = Autoupdate;
};
72CCCC14287B3D1900E7156B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 8DC2EF4F0486A6940098B216;
remoteInfo = Sparkle;
};
72CCCC16287B3D3400E7156B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = EA1E280E22B64522004AA304;
remoteInfo = bsdiff;
};
72CCCC18287B3D3D00E7156B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = EA1E282C22B660BE004AA304;
remoteInfo = ed25519;
};
72CCCC1A287B3D9000E7156B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = EA1E282C22B660BE004AA304;
remoteInfo = ed25519;
};
72CCCC1C287B3D9600E7156B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = EA1E282C22B660BE004AA304;
remoteInfo = ed25519;
};
72CCCC1E287B3DA100E7156B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = EA1E282C22B660BE004AA304;
remoteInfo = ed25519;
};
72CCCC20287B3DA400E7156B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
proxyType = 1;
remoteGlobalIDString = EA1E280E22B64522004AA304;
remoteInfo = bsdiff;
};
72D954B91CBB6E27006F28BD /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
@@ -938,10 +874,6 @@
149B78641B7D3A4800D7D62C /* ConfigUnitTestCoverage.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigUnitTestCoverage.xcconfig; sourceTree = "<group>"; };
1EAA4C8A2132C7BF00604473 /* ReleaseNotesColorStyle.css */ = {isa = PBXFileReference; lastKnownFileType = text.css; path = ReleaseNotesColorStyle.css; sourceTree = "<group>"; };
3772FEA813DE0B6B00F79537 /* SUVersionDisplayProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUVersionDisplayProtocol.h; sourceTree = "<group>"; };
37A5F28528E9219000891504 /* zh_HK */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_HK; path = zh_HK.lproj/Sparkle.strings; sourceTree = "<group>"; };
37A5F28628E9219000891504 /* zh_HK */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_HK; path = zh_HK.lproj/SUUpdatePermissionPrompt.strings; sourceTree = "<group>"; };
37A5F28728E9219000891504 /* zh_HK */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_HK; path = zh_HK.lproj/SUUpdateAlert.strings; sourceTree = "<group>"; };
37A5F28828E9219000891504 /* zh_HK */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = zh_HK; path = zh_HK.lproj/MainMenu.strings; sourceTree = "<group>"; };
4607BEA21948443800EF8DA4 /* nb */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nb; path = nb.lproj/Sparkle.strings; sourceTree = "<group>"; };
525A278F133D6AE900FD8D70 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
555CF29A196C52330000B31E /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/Sparkle.strings; sourceTree = "<group>"; };
@@ -984,6 +916,7 @@
612DCBAE0D488BC60015DBEA /* SUUpdatePermissionPrompt.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUpdatePermissionPrompt.m; sourceTree = "<group>"; };
613151B20FB4946A000DCD59 /* is */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = is; path = is.lproj/Sparkle.strings; sourceTree = "<group>"; };
615409C4103BBC4000125AF1 /* cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = cs; path = cs.lproj/Sparkle.strings; sourceTree = "<group>"; };
615AE3CF0D64DC40001CA7BD /* SUModelTranslation.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = SUModelTranslation.plist; sourceTree = "<group>"; };
6186554310D7484E00B1E074 /* pt-PT */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = "pt-PT"; path = "pt-PT.lproj/Sparkle.strings"; sourceTree = "<group>"; };
618915730E35937600B5E981 /* sv */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = sv; path = sv.lproj/Sparkle.strings; sourceTree = "<group>"; };
6195D4920E404AD700D41A50 /* ru */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Sparkle.strings; sourceTree = "<group>"; };
@@ -1018,9 +951,8 @@
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>"; };
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>"; };
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; };
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>"; };
@@ -1085,7 +1017,6 @@
722FB7E4260EE53F00EB571C /* SUNormalization.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SUNormalization.m; sourceTree = "<group>"; };
72316BD11E0DA8430039EFD9 /* SUUnarchiverNotifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUUnarchiverNotifier.h; path = Autoupdate/SUUnarchiverNotifier.h; sourceTree = SOURCE_ROOT; };
72316BD21E0DA8430039EFD9 /* SUUnarchiverNotifier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUUnarchiverNotifier.m; path = Autoupdate/SUUnarchiverNotifier.m; sourceTree = SOURCE_ROOT; };
7235B75E29DFC0120081FE4E /* make-xcframework.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "make-xcframework.sh"; sourceTree = "<group>"; };
723ABCD7259A9A9D00BDB4FA /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Sparkle.strings; sourceTree = "<group>"; };
723ABD37259A9BA500BDB4FA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/SUUpdateAlert.xib; sourceTree = "<group>"; };
723ABD4C259A9BB900BDB4FA /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/SUUpdateAlert.strings; sourceTree = "<group>"; };
@@ -1181,14 +1112,13 @@
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>"; };
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>"; };
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>"; };
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>"; };
723AC00F259DBDAA00BDB4FA /* SUReleaseNotesCommon.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SUReleaseNotesCommon.m; sourceTree = "<group>"; };
723AD12E29922B5F006BB02F /* test-dangerous-link.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "test-dangerous-link.xml"; sourceTree = "<group>"; };
723AC00E259DBDAA00BDB4FA /* SUWebViewCommon.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUWebViewCommon.h; sourceTree = "<group>"; };
723AC00F259DBDAA00BDB4FA /* SUWebViewCommon.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SUWebViewCommon.m; sourceTree = "<group>"; };
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; };
723B5DA21CF7AB0100365F95 /* SPUDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SPUDownloader.h; path = Downloader/SPUDownloader.h; sourceTree = SOURCE_ROOT; };
@@ -1272,6 +1202,8 @@
7267E5A41D3D8A8A00D1BF90 /* StatusInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = StatusInfo.m; path = Autoupdate/StatusInfo.m; sourceTree = SOURCE_ROOT; };
7267E5A61D3D8A9900D1BF90 /* AgentConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AgentConnection.h; path = Autoupdate/AgentConnection.h; sourceTree = SOURCE_ROOT; };
7267E5A71D3D8A9900D1BF90 /* AgentConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AgentConnection.m; path = Autoupdate/AgentConnection.m; sourceTree = SOURCE_ROOT; };
7267E5A91D3D8AA800D1BF90 /* TerminationListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TerminationListener.h; path = Autoupdate/TerminationListener.h; sourceTree = SOURCE_ROOT; };
7267E5AA1D3D8AA800D1BF90 /* TerminationListener.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TerminationListener.m; path = Autoupdate/TerminationListener.m; sourceTree = SOURCE_ROOT; };
7267E5AC1D3D8AB700D1BF90 /* SPUInstallationInputData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SPUInstallationInputData.h; path = Autoupdate/SPUInstallationInputData.h; sourceTree = SOURCE_ROOT; };
7267E5AD1D3D8AB700D1BF90 /* SPUInstallationInputData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SPUInstallationInputData.m; path = Autoupdate/SPUInstallationInputData.m; sourceTree = SOURCE_ROOT; };
7267E5AF1D3D8AD500D1BF90 /* SPUMessageTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SPUMessageTypes.h; path = Autoupdate/SPUMessageTypes.h; sourceTree = SOURCE_ROOT; };
@@ -1330,8 +1262,6 @@
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>"; };
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; };
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; };
@@ -1343,7 +1273,6 @@
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>"; };
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>"; };
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>"; };
@@ -1353,10 +1282,6 @@
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>"; };
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>"; };
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>"; };
@@ -1384,7 +1309,6 @@
72BC6C3C275027BF0083F14B /* SparkleTestCodeSign_apfs.dmg */ = {isa = PBXFileReference; lastKnownFileType = file; path = SparkleTestCodeSign_apfs.dmg; sourceTree = "<group>"; };
72BEBFEE1D7287560019146B /* SUSpotlightImporterTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SUSpotlightImporterTest.swift; sourceTree = "<group>"; };
72CCDEBD27421FD500B53718 /* SparkleTestCodeSignApp_bad_header.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = SparkleTestCodeSignApp_bad_header.zip; sourceTree = "<group>"; };
72D60CD828C2BA2100189AB8 /* SPUStandardUserDriver+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SPUStandardUserDriver+Private.h"; sourceTree = "<group>"; };
72D9547F1CBACC35006F28BD /* InstallerProgressAppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InstallerProgressAppController.h; path = Sparkle/InstallerProgress/InstallerProgressAppController.h; sourceTree = SOURCE_ROOT; };
72D954801CBACC35006F28BD /* InstallerProgressAppController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = InstallerProgressAppController.m; path = Sparkle/InstallerProgress/InstallerProgressAppController.m; sourceTree = SOURCE_ROOT; };
72D954821CBAD34F006F28BD /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Sparkle/InstallerProgress/main.m; sourceTree = SOURCE_ROOT; };
@@ -1410,8 +1334,6 @@
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>"; };
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; };
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>"; };
@@ -1587,12 +1509,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
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;
};
@@ -1722,7 +1638,6 @@
0867D69AFE84028FC02AAC07 /* Frameworks */ = {
isa = PBXGroup;
children = (
654F352629B154AE00B10EEB /* ImageIO.framework */,
725B81F92781AEA40041746F /* libcompression.tbd */,
0867D6A5FE840307C02AAC07 /* AppKit.framework */,
721BC2081D17A553002BC71E /* Carbon.framework */,
@@ -1802,6 +1717,7 @@
1420DF4F196247F900203BB0 /* Images.xcassets */,
14732BBC1960EFB500593899 /* README.markdown */,
14732BB91960EEEE00593899 /* SampleAppcast.xml */,
615AE3CF0D64DC40001CA7BD /* SUModelTranslation.plist */,
1EAA4C8A2132C7BF00604473 /* ReleaseNotesColorStyle.css */,
);
path = Resources;
@@ -1849,8 +1765,6 @@
729F7ECD27409076004592DC /* SparkleTestCodeSignApp_bad_extraneous.zip */,
72CCDEBD27421FD500B53718 /* SparkleTestCodeSignApp_bad_header.zip */,
F8761EB21ADC50EB000C9034 /* SparkleTestCodeSignApp.zip */,
72EB735E29BE981300FBCEE7 /* DevSignedApp.zip */,
72EB736029BEB36100FBCEE7 /* DevSignedAppVersion2.zip */,
14958C6C19AEBC610061B14F /* test-pubkey.pem */,
5AF6C74E1AEA46D10014A3AB /* test.pkg */,
5AD0FA7E1C73F2E2004BCEFF /* testappcast.xml */,
@@ -1864,7 +1778,6 @@
FA30773C24CBC295007BA37D /* testlocalizedreleasenotesappcast.xml */,
5A5DD41B249F0F4B0045EB3E /* test-relative-urls.xml */,
729F7EAB27366353004592DC /* test-links.xml */,
723AD12E29922B5F006BB02F /* test-dangerous-link.xml */,
5A5DD40324958AFF0045EB3E /* SUUpdateValidatorTest */,
);
path = Resources;
@@ -1885,6 +1798,8 @@
7267E5AD1D3D8AB700D1BF90 /* SPUInstallationInputData.m */,
729924921DF4A45000DBCDF5 /* SUUpdateValidator.h */,
729924931DF4A45000DBCDF5 /* SUUpdateValidator.m */,
7267E5A91D3D8AA800D1BF90 /* TerminationListener.h */,
7267E5AA1D3D8AA800D1BF90 /* TerminationListener.m */,
);
path = Autoupdate;
sourceTree = "<group>";
@@ -1994,11 +1909,12 @@
6196CFE409C71ADE000DC222 /* SUStatusController.m */,
61B5FCA009C5228F00B25A18 /* SUUpdateAlert.h */,
61B5FCA109C5228F00B25A18 /* SUUpdateAlert.m */,
723AC036259DBF1B00BDB4FA /* Release Notes Views */,
723AC036259DBF1B00BDB4FA /* Web View */,
612DCBAD0D488BC60015DBEA /* SUUpdatePermissionPrompt.h */,
612DCBAE0D488BC60015DBEA /* SUUpdatePermissionPrompt.m */,
723C8A521E2D60DB00C14942 /* SUTouchBarButtonGroup.h */,
723C8A531E2D60DB00C14942 /* SUTouchBarButtonGroup.m */,
3772FEA813DE0B6B00F79537 /* SUVersionDisplayProtocol.h */,
);
name = "User Interface";
sourceTree = "<group>";
@@ -2049,11 +1965,6 @@
727F340A2605321D00020E85 /* SULog+NSError.m */,
726F2CE31BC9C33D001971A4 /* SUOperatingSystem.h */,
726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */,
3772FEA813DE0B6B00F79537 /* SUVersionDisplayProtocol.h */,
72AEB1D229A1A74E0033883E /* SPUStandardVersionDisplay.h */,
72AEB1D329A1A74E0033883E /* SPUStandardVersionDisplay.m */,
72AEB1D629A1CB510033883E /* SPUNoUpdateFoundInfo.h */,
72AEB1D729A1CB510033883E /* SPUNoUpdateFoundInfo.m */,
);
includeInIndex = 1;
name = "Other Sources";
@@ -2194,20 +2105,18 @@
name = Internal;
sourceTree = "<group>";
};
723AC036259DBF1B00BDB4FA /* Release Notes Views */ = {
723AC036259DBF1B00BDB4FA /* Web View */ = {
isa = PBXGroup;
children = (
723ABF1A259D055E00BDB4FA /* SUReleaseNotesView.h */,
723AC00E259DBDAA00BDB4FA /* SUReleaseNotesCommon.h */,
723AC00F259DBDAA00BDB4FA /* SUReleaseNotesCommon.m */,
723ABF1A259D055E00BDB4FA /* SUWebView.h */,
723AC00E259DBDAA00BDB4FA /* SUWebViewCommon.h */,
723AC00F259DBDAA00BDB4FA /* SUWebViewCommon.m */,
723ABFC2259D4CB300BDB4FA /* SUWKWebView.h */,
723ABFC3259D4CB300BDB4FA /* SUWKWebView.m */,
723ABF2E259D062F00BDB4FA /* SULegacyWebView.h */,
723ABF2F259D062F00BDB4FA /* SULegacyWebView.m */,
7286EE5D28CEC84900163C1D /* SUPlainTextReleaseNotesView.h */,
7286EE5E28CEC84900163C1D /* SUPlainTextReleaseNotesView.m */,
);
name = "Release Notes Views";
name = "Web View";
sourceTree = "<group>";
};
724BB36D1D31D0B7005D534A /* InstallerConnection */ = {
@@ -2250,7 +2159,6 @@
7246E0A11C83B685003B4E75 /* SPUStandardUpdaterController.h */,
7246E0A21C83B685003B4E75 /* SPUStandardUpdaterController.m */,
725CB9581C7121830064365A /* SPUStandardUserDriver.h */,
72D60CD828C2BA2100189AB8 /* SPUStandardUserDriver+Private.h */,
725CB9591C7121830064365A /* SPUStandardUserDriver.m */,
726E4A361C89116000C57C6A /* SPUStandardUserDriverDelegate.h */,
722C9538286EA54A0033908A /* SPUGentleUserDriverReminders.h */,
@@ -2403,7 +2311,7 @@
EA1E284422B660ED004AA304 /* ge.h */,
);
name = ed25519;
path = "ed25519-sparkle/src";
path = ed25519/src;
sourceTree = "<group>";
};
EA1E285F22B66487004AA304 /* generate_keys */ = {
@@ -2462,7 +2370,6 @@
72F94ED61CC344A7002DEE68 /* ConfigDownloaderDebug.xcconfig */,
FA1941D10D94A70100DD942E /* ConfigFramework.xcconfig */,
FA1941CA0D94A70100DD942E /* ConfigFrameworkDebug.xcconfig */,
72A40F082956120D007C7DD5 /* ConfigFrameworkRelease.xcconfig */,
724BB37E1D31D1EA005D534A /* ConfigInstallerConnection.xcconfig */,
724BB37F1D31D1EA005D534A /* ConfigInstallerConnectionDebug.xcconfig */,
726E07C11CAF1E79001A286B /* ConfigInstallerLauncher.xcconfig */,
@@ -2491,9 +2398,8 @@
EA1E285722B6622E004AA304 /* ed25519-Release.xcconfig */,
EA1E285922B6622E004AA304 /* ed25519-Shared.xcconfig */,
14732BC91960F70A00593899 /* make-release-package.sh */,
7235B75E29DFC0120081FE4E /* make-xcframework.sh */,
14652F7919A93E5F00959E44 /* set-git-version-info.sh */,
72045CE426FEE708004F96E5 /* strip-framework.sh */,
72045CE426FEE708004F96E5 /* strip-xpc-services.sh */,
720C192827127A3800740C8E /* release-move-tag.sh */,
720B4C2325EBFAFD005A0592 /* link-tools.sh */,
146EC84E19A68CF8004A50C5 /* Sparkle.podspec */,
@@ -2514,7 +2420,6 @@
72B767E21C9CE90A00A07552 /* SPUCoreBasedUpdateDriver.h in Headers */,
72F9EC441D5E9ED8004AC8B6 /* SPUDownloadData.h in Headers */,
72EF30C12675CF38008CE987 /* SPUAppcastItemState.h in Headers */,
72AEB1D429A1A74E0033883E /* SPUStandardVersionDisplay.h in Headers */,
7229E1BD1C98EFF200CB50D0 /* SPUDownloadDriver.h in Headers */,
7267E5FD1D3DD1B700D1BF90 /* SPUResumableUpdate.h in Headers */,
7267E5B61D3D8AEE00D1BF90 /* SPUInstallationInfo.h in Headers */,
@@ -2524,7 +2429,6 @@
721BC20E1D1CDE55002BC71E /* SPULocalCacheDirectory.h in Headers */,
7267E5B11D3D8AD500D1BF90 /* SPUMessageTypes.h in Headers */,
728337A61C9E6FF40085AA99 /* SPUProbeInstallStatus.h in Headers */,
7286EE5F28CEC84900163C1D /* SUPlainTextReleaseNotesView.h in Headers */,
723C8A541E2D60DB00C14942 /* SUTouchBarButtonGroup.h in Headers */,
72B767D21C9C7B9300A07552 /* SPUProbingUpdateDriver.h in Headers */,
7229E1B91C97CC4D00CB50D0 /* SPUScheduledUpdateDriver.h in Headers */,
@@ -2532,7 +2436,6 @@
7246E0A31C83B685003B4E75 /* SPUStandardUpdaterController.h in Headers */,
725CB95A1C7121830064365A /* SPUStandardUserDriver.h in Headers */,
726E4A371C89116000C57C6A /* SPUStandardUserDriverDelegate.h in Headers */,
72D60CD928C2BAE900189AB8 /* SPUStandardUserDriver+Private.h in Headers */,
722C9539286EA68C0033908A /* SPUGentleUserDriverReminders.h in Headers */,
729F7EAF273F1840004592DC /* SPUUserAgent+Private.h in Headers */,
72EE17FC26D1CC9D00C58B19 /* SPUInstallationType.h in Headers */,
@@ -2551,7 +2454,6 @@
72F9EC3F1D5E823F004AC8B6 /* SPUUpdaterTimer.h in Headers */,
7269E494264798200088C213 /* SPUSkippedUpdate.h in Headers */,
723ABFC4259D4CB300BDB4FA /* SUWKWebView.h in Headers */,
72AEB1D829A1CB510033883E /* SPUNoUpdateFoundInfo.h in Headers */,
725CB9571C7120410064365A /* SPUUserDriver.h in Headers */,
72B767DE1C9CDB9700A07552 /* SPUUserInitiatedUpdateDriver.h in Headers */,
72F94F581CC44DE1002DEE68 /* SPUXPCServiceInfo.h in Headers */,
@@ -2565,11 +2467,11 @@
7267E5E51D3D90AA00D1BF90 /* SUFileManager.h in Headers */,
72B3DEC91E23472200457642 /* SPUDownloadedUpdate.h in Headers */,
61EF67590E25C5B400F754E0 /* SUHost.h in Headers */,
723AC010259DBDAA00BDB4FA /* SUReleaseNotesCommon.h in Headers */,
723AC010259DBDAA00BDB4FA /* SUWebViewCommon.h in Headers */,
72162B081C82C9600013C1C5 /* SULocalizations.h in Headers */,
55C14F06136EF6DB00649790 /* SULog.h in Headers */,
EA1E286E22B665F0004AA304 /* SUSignatures.h in Headers */,
723ABF1B259D055E00BDB4FA /* SUReleaseNotesView.h in Headers */,
723ABF1B259D055E00BDB4FA /* SUWebView.h in Headers */,
72B3DECD1E23479000457642 /* SPUInformationalUpdate.h in Headers */,
726F2CE51BC9C33D001971A4 /* SUOperatingSystem.h in Headers */,
61A225A40D1C4AC000430CCD /* SUStandardVersionComparator.h in Headers */,
@@ -2673,8 +2575,6 @@
buildRules = (
);
dependencies = (
72CCCC19287B3D3D00E7156B /* PBXTargetDependency */,
72CCCC17287B3D3400E7156B /* PBXTargetDependency */,
61B5F91C09C4CF7200B25A18 /* PBXTargetDependency */,
726E4A201C86C88F00C57C6A /* PBXTargetDependency */,
);
@@ -2694,8 +2594,6 @@
buildRules = (
);
dependencies = (
72CCCC21287B3DA400E7156B /* PBXTargetDependency */,
72CCCC1F287B3DA100E7156B /* PBXTargetDependency */,
);
name = generate_appcast;
packageProductDependencies = (
@@ -2818,7 +2716,6 @@
buildRules = (
);
dependencies = (
72CCCC15287B3D1900E7156B /* PBXTargetDependency */,
);
name = TestAppHelper;
productName = TestAppHelper;
@@ -2871,7 +2768,7 @@
8DC2EF520486A6940098B216 /* Resources */,
142E0E0319A6A24100E4312B /* Copy Tools */,
72045CDF26FEE51D004F96E5 /* Copy XPC Services */,
72045CE626FEE8CC004F96E5 /* Strip Framework */,
72045CE626FEE8CC004F96E5 /* Strip XPC Services */,
8DC2EF540486A6940098B216 /* Sources */,
8DC2EF560486A6940098B216 /* Frameworks */,
6131B1910DDCDE32005215F0 /* Run Script: Set Git Version Info */,
@@ -2937,7 +2834,6 @@
buildRules = (
);
dependencies = (
72CCCC1B287B3D9000E7156B /* PBXTargetDependency */,
);
name = generate_keys;
packageProductDependencies = (
@@ -2958,7 +2854,6 @@
buildRules = (
);
dependencies = (
72CCCC1D287B3D9600E7156B /* PBXTargetDependency */,
);
name = sign_update;
packageProductDependencies = (
@@ -3099,7 +2994,6 @@
Base,
hr,
fa,
zh_HK,
);
mainGroup = 0867D691FE84028FC02AAC07 /* Sparkle */;
packageReferences = (
@@ -3141,8 +3035,6 @@
files = (
725B3A82263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml in Resources */,
14958C6E19AEBC950061B14F /* signed-test-file.txt in Resources */,
723AD12F29922B5F006BB02F /* test-dangerous-link.xml in Resources */,
72EB736129BEB36100FBCEE7 /* DevSignedAppVersion2.zip in Resources */,
723EDC3F26885A8E000BCBA4 /* testappcast_channels.xml in Resources */,
720DC50427A51A6500DFF3EC /* testappcast_minimumAutoupdateVersionSkipping.xml in Resources */,
72AC6B2E1B9B218C00F62325 /* SparkleTestCodeSignApp.dmg in Resources */,
@@ -3157,7 +3049,6 @@
5A5DD40424958B000045EB3E /* SUUpdateValidatorTest in Resources */,
14958C6F19AEBC980061B14F /* test-pubkey.pem in Resources */,
5AF6C74F1AEA46D10014A3AB /* test.pkg in Resources */,
72EB735F29BE981300FBCEE7 /* DevSignedApp.zip in Resources */,
72BC6C3D275027BF0083F14B /* SparkleTestCodeSign_apfs.dmg in Resources */,
720DC50627A62CDC00DFF3EC /* testappcast_minimumAutoupdateVersionSkipping2.xml in Resources */,
5AD0FA7F1C73F2E2004BCEFF /* testappcast.xml in Resources */,
@@ -3188,6 +3079,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
725264A91D5FBD9100CD6400 /* Sparkle.strings in Resources */,
72EB87EC1CB8887E00C37F42 /* SUStatus.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -3241,6 +3133,7 @@
61AAE8280A321A7F00D8810D /* Sparkle.strings in Resources */,
1EAA4C8B2132C7BF00604473 /* ReleaseNotesColorStyle.css in Resources */,
723ABD38259A9BA500BDB4FA /* SUUpdateAlert.xib in Resources */,
615AE3D00D64DC40001CA7BD /* SUModelTranslation.plist in Resources */,
55C14BEF136EF21700649790 /* SUStatus.xib in Resources */,
723ABD6C259A9CBC00BDB4FA /* SUUpdatePermissionPrompt.xib in Resources */,
);
@@ -3265,7 +3158,7 @@
shellScript = "\"$SRCROOT/Configurations/set-git-version-info.sh\"\n";
showEnvVarsInLog = 0;
};
72045CE626FEE8CC004F96E5 /* Strip Framework */ = {
72045CE626FEE8CC004F96E5 /* Strip XPC Services */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
@@ -3275,14 +3168,14 @@
);
inputPaths = (
);
name = "Strip Framework";
name = "Strip XPC Services";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"$SRCROOT/Configurations/strip-framework.sh\"\n";
shellScript = "\"$SRCROOT/Configurations/strip-xpc-services.sh\"\n";
};
720B4C2125EBFAA5005A0592 /* Run Script: Link Tools */ = {
isa = PBXShellScriptBuildPhase;
@@ -3318,7 +3211,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"$SRCROOT/Configurations/make-xcframework.sh\"\n";
shellScript = "# Deleting old products\nrm -rd \"$BUILT_PRODUCTS_DIR/Sparkle.xcarchive\"\nrm -rd \"$BUILT_PRODUCTS_DIR/Sparkle.xcframework\"\n\nxcodebuild archive -scheme Sparkle -archivePath \"$BUILT_PRODUCTS_DIR/Sparkle.xcarchive\" BUILD_LIBRARY_FOR_DISTRIBUTION=YES SKIP_INSTALL=NO\n\nif [ $XCODE_VERSION_MAJOR -ge \"1200\" ]; then\nxcodebuild -create-xcframework -framework \"$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/Products/Library/Frameworks/Sparkle.framework\" -debug-symbols \"$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/dSYMs/Sparkle.framework.dSYM\" -output \"$BUILT_PRODUCTS_DIR/Sparkle.xcframework\"\nelse\necho \"warning: Your Xcode version does not support bundling dSYMs in XCFrameworks directly. You should copy them manually into the XCFramework.\"\necho \"note: cp '$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/dSYMs/Sparkle.framework.dSYM' '$BUILT_PRODUCTS_DIR/Sparkle.xcframework/your_architecture/dSYMs'\"\nxcodebuild -create-xcframework -framework \"$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/Products/Library/Frameworks/Sparkle.framework\" -output \"$BUILT_PRODUCTS_DIR/Sparkle.xcframework\"\nfi\n";
};
/* End PBXShellScriptBuildPhase section */
@@ -3344,12 +3237,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
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 */,
725EE483277C767A00D820CE /* SPUXarDeltaArchive.m in Sources */,
7269E4982648D3460088C213 /* SPUSkippedUpdate.m in Sources */,
@@ -3471,6 +3358,7 @@
buildActionMask = 2147483647;
files = (
724BB3731D31D0B7005D534A /* main.m in Sources */,
72F9EC341D5BF542004AC8B6 /* SUFileManager.m in Sources */,
724BB3711D31D0B7005D534A /* SUInstallerConnection.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -3480,6 +3368,7 @@
buildActionMask = 2147483647;
files = (
724BB39A1D333832005D534A /* main.m in Sources */,
72F9EC351D5BF54E004AC8B6 /* SUFileManager.m in Sources */,
724BB3981D333832005D534A /* SUInstallerStatus.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -3497,6 +3386,7 @@
buildActionMask = 2147483647;
files = (
72464F7E1E21ED8C00FB341C /* SUHost.m in Sources */,
72464F711E1F326A00FB341C /* SUOperatingSystem.m in Sources */,
726E07B41CAF08D6001A286B /* main.m in Sources */,
721D8A7B1D4963190032E472 /* SPULocalCacheDirectory.m in Sources */,
7267E5E11D3D901600D1BF90 /* SPUMessageTypes.m in Sources */,
@@ -3513,6 +3403,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
72464F721E1F327C00FB341C /* SUOperatingSystem.m in Sources */,
723B5DA71CF7AB0100365F95 /* main.m in Sources */,
72E539121D68C3FA0092CE5E /* SPUDownloadData.m in Sources */,
723B5DA91CF7AB0100365F95 /* SPUDownloader.m in Sources */,
@@ -3574,6 +3465,7 @@
7267E5881D3D89B300D1BF90 /* SUUnarchiver.m in Sources */,
72316BD31E0DA8430039EFD9 /* SUUnarchiverNotifier.m in Sources */,
729924941DF4A45000DBCDF5 /* SUUpdateValidator.m in Sources */,
7267E5AB1D3D8AA800D1BF90 /* TerminationListener.m in Sources */,
722FB7E5260EE53F00EB571C /* SUNormalization.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -3619,7 +3511,6 @@
72EF30C02675CF38008CE987 /* SPUAppcastItemStateResolver.m in Sources */,
61B5F8EE09C4CE3C00B25A18 /* SPUUpdater.m in Sources */,
720E217C1D0D00BF003A311C /* SPUUpdaterCycle.m in Sources */,
72AEB1D529A1A74E0033883E /* SPUStandardVersionDisplay.m in Sources */,
726E078E1CA891E9001A286B /* SPUUpdaterSettings.m in Sources */,
721D588F25BE59F900D23BEA /* SUPhasedUpdateGroupInfo.m in Sources */,
72F9EC401D5E823F004AC8B6 /* SPUUpdaterTimer.m in Sources */,
@@ -3644,10 +3535,8 @@
61A225A50D1C4AC000430CCD /* SUStandardVersionComparator.m in Sources */,
727F340B2605321D00020E85 /* SULog+NSError.m in Sources */,
EA1E287022B66621004AA304 /* SUSignatures.m in Sources */,
7286EE6028CEC84900163C1D /* SUPlainTextReleaseNotesView.m in Sources */,
6196CFFA09C72149000DC222 /* SUStatusController.m in Sources */,
72B3DECA1E23472200457642 /* SPUDownloadedUpdate.m in Sources */,
72AEB1D929A1CB510033883E /* SPUNoUpdateFoundInfo.m in Sources */,
61A2279D0D1CEE7600430CCD /* SUSystemProfiler.m in Sources */,
61B5FCDE09C52A9F00B25A18 /* SUUpdateAlert.m in Sources */,
612DCBB00D488BC60015DBEA /* SUUpdatePermissionPrompt.m in Sources */,
@@ -3656,7 +3545,7 @@
72F9EBE31D517E2F004AC8B6 /* SUUpdater.m in Sources */,
724BB3881D32A167005D534A /* SUXPCInstallerConnection.m in Sources */,
724BB3A91D33461B005D534A /* SUXPCInstallerStatus.m in Sources */,
723AC011259DBDAA00BDB4FA /* SUReleaseNotesCommon.m in Sources */,
723AC011259DBDAA00BDB4FA /* SUWebViewCommon.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -3837,41 +3726,6 @@
target = 72B398D11D3D879300EE297F /* Autoupdate */;
targetProxy = 72A5D5AB1D6929260009E5AC /* PBXContainerItemProxy */;
};
72CCCC15287B3D1900E7156B /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 8DC2EF4F0486A6940098B216 /* Sparkle */;
targetProxy = 72CCCC14287B3D1900E7156B /* PBXContainerItemProxy */;
};
72CCCC17287B3D3400E7156B /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = EA1E280E22B64522004AA304 /* bsdiff */;
targetProxy = 72CCCC16287B3D3400E7156B /* PBXContainerItemProxy */;
};
72CCCC19287B3D3D00E7156B /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = EA1E282C22B660BE004AA304 /* ed25519 */;
targetProxy = 72CCCC18287B3D3D00E7156B /* PBXContainerItemProxy */;
};
72CCCC1B287B3D9000E7156B /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = EA1E282C22B660BE004AA304 /* ed25519 */;
targetProxy = 72CCCC1A287B3D9000E7156B /* PBXContainerItemProxy */;
};
72CCCC1D287B3D9600E7156B /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = EA1E282C22B660BE004AA304 /* ed25519 */;
targetProxy = 72CCCC1C287B3D9600E7156B /* PBXContainerItemProxy */;
};
72CCCC1F287B3DA100E7156B /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = EA1E282C22B660BE004AA304 /* ed25519 */;
targetProxy = 72CCCC1E287B3DA100E7156B /* PBXContainerItemProxy */;
};
72CCCC21287B3DA400E7156B /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = EA1E280E22B64522004AA304 /* bsdiff */;
targetProxy = 72CCCC20287B3DA400E7156B /* PBXContainerItemProxy */;
};
72D954BA1CBB6E27006F28BD /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 721C24441CB753E6005440CB /* Installer Progress */;
@@ -3946,7 +3800,6 @@
726FD2CC25F4BE5F00123BC6 /* fa */,
F67C9B7B281410B600740813 /* hu */,
F6E11510281410D10003736C /* ar */,
37A5F28528E9219000891504 /* zh_HK */,
);
name = Sparkle.strings;
sourceTree = "<group>";
@@ -3987,7 +3840,6 @@
723ABD69259A9C6600BDB4FA /* uk */,
72E1DAB625B3E8AE0001BA6D /* hr */,
F67C9B7C281410B600740813 /* hu */,
37A5F28728E9219000891504 /* zh_HK */,
);
name = SUUpdateAlert.xib;
sourceTree = "<group>";
@@ -4026,7 +3878,6 @@
723ABD9F259A9D6000BDB4FA /* tr */,
723ABDA0259A9D6300BDB4FA /* uk */,
72E1DAB525B3E8AE0001BA6D /* hr */,
37A5F28628E9219000891504 /* zh_HK */,
);
name = SUUpdatePermissionPrompt.xib;
sourceTree = "<group>";
@@ -4076,7 +3927,6 @@
723ABE39259A9F2E00BDB4FA /* uk */,
72E1DAB725B3E8AE0001BA6D /* hr */,
726FD2CB25F4BE5F00123BC6 /* fa */,
37A5F28828E9219000891504 /* zh_HK */,
);
name = MainMenu.xib;
sourceTree = "<group>";
@@ -4164,7 +4014,7 @@
};
1DEB91AF08733DA50010E9CD /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 72A40F082956120D007C7DD5 /* ConfigFrameworkRelease.xcconfig */;
baseConfigurationReference = FA1941D10D94A70100DD942E /* ConfigFramework.xcconfig */;
buildSettings = {
};
name = Release;
@@ -1,14 +1,16 @@
{
"pins" : [
{
"identity" : "swift-argument-parser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser.git",
"state" : {
"revision" : "83b23d940471b313427da226196661856f6ba3e0",
"version" : "0.4.4"
"object": {
"pins": [
{
"package": "swift-argument-parser",
"repositoryURL": "https://github.com/apple/swift-argument-parser.git",
"state": {
"branch": null,
"revision": "83b23d940471b313427da226196661856f6ba3e0",
"version": "0.4.4"
}
}
}
],
"version" : 2
]
},
"version": 1
}
@@ -4,7 +4,7 @@
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "NO">
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
Loaded 100 of 350 files, more files were not shown because too many files have changed in this diff. Show more