mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-22 04:30:47 +00:00
Compare commits
75
Commits
2.0.0
...
2.2.0-beta.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
220c1edac1 | ||
|
|
e866f8d786 | ||
|
|
2b6664cd8a | ||
|
|
a913fe1355 | ||
|
|
24b072c661 | ||
|
|
2ddef5179e | ||
|
|
308ba94373 | ||
|
|
9a1142a5b1 | ||
|
|
4cb4974107 | ||
|
|
5343305e3f | ||
|
|
72c866f964 | ||
|
|
6808a94dbb | ||
|
|
38ed86dad0 | ||
|
|
15e8270291 | ||
|
|
d7942768b8 | ||
|
|
f126876d35 | ||
|
|
9080bebc88 | ||
|
|
bf6dc6210f | ||
|
|
04d3c13043 | ||
|
|
a33bae7bad | ||
|
|
b3d31d254e | ||
|
|
024eec0b09 | ||
|
|
9ba73525b0 | ||
|
|
7ced6efba0 | ||
|
|
fabd3e6c7b | ||
|
|
58fa11ce04 | ||
|
|
503830bf24 | ||
|
|
2bc9471ed1 | ||
|
|
339e26984e | ||
|
|
9042c8dbd9 | ||
|
|
180f8975cf | ||
|
|
d5b650bae7 | ||
|
|
94719edeb3 | ||
|
|
c33a416b53 | ||
|
|
b0116ef31b | ||
|
|
c0cf32c2b7 | ||
|
|
f250bead4b | ||
|
|
640e988a39 | ||
|
|
183a930797 | ||
|
|
2f86c4f5fe | ||
|
|
286edd1fa2 | ||
|
|
242ba4e5c4 | ||
|
|
8edc77fdb2 | ||
|
|
eb938ad15a | ||
|
|
18c751eaf9 | ||
|
|
94b48c45e7 | ||
|
|
e8fea3481a | ||
|
|
8ea4d705f5 | ||
|
|
ac2ef612bc | ||
|
|
84252a64f8 | ||
|
|
930ea303fd | ||
|
|
452472ee3e | ||
|
|
d4499956e7 | ||
|
|
91bccdf0ad | ||
|
|
89e20a490d | ||
|
|
9e45a78e6f | ||
|
|
92d8b2bee6 | ||
|
|
6bed29c481 | ||
|
|
fa9bfc1fc4 | ||
|
|
05abb2f7e4 | ||
|
|
c029b98efb | ||
|
|
c30f6fe7fb | ||
|
|
403209b818 | ||
|
|
1641371e83 | ||
|
|
1f538981c3 | ||
|
|
0a152ed02d | ||
|
|
b05c058219 | ||
|
|
3bd1b25513 | ||
|
|
41f953d77b | ||
|
|
51ee14c3d3 | ||
|
|
f6396aecfb | ||
|
|
71fc8d7b11 | ||
|
|
23fc577184 | ||
|
|
a1add127eb | ||
|
|
fc44085602 |
No files matched your search
@@ -1,11 +1,24 @@
|
||||
---
|
||||
name: Enhancements and Bug Fixes
|
||||
about: Found a bug? Want to implement a new feature?
|
||||
about: Found a bug? Want to implement a new feature? Something else?
|
||||
title: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
|
||||
If this is a question or an idea, please consider posting in Discussions first:
|
||||
https://github.com/sparkle-project/Sparkle/discussions
|
||||
|
||||
Otherwise the answer to your issue may already be 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
|
||||
|
||||
-->
|
||||
|
||||
## Summary
|
||||
|
||||
[provide general summary to the issue or enhancement and its rationale]
|
||||
@@ -16,4 +29,4 @@ assignees: ''
|
||||
|
||||
## Version
|
||||
|
||||
[please specify versions of Sparkle this is applicable to; note new pull requests must be developed and landed in 2.x development branch first and the 1.x (master) branch is feature-frozen]
|
||||
[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
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: Sparkle 2.x doesn't work in my app
|
||||
about: Problems with using the beta version of Sparkle 2
|
||||
about: Problems with integration, unexpected errors using Sparkle 2
|
||||
title: ''
|
||||
labels: '2.x'
|
||||
assignees: ''
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: Sparkle 1.x doesn't work in my app
|
||||
about: Problems with integration, unexpected errors
|
||||
about: Problems with integration, unexpected errors using Sparkle 1
|
||||
title: ''
|
||||
labels: '1.x'
|
||||
assignees: ''
|
||||
@@ -2,18 +2,12 @@
|
||||
|
||||
Fixes # (issue)
|
||||
|
||||
## Checklist:
|
||||
## Misc Checklist
|
||||
|
||||
- [ ] My change is being tested and reviewed against the Sparkle 2.x branch. New changes must be developed on the 2.x development branch first.
|
||||
- [ ] My change is being backported to master branch (Sparkle 1.x). Please create a separate pull request for 1.x, should it be backported. Note 1.x is feature frozen and is only taking bug fixes, localization updates, and critical OS adoption enhancements.
|
||||
- [ ] I have reviewed and commented my code, particularly in hard-to-understand areas.
|
||||
- [ ] 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
|
||||
|
||||
## Type of change
|
||||
|
||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||
- [ ] New feature (non-breaking change which adds functionality)
|
||||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||
- [ ] My change is or requires a documentation or localization 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
|
||||
|
||||
|
||||
@@ -10,19 +10,21 @@ jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
xcode: ['xcode12.5.1', 'xcode13.1']
|
||||
xcode: ['xcode12.5.1', 'xcode13.3.1']
|
||||
include:
|
||||
- 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
|
||||
- xcode: 'xcode13.1'
|
||||
xcode-path: '/Applications/Xcode_13.1.app/Contents/Developer'
|
||||
upload-dist: true
|
||||
run-analyzer: true
|
||||
macos: 'macos-11'
|
||||
|
||||
name: Build and Test Sparkle
|
||||
runs-on: macos-11
|
||||
runs-on: ${{ matrix.macos }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
||||
@@ -2,7 +2,7 @@ name: "Create Draft Release"
|
||||
|
||||
env:
|
||||
BUILDDIR: "build"
|
||||
DEVELOPER_DIR: "/Applications/Xcode_13.1.app/Contents/Developer"
|
||||
DEVELOPER_DIR: "/Applications/Xcode_13.3.1.app/Contents/Developer"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -29,7 +29,7 @@ concurrency:
|
||||
jobs:
|
||||
release:
|
||||
name: "Publish binaries for release"
|
||||
runs-on: macos-11
|
||||
runs-on: macos-12
|
||||
|
||||
steps:
|
||||
- name: "Checkout sources"
|
||||
@@ -90,7 +90,7 @@ jobs:
|
||||
with:
|
||||
draft: true
|
||||
prerelease: ${{ env.PRERELEASE_VERSION }}
|
||||
name: "Sparkle ${{ github.event.inputs.marketingVersion }}${{ github.event.inputs.prereleaseSuffix }}"
|
||||
name: "${{ github.event.inputs.marketingVersion }}${{ github.event.inputs.prereleaseSuffix }}"
|
||||
tag_name: "${{ github.event.inputs.marketingVersion }}${{ github.event.inputs.prereleaseSuffix }}"
|
||||
fail_on_unmatched_files: true
|
||||
token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
|
||||
#define FIRST_UPDATER_MESSAGE_TIMEOUT 7ull
|
||||
#define RETRIEVE_PROCESS_IDENTIFIER_TIMEOUT 5ull
|
||||
#define FIRST_UPDATER_MESSAGE_TIMEOUT 18ull
|
||||
#define RETRIEVE_PROCESS_IDENTIFIER_TIMEOUT 8ull
|
||||
|
||||
/**
|
||||
* Show display progress UI after a delay from starting the final part of the installation.
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// SPUDeltaArchive.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mayur Pawashe on 12/29/21.
|
||||
// Copyright © 2021 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@protocol SPUDeltaArchiveProtocol;
|
||||
@class SPUDeltaArchiveHeader;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
// Opens patch file for reading and decodes the archive header
|
||||
id<SPUDeltaArchiveProtocol> SPUDeltaArchiveReadPatchAndHeader(NSString *patchFile, SPUDeltaArchiveHeader * _Nullable __autoreleasing * _Nullable outHeader);
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,121 @@
|
||||
//
|
||||
// SPUDeltaArchive.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mayur Pawashe on 12/29/21.
|
||||
// Copyright © 2021 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SPUDeltaArchive.h"
|
||||
#import "SPUDeltaArchiveProtocol.h"
|
||||
#import "SPUSparkleDeltaArchive.h"
|
||||
#import "SPUXarDeltaArchive.h"
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
|
||||
SPUDeltaCompressionMode SPUDeltaCompressionModeDefault = (SPUDeltaCompressionMode)UINT8_MAX;
|
||||
|
||||
id<SPUDeltaArchiveProtocol> SPUDeltaArchiveReadPatchAndHeader(NSString *patchFile, SPUDeltaArchiveHeader * _Nullable __autoreleasing * _Nullable outHeader)
|
||||
{
|
||||
id<SPUDeltaArchiveProtocol> sparkleArchive = [[SPUSparkleDeltaArchive alloc] initWithPatchFileForReading:patchFile];
|
||||
|
||||
SPUDeltaArchiveHeader *header = [sparkleArchive readHeader];
|
||||
if (header == nil) {
|
||||
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
|
||||
[sparkleArchive close];
|
||||
|
||||
id<SPUDeltaArchiveProtocol> xarArchive = [[SPUXarDeltaArchive alloc] initWithPatchFileForReading:patchFile];
|
||||
|
||||
SPUDeltaArchiveHeader *xarHeader = [xarArchive readHeader];
|
||||
if (outHeader != NULL) {
|
||||
*outHeader = xarHeader;
|
||||
}
|
||||
return xarArchive;
|
||||
} else {
|
||||
if (outHeader != NULL) {
|
||||
*outHeader = nil;
|
||||
}
|
||||
return sparkleArchive;
|
||||
}
|
||||
} else {
|
||||
if (outHeader != NULL) {
|
||||
*outHeader = header;
|
||||
}
|
||||
return sparkleArchive;
|
||||
}
|
||||
}
|
||||
|
||||
@implementation SPUDeltaArchiveItem
|
||||
|
||||
@synthesize relativeFilePath = _relativeFilePath;
|
||||
@synthesize itemFilePath = _itemFilePath;
|
||||
@synthesize clonedRelativePath = _clonedRelativePath;
|
||||
@synthesize sourcePath = _sourcePath;
|
||||
@synthesize commands = _commands;
|
||||
@synthesize xarContext = _xarContext;
|
||||
@synthesize mode = _mode;
|
||||
@synthesize codedDataLength = _codedDataLength;
|
||||
|
||||
- (instancetype)initWithRelativeFilePath:(NSString *)relativeFilePath commands:(SPUDeltaItemCommands)commands mode:(uint16_t)mode
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_relativeFilePath = [relativeFilePath copy];
|
||||
_commands = commands;
|
||||
_mode = mode;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation SPUDeltaArchiveHeader
|
||||
{
|
||||
unsigned char _beforeTreeHash[CC_SHA1_DIGEST_LENGTH];
|
||||
unsigned char _afterTreeHash[CC_SHA1_DIGEST_LENGTH];
|
||||
}
|
||||
|
||||
@synthesize compression = _compression;
|
||||
@synthesize compressionLevel = _compressionLevel;
|
||||
@synthesize fileSystemCompression = _fileSystemCompression;
|
||||
@synthesize majorVersion = _majorVersion;
|
||||
@synthesize minorVersion = _minorVersion;
|
||||
|
||||
- (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
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil)
|
||||
{
|
||||
_compression = compression;
|
||||
_compressionLevel = compressionLevel;
|
||||
_fileSystemCompression = fileSystemCompression;
|
||||
|
||||
_majorVersion = majorVersion;
|
||||
_minorVersion = minorVersion;
|
||||
|
||||
memcpy(_beforeTreeHash, beforeTreeHash, sizeof(_beforeTreeHash));
|
||||
memcpy(_afterTreeHash, afterTreeHash, sizeof(_afterTreeHash));
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
|
||||
|
||||
- (unsigned char *)beforeTreeHash
|
||||
{
|
||||
return _beforeTreeHash;
|
||||
}
|
||||
|
||||
- (unsigned char *)afterTreeHash
|
||||
{
|
||||
return _afterTreeHash;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,110 @@
|
||||
//
|
||||
// SPUDeltaArchiveProtocol.h
|
||||
// Autoupdate
|
||||
//
|
||||
// Created by Mayur Pawashe on 12/28/21.
|
||||
// Copyright © 2021 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SPUDeltaCompressionMode.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
// Attributes for an item we extract/write to the archive
|
||||
|
||||
// Note: BinaryDiff cannot coexist together with Delete
|
||||
typedef NS_ENUM(uint8_t, SPUDeltaItemCommands) {
|
||||
SPUDeltaItemCommandEndMarker = 0,
|
||||
SPUDeltaItemCommandDelete = (1u << 0),
|
||||
SPUDeltaItemCommandExtract = (1u << 1),
|
||||
SPUDeltaItemCommandModifyPermissions = (1u << 2),
|
||||
SPUDeltaItemCommandBinaryDiff = (1u << 3),
|
||||
SPUDeltaItemCommandClone = (1u << 4),
|
||||
};
|
||||
|
||||
// Represents header for our archive
|
||||
@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;
|
||||
|
||||
@property (nonatomic, readonly) SPUDeltaCompressionMode compression;
|
||||
@property (nonatomic, readonly) uint8_t compressionLevel;
|
||||
@property (nonatomic, readonly) bool fileSystemCompression;
|
||||
@property (nonatomic, readonly) uint16_t majorVersion;
|
||||
@property (nonatomic, readonly) uint16_t minorVersion;
|
||||
@property (nonatomic, readonly) unsigned char *beforeTreeHash;
|
||||
@property (nonatomic, readonly) unsigned char *afterTreeHash;
|
||||
|
||||
@end
|
||||
|
||||
// Represents an item we read or write to in our delta archive
|
||||
@interface SPUDeltaArchiveItem : NSObject
|
||||
|
||||
- (instancetype)initWithRelativeFilePath:(NSString *)relativeFilePath commands:(SPUDeltaItemCommands)commands mode:(uint16_t)mode;
|
||||
|
||||
// The relative file path of the item, eg /Contents/MacOS/Foo
|
||||
@property (nonatomic, readonly) NSString *relativeFilePath;
|
||||
// For extraction, the path where the item will be extracted. For creation, the path to the item to add to the archive.
|
||||
@property (nonatomic, nullable) NSString *itemFilePath;
|
||||
// The relative file path of the originating item for clones. This may be null.
|
||||
// For example, if /Contents/Resources/hello/foo.txt moves to /Contents/Resources/hello2/foo.txt, the former is the relative path
|
||||
@property (nonatomic, nullable) NSString *clonedRelativePath;
|
||||
// The source path of the item to extract file metadata from such as file size.
|
||||
@property (nonatomic, nullable) NSString *sourcePath;
|
||||
// The commands that describe the actions to take for this item.
|
||||
@property (nonatomic, readonly) SPUDeltaItemCommands commands;
|
||||
// Provided change in permissions for item or tracking file mode for the item
|
||||
@property (nonatomic) uint16_t mode;
|
||||
|
||||
// Private properties
|
||||
// xar_file context for Xar delta archiver
|
||||
@property (nonatomic, nullable) const void *xarContext;
|
||||
// Tracking length of item's data in data section, when encoding items and when extracting items
|
||||
@property (nonatomic) uint64_t codedDataLength;
|
||||
|
||||
@end
|
||||
|
||||
// A protocol for reading and writing binary delta patches
|
||||
// Operations must be done in order. The header must first be read or written before any other operations.
|
||||
// For reading, file items cannot be extracted out of order.
|
||||
@protocol SPUDeltaArchiveProtocol <NSObject>
|
||||
|
||||
@property (nonatomic, readonly, class) BOOL maySupportSafeExtraction;
|
||||
|
||||
// If non-nil, there was an error with reading or writing data from the archive
|
||||
@property (nonatomic, readonly, nullable) NSError *error;
|
||||
|
||||
// Closes file for reading/writing, called in -dealloc if it's not called manually
|
||||
- (void)close;
|
||||
|
||||
// For reading
|
||||
|
||||
// Retrieves metadata for the archive including major/minor version and expected bundle hashes
|
||||
- (nullable SPUDeltaArchiveHeader *)readHeader;
|
||||
|
||||
// Enumerate through items in the patch file and read the path, attributes, permissions (if permission attribute is available), and way to stop enumeration
|
||||
- (void)enumerateItems:(void (^)(SPUDeltaArchiveItem *item, BOOL *stop))itemHandler;
|
||||
|
||||
// Extract a file item from the patch file to a destination file
|
||||
// The item's physical file path must be set as a destination
|
||||
- (BOOL)extractItem:(SPUDeltaArchiveItem *)item;
|
||||
|
||||
// ------------
|
||||
|
||||
// For writing
|
||||
|
||||
// Set metadata for archive including major/minor version and expected bundle hashes
|
||||
- (void)writeHeader:(SPUDeltaArchiveHeader *)header;
|
||||
|
||||
// Add item to patch file
|
||||
// Physical file path must be provided if there is an extract or binary delta attribute
|
||||
// Permissions are used only if there is a modify permissions attribute
|
||||
- (void)addItem:(SPUDeltaArchiveItem *)item;
|
||||
|
||||
// Finishes encoding items after having added all of them
|
||||
- (void)finishEncodingItems;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// SPUDeltaCompressionMode.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mayur Pawashe on 1/3/22.
|
||||
// Copyright © 2022 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
// Compression mode to use during patch creation
|
||||
typedef NS_ENUM(uint8_t, SPUDeltaCompressionMode) {
|
||||
SPUDeltaCompressionModeNone = 0,
|
||||
SPUDeltaCompressionModeBzip2,
|
||||
SPUDeltaCompressionModeLZMA,
|
||||
SPUDeltaCompressionModeLZFSE,
|
||||
SPUDeltaCompressionModeLZ4,
|
||||
SPUDeltaCompressionModeZLIB
|
||||
};
|
||||
|
||||
// For Swift access
|
||||
extern SPUDeltaCompressionMode SPUDeltaCompressionModeDefault;
|
||||
@@ -0,0 +1,107 @@
|
||||
//
|
||||
// SPUSparkleDeltaArchive.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mayur Pawashe on 12/30/21.
|
||||
// Copyright © 2021 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "SPUDeltaArchiveProtocol.h"
|
||||
#import "SPUDeltaCompressionMode.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
#define SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN @"Sparkle Delta Archive"
|
||||
#define SPARKLE_DELTA_ARCHIVE_ERROR_CODE_BAD_MAGIC 1
|
||||
#define SPARKLE_DELTA_ARCHIVE_ERROR_CODE_BAD_COMPRESSION_VALUE 2
|
||||
#define SPARKLE_DELTA_ARCHIVE_ERROR_CODE_BAD_CHUNK_SIZE 3
|
||||
#define SPARKLE_DELTA_ARCHIVE_ERROR_CODE_BAD_CLONE_LOOKUP 4
|
||||
#define SPARKLE_DELTA_ARCHIVE_ERROR_CODE_TOO_MANY_FILES 5
|
||||
#define SPARKLE_DELTA_ARCHIVE_ERROR_CODE_LINK_TOO_LONG 6
|
||||
|
||||
/*
|
||||
Modern container format for binary delta archives.
|
||||
|
||||
Delta archive format has four sections which are the header, the relative file path table, the commands, and the data blobs.
|
||||
|
||||
The relative file path table records all the file paths the archive needs to know about.
|
||||
The commands are the operations to be recorded (eg: extract, clone, binary diff, delete).
|
||||
The commands may additionally have more metadata such as file permission modes, relative path indexes in the case of clones, or file sizes for the data blobs.
|
||||
The data blobs contain all file data from extract and binary diff outputs.
|
||||
|
||||
The implementation design of this archive is such that we do not seek backwards or skip ahead to fetch data.
|
||||
We go through the archive when writing or reading from it in a single pass.
|
||||
|
||||
-- UNCOMPRESSED --
|
||||
|
||||
[ HEADER (part 1) ]
|
||||
magic (length: 4)
|
||||
compression (length: 1)
|
||||
metadata (See format below. length: 1)
|
||||
|
||||
-- METADATA --
|
||||
compressionLevel (bits [0, 4])
|
||||
(bits [5, 6] reserved)
|
||||
fileSystemCompression (bit 7)
|
||||
|
||||
-- COMPRESSED --
|
||||
|
||||
[ HEADER (part 2)]
|
||||
majorVersion (length: 2)
|
||||
minorVersion (length: 2)
|
||||
beforeTreeHash (length: 40)
|
||||
afterTreeHash (length: 40)
|
||||
|
||||
[ RELATIVE_FILE_PATH_TABLE ]
|
||||
sizeOfRelativeFilePathTable (length: 8 bytes)
|
||||
List of null terminated path strings joined together (N paths)
|
||||
|
||||
[ COMMANDS ]
|
||||
[ Command ]
|
||||
Set of command types for entry (length: 1 byte)
|
||||
Additional metadata for command (see below section)
|
||||
(M commands where M <= N paths)
|
||||
(Indexes for commands refer to indexes to relative file path table, excluding extraneous trailing entries in relative path table used for clones)
|
||||
(Last command must be a ZERO COMMAND (a null terminating command))
|
||||
|
||||
[COMMAND METADATA]
|
||||
[COMMAND: DELETE]
|
||||
N/A: no additional data
|
||||
|
||||
[COMMAND: MODIFY_PERMISSIONS]
|
||||
fileMode (length: 2)
|
||||
|
||||
[COMMAND: CLONE_FILE]
|
||||
sourceRelativePathIndex (length: 4)
|
||||
|
||||
[COMMAND: EXTRACT_FILE]
|
||||
dataLength (length: 8 for regular files, 2 for symbolic links, 0 for directories)
|
||||
|
||||
[COMMAND: BINARY_DIFF_FILE]
|
||||
dataLength (length: 8)
|
||||
|
||||
Note: These command types may be OR'd or combined. In those cases, different commands
|
||||
that have the same attribute (eg dataLength) are not repeated. This list of metadata is also
|
||||
in order in what will be encoded/decoded first.
|
||||
|
||||
EXTRACT_FILE and BINARY_DIFF_FILE cannot be combined.
|
||||
CLONE_FILE and EXTRACT_FILE cannot be combined.
|
||||
MODIFY_PERMISSIONS can be combined with either CLONE_FILE, EXTRACT_FILE, BINARY_DIFF_FILE, or just by itself.
|
||||
CLONE_FILE can be combined with BINARY_DIFF_FILE or just by itself.
|
||||
DELETE can be combined with EXTRACT_FILE, or just by itself. It is only combined with EXTRACT_FILE when the file type (regular, directory, or symlink) changes.
|
||||
|
||||
[ DATA_BLOBS ]
|
||||
All raw binary data joined together
|
||||
(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)
|
||||
*/
|
||||
@interface SPUSparkleDeltaArchive : NSObject <SPUDeltaArchiveProtocol>
|
||||
|
||||
- (instancetype)initWithPatchFileForWriting:(NSString *)patchFile;
|
||||
- (instancetype)initWithPatchFileForReading:(NSString *)patchFile;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// SPUXarDeltaArchive.h
|
||||
// Autoupdate
|
||||
//
|
||||
// Created by Mayur Pawashe on 12/28/21.
|
||||
// Copyright © 2021 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "SPUDeltaArchiveProtocol.h"
|
||||
#import "SPUDeltaCompressionMode.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
// Legacy container format for binary delta archives
|
||||
@interface SPUXarDeltaArchive : NSObject <SPUDeltaArchiveProtocol>
|
||||
|
||||
- (instancetype)initWithPatchFileForWriting:(NSString *)patchFile;
|
||||
- (instancetype)initWithPatchFileForReading:(NSString *)patchFile;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,412 @@
|
||||
//
|
||||
// SPUXarDeltaArchive.m
|
||||
// Autoupdate
|
||||
//
|
||||
// Created by Mayur Pawashe on 12/28/21.
|
||||
// Copyright © 2021 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SPUXarDeltaArchive.h"
|
||||
#include <xar/xar.h>
|
||||
#include "SUBinaryDeltaCommon.h"
|
||||
#import <Availability.h>
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 120000
|
||||
#define HAS_XAR_GET_SAFE_PATH 1
|
||||
#else
|
||||
#define HAS_XAR_GET_SAFE_PATH 0
|
||||
#endif
|
||||
|
||||
#if HAS_XAR_GET_SAFE_PATH
|
||||
// This is preferred over xar_get_path (which is deprecated) when it's available
|
||||
// Don't use OS availability for this API
|
||||
extern char *xar_get_safe_path(xar_file_t f) __attribute__((weak_import));
|
||||
#endif
|
||||
|
||||
// Xar attribute keys
|
||||
#define BINARY_DELTA_ATTRIBUTES_KEY "binary-delta-attributes"
|
||||
#define MAJOR_DIFF_VERSION_KEY "major-version"
|
||||
#define MINOR_DIFF_VERSION_KEY "minor-version"
|
||||
#define BEFORE_TREE_SHA1_KEY "before-tree-sha1"
|
||||
#define AFTER_TREE_SHA1_KEY "after-tree-sha1"
|
||||
#define DELETE_KEY "delete"
|
||||
#define EXTRACT_KEY "extract"
|
||||
#define BINARY_DELTA_KEY "binary-delta"
|
||||
#define MODIFY_PERMISSIONS_KEY "mod-permissions"
|
||||
|
||||
// Errors
|
||||
#define SPARKLE_DELTA_XAR_ARCHIVE_ERROR_DOMAIN @"Sparkle XAR Archive"
|
||||
#define SPARKLE_DELTA_XAR_ARCHIVE_ERROR_CODE_OPEN_FAILURE 1
|
||||
#define SPARKLE_DELTA_XAR_ARCHIVE_ERROR_CODE_ADD_FAILURE 2
|
||||
#define SPARKLE_DELTA_XAR_ARCHIVE_ERROR_CODE_EXTRACT_FAILURE 3
|
||||
#define SPARKLE_DELTA_XAR_ARCHIVE_ERROR_CODE_UNSUPPORTED_COMPRESSION_FAILURE 4
|
||||
|
||||
@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
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_patchFile = [patchFile copy];
|
||||
_xarMode = WRITE;
|
||||
_fileTable = [NSMutableDictionary dictionary];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithPatchFileForReading:(NSString *)patchFile
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_patchFile = [patchFile copy];
|
||||
_xarMode = READ;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[self close];
|
||||
}
|
||||
|
||||
- (void)close
|
||||
{
|
||||
if (self.x != NULL) {
|
||||
xar_close(self.x);
|
||||
self.x = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// This indicates if safe extraction is available at compile time (SDK), but not if it's available at runtime.
|
||||
+ (BOOL)maySupportSafeExtraction
|
||||
{
|
||||
return HAS_XAR_GET_SAFE_PATH;
|
||||
}
|
||||
|
||||
- (nullable SPUDeltaArchiveHeader *)readHeader
|
||||
{
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
|
||||
self.x = x;
|
||||
|
||||
uint16_t majorDiffVersion = SUBinaryDeltaMajorVersionFirst;
|
||||
uint16_t minorDiffVersion = 0;
|
||||
NSString *expectedBeforeHash = nil;
|
||||
NSString *expectedAfterHash = nil;
|
||||
|
||||
xar_subdoc_t 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
|
||||
const char *value = NULL;
|
||||
xar_subdoc_prop_get(subdoc, MAJOR_DIFF_VERSION_KEY, &value);
|
||||
if (value != NULL) {
|
||||
majorDiffVersion = (uint16_t)[@(value) intValue];
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
// available in version 2.0 or later
|
||||
const char *value = NULL;
|
||||
xar_subdoc_prop_get(subdoc, MINOR_DIFF_VERSION_KEY, &value);
|
||||
if (value != NULL) {
|
||||
minorDiffVersion = (uint16_t)[@(value) intValue];
|
||||
}
|
||||
}
|
||||
|
||||
// available in version 2.0 or later
|
||||
{
|
||||
const char *value = NULL;
|
||||
xar_subdoc_prop_get(subdoc, BEFORE_TREE_SHA1_KEY, &value);
|
||||
if (value != NULL) {
|
||||
expectedBeforeHash = @(value);
|
||||
}
|
||||
}
|
||||
|
||||
// available in version 2.0 or later
|
||||
{
|
||||
const char *value = NULL;
|
||||
xar_subdoc_prop_get(subdoc, AFTER_TREE_SHA1_KEY, &value);
|
||||
if (value != NULL) {
|
||||
expectedAfterHash = @(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char rawExpectedBeforeHash[CC_SHA1_DIGEST_LENGTH] = {0};
|
||||
getRawHashFromDisplayHash(rawExpectedBeforeHash, expectedBeforeHash);
|
||||
|
||||
unsigned char rawExpectedAfterHash[CC_SHA1_DIGEST_LENGTH] = {0};
|
||||
getRawHashFromDisplayHash(rawExpectedAfterHash, expectedAfterHash);
|
||||
|
||||
// I wasn't able to figure out how to retrieve the compression options from xar,
|
||||
// so we will use default flags to indicate the info isn't available
|
||||
return [[SPUDeltaArchiveHeader alloc] initWithCompression:SPUDeltaCompressionModeDefault compressionLevel:0 fileSystemCompression:false majorVersion:majorDiffVersion minorVersion:minorDiffVersion beforeTreeHash:rawExpectedBeforeHash afterTreeHash:rawExpectedAfterHash];
|
||||
}
|
||||
|
||||
- (void)writeHeader:(SPUDeltaArchiveHeader *)header
|
||||
{
|
||||
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, WRITE);
|
||||
#pragma clang diagnostic pop
|
||||
if (x == NULL) {
|
||||
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;
|
||||
}
|
||||
|
||||
self.x = x;
|
||||
|
||||
SPUDeltaCompressionMode compression = (header.compression == SPUDeltaCompressionModeDefault ? SPUDeltaCompressionModeBzip2 : header.compression);
|
||||
|
||||
uint8_t compressionLevel;
|
||||
// Only 1 - 9 are valid, 0 is special case to use default level 9
|
||||
if (header.compressionLevel <= 0 || header.compressionLevel > 9) {
|
||||
compressionLevel = 9;
|
||||
} else {
|
||||
compressionLevel = header.compressionLevel;
|
||||
}
|
||||
|
||||
switch (compression) {
|
||||
case SPUDeltaCompressionModeNone:
|
||||
xar_opt_set(x, XAR_OPT_COMPRESSION, XAR_OPT_VAL_NONE);
|
||||
break;
|
||||
case SPUDeltaCompressionModeBzip2: {
|
||||
xar_opt_set(x, XAR_OPT_COMPRESSION, "bzip2");
|
||||
|
||||
char buffer[256] = {0};
|
||||
snprintf(buffer, sizeof(buffer) - 1, "%d", compressionLevel);
|
||||
xar_opt_set(x, XAR_OPT_COMPRESSIONARG, buffer);
|
||||
|
||||
break;
|
||||
}
|
||||
case SPUDeltaCompressionModeLZMA:
|
||||
case SPUDeltaCompressionModeLZFSE:
|
||||
case SPUDeltaCompressionModeLZ4:
|
||||
case SPUDeltaCompressionModeZLIB: {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
xar_subdoc_t attributes = xar_subdoc_new(x, BINARY_DELTA_ATTRIBUTES_KEY);
|
||||
|
||||
xar_subdoc_prop_set(attributes, MAJOR_DIFF_VERSION_KEY, [[NSString stringWithFormat:@"%u", header.majorVersion] UTF8String]);
|
||||
xar_subdoc_prop_set(attributes, MINOR_DIFF_VERSION_KEY, [[NSString stringWithFormat:@"%u", header.minorVersion] UTF8String]);
|
||||
|
||||
xar_subdoc_prop_set(attributes, BEFORE_TREE_SHA1_KEY, [displayHashFromRawHash(header.beforeTreeHash) UTF8String]);
|
||||
xar_subdoc_prop_set(attributes, AFTER_TREE_SHA1_KEY, [displayHashFromRawHash(header.afterTreeHash) UTF8String]);
|
||||
}
|
||||
|
||||
static xar_file_t _xarAddFile(NSMutableDictionary<NSString *, NSValue *> *fileTable, xar_t x, NSString *relativePath, NSString *filePath)
|
||||
{
|
||||
NSArray<NSString *> *rootRelativePathComponents = relativePath.pathComponents;
|
||||
// Relative path must at least have starting "/" component and one more path component
|
||||
if (rootRelativePathComponents.count < 2) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NSArray<NSString *> *relativePathComponents = [rootRelativePathComponents subarrayWithRange:NSMakeRange(1, rootRelativePathComponents.count - 1)];
|
||||
|
||||
NSUInteger relativePathComponentsCount = relativePathComponents.count;
|
||||
|
||||
// Build parent files as needed until we get to our final file we want to add
|
||||
// So if we get "Contents/Resources/foo.txt", we will first add "Contents" parent,
|
||||
// then "Resources" parent, then "foo.txt" as the final entry we want to add
|
||||
// We store every file we add into a fileTable for easy referencing
|
||||
// Note if a diff has Contents/Resources/foo/ and Contents/Resources/foo/bar.txt,
|
||||
// due to sorting order we will add the foo directory first and won't end up with
|
||||
// mis-ordering bugs
|
||||
xar_file_t lastParent = NULL;
|
||||
for (NSUInteger componentIndex = 0; componentIndex < relativePathComponentsCount; componentIndex++) {
|
||||
NSArray<NSString *> *subpathComponents = [relativePathComponents subarrayWithRange:NSMakeRange(0, componentIndex + 1)];
|
||||
NSString *subpathKey = [subpathComponents componentsJoinedByString:@"/"];
|
||||
|
||||
xar_file_t cachedFile = [fileTable[subpathKey] pointerValue];
|
||||
if (cachedFile != NULL) {
|
||||
lastParent = cachedFile;
|
||||
} else {
|
||||
xar_file_t newParent;
|
||||
|
||||
BOOL atLastIndex = (componentIndex == relativePathComponentsCount - 1);
|
||||
|
||||
NSString *lastPathComponent = subpathComponents.lastObject;
|
||||
if (atLastIndex && filePath != nil) {
|
||||
newParent = xar_add_frompath(x, lastParent, lastPathComponent.fileSystemRepresentation, filePath.fileSystemRepresentation);
|
||||
} else {
|
||||
newParent = xar_add_frombuffer(x, lastParent, lastPathComponent.fileSystemRepresentation, "", 1);
|
||||
}
|
||||
|
||||
lastParent = newParent;
|
||||
fileTable[subpathKey] = [NSValue valueWithPointer:newParent];
|
||||
}
|
||||
}
|
||||
return lastParent;
|
||||
}
|
||||
|
||||
- (void)addItem:(SPUDeltaArchiveItem *)item
|
||||
{
|
||||
if (self.error != nil) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *relativeFilePath = item.relativeFilePath;
|
||||
NSString *filePath = item.itemFilePath;
|
||||
SPUDeltaItemCommands commands = item.commands;
|
||||
uint16_t mode = item.mode;
|
||||
|
||||
xar_file_t newFile = _xarAddFile(self.fileTable, self.x, relativeFilePath, filePath);
|
||||
if (newFile == NULL) {
|
||||
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;
|
||||
}
|
||||
|
||||
if ((commands & SPUDeltaItemCommandDelete) != 0) {
|
||||
xar_prop_set(newFile, DELETE_KEY, "true");
|
||||
}
|
||||
|
||||
if ((commands & SPUDeltaItemCommandExtract) != 0) {
|
||||
xar_prop_set(newFile, EXTRACT_KEY, "true");
|
||||
}
|
||||
|
||||
if ((commands & SPUDeltaItemCommandBinaryDiff) != 0) {
|
||||
xar_prop_set(newFile, BINARY_DELTA_KEY, "true");
|
||||
}
|
||||
|
||||
if ((commands & SPUDeltaItemCommandModifyPermissions) != 0) {
|
||||
xar_prop_set(newFile, MODIFY_PERMISSIONS_KEY, [NSString stringWithFormat:@"%u", mode].UTF8String);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)finishEncodingItems
|
||||
{
|
||||
// Items are already encoded when they are extracted prior
|
||||
}
|
||||
|
||||
- (void)enumerateItems:(void (^)(SPUDeltaArchiveItem *, BOOL *))itemHandler
|
||||
{
|
||||
if (self.error != nil) {
|
||||
return;
|
||||
}
|
||||
|
||||
BOOL exitedEarly = NO;
|
||||
xar_iter_t iter = xar_iter_new();
|
||||
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
|
||||
#pragma clang diagnostic ignored "-Wunguarded-availability-new"
|
||||
if (xar_get_safe_path != NULL) {
|
||||
pathCString = xar_get_safe_path(file);
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
pathCString = xar_get_path(file);
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
if (pathCString == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSString *relativePath = @(pathCString);
|
||||
|
||||
SPUDeltaItemCommands commands = 0;
|
||||
{
|
||||
const char *value = NULL;
|
||||
if (xar_prop_get(file, DELETE_KEY, &value) == 0) {
|
||||
commands |= SPUDeltaItemCommandDelete;
|
||||
}
|
||||
}
|
||||
{
|
||||
const char *value = NULL;
|
||||
if (xar_prop_get(file, BINARY_DELTA_KEY, &value) == 0) {
|
||||
commands |= SPUDeltaItemCommandBinaryDiff;
|
||||
}
|
||||
}
|
||||
{
|
||||
const char *value = NULL;
|
||||
if (xar_prop_get(file, EXTRACT_KEY, &value) == 0) {
|
||||
commands |= SPUDeltaItemCommandExtract;
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t mode = 0;
|
||||
{
|
||||
const char *value = NULL;
|
||||
if (xar_prop_get(file, MODIFY_PERMISSIONS_KEY, &value) == 0) {
|
||||
commands |= SPUDeltaItemCommandModifyPermissions;
|
||||
mode = (uint16_t)[@(value) intValue];
|
||||
}
|
||||
}
|
||||
|
||||
SPUDeltaArchiveItem *item = [[SPUDeltaArchiveItem alloc] initWithRelativeFilePath:relativePath commands:commands mode:mode];
|
||||
item.xarContext = file;
|
||||
|
||||
itemHandler(item, &exitedEarly);
|
||||
if (exitedEarly) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
xar_iter_free(iter);
|
||||
}
|
||||
|
||||
- (BOOL)extractItem:(SPUDeltaArchiveItem *)item
|
||||
{
|
||||
if (self.error != nil) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
assert(item.itemFilePath != nil);
|
||||
assert(item.xarContext != NULL);
|
||||
|
||||
xar_file_t file = item.xarContext;
|
||||
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;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
+284
-194
@@ -8,137 +8,77 @@
|
||||
|
||||
#import "SUBinaryDeltaApply.h"
|
||||
#import "SUBinaryDeltaCommon.h"
|
||||
#include <CommonCrypto/CommonDigest.h>
|
||||
#import "SPUDeltaArchiveProtocol.h"
|
||||
#import "SPUDeltaArchive.h"
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
#include "bspatch.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <xar/xar.h>
|
||||
#include <Availability.h>
|
||||
#import <sys/stat.h>
|
||||
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 120000
|
||||
#define HAS_XAR_GET_SAFE_PATH 1
|
||||
#else
|
||||
#define HAS_XAR_GET_SAFE_PATH 0
|
||||
#endif
|
||||
|
||||
#if HAS_XAR_GET_SAFE_PATH
|
||||
// This is preferred over xar_get_path (which is deprecated) when it's available
|
||||
// Don't use OS availability for this API
|
||||
extern char *xar_get_safe_path(xar_file_t f) __attribute__((weak_import));
|
||||
#endif
|
||||
|
||||
static BOOL applyBinaryDeltaToFile(xar_t x, xar_file_t file, NSString *sourceFilePath, NSString *destinationFilePath)
|
||||
static BOOL applyBinaryDeltaToFile(NSString *patchFile, NSString *sourceFilePath, NSString *destinationFilePath)
|
||||
{
|
||||
NSString *patchFile = temporaryFilename(@"apply-binary-delta");
|
||||
xar_extract_tofile(x, file, [patchFile fileSystemRepresentation]);
|
||||
const char *argv[] = {"/usr/bin/bspatch", [sourceFilePath fileSystemRepresentation], [destinationFilePath fileSystemRepresentation], [patchFile fileSystemRepresentation]};
|
||||
BOOL success = (bspatch(4, argv) == 0);
|
||||
unlink([patchFile fileSystemRepresentation]);
|
||||
return success;
|
||||
}
|
||||
|
||||
BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFile, BOOL verbose, void (^progressCallback)(double progress), NSError *__autoreleasing *error)
|
||||
BOOL applyBinaryDelta(NSString *source, NSString *finalDestination, NSString *patchFile, BOOL verbose, void (^progressCallback)(double progress), NSError *__autoreleasing *error)
|
||||
{
|
||||
xar_t x = xar_open([patchFile fileSystemRepresentation], READ);
|
||||
if (!x) {
|
||||
SPUDeltaArchiveHeader *header = nil;
|
||||
id<SPUDeltaArchiveProtocol> archive = SPUDeltaArchiveReadPatchAndHeader(patchFile, &header);
|
||||
if (archive.error != nil) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Unable to open %@. Giving up.", patchFile] }];
|
||||
*error = archive.error;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
SUBinaryDeltaMajorVersion majorDiffVersion = FIRST_DELTA_DIFF_MAJOR_VERSION;
|
||||
int minorDiffVersion = 0;
|
||||
progressCallback(0/7.0);
|
||||
|
||||
NSString *expectedBeforeHashv1 = nil;
|
||||
NSString *expectedAfterHashv1 = nil;
|
||||
SUBinaryDeltaMajorVersion majorDiffVersion = header.majorVersion;
|
||||
uint16_t minorDiffVersion = header.minorVersion;
|
||||
|
||||
NSString *expectedNewBeforeHash = nil;
|
||||
NSString *expectedNewAfterHash = nil;
|
||||
|
||||
progressCallback(0/6.0);
|
||||
|
||||
xar_subdoc_t subdoc;
|
||||
for (subdoc = xar_subdoc_first(x); subdoc; subdoc = xar_subdoc_next(subdoc)) {
|
||||
if (!strcmp(xar_subdoc_name(subdoc), BINARY_DELTA_ATTRIBUTES_KEY)) {
|
||||
const char *value = 0;
|
||||
|
||||
// available in version 2.0 or later
|
||||
xar_subdoc_prop_get(subdoc, MAJOR_DIFF_VERSION_KEY, &value);
|
||||
if (value)
|
||||
majorDiffVersion = (SUBinaryDeltaMajorVersion)[@(value) intValue];
|
||||
|
||||
// available in version 2.0 or later
|
||||
xar_subdoc_prop_get(subdoc, MINOR_DIFF_VERSION_KEY, &value);
|
||||
if (value)
|
||||
minorDiffVersion = [@(value) intValue];
|
||||
|
||||
// available in version 2.0 or later
|
||||
xar_subdoc_prop_get(subdoc, BEFORE_TREE_SHA1_KEY, &value);
|
||||
if (value)
|
||||
expectedNewBeforeHash = @(value);
|
||||
|
||||
// available in version 2.0 or later
|
||||
xar_subdoc_prop_get(subdoc, AFTER_TREE_SHA1_KEY, &value);
|
||||
if (value)
|
||||
expectedNewAfterHash = @(value);
|
||||
|
||||
// only available in version 1.0
|
||||
xar_subdoc_prop_get(subdoc, BEFORE_TREE_SHA1_OLD_KEY, &value);
|
||||
if (value)
|
||||
expectedBeforeHashv1 = @(value);
|
||||
|
||||
// only available in version 1.0
|
||||
xar_subdoc_prop_get(subdoc, AFTER_TREE_SHA1_OLD_KEY, &value);
|
||||
if (value)
|
||||
expectedAfterHashv1 = @(value);
|
||||
}
|
||||
}
|
||||
|
||||
if (majorDiffVersion < FIRST_DELTA_DIFF_MAJOR_VERSION) {
|
||||
xar_close(x);
|
||||
|
||||
unsigned char *expectedBeforeHash = header.beforeTreeHash;
|
||||
unsigned char *expectedAfterHash = header.afterTreeHash;
|
||||
|
||||
if (majorDiffVersion < SUBinaryDeltaMajorVersionFirst) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadCorruptFileError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Unable to identify diff-version %u in delta. Giving up.", majorDiffVersion] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (majorDiffVersion > LATEST_DELTA_DIFF_MAJOR_VERSION) {
|
||||
xar_close(x);
|
||||
|
||||
|
||||
if (majorDiffVersion < SUBinaryDeltaMajorVersionFirstSupported) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"A later version is needed to apply this patch (on major version %u, but patch requests version %u).", LATEST_DELTA_DIFF_MAJOR_VERSION, majorDiffVersion] }];
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadCorruptFileError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Applying version %u patches is no longer supported.", majorDiffVersion] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (majorDiffVersion > SUBinaryDeltaMajorVersionLatest) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"A later version is needed to apply this patch (on major version %u, but patch requests version %u).", SUBinaryDeltaMajorVersionLatest, majorDiffVersion] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
#if HAS_XAR_GET_SAFE_PATH
|
||||
// Reject patches that did not generate valid hierarchical xar container paths
|
||||
// These will not succeed to patch using recent versions of BinaryDelta
|
||||
if ((majorDiffVersion == SUBinaryDeltaMajorVersion2 && minorDiffVersion < 3) || (majorDiffVersion == SUBinaryDeltaMajorVersion1 && minorDiffVersion < 2)) {
|
||||
xar_close(x);
|
||||
|
||||
if ([[archive class] maySupportSafeExtraction] && majorDiffVersion == SUBinaryDeltaMajorVersion2 && minorDiffVersion < 3) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadCorruptFileError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"This patch version (%u.%u) is too old and potentially unsafe to apply. Please re-generate the patch using the latest version of BinaryDelta or generate_appcast. New version %u.%u patches will still be compatible with older versions of Sparkle.", majorDiffVersion, minorDiffVersion, majorDiffVersion, latestMinorVersionForMajorVersion(majorDiffVersion)] }];
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
#endif
|
||||
|
||||
BOOL usesNewTreeHash = MAJOR_VERSION_IS_AT_LEAST(majorDiffVersion, SUBinaryDeltaMajorVersion2);
|
||||
|
||||
NSString *expectedBeforeHash = usesNewTreeHash ? expectedNewBeforeHash : expectedBeforeHashv1;
|
||||
NSString *expectedAfterHash = usesNewTreeHash ? expectedNewAfterHash : expectedAfterHashv1;
|
||||
|
||||
if (!expectedBeforeHash || !expectedAfterHash) {
|
||||
xar_close(x);
|
||||
|
||||
if (expectedBeforeHash == nil || expectedAfterHash == nil) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadCorruptFileError userInfo:@{ NSLocalizedDescriptionKey: @"Unable to find before-sha1 or after-sha1 metadata in delta. Giving up." }];
|
||||
}
|
||||
@@ -150,12 +90,10 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
||||
fprintf(stderr, "Verifying source...");
|
||||
}
|
||||
|
||||
progressCallback(1/6.0);
|
||||
|
||||
NSString *beforeHash = hashOfTreeWithVersion(source, majorDiffVersion);
|
||||
if (!beforeHash) {
|
||||
xar_close(x);
|
||||
|
||||
progressCallback(1/7.0);
|
||||
|
||||
unsigned char beforeHash[CC_SHA1_DIGEST_LENGTH] = {0};
|
||||
if (!getRawHashOfTreeWithVersion(beforeHash, source, majorDiffVersion)) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
@@ -165,14 +103,12 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (![beforeHash isEqualToString:expectedBeforeHash]) {
|
||||
xar_close(x);
|
||||
|
||||
if (memcmp(beforeHash, expectedBeforeHash, CC_SHA1_DIGEST_LENGTH) != 0) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Source doesn't have expected hash (%@ != %@). Giving up.", expectedBeforeHash, beforeHash] }];
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Source doesn't have expected hash (%@ != %@). Giving up.", displayHashFromRawHash(expectedBeforeHash), displayHashFromRawHash(beforeHash)] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
@@ -181,11 +117,19 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
||||
fprintf(stderr, "\nCopying files...");
|
||||
}
|
||||
|
||||
progressCallback(2/6.0);
|
||||
progressCallback(2/7.0);
|
||||
|
||||
// Make a temporary destination path if necessary
|
||||
// If we want to apply file system compression after we're done applying, we'll need to use a different
|
||||
// temporary path
|
||||
NSString *destination;
|
||||
if (header.fileSystemCompression) {
|
||||
destination = [finalDestination.stringByDeletingLastPathComponent stringByAppendingPathComponent:[NSString stringWithFormat:@".tmp.%@", finalDestination.lastPathComponent]];
|
||||
} else {
|
||||
destination = finalDestination;
|
||||
}
|
||||
|
||||
if (!removeTree(destination)) {
|
||||
xar_close(x);
|
||||
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
@@ -195,11 +139,9 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
||||
return NO;
|
||||
}
|
||||
|
||||
progressCallback(3/6.0);
|
||||
progressCallback(3/7.0);
|
||||
|
||||
if (!copyTree(source, destination)) {
|
||||
xar_close(x);
|
||||
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
@@ -209,44 +151,31 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
||||
return NO;
|
||||
}
|
||||
|
||||
progressCallback(4/6.0);
|
||||
|
||||
BOOL hasExtractKeyAvailable = MAJOR_VERSION_IS_AT_LEAST(majorDiffVersion, SUBinaryDeltaMajorVersion2);
|
||||
progressCallback(4/7.0);
|
||||
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\nPatching...");
|
||||
}
|
||||
NSFileManager *fileManager = [[NSFileManager alloc] init];
|
||||
xar_file_t file;
|
||||
xar_iter_t iter = xar_iter_new();
|
||||
for (file = xar_file_first(x, iter); file; file = xar_file_next(iter)) {
|
||||
char *pathCString;
|
||||
#if HAS_XAR_GET_SAFE_PATH
|
||||
if (xar_get_safe_path != NULL) {
|
||||
pathCString = xar_get_safe_path(file);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
pathCString = xar_get_path(file);
|
||||
}
|
||||
|
||||
// Ensure error is cleared out in advance
|
||||
if (error != NULL) {
|
||||
*error = nil;
|
||||
}
|
||||
|
||||
[archive enumerateItems:^(SPUDeltaArchiveItem *item, BOOL *stop) {
|
||||
NSString *relativePath = item.relativeFilePath;
|
||||
|
||||
if (pathCString == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSString *path = @(pathCString);
|
||||
if ([path.pathComponents containsObject:@".."]) {
|
||||
xar_close(x);
|
||||
|
||||
if ([relativePath.pathComponents containsObject:@".."]) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Relative path '%@' contains '..' path component", path] }];
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Relative path '%@' contains '..' path component", relativePath] }];
|
||||
}
|
||||
return NO;
|
||||
*stop = YES;
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *sourceFilePath = [source stringByAppendingPathComponent:path];
|
||||
NSString *destinationFilePath = [destination stringByAppendingPathComponent:path];
|
||||
NSString *sourceFilePath = [source stringByAppendingPathComponent:relativePath];
|
||||
NSString *destinationFilePath = [destination stringByAppendingPathComponent:relativePath];
|
||||
{
|
||||
NSString *destinationParentDirectory = destinationFilePath.stringByDeletingLastPathComponent;
|
||||
NSDictionary<NSFileAttributeKey, id> *destinationParentDirectoryAttributes = [fileManager attributesOfItemAtPath:destinationParentDirectory error:NULL];
|
||||
@@ -257,12 +186,11 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
||||
// If it's inside a symlink, this is not good in any circumstance
|
||||
NSString *fileType = destinationParentDirectoryAttributes[NSFileType];
|
||||
if ([fileType isEqualToString:NSFileTypeSymbolicLink]) {
|
||||
xar_close(x);
|
||||
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to create patch because '%@' cannot be a symbolic link.", destinationParentDirectory] }];
|
||||
}
|
||||
return NO;
|
||||
*stop = YES;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -273,121 +201,283 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
||||
|
||||
// Files that have no property set that we check for will get ignored
|
||||
// This is important because they aren't part of the delta, just part of the directory structure
|
||||
|
||||
const char *value;
|
||||
if (!xar_prop_get(file, DELETE_KEY, &value) || (!hasExtractKeyAvailable && !xar_prop_get(file, DELETE_THEN_EXTRACT_OLD_KEY, &value))) {
|
||||
SPUDeltaItemCommands commands = item.commands;
|
||||
if ((commands & SPUDeltaItemCommandDelete) != 0) {
|
||||
if (!removeTree(destinationFilePath)) {
|
||||
xar_close(x);
|
||||
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"%@ or %@: failed to remove %@", @DELETE_KEY, @DELETE_THEN_EXTRACT_OLD_KEY, destination] }];
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"delete: failed to remove %@", destination] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
if (!hasExtractKeyAvailable && !xar_prop_get(file, DELETE_KEY, &value)) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n❌ %s %s", VERBOSE_DELETED, [path fileSystemRepresentation]);
|
||||
}
|
||||
continue;
|
||||
*stop = YES;
|
||||
return;
|
||||
}
|
||||
|
||||
removedFile = YES;
|
||||
}
|
||||
|
||||
if (!xar_prop_get(file, BINARY_DELTA_KEY, &value)) {
|
||||
if (!applyBinaryDeltaToFile(x, file, sourceFilePath, destinationFilePath)) {
|
||||
xar_close(x);
|
||||
if ((commands & SPUDeltaItemCommandClone) != 0 && (commands & SPUDeltaItemCommandBinaryDiff) == 0) {
|
||||
NSString *clonedRelativePath = item.clonedRelativePath;
|
||||
if ([clonedRelativePath.pathComponents containsObject:@".."]) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Relative path for clone '%@' contains '..' path component", clonedRelativePath] }];
|
||||
}
|
||||
*stop = YES;
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *clonedOriginalPath = [source stringByAppendingPathComponent:clonedRelativePath];
|
||||
|
||||
// Ensure there isn't an item already at our destination
|
||||
[fileManager removeItemAtPath:destinationFilePath error:NULL];
|
||||
|
||||
NSError *copyError = nil;
|
||||
if (![fileManager copyItemAtPath:clonedOriginalPath toPath:destinationFilePath error:©Error]) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (error != NULL) {
|
||||
*error = copyError;
|
||||
}
|
||||
|
||||
*stop = YES;
|
||||
return;
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n✂️ %s %s -> %s", VERBOSE_CLONED, [clonedRelativePath fileSystemRepresentation], [relativePath fileSystemRepresentation]);
|
||||
}
|
||||
} else if ((commands & SPUDeltaItemCommandBinaryDiff) != 0) {
|
||||
NSString *tempDiffFile = temporaryFilename(@"apply-binary-delta");
|
||||
item.itemFilePath = tempDiffFile;
|
||||
|
||||
if (![archive extractItem:item]) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Unable to extract diffed file to %@", tempDiffFile], NSUnderlyingErrorKey: (NSError * _Nonnull)archive.error }];
|
||||
}
|
||||
|
||||
*stop = YES;
|
||||
return;
|
||||
}
|
||||
|
||||
NSString *sourceDiffFilePath;
|
||||
NSString *clonedRelativePath;
|
||||
if ((commands & SPUDeltaItemCommandClone) != 0) {
|
||||
clonedRelativePath = item.clonedRelativePath;
|
||||
if ([clonedRelativePath.pathComponents containsObject:@".."]) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Relative path for clone '%@' contains '..' path component", clonedRelativePath] }];
|
||||
}
|
||||
*stop = YES;
|
||||
return;
|
||||
}
|
||||
|
||||
sourceDiffFilePath = [source stringByAppendingPathComponent:clonedRelativePath];
|
||||
} else {
|
||||
sourceDiffFilePath = sourceFilePath;
|
||||
clonedRelativePath = nil;
|
||||
}
|
||||
|
||||
if (!applyBinaryDeltaToFile(tempDiffFile, sourceDiffFilePath, destinationFilePath)) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Unable to patch %@ to destination %@", sourceFilePath, destinationFilePath] }];
|
||||
}
|
||||
return NO;
|
||||
*stop = YES;
|
||||
return;
|
||||
}
|
||||
|
||||
// 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) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Unable to retrieve stat info from %@", sourceFilePath] }];
|
||||
}
|
||||
*stop = YES;
|
||||
return;
|
||||
}
|
||||
|
||||
if (chmod(destinationFilePath.fileSystemRepresentation, sourceFileInfo.st_mode) != 0) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteNoPermissionError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Unable to modify permissions (%u) on file %@", sourceFileInfo.st_mode, destinationFilePath] }];
|
||||
}
|
||||
*stop = YES;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n🔨 %s %s", VERBOSE_PATCHED, [path fileSystemRepresentation]);
|
||||
if ((commands & SPUDeltaItemCommandClone) != 0) {
|
||||
fprintf(stderr, "\n🔨 %s %s -> %s", VERBOSE_PATCHED, [clonedRelativePath fileSystemRepresentation], [relativePath fileSystemRepresentation]);
|
||||
} else {
|
||||
fprintf(stderr, "\n🔨 %s %s", VERBOSE_PATCHED, [relativePath fileSystemRepresentation]);
|
||||
}
|
||||
}
|
||||
} else if ((hasExtractKeyAvailable && !xar_prop_get(file, EXTRACT_KEY, &value)) || (!hasExtractKeyAvailable && xar_prop_get(file, MODIFY_PERMISSIONS_KEY, &value))) { // extract and permission modifications don't coexist
|
||||
|
||||
if (xar_extract_tofile(x, file, [destinationFilePath fileSystemRepresentation]) != 0) {
|
||||
xar_close(x);
|
||||
|
||||
} else if ((commands & SPUDeltaItemCommandExtract) != 0) { // extract and permission modifications don't coexist
|
||||
item.itemFilePath = destinationFilePath;
|
||||
if (![archive extractItem:item]) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Unable to extract file to %@", destinationFilePath] }];
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Unable to extract file to %@", destinationFilePath], NSUnderlyingErrorKey: (NSError * _Nonnull)archive.error }];
|
||||
}
|
||||
return NO;
|
||||
*stop = YES;
|
||||
return;
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
if (fileExisted) {
|
||||
fprintf(stderr, "\n✏️ %s %s", VERBOSE_UPDATED, [path fileSystemRepresentation]);
|
||||
fprintf(stderr, "\n✏️ %s %s", VERBOSE_UPDATED, [relativePath fileSystemRepresentation]);
|
||||
} else {
|
||||
fprintf(stderr, "\n✅ %s %s", VERBOSE_ADDED, [path fileSystemRepresentation]);
|
||||
fprintf(stderr, "\n✅ %s %s", VERBOSE_ADDED, [relativePath fileSystemRepresentation]);
|
||||
}
|
||||
}
|
||||
} else if (verbose && removedFile) {
|
||||
fprintf(stderr, "\n❌ %s %s", VERBOSE_DELETED, [path fileSystemRepresentation]);
|
||||
fprintf(stderr, "\n❌ %s %s", VERBOSE_DELETED, [relativePath fileSystemRepresentation]);
|
||||
}
|
||||
|
||||
if (!xar_prop_get(file, MODIFY_PERMISSIONS_KEY, &value)) {
|
||||
mode_t mode = (mode_t)[[NSString stringWithUTF8String:value] intValue];
|
||||
if ((commands & SPUDeltaItemCommandModifyPermissions) != 0) {
|
||||
mode_t mode = (mode_t)item.mode;
|
||||
if (!modifyPermissions(destinationFilePath, mode)) {
|
||||
xar_close(x);
|
||||
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteNoPermissionError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Unable to modify permissions (%@) on file %@", @(value), destinationFilePath] }];
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteNoPermissionError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Unable to modify permissions (%u) on file %@", mode, destinationFilePath] }];
|
||||
}
|
||||
return NO;
|
||||
*stop = YES;
|
||||
return;
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n👮 %s %s (0%o)", VERBOSE_MODIFIED, [path fileSystemRepresentation], mode);
|
||||
fprintf(stderr, "\n👮 %s %s (0%o)", VERBOSE_MODIFIED, [relativePath fileSystemRepresentation], mode & PERMISSION_FLAGS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
||||
xar_close(x);
|
||||
|
||||
progressCallback(5/6.0);
|
||||
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\nVerifying destination...");
|
||||
}
|
||||
NSString *afterHash = hashOfTreeWithVersion(destination, majorDiffVersion);
|
||||
if (!afterHash) {
|
||||
[archive close];
|
||||
|
||||
// Set error from enumerating items if we have encountered an error and haven't set it yet
|
||||
NSError *archiveError = archive.error;
|
||||
if (archiveError != nil) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Unable to calculate hash of tree %@", destination] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (![afterHash isEqualToString:expectedAfterHash]) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Destination doesn't have expected hash (%@ != %@). Giving up.", expectedAfterHash, afterHash] }];
|
||||
if (error != NULL && *error == nil) {
|
||||
*error = archiveError;
|
||||
}
|
||||
removeTree(destination);
|
||||
return NO;
|
||||
}
|
||||
|
||||
progressCallback(6/6.0);
|
||||
progressCallback(5/7.0);
|
||||
|
||||
// Re-apply file system compression is requested
|
||||
if (header.fileSystemCompression) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\nApplying file system compression...");
|
||||
}
|
||||
|
||||
NSTask *dittoTask = [[NSTask alloc] init];
|
||||
|
||||
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;
|
||||
|
||||
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) {
|
||||
[dittoTask waitUntilExit];
|
||||
|
||||
if (dittoTask.terminationStatus != 0) {
|
||||
failedToApplyFileSystemCompression = YES;
|
||||
|
||||
fprintf(stderr, "\nWarning: ditto task for file compression returned exit status %d", dittoTask.terminationStatus);
|
||||
}
|
||||
}
|
||||
|
||||
if (failedToApplyFileSystemCompression) {
|
||||
// Try to replace bundle normally
|
||||
if (![fileManager replaceItemAtURL:[NSURL fileURLWithPath:finalDestination] withItemAtURL:[NSURL fileURLWithPath:destination isDirectory:YES] backupItemName:nil options:0 resultingItemURL:NULL error:error]) {
|
||||
removeTree(destination);
|
||||
return NO;
|
||||
}
|
||||
} else {
|
||||
// Remove original copy
|
||||
[fileManager removeItemAtURL:[NSURL fileURLWithPath:destination isDirectory:YES] error:NULL];
|
||||
}
|
||||
}
|
||||
|
||||
progressCallback(6/7.0);
|
||||
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\nVerifying destination...");
|
||||
}
|
||||
|
||||
unsigned char afterHash[CC_SHA1_DIGEST_LENGTH] = {0};
|
||||
if (!getRawHashOfTreeWithVersion(afterHash, finalDestination, majorDiffVersion)) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Unable to calculate hash of tree %@", finalDestination] }];
|
||||
}
|
||||
removeTree(finalDestination);
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (memcmp(afterHash, expectedAfterHash, CC_SHA1_DIGEST_LENGTH) != 0) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Destination doesn't have expected hash (%@ != %@). Giving up.", displayHashFromRawHash(expectedAfterHash), displayHashFromRawHash(afterHash)] }];
|
||||
}
|
||||
removeTree(finalDestination);
|
||||
return NO;
|
||||
}
|
||||
|
||||
progressCallback(7/7.0);
|
||||
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\nDone!\n");
|
||||
|
||||
@@ -10,33 +10,19 @@
|
||||
#define SUBINARYDELTACOMMON_H
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "SPUDeltaCompressionMode.h"
|
||||
#include <fts.h>
|
||||
|
||||
#define PERMISSION_FLAGS (S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX)
|
||||
|
||||
#define IS_VALID_PERMISSIONS(mode) \
|
||||
(((mode & PERMISSION_FLAGS) == 0755) || ((mode & PERMISSION_FLAGS) == 0644))
|
||||
#define VALID_SYMBOLIC_LINK_PERMISSIONS 0755
|
||||
// Enforcing Sparkle's executable permissions to be valid allows us to perform a preflight test before
|
||||
// downloading delta items
|
||||
#define VALID_SPARKLE_EXECUTABLE_PERMISSIONS 0755
|
||||
|
||||
#define APPLE_CODE_SIGN_XATTR_CODE_DIRECTORY_KEY "com.apple.cs.CodeDirectory"
|
||||
#define APPLE_CODE_SIGN_XATTR_CODE_REQUIREMENTS_KEY "com.apple.cs.CodeRequirements"
|
||||
#define APPLE_CODE_SIGN_XATTR_CODE_SIGNATURE_KEY "com.apple.cs.CodeSignature"
|
||||
|
||||
#define BINARY_DELTA_ATTRIBUTES_KEY "binary-delta-attributes"
|
||||
#define MAJOR_DIFF_VERSION_KEY "major-version"
|
||||
#define MINOR_DIFF_VERSION_KEY "minor-version"
|
||||
#define BEFORE_TREE_SHA1_KEY "before-tree-sha1"
|
||||
#define AFTER_TREE_SHA1_KEY "after-tree-sha1"
|
||||
#define DELETE_KEY "delete"
|
||||
#define EXTRACT_KEY "extract"
|
||||
#define BINARY_DELTA_KEY "binary-delta"
|
||||
#define MODIFY_PERMISSIONS_KEY "mod-permissions"
|
||||
|
||||
// Properties no longer used in new patches
|
||||
#define DELETE_THEN_EXTRACT_OLD_KEY "delete-then-extract"
|
||||
#define BEFORE_TREE_SHA1_OLD_KEY "before-sha1"
|
||||
#define AFTER_TREE_SHA1_OLD_KEY "after-sha1"
|
||||
|
||||
#define VERBOSE_DELETED "Deleted" // file is deleted from the file system when applying a patch
|
||||
#define VERBOSE_REMOVED "Removed" // file is set to be removed when creating a patch
|
||||
#define VERBOSE_ADDED "Added" // file is added to the patch or file system
|
||||
@@ -44,23 +30,40 @@
|
||||
#define VERBOSE_PATCHED "Patched" // file is patched when applying a patch
|
||||
#define VERBOSE_UPDATED "Updated" // file's contents are updated
|
||||
#define VERBOSE_MODIFIED "Modified" // file's metadata is modified
|
||||
#define VERBOSE_CLONED "Cloned" // file is cloned in content from a differently named file
|
||||
|
||||
#define MAJOR_VERSION_IS_AT_LEAST(actualMajor, expectedMajor) (actualMajor >= expectedMajor)
|
||||
|
||||
// Each major version will be assigned a name of a color
|
||||
// Relative path of custom icon data that may be set on a bundle via a resource fork
|
||||
#define CUSTOM_ICON_PATH @"/Icon\r"
|
||||
|
||||
// Changes that break backwards compatibility will have different major versions
|
||||
// Changes that affect creating but not applying patches will have different minor versions
|
||||
|
||||
typedef NS_ENUM(uint16_t, SUBinaryDeltaMajorVersion)
|
||||
{
|
||||
// Note: support for creating or applying version 1 deltas have been removed
|
||||
SUBinaryDeltaMajorVersion1 = 1,
|
||||
SUBinaryDeltaMajorVersion2 = 2
|
||||
SUBinaryDeltaMajorVersion2 = 2,
|
||||
SUBinaryDeltaMajorVersion3 = 3
|
||||
};
|
||||
|
||||
#define FIRST_DELTA_DIFF_MAJOR_VERSION SUBinaryDeltaMajorVersion1
|
||||
#define LATEST_DELTA_DIFF_MAJOR_VERSION SUBinaryDeltaMajorVersion2
|
||||
extern SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionDefault;
|
||||
extern SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionLatest;
|
||||
extern SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionFirst;
|
||||
extern SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionFirstSupported;
|
||||
|
||||
#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."
|
||||
|
||||
SPUDeltaCompressionMode deltaCompressionModeFromDescription(NSString *description, BOOL *requestValid);
|
||||
NSString *deltaCompressionStringFromMode(SPUDeltaCompressionMode mode);
|
||||
|
||||
extern int compareFiles(const FTSENT **a, const FTSENT **b);
|
||||
BOOL getRawHashOfTreeWithVersion(unsigned char *hashBuffer, NSString *path, uint16_t majorVersion);
|
||||
BOOL getRawHashOfTreeAndFileTablesWithVersion(unsigned char *hashBuffer, NSString *path, uint16_t majorVersion, NSMutableDictionary<NSData *, NSMutableArray<NSString *> *> *hashToFileKeyDictionary, NSMutableDictionary<NSString *, NSData *> *fileKeyToHashDictionary);
|
||||
NSString *displayHashFromRawHash(const unsigned char *hash);
|
||||
void getRawHashFromDisplayHash(unsigned char *hash, NSString *hexHash);
|
||||
extern NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion);
|
||||
extern NSString *hashOfTree(NSString *path);
|
||||
extern BOOL removeTree(NSString *path);
|
||||
@@ -70,5 +73,5 @@ extern NSString *pathRelativeToDirectory(NSString *directory, NSString *path);
|
||||
NSString *temporaryFilename(NSString *base);
|
||||
NSString *temporaryDirectory(NSString *base);
|
||||
NSString *stringWithFileSystemRepresentation(const char*);
|
||||
int latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion);
|
||||
uint16_t latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion);
|
||||
#endif
|
||||
@@ -16,13 +16,81 @@
|
||||
#include <sys/mman.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
#include <xar/xar.h>
|
||||
#include <xlocale.h>
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
|
||||
// Note: the framework bundle version must be bumped, and generate_appcast must be updated to compare it,
|
||||
// when we add/change new major versions and defaults. Unit tests need to be updated to use new versions too.
|
||||
SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionDefault = SUBinaryDeltaMajorVersion3;
|
||||
SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionLatest = SUBinaryDeltaMajorVersion3;
|
||||
SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionFirst = SUBinaryDeltaMajorVersion1;
|
||||
SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionFirstSupported = SUBinaryDeltaMajorVersion2;
|
||||
|
||||
SPUDeltaCompressionMode deltaCompressionModeFromDescription(NSString *requestedDescription, BOOL *requestValid)
|
||||
{
|
||||
// Set to NO later if request was not valid
|
||||
if (requestValid != NULL) {
|
||||
*requestValid = YES;
|
||||
}
|
||||
|
||||
SPUDeltaCompressionMode compression;
|
||||
NSString *description = requestedDescription.lowercaseString;
|
||||
|
||||
if ([description isEqualToString:@"default"]) {
|
||||
compression = SPUDeltaCompressionModeDefault;
|
||||
} else if ([description isEqualToString:@"none"]) {
|
||||
compression = SPUDeltaCompressionModeNone;
|
||||
} else if ([description isEqualToString:@"bzip2"]) {
|
||||
compression = SPUDeltaCompressionModeBzip2;
|
||||
} else if ([description isEqualToString:@"lzma"]) {
|
||||
compression = SPUDeltaCompressionModeLZMA;
|
||||
} else if ([description isEqualToString:@"lzfse"]) {
|
||||
compression = SPUDeltaCompressionModeLZFSE;
|
||||
} else if ([description isEqualToString:@"lz4"]) {
|
||||
compression = SPUDeltaCompressionModeLZ4;
|
||||
} else if ([description isEqualToString:@"zlib"]) {
|
||||
compression = SPUDeltaCompressionModeZLIB;
|
||||
} else {
|
||||
compression = SPUDeltaCompressionModeDefault;
|
||||
|
||||
if (requestValid != NULL) {
|
||||
*requestValid = NO;
|
||||
}
|
||||
}
|
||||
|
||||
return compression;
|
||||
}
|
||||
|
||||
NSString *deltaCompressionStringFromMode(SPUDeltaCompressionMode mode)
|
||||
{
|
||||
switch (mode) {
|
||||
case SPUDeltaCompressionModeBzip2:
|
||||
return @"bzip2";
|
||||
case SPUDeltaCompressionModeLZMA:
|
||||
return @"LZMA";
|
||||
case SPUDeltaCompressionModeNone:
|
||||
return @"no";
|
||||
case SPUDeltaCompressionModeLZ4:
|
||||
return @"LZ4";
|
||||
case SPUDeltaCompressionModeLZFSE:
|
||||
return @"LZFSE";
|
||||
case SPUDeltaCompressionModeZLIB:
|
||||
return @"ZLIB";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (mode == SPUDeltaCompressionModeDefault) {
|
||||
return @"default";
|
||||
}
|
||||
|
||||
return @"unknown";
|
||||
}
|
||||
|
||||
int compareFiles(const FTSENT **a, const FTSENT **b)
|
||||
{
|
||||
return strcoll((*a)->fts_name, (*b)->fts_name);
|
||||
return strcoll_l((*a)->fts_name, (*b)->fts_name, _c_locale);
|
||||
}
|
||||
|
||||
NSString *pathRelativeToDirectory(NSString *directory, NSString *path)
|
||||
@@ -39,13 +107,15 @@ NSString *stringWithFileSystemRepresentation(const char *input)
|
||||
return [[NSFileManager defaultManager] stringWithFileSystemRepresentation:input length:strlen(input)];
|
||||
}
|
||||
|
||||
int latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion)
|
||||
uint16_t latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion)
|
||||
{
|
||||
switch (majorVersion) {
|
||||
case SUBinaryDeltaMajorVersion1:
|
||||
return 2;
|
||||
case SUBinaryDeltaMajorVersion2:
|
||||
return 3;
|
||||
return 4;
|
||||
case SUBinaryDeltaMajorVersion3:
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -96,7 +166,7 @@ static void _hashOfBuffer(unsigned char *hash, const char *buffer, ssize_t buffe
|
||||
CC_SHA1_Final(hash, &hashContext);
|
||||
}
|
||||
|
||||
static BOOL _hashOfFileContents(unsigned char *hash, FTSENT *ent)
|
||||
static BOOL _hashOfFileContents(unsigned char *hash, FTSENT *ent, void *tempBuffer, size_t tempBufferSize)
|
||||
{
|
||||
if (ent->fts_info == FTS_SL) {
|
||||
char linkDestination[MAXPATHLEN + 1];
|
||||
@@ -108,27 +178,37 @@ static BOOL _hashOfFileContents(unsigned char *hash, FTSENT *ent)
|
||||
|
||||
_hashOfBuffer(hash, linkDestination, linkDestinationLength);
|
||||
} else if (ent->fts_info == FTS_F) {
|
||||
int fileDescriptor = open(ent->fts_path, O_RDONLY);
|
||||
if (fileDescriptor == -1) {
|
||||
perror("open");
|
||||
return NO;
|
||||
}
|
||||
|
||||
ssize_t fileSize = ent->fts_statp->st_size;
|
||||
if (fileSize == 0) {
|
||||
if (fileSize <= 0) {
|
||||
_hashOfBuffer(hash, NULL, 0);
|
||||
} else {
|
||||
void *buffer = mmap(0, (size_t)fileSize, PROT_READ, MAP_FILE | MAP_PRIVATE, fileDescriptor, 0);
|
||||
if (buffer == (void *)-1) {
|
||||
close(fileDescriptor);
|
||||
perror("mmap");
|
||||
FILE *file = fopen(ent->fts_path, "rb");
|
||||
if (file == NULL) {
|
||||
perror("fopen");
|
||||
return NO;
|
||||
}
|
||||
|
||||
_hashOfBuffer(hash, buffer, fileSize);
|
||||
munmap(buffer, (size_t)fileSize);
|
||||
|
||||
CC_SHA1_CTX hashContext;
|
||||
CC_SHA1_Init(&hashContext);
|
||||
|
||||
size_t bytesLeft = (size_t)fileSize;
|
||||
while (bytesLeft > 0) {
|
||||
size_t bytesToConsume = (bytesLeft >= tempBufferSize) ? tempBufferSize : bytesLeft;
|
||||
|
||||
if (fread(tempBuffer, bytesToConsume, 1, file) < 1) {
|
||||
perror("fread");
|
||||
fclose(file);
|
||||
return NO;
|
||||
}
|
||||
|
||||
CC_SHA1_Update(&hashContext, tempBuffer, (CC_LONG)bytesToConsume);
|
||||
bytesLeft -= bytesToConsume;
|
||||
}
|
||||
|
||||
CC_SHA1_Final(hash, &hashContext);
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
close(fileDescriptor);
|
||||
} else if (ent->fts_info == FTS_D) {
|
||||
memset(hash, 0xdd, CC_SHA1_DIGEST_LENGTH);
|
||||
} else {
|
||||
@@ -137,18 +217,31 @@ static BOOL _hashOfFileContents(unsigned char *hash, FTSENT *ent)
|
||||
return YES;
|
||||
}
|
||||
|
||||
NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion)
|
||||
BOOL getRawHashOfTreeWithVersion(unsigned char *hashBuffer, NSString *path, uint16_t majorVersion)
|
||||
{
|
||||
return getRawHashOfTreeAndFileTablesWithVersion(hashBuffer, path, majorVersion, nil, nil);
|
||||
}
|
||||
|
||||
BOOL getRawHashOfTreeAndFileTablesWithVersion(unsigned char *hashBuffer, NSString *path, uint16_t __unused majorVersion, NSMutableDictionary<NSData *, NSMutableArray<NSString *> *> *hashToFileKeyDictionary, NSMutableDictionary<NSString *, NSData *> *fileKeyToHashDictionary)
|
||||
{
|
||||
char pathBuffer[PATH_MAX] = { 0 };
|
||||
if (![path getFileSystemRepresentation:pathBuffer maxLength:sizeof(pathBuffer)]) {
|
||||
return nil;
|
||||
return NO;
|
||||
}
|
||||
|
||||
const size_t tempBufferSize = 16384;
|
||||
void *tempBuffer = calloc(1, tempBufferSize);
|
||||
if (tempBuffer == NULL) {
|
||||
perror("calloc");
|
||||
return NO;
|
||||
}
|
||||
|
||||
char *const sourcePaths[] = { pathBuffer, 0 };
|
||||
FTS *fts = fts_open(sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles);
|
||||
if (!fts) {
|
||||
perror("fts_open");
|
||||
return nil;
|
||||
free(tempBuffer);
|
||||
return NO;
|
||||
}
|
||||
|
||||
CC_SHA1_CTX hashContext;
|
||||
@@ -162,53 +255,97 @@ NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion)
|
||||
if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D)
|
||||
continue;
|
||||
|
||||
if (ent->fts_info == FTS_D && !MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2)) {
|
||||
NSString *relativePath = pathRelativeToDirectory(normalizedPath, stringWithFileSystemRepresentation(ent->fts_path));
|
||||
|
||||
// Ignore icon resource fork data
|
||||
if (relativePath.length == 0 || [relativePath isEqualToString:CUSTOM_ICON_PATH]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSString *relativePath = pathRelativeToDirectory(normalizedPath, stringWithFileSystemRepresentation(ent->fts_path));
|
||||
if (relativePath.length == 0)
|
||||
continue;
|
||||
|
||||
unsigned char fileHash[CC_SHA1_DIGEST_LENGTH];
|
||||
if (!_hashOfFileContents(fileHash, ent)) {
|
||||
return nil;
|
||||
if (!_hashOfFileContents(fileHash, ent, tempBuffer, tempBufferSize)) {
|
||||
fts_close(fts);
|
||||
free(tempBuffer);
|
||||
return NO;
|
||||
}
|
||||
CC_SHA1_Update(&hashContext, fileHash, sizeof(fileHash));
|
||||
|
||||
// For file hash tables we only track regular files
|
||||
if (ent->fts_info == FTS_F) {
|
||||
NSData *hashKey = [NSData dataWithBytes:fileHash length:sizeof(fileHash)];
|
||||
|
||||
if (hashToFileKeyDictionary != nil) {
|
||||
if (hashToFileKeyDictionary[hashKey] == nil) {
|
||||
hashToFileKeyDictionary[hashKey] = [NSMutableArray array];
|
||||
}
|
||||
[hashToFileKeyDictionary[hashKey] addObject:relativePath];
|
||||
}
|
||||
|
||||
if (fileKeyToHashDictionary != nil) {
|
||||
fileKeyToHashDictionary[relativePath] = hashKey;
|
||||
}
|
||||
}
|
||||
|
||||
const char *relativePathBytes = [relativePath fileSystemRepresentation];
|
||||
CC_SHA1_Update(&hashContext, relativePathBytes, (CC_LONG)strlen(relativePathBytes));
|
||||
|
||||
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2)) {
|
||||
uint16_t mode = ent->fts_statp->st_mode;
|
||||
// permission of symlinks is irrelevant and can't be changed.
|
||||
// hardcoding a value helps avoid differences between filesystems.
|
||||
if (ent->fts_info == FTS_SL) {
|
||||
mode = 0755;
|
||||
}
|
||||
uint16_t type = ent->fts_info;
|
||||
uint16_t permissions = mode & PERMISSION_FLAGS;
|
||||
uint16_t mode = ent->fts_statp->st_mode;
|
||||
uint16_t type = ent->fts_info;
|
||||
uint16_t permissions = mode & PERMISSION_FLAGS;
|
||||
|
||||
// permission of symlinks are 0777 on some linux file systems and can't be changed,
|
||||
// differing from the 0755 macOS default.
|
||||
// hardcoding a value helps avoid differences between filesystems.
|
||||
uint16_t hashedPermissions = (ent->fts_info == FTS_SL) ? VALID_SYMBOLIC_LINK_PERMISSIONS : permissions;
|
||||
|
||||
CC_SHA1_Update(&hashContext, &type, sizeof(type));
|
||||
CC_SHA1_Update(&hashContext, &permissions, sizeof(permissions));
|
||||
}
|
||||
CC_SHA1_Update(&hashContext, &type, sizeof(type));
|
||||
CC_SHA1_Update(&hashContext, &hashedPermissions, sizeof(hashedPermissions));
|
||||
}
|
||||
|
||||
free(tempBuffer);
|
||||
|
||||
fts_close(fts);
|
||||
|
||||
unsigned char hash[CC_SHA1_DIGEST_LENGTH];
|
||||
CC_SHA1_Final(hash, &hashContext);
|
||||
CC_SHA1_Final(hashBuffer, &hashContext);
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
char hexHash[CC_SHA1_DIGEST_LENGTH * 2 + 1];
|
||||
size_t i;
|
||||
for (i = 0; i < CC_SHA1_DIGEST_LENGTH; i++)
|
||||
void getRawHashFromDisplayHash(unsigned char *hash, NSString *hexHash)
|
||||
{
|
||||
const char *hexString = hexHash.UTF8String;
|
||||
if (hexString == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (size_t blockIndex = 0; blockIndex < CC_SHA1_DIGEST_LENGTH; blockIndex++) {
|
||||
const char *currentBlock = hexString + blockIndex * 2;
|
||||
char convertedBlock[3] = {currentBlock[0], currentBlock[1], '\0'};
|
||||
hash[blockIndex] = (unsigned char)strtol(convertedBlock, NULL, 16);
|
||||
}
|
||||
}
|
||||
|
||||
NSString *displayHashFromRawHash(const unsigned char *hash)
|
||||
{
|
||||
char hexHash[CC_SHA1_DIGEST_LENGTH * 2 + 1] = {0};
|
||||
for (size_t i = 0; i < CC_SHA1_DIGEST_LENGTH; i++) {
|
||||
sprintf(hexHash + i * 2, "%02x", hash[i]);
|
||||
|
||||
}
|
||||
return @(hexHash);
|
||||
}
|
||||
|
||||
NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion)
|
||||
{
|
||||
unsigned char hash[CC_SHA1_DIGEST_LENGTH];
|
||||
if (!getRawHashOfTreeWithVersion(hash, path, majorVersion)) {
|
||||
return nil;
|
||||
}
|
||||
return displayHashFromRawHash(hash);
|
||||
}
|
||||
|
||||
extern NSString *hashOfTree(NSString *path)
|
||||
{
|
||||
return hashOfTreeWithVersion(path, LATEST_DELTA_DIFF_MAJOR_VERSION);
|
||||
return hashOfTreeWithVersion(path, SUBinaryDeltaMajorVersionLatest);
|
||||
}
|
||||
|
||||
BOOL removeTree(NSString *path)
|
||||
|
||||
@@ -10,8 +10,9 @@
|
||||
#define SUBINARYDELTACREATE_H
|
||||
|
||||
#import "SUBinaryDeltaCommon.h"
|
||||
#import "SPUDeltaArchiveProtocol.h"
|
||||
|
||||
@class NSString;
|
||||
BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchFile, SUBinaryDeltaMajorVersion majorVersion, BOOL verbose, NSError * __autoreleasing *error);
|
||||
BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchFile, SUBinaryDeltaMajorVersion majorVersion, SPUDeltaCompressionMode compression, uint8_t compressionLevel, BOOL verbose, NSError * __autoreleasing *error);
|
||||
|
||||
#endif
|
||||
+488
-144
@@ -9,6 +9,9 @@
|
||||
#import "SUBinaryDeltaCreate.h"
|
||||
#import <Foundation/Foundation.h>
|
||||
#include "SUBinaryDeltaCommon.h"
|
||||
#import "SPUDeltaArchiveProtocol.h"
|
||||
#import "SPUSparkleDeltaArchive.h"
|
||||
#import "SPUXarDeltaArchive.h"
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
#include <fcntl.h>
|
||||
#include <fts.h>
|
||||
@@ -19,7 +22,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/xattr.h>
|
||||
#include <xar/xar.h>
|
||||
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
|
||||
@@ -27,29 +30,40 @@ extern int bsdiff(int argc, const char **argv);
|
||||
|
||||
@interface CreateBinaryDeltaOperation : NSOperation
|
||||
@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 oldTree:(NSString *)oldTree newTree:(NSString *)newTree oldPermissions:(NSNumber *)oldPermissions newPermissions:(NSNumber *)permissions;
|
||||
- (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
|
||||
@synthesize relativePath = _relativePath;
|
||||
@synthesize clonedRelativePath = _clonedRelativePath;
|
||||
@synthesize resultPath = _resultPath;
|
||||
@synthesize oldPermissions = _oldPermissions;
|
||||
@synthesize permissions = _permissions;
|
||||
@synthesize changingPermissions = _changingPermissions;
|
||||
@synthesize _fromPath = _fromPath;
|
||||
@synthesize _toPath = _toPath;
|
||||
|
||||
- (id)initWithRelativePath:(NSString *)relativePath oldTree:(NSString *)oldTree newTree:(NSString *)newTree oldPermissions:(NSNumber *)oldPermissions newPermissions:(NSNumber *)permissions
|
||||
- (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])) {
|
||||
self.relativePath = relativePath;
|
||||
self.clonedRelativePath = clonedRelativePath;
|
||||
self.oldPermissions = oldPermissions;
|
||||
self.permissions = permissions;
|
||||
self._fromPath = [oldTree stringByAppendingPathComponent:relativePath];
|
||||
self.changingPermissions = changingPermissions;
|
||||
|
||||
if (clonedRelativePath == nil) {
|
||||
self._fromPath = [oldTree stringByAppendingPathComponent:relativePath];
|
||||
} else {
|
||||
self._fromPath = [oldTree stringByAppendingPathComponent:clonedRelativePath];
|
||||
}
|
||||
self._toPath = [newTree stringByAppendingPathComponent:relativePath];
|
||||
}
|
||||
return self;
|
||||
@@ -88,15 +102,6 @@ static NSDictionary *infoForFile(FTSENT *ent)
|
||||
INFO_SIZE_KEY: @(size) };
|
||||
}
|
||||
|
||||
static bool isSymLink(const FTSENT *ent)
|
||||
{
|
||||
if (ent->fts_info == FTS_SL)
|
||||
{
|
||||
return (true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool aclExists(const FTSENT *ent)
|
||||
{
|
||||
// macOS does not currently support ACLs for symlinks
|
||||
@@ -174,17 +179,16 @@ static BOOL shouldSkipDeltaCompression(NSDictionary *originalInfo, NSDictionary
|
||||
|
||||
unsigned short originalInfoType = [(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue];
|
||||
unsigned short newInfoType = [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue];
|
||||
if (originalInfoType != newInfoType) {
|
||||
// File types are different
|
||||
if (originalInfoType != newInfoType || originalInfoType != FTS_F) {
|
||||
// File types are different or they're not regular files
|
||||
return YES;
|
||||
}
|
||||
|
||||
NSString *originalPath = originalInfo[INFO_PATH_KEY];
|
||||
NSString *newPath = newInfo[INFO_PATH_KEY];
|
||||
|
||||
// Skip delta if both entries are directories, or if the files/symlinks are equal in content
|
||||
if (originalInfoType == FTS_D || [[NSFileManager defaultManager] contentsEqualAtPath:originalPath andPath:newPath]) {
|
||||
// this is possible if just the permissions have changed but contents have not
|
||||
// Skip delta if the files are equal in content
|
||||
if ([[NSFileManager defaultManager] contentsEqualAtPath:originalPath andPath:newPath]) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
@@ -236,72 +240,171 @@ static BOOL shouldChangePermissions(NSDictionary *originalInfo, NSDictionary *ne
|
||||
if (!originalInfo) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
unsigned short originalInfoType = [(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue];
|
||||
unsigned short newInfoType = [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue];
|
||||
|
||||
if ([(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
|
||||
if (originalInfoType != newInfoType) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
unsigned short oldPermissions = [(NSNumber *)originalInfo[INFO_PERMISSIONS_KEY] unsignedShortValue];
|
||||
unsigned short newPermissions = [(NSNumber *)newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue];
|
||||
|
||||
if ([(NSNumber *)originalInfo[INFO_PERMISSIONS_KEY] unsignedShortValue] == [(NSNumber *)newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]) {
|
||||
if (oldPermissions == newPermissions) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
// We don't track new permissions on symbolic links that aren't the 0755 macOS default
|
||||
// Some linux / remotely mounted filesystems may not track permissions on symlinks and use 0777
|
||||
// We don't want to pick up bad permissions
|
||||
if (newInfoType == FTS_SL && newPermissions != VALID_SYMBOLIC_LINK_PERMISSIONS) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
static xar_file_t _xarAddFile(NSMutableDictionary<NSString *, NSValue *> *fileTable, xar_t x, NSString *relativePath, NSString *filePath)
|
||||
#define MIN_SIZE_FOR_CLONE 4096
|
||||
#define MIN_SIZE_FOR_CLONE_DIFF (4096 * 4)
|
||||
static NSString *cloneableRelativePath(NSDictionary<NSString *, NSData *> *afterFileKeyToHashDictionary, NSDictionary<NSData *, NSArray<NSString *> *> *beforeHashToFileKeyDictionary, NSDictionary<NSString *, NSString *> *frameworkVersionsSubstitutes, NSDictionary<NSString *, NSString *> *fileSubstitutes, NSDictionary *originalTreeState, NSDictionary *newInfo, NSString *key, NSNumber * __autoreleasing *outNewPermissions, BOOL *clonePermissionsChanged, BOOL *clonedBinaryDiff)
|
||||
{
|
||||
NSArray<NSString *> *rootRelativePathComponents = relativePath.pathComponents;
|
||||
// Relative path must at least have starting "/" component and one more path component
|
||||
if (rootRelativePathComponents.count < 2) {
|
||||
return NULL;
|
||||
// Avoid clones for small files. Small files can compress very well, sometimes better than tracking clones.
|
||||
if ([(NSNumber *)newInfo[INFO_SIZE_KEY] unsignedLongLongValue] <= MIN_SIZE_FOR_CLONE) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSArray<NSString *> *relativePathComponents = [rootRelativePathComponents subarrayWithRange:NSMakeRange(1, rootRelativePathComponents.count - 1)];
|
||||
if ([(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue] != FTS_F) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSUInteger relativePathComponentsCount = relativePathComponents.count;
|
||||
|
||||
// Build parent files as needed until we get to our final file we want to add
|
||||
// So if we get "Contents/Resources/foo.txt", we will first add "Contents" parent,
|
||||
// then "Resources" parent, then "foo.txt" as the final entry we want to add
|
||||
// We store every file we add into a fileTable for easy referencing
|
||||
// Note if a diff has Contents/Resources/foo/ and Contents/Resources/foo/bar.txt,
|
||||
// due to sorting order we will add the foo directory first and won't end up with
|
||||
// mis-ordering bugs
|
||||
xar_file_t lastParent = NULL;
|
||||
for (NSUInteger componentIndex = 0; componentIndex < relativePathComponentsCount; componentIndex++) {
|
||||
NSArray<NSString *> *subpathComponents = [relativePathComponents subarrayWithRange:NSMakeRange(0, componentIndex + 1)];
|
||||
NSString *subpathKey = [subpathComponents componentsJoinedByString:@"/"];
|
||||
|
||||
xar_file_t cachedFile = [fileTable[subpathKey] pointerValue];
|
||||
if (cachedFile != NULL) {
|
||||
lastParent = cachedFile;
|
||||
} else {
|
||||
xar_file_t newParent;
|
||||
|
||||
BOOL atLastIndex = (componentIndex == relativePathComponentsCount - 1);
|
||||
|
||||
NSString *lastPathComponent = subpathComponents.lastObject;
|
||||
if (atLastIndex && filePath != nil) {
|
||||
newParent = xar_add_frompath(x, lastParent, lastPathComponent.fileSystemRepresentation, filePath.fileSystemRepresentation);
|
||||
} else {
|
||||
newParent = xar_add_frombuffer(x, lastParent, lastPathComponent.fileSystemRepresentation, "", 1);
|
||||
{
|
||||
NSData *keyHash = afterFileKeyToHashDictionary[key];
|
||||
if (keyHash != nil) {
|
||||
// Check for identical clones first
|
||||
for (NSString *oldRelativePath in beforeHashToFileKeyDictionary[keyHash]) {
|
||||
NSDictionary *oldCloneInfo = originalTreeState[oldRelativePath];
|
||||
if (oldCloneInfo == nil) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ([(NSNumber *)oldCloneInfo[INFO_TYPE_KEY] unsignedShortValue] != FTS_F) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSString *clonePath = oldCloneInfo[INFO_PATH_KEY];
|
||||
NSString *newPath = newInfo[INFO_PATH_KEY];
|
||||
|
||||
if (![[NSFileManager defaultManager] contentsEqualAtPath:clonePath andPath:newPath]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSNumber *newPermissions = newInfo[INFO_PERMISSIONS_KEY];
|
||||
if (outNewPermissions != NULL) {
|
||||
*outNewPermissions = newPermissions;
|
||||
}
|
||||
|
||||
if (clonePermissionsChanged != NULL) {
|
||||
*clonePermissionsChanged = ([(NSNumber *)oldCloneInfo[INFO_PERMISSIONS_KEY] unsignedShortValue] != [newPermissions unsignedShortValue]);
|
||||
}
|
||||
|
||||
if (clonedBinaryDiff != NULL) {
|
||||
*clonedBinaryDiff = NO;
|
||||
}
|
||||
|
||||
return oldRelativePath;
|
||||
}
|
||||
|
||||
lastParent = newParent;
|
||||
fileTable[subpathKey] = [NSValue valueWithPointer:newParent];
|
||||
}
|
||||
}
|
||||
return lastParent;
|
||||
|
||||
// For non-identical files where we do a binary diff, make sure file size matches a more strict file size test
|
||||
if ([(NSNumber *)newInfo[INFO_SIZE_KEY] unsignedLongLongValue] <= MIN_SIZE_FOR_CLONE_DIFF) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Look out for any .framework/Versions/{A -> B} changes
|
||||
for (NSString *frameworkVersionPrefix in frameworkVersionsSubstitutes) {
|
||||
if (![key hasPrefix:frameworkVersionPrefix]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSString *cloneFrameworkSubstitutePrefix = frameworkVersionsSubstitutes[frameworkVersionPrefix];
|
||||
if (cloneFrameworkSubstitutePrefix == nil) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSString *cloneRelativeKey = [key stringByReplacingCharactersInRange:NSMakeRange(0, frameworkVersionPrefix.length) withString:cloneFrameworkSubstitutePrefix];
|
||||
|
||||
NSDictionary *oldCloneInfo = originalTreeState[cloneRelativeKey];
|
||||
if (oldCloneInfo == nil) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSNumber *newPermissions = newInfo[INFO_PERMISSIONS_KEY];
|
||||
if (outNewPermissions != NULL) {
|
||||
*outNewPermissions = newPermissions;
|
||||
}
|
||||
|
||||
if (clonePermissionsChanged != NULL) {
|
||||
*clonePermissionsChanged = ([(NSNumber *)oldCloneInfo[INFO_PERMISSIONS_KEY] unsignedShortValue] != [newPermissions unsignedShortValue]);
|
||||
}
|
||||
|
||||
if (clonedBinaryDiff != NULL) {
|
||||
*clonedBinaryDiff = YES;
|
||||
}
|
||||
|
||||
return cloneRelativeKey;
|
||||
}
|
||||
|
||||
// Look out for any changes that involve the same named file moving to another directory
|
||||
do {
|
||||
NSString *cloneRelativeKey = fileSubstitutes[key.lastPathComponent];
|
||||
if (cloneRelativeKey == nil) {
|
||||
break;
|
||||
}
|
||||
|
||||
NSDictionary *oldCloneInfo = originalTreeState[cloneRelativeKey];
|
||||
if (oldCloneInfo == nil) {
|
||||
break;
|
||||
}
|
||||
|
||||
uint64_t cloneSize = [(NSNumber *)oldCloneInfo[INFO_SIZE_KEY] unsignedLongValue];
|
||||
uint64_t newSize = [(NSNumber *)newInfo[INFO_SIZE_KEY] unsignedLongValue];
|
||||
uint64_t minSize = MIN(cloneSize, newSize);
|
||||
uint64_t maxSize = MAX(cloneSize, newSize);
|
||||
|
||||
// Ensure file is at least 60% the same size
|
||||
if (minSize == 0 || maxSize == 0 || (double)minSize / (double)maxSize < 0.60) {
|
||||
break;
|
||||
}
|
||||
|
||||
NSNumber *newPermissions = newInfo[INFO_PERMISSIONS_KEY];
|
||||
if (outNewPermissions != NULL) {
|
||||
*outNewPermissions = newPermissions;
|
||||
}
|
||||
|
||||
if (clonePermissionsChanged != NULL) {
|
||||
*clonePermissionsChanged = ([(NSNumber *)oldCloneInfo[INFO_PERMISSIONS_KEY] unsignedShortValue] != [newPermissions unsignedShortValue]);
|
||||
}
|
||||
|
||||
if (clonedBinaryDiff != NULL) {
|
||||
*clonedBinaryDiff = YES;
|
||||
}
|
||||
|
||||
return cloneRelativeKey;
|
||||
} while (NO);
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchFile, SUBinaryDeltaMajorVersion majorVersion, BOOL verbose, NSError *__autoreleasing *error)
|
||||
BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchFile, SUBinaryDeltaMajorVersion majorVersion, SPUDeltaCompressionMode compression, uint8_t compressionLevel, BOOL verbose, NSError *__autoreleasing *error)
|
||||
{
|
||||
assert(source);
|
||||
assert(destination);
|
||||
assert(patchFile);
|
||||
assert(majorVersion >= FIRST_DELTA_DIFF_MAJOR_VERSION && majorVersion <= LATEST_DELTA_DIFF_MAJOR_VERSION);
|
||||
assert(majorVersion >= SUBinaryDeltaMajorVersionFirst && majorVersion <= SUBinaryDeltaMajorVersionLatest);
|
||||
|
||||
int minorVersion = latestMinorVersionForMajorVersion(majorVersion);
|
||||
uint16_t minorVersion = latestMinorVersionForMajorVersion(majorVersion);
|
||||
|
||||
NSMutableDictionary *originalTreeState = [NSMutableDictionary dictionary];
|
||||
|
||||
@@ -323,7 +426,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
fprintf(stderr, "Creating version %u.%u patch...\n", majorVersion, minorVersion);
|
||||
fprintf(stderr, "Creating version %u.%u patch using %s compression...\n", majorVersion, minorVersion, deltaCompressionStringFromMode(compression).UTF8String);
|
||||
fprintf(stderr, "Processing source, %s...", [source fileSystemRepresentation]);
|
||||
}
|
||||
|
||||
@@ -337,6 +440,16 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
||||
if (![key length]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ([key isEqualToString:CUSTOM_ICON_PATH]) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Diffing bundles with a custom icon set via a resource fork is not supported. Detected presence of %@", @(ent->fts_path)] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSDictionary *info = infoForFile(ent);
|
||||
if (!info) {
|
||||
@@ -350,6 +463,20 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
||||
}
|
||||
originalTreeState[key] = info;
|
||||
|
||||
// Ensure Sparkle executable permissions are valid
|
||||
if (ent->fts_info == FTS_F && [key.lastPathComponent isEqualToString:@"Sparkle"] && [key.stringByDeletingLastPathComponent.stringByDeletingLastPathComponent.stringByDeletingLastPathComponent.lastPathComponent isEqualToString:@"Sparkle.framework"]) {
|
||||
mode_t permissions = (mode_t)[(NSNumber *)info[INFO_PERMISSIONS_KEY] shortValue];
|
||||
if (permissions != VALID_SPARKLE_EXECUTABLE_PERMISSIONS) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Permissions for Sparkle executable must be 0%o (found 0%o) on file %@", VALID_SPARKLE_EXECUTABLE_PERMISSIONS, permissions, @(ent->fts_path)] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
if (aclExists(ent)) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
@@ -372,9 +499,11 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
||||
}
|
||||
fts_close(fts);
|
||||
|
||||
NSString *beforeHash = hashOfTreeWithVersion(source, majorVersion);
|
||||
|
||||
if (!beforeHash) {
|
||||
// This dictionary will help us keep track of clones
|
||||
NSMutableDictionary<NSData *, NSMutableArray<NSString *> *> *beforeHashToFileKeyDictionary = MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion3) ? [NSMutableDictionary dictionary] : nil;
|
||||
|
||||
unsigned char beforeHash[CC_SHA1_DIGEST_LENGTH] = {0};
|
||||
if (!getRawHashOfTreeAndFileTablesWithVersion(beforeHash, source, majorVersion, beforeHashToFileKeyDictionary, nil)) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
@@ -412,7 +541,11 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
bool foundFilesystemCompression = false;
|
||||
|
||||
uint32_t warningsCount = 0;
|
||||
const uint32_t maxWarningsToPrint = 16;
|
||||
while ((ent = fts_read(fts))) {
|
||||
if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D) {
|
||||
continue;
|
||||
@@ -422,6 +555,16 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
||||
if (![key length]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ([key isEqualToString:CUSTOM_ICON_PATH]) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Diffing bundles with a custom icon set via a resource fork is not supported. Detected presence of %@", @(ent->fts_path)] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSDictionary *info = infoForFile(ent);
|
||||
if (!info) {
|
||||
@@ -434,23 +577,24 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
||||
return NO;
|
||||
}
|
||||
|
||||
// We should validate permissions and ACLs even if we don't store the info in the diff in the case of ACLs,
|
||||
// or in the case of permissions if the patch version is 1
|
||||
|
||||
// Ensure Sparkle executable permissions are valid
|
||||
if (ent->fts_info == FTS_F && [key.lastPathComponent isEqualToString:@"Sparkle"] && [key.stringByDeletingLastPathComponent.stringByDeletingLastPathComponent.stringByDeletingLastPathComponent.lastPathComponent isEqualToString:@"Sparkle.framework"]) {
|
||||
mode_t permissions = (mode_t)[(NSNumber *)info[INFO_PERMISSIONS_KEY] shortValue];
|
||||
if (permissions != VALID_SPARKLE_EXECUTABLE_PERMISSIONS) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Permissions for Sparkle executable must be 0%o (found 0%o) on file %@", VALID_SPARKLE_EXECUTABLE_PERMISSIONS, permissions, @(ent->fts_path)] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
// We should validate ACLs even if we don't store the info in the diff in the case of ACLs
|
||||
// We should also not allow files with code signed extended attributes since Apple doesn't recommend inserting these
|
||||
// inside an application, and since we don't preserve extended attribitutes anyway
|
||||
|
||||
mode_t permissions = [(NSNumber*)info[INFO_PERMISSIONS_KEY] unsignedShortValue];
|
||||
if (!isSymLink(ent) && !IS_VALID_PERMISSIONS(permissions)) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Invalid file permissions after-tree on file %@ (only permissions with modes 0755 and 0644 are supported)", @(ent->fts_path)] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (aclExists(ent)) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
@@ -470,10 +614,50 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (warningsCount < maxWarningsToPrint) {
|
||||
uint16_t permissions = (ent->fts_statp->st_mode & PERMISSION_FLAGS);
|
||||
if (ent->fts_info == FTS_SL) {
|
||||
if (permissions != VALID_SYMBOLIC_LINK_PERMISSIONS) {
|
||||
fprintf(stderr, "\nWarning: file permissions 0%o of symbolic link '%s' won't be preserved in the delta update (only permissions with mode 0755 are supported for symbolic links).", permissions, ent->fts_path);
|
||||
|
||||
warningsCount++;
|
||||
}
|
||||
} else if (permissions != 0755 && permissions != 0644) {
|
||||
// This could indicate something is wrong inside of the bundle so it's worth warning the user about
|
||||
fprintf(stderr, "\nWarning: detected irregular file permissions 0%o for '%s'", permissions, ent->fts_path);
|
||||
|
||||
warningsCount++;
|
||||
}
|
||||
|
||||
if (warningsCount == maxWarningsToPrint) {
|
||||
fprintf(stderr, "\nWarning: encountered too many warnings.. Ignoring the rest..");
|
||||
}
|
||||
}
|
||||
|
||||
// If we find any executable files that are using file system compression, that is sufficient
|
||||
// for recording that the applier should re-apply file system compression.
|
||||
// We check for executable files because they are likely candidates to be compressed.
|
||||
if (!foundFilesystemCompression && MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion3) && ent->fts_info == FTS_F && (ent->fts_statp->st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) != 0 && (ent->fts_statp->st_flags & UF_COMPRESSED) != 0) {
|
||||
foundFilesystemCompression = true;
|
||||
|
||||
if (verbose) {
|
||||
fprintf(stderr, " File system compression detected.");
|
||||
}
|
||||
}
|
||||
|
||||
NSDictionary *oldInfo = originalTreeState[key];
|
||||
|
||||
if ([info isEqual:oldInfo]) {
|
||||
BOOL hasEqualInfo;
|
||||
if (![info isEqual:oldInfo]) {
|
||||
hasEqualInfo = NO;
|
||||
} else {
|
||||
NSString *originalPath = oldInfo[INFO_PATH_KEY];
|
||||
NSString *newPath = info[INFO_PATH_KEY];
|
||||
hasEqualInfo = [[NSFileManager defaultManager] contentsEqualAtPath:originalPath andPath:newPath];
|
||||
}
|
||||
|
||||
if (hasEqualInfo) {
|
||||
[newTreeState removeObjectForKey:key];
|
||||
} else {
|
||||
newTreeState[key] = info;
|
||||
@@ -493,8 +677,11 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
||||
}
|
||||
fts_close(fts);
|
||||
|
||||
NSString *afterHash = hashOfTreeWithVersion(destination, majorVersion);
|
||||
if (!afterHash) {
|
||||
// This dictionary will help us keep track of clones
|
||||
NSMutableDictionary<NSString *, NSData *> *afterFileKeyToHashDictionary = MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion3) ? [NSMutableDictionary dictionary] : nil;
|
||||
|
||||
unsigned char afterHash[CC_SHA1_DIGEST_LENGTH] = {0};
|
||||
if (!getRawHashOfTreeAndFileTablesWithVersion(afterHash, destination, majorVersion, nil, afterFileKeyToHashDictionary)) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
@@ -512,31 +699,27 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\nWriting to temporary file %s...", [temporaryFile fileSystemRepresentation]);
|
||||
}
|
||||
xar_t x = xar_open([temporaryFile fileSystemRepresentation], WRITE);
|
||||
if (!x) {
|
||||
|
||||
id<SPUDeltaArchiveProtocol> archive;
|
||||
if (majorVersion >= SUBinaryDeltaMajorVersion3) {
|
||||
archive = [[SPUSparkleDeltaArchive alloc] initWithPatchFileForWriting:temporaryFile];
|
||||
} else {
|
||||
archive = [[SPUXarDeltaArchive alloc] initWithPatchFileForWriting:temporaryFile];
|
||||
}
|
||||
|
||||
SPUDeltaArchiveHeader *header = [[SPUDeltaArchiveHeader alloc] initWithCompression:compression compressionLevel:compressionLevel fileSystemCompression:foundFilesystemCompression majorVersion:majorVersion minorVersion:minorVersion beforeTreeHash:beforeHash afterTreeHash:afterHash];
|
||||
|
||||
[archive writeHeader:header];
|
||||
if (archive.error != nil) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to write to %@", temporaryFile] }];
|
||||
*error = archive.error;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
xar_opt_set(x, XAR_OPT_COMPRESSION, "bzip2");
|
||||
|
||||
xar_subdoc_t attributes = xar_subdoc_new(x, BINARY_DELTA_ATTRIBUTES_KEY);
|
||||
|
||||
xar_subdoc_prop_set(attributes, MAJOR_DIFF_VERSION_KEY, [[NSString stringWithFormat:@"%u", majorVersion] UTF8String]);
|
||||
xar_subdoc_prop_set(attributes, MINOR_DIFF_VERSION_KEY, [[NSString stringWithFormat:@"%u", minorVersion] UTF8String]);
|
||||
|
||||
// Version 1 patches don't have a major or minor version field, so we need to differentiate between the hash keys
|
||||
const char *beforeHashKey = MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2) ? BEFORE_TREE_SHA1_KEY : BEFORE_TREE_SHA1_OLD_KEY;
|
||||
const char *afterHashKey = MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2) ? AFTER_TREE_SHA1_KEY : AFTER_TREE_SHA1_OLD_KEY;
|
||||
|
||||
xar_subdoc_prop_set(attributes, beforeHashKey, [beforeHash UTF8String]);
|
||||
xar_subdoc_prop_set(attributes, afterHashKey, [afterHash UTF8String]);
|
||||
|
||||
NSOperationQueue *deltaQueue = [[NSOperationQueue alloc] init];
|
||||
NSMutableArray *deltaOperations = [NSMutableArray array];
|
||||
|
||||
@@ -551,15 +734,104 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
||||
return originalTreeState[key1] ? NSOrderedAscending : NSOrderedDescending;
|
||||
}];
|
||||
|
||||
NSMutableDictionary<NSString *, NSValue *> *fileTable = [NSMutableDictionary dictionary];
|
||||
|
||||
// Using a couple of heursitics we track if files have been moved to other locations within the app bundle
|
||||
NSMutableDictionary<NSString *, NSString *> *frameworkVersionsSubstitutes = [NSMutableDictionary dictionary];
|
||||
NSMutableDictionary<NSString *, NSString *> *fileSubstitutes = [NSMutableDictionary dictionary];
|
||||
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion3)) {
|
||||
// Heuristic #1: track if an old framework version was removed and a new framework version was added
|
||||
// Keep track of these prefixes in a dictionary
|
||||
// Eg: /Contents/Frameworks/Foo.framework/Versions/B/ (new) -> /Contents/Frameworks/Foo.framework/Versions/A/ (old)
|
||||
|
||||
NSMutableDictionary<NSString *, NSString *> *oldFrameworkVersions = [NSMutableDictionary dictionary];
|
||||
for (NSString *key in keys) {
|
||||
id value = [newTreeState valueForKey:key];
|
||||
if (![(NSObject *)value isEqual:[NSNull null]]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSDictionary *originalInfo = originalTreeState[key];
|
||||
if ([(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue] != FTS_D) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSString *keyWithoutLastPathComponent = key.stringByDeletingLastPathComponent;
|
||||
|
||||
if (![keyWithoutLastPathComponent.lastPathComponent isEqualToString:@"Versions"]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSString *keyWithoutLastLastPathComponent = keyWithoutLastPathComponent.stringByDeletingLastPathComponent;
|
||||
|
||||
if (![keyWithoutLastLastPathComponent.pathExtension isEqualToString:@"framework"]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
oldFrameworkVersions[keyWithoutLastLastPathComponent] = key;
|
||||
}
|
||||
|
||||
for (NSString *key in keys) {
|
||||
id value = [newTreeState valueForKey:key];
|
||||
if ([(NSObject *)value isEqual:[NSNull null]] || originalTreeState[key] != nil) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSDictionary *newInfo = value;
|
||||
if ([(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue] != FTS_D) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSString *keyWithoutLastPathComponent = key.stringByDeletingLastPathComponent;
|
||||
|
||||
if (![keyWithoutLastPathComponent.lastPathComponent isEqualToString:@"Versions"]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSString *keyWithoutLastLastPathComponent = keyWithoutLastPathComponent.stringByDeletingLastPathComponent;
|
||||
|
||||
if (![keyWithoutLastLastPathComponent.pathExtension isEqualToString:@"framework"]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSString *oldFrameworkVersionKey = oldFrameworkVersions[keyWithoutLastLastPathComponent];
|
||||
if (oldFrameworkVersionKey == nil) {
|
||||
continue;
|
||||
}
|
||||
|
||||
frameworkVersionsSubstitutes[[key stringByAppendingString:@"/"]] = [oldFrameworkVersionKey stringByAppendingString:@"/"];
|
||||
}
|
||||
|
||||
// Heuristic #2: Keep a table of removed filenames, collapsing them by the largest file per unique name
|
||||
// This sees if a file has just been moved to another location
|
||||
for (NSString *key in keys) {
|
||||
id value = [newTreeState valueForKey:key];
|
||||
if (![(NSObject *)value isEqual:[NSNull null]]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSDictionary *keyInfo = originalTreeState[key];
|
||||
if ([(NSNumber *)keyInfo[INFO_TYPE_KEY] unsignedShortValue] != FTS_F) {
|
||||
continue;
|
||||
}
|
||||
|
||||
NSString *lastPathComponent = key.lastPathComponent;
|
||||
|
||||
NSString *existingKey = fileSubstitutes[lastPathComponent];
|
||||
if (existingKey == nil) {
|
||||
fileSubstitutes[lastPathComponent] = key;
|
||||
} else {
|
||||
NSDictionary *existingKeyInfo = originalTreeState[existingKey];
|
||||
if ([(NSNumber *)keyInfo[INFO_SIZE_KEY] unsignedLongValue] > [(NSNumber *)existingKeyInfo[INFO_SIZE_KEY] unsignedLongValue]) {
|
||||
fileSubstitutes[lastPathComponent] = key;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (NSString *key in keys) {
|
||||
id value = [newTreeState valueForKey:key];
|
||||
|
||||
if ([(NSObject *)value isEqual:[NSNull null]]) {
|
||||
xar_file_t newFile = _xarAddFile(fileTable, x, key, NULL);
|
||||
assert(newFile);
|
||||
xar_prop_set(newFile, DELETE_KEY, "true");
|
||||
[archive addItem:[[SPUDeltaArchiveItem alloc] initWithRelativeFilePath:key commands:SPUDeltaItemCommandDelete mode:0]];
|
||||
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n❌ %s %s", VERBOSE_REMOVED, [key fileSystemRepresentation]);
|
||||
@@ -570,47 +842,73 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
||||
NSDictionary *originalInfo = originalTreeState[key];
|
||||
NSDictionary *newInfo = newTreeState[key];
|
||||
if (shouldSkipDeltaCompression(originalInfo, newInfo)) {
|
||||
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2) && shouldSkipExtracting(originalInfo, newInfo)) {
|
||||
if (shouldSkipExtracting(originalInfo, newInfo)) {
|
||||
if (shouldChangePermissions(originalInfo, newInfo)) {
|
||||
xar_file_t newFile = _xarAddFile(fileTable, x, key, NULL);
|
||||
assert(newFile);
|
||||
xar_prop_set(newFile, MODIFY_PERMISSIONS_KEY, [[NSString stringWithFormat:@"%u", [(NSNumber *)newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]] UTF8String]);
|
||||
[archive addItem:[[SPUDeltaArchiveItem alloc] initWithRelativeFilePath:key commands:SPUDeltaItemCommandModifyPermissions mode:[(NSNumber *)newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]]];
|
||||
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n👮 %s %s (0%o -> 0%o)", VERBOSE_MODIFIED, [key fileSystemRepresentation], [(NSNumber *)originalInfo[INFO_PERMISSIONS_KEY] unsignedShortValue], [(NSNumber *)newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
NSString *path = [destination stringByAppendingPathComponent:key];
|
||||
xar_file_t newFile = _xarAddFile(fileTable, x, key, path);
|
||||
assert(newFile);
|
||||
|
||||
if (shouldDeleteThenExtract(originalInfo, newInfo)) {
|
||||
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2)) {
|
||||
xar_prop_set(newFile, DELETE_KEY, "true");
|
||||
// Check if the new file can be cloned from an old existing one located at a different path
|
||||
NSNumber *newPermissions = nil;
|
||||
BOOL clonePermissionsChanged = NO;
|
||||
BOOL clonedBinaryDiff = NO;
|
||||
NSString *clonedRelativePath = MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion3) ? cloneableRelativePath(afterFileKeyToHashDictionary, beforeHashToFileKeyDictionary, frameworkVersionsSubstitutes, fileSubstitutes, originalTreeState, newInfo, key, &newPermissions, &clonePermissionsChanged, &clonedBinaryDiff) : nil;
|
||||
if (clonedRelativePath != nil) {
|
||||
if (clonedBinaryDiff) {
|
||||
NSDictionary *cloneInfo = originalTreeState[clonedRelativePath];
|
||||
|
||||
CreateBinaryDeltaOperation *operation = [[CreateBinaryDeltaOperation alloc] initWithRelativePath:key clonedRelativePath:clonedRelativePath oldTree:source newTree:destination oldPermissions:cloneInfo[INFO_PERMISSIONS_KEY] newPermissions:newPermissions changingPermissions:clonePermissionsChanged];
|
||||
[deltaQueue addOperation:operation];
|
||||
[deltaOperations addObject:operation];
|
||||
} else {
|
||||
xar_prop_set(newFile, DELETE_THEN_EXTRACT_OLD_KEY, "true");
|
||||
SPUDeltaItemCommands commands = SPUDeltaItemCommandClone;
|
||||
if (clonePermissionsChanged) {
|
||||
commands |= SPUDeltaItemCommandModifyPermissions;
|
||||
}
|
||||
|
||||
SPUDeltaArchiveItem *item = [[SPUDeltaArchiveItem alloc] initWithRelativeFilePath:key commands:commands mode:(clonePermissionsChanged ? newPermissions.unsignedShortValue : 0)];
|
||||
// Physical path for clones points to the old file
|
||||
item.itemFilePath = [source stringByAppendingPathComponent:clonedRelativePath];
|
||||
item.sourcePath = item.itemFilePath;
|
||||
item.clonedRelativePath = clonedRelativePath;
|
||||
|
||||
[archive addItem:item];
|
||||
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n✂️ %s %s -> %s", VERBOSE_CLONED, [clonedRelativePath fileSystemRepresentation], [key fileSystemRepresentation]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Otherwise add a new file
|
||||
NSString *path = [destination stringByAppendingPathComponent:key];
|
||||
|
||||
SPUDeltaItemCommands commands = SPUDeltaItemCommandExtract;
|
||||
if (shouldDeleteThenExtract(originalInfo, newInfo)) {
|
||||
commands |= SPUDeltaItemCommandDelete;
|
||||
}
|
||||
|
||||
SPUDeltaArchiveItem *item = [[SPUDeltaArchiveItem alloc] initWithRelativeFilePath:key commands:commands mode:0];
|
||||
item.itemFilePath = path;
|
||||
item.sourcePath = path;
|
||||
|
||||
[archive addItem:item];
|
||||
|
||||
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2)) {
|
||||
xar_prop_set(newFile, EXTRACT_KEY, "true");
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
if (originalInfo) {
|
||||
fprintf(stderr, "\n✏️ %s %s", VERBOSE_UPDATED, [key fileSystemRepresentation]);
|
||||
} else {
|
||||
fprintf(stderr, "\n✅ %s %s", VERBOSE_ADDED, [key fileSystemRepresentation]);
|
||||
if (verbose) {
|
||||
if (originalInfo) {
|
||||
fprintf(stderr, "\n✏️ %s %s", VERBOSE_UPDATED, [key fileSystemRepresentation]);
|
||||
} else {
|
||||
fprintf(stderr, "\n✅ %s %s", VERBOSE_ADDED, [key fileSystemRepresentation]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
NSNumber *permissions =
|
||||
(MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2) && shouldChangePermissions(originalInfo, newInfo)) ?
|
||||
newInfo[INFO_PERMISSIONS_KEY] :
|
||||
nil;
|
||||
CreateBinaryDeltaOperation *operation = [[CreateBinaryDeltaOperation alloc] initWithRelativePath:key oldTree:source newTree:destination oldPermissions:originalInfo[INFO_PERMISSIONS_KEY] newPermissions:permissions];
|
||||
NSNumber *permissions = newInfo[INFO_PERMISSIONS_KEY];
|
||||
|
||||
CreateBinaryDeltaOperation *operation = [[CreateBinaryDeltaOperation alloc] initWithRelativePath:key clonedRelativePath:nil oldTree:source newTree:destination oldPermissions:originalInfo[INFO_PERMISSIONS_KEY] newPermissions:permissions changingPermissions:shouldChangePermissions(originalInfo, newInfo)];
|
||||
[deltaQueue addOperation:operation];
|
||||
[deltaOperations addObject:operation];
|
||||
}
|
||||
@@ -618,37 +916,83 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
||||
|
||||
[deltaQueue waitUntilAllOperationsAreFinished];
|
||||
|
||||
BOOL deltaOperationsFailed = NO;
|
||||
for (CreateBinaryDeltaOperation *operation in deltaOperations) {
|
||||
NSString *resultPath = [operation resultPath];
|
||||
if (!resultPath) {
|
||||
if (resultPath == nil) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to create patch from source %@ and destination %@", operation.relativePath, resultPath] }];
|
||||
}
|
||||
return NO;
|
||||
deltaOperationsFailed = YES;
|
||||
break;
|
||||
}
|
||||
|
||||
NSString *clonedRelativePath = [operation clonedRelativePath];
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n🔨 %s %s", VERBOSE_DIFFED, [[operation relativePath] fileSystemRepresentation]);
|
||||
if (clonedRelativePath == nil) {
|
||||
fprintf(stderr, "\n🔨 %s %s", VERBOSE_DIFFED, [[operation relativePath] fileSystemRepresentation]);
|
||||
} else {
|
||||
fprintf(stderr, "\n🔨 %s %s -> %s", VERBOSE_DIFFED, [clonedRelativePath fileSystemRepresentation], [[operation relativePath] fileSystemRepresentation]);
|
||||
}
|
||||
}
|
||||
|
||||
NSNumber *mode = operation.permissions;
|
||||
NSString *relativePath = operation.relativePath;
|
||||
|
||||
SPUDeltaItemCommands commands = SPUDeltaItemCommandBinaryDiff;
|
||||
if (operation.changingPermissions) {
|
||||
commands |= SPUDeltaItemCommandModifyPermissions;
|
||||
}
|
||||
if (clonedRelativePath != nil) {
|
||||
commands |= SPUDeltaItemCommandClone;
|
||||
}
|
||||
|
||||
SPUDeltaArchiveItem *item = [[SPUDeltaArchiveItem alloc] initWithRelativeFilePath:relativePath commands:commands mode:mode.unsignedShortValue];
|
||||
item.itemFilePath = resultPath;
|
||||
item.sourcePath = operation._fromPath;
|
||||
item.clonedRelativePath = clonedRelativePath;
|
||||
|
||||
[archive addItem:item];
|
||||
|
||||
xar_file_t newFile = _xarAddFile(fileTable, x, [operation relativePath], resultPath);
|
||||
assert(newFile);
|
||||
xar_prop_set(newFile, BINARY_DELTA_KEY, "true");
|
||||
unlink([resultPath fileSystemRepresentation]);
|
||||
|
||||
if (operation.permissions) {
|
||||
xar_prop_set(newFile, MODIFY_PERMISSIONS_KEY, [[NSString stringWithFormat:@"%u", [operation.permissions unsignedShortValue]] UTF8String]);
|
||||
|
||||
if (operation.changingPermissions) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n👮 %s %s (0%o -> 0%o)", VERBOSE_MODIFIED, [[operation relativePath] fileSystemRepresentation], operation.oldPermissions.unsignedShortValue, operation.permissions.unsignedShortValue);
|
||||
fprintf(stderr, "\n👮 %s %s (0%o -> 0%o)", VERBOSE_MODIFIED, relativePath.fileSystemRepresentation, operation.oldPermissions.unsignedShortValue, operation.permissions.unsignedShortValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xar_close(x);
|
||||
|
||||
if (!deltaOperationsFailed) {
|
||||
[archive finishEncodingItems];
|
||||
}
|
||||
|
||||
[archive close];
|
||||
|
||||
// Clean up operations after the archive has finished encoding
|
||||
for (CreateBinaryDeltaOperation *operation in deltaOperations) {
|
||||
NSString *resultPath = [operation resultPath];
|
||||
if (resultPath != nil) {
|
||||
unlink(resultPath.fileSystemRepresentation);
|
||||
}
|
||||
}
|
||||
|
||||
if (deltaOperationsFailed) {
|
||||
// We already set an error so let's bail
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSError *archiveError = archive.error;
|
||||
if (archiveError != nil) {
|
||||
if (verbose) {
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
if (error != NULL) {
|
||||
*error = archiveError;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSFileManager *filemgr;
|
||||
filemgr = [NSFileManager defaultManager];
|
||||
|
||||
@@ -1,246 +0,0 @@
|
||||
//
|
||||
// SUBinaryDeltaTool.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mark Rowe on 2009-06-01.
|
||||
// Copyright 2009 Mark Rowe. All rights reserved.
|
||||
//
|
||||
|
||||
#include "SUBinaryDeltaApply.h"
|
||||
#include "SUBinaryDeltaCreate.h"
|
||||
#import "SUBinaryDeltaCommon.h"
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <xar/xar.h>
|
||||
|
||||
#define VERBOSE_FLAG @"--verbose"
|
||||
#define VERSION_FLAG @"--version"
|
||||
|
||||
#define CREATE_COMMAND @"create"
|
||||
#define APPLY_COMMAND @"apply"
|
||||
#define VERSION_COMMAND @"version"
|
||||
#define VERSION_ALTERNATE_COMMAND @"--version"
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
|
||||
static void printUsage(NSString *programName)
|
||||
{
|
||||
fprintf(stderr, "Usage:\n");
|
||||
fprintf(stderr, "%s create [--verbose] [--version=<version>] <before-tree> <after-tree> <patch-file>\n", [programName UTF8String]);
|
||||
fprintf(stderr, "%s apply [--verbose] <before-tree> <after-tree> <patch-file>\n", [programName UTF8String]);
|
||||
fprintf(stderr, "%s version [<patch-file>]\n", [programName UTF8String]);
|
||||
}
|
||||
|
||||
static BOOL runCreateCommand(NSString *programName, NSArray<NSString *> *args)
|
||||
{
|
||||
if (args.count < 3 || args.count > 5) {
|
||||
printUsage(programName);
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSUInteger numberOflagsFound = 0;
|
||||
NSUInteger verboseIndex = [args indexOfObject:VERBOSE_FLAG];
|
||||
NSUInteger versionIndex = NSNotFound;
|
||||
for (NSUInteger argumentIndex = 0; argumentIndex < args.count; ++argumentIndex) {
|
||||
if ([args[argumentIndex] hasPrefix:VERSION_FLAG]) {
|
||||
versionIndex = argumentIndex;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (verboseIndex != NSNotFound) {
|
||||
++numberOflagsFound;
|
||||
}
|
||||
if (versionIndex != NSNotFound) {
|
||||
++numberOflagsFound;
|
||||
}
|
||||
|
||||
if (args.count - numberOflagsFound < 3) {
|
||||
printUsage(programName);
|
||||
return NO;
|
||||
}
|
||||
|
||||
BOOL verbose = (verboseIndex != NSNotFound);
|
||||
NSString *versionField = (versionIndex != NSNotFound) ? args[versionIndex] : nil;
|
||||
|
||||
NSArray<NSString *> *versionComponents = nil;
|
||||
if (versionField) {
|
||||
versionComponents = [versionField componentsSeparatedByString:@"="];
|
||||
if (versionComponents.count != 2) {
|
||||
printUsage(programName);
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
SUBinaryDeltaMajorVersion patchVersion =
|
||||
!versionComponents ?
|
||||
LATEST_DELTA_DIFF_MAJOR_VERSION :
|
||||
(SUBinaryDeltaMajorVersion)[[versionComponents[1] componentsSeparatedByString:@"."][0] intValue]; // ignore minor version if provided
|
||||
|
||||
if (patchVersion < FIRST_DELTA_DIFF_MAJOR_VERSION) {
|
||||
fprintf(stderr, "Version provided (%u) is not valid\n", patchVersion);
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (patchVersion > LATEST_DELTA_DIFF_MAJOR_VERSION) {
|
||||
fprintf(stderr, "This program is too old to create a version %u patch, or the version number provided is invalid\n", patchVersion);
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSMutableArray *fileArgs = [NSMutableArray array];
|
||||
for (NSString *argument in args) {
|
||||
if (![argument hasPrefix:VERSION_FLAG] && ![argument isEqualToString:VERBOSE_FLAG]) {
|
||||
[fileArgs addObject:argument];
|
||||
}
|
||||
}
|
||||
|
||||
if (fileArgs.count != 3) {
|
||||
printUsage(programName);
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSString *sourcePath = fileArgs[0];
|
||||
NSString *destPath = fileArgs[1];
|
||||
NSString *patchPath = fileArgs[2];
|
||||
|
||||
BOOL isDirectory;
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:sourcePath isDirectory:&isDirectory] || !isDirectory) {
|
||||
printUsage(programName);
|
||||
fprintf(stderr, "Error: before-tree must be a directory\n");
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:destPath isDirectory:&isDirectory] || !isDirectory) {
|
||||
printUsage(programName);
|
||||
fprintf(stderr, "Error: after-tree must be a directory\n");
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSError *createDiffError = nil;
|
||||
if (!createBinaryDelta(sourcePath, destPath, patchPath, patchVersion, verbose, &createDiffError)) {
|
||||
fprintf(stderr, "%s\n", [createDiffError.localizedDescription UTF8String]);
|
||||
return NO;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
static BOOL runApplyCommand(NSString *programName, NSArray *args)
|
||||
{
|
||||
if (args.count < 3 || args.count > 4) {
|
||||
printUsage(programName);
|
||||
return NO;
|
||||
}
|
||||
|
||||
BOOL verbose = [args containsObject:VERBOSE_FLAG];
|
||||
|
||||
if (args.count == 4 && !verbose) {
|
||||
printUsage(programName);
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSMutableArray *fileArgs = [NSMutableArray array];
|
||||
for (NSString *argument in args) {
|
||||
if (![argument isEqualToString:VERBOSE_FLAG]) {
|
||||
[fileArgs addObject:argument];
|
||||
}
|
||||
}
|
||||
|
||||
if (fileArgs.count != 3) {
|
||||
printUsage(programName);
|
||||
return NO;
|
||||
}
|
||||
|
||||
BOOL isDirectory;
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:fileArgs[0] isDirectory:&isDirectory] || !isDirectory) {
|
||||
printUsage(programName);
|
||||
fprintf(stderr, "Error: before-tree must be a directory\n");
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (![[NSFileManager defaultManager] fileExistsAtPath:fileArgs[2] isDirectory:&isDirectory] || isDirectory) {
|
||||
printUsage(programName);
|
||||
fprintf(stderr, "Error: patch-file must be a file %d\n", isDirectory);
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSError *applyDiffError = nil;
|
||||
if (!applyBinaryDelta(fileArgs[0], fileArgs[1], fileArgs[2], verbose, ^(__unused double x){}, &applyDiffError)) {
|
||||
fprintf(stderr, "%s\n", [applyDiffError.localizedDescription UTF8String]);
|
||||
return NO;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
static BOOL runVersionCommand(NSString *programName, NSArray *args)
|
||||
{
|
||||
if (args.count > 1) {
|
||||
printUsage(programName);
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (args.count == 0) {
|
||||
fprintf(stdout, "%u.%u\n", LATEST_DELTA_DIFF_MAJOR_VERSION, latestMinorVersionForMajorVersion(LATEST_DELTA_DIFF_MAJOR_VERSION));
|
||||
} else {
|
||||
NSString *patchFile = args[0];
|
||||
xar_t x = xar_open([patchFile fileSystemRepresentation], READ);
|
||||
if (!x) {
|
||||
fprintf(stderr, "Unable to open patch %s\n", [patchFile fileSystemRepresentation]);
|
||||
return NO;
|
||||
}
|
||||
|
||||
SUBinaryDeltaMajorVersion majorDiffVersion = FIRST_DELTA_DIFF_MAJOR_VERSION;
|
||||
int minorDiffVersion = 0;
|
||||
|
||||
xar_subdoc_t subdoc;
|
||||
for (subdoc = xar_subdoc_first(x); subdoc; subdoc = xar_subdoc_next(subdoc)) {
|
||||
if (!strcmp(xar_subdoc_name(subdoc), BINARY_DELTA_ATTRIBUTES_KEY)) {
|
||||
const char *value = 0;
|
||||
|
||||
// available in version 2.0 or later
|
||||
xar_subdoc_prop_get(subdoc, MAJOR_DIFF_VERSION_KEY, &value);
|
||||
if (value)
|
||||
majorDiffVersion = (SUBinaryDeltaMajorVersion)[@(value) intValue];
|
||||
|
||||
// available in version 2.0 or later
|
||||
xar_subdoc_prop_get(subdoc, MINOR_DIFF_VERSION_KEY, &value);
|
||||
if (value)
|
||||
minorDiffVersion = [@(value) intValue];
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stdout, "%u.%u\n", majorDiffVersion, minorDiffVersion);
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
int main(int __unused argc, char __unused *argv[])
|
||||
{
|
||||
@autoreleasepool {
|
||||
NSArray<NSString *> *args = [[NSProcessInfo processInfo] arguments];
|
||||
NSString *programName = [args[0] lastPathComponent];
|
||||
|
||||
if (args.count < 2) {
|
||||
printUsage(programName);
|
||||
return 1;
|
||||
}
|
||||
|
||||
NSString *command = args[1];
|
||||
NSArray *commandArguments = [args subarrayWithRange:NSMakeRange(2, args.count - 2)];
|
||||
|
||||
BOOL result;
|
||||
if ([command isEqualToString:CREATE_COMMAND]) {
|
||||
result = runCreateCommand(programName, commandArguments);
|
||||
} else if ([command isEqualToString:APPLY_COMMAND]) {
|
||||
result = runApplyCommand(programName, commandArguments);
|
||||
} else if ([command isEqualToString:VERSION_COMMAND] || [command isEqualToString:VERSION_ALTERNATE_COMMAND]) {
|
||||
result = runVersionCommand(programName, commandArguments);
|
||||
} else {
|
||||
result = NO;
|
||||
printUsage(programName);
|
||||
}
|
||||
|
||||
return result ? 0 : 1;
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,14 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface SUCodeSigningVerifier : NSObject
|
||||
|
||||
+ (BOOL)codeSignatureAtBundleURL:(NSURL *)oldBundleURL matchesSignatureAtBundleURL:(NSURL *)newBundleURL error:(NSError **)error;
|
||||
+ (BOOL)codeSignatureIsValidAtBundleURL:(NSURL *)bundleURL error:(NSError **)error;
|
||||
|
||||
+ (BOOL)codeSignatureIsValidAtBundleURL:(NSURL *)bundleURL checkNestedCode:(BOOL)checkNestedCode error:(NSError **)error;
|
||||
|
||||
// Same as above except does not check for nested code. This method should be used by the framework.
|
||||
+ (BOOL)codeSignatureIsValidAtBundleURL:(NSURL *)bundleURL error:(NSError *__autoreleasing *)error;
|
||||
|
||||
+ (BOOL)bundleAtURLIsCodeSigned:(NSURL *)bundleURL;
|
||||
@end
|
||||
|
||||
|
||||
@@ -127,6 +127,11 @@ finally:
|
||||
}
|
||||
|
||||
+ (BOOL)codeSignatureIsValidAtBundleURL:(NSURL *)bundleURL error:(NSError *__autoreleasing *)error
|
||||
{
|
||||
return [self codeSignatureIsValidAtBundleURL:bundleURL checkNestedCode:NO error:error];
|
||||
}
|
||||
|
||||
+ (BOOL)codeSignatureIsValidAtBundleURL:(NSURL *)bundleURL checkNestedCode:(BOOL)checkNestedCode error:(NSError *__autoreleasing *)error
|
||||
{
|
||||
OSStatus result;
|
||||
SecStaticCodeRef staticCode = NULL;
|
||||
@@ -143,8 +148,12 @@ finally:
|
||||
goto finally;
|
||||
}
|
||||
|
||||
// See in -codeSignatureAtBundleURL:matchesSignatureAtBundleURL:error: for why kSecCSCheckNestedCode is not passed
|
||||
// See in -codeSignatureAtBundleURL:matchesSignatureAtBundleURL:error: for why kSecCSCheckNestedCode is not always passed
|
||||
SecCSFlags flags = (SecCSFlags) (kSecCSDefaultFlags | kSecCSCheckAllArchitectures);
|
||||
if (checkNestedCode) {
|
||||
flags |= kSecCSCheckNestedCode;
|
||||
}
|
||||
|
||||
result = SecStaticCodeCheckValidityWithErrors(staticCode, flags, NULL, &cfError);
|
||||
|
||||
if (result != errSecSuccess) {
|
||||
|
||||
@@ -191,13 +191,13 @@
|
||||
NSString *fromPath = [mountPoint stringByAppendingPathComponent:item];
|
||||
NSString *toPath = [[self.archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:item];
|
||||
|
||||
// We skip any files in the DMG which are not readable.
|
||||
itemsCopied += 1.0;
|
||||
[notifier notifyProgress:0.5 + itemsCopied/(totalItems*2.0)];
|
||||
|
||||
// We skip any files in the DMG which are not readable but include the item in the progress
|
||||
if (![manager isReadableFileAtPath:fromPath]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
itemsCopied += 1.0;
|
||||
[notifier notifyProgress:0.5 + itemsCopied/(totalItems*2.0)];
|
||||
|
||||
SULog(SULogLevelDefault, @"copyItemAtPath:%@ toPath:%@", fromPath, toPath);
|
||||
|
||||
|
||||
@@ -265,6 +265,9 @@
|
||||
return NO;
|
||||
}
|
||||
|
||||
// Sparkle's DSA support is deprecated
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
__block SecGroupTransformRef group = SecTransformCreateGroupTransform();
|
||||
__block SecTransformRef dataReadTransform = NULL;
|
||||
__block SecTransformRef dataDigestTransform = NULL;
|
||||
@@ -297,7 +300,7 @@
|
||||
|
||||
return cleanup();
|
||||
}
|
||||
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
|
||||
dataVerifyTransform = SecVerifyTransformCreate(dsaPubKeySecKey, (__bridge CFDataRef)dsaSignature, &error);
|
||||
@@ -317,8 +320,12 @@
|
||||
|
||||
return cleanup();
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
SecTransformConnectTransforms(dataReadTransform, kSecTransformOutputAttributeName, dataDigestTransform, kSecTransformInputAttributeName, group, &error);
|
||||
#pragma clang diagnostic pop
|
||||
if (error) {
|
||||
if (outError != NULL) {
|
||||
*outError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{NSLocalizedDescriptionKey : @"Failed to connect data read transform", NSUnderlyingErrorKey: (__bridge NSError *)error}];
|
||||
@@ -327,7 +334,10 @@
|
||||
return cleanup();
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
SecTransformConnectTransforms(dataDigestTransform, kSecTransformOutputAttributeName, dataVerifyTransform, kSecTransformInputAttributeName, group, &error);
|
||||
#pragma clang diagnostic pop
|
||||
if (error) {
|
||||
if (outError != NULL) {
|
||||
*outError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{NSLocalizedDescriptionKey : @"Failed to connect data digest transform", NSUnderlyingErrorKey: (__bridge NSError *)error}];
|
||||
@@ -336,7 +346,10 @@
|
||||
return cleanup();
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
NSNumber *result = CFBridgingRelease(SecTransformExecute(group, &error));
|
||||
#pragma clang diagnostic pop
|
||||
if (error) {
|
||||
SULog(SULogLevelError, @"DSA signature verification failed: %@", error);
|
||||
if (outError != NULL) {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
//
|
||||
// Use this file to import your target's public headers that you would like to expose to Swift.
|
||||
//
|
||||
|
||||
#import "SUBinaryDeltaApply.h"
|
||||
#import "SUBinaryDeltaCreate.h"
|
||||
#import "SPUDeltaArchive.h"
|
||||
#import "SPUDeltaArchiveProtocol.h"
|
||||
@@ -0,0 +1,228 @@
|
||||
//
|
||||
// main.swift
|
||||
// BinaryDelta
|
||||
//
|
||||
// Created by Mayur Pawashe on 1/3/22.
|
||||
// Copyright © 2022 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import ArgumentParser
|
||||
|
||||
// Create a patch from an old and new bundle
|
||||
struct Create: ParsableCommand {
|
||||
@Option(name: .long, help: ArgumentHelp("The major version of the patch to generate. Defaults to the latest stable version. Older versions will need to be specified for updating from applications using older versions of Sparkle.", valueName: "version"))
|
||||
var version: Int = Int(SUBinaryDeltaMajorVersionDefault.rawValue)
|
||||
|
||||
@Flag(name: .customLong("verbose"), help: ArgumentHelp("Enable logging of the changes being archived into the generated patch."))
|
||||
var verbose: Bool = false
|
||||
|
||||
@Option(name: .long, help: ArgumentHelp(COMPRESSION_METHOD_ARGUMENT_DESCRIPTION, valueName: "compression"))
|
||||
var compression: String = "default"
|
||||
|
||||
@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."))
|
||||
var beforeTree: String
|
||||
|
||||
@Argument(help: ArgumentHelp("Path to new bundle to create a patch from."))
|
||||
var afterTree: String
|
||||
|
||||
@Argument(help: ArgumentHelp("Path to new patch file to create."))
|
||||
var patchFile: String
|
||||
|
||||
func validate() throws {
|
||||
var validCompression: ObjCBool = false
|
||||
let compressionMode = deltaCompressionModeFromDescription(compression, &validCompression)
|
||||
guard validCompression.boolValue else {
|
||||
fputs("Error: unrecognized compression \(compression)\n", stderr)
|
||||
throw ExitCode(1)
|
||||
}
|
||||
|
||||
switch compressionMode {
|
||||
case SPUDeltaCompressionModeDefault:
|
||||
fallthrough
|
||||
case .none:
|
||||
guard compressionLevel == 0 else {
|
||||
fputs("Error: compression level must be 0 for compression \(compression)\n", stderr)
|
||||
throw ExitCode(1)
|
||||
}
|
||||
break
|
||||
case .bzip2:
|
||||
guard compressionLevel >= 0 && compressionLevel <= 9 else {
|
||||
fputs("Error: compression level \(compressionLevel) is not valid.\n", stderr)
|
||||
throw ExitCode(1)
|
||||
}
|
||||
break
|
||||
case .LZMA:
|
||||
fallthrough
|
||||
case .LZFSE:
|
||||
fallthrough
|
||||
case .LZ4:
|
||||
fallthrough
|
||||
case .ZLIB:
|
||||
guard version >= 3 else {
|
||||
fputs("Error: version \(version) patch files do not support compression \(compression)\n", stderr)
|
||||
throw ExitCode(1)
|
||||
}
|
||||
|
||||
guard compressionLevel == 0 else {
|
||||
fputs("Error: compression level provided must be 0 for compression \(compression)\n", stderr)
|
||||
throw ExitCode(1)
|
||||
}
|
||||
break
|
||||
@unknown default:
|
||||
fputs("Error: unrecognized compression \(compression)\n", stderr)
|
||||
throw ExitCode(1)
|
||||
}
|
||||
|
||||
guard version >= SUBinaryDeltaMajorVersionFirst.rawValue else {
|
||||
fputs("Error: version provided \(version) is not valid.\n", stderr)
|
||||
throw ExitCode(1)
|
||||
}
|
||||
|
||||
guard version >= SUBinaryDeltaMajorVersionFirstSupported.rawValue else {
|
||||
fputs("Error: creating version \(version) patches is no longer supported.\n", stderr)
|
||||
throw ExitCode(1)
|
||||
}
|
||||
|
||||
guard version <= SUBinaryDeltaMajorVersionLatest.rawValue else {
|
||||
fputs("Error: this program is too old to create a version \(version) patch, or the version number provided is invalid.\n", stderr)
|
||||
throw ExitCode(1)
|
||||
}
|
||||
|
||||
let fileManager = FileManager.default
|
||||
|
||||
var isDirectory: ObjCBool = false
|
||||
if !fileManager.fileExists(atPath: beforeTree, isDirectory: &isDirectory) || !isDirectory.boolValue {
|
||||
fputs("Error: before-tree must be a directory\n", stderr)
|
||||
throw ExitCode(1)
|
||||
}
|
||||
|
||||
if !fileManager.fileExists(atPath: afterTree, isDirectory: &isDirectory) || !isDirectory.boolValue {
|
||||
fputs("Error: after-tree must be a directory\n", stderr)
|
||||
throw ExitCode(1)
|
||||
}
|
||||
}
|
||||
|
||||
func run() throws {
|
||||
let compressionMode = deltaCompressionModeFromDescription(compression, nil)
|
||||
|
||||
guard let majorDeltaVersion = SUBinaryDeltaMajorVersion(rawValue: UInt16(version)) else {
|
||||
// We shouldn't reach here
|
||||
fputs("Error: failed to retrieve major version from provided version: \(version)\n", stderr)
|
||||
throw ExitCode(1)
|
||||
}
|
||||
|
||||
var createDiffError: NSError? = nil
|
||||
if !createBinaryDelta(beforeTree, afterTree, patchFile, majorDeltaVersion, compressionMode, compressionLevel, verbose, &createDiffError) {
|
||||
if let error = createDiffError {
|
||||
fputs("\(error.localizedDescription)\n", stderr)
|
||||
} else {
|
||||
fputs("Error: Failed to create patch due to unknown reason.\n", stderr)
|
||||
}
|
||||
throw ExitCode(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Apply a patch from an old bundle to generate a new bundle
|
||||
struct Apply: ParsableCommand {
|
||||
static let configuration = CommandConfiguration(abstract: "Apply a patch against an original bundle to generate a new bundle.")
|
||||
|
||||
@Flag(name: .customLong("verbose"), help: ArgumentHelp("Enable logging of changes being applied from the patch."))
|
||||
var verbose: Bool = false
|
||||
|
||||
@Argument(help: ArgumentHelp("Path to original bundle to patch."))
|
||||
var beforeTree: String
|
||||
|
||||
@Argument(help: ArgumentHelp("Path to new bundle to create."))
|
||||
var afterTree: String
|
||||
|
||||
@Argument(help: ArgumentHelp("Path to patch file to apply."))
|
||||
var patchFile: String
|
||||
|
||||
func validate() throws {
|
||||
let fileManager = FileManager.default
|
||||
|
||||
var isDirectory: ObjCBool = false
|
||||
if !fileManager.fileExists(atPath: beforeTree, isDirectory: &isDirectory) || !isDirectory.boolValue {
|
||||
fputs("Error: before-tree must be a directory\n", stderr)
|
||||
throw ExitCode(1)
|
||||
}
|
||||
|
||||
if !fileManager.fileExists(atPath: patchFile, isDirectory: &isDirectory) || isDirectory.boolValue {
|
||||
fputs("Error: patch-file must be a file\n", stderr)
|
||||
throw ExitCode(1)
|
||||
}
|
||||
}
|
||||
|
||||
func run() throws {
|
||||
var applyDiffError: NSError?
|
||||
if (!applyBinaryDelta(beforeTree, afterTree, patchFile, verbose, { _ in }, &applyDiffError)) {
|
||||
if let error = applyDiffError {
|
||||
fputs("\(error.localizedDescription)\n", stderr)
|
||||
} else {
|
||||
fputs("Error: patch failed to apply for unknown reason\n", stderr)
|
||||
}
|
||||
throw ExitCode(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Output information for BinaryDelta or from a patch file
|
||||
struct Info: ParsableCommand {
|
||||
@Argument(help: ArgumentHelp("Path to patch file to extract information from."))
|
||||
var patchFile : String?
|
||||
|
||||
func run() throws {
|
||||
if let patchFile = patchFile {
|
||||
// Print version of patch file
|
||||
var header: SPUDeltaArchiveHeader? = nil
|
||||
let archive = SPUDeltaArchiveReadPatchAndHeader(patchFile, &header)
|
||||
if let error = archive.error {
|
||||
fputs("Error: Unable to open patch \(patchFile): \(error.localizedDescription)\n", stderr)
|
||||
throw ExitCode(1)
|
||||
}
|
||||
|
||||
if let header = header {
|
||||
if header.majorVersion < SUBinaryDeltaMajorVersionFirst.rawValue {
|
||||
fputs("Error: major version \(header.majorVersion) is invalid.\n", stderr)
|
||||
throw ExitCode(1)
|
||||
}
|
||||
|
||||
fputs("Patch version \(header.majorVersion).\(header.minorVersion)", stdout)
|
||||
|
||||
// Print out compression info only if it's available
|
||||
// We can't get compression info from version 2 files
|
||||
if header.compression != SPUDeltaCompressionModeDefault, let compressionDescription = deltaCompressionStringFromMode(header.compression) {
|
||||
fputs(" using \(compressionDescription) compression", stdout)
|
||||
|
||||
// Compression level isn't available or applicable for all formats
|
||||
if header.compressionLevel != 0 {
|
||||
fputs(" with level \(header.compressionLevel)", stdout)
|
||||
}
|
||||
}
|
||||
|
||||
fputs("\n", stdout)
|
||||
} else {
|
||||
fputs("Error: Failed to retrieve header due to unknown reason.\n", stderr)
|
||||
throw ExitCode(1)
|
||||
}
|
||||
} else {
|
||||
// Print version of program
|
||||
fputs("BinaryDelta version \(SUBinaryDeltaMajorVersionLatest.rawValue).\(latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersionLatest))\n", stdout)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct BinaryDelta: ParsableCommand {
|
||||
static let configuration = CommandConfiguration(commandName: "BinaryDelta", abstract: "Create and apply small and efficient delta patches between an old and new version of a bundle.", subcommands: [Create.self, Apply.self, Info.self])
|
||||
}
|
||||
|
||||
DispatchQueue.global().async(execute: {
|
||||
BinaryDelta.main()
|
||||
CFRunLoopStop(CFRunLoopGetMain())
|
||||
})
|
||||
CFRunLoopRun()
|
||||
@@ -1,3 +1,66 @@
|
||||
# 2.2.0
|
||||
|
||||
* Update Focus Improvements (#924)
|
||||
* Present new scheduled updates in utmost focus only at opportune times (Zorg)
|
||||
* For regular apps opportune times are: app launch, app re-activation, and system being idle (without a power assertion being held to prevent display sleep).
|
||||
* For background (dockless) apps opportune time is just app launch. Otherwise, the update is now shown behind other applications and windows, instead of previously stealing focus from other active apps.
|
||||
* Add APIs and documentation for adding gentle update reminders to compliment Sparkle's standard user interface (Zorg) (#2122)
|
||||
* Allow status window to be minimizable for regular app installs (Zorg) (#2100)
|
||||
* Center status window and inherit key focus from the previously shown update alert window (Zorg)
|
||||
* Activate app when checking for updates if the app is not currently active (e.g, from a menu bar extra menu item) (Zorg)
|
||||
* Fix issue where bringing status window to front made other active windows exit in macOS Ventura's Stage Manager (#2153) (Zorg)
|
||||
* Fix showing update in focus not bringing the "checking for updates" window in focus (Zorg) (#2150)
|
||||
* Rename XPC Service filenames for Sandboxing to show more friendly human-readable name in authorization dialog (Zorg) (#2096)
|
||||
* Add support for running the framework and sparkle-cli as root (Zorg) (#2119)
|
||||
* Fix issue where update cycle may not complete in unusual configuration if automatic checks are disabled + automatic downloading is enabled + install requires user interaction (Zorg) (#2133)
|
||||
* Update last update check time when choosing to install an update & relaunch (Zorg) (#2136)
|
||||
* Improve error reporting in the framework and sparkle-cli when installation fails with no write permission (Zorg) (#2157)
|
||||
* Use displayVersionString instead of versionString for OS version mismatch error message (samschott) (#2138)
|
||||
* Make displayVersionString non-null and update fallback documentation (Zorg) (#2139)
|
||||
* Ignore custom icons set via resource forks when applying delta updates (Zorg) (#2114)
|
||||
* Fall back to regular update if delta update fails to download (Zorg) (#2118)
|
||||
* Skip downloading delta updates when application has been moved to a file system (like FAT) that doesn't support regular permission modes (Zorg) (#2148)
|
||||
* Bump initial installer message timeouts and declare daemon/agents processes as Interactive (Zorg) (#2162)
|
||||
* Add and improve translation strings and update pt-BR (BR Lingo) (#2094)
|
||||
* Update localisations (Eitot) (#2113)
|
||||
* Replace deprecated code with newer APIs (Eitot) (#2112)
|
||||
* Remove obsolete fallbacks for older OS versions (Eitot) (#2110)
|
||||
* Remove SPUURLRequest (Zorg) (#2124)
|
||||
* Silence ivar deprecation warnings (Zorg) (#2099)
|
||||
* Fix Xcode 14 project warnings (Zorg) (#2147)
|
||||
* Update text for external licenses (Zorg) (#2164)
|
||||
|
||||
This update renames the bundled XPC Services, brings improvements to notifying users of new updates without disrupting their focus, and adds [gentle update reminder APIs](https://sparkle-project.org/documentation/gentle-reminders/) to further customize how Sparkle's standard user interface delivers new update alerts.
|
||||
|
||||
# 2.1.0
|
||||
|
||||
* New Binary Delta format (version 3)
|
||||
* Features a custom and more efficient container format, migrating away from the deprecated xar format (Zorg) (#2051)
|
||||
* Adds delta compression options for lzma, bzip2, zlib, lzfse, lz4, and no compression (Zorg) (#2051)
|
||||
* Changes default delta format compression from bzip2 (in version 2) to lzma (in version 3) resulting in smaller deltas (Zorg) (#2051)
|
||||
* Preserve file system (HFS+/apfs) level compression when applying delta updates (Zorg) (#2084)
|
||||
* Tracks renames and binary diffs for files that have moved around to new locations using intelligent heuristics (Zorg) (#2051, #2053)
|
||||
* Added more unit tests, UI tests, and generate_appcast/BinaryDelta tools support for the new format (Zorg) (#2052, #2054)
|
||||
* Major upgrade improvements (#2070)
|
||||
* Fix skipping a major version to not skip subsequent major versions (Zorg) (#2079)
|
||||
* Add sparkle:belowVersion element for informational updates (Zorg) (#2080)
|
||||
* Add option to allow developers to ignore/reset user skipped upgrades (Zorg) (#2081)
|
||||
* Fix progress bar and button alignment for checking updates (Zorg) (#2066)
|
||||
* This deprecates `-[SPUUserDriver showInstallingUpdate]` and `-[SPUUserDriver showSendingTerminationSignal]` in favor for `-[SPUUserDriver showInstallingUpdateWithApplicationTerminated:]`
|
||||
* Fix unsteady progress when installing updates (Zorg) (#2072)
|
||||
* Check http statusCode in didFinishDownloadingToURL (Eric Shapiro, Zorg) (#2049, #2073)
|
||||
* Use strcoll_l() for locale-independent comparisons for delta updates (Dan Rigdon-Bel) (#2087)
|
||||
* Fix version compare not treating '2.1.0' and '2.1' as being equal (Zorg) (#2065)
|
||||
* Add verify and account options for signing updates (Zorg) (#2074)
|
||||
* Add delta patch and Apple code signing verification in generate_appcast (Zorg) (#2076, #2077)
|
||||
* Use more modern NSSecureCoding APIs when available (Zorg) (#2058)
|
||||
* Use more modern FileManager APIs for copying files (Zorg) (#2059)
|
||||
* Fix make release failing when customizing XPC_SERVICE_BUNDLE_ID_PREFIX (Zorg) (#2060)
|
||||
* Preserve the Entitlements directory in podspec (digitalMoksha) (#2062)
|
||||
* Add hidden option to generate_appcast to set max CDATA threshold (Zorg) (#2075)
|
||||
|
||||
This update introduces a new major format for [delta updates](https://sparkle-project.org/documentation/delta-updates/), which migrates away from deprecated APIs (xar) and creates smaller patches. If you don't use `generate_appcast`, please check the [compatibility notes for creating delta updates](https://sparkle-project.org/documentation/delta-updates/#compatibility).
|
||||
|
||||
# 2.0.0
|
||||
|
||||
* Support for Sandboxed Applications (Zorg)
|
||||
@@ -12,7 +75,7 @@
|
||||
* API Changes
|
||||
* Introduced new SPUStandardUpdaterController, SPUUpdater, SPUUserDriver classes/protocols (Zorg)
|
||||
* Decoupled AppKit and UI logic in the framework from core functionality (Zorg)
|
||||
* Ensure (most) API / ABI compatibility with Sparkle 1; you can likely test Sparkle 2 in an existing app with little to no changes (Zorg)
|
||||
* Ensure (most) API compatibility with Sparkle 1; you can likely test Sparkle 2 in an existing app with little to no changes (Zorg)
|
||||
* Deprecated SUUpdater, albeit it is still functional for testing and transitional purposes (Zorg)
|
||||
* `-bestValidUpdateInAppcast:forUpdater:` delegate method behavior has been refined and discouraged for some cases. Please review its updated header documentation in `SPUUpdaterDelegate.h` if you use this method. (#1838, #1862, #1879, #1880) (Zorg)
|
||||
* Delegation methods may have been removed or added to the newer updater API. Please review `SPUUpdaterDelegate` if using `SPUUpdater`. (Zorg)
|
||||
@@ -43,7 +106,7 @@
|
||||
|
||||
Please visit [Sparkle's website](http://sparkle-project.org) for more information on documentation and migration.
|
||||
|
||||
If you are migrating from earlier beta versions of Sparkle 2 and use sandboxing, please re-familiarize yourself with the [Sandboxing guide](https://sparkle-project.org/documentation/sandboxing/). Some of the XPC Services are now optional and integration with XPC Serviecs and code signing have been simplified. The SPUUserDriver protocol for custom user interfaces has been greatly simplified too.
|
||||
If you are migrating from earlier beta versions of Sparkle 2 and use sandboxing, please re-familiarize yourself with the [Sandboxing guide](https://sparkle-project.org/documentation/sandboxing/). Some of the XPC Services are now optional and integration with XPC Services and code signing have been simplified. The SPUUserDriver protocol for custom user interfaces has been greatly simplified too.
|
||||
|
||||
# 1.27.1
|
||||
|
||||
|
||||
+1
-1
@@ -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"}
|
||||
{"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"}
|
||||
@@ -1 +0,0 @@
|
||||
// BinaryDelta tool only
|
||||
@@ -10,7 +10,15 @@ SPARKLE_EMBED_DOWNLOADER_XPC_SERVICE = 1
|
||||
SPARKLE_EMBED_INSTALLER_STATUS_XPC_SERVICE = 0
|
||||
SPARKLE_EMBED_INSTALLER_CONNECTION_XPC_SERVICE = 0
|
||||
|
||||
// Set this to your own prefix if you want to use XPC Service names with different prefix
|
||||
// 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
|
||||
// when installing an update that requires authorization.
|
||||
INSTALLER_CONNECTION_NAME = InstallerConnection
|
||||
INSTALLER_STATUS_NAME = InstallerStatus
|
||||
INSTALLER_LAUNCHER_NAME = Installer
|
||||
DOWNLOADER_NAME = Downloader
|
||||
|
||||
// Set this to your own prefix if you want to use XPC Service bundle IDs with different prefix
|
||||
XPC_SERVICE_BUNDLE_ID_PREFIX = org.sparkle-project
|
||||
|
||||
INSTALLER_CONNECTION_BUNDLE_ID = ${XPC_SERVICE_BUNDLE_ID_PREFIX}.InstallerConnection
|
||||
@@ -34,13 +42,13 @@ SPARKLE_ICON_NAME = AppIcon
|
||||
// If you change any of these version details, you must increase CURRENT_PROJECT_VERSION
|
||||
// These variables must have a space after the '=' too
|
||||
SPARKLE_VERSION_MAJOR = 2
|
||||
SPARKLE_VERSION_MINOR = 0
|
||||
SPARKLE_VERSION_MINOR = 2
|
||||
SPARKLE_VERSION_PATCH = 0
|
||||
|
||||
// This should be in SemVer format or empty, ie. "-beta.1"
|
||||
// These variables must have a space after the '=' too
|
||||
SPARKLE_VERSION_SUFFIX =
|
||||
CURRENT_PROJECT_VERSION = 2008
|
||||
SPARKLE_VERSION_SUFFIX = -beta.2
|
||||
CURRENT_PROJECT_VERSION = 2015
|
||||
|
||||
MARKETING_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)$(SPARKLE_VERSION_SUFFIX)
|
||||
ALWAYS_SEARCH_USER_PATHS = NO
|
||||
@@ -52,7 +60,7 @@ MACOSX_DEPLOYMENT_TARGET = 10.11
|
||||
PRODUCT_NAME = ${TARGET_NAME}
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle.${PRODUCT_NAME:rfc1034identifier}
|
||||
|
||||
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_BUNDLE_ID=\"${INSTALLER_LAUNCHER_BUNDLE_ID}\" INSTALLER_CONNECTION_BUNDLE_ID=\"${INSTALLER_CONNECTION_BUNDLE_ID}\" INSTALLER_STATUS_BUNDLE_ID=\"${INSTALLER_STATUS_BUNDLE_ID}\" DOWNLOADER_BUNDLE_ID=\"${DOWNLOADER_BUNDLE_ID}\"
|
||||
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
|
||||
@@ -110,4 +118,4 @@ GCC_WARN_UNUSED_VARIABLE = YES
|
||||
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-arc-repeated-use-of-weak -Wno-auto-import -Wno-gnu-zero-variadic-macro-arguments -Wno-format-non-iso $(WARNING_CFLAGS_EXTRA)
|
||||
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)
|
||||
@@ -3,6 +3,6 @@
|
||||
INFOPLIST_FILE = Downloader/Info.plist
|
||||
WRAPPER_EXTENSION = xpc
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ${DOWNLOADER_BUNDLE_ID}
|
||||
PRODUCT_NAME = ${DOWNLOADER_BUNDLE_ID}
|
||||
PRODUCT_NAME = ${DOWNLOADER_NAME}
|
||||
CODE_SIGN_ENTITLEMENTS = Downloader/${DOWNLOADER_BUNDLE_ID}.entitlements
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) BUILDING_SPARKLE_DOWNLOADER_SERVICE=1
|
||||
@@ -3,4 +3,4 @@
|
||||
INFOPLIST_FILE = InstallerConnection/Info.plist
|
||||
WRAPPER_EXTENSION = xpc
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_CONNECTION_BUNDLE_ID}
|
||||
PRODUCT_NAME = ${INSTALLER_CONNECTION_BUNDLE_ID}
|
||||
PRODUCT_NAME = ${INSTALLER_CONNECTION_NAME}
|
||||
@@ -3,4 +3,4 @@
|
||||
INFOPLIST_FILE = InstallerLauncher/Info.plist
|
||||
WRAPPER_EXTENSION = xpc
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_LAUNCHER_BUNDLE_ID}
|
||||
PRODUCT_NAME = ${INSTALLER_LAUNCHER_BUNDLE_ID}
|
||||
PRODUCT_NAME = ${INSTALLER_LAUNCHER_NAME}
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
INFOPLIST_FILE = InstallerStatus/Info.plist
|
||||
WRAPPER_EXTENSION = xpc
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_STATUS_BUNDLE_ID}
|
||||
PRODUCT_NAME = ${INSTALLER_STATUS_BUNDLE_ID}
|
||||
PRODUCT_BUNDLE_IDENTIFIER = ${INSTALLER_STATUS_NAME}
|
||||
PRODUCT_NAME = ${INSTALLER_STATUS_NAME}
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright © 2019 Sparkle Project. All rights reserved.
|
||||
|
||||
#include "bsdiff-Shared.xcconfig"
|
||||
|
||||
// Disable asserts for performance
|
||||
GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) NDEBUG=1
|
||||
@@ -48,8 +48,8 @@ if [ "$ACTION" = "" ] ; then
|
||||
mkdir -p "$CONFIGURATION_BUILD_DIR/staging/Entitlements"
|
||||
mkdir -p "$CONFIGURATION_BUILD_DIR/staging-spm/Entitlements"
|
||||
|
||||
cp -R "$SRCROOT/Downloader/org.sparkle-project.Downloader.entitlements" "$CONFIGURATION_BUILD_DIR/staging/Entitlements"
|
||||
cp -R "$SRCROOT/Downloader/org.sparkle-project.Downloader.entitlements" "$CONFIGURATION_BUILD_DIR/staging-spm/Entitlements"
|
||||
cp -R "$SRCROOT/Downloader/org.sparkle-project.Downloader.entitlements" "$CONFIGURATION_BUILD_DIR/staging/Entitlements/$DOWNLOADER_NAME.entitlements"
|
||||
cp -R "$SRCROOT/Downloader/org.sparkle-project.Downloader.entitlements" "$CONFIGURATION_BUILD_DIR/staging-spm/Entitlements/$DOWNLOADER_NAME.entitlements"
|
||||
fi
|
||||
|
||||
mkdir -p "$CONFIGURATION_BUILD_DIR/staging/Symbols"
|
||||
@@ -66,8 +66,8 @@ if [ "$ACTION" = "" ] ; then
|
||||
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/org.sparkle-project.InstallerLauncher.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
|
||||
cp -R "$CONFIGURATION_BUILD_DIR/org.sparkle-project.Downloader.xpc.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"
|
||||
|
||||
@@ -5,22 +5,22 @@ 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_BUNDLE_ID}.xpc"
|
||||
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_BUNDLE_ID}.xpc"
|
||||
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_BUNDLE_ID}.xpc"
|
||||
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_BUNDLE_ID}.xpc"
|
||||
rm -rf "${FRAMEWORK_PATH}"/"Versions/"${FRAMEWORK_VERSION}"/XPCServices"/"${INSTALLER_CONNECTION_NAME}.xpc"
|
||||
removedservices=$((removedservices+1))
|
||||
fi
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#import "SPUDownloader.h"
|
||||
#import "SPUDownloaderDelegate.h"
|
||||
#import "SPULocalCacheDirectory.h"
|
||||
#import "SPUURLRequest.h"
|
||||
#import "SPUDownloadData.h"
|
||||
#import "SPUDownloadDataPrivate.h"
|
||||
#import "SUErrors.h"
|
||||
@@ -61,19 +60,19 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)startDownloadWithRequest:(SPUURLRequest *)request
|
||||
- (void)startDownloadWithRequest:(NSURLRequest *)request
|
||||
{
|
||||
self.downloadSession = [NSURLSession
|
||||
sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]
|
||||
delegate:self
|
||||
delegateQueue:[NSOperationQueue mainQueue]];
|
||||
self.download = [self.downloadSession downloadTaskWithRequest:request.request];
|
||||
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
|
||||
|
||||
- (void)startPersistentDownloadWithRequest:(SPUURLRequest *)request bundleIdentifier:(NSString *)bundleIdentifier desiredFilename:(NSString *)desiredFilename
|
||||
- (void)startPersistentDownloadWithRequest:(NSURLRequest *)request bundleIdentifier:(NSString *)bundleIdentifier desiredFilename:(NSString *)desiredFilename
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (self.download == nil && self.delegate != nil) {
|
||||
@@ -90,7 +89,7 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
|
||||
});
|
||||
}
|
||||
|
||||
- (void)startTemporaryDownloadWithRequest:(SPUURLRequest *)request
|
||||
- (void)startTemporaryDownloadWithRequest:(NSURLRequest *)request
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (self.download == nil && self.delegate != nil) {
|
||||
@@ -159,9 +158,16 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
|
||||
});
|
||||
}
|
||||
|
||||
- (void)URLSession:(NSURLSession *)__unused session downloadTask:(NSURLSessionDownloadTask *)__unused downloadTask didFinishDownloadingToURL:(NSURL *)location
|
||||
- (void)URLSession:(NSURLSession *)__unused session downloadTask:(NSURLSessionDownloadTask *) downloadTask didFinishDownloadingToURL:(NSURL *)location
|
||||
{
|
||||
if (self.mode == SPUDownloadModeTemporary)
|
||||
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 the update. %@ (%ld)", [NSHTTPURLResponse localizedStringForStatusCode:statusCode], (long)statusCode];
|
||||
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUDownloadError userInfo:@{ NSLocalizedDescriptionKey: message }];
|
||||
[self.delegate downloaderDidFailWithError:error];
|
||||
}
|
||||
else if (self.mode == SPUDownloadModeTemporary)
|
||||
{
|
||||
self.downloadFilename = location.path;
|
||||
[self downloadDidFinish]; // file is already in a system temp dir
|
||||
|
||||
@@ -10,14 +10,12 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class SPUURLRequest;
|
||||
|
||||
// The protocol that this service will vend as its API. This header file will also need to be visible to the process hosting the service.
|
||||
@protocol SPUDownloaderProtocol
|
||||
|
||||
- (void)startPersistentDownloadWithRequest:(SPUURLRequest *)request bundleIdentifier:(NSString *)bundleIdentifier desiredFilename:(NSString *)desiredFilename;
|
||||
- (void)startPersistentDownloadWithRequest:(NSURLRequest *)request bundleIdentifier:(NSString *)bundleIdentifier desiredFilename:(NSString *)desiredFilename;
|
||||
|
||||
- (void)startTemporaryDownloadWithRequest:(SPUURLRequest *)request;
|
||||
- (void)startTemporaryDownloadWithRequest:(NSURLRequest *)request;
|
||||
|
||||
- (void)removeDownloadDirectory:(NSString *)directoryName bundleIdentifier:(NSString *)bundleIdentifier;
|
||||
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
#import "SUHost.h"
|
||||
#import <ImageIO/ImageIO.h>
|
||||
#import <ServiceManagement/ServiceManagement.h>
|
||||
#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
|
||||
#import <SystemConfiguration/SystemConfiguration.h>
|
||||
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
|
||||
@@ -70,13 +73,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
// If we are running as the root user, there is no need to explicitly set the UserName / GroupName keys
|
||||
// because we are submitting under the user domain, which should automatically use the the console user.
|
||||
NSMutableDictionary *jobDictionary = [[NSMutableDictionary alloc] init];
|
||||
jobDictionary[@"Label"] = label;
|
||||
jobDictionary[@"ProgramArguments"] = arguments;
|
||||
jobDictionary[@"EnableTransactions"] = @NO;
|
||||
jobDictionary[@"KeepAlive"] = @{@"SuccessfulExit" : @NO};
|
||||
jobDictionary[@"RunAtLoad"] = @NO;
|
||||
jobDictionary[@"NICE"] = @0;
|
||||
jobDictionary[@"Nice"] = @0;
|
||||
jobDictionary[@"ProcessType"] = @"Interactive";
|
||||
jobDictionary[@"LaunchOnlyOnce"] = @YES;
|
||||
jobDictionary[@"MachServices"] = @{SPUStatusInfoServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES};
|
||||
|
||||
@@ -100,7 +106,7 @@
|
||||
return (submittedJob == true);
|
||||
}
|
||||
|
||||
- (SUInstallerLauncherStatus)submitInstallerAtPath:(NSString *)installerPath withHostBundle:(NSBundle *)hostBundle updaterIdentifier:(NSString *)updaterIdentifier authorizationPrompt:(NSString *)authorizationPrompt inSystemDomain:(BOOL)systemDomain
|
||||
- (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];
|
||||
|
||||
@@ -110,12 +116,6 @@
|
||||
NSString *hostBundleIdentifier = hostBundle.bundleIdentifier;
|
||||
assert(hostBundleIdentifier != nil);
|
||||
|
||||
NSString *homeDirectory = NSHomeDirectory();
|
||||
assert(homeDirectory != nil);
|
||||
|
||||
NSString *userName = NSUserName();
|
||||
assert(userName != nil);
|
||||
|
||||
// The first argument has to be the path to the program, and the second is a host identifier so that the installer knows what mach services to host
|
||||
// The third and forth arguments are for home directory and user name which only pkg installer scripts may need
|
||||
// We intentionally do not pass any more arguments. Anything else should be done via IPC.
|
||||
@@ -133,7 +133,7 @@
|
||||
|
||||
BOOL canceledAuthorization = NO;
|
||||
BOOL failedToUseSystemDomain = NO;
|
||||
if (auth != NULL && systemDomain) {
|
||||
if (auth != NULL && systemDomain && !rootUser) {
|
||||
// See Apple's 'EvenBetterAuthorizationSample' sample code and
|
||||
// https://developer.apple.com/library/mac/technotes/tn2095/_index.html#//apple_ref/doc/uid/DTS10003110-CH1-SECTION7
|
||||
// We can set a custom right name for authenticating as an administrator
|
||||
@@ -207,7 +207,16 @@
|
||||
NSString *path = [[NSString alloc] initWithUTF8String:pathBuffer];
|
||||
tempIconDestinationURL = [NSURL fileURLWithPath:path];
|
||||
|
||||
CGImageDestinationRef imageDestination = CGImageDestinationCreateWithURL((CFURLRef)tempIconDestinationURL, kUTTypePNG, 1, NULL);
|
||||
CGImageDestinationRef imageDestination = NULL;
|
||||
if (@available(macOS 11, *)) {
|
||||
CFStringRef uti = (__bridge CFStringRef)[UTTypePNG identifier];
|
||||
imageDestination = CGImageDestinationCreateWithURL((CFURLRef)tempIconDestinationURL, uti, 1, NULL);
|
||||
} else {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
imageDestination = CGImageDestinationCreateWithURL((CFURLRef)tempIconDestinationURL, kUTTypePNG, 1, NULL);
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
if (imageDestination != NULL) {
|
||||
CGImageDestinationAddImageFromSource(imageDestination, imageSource, imageIndex, (CFDictionaryRef)@{});
|
||||
if (CGImageDestinationFinalize(imageDestination)) {
|
||||
@@ -269,7 +278,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
NSDictionary *jobDictionary = @{@"Label" : label, @"ProgramArguments" : arguments, @"EnableTransactions" : @NO, @"KeepAlive" : @{@"SuccessfulExit" : @NO}, @"RunAtLoad" : @NO, @"Nice" : @0, @"LaunchOnlyOnce": @YES, @"MachServices" : @{SPUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES, SPUProgressAgentServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES}};
|
||||
NSDictionary *jobDictionary = @{@"Label" : label, @"ProgramArguments" : arguments, @"EnableTransactions" : @NO, @"KeepAlive" : @{@"SuccessfulExit" : @NO}, @"RunAtLoad" : @NO, @"Nice" : @0, @"ProcessType": @"Interactive", @"LaunchOnlyOnce": @YES, @"MachServices" : @{SPUInstallerServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES, SPUProgressAgentServiceNameForBundleIdentifier(hostBundleIdentifier) : @YES}};
|
||||
|
||||
CFErrorRef submitError = NULL;
|
||||
#pragma clang diagnostic push
|
||||
@@ -361,38 +370,46 @@ BOOL SPUSystemNeedsAuthorizationAccessForBundlePath(NSString *bundlePath)
|
||||
return needsAuthorization;
|
||||
}
|
||||
|
||||
static BOOL SPUSystemNeedsAuthorizationAccess(NSString *path, NSString *installationType)
|
||||
static BOOL SPUUsesSystemDomainForBundlePath(NSString *path, NSString *installationType, BOOL rootUser)
|
||||
{
|
||||
BOOL needsAuthorization;
|
||||
if ([installationType isEqualToString:SPUInstallationTypeGuidedPackage]) {
|
||||
needsAuthorization = YES;
|
||||
} else if ([installationType isEqualToString:SPUInstallationTypeInteractivePackage]) {
|
||||
needsAuthorization = NO;
|
||||
if (!rootUser) {
|
||||
if ([installationType isEqualToString:SPUInstallationTypeGuidedPackage]) {
|
||||
return YES;
|
||||
} else if ([installationType isEqualToString:SPUInstallationTypeInteractivePackage]) {
|
||||
return NO;
|
||||
} else {
|
||||
return SPUSystemNeedsAuthorizationAccessForBundlePath(path);
|
||||
}
|
||||
} else {
|
||||
needsAuthorization = SPUSystemNeedsAuthorizationAccessForBundlePath(path);
|
||||
// If we are the root user we use the system domain even if we don't need escalated authorization.
|
||||
// Note interactive package installations are not supported as root.
|
||||
return YES;
|
||||
}
|
||||
return needsAuthorization;
|
||||
}
|
||||
|
||||
|
||||
// Note: do not pass untrusted information such as paths to the installer and progress agent tools, when we can find them ourselves here
|
||||
- (void)launchInstallerWithHostBundlePath:(NSString *)hostBundlePath updaterIdentifier:(NSString *)updaterIdentifier authorizationPrompt:(NSString *)authorizationPrompt installationType:(NSString *)installationType allowingDriverInteraction:(BOOL)allowingDriverInteraction completion:(void (^)(SUInstallerLauncherStatus, BOOL))completionHandler
|
||||
{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
BOOL needsSystemAuthorization = SPUSystemNeedsAuthorizationAccess(hostBundlePath, installationType);
|
||||
// We could do a sort of preflight Authorization test instead of testing if we are running as root,
|
||||
// but I think this is not necessarily a better approach. We have to chown() the launcher cache directory later on,
|
||||
// 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, installationType, rootUser);
|
||||
|
||||
NSBundle *hostBundle = [NSBundle bundleWithPath:hostBundlePath];
|
||||
if (hostBundle == nil) {
|
||||
SULog(SULogLevelError, @"InstallerLauncher failed to create bundle at %@", hostBundlePath);
|
||||
SULog(SULogLevelError, @"Please make sure InstallerLauncher is not sandboxed and do not sign your app by passing --deep. Check: codesign -d --entitlements :- \"%@\"", NSBundle.mainBundle.bundlePath);
|
||||
SULog(SULogLevelError, @"More information regarding sandboxing: https://sparkle-project.org/documentation/sandboxing/");
|
||||
completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization);
|
||||
completionHandler(SUInstallerLauncherFailure, inSystemDomain);
|
||||
return;
|
||||
}
|
||||
|
||||
// if we need to use the system domain and we aren't allowed interaction, then try sometime later when interaction is allowed
|
||||
if (needsSystemAuthorization && !allowingDriverInteraction) {
|
||||
completionHandler(SUInstallerLauncherAuthorizeLater, needsSystemAuthorization);
|
||||
// if we need to use the system authorization from non-root and we aren't allowed interaction, then try sometime later when interaction is allowed
|
||||
if (inSystemDomain && !rootUser && !allowingDriverInteraction) {
|
||||
completionHandler(SUInstallerLauncherAuthorizeLater, inSystemDomain);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -407,7 +424,7 @@ static BOOL SPUSystemNeedsAuthorizationAccess(NSString *path, NSString *installa
|
||||
NSString *installerPath = [self pathForBundledTool:@""SPARKLE_RELAUNCH_TOOL_NAME extension:@"" fromBundle:ourBundle];
|
||||
if (installerPath == nil) {
|
||||
SULog(SULogLevelError, @"Error: Cannot submit installer because the installer could not be located");
|
||||
completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization);
|
||||
completionHandler(SUInstallerLauncherFailure, inSystemDomain);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -416,7 +433,7 @@ static BOOL SPUSystemNeedsAuthorizationAccess(NSString *path, NSString *installa
|
||||
|
||||
if (progressToolResourcePath == nil) {
|
||||
SULog(SULogLevelError, @"Error: Cannot submit progress tool because the progress tool could not be located");
|
||||
completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization);
|
||||
completionHandler(SUInstallerLauncherFailure, inSystemDomain);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -432,25 +449,69 @@ static BOOL SPUSystemNeedsAuthorizationAccess(NSString *path, NSString *installa
|
||||
NSString *launcherCachePath = [SPULocalCacheDirectory createUniqueDirectoryInDirectory:rootLauncherCachePath];
|
||||
if (launcherCachePath == nil) {
|
||||
SULog(SULogLevelError, @"Failed to create cache directory for progress tool in %@", rootLauncherCachePath);
|
||||
completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization);
|
||||
completionHandler(SUInstallerLauncherFailure, inSystemDomain);
|
||||
return;
|
||||
}
|
||||
|
||||
SUFileManager *fileManager = [[SUFileManager alloc] init];
|
||||
|
||||
NSString *userName;
|
||||
NSString *homeDirectory;
|
||||
if (!rootUser) {
|
||||
// Normal path
|
||||
homeDirectory = NSHomeDirectory();
|
||||
assert(homeDirectory != nil);
|
||||
|
||||
userName = NSUserName();
|
||||
assert(userName != nil);
|
||||
} 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");
|
||||
completionHandler(SUInstallerLauncherFailure, inSystemDomain);
|
||||
return;
|
||||
}
|
||||
|
||||
userName = (NSString *)CFBridgingRelease(userNameRef);
|
||||
homeDirectory = NSHomeDirectoryForUser(userName);
|
||||
if (homeDirectory == nil) {
|
||||
SULog(SULogLevelError, @"Failed to retrieve home directory for user: %@", userName);
|
||||
|
||||
completionHandler(SUInstallerLauncherFailure, inSystemDomain);
|
||||
return;
|
||||
}
|
||||
|
||||
// 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;
|
||||
if (![fileManager changeOwnerAndGroupOfItemAtURL:[NSURL fileURLWithPath:launcherCachePath] ownerID:uid groupID:gid error:&changeOwnerAndGroupError]) {
|
||||
SULog(SULogLevelError, @"Failed to change owner and group for launcher cache directory: %@", changeOwnerAndGroupError);
|
||||
|
||||
completionHandler(SUInstallerLauncherFailure, inSystemDomain);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
NSString *progressToolPath = [launcherCachePath stringByAppendingPathComponent:@""SPARKLE_INSTALLER_PROGRESS_TOOL_NAME@".app"];
|
||||
|
||||
NSError *copyError = nil;
|
||||
// SUFileManager is more reliable for copying files around
|
||||
if (![[[SUFileManager alloc] init] copyItemAtURL:[NSURL fileURLWithPath:progressToolResourcePath] toURL:[NSURL fileURLWithPath:progressToolPath] error:©Error]) {
|
||||
if (![fileManager copyItemAtURL:[NSURL fileURLWithPath:progressToolResourcePath] toURL:[NSURL fileURLWithPath:progressToolPath] error:©Error]) {
|
||||
SULog(SULogLevelError, @"Failed to copy progress tool to cache: %@", copyError);
|
||||
completionHandler(SUInstallerLauncherFailure, needsSystemAuthorization);
|
||||
completionHandler(SUInstallerLauncherFailure, inSystemDomain);
|
||||
return;
|
||||
}
|
||||
|
||||
SUInstallerLauncherStatus installerStatus = [self submitInstallerAtPath:installerPath withHostBundle:hostBundle updaterIdentifier:updaterIdentifier authorizationPrompt:authorizationPrompt inSystemDomain:needsSystemAuthorization];
|
||||
SUInstallerLauncherStatus installerStatus = [self submitInstallerAtPath:installerPath withHostBundle:hostBundle updaterIdentifier:updaterIdentifier userName:userName homeDirectory:homeDirectory authorizationPrompt:authorizationPrompt inSystemDomain:inSystemDomain rootUser:rootUser];
|
||||
|
||||
BOOL submittedProgressTool = NO;
|
||||
if (installerStatus == SUInstallerLauncherSuccess) {
|
||||
submittedProgressTool = [self submitProgressToolAtPath:progressToolPath withHostBundle:hostBundle inSystemDomainForInstaller:needsSystemAuthorization];
|
||||
submittedProgressTool = [self submitProgressToolAtPath:progressToolPath withHostBundle:hostBundle inSystemDomainForInstaller:inSystemDomain];
|
||||
|
||||
if (!submittedProgressTool) {
|
||||
SULog(SULogLevelError, @"Failed to submit progress tool job");
|
||||
@@ -461,9 +522,9 @@ static BOOL SPUSystemNeedsAuthorizationAccess(NSString *path, NSString *installa
|
||||
}
|
||||
|
||||
if (installerStatus == SUInstallerLauncherCanceled) {
|
||||
completionHandler(installerStatus, needsSystemAuthorization);
|
||||
completionHandler(installerStatus, inSystemDomain);
|
||||
} else {
|
||||
completionHandler(submittedProgressTool ? SUInstallerLauncherSuccess : SUInstallerLauncherFailure, needsSystemAuthorization);
|
||||
completionHandler(submittedProgressTool ? SUInstallerLauncherSuccess : SUInstallerLauncherFailure, inSystemDomain);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -29,13 +29,86 @@ EXTERNAL LICENSES
|
||||
=================
|
||||
|
||||
bspatch.c and bsdiff.c, from bsdiff 4.3 <http://www.daemonology.net/bsdiff/>:
|
||||
Copyright (c) 2003-2005 Colin Percival.
|
||||
|
||||
Copyright 2003-2005 Colin Percival
|
||||
All rights reserved
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted providing that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
--
|
||||
|
||||
sais.c and sais.c, from sais-lite (2010/08/07) <https://sites.google.com/site/yuta256/sais>:
|
||||
Copyright (c) 2008-2010 Yuta Mori.
|
||||
|
||||
The sais-lite copyright is as follows:
|
||||
|
||||
Copyright (c) 2008-2010 Yuta Mori All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
--
|
||||
|
||||
Portable C implementation of Ed25519, from https://github.com/orlp/ed25519
|
||||
|
||||
Copyright (c) 2015 Orson Peters <orsonpeters@gmail.com>
|
||||
|
||||
This software is provided 'as-is', without any express or implied warranty. In no event will the
|
||||
authors be held liable for any damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose, including commercial
|
||||
applications, and to alter it and redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not claim that you wrote the
|
||||
original software. If you use this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as
|
||||
being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
--
|
||||
|
||||
SUSignatureVerifier.m:
|
||||
Copyright (c) 2011 Mark Hamlin.
|
||||
|
||||
Copyright (c) 2011 Mark Hamlin.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ ifndef BUILDDIR
|
||||
endif
|
||||
|
||||
localizable-strings:
|
||||
rm -f Sparkle/en.lproj/Sparkle.strings
|
||||
genstrings -o Sparkle/en.lproj -s SULocalizedString Sparkle/*.m Sparkle/*.h
|
||||
iconv -f UTF-16 -t UTF-8 < Sparkle/en.lproj/Localizable.strings > Sparkle/en.lproj/Sparkle.strings
|
||||
rm Sparkle/en.lproj/Localizable.strings
|
||||
rm -f Sparkle/Base.lproj/Sparkle.strings
|
||||
genstrings -o Sparkle/Base.lproj -s SULocalizedString Sparkle/*.m
|
||||
iconv -f UTF-16 -t UTF-8 < Sparkle/Base.lproj/Localizable.strings > Sparkle/Base.lproj/Sparkle.strings
|
||||
rm Sparkle/Base.lproj/Localizable.strings
|
||||
|
||||
release:
|
||||
xcodebuild -scheme Distribution -configuration Release -derivedDataPath "$(BUILDDIR)" build
|
||||
|
||||
+3
-3
@@ -2,10 +2,10 @@
|
||||
import PackageDescription
|
||||
|
||||
// Version is technically not required here, SPM doesn't check
|
||||
let version = "2.0.0"
|
||||
let version = "2.2.0-beta.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.0.0"
|
||||
let checksum = "bed3158a836fd946bc910f9643ba7878e53ccd05538291f599d8a75456f26818"
|
||||
let tag = "2.2.0-beta.2"
|
||||
let checksum = "8020ba7dfcc764e6e25b93d1b1906aadbe2c0d8a0a7e8c0e3205da80d575da7a"
|
||||
let url = "https://github.com/sparkle-project/Sparkle/releases/download/\(tag)/Sparkle-for-Swift-Package-Manager.zip"
|
||||
|
||||
let package = Package(
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = "Sparkle"
|
||||
s.version = "2.0.0"
|
||||
s.version = "2.2.0-beta.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"
|
||||
@@ -22,7 +22,7 @@ Pod::Spec.new do |s|
|
||||
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'
|
||||
|
||||
s.preserve_paths = ['bin/*', 'Symbols']
|
||||
s.preserve_paths = ['bin/*', 'Entitlements', 'Symbols']
|
||||
s.public_header_files = 'Sparkle.framework/Versions/B/Headers/*.h'
|
||||
s.vendored_frameworks = 'Sparkle.framework'
|
||||
s.xcconfig = {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 52;
|
||||
objectVersion = 54;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXAggregateTarget section */
|
||||
@@ -107,10 +107,10 @@
|
||||
61EF67560E25B58D00F754E0 /* SUHost.m in Sources */ = {isa = PBXBuildFile; fileRef = 61EF67550E25B58D00F754E0 /* SUHost.m */; };
|
||||
61EF67590E25C5B400F754E0 /* SUHost.h in Headers */ = {isa = PBXBuildFile; fileRef = 61EF67580E25C5B400F754E0 /* SUHost.h */; };
|
||||
7202DC9A269ABD3500737EC4 /* testappcast_phasedRollout.xml in Resources */ = {isa = PBXBuildFile; fileRef = 7202DC99269ABD3500737EC4 /* testappcast_phasedRollout.xml */; };
|
||||
72045CE026FEE535004F96E5 /* org.sparkle-project.Downloader.xpc in Copy XPC Services */ = {isa = PBXBuildFile; fileRef = 726E07EF1CAF37BD001A286B /* org.sparkle-project.Downloader.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
72045CE126FEE535004F96E5 /* org.sparkle-project.InstallerConnection.xpc in Copy XPC Services */ = {isa = PBXBuildFile; fileRef = 724BB36C1D31D0B7005D534A /* org.sparkle-project.InstallerConnection.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
72045CE226FEE535004F96E5 /* org.sparkle-project.InstallerLauncher.xpc in Copy XPC Services */ = {isa = PBXBuildFile; fileRef = 726E07AD1CAF08D6001A286B /* org.sparkle-project.InstallerLauncher.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
72045CE326FEE535004F96E5 /* org.sparkle-project.InstallerStatus.xpc in Copy XPC Services */ = {isa = PBXBuildFile; fileRef = 724BB3931D333832005D534A /* org.sparkle-project.InstallerStatus.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
72045CE026FEE535004F96E5 /* Downloader.xpc in Copy XPC Services */ = {isa = PBXBuildFile; fileRef = 726E07EF1CAF37BD001A286B /* Downloader.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
72045CE126FEE535004F96E5 /* InstallerConnection.xpc in Copy XPC Services */ = {isa = PBXBuildFile; fileRef = 724BB36C1D31D0B7005D534A /* InstallerConnection.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
72045CE226FEE535004F96E5 /* Installer.xpc in Copy XPC Services */ = {isa = PBXBuildFile; fileRef = 726E07AD1CAF08D6001A286B /* Installer.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
72045CE326FEE535004F96E5 /* InstallerStatus.xpc in Copy XPC Services */ = {isa = PBXBuildFile; fileRef = 724BB3931D333832005D534A /* InstallerStatus.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
720595EF1D700568000572E8 /* SUApplicationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 725602D41C83551C00DAA70E /* SUApplicationInfo.m */; };
|
||||
7205C4411E13049400E370AE /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7205C4401E13049400E370AE /* main.swift */; };
|
||||
7205C44C1E1304CE00E370AE /* Appcast.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7205C4471E1304CE00E370AE /* Appcast.swift */; };
|
||||
@@ -132,11 +132,12 @@
|
||||
7205C4621E1306A600E370AE /* SUBinaryDeltaCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5711D3D895B00D1BF90 /* SUBinaryDeltaCommon.m */; };
|
||||
7205C4631E1306B500E370AE /* libxar.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 726E07681CA616A4001A286B /* libxar.tbd */; };
|
||||
7205C4641E1306BE00E370AE /* libbz2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 726E076A1CA616B3001A286B /* libbz2.tbd */; };
|
||||
720767D31E2EE9C200F9A850 /* SUTouchBarForwardDeclarations.h in Headers */ = {isa = PBXBuildFile; fileRef = 720767D21E2EE9C200F9A850 /* SUTouchBarForwardDeclarations.h */; };
|
||||
720AC2A42618E85700E25A3E /* SPUInstallationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5B51D3D8AEE00D1BF90 /* SPUInstallationInfo.m */; };
|
||||
720AC2C92618E89500E25A3E /* SUAppcastItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B5FC5409C5182000B25A18 /* SUAppcastItem.m */; };
|
||||
720AC2DC2618E8A500E25A3E /* SPUSecureCoding.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E075B1CA3A6D6001A286B /* SPUSecureCoding.m */; };
|
||||
720B16451C66433D006985FB /* SUTestApplicationTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 720B16431C66433D006985FB /* SUTestApplicationTest.swift */; };
|
||||
720DC50427A51A6500DFF3EC /* testappcast_minimumAutoupdateVersionSkipping.xml in Resources */ = {isa = PBXBuildFile; fileRef = 720DC50327A51A6500DFF3EC /* testappcast_minimumAutoupdateVersionSkipping.xml */; };
|
||||
720DC50627A62CDC00DFF3EC /* testappcast_minimumAutoupdateVersionSkipping2.xml in Resources */ = {isa = PBXBuildFile; fileRef = 720DC50527A62CDC00DFF3EC /* testappcast_minimumAutoupdateVersionSkipping2.xml */; };
|
||||
720E217B1D0D00BF003A311C /* SPUUpdaterCycle.h in Headers */ = {isa = PBXBuildFile; fileRef = 720E21791D0D00BF003A311C /* SPUUpdaterCycle.h */; };
|
||||
720E217C1D0D00BF003A311C /* SPUUpdaterCycle.m in Sources */ = {isa = PBXBuildFile; fileRef = 720E217A1D0D00BF003A311C /* SPUUpdaterCycle.m */; };
|
||||
7210C7681B9A9A1500EB90AC /* SUUnarchiverTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7210C7671B9A9A1500EB90AC /* SUUnarchiverTest.swift */; };
|
||||
@@ -215,9 +216,22 @@
|
||||
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 */; };
|
||||
725B81FA2781AEAF0041746F /* libcompression.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 725B81F92781AEA40041746F /* libcompression.tbd */; };
|
||||
725B81FB2781CD930041746F /* libcompression.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 725B81F92781AEA40041746F /* libcompression.tbd */; };
|
||||
725B81FC2781CDC20041746F /* libcompression.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 725B81F92781AEA40041746F /* libcompression.tbd */; };
|
||||
725C2EAA2782EC61007CB7B5 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 725C2EA92782EC61007CB7B5 /* main.swift */; };
|
||||
725C2EAC2782EF3C007CB7B5 /* ArgumentParser in Frameworks */ = {isa = PBXBuildFile; productRef = 725C2EAB2782EF3C007CB7B5 /* ArgumentParser */; };
|
||||
725CB9571C7120410064365A /* SPUUserDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 725CB9561C7120410064365A /* SPUUserDriver.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
725CB95A1C7121830064365A /* SPUStandardUserDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = 725CB9581C7121830064365A /* SPUStandardUserDriver.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
725CB95B1C7121830064365A /* SPUStandardUserDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 725CB9591C7121830064365A /* SPUStandardUserDriver.m */; };
|
||||
725EE480277BF13B00D820CE /* SPUXarDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 725EE47F277BF13B00D820CE /* SPUXarDeltaArchive.m */; };
|
||||
725EE482277BF44A00D820CE /* SPUXarDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 725EE47F277BF13B00D820CE /* SPUXarDeltaArchive.m */; };
|
||||
725EE483277C767A00D820CE /* SPUXarDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 725EE47F277BF13B00D820CE /* SPUXarDeltaArchive.m */; };
|
||||
725EE486277D375F00D820CE /* SPUDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 725EE485277D375F00D820CE /* SPUDeltaArchive.m */; };
|
||||
725EE487277D376000D820CE /* SPUDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 725EE485277D375F00D820CE /* SPUDeltaArchive.m */; };
|
||||
725EE488277D398100D820CE /* SPUDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 725EE485277D375F00D820CE /* SPUDeltaArchive.m */; };
|
||||
725EE489277D39B400D820CE /* SPUDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 725EE485277D375F00D820CE /* SPUDeltaArchive.m */; };
|
||||
725EE48A277D39B400D820CE /* SPUXarDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 725EE47F277BF13B00D820CE /* SPUXarDeltaArchive.m */; };
|
||||
725F97771C8A62F500265BE4 /* SUAdHocCodeSigning.m in Sources */ = {isa = PBXBuildFile; fileRef = 725F97751C8A62F500265BE4 /* SUAdHocCodeSigning.m */; };
|
||||
725F97781C8A65AC00265BE4 /* SUAdHocCodeSigning.m in Sources */ = {isa = PBXBuildFile; fileRef = 725F97751C8A62F500265BE4 /* SUAdHocCodeSigning.m */; };
|
||||
725F97841C8AA90000265BE4 /* SUPopUpTitlebarUserDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 725F97831C8AA90000265BE4 /* SUPopUpTitlebarUserDriver.m */; };
|
||||
@@ -229,7 +243,6 @@
|
||||
7267E5781D3D895B00D1BF90 /* SUBinaryDeltaCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5711D3D895B00D1BF90 /* SUBinaryDeltaCommon.m */; };
|
||||
7267E5791D3D895B00D1BF90 /* SUBinaryDeltaCreate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5731D3D895B00D1BF90 /* SUBinaryDeltaCreate.m */; };
|
||||
7267E57A1D3D895B00D1BF90 /* SUBinaryDeltaCreate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5731D3D895B00D1BF90 /* SUBinaryDeltaCreate.m */; };
|
||||
7267E57C1D3D895B00D1BF90 /* SUBinaryDeltaTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5741D3D895B00D1BF90 /* SUBinaryDeltaTool.m */; };
|
||||
7267E57F1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E57E1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.m */; };
|
||||
7267E5861D3D89B300D1BF90 /* SUDiskImageUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5811D3D89B300D1BF90 /* SUDiskImageUnarchiver.m */; };
|
||||
7267E5871D3D89B300D1BF90 /* SUPipedUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5831D3D89B300D1BF90 /* SUPipedUnarchiver.m */; };
|
||||
@@ -320,10 +333,12 @@
|
||||
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 */; };
|
||||
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 */; };
|
||||
728ED34D277DA23400D9238F /* SPUSparkleDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 728ED349277DA23400D9238F /* SPUSparkleDeltaArchive.m */; };
|
||||
729051E41DC82AC0003DEA7F /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; };
|
||||
7293A1AE1CEE933800B957A7 /* SPUURLRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 7293A1AC1CEE933800B957A7 /* SPUURLRequest.h */; };
|
||||
7293A1AF1CEE933800B957A7 /* SPUURLRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7293A1AD1CEE933800B957A7 /* SPUURLRequest.m */; };
|
||||
7293A1B11CEE9B9F00B957A7 /* SPUURLRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7293A1AD1CEE933800B957A7 /* SPUURLRequest.m */; };
|
||||
729743AB279D1BD2009910B2 /* SUCodeSigningVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5991D3D8A5A00D1BF90 /* SUCodeSigningVerifier.m */; };
|
||||
729924941DF4A45000DBCDF5 /* SUUpdateValidator.m in Sources */ = {isa = PBXBuildFile; fileRef = 729924931DF4A45000DBCDF5 /* SUUpdateValidator.m */; };
|
||||
729F7EAC27366353004592DC /* test-links.xml in Resources */ = {isa = PBXBuildFile; fileRef = 729F7EAB27366353004592DC /* test-links.xml */; };
|
||||
729F7EAF273F1840004592DC /* SPUUserAgent+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 729F7EAD273F1840004592DC /* SPUUserAgent+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
@@ -390,6 +405,16 @@
|
||||
72EF30C42675CFA1008CE987 /* SPUAppcastItemState.m in Sources */ = {isa = PBXBuildFile; fileRef = 72EF30BB2675CF38008CE987 /* SPUAppcastItemState.m */; };
|
||||
72EF30C52675CFA1008CE987 /* SPUAppcastItemStateResolver.m in Sources */ = {isa = PBXBuildFile; fileRef = 72EF30BC2675CF38008CE987 /* SPUAppcastItemStateResolver.m */; };
|
||||
72EF30C7267C716A008CE987 /* SUAppcastItem+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 72EF30C6267C716A008CE987 /* SUAppcastItem+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
72F0EC45278A55CA002A876A /* screenshot.png in Resources */ = {isa = PBXBuildFile; fileRef = 72F0EC44278A55CA002A876A /* screenshot.png */; };
|
||||
72F0EC46278A5B87002A876A /* SUBinaryDeltaCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5711D3D895B00D1BF90 /* SUBinaryDeltaCommon.m */; };
|
||||
72F0EC47278A5B87002A876A /* SUBinaryDeltaCreate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5731D3D895B00D1BF90 /* SUBinaryDeltaCreate.m */; };
|
||||
72F0EC48278A5B95002A876A /* SPUDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 725EE485277D375F00D820CE /* SPUDeltaArchive.m */; };
|
||||
72F0EC49278A5B95002A876A /* SPUSparkleDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 728ED349277DA23400D9238F /* SPUSparkleDeltaArchive.m */; };
|
||||
72F0EC4A278A5B95002A876A /* SPUXarDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 725EE47F277BF13B00D820CE /* SPUXarDeltaArchive.m */; };
|
||||
72F0EC4B278A5BB2002A876A /* libxar.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 726E07681CA616A4001A286B /* libxar.tbd */; };
|
||||
72F0EC4C278A5BB9002A876A /* libbz2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 726E076A1CA616B3001A286B /* libbz2.tbd */; };
|
||||
72F0EC4D278A5BCA002A876A /* libbsdiff.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EA1E280F22B64522004AA304 /* libbsdiff.a */; };
|
||||
72F0EC4E278A73C6002A876A /* SUFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5E41D3D90AA00D1BF90 /* SUFileManager.m */; };
|
||||
72F94F581CC44DE1002DEE68 /* SPUXPCServiceInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 72F94F561CC44DE1002DEE68 /* SPUXPCServiceInfo.h */; };
|
||||
72F94F591CC44DE1002DEE68 /* SPUXPCServiceInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F94F571CC44DE1002DEE68 /* SPUXPCServiceInfo.m */; };
|
||||
72F94F5A1CC450DE002DEE68 /* SUInstallerLauncher.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E07B11CAF08D6001A286B /* SUInstallerLauncher.m */; };
|
||||
@@ -438,6 +463,7 @@
|
||||
EA1E287022B66621004AA304 /* SUSignatures.m in Sources */ = {isa = PBXBuildFile; fileRef = EA1E286D22B665E8004AA304 /* SUSignatures.m */; };
|
||||
EA1E287922B666EB004AA304 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA1E287822B666EB004AA304 /* main.swift */; };
|
||||
EA1E287E22B66705004AA304 /* libed25519.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EA1E282D22B660BE004AA304 /* libed25519.a */; };
|
||||
F6D399512814387000A8C0DA /* UniformTypeIdentifiers.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F6D399502814387000A8C0DA /* UniformTypeIdentifiers.framework */; };
|
||||
F8761EB11ADC5068000C9034 /* SUCodeSigningVerifierTest.m in Sources */ = {isa = PBXBuildFile; fileRef = F8761EB01ADC5068000C9034 /* SUCodeSigningVerifierTest.m */; };
|
||||
F8761EB31ADC50EB000C9034 /* SparkleTestCodeSignApp.zip in Resources */ = {isa = PBXBuildFile; fileRef = F8761EB21ADC50EB000C9034 /* SparkleTestCodeSignApp.zip */; };
|
||||
FA30773D24CBC295007BA37D /* testlocalizedreleasenotesappcast.xml in Resources */ = {isa = PBXBuildFile; fileRef = FA30773C24CBC295007BA37D /* testlocalizedreleasenotesappcast.xml */; };
|
||||
@@ -719,10 +745,10 @@
|
||||
dstPath = "$(CONTENTS_FOLDER_PATH)/XPCServices";
|
||||
dstSubfolderSpec = 16;
|
||||
files = (
|
||||
72045CE026FEE535004F96E5 /* org.sparkle-project.Downloader.xpc in Copy XPC Services */,
|
||||
72045CE126FEE535004F96E5 /* org.sparkle-project.InstallerConnection.xpc in Copy XPC Services */,
|
||||
72045CE226FEE535004F96E5 /* org.sparkle-project.InstallerLauncher.xpc in Copy XPC Services */,
|
||||
72045CE326FEE535004F96E5 /* org.sparkle-project.InstallerStatus.xpc in Copy XPC Services */,
|
||||
72045CE026FEE535004F96E5 /* Downloader.xpc in Copy XPC Services */,
|
||||
72045CE126FEE535004F96E5 /* InstallerConnection.xpc in Copy XPC Services */,
|
||||
72045CE226FEE535004F96E5 /* Installer.xpc in Copy XPC Services */,
|
||||
72045CE326FEE535004F96E5 /* InstallerStatus.xpc in Copy XPC Services */,
|
||||
);
|
||||
name = "Copy XPC Services";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -867,7 +893,6 @@
|
||||
5D06E8D00FD68C7C005AE3F6 /* BinaryDelta */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = BinaryDelta; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
5D06E8DB0FD68CB9005AE3F6 /* bsdiff.c */ = {isa = PBXFileReference; comments = "-Wno-shorten-64-to-32"; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bsdiff.c; sourceTree = "<group>"; };
|
||||
5D06E8DC0FD68CB9005AE3F6 /* bspatch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bspatch.c; sourceTree = "<group>"; };
|
||||
5D06E8F10FD68D21005AE3F6 /* ConfigBinaryDelta.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ConfigBinaryDelta.xcconfig; sourceTree = "<group>"; };
|
||||
5D06E8FB0FD68D61005AE3F6 /* libbz2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbz2.dylib; path = usr/lib/libbz2.dylib; sourceTree = SDKROOT; };
|
||||
5D1AF5890FD7678C0065DB48 /* libxar.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxar.1.dylib; path = usr/lib/libxar.1.dylib; sourceTree = SDKROOT; };
|
||||
5D1AF58F0FD767AD0065DB48 /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; };
|
||||
@@ -891,7 +916,7 @@
|
||||
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>"; };
|
||||
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>"; };
|
||||
6196CFE309C71ADE000DC222 /* SUStatusController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUStatusController.h; sourceTree = "<group>"; };
|
||||
@@ -920,7 +945,7 @@
|
||||
61B5FCA109C5228F00B25A18 /* SUUpdateAlert.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUpdateAlert.m; sourceTree = "<group>"; };
|
||||
61BA66CC14BDFA0400D02D86 /* sl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sl; path = sl.lproj/Sparkle.strings; sourceTree = "<group>"; };
|
||||
61C268090E2DB5D000175E6C /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = SOURCE_ROOT; };
|
||||
61E31A80103299500051D188 /* pt_BR */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = pt_BR; path = pt_BR.lproj/Sparkle.strings; sourceTree = "<group>"; };
|
||||
61E31A80103299500051D188 /* pt-BR */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/Sparkle.strings"; sourceTree = "<group>"; };
|
||||
61EF67550E25B58D00F754E0 /* SUHost.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUHost.m; sourceTree = "<group>"; };
|
||||
61EF67580E25C5B400F754E0 /* SUHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUHost.h; sourceTree = "<group>"; };
|
||||
61F3AC1215C22D4A00260CA2 /* th */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = th; path = th.lproj/Sparkle.strings; sourceTree = "<group>"; };
|
||||
@@ -942,11 +967,12 @@
|
||||
7205C46E1E13254500E370AE /* ConfigUITestDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigUITestDebug.xcconfig; sourceTree = "<group>"; };
|
||||
7205C46F1E13255900E370AE /* ConfigUITestRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigUITestRelease.xcconfig; sourceTree = "<group>"; };
|
||||
720767D11E2EB86200F9A850 /* AppKitPrevention.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppKitPrevention.h; sourceTree = "<group>"; };
|
||||
720767D21E2EE9C200F9A850 /* SUTouchBarForwardDeclarations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUTouchBarForwardDeclarations.h; sourceTree = "<group>"; };
|
||||
720B16421C66433D006985FB /* UITests-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "UITests-Info.plist"; path = "UITests/UITests-Info.plist"; sourceTree = SOURCE_ROOT; };
|
||||
720B16431C66433D006985FB /* SUTestApplicationTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SUTestApplicationTest.swift; path = UITests/SUTestApplicationTest.swift; sourceTree = SOURCE_ROOT; };
|
||||
720B4C2325EBFAFD005A0592 /* link-tools.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "link-tools.sh"; sourceTree = "<group>"; };
|
||||
720C192827127A3800740C8E /* release-move-tag.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "release-move-tag.sh"; sourceTree = "<group>"; };
|
||||
720DC50327A51A6500DFF3EC /* testappcast_minimumAutoupdateVersionSkipping.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = testappcast_minimumAutoupdateVersionSkipping.xml; sourceTree = "<group>"; };
|
||||
720DC50527A62CDC00DFF3EC /* testappcast_minimumAutoupdateVersionSkipping2.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = testappcast_minimumAutoupdateVersionSkipping2.xml; sourceTree = "<group>"; };
|
||||
720E21791D0D00BF003A311C /* SPUUpdaterCycle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUUpdaterCycle.h; sourceTree = "<group>"; };
|
||||
720E217A1D0D00BF003A311C /* SPUUpdaterCycle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUUpdaterCycle.m; sourceTree = "<group>"; };
|
||||
7210C7671B9A9A1500EB90AC /* SUUnarchiverTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SUUnarchiverTest.swift; sourceTree = "<group>"; };
|
||||
@@ -1010,8 +1036,8 @@
|
||||
723ABD5C259A9C3B00BDB4FA /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/SUUpdateAlert.strings; sourceTree = "<group>"; };
|
||||
723ABD5D259A9C3D00BDB4FA /* nb */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nb; path = nb.lproj/SUUpdateAlert.strings; sourceTree = "<group>"; };
|
||||
723ABD5E259A9C4000BDB4FA /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/SUUpdateAlert.strings; sourceTree = "<group>"; };
|
||||
723ABD5F259A9C4900BDB4FA /* pt_BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt_BR; path = pt_BR.lproj/SUUpdateAlert.strings; sourceTree = "<group>"; };
|
||||
723ABD60259A9C4B00BDB4FA /* pt_PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt_PT; path = pt_PT.lproj/SUUpdateAlert.strings; sourceTree = "<group>"; };
|
||||
723ABD5F259A9C4900BDB4FA /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/SUUpdateAlert.strings"; sourceTree = "<group>"; };
|
||||
723ABD60259A9C4B00BDB4FA /* pt-PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-PT"; path = "pt-PT.lproj/SUUpdateAlert.strings"; sourceTree = "<group>"; };
|
||||
723ABD61259A9C5400BDB4FA /* ro */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ro; path = ro.lproj/SUUpdateAlert.strings; sourceTree = "<group>"; };
|
||||
723ABD62259A9C5700BDB4FA /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/SUUpdateAlert.strings; sourceTree = "<group>"; };
|
||||
723ABD63259A9C5900BDB4FA /* sk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sk; path = sk.lproj/SUUpdateAlert.strings; sourceTree = "<group>"; };
|
||||
@@ -1040,8 +1066,8 @@
|
||||
723ABD93259A9D3C00BDB4FA /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/SUUpdatePermissionPrompt.strings; sourceTree = "<group>"; };
|
||||
723ABD94259A9D3E00BDB4FA /* nb */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nb; path = nb.lproj/SUUpdatePermissionPrompt.strings; sourceTree = "<group>"; };
|
||||
723ABD95259A9D4100BDB4FA /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/SUUpdatePermissionPrompt.strings; sourceTree = "<group>"; };
|
||||
723ABD96259A9D4600BDB4FA /* pt_BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt_BR; path = pt_BR.lproj/SUUpdatePermissionPrompt.strings; sourceTree = "<group>"; };
|
||||
723ABD97259A9D4900BDB4FA /* pt_PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt_PT; path = pt_PT.lproj/SUUpdatePermissionPrompt.strings; sourceTree = "<group>"; };
|
||||
723ABD96259A9D4600BDB4FA /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/SUUpdatePermissionPrompt.strings"; sourceTree = "<group>"; };
|
||||
723ABD97259A9D4900BDB4FA /* pt-PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-PT"; path = "pt-PT.lproj/SUUpdatePermissionPrompt.strings"; sourceTree = "<group>"; };
|
||||
723ABD98259A9D4C00BDB4FA /* ro */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ro; path = ro.lproj/SUUpdatePermissionPrompt.strings; sourceTree = "<group>"; };
|
||||
723ABD99259A9D4F00BDB4FA /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/SUUpdatePermissionPrompt.strings; sourceTree = "<group>"; };
|
||||
723ABD9A259A9D5200BDB4FA /* sk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sk; path = sk.lproj/SUUpdatePermissionPrompt.strings; sourceTree = "<group>"; };
|
||||
@@ -1073,8 +1099,8 @@
|
||||
723ABE2A259A9F0600BDB4FA /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/MainMenu.strings; sourceTree = "<group>"; };
|
||||
723ABE2B259A9F0800BDB4FA /* nb */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nb; path = nb.lproj/MainMenu.strings; sourceTree = "<group>"; };
|
||||
723ABE2C259A9F0B00BDB4FA /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/MainMenu.strings; sourceTree = "<group>"; };
|
||||
723ABE2D259A9F0F00BDB4FA /* pt_BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt_BR; path = pt_BR.lproj/MainMenu.strings; sourceTree = "<group>"; };
|
||||
723ABE2E259A9F1100BDB4FA /* pt_PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt_PT; path = pt_PT.lproj/MainMenu.strings; sourceTree = "<group>"; };
|
||||
723ABE2D259A9F0F00BDB4FA /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/MainMenu.strings"; sourceTree = "<group>"; };
|
||||
723ABE2E259A9F1100BDB4FA /* pt-PT */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-PT"; path = "pt-PT.lproj/MainMenu.strings"; sourceTree = "<group>"; };
|
||||
723ABE2F259A9F1400BDB4FA /* ro */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ro; path = ro.lproj/MainMenu.strings; sourceTree = "<group>"; };
|
||||
723ABE30259A9F1700BDB4FA /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/MainMenu.strings; sourceTree = "<group>"; };
|
||||
723ABE31259A9F1A00BDB4FA /* sk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = sk; path = sk.lproj/MainMenu.strings; sourceTree = "<group>"; };
|
||||
@@ -1102,7 +1128,7 @@
|
||||
723EDC3E26885A8E000BCBA4 /* testappcast_channels.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = testappcast_channels.xml; sourceTree = "<group>"; };
|
||||
7246E0A11C83B685003B4E75 /* SPUStandardUpdaterController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUStandardUpdaterController.h; sourceTree = "<group>"; };
|
||||
7246E0A21C83B685003B4E75 /* SPUStandardUpdaterController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUStandardUpdaterController.m; sourceTree = "<group>"; };
|
||||
724BB36C1D31D0B7005D534A /* org.sparkle-project.InstallerConnection.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = "org.sparkle-project.InstallerConnection.xpc"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
724BB36C1D31D0B7005D534A /* InstallerConnection.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = InstallerConnection.xpc; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
724BB36E1D31D0B7005D534A /* SUInstallerConnectionProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUInstallerConnectionProtocol.h; sourceTree = "<group>"; };
|
||||
724BB36F1D31D0B7005D534A /* SUInstallerConnection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUInstallerConnection.h; sourceTree = "<group>"; };
|
||||
724BB3701D31D0B7005D534A /* SUInstallerConnection.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SUInstallerConnection.m; sourceTree = "<group>"; };
|
||||
@@ -1113,7 +1139,7 @@
|
||||
724BB3801D31F186005D534A /* SUInstallerCommunicationProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUInstallerCommunicationProtocol.h; sourceTree = "<group>"; };
|
||||
724BB3851D32A167005D534A /* SUXPCInstallerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUXPCInstallerConnection.h; sourceTree = "<group>"; };
|
||||
724BB3861D32A167005D534A /* SUXPCInstallerConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUXPCInstallerConnection.m; sourceTree = "<group>"; };
|
||||
724BB3931D333832005D534A /* org.sparkle-project.InstallerStatus.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = "org.sparkle-project.InstallerStatus.xpc"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
724BB3931D333832005D534A /* InstallerStatus.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = InstallerStatus.xpc; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
724BB3951D333832005D534A /* SUInstallerStatusProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUInstallerStatusProtocol.h; sourceTree = "<group>"; };
|
||||
724BB3961D333832005D534A /* SUInstallerStatus.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUInstallerStatus.h; sourceTree = "<group>"; };
|
||||
724BB3971D333832005D534A /* SUInstallerStatus.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SUInstallerStatus.m; sourceTree = "<group>"; };
|
||||
@@ -1128,10 +1154,19 @@
|
||||
725602D41C83551C00DAA70E /* SUApplicationInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUApplicationInfo.m; sourceTree = "<group>"; };
|
||||
72563CA9272E1C5400AF39F0 /* .github */ = {isa = PBXFileReference; lastKnownFileType = folder; path = .github; sourceTree = "<group>"; };
|
||||
725B3A81263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = testappcast_minimumAutoupdateVersion.xml; sourceTree = "<group>"; };
|
||||
725B81F92781AEA40041746F /* libcompression.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libcompression.tbd; path = usr/lib/libcompression.tbd; sourceTree = SDKROOT; };
|
||||
725C2EA82782EC44007CB7B5 /* Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "Bridging-Header.h"; path = "BinaryDelta/Bridging-Header.h"; sourceTree = SOURCE_ROOT; };
|
||||
725C2EA92782EC61007CB7B5 /* main.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = main.swift; path = BinaryDelta/main.swift; sourceTree = SOURCE_ROOT; };
|
||||
725C2EAD278386A8007CB7B5 /* SPUDeltaCompressionMode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SPUDeltaCompressionMode.h; path = Autoupdate/SPUDeltaCompressionMode.h; sourceTree = SOURCE_ROOT; };
|
||||
725CB9561C7120410064365A /* SPUUserDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUUserDriver.h; sourceTree = "<group>"; };
|
||||
725CB9581C7121830064365A /* SPUStandardUserDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUStandardUserDriver.h; sourceTree = "<group>"; };
|
||||
725CB9591C7121830064365A /* SPUStandardUserDriver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUStandardUserDriver.m; sourceTree = "<group>"; };
|
||||
725DED72263D10C400E7FA8F /* SUAppcast+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SUAppcast+Private.h"; sourceTree = "<group>"; };
|
||||
725EE47E277BF13A00D820CE /* SPUXarDeltaArchive.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SPUXarDeltaArchive.h; path = Autoupdate/SPUXarDeltaArchive.h; sourceTree = SOURCE_ROOT; };
|
||||
725EE47F277BF13B00D820CE /* SPUXarDeltaArchive.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SPUXarDeltaArchive.m; path = Autoupdate/SPUXarDeltaArchive.m; sourceTree = SOURCE_ROOT; };
|
||||
725EE481277BF17A00D820CE /* SPUDeltaArchiveProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SPUDeltaArchiveProtocol.h; path = Autoupdate/SPUDeltaArchiveProtocol.h; sourceTree = SOURCE_ROOT; };
|
||||
725EE484277D375F00D820CE /* SPUDeltaArchive.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SPUDeltaArchive.h; path = Autoupdate/SPUDeltaArchive.h; sourceTree = SOURCE_ROOT; };
|
||||
725EE485277D375F00D820CE /* SPUDeltaArchive.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SPUDeltaArchive.m; path = Autoupdate/SPUDeltaArchive.m; sourceTree = SOURCE_ROOT; };
|
||||
725F97741C8A62F500265BE4 /* SUAdHocCodeSigning.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUAdHocCodeSigning.h; sourceTree = "<group>"; };
|
||||
725F97751C8A62F500265BE4 /* SUAdHocCodeSigning.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUAdHocCodeSigning.m; sourceTree = "<group>"; };
|
||||
725F97821C8AA90000265BE4 /* SUPopUpTitlebarUserDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUPopUpTitlebarUserDriver.h; sourceTree = "<group>"; };
|
||||
@@ -1145,7 +1180,6 @@
|
||||
7267E5711D3D895B00D1BF90 /* SUBinaryDeltaCommon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUBinaryDeltaCommon.m; path = Autoupdate/SUBinaryDeltaCommon.m; sourceTree = SOURCE_ROOT; };
|
||||
7267E5721D3D895B00D1BF90 /* SUBinaryDeltaCreate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUBinaryDeltaCreate.h; path = Autoupdate/SUBinaryDeltaCreate.h; sourceTree = SOURCE_ROOT; };
|
||||
7267E5731D3D895B00D1BF90 /* SUBinaryDeltaCreate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUBinaryDeltaCreate.m; path = Autoupdate/SUBinaryDeltaCreate.m; sourceTree = SOURCE_ROOT; };
|
||||
7267E5741D3D895B00D1BF90 /* SUBinaryDeltaTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUBinaryDeltaTool.m; path = Autoupdate/SUBinaryDeltaTool.m; sourceTree = SOURCE_ROOT; };
|
||||
7267E57D1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUBinaryDeltaUnarchiver.h; path = Autoupdate/SUBinaryDeltaUnarchiver.h; sourceTree = SOURCE_ROOT; };
|
||||
7267E57E1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUBinaryDeltaUnarchiver.m; path = Autoupdate/SUBinaryDeltaUnarchiver.m; sourceTree = SOURCE_ROOT; };
|
||||
7267E5801D3D89B300D1BF90 /* SUDiskImageUnarchiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUDiskImageUnarchiver.h; path = Autoupdate/SUDiskImageUnarchiver.h; sourceTree = SOURCE_ROOT; };
|
||||
@@ -1200,14 +1234,14 @@
|
||||
726E076A1CA616B3001A286B /* libbz2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libbz2.tbd; path = usr/lib/libbz2.tbd; sourceTree = SDKROOT; };
|
||||
726E078B1CA891E9001A286B /* SPUUpdaterSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUUpdaterSettings.h; sourceTree = "<group>"; };
|
||||
726E078C1CA891E9001A286B /* SPUUpdaterSettings.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUUpdaterSettings.m; sourceTree = "<group>"; };
|
||||
726E07AD1CAF08D6001A286B /* org.sparkle-project.InstallerLauncher.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = "org.sparkle-project.InstallerLauncher.xpc"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
726E07AD1CAF08D6001A286B /* Installer.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = Installer.xpc; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
726E07AF1CAF08D6001A286B /* SUInstallerLauncherProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUInstallerLauncherProtocol.h; sourceTree = "<group>"; };
|
||||
726E07B01CAF08D6001A286B /* SUInstallerLauncher.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SUInstallerLauncher.h; sourceTree = "<group>"; };
|
||||
726E07B11CAF08D6001A286B /* SUInstallerLauncher.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SUInstallerLauncher.m; sourceTree = "<group>"; };
|
||||
726E07B31CAF08D6001A286B /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
726E07B51CAF08D6001A286B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
726E07C11CAF1E79001A286B /* ConfigInstallerLauncher.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ConfigInstallerLauncher.xcconfig; sourceTree = "<group>"; };
|
||||
726E07EF1CAF37BD001A286B /* org.sparkle-project.Downloader.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = "org.sparkle-project.Downloader.xpc"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
726E07EF1CAF37BD001A286B /* Downloader.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = Downloader.xpc; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
726E4A111C86C44A00C57C6A /* Sparkle-Test-App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "Sparkle-Test-App.entitlements"; sourceTree = "<group>"; };
|
||||
726E4A161C86C88F00C57C6A /* TestAppHelper.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = TestAppHelper.xpc; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
726E4A181C86C88F00C57C6A /* TestAppHelperProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestAppHelperProtocol.h; sourceTree = "<group>"; };
|
||||
@@ -1226,8 +1260,8 @@
|
||||
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>"; };
|
||||
7293A1AC1CEE933800B957A7 /* SPUURLRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUURLRequest.h; sourceTree = "<group>"; };
|
||||
7293A1AD1CEE933800B957A7 /* SPUURLRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUURLRequest.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; };
|
||||
729924931DF4A45000DBCDF5 /* SUUpdateValidator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUUpdateValidator.m; path = Sparkle/SUUpdateValidator.m; sourceTree = SOURCE_ROOT; };
|
||||
729BB3D11D503826007C4276 /* org.sparkle-project.Downloader.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = "org.sparkle-project.Downloader.entitlements"; path = "Downloader/org.sparkle-project.Downloader.entitlements"; sourceTree = SOURCE_ROOT; };
|
||||
@@ -1306,6 +1340,7 @@
|
||||
72EF30BC2675CF38008CE987 /* SPUAppcastItemStateResolver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUAppcastItemStateResolver.m; sourceTree = "<group>"; };
|
||||
72EF30BD2675CF38008CE987 /* SPUAppcastItemState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUAppcastItemState.h; sourceTree = "<group>"; };
|
||||
72EF30C6267C716A008CE987 /* SUAppcastItem+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SUAppcastItem+Private.h"; sourceTree = "<group>"; };
|
||||
72F0EC44278A55CA002A876A /* screenshot.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = screenshot.png; sourceTree = "<group>"; };
|
||||
72F94ED51CC3441A002DEE68 /* ConfigInstallerLauncherDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigInstallerLauncherDebug.xcconfig; sourceTree = "<group>"; };
|
||||
72F94ED61CC344A7002DEE68 /* ConfigDownloaderDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigDownloaderDebug.xcconfig; sourceTree = "<group>"; };
|
||||
72F94EDA1CC36C37002DEE68 /* ConfigTestAppDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigTestAppDebug.xcconfig; sourceTree = "<group>"; };
|
||||
@@ -1360,6 +1395,10 @@
|
||||
EA1E287622B666EB004AA304 /* sign_update */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = sign_update; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
EA1E287822B666EB004AA304 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
|
||||
EA1E287F22B667D8004AA304 /* Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
F67C9B7B281410B600740813 /* hu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/Sparkle.strings; sourceTree = "<group>"; };
|
||||
F67C9B7C281410B600740813 /* hu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/SUUpdateAlert.strings; sourceTree = "<group>"; };
|
||||
F6D399502814387000A8C0DA /* UniformTypeIdentifiers.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UniformTypeIdentifiers.framework; path = System/Library/Frameworks/UniformTypeIdentifiers.framework; sourceTree = SDKROOT; };
|
||||
F6E11510281410D10003736C /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/Sparkle.strings; sourceTree = "<group>"; };
|
||||
F8761EB01ADC5068000C9034 /* SUCodeSigningVerifierTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUCodeSigningVerifierTest.m; sourceTree = "<group>"; };
|
||||
F8761EB21ADC50EB000C9034 /* SparkleTestCodeSignApp.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = SparkleTestCodeSignApp.zip; sourceTree = "<group>"; };
|
||||
FA1941CA0D94A70100DD942E /* ConfigFrameworkDebug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = ConfigFrameworkDebug.xcconfig; sourceTree = "<group>"; };
|
||||
@@ -1383,6 +1422,7 @@
|
||||
files = (
|
||||
EA1E281922B645D9004AA304 /* libbsdiff.a in Frameworks */,
|
||||
5D06E9050FD68D7D005AE3F6 /* Foundation.framework in Frameworks */,
|
||||
725C2EAC2782EF3C007CB7B5 /* ArgumentParser in Frameworks */,
|
||||
5D06E8FF0FD68D6D005AE3F6 /* libbz2.dylib in Frameworks */,
|
||||
5D1AF58B0FD7678C0065DB48 /* libxar.1.dylib in Frameworks */,
|
||||
5D1AF5900FD767AD0065DB48 /* libxml2.dylib in Frameworks */,
|
||||
@@ -1394,6 +1434,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
725B81FB2781CD930041746F /* libcompression.tbd in Frameworks */,
|
||||
5A06357323FE333600478A72 /* libed25519.a in Frameworks */,
|
||||
EA1E281822B645CE004AA304 /* libbsdiff.a in Frameworks */,
|
||||
14732BD119610A1200593899 /* AppKit.framework in Frameworks */,
|
||||
@@ -1409,6 +1450,9 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
72F0EC4D278A5BCA002A876A /* libbsdiff.a in Frameworks */,
|
||||
72F0EC4C278A5BB9002A876A /* libbz2.tbd in Frameworks */,
|
||||
72F0EC4B278A5BB2002A876A /* libxar.tbd in Frameworks */,
|
||||
5A06357423FE33A400478A72 /* libed25519.a in Frameworks */,
|
||||
14950073195FCE4E00BC5B5B /* AppKit.framework in Frameworks */,
|
||||
14950072195FCE4B00BC5B5B /* Foundation.framework in Frameworks */,
|
||||
@@ -1434,6 +1478,7 @@
|
||||
files = (
|
||||
721C245A1CB75756005440CB /* Cocoa.framework in Frameworks */,
|
||||
724BB3B71D35ABA8005D534A /* Security.framework in Frameworks */,
|
||||
F6D399512814387000A8C0DA /* UniformTypeIdentifiers.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -1487,6 +1532,7 @@
|
||||
EA1E281722B645AE004AA304 /* libbsdiff.a in Frameworks */,
|
||||
7267E5C91D3D8C4300D1BF90 /* CoreServices.framework in Frameworks */,
|
||||
7267E5CA1D3D8C4800D1BF90 /* Foundation.framework in Frameworks */,
|
||||
725B81FA2781AEAF0041746F /* libcompression.tbd in Frameworks */,
|
||||
5A06357023FE332300478A72 /* libed25519.a in Frameworks */,
|
||||
7267E5D61D3D8D3500D1BF90 /* libbz2.tbd in Frameworks */,
|
||||
7267E5D51D3D8D2800D1BF90 /* libxar.tbd in Frameworks */,
|
||||
@@ -1507,6 +1553,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
725B81FC2781CDC20041746F /* libcompression.tbd in Frameworks */,
|
||||
1495006F195FCE1800BC5B5B /* Foundation.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -1545,10 +1592,10 @@
|
||||
72B398D21D3D879300EE297F /* Autoupdate */,
|
||||
5D06E8D00FD68C7C005AE3F6 /* BinaryDelta */,
|
||||
7205C43E1E13049400E370AE /* generate_appcast */,
|
||||
726E07EF1CAF37BD001A286B /* org.sparkle-project.Downloader.xpc */,
|
||||
724BB36C1D31D0B7005D534A /* org.sparkle-project.InstallerConnection.xpc */,
|
||||
726E07AD1CAF08D6001A286B /* org.sparkle-project.InstallerLauncher.xpc */,
|
||||
724BB3931D333832005D534A /* org.sparkle-project.InstallerStatus.xpc */,
|
||||
726E07EF1CAF37BD001A286B /* Downloader.xpc */,
|
||||
724BB36C1D31D0B7005D534A /* InstallerConnection.xpc */,
|
||||
726E07AD1CAF08D6001A286B /* Installer.xpc */,
|
||||
724BB3931D333832005D534A /* InstallerStatus.xpc */,
|
||||
61B5F90209C4CEE200B25A18 /* Sparkle Test App.app */,
|
||||
612279D90DB5470200AB99EA /* Sparkle Unit Tests.xctest */,
|
||||
72D9549E1CBB415B006F28BD /* sparkle.app */,
|
||||
@@ -1589,6 +1636,7 @@
|
||||
0867D69AFE84028FC02AAC07 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
725B81F92781AEA40041746F /* libcompression.tbd */,
|
||||
0867D6A5FE840307C02AAC07 /* AppKit.framework */,
|
||||
721BC2081D17A553002BC71E /* Carbon.framework */,
|
||||
525A278F133D6AE900FD8D70 /* Cocoa.framework */,
|
||||
@@ -1606,6 +1654,7 @@
|
||||
7267E5CF1D3D8C8500D1BF90 /* SecurityFoundation.framework */,
|
||||
724BB3B51D35AAC3005D534A /* ServiceManagement.framework */,
|
||||
55C14F31136EFC2400649790 /* SystemConfiguration.framework */,
|
||||
F6D399502814387000A8C0DA /* UniformTypeIdentifiers.framework */,
|
||||
61B5FC3F09C4FD4000B25A18 /* WebKit.framework */,
|
||||
14732BD219610A1800593899 /* XCTest.framework */,
|
||||
);
|
||||
@@ -1719,6 +1768,8 @@
|
||||
5AD0FA7E1C73F2E2004BCEFF /* testappcast.xml */,
|
||||
723EDC3E26885A8E000BCBA4 /* testappcast_channels.xml */,
|
||||
725B3A81263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml */,
|
||||
720DC50327A51A6500DFF3EC /* testappcast_minimumAutoupdateVersionSkipping.xml */,
|
||||
720DC50527A62CDC00DFF3EC /* testappcast_minimumAutoupdateVersionSkipping2.xml */,
|
||||
7202DC99269ABD3500737EC4 /* testappcast_phasedRollout.xml */,
|
||||
722545B526805FF80036465C /* testappcast_info_updates.xml */,
|
||||
5F1510A11C96E591006E1629 /* testnamespaces.xml */,
|
||||
@@ -1760,9 +1811,18 @@
|
||||
7267E5711D3D895B00D1BF90 /* SUBinaryDeltaCommon.m */,
|
||||
7267E5721D3D895B00D1BF90 /* SUBinaryDeltaCreate.h */,
|
||||
7267E5731D3D895B00D1BF90 /* SUBinaryDeltaCreate.m */,
|
||||
7267E5741D3D895B00D1BF90 /* SUBinaryDeltaTool.m */,
|
||||
725EE481277BF17A00D820CE /* SPUDeltaArchiveProtocol.h */,
|
||||
725C2EAD278386A8007CB7B5 /* SPUDeltaCompressionMode.h */,
|
||||
725EE484277D375F00D820CE /* SPUDeltaArchive.h */,
|
||||
725EE485277D375F00D820CE /* SPUDeltaArchive.m */,
|
||||
728ED348277DA23400D9238F /* SPUSparkleDeltaArchive.h */,
|
||||
728ED349277DA23400D9238F /* SPUSparkleDeltaArchive.m */,
|
||||
725EE47E277BF13A00D820CE /* SPUXarDeltaArchive.h */,
|
||||
725EE47F277BF13B00D820CE /* SPUXarDeltaArchive.m */,
|
||||
7267E57D1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.h */,
|
||||
7267E57E1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.m */,
|
||||
725C2EA92782EC61007CB7B5 /* main.swift */,
|
||||
725C2EA82782EC44007CB7B5 /* Bridging-Header.h */,
|
||||
);
|
||||
name = "Binary Delta";
|
||||
sourceTree = "<group>";
|
||||
@@ -1815,8 +1875,6 @@
|
||||
721AB11626C777D900D34A86 /* SPUDownloadDataPrivate.h */,
|
||||
72F9EC431D5E9ED8004AC8B6 /* SPUDownloadData.m */,
|
||||
7214B8851D45AD9A00CB5CED /* SPUInstallationType.h */,
|
||||
7293A1AC1CEE933800B957A7 /* SPUURLRequest.h */,
|
||||
7293A1AD1CEE933800B957A7 /* SPUURLRequest.m */,
|
||||
61B5FB9409C4F04600B25A18 /* SUAppcast.h */,
|
||||
725DED72263D10C400E7FA8F /* SUAppcast+Private.h */,
|
||||
61B5FB9509C4F04600B25A18 /* SUAppcast.m */,
|
||||
@@ -1852,7 +1910,6 @@
|
||||
723AC036259DBF1B00BDB4FA /* Web View */,
|
||||
612DCBAD0D488BC60015DBEA /* SUUpdatePermissionPrompt.h */,
|
||||
612DCBAE0D488BC60015DBEA /* SUUpdatePermissionPrompt.m */,
|
||||
720767D21E2EE9C200F9A850 /* SUTouchBarForwardDeclarations.h */,
|
||||
723C8A521E2D60DB00C14942 /* SUTouchBarButtonGroup.h */,
|
||||
723C8A531E2D60DB00C14942 /* SUTouchBarButtonGroup.m */,
|
||||
3772FEA813DE0B6B00F79537 /* SUVersionDisplayProtocol.h */,
|
||||
@@ -1935,6 +1992,7 @@
|
||||
72E45CF51B640DAE005C701A /* SUUpdateSettingsWindowController.m */,
|
||||
72E45CF61B640DAE005C701A /* SUUpdateSettingsWindowController.xib */,
|
||||
61B5F90409C4CEE200B25A18 /* TestApplication-Info.plist */,
|
||||
72F0EC44278A55CA002A876A /* screenshot.png */,
|
||||
);
|
||||
name = "Test Application";
|
||||
path = TestApplication;
|
||||
@@ -2301,7 +2359,6 @@
|
||||
EA1E286822B664FD004AA304 /* CommandLineTool-Debug.xcconfig */,
|
||||
EA1E286722B664FD004AA304 /* CommandLineTool-Release.xcconfig */,
|
||||
EA1E286922B664FD004AA304 /* CommandLineTool-Shared.xcconfig */,
|
||||
5D06E8F10FD68D21005AE3F6 /* ConfigBinaryDelta.xcconfig */,
|
||||
FA1941D00D94A70100DD942E /* ConfigCommon.xcconfig */,
|
||||
149B78631B7D3A0C00D7D62C /* ConfigCommonCoverage.xcconfig */,
|
||||
FA1941CF0D94A70100DD942E /* ConfigCommonDebug.xcconfig */,
|
||||
@@ -2393,7 +2450,6 @@
|
||||
72F9EC3F1D5E823F004AC8B6 /* SPUUpdaterTimer.h in Headers */,
|
||||
7269E494264798200088C213 /* SPUSkippedUpdate.h in Headers */,
|
||||
723ABFC4259D4CB300BDB4FA /* SUWKWebView.h in Headers */,
|
||||
7293A1AE1CEE933800B957A7 /* SPUURLRequest.h in Headers */,
|
||||
725CB9571C7120410064365A /* SPUUserDriver.h in Headers */,
|
||||
72B767DE1C9CDB9700A07552 /* SPUUserInitiatedUpdateDriver.h in Headers */,
|
||||
72F94F581CC44DE1002DEE68 /* SPUXPCServiceInfo.h in Headers */,
|
||||
@@ -2402,7 +2458,6 @@
|
||||
61B5FC7009C51F4A00B25A18 /* SUAppcastItem.h in Headers */,
|
||||
725602D51C83551C00DAA70E /* SUApplicationInfo.h in Headers */,
|
||||
7214B8811D456A8500CB5CED /* SUBundleIcon.h in Headers */,
|
||||
720767D31E2EE9C200F9A850 /* SUTouchBarForwardDeclarations.h in Headers */,
|
||||
55E6F33319EC9F6C00005E76 /* SUErrors.h in Headers */,
|
||||
14652F8419A978C200959E44 /* SUExport.h in Headers */,
|
||||
7267E5E51D3D90AA00D1BF90 /* SUFileManager.h in Headers */,
|
||||
@@ -2476,6 +2531,9 @@
|
||||
376769AF23442F320077B8F7 /* PBXTargetDependency */,
|
||||
);
|
||||
name = BinaryDelta;
|
||||
packageProductDependencies = (
|
||||
725C2EAB2782EF3C007CB7B5 /* ArgumentParser */,
|
||||
);
|
||||
productName = BinaryDelta;
|
||||
productReference = 5D06E8D00FD68C7C005AE3F6 /* BinaryDelta */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
@@ -2572,7 +2630,7 @@
|
||||
);
|
||||
name = SparkleInstallerConnection;
|
||||
productName = InstallerConnection;
|
||||
productReference = 724BB36C1D31D0B7005D534A /* org.sparkle-project.InstallerConnection.xpc */;
|
||||
productReference = 724BB36C1D31D0B7005D534A /* InstallerConnection.xpc */;
|
||||
productType = "com.apple.product-type.xpc-service";
|
||||
};
|
||||
724BB3921D333832005D534A /* SparkleInstallerStatus */ = {
|
||||
@@ -2589,7 +2647,7 @@
|
||||
);
|
||||
name = SparkleInstallerStatus;
|
||||
productName = InstallerStatus;
|
||||
productReference = 724BB3931D333832005D534A /* org.sparkle-project.InstallerStatus.xpc */;
|
||||
productReference = 724BB3931D333832005D534A /* InstallerStatus.xpc */;
|
||||
productType = "com.apple.product-type.xpc-service";
|
||||
};
|
||||
726B2B5C1C645FC900388755 /* UI Tests */ = {
|
||||
@@ -2623,7 +2681,7 @@
|
||||
);
|
||||
name = SparkleInstallerLauncher;
|
||||
productName = InstallerLauncher;
|
||||
productReference = 726E07AD1CAF08D6001A286B /* org.sparkle-project.InstallerLauncher.xpc */;
|
||||
productReference = 726E07AD1CAF08D6001A286B /* Installer.xpc */;
|
||||
productType = "com.apple.product-type.xpc-service";
|
||||
};
|
||||
726E07EE1CAF37BD001A286B /* SparkleDownloader */ = {
|
||||
@@ -2640,7 +2698,7 @@
|
||||
);
|
||||
name = SparkleDownloader;
|
||||
productName = UpdateDownloader;
|
||||
productReference = 726E07EF1CAF37BD001A286B /* org.sparkle-project.Downloader.xpc */;
|
||||
productReference = 726E07EF1CAF37BD001A286B /* Downloader.xpc */;
|
||||
productType = "com.apple.product-type.xpc-service";
|
||||
};
|
||||
726E4A151C86C88F00C57C6A /* TestAppHelper */ = {
|
||||
@@ -2809,9 +2867,12 @@
|
||||
attributes = {
|
||||
CLASSPREFIX = SU;
|
||||
LastSwiftUpdateCheck = 1020;
|
||||
LastUpgradeCheck = 1300;
|
||||
LastUpgradeCheck = 1400;
|
||||
ORGANIZATIONNAME = "Sparkle Project";
|
||||
TargetAttributes = {
|
||||
5D06E8CF0FD68C7C005AE3F6 = {
|
||||
LastSwiftMigration = 1320;
|
||||
};
|
||||
612279D80DB5470200AB99EA = {
|
||||
LastSwiftMigration = 0800;
|
||||
TestTargetID = 8DC2EF4F0486A6940098B216;
|
||||
@@ -2907,7 +2968,6 @@
|
||||
ja,
|
||||
ko,
|
||||
nl,
|
||||
no,
|
||||
pl,
|
||||
ru,
|
||||
sk,
|
||||
@@ -2915,9 +2975,6 @@
|
||||
th,
|
||||
tr,
|
||||
zh_CN,
|
||||
fr_ca,
|
||||
pt_BR,
|
||||
pt_PT,
|
||||
pt,
|
||||
ro,
|
||||
sl,
|
||||
@@ -2931,7 +2988,6 @@
|
||||
"pt-PT",
|
||||
"pt-BR",
|
||||
Base,
|
||||
fr_CA,
|
||||
hr,
|
||||
fa,
|
||||
);
|
||||
@@ -2976,6 +3032,7 @@
|
||||
725B3A82263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml in Resources */,
|
||||
14958C6E19AEBC950061B14F /* signed-test-file.txt in Resources */,
|
||||
723EDC3F26885A8E000BCBA4 /* testappcast_channels.xml in Resources */,
|
||||
720DC50427A51A6500DFF3EC /* testappcast_minimumAutoupdateVersionSkipping.xml in Resources */,
|
||||
72AC6B2E1B9B218C00F62325 /* SparkleTestCodeSignApp.dmg in Resources */,
|
||||
C23E885B1BE7B24F0050BB73 /* SparkleTestCodeSignApp.enc.dmg in Resources */,
|
||||
72AC6B281B9AAD6700F62325 /* SparkleTestCodeSignApp.tar in Resources */,
|
||||
@@ -2989,6 +3046,7 @@
|
||||
14958C6F19AEBC980061B14F /* test-pubkey.pem in Resources */,
|
||||
5AF6C74F1AEA46D10014A3AB /* test.pkg in Resources */,
|
||||
72BC6C3D275027BF0083F14B /* SparkleTestCodeSign_apfs.dmg in Resources */,
|
||||
720DC50627A62CDC00DFF3EC /* testappcast_minimumAutoupdateVersionSkipping2.xml in Resources */,
|
||||
5AD0FA7F1C73F2E2004BCEFF /* testappcast.xml in Resources */,
|
||||
FA30773D24CBC295007BA37D /* testlocalizedreleasenotesappcast.xml in Resources */,
|
||||
72CCDEBE27421FD500B53718 /* SparkleTestCodeSignApp_bad_header.zip in Resources */,
|
||||
@@ -3008,6 +3066,7 @@
|
||||
72E45CFC1B641961005C701A /* sparkletestcast.xml in Resources */,
|
||||
725F97A61C8B304D00265BE4 /* SUInstallUpdateViewController.xib in Resources */,
|
||||
723ABE02259A9E9E00BDB4FA /* MainMenu.xib in Resources */,
|
||||
72F0EC45278A55CA002A876A /* screenshot.png in Resources */,
|
||||
72E45CF81B640DAE005C701A /* SUUpdateSettingsWindowController.xib in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
@@ -3081,6 +3140,7 @@
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
6131B1910DDCDE32005215F0 /* Run Script: Set Git Version Info */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 12;
|
||||
files = (
|
||||
);
|
||||
@@ -3096,6 +3156,7 @@
|
||||
};
|
||||
72045CE626FEE8CC004F96E5 /* Strip XPC Services */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
@@ -3114,6 +3175,7 @@
|
||||
};
|
||||
720B4C2125EBFAA5005A0592 /* Run Script: Link Tools */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
@@ -3154,10 +3216,13 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
725EE482277BF44A00D820CE /* SPUXarDeltaArchive.m in Sources */,
|
||||
728ED34C277DA23400D9238F /* SPUSparkleDeltaArchive.m in Sources */,
|
||||
725C2EAA2782EC61007CB7B5 /* main.swift in Sources */,
|
||||
7267E5761D3D895B00D1BF90 /* SUBinaryDeltaApply.m in Sources */,
|
||||
725EE487277D376000D820CE /* SPUDeltaArchive.m in Sources */,
|
||||
7267E5781D3D895B00D1BF90 /* SUBinaryDeltaCommon.m in Sources */,
|
||||
7267E57A1D3D895B00D1BF90 /* SUBinaryDeltaCreate.m in Sources */,
|
||||
7267E57C1D3D895B00D1BF90 /* SUBinaryDeltaTool.m in Sources */,
|
||||
726F2CE81BC9C48F001971A4 /* SUConstants.m in Sources */,
|
||||
7267E5EA1D3D90AA00D1BF90 /* SUFileManager.m in Sources */,
|
||||
726F2CE91BC9C499001971A4 /* SUOperatingSystem.m in Sources */,
|
||||
@@ -3168,6 +3233,8 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
725EE488277D398100D820CE /* SPUDeltaArchive.m in Sources */,
|
||||
725EE483277C767A00D820CE /* SPUXarDeltaArchive.m in Sources */,
|
||||
7269E4982648D3460088C213 /* SPUSkippedUpdate.m in Sources */,
|
||||
721D5ABC25C680A300D23BEA /* SUFlatPackageUnarchiver.m in Sources */,
|
||||
725F97771C8A62F500265BE4 /* SUAdHocCodeSigning.m in Sources */,
|
||||
@@ -3175,6 +3242,7 @@
|
||||
7267E5EE1D3D915900D1BF90 /* SUBinaryDeltaApply.m in Sources */,
|
||||
7267E5EF1D3D915900D1BF90 /* SUBinaryDeltaCommon.m in Sources */,
|
||||
7267E5F01D3D915900D1BF90 /* SUBinaryDeltaCreate.m in Sources */,
|
||||
728ED34B277DA23400D9238F /* SPUSparkleDeltaArchive.m in Sources */,
|
||||
142E0E0919A83AAC00E4312B /* SUBinaryDeltaTest.m in Sources */,
|
||||
7267E5F11D3D917A00D1BF90 /* SUBinaryDeltaUnarchiver.m in Sources */,
|
||||
F8761EB11ADC5068000C9034 /* SUCodeSigningVerifierTest.m in Sources */,
|
||||
@@ -3204,6 +3272,12 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
72F0EC4E278A73C6002A876A /* SUFileManager.m in Sources */,
|
||||
72F0EC48278A5B95002A876A /* SPUDeltaArchive.m in Sources */,
|
||||
72F0EC49278A5B95002A876A /* SPUSparkleDeltaArchive.m in Sources */,
|
||||
72F0EC4A278A5B95002A876A /* SPUXarDeltaArchive.m in Sources */,
|
||||
72F0EC46278A5B87002A876A /* SUBinaryDeltaCommon.m in Sources */,
|
||||
72F0EC47278A5B87002A876A /* SUBinaryDeltaCreate.m in Sources */,
|
||||
61B5F93009C4CFDC00B25A18 /* main.m in Sources */,
|
||||
726F2CEB1BC9C733001971A4 /* SUConstants.m in Sources */,
|
||||
725F97A51C8B304D00265BE4 /* SUInstallUpdateViewController.m in Sources */,
|
||||
@@ -3218,6 +3292,9 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
729743AB279D1BD2009910B2 /* SUCodeSigningVerifier.m in Sources */,
|
||||
725EE489277D39B400D820CE /* SPUDeltaArchive.m in Sources */,
|
||||
725EE48A277D39B400D820CE /* SPUXarDeltaArchive.m in Sources */,
|
||||
721D5B1B25C692BB00D23BEA /* SUFlatPackageUnarchiver.m in Sources */,
|
||||
72464F7C1E2097F600FB341C /* SUOperatingSystem.m in Sources */,
|
||||
7205C44C1E1304CE00E370AE /* Appcast.swift in Sources */,
|
||||
@@ -3225,6 +3302,7 @@
|
||||
7205C44E1E1304CE00E370AE /* Signatures.swift in Sources */,
|
||||
7205C44F1E1304CE00E370AE /* FeedXML.swift in Sources */,
|
||||
7205C4411E13049400E370AE /* main.swift in Sources */,
|
||||
728ED34D277DA23400D9238F /* SPUSparkleDeltaArchive.m in Sources */,
|
||||
7205C45F1E13066F00E370AE /* SUBinaryDeltaApply.m in Sources */,
|
||||
7205C4621E1306A600E370AE /* SUBinaryDeltaCommon.m in Sources */,
|
||||
FA30773F24CBC3E9007BA37D /* URL+Hashing.swift in Sources */,
|
||||
@@ -3326,7 +3404,6 @@
|
||||
72E539121D68C3FA0092CE5E /* SPUDownloadData.m in Sources */,
|
||||
723B5DA91CF7AB0100365F95 /* SPUDownloader.m in Sources */,
|
||||
721BC2101D1CDE55002BC71E /* SPULocalCacheDirectory.m in Sources */,
|
||||
7293A1B11CEE9B9F00B957A7 /* SPUURLRequest.m in Sources */,
|
||||
728638ED1CAF50CE00783084 /* SUConstants.m in Sources */,
|
||||
721D8A871D4C5BF10032E472 /* SULog.m in Sources */,
|
||||
);
|
||||
@@ -3346,6 +3423,8 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
725EE480277BF13B00D820CE /* SPUXarDeltaArchive.m in Sources */,
|
||||
728ED34A277DA23400D9238F /* SPUSparkleDeltaArchive.m in Sources */,
|
||||
72EF30C42675CFA1008CE987 /* SPUAppcastItemState.m in Sources */,
|
||||
72EF30C52675CFA1008CE987 /* SPUAppcastItemStateResolver.m in Sources */,
|
||||
72464F701E1F31E000FB341C /* SUOperatingSystem.m in Sources */,
|
||||
@@ -3359,6 +3438,7 @@
|
||||
7267E5CD1D3D8C7200D1BF90 /* SPUSecureCoding.m in Sources */,
|
||||
7267E5CB1D3D8C6400D1BF90 /* SUAppcastItem.m in Sources */,
|
||||
7267E5751D3D895B00D1BF90 /* SUBinaryDeltaApply.m in Sources */,
|
||||
725EE486277D375F00D820CE /* SPUDeltaArchive.m in Sources */,
|
||||
7267E5771D3D895B00D1BF90 /* SUBinaryDeltaCommon.m in Sources */,
|
||||
7267E5791D3D895B00D1BF90 /* SUBinaryDeltaCreate.m in Sources */,
|
||||
7267E57F1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.m in Sources */,
|
||||
@@ -3430,7 +3510,6 @@
|
||||
726E078E1CA891E9001A286B /* SPUUpdaterSettings.m in Sources */,
|
||||
721D588F25BE59F900D23BEA /* SUPhasedUpdateGroupInfo.m in Sources */,
|
||||
72F9EC401D5E823F004AC8B6 /* SPUUpdaterTimer.m in Sources */,
|
||||
7293A1AF1CEE933800B957A7 /* SPUURLRequest.m in Sources */,
|
||||
72B767DF1C9CDB9700A07552 /* SPUUserInitiatedUpdateDriver.m in Sources */,
|
||||
72F94F591CC44DE1002DEE68 /* SPUXPCServiceInfo.m in Sources */,
|
||||
61B5FBB709C4FAFF00B25A18 /* SUAppcast.m in Sources */,
|
||||
@@ -3700,8 +3779,8 @@
|
||||
4607BEA21948443800EF8DA4 /* nb */,
|
||||
61AAE8710A321F7700D8810D /* nl */,
|
||||
611A904210240DD300CC659E /* pl */,
|
||||
61E31A80103299500051D188 /* pt_BR */,
|
||||
6186554310D7484E00B1E074 /* pt_PT */,
|
||||
61E31A80103299500051D188 /* pt-BR */,
|
||||
6186554310D7484E00B1E074 /* pt-PT */,
|
||||
004A8652192A492B00C9730D /* ro */,
|
||||
6195D4920E404AD700D41A50 /* ru */,
|
||||
FE5536F617A2C6AB007CB333 /* sk */,
|
||||
@@ -3715,6 +3794,8 @@
|
||||
723ABCD7259A9A9D00BDB4FA /* Base */,
|
||||
72E1DACB25B3E8DF0001BA6D /* hr */,
|
||||
726FD2CC25F4BE5F00123BC6 /* fa */,
|
||||
F67C9B7B281410B600740813 /* hu */,
|
||||
F6E11510281410D10003736C /* ar */,
|
||||
);
|
||||
name = Sparkle.strings;
|
||||
sourceTree = "<group>";
|
||||
@@ -3742,8 +3823,8 @@
|
||||
723ABD5C259A9C3B00BDB4FA /* ko */,
|
||||
723ABD5D259A9C3D00BDB4FA /* nb */,
|
||||
723ABD5E259A9C4000BDB4FA /* pl */,
|
||||
723ABD5F259A9C4900BDB4FA /* pt_BR */,
|
||||
723ABD60259A9C4B00BDB4FA /* pt_PT */,
|
||||
723ABD5F259A9C4900BDB4FA /* pt-BR */,
|
||||
723ABD60259A9C4B00BDB4FA /* pt-PT */,
|
||||
723ABD61259A9C5400BDB4FA /* ro */,
|
||||
723ABD62259A9C5700BDB4FA /* ru */,
|
||||
723ABD63259A9C5900BDB4FA /* sk */,
|
||||
@@ -3754,6 +3835,7 @@
|
||||
723ABD68259A9C6300BDB4FA /* tr */,
|
||||
723ABD69259A9C6600BDB4FA /* uk */,
|
||||
72E1DAB625B3E8AE0001BA6D /* hr */,
|
||||
F67C9B7C281410B600740813 /* hu */,
|
||||
);
|
||||
name = SUUpdateAlert.xib;
|
||||
sourceTree = "<group>";
|
||||
@@ -3780,8 +3862,8 @@
|
||||
723ABD93259A9D3C00BDB4FA /* ko */,
|
||||
723ABD94259A9D3E00BDB4FA /* nb */,
|
||||
723ABD95259A9D4100BDB4FA /* pl */,
|
||||
723ABD96259A9D4600BDB4FA /* pt_BR */,
|
||||
723ABD97259A9D4900BDB4FA /* pt_PT */,
|
||||
723ABD96259A9D4600BDB4FA /* pt-BR */,
|
||||
723ABD97259A9D4900BDB4FA /* pt-PT */,
|
||||
723ABD98259A9D4C00BDB4FA /* ro */,
|
||||
723ABD99259A9D4F00BDB4FA /* ru */,
|
||||
723ABD9A259A9D5200BDB4FA /* sk */,
|
||||
@@ -3828,8 +3910,8 @@
|
||||
723ABE2A259A9F0600BDB4FA /* ko */,
|
||||
723ABE2B259A9F0800BDB4FA /* nb */,
|
||||
723ABE2C259A9F0B00BDB4FA /* pl */,
|
||||
723ABE2D259A9F0F00BDB4FA /* pt_BR */,
|
||||
723ABE2E259A9F1100BDB4FA /* pt_PT */,
|
||||
723ABE2D259A9F0F00BDB4FA /* pt-BR */,
|
||||
723ABE2E259A9F1100BDB4FA /* pt-PT */,
|
||||
723ABE2F259A9F1400BDB4FA /* ro */,
|
||||
723ABE30259A9F1700BDB4FA /* ru */,
|
||||
723ABE31259A9F1A00BDB4FA /* sk */,
|
||||
@@ -3902,7 +3984,7 @@
|
||||
};
|
||||
149B785E1B7D398100D7D62C /* Coverage */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 5D06E8F10FD68D21005AE3F6 /* ConfigBinaryDelta.xcconfig */;
|
||||
baseConfigurationReference = EA1E286722B664FD004AA304 /* CommandLineTool-Release.xcconfig */;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Coverage;
|
||||
@@ -3949,14 +4031,14 @@
|
||||
};
|
||||
5D06E8D20FD68C7D005AE3F6 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 5D06E8F10FD68D21005AE3F6 /* ConfigBinaryDelta.xcconfig */;
|
||||
baseConfigurationReference = EA1E286822B664FD004AA304 /* CommandLineTool-Debug.xcconfig */;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
5D06E8D30FD68C7D005AE3F6 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 5D06E8F10FD68D21005AE3F6 /* ConfigBinaryDelta.xcconfig */;
|
||||
baseConfigurationReference = EA1E286722B664FD004AA304 /* CommandLineTool-Release.xcconfig */;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Release;
|
||||
@@ -4544,6 +4626,11 @@
|
||||
/* End XCRemoteSwiftPackageReference section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
725C2EAB2782EF3C007CB7B5 /* ArgumentParser */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 727DBAE326B5BBFD00111F0C /* XCRemoteSwiftPackageReference "swift-argument-parser" */;
|
||||
productName = ArgumentParser;
|
||||
};
|
||||
727DBAE426B5BBFD00111F0C /* ArgumentParser */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 727DBAE326B5BBFD00111F0C /* XCRemoteSwiftPackageReference "swift-argument-parser" */;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1310"
|
||||
LastUpgradeVersion = "1400"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1300"
|
||||
LastUpgradeVersion = "1400"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1300"
|
||||
LastUpgradeVersion = "1400"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@@ -52,6 +52,13 @@
|
||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<EnvironmentVariables>
|
||||
<EnvironmentVariable
|
||||
key = "TEST_MODE"
|
||||
value = "DELTA"
|
||||
isEnabled = "NO">
|
||||
</EnvironmentVariable>
|
||||
</EnvironmentVariables>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1300"
|
||||
LastUpgradeVersion = "1400"
|
||||
version = "2.0">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1300"
|
||||
LastUpgradeVersion = "1400"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1300"
|
||||
LastUpgradeVersion = "1400"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1300"
|
||||
LastUpgradeVersion = "1400"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1300"
|
||||
LastUpgradeVersion = "1400"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1310"
|
||||
LastUpgradeVersion = "1400"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
Vendored
+81
-84
@@ -1,155 +1,152 @@
|
||||
/* Description text for SUUpdateAlert when the critical update has already been downloaded and ready to install. */
|
||||
"%1$@ %2$@ has been downloaded and is ready to use! This is an important update; would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ has been downloaded and is ready to use! This is an important update; would you like to install it and relaunch %1$@ now?";
|
||||
|
||||
/* Description text for SUUpdateAlert when the update has already been downloaded and ready to install. */
|
||||
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?";
|
||||
|
||||
"%1$@ can't be updated, because it was opened from a read-only or a temporary location." = "%1$@ can't be updated, because it was opened from a read-only or a temporary location.";
|
||||
/* No comment provided by engineer. */
|
||||
"%1$@ %2$@ is available but your macOS version is too new for this update. This update only supports up to macOS %3$@." = "%1$@ %2$@ is available but your macOS version is too new for this update. This update only supports up to macOS %3$@.";
|
||||
|
||||
"Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again.";
|
||||
|
||||
"Quit %1$@, move it into your Applications folder, relaunch it from there and try again." = "Quit %1$@, move it into your Applications folder, relaunch it from there and try again.";
|
||||
/* No comment provided by engineer. */
|
||||
"%1$@ %2$@ is available but your macOS version is too old to install it. At least macOS %3$@ is required." = "%1$@ %2$@ is available but your macOS version is too old to install it. At least macOS %3$@ is required.";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "%1$@ can’t be updated if it’s running from the location it was downloaded to.";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "%1$@ can’t be updated, because it was opened from a read-only or a temporary location.";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"%@ %@ is currently the newest version available." = "%1$@ %2$@ is currently the newest version available.";
|
||||
|
||||
"%@ %@ is currently the newest version available.\n(You are currently running version %@.)" = "%1$@ %2$@ is currently the newest version available.\n(You are currently running version %3$@.)";
|
||||
/* No comment provided by engineer. */
|
||||
"%@ %@ is currently the newest version available.\n(You are currently running version %@.)" = "%1$@ %2$@ is currently the newest version available.\n(You are currently running version %3$@.)";
|
||||
|
||||
"An error occurred while running the updater. Please try again later." = "An error occurred while running the updater. Please try again later.";
|
||||
|
||||
"An error occurred while starting the installer. Please try again later." = "An error occurred while starting the installer. Please try again later.";
|
||||
|
||||
"An error occurred while connecting to the installer. Please try again later." = "An error occurred while connecting to the installer. Please try again later.";
|
||||
|
||||
"An error occurred while launching the installer. Please try again later." = "An error occurred while launching the installer. Please try again later.";
|
||||
|
||||
"Update Installed" = "Update Installed";
|
||||
|
||||
"%@ is now updated to version %@!" = "%@ is now updated to version %@!";
|
||||
|
||||
"%@ is now updated!" = "%@ is now updated!";
|
||||
/* Description text for SUUpdateAlert when the critical update is downloadable. */
|
||||
"%@ %@ is now available—you have %@. This is an important update; would you like to download it now?" = "%1$@ %2$@ is now available—you have %3$@. This is an important update; would you like to download it now?";
|
||||
|
||||
/* Description text for SUUpdateAlert when the update is downloadable. */
|
||||
"%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@ is now available—you have %3$@. Would you like to download it now?";
|
||||
"%@ %@ is now available—you have %@. Would you like to download it now?" = "%1$@ %2$@ is now available—you have %3$@. Would you like to download it now?";
|
||||
|
||||
/* Description text for SUUpdateAlert when the update informational with no download. */
|
||||
"%@ %@ is now available--you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ is now available—you have %3$@. Would you like to learn more about this update on the web?";
|
||||
|
||||
/* Critical downloadable update */
|
||||
"%@ %@ is now available--you have %@. This is an important update; would you like to download it now?" = "%1$@ %2$@ is now available—you have %3$@. This is an important update; would you like to download it now?";
|
||||
"%@ %@ is now available—you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ is now available—you have %3$@. Would you like to learn more about this update on the web?";
|
||||
|
||||
/* The download progress in a unit of bytes, e.g. 100 KB */
|
||||
"%@ downloaded" = "%@ downloaded";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"%@ is now updated to version %@!" = "%1$@ is now updated to version %2$@!";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"%@ is now updated!" = "%@ is now updated!";
|
||||
|
||||
/* The download progress in units of bytes, e.g. 100 KB of 1,0 MB */
|
||||
"%@ of %@" = "%1$@ of %2$@";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"A new version of %@ is available!" = "A new version of %@ is available!";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"A new version of %@ is ready to install!" = "A new version of %@ is ready to install!";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"An error occurred in retrieving update information. Please try again later." = "An error occurred in retrieving update information. Please try again later.";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"An error occurred while connecting to the installer. Please try again later." = "An error occurred while connecting to the installer. Please try again later.";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"An error occurred while downloading the update. Please try again later." = "An error occurred while downloading the update. Please try again later.";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"An error occurred while extracting the archive. Please try again later." = "An error occurred while extracting the archive. Please try again later.";
|
||||
|
||||
"An error occurred while installing the update. Please try again later." = "An error occurred while installing the update. Please try again later.";
|
||||
/* No comment provided by engineer. */
|
||||
"An error occurred while launching the installer. Please try again later." = "An error occurred while launching the installer. Please try again later.";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"An error occurred while parsing the update feed." = "An error occurred while parsing the update feed.";
|
||||
|
||||
"An error occurred while downloading the update feed." = "An error occurred while downloading the update feed.";
|
||||
/* No comment provided by engineer. */
|
||||
"An error occurred while running the updater. Please try again later." = "An error occurred while running the updater. Please try again later.";
|
||||
|
||||
"Failed to resume installing update." = "Failed to resume installing update.";
|
||||
|
||||
"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@." = "An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@.";
|
||||
/* No comment provided by engineer. */
|
||||
"An error occurred while starting the installer. Please try again later." = "An error occurred while starting the installer. Please try again later.";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"An important update to %@ is ready to install" = "An important update to %@ is ready to install";
|
||||
|
||||
"Unable to Check For Updates" = "Unable to Check For Updates";
|
||||
|
||||
"The update checker failed to start correctly. You should contact the app developer to report this issue and verify that you have the latest version" = "The update checker failed to start correctly. You should contact the app developer to report this issue and verify that you have the latest version";
|
||||
|
||||
/* the unit for bytes */
|
||||
"B" = "B";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Cancel" = "Cancel";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Cancel Update" = "Cancel Update";
|
||||
|
||||
"Checking for updates..." = "Checking for updates…";
|
||||
/* No comment provided by engineer. */
|
||||
"Checking for updates…" = "Checking for updates…";
|
||||
|
||||
/* Take care not to overflow the status window. */
|
||||
"Downloading update..." = "Downloading update…";
|
||||
"Downloading update…" = "Downloading update…";
|
||||
|
||||
/* Take care not to overflow the status window. */
|
||||
"Extracting update..." = "Extracting update…";
|
||||
"Extracting update…" = "Extracting update…";
|
||||
|
||||
/* the unit for gigabytes */
|
||||
"GB" = "GB";
|
||||
/* No comment provided by engineer. */
|
||||
"Failed to resume installing update." = "Failed to resume installing update.";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Install and Relaunch" = "Install and Relaunch";
|
||||
|
||||
/* Alternate title for 'Remind Me Later' button when downloaded updates can be resumed */
|
||||
"Install on Quit" = "Install on Quit";
|
||||
|
||||
/* Take care not to overflow the status window. */
|
||||
"Installing update..." = "Installing update…";
|
||||
"Installing update…" = "Installing update…";
|
||||
|
||||
/* Title confirmation for skipping major upgrade and future updates */
|
||||
"Are you sure you want to skip this upgrade?" = "Are you sure you want to skip this upgrade?";
|
||||
/* Alternate title for 'Install Update' button when there's no download in RSS feed. */
|
||||
"Learn More…" = "Learn More…";
|
||||
|
||||
/* Confirmation message for skipping major upgrade and future updates */
|
||||
"Skipping this major upgrade will opt out of alerts for future updates." = "Skipping this major upgrade will opt out of alerts for future updates.";
|
||||
|
||||
/* Skipping major upgrade */
|
||||
"Skip Upgrade" = "Skip Upgrade";
|
||||
|
||||
/* Not skipping a major upgrade */
|
||||
"Don't Skip" = "Don't Skip";
|
||||
|
||||
/* the unit for kilobytes */
|
||||
"KB" = "KB";
|
||||
|
||||
/* Alternative name for "Install" button if we have a paid update or other update
|
||||
without a download but with a URL. */
|
||||
"Learn More..." = "Learn More…";
|
||||
|
||||
/* the unit for megabytes */
|
||||
"MB" = "MB";
|
||||
|
||||
/* OK button. */
|
||||
/* No comment provided by engineer. */
|
||||
"OK" = "OK";
|
||||
|
||||
/* Status message on progress window once download has finished. */
|
||||
/* No comment provided by engineer. */
|
||||
"Quit %1$@, move it into your Applications folder, relaunch it from there and try again." = "Quit %1$@, move it into your Applications folder, relaunch it from there and try again.";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Ready to Install" = "Ready to Install";
|
||||
|
||||
/* Message that is optionally shown at startup to allow users to turn on/off update checks. */
|
||||
/* No comment provided by engineer. */
|
||||
"Should %1$@ automatically check for updates? You can always check for updates manually from the %1$@ menu." = "Should %1$@ automatically check for updates? You can always check for updates manually from the %1$@ menu.";
|
||||
|
||||
"The update is improperly signed." = "The update is improperly signed.";
|
||||
/* No comment provided by engineer. */
|
||||
"The update checker failed to start correctly. You should contact the app developer to report this issue and verify that you have the latest version." = "The update checker failed to start correctly. You should contact the app developer to report this issue and verify that you have the latest version.";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"The update is improperly signed and could not be validated. Please try again later or contact the app developer." = "The update is improperly signed and could not be validated. Please try again later or contact the app developer.";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Unable to Check For Updates" = "Unable to Check For Updates";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Update Error!" = "Update Error!";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Update Installed" = "Update Installed";
|
||||
|
||||
/* No comment provided by engineer. */
|
||||
"Updating %@" = "Updating %@";
|
||||
|
||||
/* 'Error' message when the user checks for updates but is already current or the feed doesn't contain any updates. (not necessarily shown in UI) */
|
||||
"You already have the newest version of %@." = "You already have the newest version of %@.";
|
||||
/* No comment provided by engineer. */
|
||||
"Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again.";
|
||||
|
||||
/* Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates. */
|
||||
"You're up-to-date!" = "You’re up to date!";
|
||||
|
||||
"Your macOS version is too old" = "Your macOS version is too old";
|
||||
|
||||
"%1$@ %2$@ is available but your macOS version is too old to install it. At least macOS %3$@ is required." = "%1$@ %2$@ is available but your macOS version is too old to install it. At least macOS %3$@ is required.";
|
||||
|
||||
"Your macOS version is too new" = "Your macOS version is too new";
|
||||
|
||||
"%1$@ %2$@ is available but your macOS version is too new for this update. This update only supports up to macOS %3$@." = "%1$@ %2$@ is available but your macOS version is too new for this update. This update only supports up to macOS %3$@.";
|
||||
|
||||
/* Used when a new update is not found */
|
||||
/* No comment provided by engineer. */
|
||||
"Version History" = "Version History";
|
||||
|
||||
/* Authorization message shown when app wants permission to update itself. */
|
||||
"%1$@ wants permission to update." = "%1$@ wants permission to update.";
|
||||
/* No comment provided by engineer. */
|
||||
"Your macOS version is too new" = "Your macOS version is too new";
|
||||
|
||||
/* Authorization message shown when app wants permission to update another app / bundle. */
|
||||
"%1$@ wants permission to update %2$@." = "%1$@ wants permission to update %2$@.";
|
||||
/* No comment provided by engineer. */
|
||||
"Your macOS version is too old" = "Your macOS version is too old";
|
||||
|
||||
/* Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates. */
|
||||
"You’re up-to-date!" = "You’re up-to-date!";
|
||||
@@ -331,7 +331,7 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
|
||||
}
|
||||
|
||||
// Note: we can launch application bundles or open plug-in bundles
|
||||
if (![[NSWorkspace sharedWorkspace] openFile:pathToRelaunch]) {
|
||||
if (![[NSWorkspace sharedWorkspace] openURL:[NSURL fileURLWithPath:pathToRelaunch isDirectory:YES]]) {
|
||||
SULog(SULogLevelError, @"Error: Failed to relaunch bundle at %@", pathToRelaunch);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -24,10 +24,10 @@
|
||||
|
||||
- (void)installerProgressShouldDisplayWithHost:(SUHost *)host
|
||||
{
|
||||
self.statusController = [[SUStatusController alloc] initWithHost:host];
|
||||
self.statusController = [[SUStatusController alloc] initWithHost:host centerPointValue:nil minimizable:NO];
|
||||
|
||||
[self.statusController setButtonTitle:SULocalizedString(@"Cancel Update", @"") target:nil action:nil isDefault:NO];
|
||||
[self.statusController beginActionWithTitle:SULocalizedString(@"Installing update...", @"") maxProgressValue:0 statusText:@""];
|
||||
[self.statusController beginActionWithTitle:SULocalizedString(@"Installing update…", @"") maxProgressValue:0 statusText:@""];
|
||||
[self.statusController showWindow:self];
|
||||
}
|
||||
|
||||
|
||||
+15
-1
@@ -98,8 +98,22 @@
|
||||
return YES;
|
||||
}
|
||||
|
||||
NSString *hostVersion = self.hostVersion;
|
||||
|
||||
// Informational update only for a set of host versions we're updating from
|
||||
return [informationalUpdateVersions containsObject:self.hostVersion];
|
||||
if ([informationalUpdateVersions containsObject:hostVersion]) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
// If an informational update version has a '<' prefix, this is an informational update if
|
||||
// hostVersion < this info update version
|
||||
for (NSString *informationalUpdateVersion in informationalUpdateVersions) {
|
||||
if ([informationalUpdateVersion hasPrefix:@"<"] && [self.applicationVersionComparator compareVersion:hostVersion toVersion:[informationalUpdateVersion substringFromIndex:1]] == NSOrderedAscending) {
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (SPUAppcastItemState *)resolveStateWithInformationalUpdateVersions:(NSSet<NSString *> * _Nullable)informationalUpdateVersions minimumOperatingSystemVersion:(NSString * _Nullable)minimumOperatingSystemVersion maximumOperatingSystemVersion:(NSString * _Nullable)maximumOperatingSystemVersion minimumAutoupdateVersion:(NSString * _Nullable)minimumAutoupdateVersion criticalUpdateDictionary:(NSDictionary * _Nullable)criticalUpdateDictionary
|
||||
|
||||
Vendored
+5
@@ -61,6 +61,11 @@
|
||||
{
|
||||
}
|
||||
|
||||
- (void)setUpdateWillInstallHandler:(void (^)(void))updateWillInstallHandler
|
||||
{
|
||||
[self.coreDriver setUpdateWillInstallHandler:updateWillInstallHandler];
|
||||
}
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders
|
||||
{
|
||||
[self.coreDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:YES requiresSilentInstall:YES];
|
||||
|
||||
Vendored
+32
-21
@@ -18,6 +18,7 @@
|
||||
#import "SPUResumableUpdate.h"
|
||||
#import "SPUAppcastItemState.h"
|
||||
#import "SUAppcastItem+Private.h"
|
||||
#import "SPUInstallationType.h"
|
||||
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
@@ -75,7 +76,7 @@
|
||||
if ([self.host isRunningTranslocated]) {
|
||||
[self.delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURunningTranslocated userInfo:@{ NSLocalizedRecoverySuggestionErrorKey: [NSString stringWithFormat:SULocalizedString(@"Quit %1$@, move it into your Applications folder, relaunch it from there and try again.", nil), hostName], NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedString(@"%1$@ can’t be updated if it’s running from the location it was downloaded to.", nil), hostName], }]];
|
||||
} else {
|
||||
[self.delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURunningFromDiskImageError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedString(@"%1$@ can't be updated, because it was opened from a read-only or a temporary location.", nil), hostName], NSLocalizedRecoverySuggestionErrorKey: [NSString stringWithFormat:SULocalizedString(@"Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again.", nil), hostName] }]];
|
||||
[self.delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURunningFromDiskImageError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedString(@"%1$@ can’t be updated, because it was opened from a read-only or a temporary location.", nil), hostName], NSLocalizedRecoverySuggestionErrorKey: [NSString stringWithFormat:SULocalizedString(@"Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again.", nil), hostName] }]];
|
||||
}
|
||||
} else {
|
||||
[self.appcastDriver loadAppcastFromURL:appcastURL userAgent:userAgent httpHeaders:httpHeaders inBackground:background];
|
||||
@@ -139,21 +140,31 @@
|
||||
- (void)notifyFoundValidUpdateWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem systemDomain:(NSNumber * _Nullable)systemDomain resuming:(BOOL)resuming
|
||||
{
|
||||
if (!self.aborted) {
|
||||
// If the update is not being resumed from a prior session, give the delegate a chance to bail
|
||||
NSError *shouldNotProceedError = nil;
|
||||
if (!resuming && [self.updaterDelegate respondsToSelector:@selector(updater:shouldProceedWithUpdate:updateCheck:error:)] && ![self.updaterDelegate updater:self.updater shouldProceedWithUpdate:updateItem updateCheck:self.updateCheck error:&shouldNotProceedError]) {
|
||||
[self.delegate basicDriverIsRequestingAbortUpdateWithError:shouldNotProceedError];
|
||||
} else {
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidFindValidUpdateNotification
|
||||
object:self.updater
|
||||
userInfo:@{ SUUpdaterAppcastItemNotificationKey: updateItem }];
|
||||
|
||||
if ([self.updaterDelegate respondsToSelector:@selector((updater:didFindValidUpdate:))]) {
|
||||
[self.updaterDelegate updater:self.updater didFindValidUpdate:updateItem];
|
||||
if (!resuming) {
|
||||
// interactive pkg based updates are not supported under root user
|
||||
if ([updateItem.installationType isEqualToString:SPUInstallationTypeInteractivePackage] && geteuid() == 0) {
|
||||
[self.delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationRootInteractiveError userInfo:@{ NSLocalizedDescriptionKey: SULocalizedString(@"Interactive based packages cannot be installed as the root user.", nil) }]];
|
||||
return;
|
||||
} else {
|
||||
// Give the delegate a chance to bail
|
||||
|
||||
NSError *shouldNotProceedError = nil;
|
||||
if ([self.updaterDelegate respondsToSelector:@selector(updater:shouldProceedWithUpdate:updateCheck:error:)] && ![self.updaterDelegate updater:self.updater shouldProceedWithUpdate:updateItem updateCheck:self.updateCheck error:&shouldNotProceedError]) {
|
||||
[self.delegate basicDriverIsRequestingAbortUpdateWithError:shouldNotProceedError];
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
[self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem systemDomain:systemDomain];
|
||||
}
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:SUUpdaterDidFindValidUpdateNotification
|
||||
object:self.updater
|
||||
userInfo:@{ SUUpdaterAppcastItemNotificationKey: updateItem }];
|
||||
|
||||
if ([self.updaterDelegate respondsToSelector:@selector((updater:didFindValidUpdate:))]) {
|
||||
[self.updaterDelegate updater:self.updater didFindValidUpdate:updateItem];
|
||||
}
|
||||
|
||||
[self.delegate basicDriverDidFindUpdateWithAppcastItem:updateItem secondaryAppcastItem:secondaryUpdateItem systemDomain:systemDomain];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,15 +184,15 @@
|
||||
switch (hostToLatestAppcastItemComparisonResult) {
|
||||
case NSOrderedDescending:
|
||||
// This means the user is a 'newer than latest' version. give a slight hint to the user instead of wrongly claiming this version is identical to the latest feed version.
|
||||
localizedDescription = SULocalizedString(@"You're up-to-date!", "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates.");
|
||||
localizedDescription = SULocalizedString(@"You’re up-to-date!", "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates.");
|
||||
|
||||
recoverySuggestion = [NSString stringWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.\n(You are currently running version %@.)", nil), [self.host name], latestAppcastItem.displayVersionString, [self.host displayVersion]];
|
||||
recoverySuggestion = [NSString stringWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.\n(You are currently running version %@.)", nil), [self.host name], latestAppcastItem.displayVersionString, [self.host displayVersion]];
|
||||
|
||||
reason = SPUNoUpdateFoundReasonOnNewerThanLatestVersion;
|
||||
break;
|
||||
case NSOrderedSame:
|
||||
// No new update is available and we're on the latest
|
||||
localizedDescription = SULocalizedString(@"You're up-to-date!", "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates.");
|
||||
localizedDescription = SULocalizedString(@"You’re up-to-date!", "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates.");
|
||||
|
||||
recoverySuggestion = [NSString stringWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.", nil), [self.host name], [self.host displayVersion]];
|
||||
|
||||
@@ -193,18 +204,18 @@
|
||||
if (!latestAppcastItem.minimumOperatingSystemVersionIsOK) {
|
||||
localizedDescription = SULocalizedString(@"Your macOS version is too old", nil);
|
||||
|
||||
recoverySuggestion = [NSString stringWithFormat:SULocalizedString(@"%1$@ %2$@ is available but your macOS version is too old to install it. At least macOS %3$@ is required.", nil), [self.host name], latestAppcastItem.versionString, latestAppcastItem.minimumSystemVersion];
|
||||
recoverySuggestion = [NSString stringWithFormat:SULocalizedString(@"%1$@ %2$@ is available but your macOS version is too old to install it. At least macOS %3$@ is required.", nil), [self.host name], latestAppcastItem.displayVersionString, latestAppcastItem.minimumSystemVersion];
|
||||
|
||||
reason = SPUNoUpdateFoundReasonSystemIsTooOld;
|
||||
} else if (!latestAppcastItem.maximumOperatingSystemVersionIsOK) {
|
||||
localizedDescription = SULocalizedString(@"Your macOS version is too new", nil);
|
||||
|
||||
recoverySuggestion = [NSString stringWithFormat:SULocalizedString(@"%1$@ %2$@ is available but your macOS version is too new for this update. This update only supports up to macOS %3$@.", nil), [self.host name], latestAppcastItem.versionString, latestAppcastItem.maximumSystemVersion];
|
||||
recoverySuggestion = [NSString stringWithFormat:SULocalizedString(@"%1$@ %2$@ is available but your macOS version is too new for this update. This update only supports up to macOS %3$@.", nil), [self.host name], latestAppcastItem.displayVersionString, latestAppcastItem.maximumSystemVersion];
|
||||
|
||||
reason = SPUNoUpdateFoundReasonSystemIsTooNew;
|
||||
} else {
|
||||
// We shouldn't realistically get here
|
||||
localizedDescription = SULocalizedString(@"You're up-to-date!", "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates.");
|
||||
localizedDescription = SULocalizedString(@"You’re up-to-date!", "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates.");
|
||||
|
||||
recoverySuggestion = [NSString stringWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.", nil), [self.host name], [self.host displayVersion]];
|
||||
|
||||
@@ -217,7 +228,7 @@
|
||||
// We will need to assume the user is up to date if the feed doen't have any applicable update items
|
||||
// There could be update items on channels the updater is not subscribed to for example. But we can't tell the user about them.
|
||||
// There could also only be update items available for other platforms or none at all.
|
||||
localizedDescription = SULocalizedString(@"You're up-to-date!", "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates.");
|
||||
localizedDescription = SULocalizedString(@"You’re up-to-date!", "Status message shown when the user checks for updates but is already current or the feed doesn't contain any updates.");
|
||||
recoverySuggestion = [NSString stringWithFormat:SULocalizedString(@"%@ %@ is currently the newest version available.", nil), [self.host name], [self.host displayVersion]];
|
||||
|
||||
reason = SPUNoUpdateFoundReasonOnLatestVersion;
|
||||
|
||||
Vendored
+3
-3
@@ -38,12 +38,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)coreDriverDidStartExtractingUpdate;
|
||||
|
||||
- (void)installerDidStartInstalling;
|
||||
- (void)installerDidStartInstallingWithApplicationTerminated:(BOOL)applicationTerminated;
|
||||
|
||||
- (void)installerDidExtractUpdateWithProgress:(double)progress;
|
||||
|
||||
- (void)installerIsSendingAppTerminationSignal;
|
||||
|
||||
- (void)installerDidFinishInstallationAndRelaunched:(BOOL)relaunched acknowledgement:(void(^)(void))acknowledgement;
|
||||
|
||||
@end
|
||||
@@ -54,6 +52,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock;
|
||||
|
||||
- (void)setUpdateWillInstallHandler:(void (^)(void))updateWillInstallHandler;
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background requiresSilentInstall:(BOOL)silentInstall;
|
||||
|
||||
- (void)resumeInstallingUpdate;
|
||||
|
||||
Vendored
+33
-23
@@ -13,6 +13,7 @@
|
||||
#import "SPUInstallerDriver.h"
|
||||
#import "SPUDownloadDriver.h"
|
||||
#import "SULog.h"
|
||||
#import "SULog+NSError.h"
|
||||
#import "SUErrors.h"
|
||||
#import "SPUResumableUpdate.h"
|
||||
#import "SPUDownloadedUpdate.h"
|
||||
@@ -88,6 +89,11 @@
|
||||
[self.basicDriver setCompletionHandler:completionBlock];
|
||||
}
|
||||
|
||||
- (void)setUpdateWillInstallHandler:(void (^)(void))updateWillInstallHandler
|
||||
{
|
||||
[self.installerDriver setUpdateWillInstallHandler:updateWillInstallHandler];
|
||||
}
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background requiresSilentInstall:(BOOL)silentInstall
|
||||
{
|
||||
self.userAgent = userAgent;
|
||||
@@ -247,24 +253,31 @@
|
||||
|
||||
- (void)downloadDriverDidFailToDownloadFileWithError:(NSError *)error
|
||||
{
|
||||
if ([self.updaterDelegate respondsToSelector:@selector((updater:failedToDownloadUpdate:error:))]) {
|
||||
NSError *errorToReport = [error.userInfo objectForKey:NSUnderlyingErrorKey];
|
||||
if (errorToReport == nil) {
|
||||
errorToReport = error;
|
||||
if ([self.updateItem isDeltaUpdate]) {
|
||||
SULog(SULogLevelError, @"Failed to download delta update. Falling back to regular update...");
|
||||
SULogError(error);
|
||||
|
||||
[self fallBackAndDownloadRegularUpdate];
|
||||
} else {
|
||||
if ([self.updaterDelegate respondsToSelector:@selector((updater:failedToDownloadUpdate:error:))]) {
|
||||
NSError *errorToReport = [error.userInfo objectForKey:NSUnderlyingErrorKey];
|
||||
if (errorToReport == nil) {
|
||||
errorToReport = error;
|
||||
}
|
||||
|
||||
[self.updaterDelegate updater:self.updater
|
||||
failedToDownloadUpdate:self.updateItem
|
||||
error:errorToReport];
|
||||
}
|
||||
|
||||
[self.updaterDelegate updater:self.updater
|
||||
failedToDownloadUpdate:self.updateItem
|
||||
error:errorToReport];
|
||||
[self.delegate coreDriverIsRequestingAbortUpdateWithError:error];
|
||||
}
|
||||
|
||||
[self.delegate coreDriverIsRequestingAbortUpdateWithError:error];
|
||||
}
|
||||
|
||||
- (void)installerDidStartInstalling
|
||||
- (void)installerDidStartInstallingWithApplicationTerminated:(BOOL)applicationTerminated
|
||||
{
|
||||
if ([self.delegate respondsToSelector:@selector(installerDidStartInstalling)]) {
|
||||
[self.delegate installerDidStartInstalling];
|
||||
if ([self.delegate respondsToSelector:@selector(installerDidStartInstallingWithApplicationTerminated:)]) {
|
||||
[self.delegate installerDidStartInstallingWithApplicationTerminated:applicationTerminated];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,14 +337,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)installerIsSendingAppTerminationSignal
|
||||
{
|
||||
// If they don't respond or do anything, we'll just install after the user terminates the app anyway
|
||||
if ([self.delegate respondsToSelector:@selector(installerIsSendingAppTerminationSignal)]) {
|
||||
[self.delegate installerIsSendingAppTerminationSignal];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)installerIsRequestingAbortInstallWithError:(nullable NSError *)error
|
||||
{
|
||||
[self.delegate coreDriverIsRequestingAbortUpdateWithError:error];
|
||||
@@ -343,15 +348,13 @@
|
||||
[self.delegate basicDriverIsRequestingAbortUpdateWithError:error];
|
||||
}
|
||||
|
||||
- (void)installerDidFailToApplyDeltaUpdate
|
||||
- (void)fallBackAndDownloadRegularUpdate
|
||||
{
|
||||
SUAppcastItem *secondaryUpdateItem = self.secondaryUpdateItem;
|
||||
assert(secondaryUpdateItem != nil);
|
||||
|
||||
BOOL backgroundDownload = self.downloadDriver.inBackground;
|
||||
|
||||
[self clearDownloadedUpdate];
|
||||
|
||||
// Fall back to the non-delta update. Note that we don't want to trigger another update was found event.
|
||||
self.updateItem = secondaryUpdateItem;
|
||||
self.secondaryUpdateItem = nil;
|
||||
@@ -359,6 +362,13 @@
|
||||
[self downloadUpdateFromAppcastItem:secondaryUpdateItem secondaryAppcastItem:nil inBackground:backgroundDownload];
|
||||
}
|
||||
|
||||
- (void)installerDidFailToApplyDeltaUpdate
|
||||
{
|
||||
[self clearDownloadedUpdate];
|
||||
|
||||
[self fallBackAndDownloadRegularUpdate];
|
||||
}
|
||||
|
||||
- (void)abortUpdateAndShowNextUpdateImmediately:(BOOL)shouldShowUpdateImmediately error:(nullable NSError *)error
|
||||
{
|
||||
[self.installerDriver abortInstall];
|
||||
|
||||
Vendored
+2
-3
@@ -16,7 +16,6 @@
|
||||
#import "SUHost.h"
|
||||
#import "SULog.h"
|
||||
#import "SUErrors.h"
|
||||
#import "SPUURLRequest.h"
|
||||
#import "SPUDownloadedUpdate.h"
|
||||
#import "SPUDownloadData.h"
|
||||
|
||||
@@ -160,9 +159,9 @@
|
||||
NSString *bundleIdentifier = self.host.bundle.bundleIdentifier;
|
||||
assert(bundleIdentifier != nil);
|
||||
|
||||
[self.downloader startPersistentDownloadWithRequest:[SPUURLRequest URLRequestWithRequest:self.request] bundleIdentifier:bundleIdentifier desiredFilename:desiredFilename];
|
||||
[self.downloader startPersistentDownloadWithRequest:self.request bundleIdentifier:bundleIdentifier desiredFilename:desiredFilename];
|
||||
} else {
|
||||
[self.downloader startTemporaryDownloadWithRequest:[SPUURLRequest URLRequestWithRequest:self.request]];
|
||||
[self.downloader startTemporaryDownloadWithRequest:self.request];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+3
-2
@@ -15,11 +15,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol SPUInstallerDriverDelegate <NSObject>
|
||||
|
||||
- (void)installerDidStartInstalling;
|
||||
- (void)installerDidStartInstallingWithApplicationTerminated:(BOOL)applicationTerminated;
|
||||
- (void)installerDidStartExtracting;
|
||||
- (void)installerDidExtractUpdateWithProgress:(double)progress;
|
||||
- (void)installerDidFinishPreparationAndWillInstallImmediately:(BOOL)willInstallImmediately silently:(BOOL)willInstallSilently;
|
||||
- (void)installerIsSendingAppTerminationSignal;
|
||||
- (void)installerWillFinishInstallationAndRelaunch:(BOOL)relaunch;
|
||||
- (void)installerDidFinishInstallationAndRelaunched:(BOOL)relaunch acknowledgement:(void(^)(void))acknowledgement;
|
||||
|
||||
@@ -34,6 +33,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)resumeInstallingUpdateWithUpdateItem:(SUAppcastItem *)updateItem systemDomain:(BOOL)systemDomain;
|
||||
|
||||
- (void)setUpdateWillInstallHandler:(void (^)(void))updateWillInstallHandler;
|
||||
|
||||
- (void)extractDownloadedUpdate:(SPUDownloadedUpdate *)downloadedUpdate silently:(BOOL)silently completion:(void (^)(NSError * _Nullable))completionHandler;
|
||||
|
||||
- (void)installWithToolAndRelaunch:(BOOL)relaunch displayingUserInterface:(BOOL)showUI;
|
||||
|
||||
Vendored
+52
-27
@@ -43,7 +43,6 @@
|
||||
@property (nonatomic, readonly) NSBundle *applicationBundle;
|
||||
@property (nonatomic, weak, readonly) id<SPUInstallerDriverDelegate> delegate;
|
||||
@property (nonatomic) SPUInstallerMessageType currentStage;
|
||||
@property (nonatomic) BOOL startedInstalling;
|
||||
|
||||
@property (nonatomic) id<SUInstallerConnectionProtocol> installerConnection;
|
||||
|
||||
@@ -65,12 +64,14 @@
|
||||
@end
|
||||
|
||||
@implementation SPUInstallerDriver
|
||||
{
|
||||
void (^_updateWillInstallHandler)(void);
|
||||
}
|
||||
|
||||
@synthesize host = _host;
|
||||
@synthesize applicationBundle = _applicationBundle;
|
||||
@synthesize delegate = _delegate;
|
||||
@synthesize currentStage = _currentStage;
|
||||
@synthesize startedInstalling = _startedInstalling;
|
||||
@synthesize installerConnection = _installerConnection;
|
||||
@synthesize extractionAttempts = _extractionAttempts;
|
||||
@synthesize postponedOnce = _postponedOnce;
|
||||
@@ -97,25 +98,56 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setUpdateWillInstallHandler:(void (^)(void))updateWillInstallHandler
|
||||
{
|
||||
_updateWillInstallHandler = [updateWillInstallHandler copy];
|
||||
}
|
||||
|
||||
- (void)_reportInstallerError:(nullable NSError *)currentInstallerError genericErrorCode:(NSInteger)genericErrorCode genericUserInfo:(NSDictionary *)genericUserInfo
|
||||
{
|
||||
// First see if there is a good custom error we can show
|
||||
// We only check for signing validation errors currently
|
||||
NSError *customError;
|
||||
// We only check for signing validation errors and installation errors due to not having write permission currently
|
||||
NSError *customError = nil;
|
||||
if (currentInstallerError != nil) {
|
||||
NSError *underlyingError = currentInstallerError.userInfo[NSUnderlyingErrorKey];
|
||||
if (underlyingError != nil && underlyingError.code == SUValidationError) {
|
||||
NSDictionary *userInfo = @{
|
||||
NSLocalizedDescriptionKey: SULocalizedString(@"The update is improperly signed and could not be validated. Please try again later or contact the app developer.", nil),
|
||||
NSUnderlyingErrorKey: (NSError * _Nonnull)currentInstallerError
|
||||
};
|
||||
|
||||
customError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:userInfo];
|
||||
} else {
|
||||
customError = nil;
|
||||
if (underlyingError != nil) {
|
||||
if (underlyingError.code == SUValidationError) {
|
||||
NSDictionary *userInfo = @{
|
||||
NSLocalizedDescriptionKey: SULocalizedString(@"The update is improperly signed and could not be validated. Please try again later or contact the app developer.", nil),
|
||||
NSUnderlyingErrorKey: (NSError * _Nonnull)currentInstallerError
|
||||
};
|
||||
|
||||
customError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:userInfo];
|
||||
} else if (underlyingError.code == SUInstallationError) {
|
||||
NSError *secondUnderlyingError = underlyingError.userInfo[NSUnderlyingErrorKey];
|
||||
if (secondUnderlyingError != nil && [secondUnderlyingError.domain isEqualToString:NSCocoaErrorDomain] && secondUnderlyingError.code == NSFileWriteNoPermissionError) {
|
||||
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||
// macOS 13 and later introduce a policy where Gatekeeper can block app modifications if the apps have different Team IDs
|
||||
BOOL warnAboutGatekeeper;
|
||||
if (@available(macOS 13, *)) {
|
||||
warnAboutGatekeeper = ![mainBundle isEqual:self.host.bundle];
|
||||
} else {
|
||||
warnAboutGatekeeper = NO;
|
||||
}
|
||||
|
||||
// Note: these error strings will only surface for external app updaters like sparkle-cli (i.e, updaters that update other app bundles)
|
||||
NSString *errorDescription;
|
||||
if (warnAboutGatekeeper) {
|
||||
SUHost *mainBundleHost = [[SUHost alloc] initWithBundle:mainBundle];
|
||||
errorDescription = [NSString stringWithFormat:SULocalizedString(@"The installation failed due to not having permission to write the new update. To install the update, you may need to allow modifications from %1$@ in System Settings under Privacy & Security and App Management", nil), mainBundleHost.name];
|
||||
} else {
|
||||
errorDescription = SULocalizedString(@"The installation failed due to not having permission to write the new update.", nil);
|
||||
}
|
||||
|
||||
NSDictionary *userInfo = @{
|
||||
NSLocalizedDescriptionKey: errorDescription,
|
||||
NSUnderlyingErrorKey: (NSError * _Nonnull)currentInstallerError
|
||||
};
|
||||
|
||||
customError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationWriteNoPermissionError userInfo:userInfo];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
customError = nil;
|
||||
}
|
||||
|
||||
// Otherwise if there's no custom error, then use a generic installer error to show
|
||||
@@ -278,9 +310,6 @@
|
||||
self.currentStage = identifier;
|
||||
} else if (identifier == SPUInstallationStartedStage1) {
|
||||
self.currentStage = identifier;
|
||||
[self.delegate installerDidStartInstalling];
|
||||
self.startedInstalling = YES;
|
||||
|
||||
} else if (identifier == SPUInstallationFinishedStage1) {
|
||||
self.currentStage = identifier;
|
||||
|
||||
@@ -308,12 +337,6 @@
|
||||
} else if (identifier == SPUInstallationFinishedStage2) {
|
||||
self.currentStage = identifier;
|
||||
|
||||
if (!self.startedInstalling) {
|
||||
// It's possible we can start from resuming to stage 2 rather than doing stage 1 again, so we should notify to start installing if we haven't done so already
|
||||
self.startedInstalling = YES;
|
||||
[self.delegate installerDidStartInstalling];
|
||||
}
|
||||
|
||||
BOOL hasTargetTerminated = NO;
|
||||
if (data.length >= sizeof(uint8_t)) {
|
||||
hasTargetTerminated = (BOOL)*((const uint8_t *)data.bytes);
|
||||
@@ -321,9 +344,7 @@
|
||||
|
||||
[self.delegate installerWillFinishInstallationAndRelaunch:self.relaunch];
|
||||
|
||||
if (!hasTargetTerminated) {
|
||||
[self.delegate installerIsSendingAppTerminationSignal];
|
||||
}
|
||||
[self.delegate installerDidStartInstallingWithApplicationTerminated:hasTargetTerminated];
|
||||
} else if (identifier == SPUInstallationFinishedStage3) {
|
||||
self.currentStage = identifier;
|
||||
|
||||
@@ -489,6 +510,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (_updateWillInstallHandler != NULL) {
|
||||
_updateWillInstallHandler();
|
||||
}
|
||||
|
||||
// Set up connection to the installer if one is not set up already
|
||||
[self setUpConnection];
|
||||
|
||||
|
||||
Vendored
+4
@@ -42,6 +42,10 @@
|
||||
{
|
||||
}
|
||||
|
||||
- (void)setUpdateWillInstallHandler:(void (^)(void))updateWillInstallHandler
|
||||
{
|
||||
}
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders
|
||||
{
|
||||
[self.basicDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:YES];
|
||||
|
||||
Vendored
+5
@@ -48,6 +48,11 @@
|
||||
self.updateDidShowHandler = handler;
|
||||
}
|
||||
|
||||
- (void)setUpdateWillInstallHandler:(void (^)(void))updateWillInstallHandler
|
||||
{
|
||||
[self.uiDriver setUpdateWillInstallHandler:updateWillInstallHandler];
|
||||
}
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders
|
||||
{
|
||||
[self.uiDriver checkForUpdatesAtAppcastURL:appcastURL withUserAgent:userAgent httpHeaders:httpHeaders inBackground:YES];
|
||||
|
||||
Vendored
+47
-22
@@ -16,33 +16,58 @@ static NSString *SURootObjectArchiveKey = @"SURootObjectArchive";
|
||||
|
||||
NSData * _Nullable SPUArchiveRootObjectSecurely(id<NSSecureCoding> rootObject)
|
||||
{
|
||||
NSMutableData *data = [NSMutableData data];
|
||||
NSKeyedArchiver *keyedArchiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data];
|
||||
keyedArchiver.requiresSecureCoding = YES;
|
||||
|
||||
@try {
|
||||
[keyedArchiver encodeObject:rootObject forKey:SURootObjectArchiveKey];
|
||||
[keyedArchiver finishEncoding];
|
||||
return [data copy];
|
||||
} @catch (NSException *exception) {
|
||||
SULog(SULogLevelError, @"Exception while securely archiving object: %@", exception);
|
||||
[keyedArchiver finishEncoding];
|
||||
return nil;
|
||||
if (@available(macOS 10.13, *)) {
|
||||
NSError *error = nil;
|
||||
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:rootObject requiringSecureCoding:YES error:&error];
|
||||
if (data == nil) {
|
||||
SULog(SULogLevelError, @"Error while securely archiving object: %@", error);
|
||||
}
|
||||
return data;
|
||||
} else {
|
||||
NSMutableData *data = [NSMutableData data];
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
NSKeyedArchiver *keyedArchiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data];
|
||||
#pragma clang diagnostic pop
|
||||
keyedArchiver.requiresSecureCoding = YES;
|
||||
|
||||
@try {
|
||||
[keyedArchiver encodeObject:rootObject forKey:SURootObjectArchiveKey];
|
||||
[keyedArchiver finishEncoding];
|
||||
return [data copy];
|
||||
} @catch (NSException *exception) {
|
||||
SULog(SULogLevelError, @"Exception while securely archiving object: %@", exception);
|
||||
[keyedArchiver finishEncoding];
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
id<NSSecureCoding> _Nullable SPUUnarchiveRootObjectSecurely(NSData *data, Class klass)
|
||||
{
|
||||
NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data];
|
||||
unarchiver.requiresSecureCoding = YES;
|
||||
|
||||
@try {
|
||||
id<NSSecureCoding> rootObject = [unarchiver decodeObjectOfClass:klass forKey:SURootObjectArchiveKey];
|
||||
[unarchiver finishDecoding];
|
||||
if (@available(macOS 10.13, *)) {
|
||||
NSError *error = nil;
|
||||
id<NSSecureCoding> rootObject = [NSKeyedUnarchiver unarchivedObjectOfClass:klass fromData:data error:&error];
|
||||
if (rootObject == nil) {
|
||||
SULog(SULogLevelError, @"Error while securely unarchiving object: %@", error);
|
||||
}
|
||||
return rootObject;
|
||||
} @catch (NSException *exception) {
|
||||
SULog(SULogLevelError, @"Exception while securely unarchiving object: %@", exception);
|
||||
[unarchiver finishDecoding];
|
||||
return nil;
|
||||
} else {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data];
|
||||
#pragma clang diagnostic pop
|
||||
unarchiver.requiresSecureCoding = YES;
|
||||
|
||||
@try {
|
||||
id<NSSecureCoding> rootObject = [unarchiver decodeObjectOfClass:klass forKey:SURootObjectArchiveKey];
|
||||
[unarchiver finishDecoding];
|
||||
return rootObject;
|
||||
} @catch (NSException *exception) {
|
||||
SULog(SULogLevelError, @"Exception while securely unarchiving object: %@", exception);
|
||||
[unarchiver finishDecoding];
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+4
-2
@@ -27,12 +27,14 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
+ (void)skipUpdate:(SUAppcastItem *)updateItem host:(SUHost *)host;
|
||||
|
||||
// At least one of minorVersion or majorVersion should be non-nil
|
||||
- (instancetype)initWithMinorVersion:(nullable NSString *)minorVersion majorVersion:(nullable NSString *)majorVersion;
|
||||
- (instancetype)initWithMinorVersion:(nullable NSString *)minorVersion majorVersion:(nullable NSString *)majorVersion majorSubreleaseVersion:(nullable NSString *)majorSubreleaseVersion;
|
||||
|
||||
// At least one of these version properties will be non-nil
|
||||
// At least one of these two version properties will be non-nil
|
||||
@property (nonatomic, readonly, nullable) NSString *minorVersion;
|
||||
@property (nonatomic, readonly, nullable) NSString *majorVersion;
|
||||
|
||||
@property (nonatomic, readonly, nullable) NSString *majorSubreleaseVersion;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
Vendored
+9
-3
@@ -18,13 +18,15 @@
|
||||
|
||||
@synthesize minorVersion = _minorVersion;
|
||||
@synthesize majorVersion = _majorVersion;
|
||||
@synthesize majorSubreleaseVersion = _majorSubreleaseVersion;
|
||||
|
||||
- (instancetype)initWithMinorVersion:(nullable NSString *)minorVersion majorVersion:(nullable NSString *)majorVersion
|
||||
- (instancetype)initWithMinorVersion:(nullable NSString *)minorVersion majorVersion:(nullable NSString *)majorVersion majorSubreleaseVersion:(nullable NSString *)majorSubreleaseVersion
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_minorVersion = [minorVersion copy];
|
||||
_majorVersion = [majorVersion copy];
|
||||
_majorSubreleaseVersion = [majorSubreleaseVersion copy];
|
||||
|
||||
assert(_minorVersion != nil || _majorVersion != nil);
|
||||
}
|
||||
@@ -35,9 +37,10 @@
|
||||
{
|
||||
NSString *minorVersion = [host objectForUserDefaultsKey:SUSkippedMinorVersionKey];
|
||||
NSString *majorVersion = [host objectForUserDefaultsKey:SUSkippedMajorVersionKey];
|
||||
NSString *majorSubreleaseVersion = [host objectForUserDefaultsKey:SUSkippedMajorSubreleaseVersionKey];
|
||||
|
||||
if (minorVersion != nil || majorVersion != nil) {
|
||||
return [[SPUSkippedUpdate alloc] initWithMinorVersion:minorVersion majorVersion:majorVersion];
|
||||
return [[SPUSkippedUpdate alloc] initWithMinorVersion:minorVersion majorVersion:majorVersion majorSubreleaseVersion:majorSubreleaseVersion];
|
||||
} else {
|
||||
return nil;
|
||||
}
|
||||
@@ -47,17 +50,20 @@
|
||||
{
|
||||
[host setObject:nil forUserDefaultsKey:SUSkippedMinorVersionKey];
|
||||
[host setObject:nil forUserDefaultsKey:SUSkippedMajorVersionKey];
|
||||
[host setObject:nil forUserDefaultsKey:SUSkippedMajorSubreleaseVersionKey];
|
||||
}
|
||||
|
||||
+ (void)skipUpdate:(SUAppcastItem *)updateItem host:(SUHost *)host
|
||||
{
|
||||
NSString *version = updateItem.versionString;
|
||||
|
||||
if (updateItem.majorUpgrade) {
|
||||
NSString *majorVersion = updateItem.minimumAutoupdateVersion;
|
||||
assert(majorVersion != nil);
|
||||
|
||||
[host setObject:majorVersion forUserDefaultsKey:SUSkippedMajorVersionKey];
|
||||
[host setObject:version forUserDefaultsKey:SUSkippedMajorSubreleaseVersionKey];
|
||||
} else {
|
||||
NSString *version = updateItem.versionString;
|
||||
[host setObject:version forUserDefaultsKey:SUSkippedMinorVersionKey];
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -38,6 +38,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*/
|
||||
SU_EXPORT @interface SPUStandardUpdaterController : NSObject
|
||||
{
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wobjc-interface-ivars"
|
||||
/**
|
||||
* Interface builder outlet for the updater's delegate.
|
||||
*/
|
||||
@@ -47,6 +49,7 @@ SU_EXPORT @interface SPUStandardUpdaterController : NSObject
|
||||
* Interface builder outlet for the user driver's delegate.
|
||||
*/
|
||||
IBOutlet __weak id<SPUStandardUserDriverDelegate> userDriverDelegate;
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+386
-87
@@ -21,9 +21,18 @@
|
||||
#import "SUOperatingSystem.h"
|
||||
#import "SPUUserUpdateState.h"
|
||||
#import "SUErrors.h"
|
||||
#import "SPUInstallationType.h"
|
||||
#import "SULog.h"
|
||||
#include <time.h>
|
||||
#include <mach/mach_time.h>
|
||||
#import <IOKit/pwr_mgt/IOPMLib.h>
|
||||
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
// The amount of time the app is allowed to be idle for us to consider showing an update prompt right away when the app is active
|
||||
static const NSTimeInterval SUScheduledUpdateIdleEventLeewayInterval = DEBUG ? 30.0 : 5 * 60.0;
|
||||
|
||||
@interface SPUStandardUserDriver ()
|
||||
|
||||
@property (nonatomic, readonly) SUHost *host;
|
||||
@@ -42,9 +51,22 @@
|
||||
@property (nonatomic) SUStatusController *statusController;
|
||||
@property (nonatomic) SUUpdatePermissionPrompt *permissionPrompt;
|
||||
|
||||
@property (nonatomic) uint64_t expectedContentLength;
|
||||
@property (nonatomic) uint64_t bytesDownloaded;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SPUStandardUserDriver
|
||||
{
|
||||
mach_timebase_info_data_t _timebaseInfo;
|
||||
double _initializationTime;
|
||||
id<NSObject> _applicationBecameActiveAfterUpdateAlertBecameKeyObserver;
|
||||
NSValue *_updateAlertWindowFrameValue;
|
||||
BOOL _updateAlertWindowWasInactive;
|
||||
BOOL _loggedGentleUpdateReminderWarning;
|
||||
BOOL _regularApplicationUpdate;
|
||||
BOOL _updateReceivedUserAttention;
|
||||
}
|
||||
|
||||
@synthesize host = _host;
|
||||
@synthesize oldHostName = _oldHostName;
|
||||
@@ -56,6 +78,8 @@
|
||||
@synthesize activeUpdateAlert = _activeUpdateAlert;
|
||||
@synthesize statusController = _statusController;
|
||||
@synthesize permissionPrompt = _permissionPrompt;
|
||||
@synthesize expectedContentLength = _expectedContentLength;
|
||||
@synthesize bytesDownloaded = _bytesDownloaded;
|
||||
|
||||
#pragma mark Birth
|
||||
|
||||
@@ -67,10 +91,34 @@
|
||||
_oldHostName = _host.name;
|
||||
_oldHostBundleURL = hostBundle.bundleURL;
|
||||
_delegate = delegate;
|
||||
|
||||
kern_return_t timebaseInfoResult = mach_timebase_info(&_timebaseInfo);
|
||||
if (timebaseInfoResult != KERN_SUCCESS) {
|
||||
SULog(SULogLevelError, @"Error: failed to fill mach_timebase_info() with error %d", timebaseInfoResult);
|
||||
|
||||
_timebaseInfo.numer = 0;
|
||||
_timebaseInfo.denom = 0;
|
||||
} else {
|
||||
[self _resetInitializationTime];
|
||||
}
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (double)currentTime
|
||||
{
|
||||
if (_timebaseInfo.denom > 0) {
|
||||
return (1.0 * mach_absolute_time() * _timebaseInfo.numer / _timebaseInfo.denom);
|
||||
} else {
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_resetInitializationTime
|
||||
{
|
||||
_initializationTime = [self currentTime];
|
||||
}
|
||||
|
||||
#pragma mark Update Permission
|
||||
|
||||
- (void)showUpdatePermissionRequest:(SPUUpdatePermissionRequest *)request reply:(void (^)(SUUpdatePermissionResponse *))reply
|
||||
@@ -83,6 +131,8 @@
|
||||
|
||||
__weak __typeof__(self) weakSelf = self;
|
||||
self.permissionPrompt = [[SUUpdatePermissionPrompt alloc] initPromptWithHost:self.host request:request reply:^(SUUpdatePermissionResponse *response) {
|
||||
[weakSelf _resetInitializationTime];
|
||||
|
||||
reply(response);
|
||||
weakSelf.permissionPrompt = nil;
|
||||
}];
|
||||
@@ -92,31 +142,186 @@
|
||||
|
||||
#pragma mark Update Alert Focus
|
||||
|
||||
- (void)setUpFocusForActiveUpdateAlertWithUserInitiation:(BOOL)userInitiated
|
||||
// This private method is used by SPUUpdater when scheduling for update checks
|
||||
- (void)_logGentleScheduledUpdateReminderWarningIfNeeded
|
||||
{
|
||||
id<SPUStandardUserDriverDelegate> delegate = self.delegate;
|
||||
if (!_loggedGentleUpdateReminderWarning && (![delegate respondsToSelector:@selector(supportsGentleScheduledUpdateReminders)] || !delegate.supportsGentleScheduledUpdateReminders)) {
|
||||
BOOL isBackgroundApp = [SUApplicationInfo isBackgroundApplication:[NSApplication sharedApplication]];
|
||||
if (isBackgroundApp) {
|
||||
SULog(SULogLevelError, @"Warning: Background app automatically schedules for update checks but does not implement gentle reminders. As a result, users may not take notice to update alerts that show up in the background. Please visit https://sparkle-project.org/documentation/gentle-reminders for more information. This warning will only be logged once.");
|
||||
|
||||
_loggedGentleUpdateReminderWarning = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// updateItem should be non-nil when showing an update for first time for scheduled updates
|
||||
// If appcastItem is != nil, then state must be != nil
|
||||
- (void)setUpActiveUpdateAlertForScheduledUpdate:(SUAppcastItem * _Nullable)updateItem state:(SPUUserUpdateState * _Nullable)state
|
||||
{
|
||||
// Make sure the window is loaded in any case
|
||||
[self.activeUpdateAlert window];
|
||||
|
||||
// If the app is a menubar app or the like, we need to focus it first and alter the
|
||||
// update prompt to behave like a normal window. Otherwise if the window were hidden
|
||||
// there may be no way for the application to be activated to make it visible again.
|
||||
if ([SUApplicationInfo isBackgroundApplication:[NSApplication sharedApplication]]) {
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
}
|
||||
[self _removeApplicationBecomeActiveObserver];
|
||||
|
||||
// Only show the update alert if the app is active; otherwise, we'll wait until it is.
|
||||
if ([NSApp isActive]) {
|
||||
[self.activeUpdateAlert setInstallButtonFocus:userInitiated];
|
||||
if (updateItem == nil) {
|
||||
// This is a user initiated check or a check to bring the already shown update back in focus
|
||||
if (![NSApp isActive]) {
|
||||
// If the user initiated an update check, we should make the app active,
|
||||
// regardless if it's a background running app or not
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
}
|
||||
|
||||
[self.activeUpdateAlert showWindow:nil];
|
||||
[self.activeUpdateAlert setInstallButtonFocus:YES];
|
||||
} else {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive:) name:NSApplicationDidBecomeActiveNotification object:NSApp];
|
||||
// Handle scheduled update check
|
||||
uint64_t timeElapsedSinceInitialization = (uint64_t)([self currentTime] - _initializationTime);
|
||||
|
||||
// Give scheduled update alerts priority if 3 or less seconds have passed since initialization
|
||||
BOOL appNearUpdaterInitialization = (timeElapsedSinceInitialization <= 3000000000ULL);
|
||||
|
||||
// We will always show an update alert at the right time
|
||||
[self.activeUpdateAlert setInstallButtonFocus:YES];
|
||||
|
||||
// If the delegate doesn't override our behavior:
|
||||
// For regular applications, only show the update alert if the app is active and if it's an an opportune time, otherwise, we'll wait until the app becomes active again.
|
||||
// For background applications, if the app is active, we will show the update window ordered back.
|
||||
// If the app is inactive, we'll show the update alert in the background behind other running apps
|
||||
// But we are near app launch, we will activate the app and show the alert as key
|
||||
BOOL backgroundApp = [SUApplicationInfo isBackgroundApplication:NSApp];
|
||||
BOOL driverShowingUpdateNow;
|
||||
BOOL immediateFocus;
|
||||
BOOL showingUpdateInBack;
|
||||
BOOL activatingApp;
|
||||
if ([NSApp isActive]) {
|
||||
BOOL systemHasBeenIdle;
|
||||
{
|
||||
// If the system has been inactive for several minutes, allow the update alert to show up immediately. We assume it's likely the user isn't at their computer in this case.
|
||||
// Note this is not done for background running applications.
|
||||
CFTimeInterval timeSinceLastEvent;
|
||||
if (!appNearUpdaterInitialization && !backgroundApp) {
|
||||
timeSinceLastEvent = CGEventSourceSecondsSinceLastEventType(kCGEventSourceStateHIDSystemState, kCGAnyInputEventType);
|
||||
|
||||
if (timeSinceLastEvent >= SUScheduledUpdateIdleEventLeewayInterval) {
|
||||
// Make sure there's no active power management assertions preventing
|
||||
// the display from sleeping by the current application.
|
||||
// If there is, then the app may still actively be in use
|
||||
CFDictionaryRef cfAssertions = NULL;
|
||||
if (IOPMCopyAssertionsByProcess(&cfAssertions) == kIOReturnSuccess) {
|
||||
NSDictionary<NSNumber *, NSArray<NSDictionary<NSString *, id> *> *> *assertions = CFBridgingRelease(cfAssertions);
|
||||
|
||||
pid_t currentProcessIdentifier = NSRunningApplication.currentApplication.processIdentifier;
|
||||
|
||||
NSNumber *processIdentifierKey = @(currentProcessIdentifier);
|
||||
NSArray<NSDictionary<NSString *, id> *> *currentProcessAssertions = assertions[processIdentifierKey];
|
||||
|
||||
BOOL foundNoDisplaySleepAssertion = NO;
|
||||
for (NSDictionary<NSString *, id> *assertion in currentProcessAssertions) {
|
||||
NSString *assertionType = assertion[(NSString *)kIOPMAssertionTypeKey];
|
||||
NSNumber *assertionLevel = assertion[(NSString *)kIOPMAssertionLevelKey];
|
||||
if ([assertionType isEqualToString:(NSString *)kIOPMAssertionTypeNoDisplaySleep] && [assertionLevel isEqual:@(kIOPMAssertionLevelOn)]) {
|
||||
|
||||
foundNoDisplaySleepAssertion = YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
systemHasBeenIdle = !foundNoDisplaySleepAssertion;
|
||||
} else {
|
||||
systemHasBeenIdle = NO;
|
||||
}
|
||||
} else {
|
||||
systemHasBeenIdle = NO;
|
||||
}
|
||||
} else {
|
||||
systemHasBeenIdle = NO;
|
||||
}
|
||||
}
|
||||
|
||||
if (appNearUpdaterInitialization || systemHasBeenIdle) {
|
||||
driverShowingUpdateNow = YES;
|
||||
immediateFocus = YES;
|
||||
showingUpdateInBack = NO;
|
||||
activatingApp = backgroundApp;
|
||||
} else {
|
||||
driverShowingUpdateNow = backgroundApp;
|
||||
immediateFocus = NO;
|
||||
// If there is a key window active in the app, show the update alert behind other windows
|
||||
showingUpdateInBack = backgroundApp && ([NSApp keyWindow] != nil);
|
||||
activatingApp = NO;
|
||||
}
|
||||
} else {
|
||||
// For regular applications, we will show the update alert when the user comes back to the app
|
||||
// For background applications, we will show the update alert right away but in the background,
|
||||
// unless focus is requested
|
||||
if (!backgroundApp) {
|
||||
driverShowingUpdateNow = NO;
|
||||
immediateFocus = NO;
|
||||
showingUpdateInBack = NO;
|
||||
activatingApp = NO;
|
||||
} else {
|
||||
driverShowingUpdateNow = YES;
|
||||
immediateFocus = appNearUpdaterInitialization;
|
||||
showingUpdateInBack = NO;
|
||||
activatingApp = appNearUpdaterInitialization;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL handleShowingUpdates;
|
||||
if ([self.delegate respondsToSelector:@selector(standardUserDriverShouldHandleShowingScheduledUpdate:andInImmediateFocus:)]) {
|
||||
handleShowingUpdates = [self.delegate standardUserDriverShouldHandleShowingScheduledUpdate:(SUAppcastItem * _Nonnull)updateItem andInImmediateFocus:immediateFocus];
|
||||
} else {
|
||||
handleShowingUpdates = YES;
|
||||
}
|
||||
|
||||
if (!handleShowingUpdates) {
|
||||
// Delay a runloop cycle to make sure the update can properly be checked
|
||||
SPUStandardUserDriver *__weak weakSelf = self;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
id<SPUStandardUserDriverDelegate> delegate = weakSelf.delegate;
|
||||
if ([delegate respondsToSelector:@selector(standardUserDriverWillHandleShowingUpdate:forUpdate:state:)]) {
|
||||
[delegate standardUserDriverWillHandleShowingUpdate:handleShowingUpdates forUpdate:(SUAppcastItem * _Nonnull)updateItem state:(SPUUserUpdateState * _Nonnull)state];
|
||||
} else {
|
||||
SULog(SULogLevelError, @"Error: Delegate <%@> is handling showing scheduled update but does not implement %@", delegate, NSStringFromSelector(@selector(standardUserDriverWillHandleShowingUpdate:forUpdate:state:)));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// The update will be shown, but not necessarily immediately if !driverShowingUpdateNow
|
||||
// It is useful to post this early in case the delegate wants to post a notification
|
||||
if ([self.delegate respondsToSelector:@selector(standardUserDriverWillHandleShowingUpdate:forUpdate:state:)]) {
|
||||
[self.delegate standardUserDriverWillHandleShowingUpdate:handleShowingUpdates forUpdate:(SUAppcastItem * _Nonnull)updateItem state:(SPUUserUpdateState * _Nonnull)state];
|
||||
}
|
||||
|
||||
if (!driverShowingUpdateNow) {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive:) name:NSApplicationDidBecomeActiveNotification object:NSApp];
|
||||
} else {
|
||||
if (activatingApp) {
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
}
|
||||
|
||||
if (showingUpdateInBack) {
|
||||
[self.activeUpdateAlert.window orderBack:nil];
|
||||
} else {
|
||||
[self.activeUpdateAlert showWindow:nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_removeApplicationBecomeActiveObserver
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSApplicationDidBecomeActiveNotification object:NSApp];
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(NSNotification *)__unused aNotification
|
||||
{
|
||||
[self.activeUpdateAlert showWindow:nil];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSApplicationDidBecomeActiveNotification object:NSApp];
|
||||
[self.activeUpdateAlert setInstallButtonFocus:YES];
|
||||
|
||||
[self _removeApplicationBecomeActiveObserver];
|
||||
}
|
||||
|
||||
#pragma mark Update Found
|
||||
@@ -132,13 +337,84 @@
|
||||
versionDisplayer = [self.delegate standardUserDriverRequestsVersionDisplayer];
|
||||
}
|
||||
|
||||
BOOL needsToObserveUserAttention = [self.delegate respondsToSelector:@selector(standardUserDriverDidReceiveUserAttentionForUpdate:)];
|
||||
|
||||
__weak SPUStandardUserDriver *weakSelf = self;
|
||||
self.activeUpdateAlert = [[SUUpdateAlert alloc] initWithAppcastItem:appcastItem state:state host:self.host versionDisplayer:versionDisplayer completionBlock:^(SPUUserUpdateChoice choice) {
|
||||
__weak id<SPUStandardUserDriverDelegate> weakDelegate = self.delegate;
|
||||
self.activeUpdateAlert = [[SUUpdateAlert alloc] initWithAppcastItem:appcastItem state:state host:self.host versionDisplayer:versionDisplayer completionBlock:^(SPUUserUpdateChoice choice, NSRect windowFrame, BOOL wasKeyWindow) {
|
||||
reply(choice);
|
||||
weakSelf.activeUpdateAlert = nil;
|
||||
|
||||
SPUStandardUserDriver *strongSelf = weakSelf;
|
||||
|
||||
if (strongSelf != nil) {
|
||||
if (needsToObserveUserAttention && !strongSelf->_updateReceivedUserAttention) {
|
||||
strongSelf->_updateReceivedUserAttention = YES;
|
||||
|
||||
id<SPUStandardUserDriverDelegate> strongDelegate = weakDelegate;
|
||||
// needsToObserveUserAttention already checks delegate responds to this selector
|
||||
[strongDelegate standardUserDriverDidReceiveUserAttentionForUpdate:appcastItem];
|
||||
}
|
||||
|
||||
// Record the window frame of the update alert right before we deallocate it
|
||||
// So we can center future status window to where the update alert last was.
|
||||
// Also record if the window was inactive at the time a response was made
|
||||
// (the window may not be key if the window e.g. holds command while clicking on a response button)
|
||||
strongSelf->_updateAlertWindowFrameValue = [NSValue valueWithRect:windowFrame];
|
||||
strongSelf->_updateAlertWindowWasInactive = !wasKeyWindow;
|
||||
|
||||
strongSelf.activeUpdateAlert = nil;
|
||||
}
|
||||
} didBecomeKeyBlock:^{
|
||||
if (!needsToObserveUserAttention) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ([NSApp isActive]) {
|
||||
SPUStandardUserDriver *strongSelf = weakSelf;
|
||||
if (strongSelf != nil && !strongSelf->_updateReceivedUserAttention) {
|
||||
strongSelf->_updateReceivedUserAttention = YES;
|
||||
|
||||
id<SPUStandardUserDriverDelegate> strongDelegate = weakDelegate;
|
||||
// needsToObserveUserAttention already checks delegate responds to this selector
|
||||
[strongDelegate standardUserDriverDidReceiveUserAttentionForUpdate:appcastItem];
|
||||
}
|
||||
} else {
|
||||
// We need to listen for when the app becomes active again, and then test if the window alert
|
||||
// is still key. if it is, let the delegate know. Remove the observation after that.
|
||||
|
||||
SPUStandardUserDriver *strongSelfOuter = weakSelf;
|
||||
if (strongSelfOuter != nil && strongSelfOuter->_applicationBecameActiveAfterUpdateAlertBecameKeyObserver == nil) {
|
||||
strongSelfOuter->_applicationBecameActiveAfterUpdateAlertBecameKeyObserver = [[NSNotificationCenter defaultCenter] addObserverForName:NSApplicationDidBecomeActiveNotification object:NSApp queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification * _Nonnull __unused note) {
|
||||
SPUStandardUserDriver *strongSelf = weakSelf;
|
||||
if (strongSelf != nil) {
|
||||
if (!strongSelf->_updateReceivedUserAttention && [strongSelf.activeUpdateAlert.window isKeyWindow]) {
|
||||
strongSelf->_updateReceivedUserAttention = YES;
|
||||
|
||||
id<SPUStandardUserDriverDelegate> strongDelegate = weakDelegate;
|
||||
// needsToObserveUserAttention already checks delegate responds to this selector
|
||||
[strongDelegate standardUserDriverDidReceiveUserAttentionForUpdate:appcastItem];
|
||||
}
|
||||
|
||||
if (strongSelf->_applicationBecameActiveAfterUpdateAlertBecameKeyObserver != nil) {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:strongSelf->_applicationBecameActiveAfterUpdateAlertBecameKeyObserver];
|
||||
|
||||
strongSelf->_applicationBecameActiveAfterUpdateAlertBecameKeyObserver = nil;
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
||||
[self setUpFocusForActiveUpdateAlertWithUserInitiation:state.userInitiated];
|
||||
_regularApplicationUpdate = [appcastItem.installationType isEqualToString:SPUInstallationTypeApplication];
|
||||
|
||||
// For user initiated checks, let the delegate know we'll be showing an update
|
||||
// For scheduled checks, -setUpActiveUpdateAlertForUpdate:state: below will handle this
|
||||
if (state.userInitiated && [self.delegate respondsToSelector:@selector(standardUserDriverWillHandleShowingUpdate:forUpdate:state:)]) {
|
||||
[self.delegate standardUserDriverWillHandleShowingUpdate:YES forUpdate:appcastItem state:state];
|
||||
}
|
||||
|
||||
[self setUpActiveUpdateAlertForScheduledUpdate:(state.userInitiated ? nil : appcastItem) state:state];
|
||||
}
|
||||
|
||||
- (void)showUpdateReleaseNotesWithDownloadData:(SPUDownloadData *)downloadData
|
||||
@@ -160,12 +436,26 @@
|
||||
|
||||
- (void)showUpdateInFocus
|
||||
{
|
||||
BOOL mayNeedToActivateApp;
|
||||
if (self.activeUpdateAlert != nil) {
|
||||
[self setUpFocusForActiveUpdateAlertWithUserInitiation:YES];
|
||||
[self setUpActiveUpdateAlertForScheduledUpdate:nil state:nil];
|
||||
mayNeedToActivateApp = NO;
|
||||
} else if (self.permissionPrompt != nil) {
|
||||
[self.permissionPrompt showWindow:nil];
|
||||
mayNeedToActivateApp = YES;
|
||||
} else if (self.statusController != nil) {
|
||||
[self.statusController showWindow:nil];
|
||||
mayNeedToActivateApp = YES;
|
||||
} else if (self.checkingController != nil) {
|
||||
[self.checkingController showWindow:nil];
|
||||
mayNeedToActivateApp = YES;
|
||||
} else {
|
||||
mayNeedToActivateApp = NO;
|
||||
}
|
||||
|
||||
if (mayNeedToActivateApp && ![NSApp isActive]) {
|
||||
// Make the app active if it's not already active, e.g, from a menu bar extra
|
||||
[NSApp activateIgnoringOtherApps:YES];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,9 +493,9 @@
|
||||
|
||||
self.cancellation = cancellation;
|
||||
|
||||
self.checkingController = [[SUStatusController alloc] initWithHost:self.host];
|
||||
self.checkingController = [[SUStatusController alloc] initWithHost:self.host centerPointValue:nil minimizable:NO];
|
||||
[[self.checkingController window] center]; // Force the checking controller to load its window.
|
||||
[self.checkingController beginActionWithTitle:SULocalizedString(@"Checking for updates...", nil) maxProgressValue:0.0 statusText:nil];
|
||||
[self.checkingController beginActionWithTitle:SULocalizedString(@"Checking for updates…", nil) maxProgressValue:0.0 statusText:nil];
|
||||
[self.checkingController setButtonTitle:SULocalizedString(@"Cancel", nil) target:self action:@selector(cancelCheckForUpdates:) isDefault:NO];
|
||||
[self.checkingController showWindow:self];
|
||||
|
||||
@@ -308,7 +598,7 @@
|
||||
case SPUNoUpdateFoundReasonSystemIsTooNew:
|
||||
if (latestAppcastItem.infoURL != nil) {
|
||||
// Show the user the product's link if available
|
||||
[alert addButtonWithTitle:SULocalizedString(@"Learn More...", nil)];
|
||||
[alert addButtonWithTitle:SULocalizedString(@"Learn More…", nil)];
|
||||
|
||||
secondaryAction = ^{
|
||||
[[NSWorkspace sharedWorkspace] openURL:(NSURL * _Nonnull)latestAppcastItem.infoURL];
|
||||
@@ -333,10 +623,6 @@
|
||||
[delegate standardUserDriverWillShowModalAlert];
|
||||
}
|
||||
|
||||
// When showing a modal alert we need to ensure that background applications
|
||||
// are focused to inform the user since there is no dock icon to notify them.
|
||||
if ([SUApplicationInfo isBackgroundApplication:[NSApplication sharedApplication]]) { [[NSApplication sharedApplication] activateIgnoringOtherApps:YES]; }
|
||||
|
||||
[alert setIcon:[SUApplicationInfo bestIconForHost:self.host]];
|
||||
|
||||
NSModalResponse response = [alert runModal];
|
||||
@@ -354,8 +640,34 @@
|
||||
- (void)createAndShowStatusController
|
||||
{
|
||||
if (self.statusController == nil) {
|
||||
self.statusController = [[SUStatusController alloc] initWithHost:self.host];
|
||||
[self.statusController showWindow:self];
|
||||
// We will make the status window minimizable for regular app updates which are often
|
||||
// quick and atomic to install on quit. But we won't do this for package based updates.
|
||||
BOOL minimizable;
|
||||
if (!_regularApplicationUpdate) {
|
||||
minimizable = NO;
|
||||
} else if ([self.delegate respondsToSelector:@selector(standardUserDriverAllowsMinimizableStatusWindow)]) {
|
||||
minimizable = [self.delegate standardUserDriverAllowsMinimizableStatusWindow];
|
||||
} else {
|
||||
minimizable = YES;
|
||||
}
|
||||
|
||||
NSValue *centerPointValue;
|
||||
if (_updateAlertWindowFrameValue != nil) {
|
||||
NSRect updateAlertFrame = _updateAlertWindowFrameValue.rectValue;
|
||||
NSPoint centerPoint = NSMakePoint(updateAlertFrame.origin.x + updateAlertFrame.size.width / 2.0, updateAlertFrame.origin.y + updateAlertFrame.size.height / 2.0);
|
||||
|
||||
centerPointValue = [NSValue valueWithPoint:centerPoint];
|
||||
} else {
|
||||
centerPointValue = nil;
|
||||
}
|
||||
|
||||
self.statusController = [[SUStatusController alloc] initWithHost:self.host centerPointValue:centerPointValue minimizable:minimizable];
|
||||
|
||||
if (_updateAlertWindowWasInactive) {
|
||||
[self.statusController.window orderFront:nil];
|
||||
} else {
|
||||
[self.statusController showWindow:self];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,8 +678,12 @@
|
||||
self.cancellation = cancellation;
|
||||
|
||||
[self createAndShowStatusController];
|
||||
[self.statusController beginActionWithTitle:SULocalizedString(@"Downloading update...", @"Take care not to overflow the status window.") maxProgressValue:0.0 statusText:nil];
|
||||
|
||||
[self.statusController beginActionWithTitle:SULocalizedString(@"Downloading update…", @"Take care not to overflow the status window.") maxProgressValue:1.0 statusText:nil];
|
||||
[self.statusController setProgressValue:0.0];
|
||||
[self.statusController setButtonTitle:SULocalizedString(@"Cancel", nil) target:self action:@selector(cancelDownload:) isDefault:NO];
|
||||
|
||||
self.bytesDownloaded = 0;
|
||||
}
|
||||
|
||||
- (void)cancelDownload:(id)__unused sender
|
||||
@@ -382,55 +698,30 @@
|
||||
{
|
||||
assert(NSThread.isMainThread);
|
||||
|
||||
[self.statusController setMaxProgressValue:expectedContentLength];
|
||||
}
|
||||
|
||||
- (NSString *)localizedStringFromByteCount:(long long)value
|
||||
{
|
||||
if (![SUOperatingSystem isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10, 8, 0}]) {
|
||||
if (value < 1000) {
|
||||
return [NSString stringWithFormat:@"%.0lf %@", value / 1.0,
|
||||
SULocalizedString(@"B", @"the unit for bytes")];
|
||||
}
|
||||
|
||||
if (value < 1000 * 1000) {
|
||||
return [NSString stringWithFormat:@"%.0lf %@", value / 1000.0,
|
||||
SULocalizedString(@"KB", @"the unit for kilobytes")];
|
||||
}
|
||||
|
||||
if (value < 1000 * 1000 * 1000) {
|
||||
return [NSString stringWithFormat:@"%.1lf %@", value / 1000.0 / 1000.0,
|
||||
SULocalizedString(@"MB", @"the unit for megabytes")];
|
||||
}
|
||||
|
||||
return [NSString stringWithFormat:@"%.2lf %@", value / 1000.0 / 1000.0 / 1000.0,
|
||||
SULocalizedString(@"GB", @"the unit for gigabytes")];
|
||||
self.expectedContentLength = expectedContentLength;
|
||||
if (expectedContentLength == 0) {
|
||||
[self.statusController setMaxProgressValue:0.0];
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wpartial-availability"
|
||||
NSByteCountFormatter *formatter = [[NSByteCountFormatter alloc] init];
|
||||
[formatter setZeroPadsFractionDigits:YES];
|
||||
return [formatter stringFromByteCount:value];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
- (void)showDownloadDidReceiveDataOfLength:(uint64_t)length
|
||||
{
|
||||
assert(NSThread.isMainThread);
|
||||
|
||||
double newProgressValue = [self.statusController progressValue] + (double)length;
|
||||
|
||||
// In case our expected content length was incorrect
|
||||
if (newProgressValue > [self.statusController maxProgressValue]) {
|
||||
[self.statusController setMaxProgressValue:newProgressValue];
|
||||
|
||||
self.bytesDownloaded += length;
|
||||
|
||||
NSByteCountFormatter *formatter = [[NSByteCountFormatter alloc] init];
|
||||
[formatter setZeroPadsFractionDigits:YES];
|
||||
|
||||
if (self.expectedContentLength > 0.0) {
|
||||
double newProgressValue = (double)self.bytesDownloaded / (double)self.expectedContentLength;
|
||||
|
||||
[self.statusController setProgressValue:MIN(newProgressValue, 1.0)];
|
||||
|
||||
[self.statusController setStatusText:[NSString stringWithFormat:SULocalizedString(@"%@ of %@", @"The download progress in units of bytes, e.g. 100 KB of 1,0 MB"), [formatter stringFromByteCount:(long long)self.bytesDownloaded], [formatter stringFromByteCount:(long long)MAX(self.bytesDownloaded, self.expectedContentLength)]]];
|
||||
} else {
|
||||
[self.statusController setStatusText:[NSString stringWithFormat:SULocalizedString(@"%@ downloaded", @"The download progress in a unit of bytes, e.g. 100 KB"), [formatter stringFromByteCount:(long long)self.bytesDownloaded]]];
|
||||
}
|
||||
|
||||
[self.statusController setProgressValue:newProgressValue];
|
||||
if ([self.statusController maxProgressValue] > 0.0)
|
||||
[self.statusController setStatusText:[NSString stringWithFormat:SULocalizedString(@"%@ of %@", nil), [self localizedStringFromByteCount:(long long)self.statusController.progressValue], [self localizedStringFromByteCount:(long long)self.statusController.maxProgressValue]]];
|
||||
else
|
||||
[self.statusController setStatusText:[NSString stringWithFormat:SULocalizedString(@"%@ downloaded", nil), [self localizedStringFromByteCount:(long long)self.statusController.progressValue]]];
|
||||
}
|
||||
|
||||
- (void)showDownloadDidStartExtractingUpdate
|
||||
@@ -440,7 +731,8 @@
|
||||
self.cancellation = nil;
|
||||
|
||||
[self createAndShowStatusController];
|
||||
[self.statusController beginActionWithTitle:SULocalizedString(@"Extracting update...", @"Take care not to overflow the status window.") maxProgressValue:0.0 statusText:nil];
|
||||
[self.statusController beginActionWithTitle:SULocalizedString(@"Extracting update…", @"Take care not to overflow the status window.") maxProgressValue:1.0 statusText:nil];
|
||||
[self.statusController setProgressValue:0.0];
|
||||
[self.statusController setButtonTitle:SULocalizedString(@"Cancel", nil) target:nil action:nil isDefault:NO];
|
||||
[self.statusController setButtonEnabled:NO];
|
||||
}
|
||||
@@ -449,18 +741,23 @@
|
||||
{
|
||||
assert(NSThread.isMainThread);
|
||||
|
||||
if ([self.statusController maxProgressValue] == 0.0) {
|
||||
[self.statusController setMaxProgressValue:1];
|
||||
}
|
||||
[self.statusController setProgressValue:progress];
|
||||
}
|
||||
|
||||
- (void)showInstallingUpdate
|
||||
- (void)showInstallingUpdateWithApplicationTerminated:(BOOL)applicationTerminated
|
||||
{
|
||||
assert(NSThread.isMainThread);
|
||||
|
||||
[self.statusController beginActionWithTitle:SULocalizedString(@"Installing update...", @"Take care not to overflow the status window.") maxProgressValue:0.0 statusText:nil];
|
||||
[self.statusController setButtonEnabled:NO];
|
||||
if (applicationTerminated) {
|
||||
[self.statusController beginActionWithTitle:SULocalizedString(@"Installing update…", @"Take care not to overflow the status window.") maxProgressValue:0.0 statusText:nil];
|
||||
[self.statusController setButtonEnabled:NO];
|
||||
} else {
|
||||
// The "quit" event can always be canceled or delayed by the application we're updating
|
||||
// So we can't easily predict how long the installation will take or if it won't happen right away
|
||||
// We close our status window because we don't want it persisting for too long and have it obscure other windows
|
||||
[self.statusController close];
|
||||
self.statusController = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)showUpdateInstalledAndRelaunched:(BOOL)relaunched acknowledgement:(void (^)(void))acknowledgement
|
||||
@@ -492,7 +789,7 @@
|
||||
}
|
||||
|
||||
if (hostVersion != nil) {
|
||||
alert.informativeText = [NSString stringWithFormat:SULocalizedString(@"%@ is now updated to version %@!", nil), hostName, hostVersion];
|
||||
alert.informativeText = [NSString stringWithFormat:SULocalizedString(@"%@ is now updated to version %@!", nil), hostName, hostVersion];
|
||||
} else {
|
||||
alert.informativeText = [NSString stringWithFormat:SULocalizedString(@"%@ is now updated!", nil), hostName];
|
||||
}
|
||||
@@ -504,21 +801,21 @@
|
||||
|
||||
#pragma mark Aborting Everything
|
||||
|
||||
- (void)showSendingTerminationSignal
|
||||
{
|
||||
assert(NSThread.isMainThread);
|
||||
|
||||
// The "quit" event can always be canceled or delayed by the application we're updating
|
||||
// So we can't easily predict how long the installation will take or if it won't happen right away
|
||||
// We close our status window because we don't want it persisting for too long and have it obscure other windows
|
||||
[self.statusController close];
|
||||
self.statusController = nil;
|
||||
}
|
||||
|
||||
- (void)dismissUpdateInstallation
|
||||
{
|
||||
assert(NSThread.isMainThread);
|
||||
|
||||
id<SPUStandardUserDriverDelegate> delegate = self.delegate;
|
||||
if ([delegate respondsToSelector:@selector(standardUserDriverWillFinishUpdateSession)]) {
|
||||
[delegate standardUserDriverWillFinishUpdateSession];
|
||||
}
|
||||
|
||||
if (_applicationBecameActiveAfterUpdateAlertBecameKeyObserver != nil) {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:_applicationBecameActiveAfterUpdateAlertBecameKeyObserver];
|
||||
_applicationBecameActiveAfterUpdateAlertBecameKeyObserver = nil;
|
||||
}
|
||||
|
||||
_updateReceivedUserAttention = NO;
|
||||
self.installUpdateHandler = nil;
|
||||
self.cancellation = nil;
|
||||
|
||||
@@ -538,6 +835,8 @@
|
||||
[self.activeUpdateAlert close];
|
||||
self.activeUpdateAlert = nil;
|
||||
}
|
||||
|
||||
[self _removeApplicationBecomeActiveObserver];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
+116
-1
@@ -16,7 +16,11 @@
|
||||
#endif
|
||||
#import <Sparkle/SUExport.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol SUVersionDisplay;
|
||||
@class SUAppcastItem;
|
||||
@class SPUUserUpdateState;
|
||||
|
||||
/**
|
||||
A protocol for Sparkle's standard user driver's delegate
|
||||
@@ -59,6 +63,117 @@ SU_EXPORT @protocol SPUStandardUserDriverDelegate <NSObject>
|
||||
|
||||
@param item The appcast item corresponding to the latest version available.
|
||||
*/
|
||||
- (void)standardUserDriverShowVersionHistoryForAppcastItem:(SUAppcastItem *_Nonnull)item;
|
||||
- (void)standardUserDriverShowVersionHistoryForAppcastItem:(SUAppcastItem *)item;
|
||||
|
||||
/**
|
||||
Specifies whether or not the download, extraction, and installing status windows allows to be minimized.
|
||||
|
||||
By default, the status window showing the current status of the update (download, extraction, ready to install) is allowed to be minimized
|
||||
for regular application bundle updates.
|
||||
|
||||
@return @c YES if the status window is allowed to be minimized (default behavior), otherwise @c NO.
|
||||
*/
|
||||
- (BOOL)standardUserDriverAllowsMinimizableStatusWindow;
|
||||
|
||||
/**
|
||||
Declares whether or not gentle scheduled update reminders are supported.
|
||||
|
||||
The delegate may implement scheduled update reminders that are presented in a gentle manner by implementing one or both of:
|
||||
`-standardUserDriverWillHandleShowingUpdate:forUpdate:state:` and `-standardUserDriverShouldHandleShowingScheduledUpdate:andInImmediateFocus:`
|
||||
|
||||
Visit https://sparkle-project.org/documentation/gentle-reminders for more information and examples.
|
||||
|
||||
@return @c YES if gentle scheduled update reminders are implemented by standard user driver delegate, otherwise @c NO (default).
|
||||
*/
|
||||
@property (nonatomic, readonly) BOOL supportsGentleScheduledUpdateReminders;
|
||||
|
||||
/**
|
||||
Specifies if the standard user driver should handle showing a new scheduled update, or if its delegate should handle showing the update instead.
|
||||
|
||||
If you implement this method and return @c NO the delegate is then responsible for showing the update,
|
||||
which must be implemented and done in `-standardUserDriverWillHandleShowingUpdate:forUpdate:state:`
|
||||
The motivation for the delegate being responsible for showing updates is to override Sparkle's default behavior
|
||||
and add gentle reminders for new updates.
|
||||
|
||||
Returning @c YES is the default behavior and allows the standard user driver to handle showing the update.
|
||||
|
||||
If the standard user driver handles showing the update, `immediateFocus` reflects whether or not it will show the update in immediate and utmost focus.
|
||||
The standard user driver may choose to show the update in immediate and utmost focus when the app was launched recently
|
||||
or the system has been idle for some time.
|
||||
|
||||
If `immediateFocus` is @c NO the standard user driver may want to defer showing the update until the user comes back to the app.
|
||||
For background running applications, when `immediateFocus` is @c NO the standard user driver will always want to show
|
||||
the update alert immediately, but behind other running applications or behind the app's own windows if it's currently active.
|
||||
|
||||
There should be no side effects made when implementing this method so you should just return @c YES or @c NO
|
||||
You will also want to implement `-standardUserDriverWillHandleShowingUpdate:forUpdate:state:` for adding additional update reminders.
|
||||
|
||||
This method is not called for user-initiated update checks. The standard user driver always handles those.
|
||||
|
||||
Visit https://sparkle-project.org/documentation/gentle-reminders for more information and examples.
|
||||
|
||||
@param update The update the standard user driver should show.
|
||||
@param immediateFocus If @c immediateFocus is @c YES, then the standard user driver proposes to show the update in immediate and utmost focus. See discussion for more details.
|
||||
|
||||
@return @c YES if the standard user should handle showing the scheduled update (default behavior), otherwise @c NO if the delegate handles showing it.
|
||||
*/
|
||||
- (BOOL)standardUserDriverShouldHandleShowingScheduledUpdate:(SUAppcastItem *)update andInImmediateFocus:(BOOL)immediateFocus;
|
||||
|
||||
/**
|
||||
Called before an update will be shown to the user.
|
||||
|
||||
If the standard user driver handles showing the update, `handleShowingUpdate` will be `YES`.
|
||||
Please see `-standardUserDriverShouldHandleShowingScheduledUpdate:andInImmediateFocus:` for how the standard user driver
|
||||
may handle showing scheduled updates when `handleShowingUpdate` is `YES` and `state.userInitiated` is `NO`.
|
||||
|
||||
If the delegate declared it handles showing the update by returning @c NO in `-standardUserDriverShouldHandleShowingScheduledUpdate:andInImmediateFocus:`
|
||||
then the delegate should handle showing update reminders in this method, or at some later point.
|
||||
In this case, `handleShowingUpdate` will be @c NO.
|
||||
To bring the update alert in focus, you may call `-[SPUStandardUpdaterController checkForUpdates:]` or `-[SPUUpdater checkForUpdates]`.
|
||||
You may want to show additional UI indicators in your application that will show this update in focus
|
||||
and want to dismiss additional UI indicators in `-standardUserDriverWillFinishUpdateSession` or `-standardUserDriverDidReceiveUserAttentionForUpdate:`
|
||||
|
||||
If `state.userInitiated` is @c YES then the standard user driver always handles showing the new update and `handleShowingUpdate` will be @c YES.
|
||||
In this case, it may still be useful for the delegate to intercept this method right before a new update will be shown.
|
||||
|
||||
This method is not called when bringing an update that has already been presented back in focus.
|
||||
|
||||
Visit https://sparkle-project.org/documentation/gentle-reminders for more information and examples.
|
||||
|
||||
@param handleShowingUpdate @c YES if the standard user driver handles showing the update, otherwise @c NO if the delegate handles showing the update.
|
||||
@param update The update that will be shown.
|
||||
@param state The user state of the update which includes if the update check was initiated by the user.
|
||||
*/
|
||||
- (void)standardUserDriverWillHandleShowingUpdate:(BOOL)handleShowingUpdate forUpdate:(SUAppcastItem *)update state:(SPUUserUpdateState *)state;
|
||||
|
||||
/**
|
||||
Called when a new update first receives attention from the user.
|
||||
|
||||
This occurs either when the user first brings the update alert in utmost focus or when the user makes a choice to install an update or dismiss/skip it.
|
||||
|
||||
This may be useful to intercept for dismissing custom attention-based UI indicators (e.g, user notifications) introduced when implementing
|
||||
`-standardUserDriverWillHandleShowingUpdate:forUpdate:state:`
|
||||
|
||||
For custom UI indicators that need to still be on screen after the user has started to install an update, please see `-standardUserDriverWillFinishUpdateSession`.
|
||||
|
||||
@param update The new update that the user gave attention to.
|
||||
*/
|
||||
- (void)standardUserDriverDidReceiveUserAttentionForUpdate:(SUAppcastItem *)update;
|
||||
|
||||
/**
|
||||
Called before the standard user driver session will finish its current update session.
|
||||
|
||||
This may occur after the user has dismissed / skipped a new update or after an update error has occurred.
|
||||
For updaters updating external/other bundles, this may also be called after an update has been successfully installed.
|
||||
|
||||
This may be useful to intercept for dismissing custom UI indicators introduced when implementing
|
||||
`-standardUserDriverWillHandleShowingUpdate:forUpdate:state:`
|
||||
|
||||
For UI indicators that need to be dismissed when the user has given attention to a new update alert,
|
||||
please see `-standardUserDriverDidReceiveUserAttentionForUpdate:`
|
||||
*/
|
||||
- (void)standardUserDriverWillFinishUpdateSession;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
Vendored
+2
@@ -33,6 +33,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)setCompletionHandler:(SPUUpdateDriverCompletion)completionBlock;
|
||||
|
||||
- (void)setUpdateWillInstallHandler:(void (^)(void))updateWillInstallHandler;
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders inBackground:(BOOL)background;
|
||||
|
||||
- (void)resumeInstallingUpdate;
|
||||
|
||||
Vendored
+22
-7
@@ -132,6 +132,11 @@
|
||||
[self.coreDriver setCompletionHandler:completionBlock];
|
||||
}
|
||||
|
||||
- (void)setUpdateWillInstallHandler:(void (^)(void))updateWillInstallHandler
|
||||
{
|
||||
[self.coreDriver setUpdateWillInstallHandler:updateWillInstallHandler];
|
||||
}
|
||||
|
||||
- (void)_clearSkippedUpdatesIfUserInitiated
|
||||
{
|
||||
if (self.userInitiated) {
|
||||
@@ -310,9 +315,24 @@
|
||||
[self.userDriver showDownloadDidStartExtractingUpdate];
|
||||
}
|
||||
|
||||
- (void)installerDidStartInstalling
|
||||
- (void)installerDidStartInstallingWithApplicationTerminated:(BOOL)applicationTerminated
|
||||
{
|
||||
[self.userDriver showInstallingUpdate];
|
||||
if ([self.userDriver respondsToSelector:@selector(showInstallingUpdateWithApplicationTerminated:)]) {
|
||||
[self.userDriver showInstallingUpdateWithApplicationTerminated:applicationTerminated];
|
||||
} else {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
if ([self.userDriver respondsToSelector:@selector(showInstallingUpdate)]) {
|
||||
[self.userDriver showInstallingUpdate];
|
||||
}
|
||||
|
||||
if (!applicationTerminated) {
|
||||
if ([self.userDriver respondsToSelector:@selector(showSendingTerminationSignal)]) {
|
||||
[self.userDriver showSendingTerminationSignal];
|
||||
}
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
}
|
||||
|
||||
- (void)installerDidExtractUpdateWithProgress:(double)progress
|
||||
@@ -331,11 +351,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)installerIsSendingAppTerminationSignal
|
||||
{
|
||||
[self.userDriver showSendingTerminationSignal];
|
||||
}
|
||||
|
||||
- (void)installerDidFinishInstallationAndRelaunched:(BOOL)relaunched acknowledgement:(void(^)(void))acknowledgement
|
||||
{
|
||||
if ([self.userDriver respondsToSelector:@selector(showUpdateInstalledAndRelaunched:acknowledgement:)]) {
|
||||
|
||||
Vendored
-31
@@ -1,31 +0,0 @@
|
||||
//
|
||||
// SPUURLRequest.h
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mayur Pawashe on 5/19/16.
|
||||
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
// A class that wraps NSURLRequest and implements NSSecureCoding
|
||||
// This class exists because NSURLRequest did not support NSSecureCoding in macOS 10.8
|
||||
// I have not verified if NSURLRequest in 10.9 implements NSSecureCoding or not
|
||||
@interface SPUURLRequest : NSObject <NSSecureCoding>
|
||||
|
||||
// Creates a new URL request
|
||||
// Only these properties are currently tracked:
|
||||
// * URL
|
||||
// * Cache policy
|
||||
// * Timeout interval
|
||||
// * HTTP header fields
|
||||
// * networkServiceType
|
||||
+ (instancetype)URLRequestWithRequest:(NSURLRequest *)request;
|
||||
|
||||
@property (nonatomic, readonly) NSURLRequest *request;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
Vendored
-94
@@ -1,94 +0,0 @@
|
||||
//
|
||||
// SPUURLRequest.m
|
||||
// Sparkle
|
||||
//
|
||||
// Created by Mayur Pawashe on 5/19/16.
|
||||
// Copyright © 2016 Sparkle Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SPUURLRequest.h"
|
||||
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
|
||||
static NSString *SPUURLRequestURLKey = @"SPUURLRequestURL";
|
||||
static NSString *SPUURLRequestCachePolicyKey = @"SPUURLRequestCachePolicy";
|
||||
static NSString *SPUURLRequestTimeoutIntervalKey = @"SPUURLRequestTimeoutInterval";
|
||||
static NSString *SPUURLRequestHttpHeaderFieldsKey = @"SPUURLRequestHttpHeaderFields";
|
||||
static NSString *SPUURLRequestNetworkServiceTypeKey = @"SPUURLRequestNetworkServiceType";
|
||||
|
||||
@interface SPUURLRequest ()
|
||||
|
||||
@property (nonatomic, readonly) NSURL *url;
|
||||
@property (nonatomic, readonly) NSURLRequestCachePolicy cachePolicy;
|
||||
@property (nonatomic, readonly) NSTimeInterval timeoutInterval;
|
||||
@property (nonatomic, readonly, nullable) NSDictionary<NSString *, NSString *> *httpHeaderFields;
|
||||
@property (nonatomic, readonly) NSURLRequestNetworkServiceType networkServiceType;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SPUURLRequest
|
||||
|
||||
@synthesize url = _url;
|
||||
@synthesize cachePolicy = _cachePolicy;
|
||||
@synthesize timeoutInterval = _timeoutInterval;
|
||||
@synthesize httpHeaderFields = _httpHeaderFields;
|
||||
@synthesize networkServiceType = _networkServiceType;
|
||||
|
||||
- (instancetype)initWithURL:(NSURL *)url cachePolicy:(NSURLRequestCachePolicy)cachePolicy timeoutInterval:(NSTimeInterval)timeoutInterval httpHeaderFields:(NSDictionary<NSString *, NSString *> *)httpHeaderFields networkServiceType:(NSURLRequestNetworkServiceType)networkServiceType
|
||||
{
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_url = url;
|
||||
_cachePolicy = cachePolicy;
|
||||
_timeoutInterval = timeoutInterval;
|
||||
_httpHeaderFields = httpHeaderFields;
|
||||
_networkServiceType = networkServiceType;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (instancetype)URLRequestWithRequest:(NSURLRequest *)request
|
||||
{
|
||||
return [(SPUURLRequest *)[[self class] alloc] initWithURL:request.URL cachePolicy:request.cachePolicy timeoutInterval:request.timeoutInterval httpHeaderFields:request.allHTTPHeaderFields networkServiceType:request.networkServiceType];
|
||||
}
|
||||
|
||||
+ (BOOL)supportsSecureCoding
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(NSCoder *)coder
|
||||
{
|
||||
[coder encodeObject:self.url forKey:SPUURLRequestURLKey];
|
||||
[coder encodeInteger:(NSInteger)self.cachePolicy forKey:SPUURLRequestCachePolicyKey];
|
||||
[coder encodeDouble:self.timeoutInterval forKey:SPUURLRequestTimeoutIntervalKey];
|
||||
[coder encodeInteger:(NSInteger)self.networkServiceType forKey:SPUURLRequestNetworkServiceTypeKey];
|
||||
|
||||
if (self.httpHeaderFields != nil) {
|
||||
[coder encodeObject:self.httpHeaderFields forKey:SPUURLRequestHttpHeaderFieldsKey];
|
||||
}
|
||||
}
|
||||
|
||||
- (instancetype)initWithCoder:(NSCoder *)decoder
|
||||
{
|
||||
NSURL *url = [decoder decodeObjectOfClass:[NSURL class] forKey:SPUURLRequestURLKey];
|
||||
NSURLRequestCachePolicy cachePolicy = (NSURLRequestCachePolicy)[decoder decodeIntegerForKey:SPUURLRequestCachePolicyKey];
|
||||
NSTimeInterval timeoutInterval = [decoder decodeDoubleForKey:SPUURLRequestTimeoutIntervalKey];
|
||||
NSDictionary<NSString *, NSString *> *httpHeaderFields = [decoder decodeObjectOfClasses:[NSSet setWithArray:@[[NSDictionary class], [NSString class]]] forKey:SPUURLRequestHttpHeaderFieldsKey];
|
||||
NSURLRequestNetworkServiceType networkServiceType = (NSURLRequestNetworkServiceType)[decoder decodeIntegerForKey:SPUURLRequestNetworkServiceTypeKey];
|
||||
|
||||
return [self initWithURL:url cachePolicy:cachePolicy timeoutInterval:timeoutInterval httpHeaderFields:httpHeaderFields networkServiceType:networkServiceType];
|
||||
}
|
||||
|
||||
- (NSURLRequest *)request
|
||||
{
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:self.url cachePolicy:self.cachePolicy timeoutInterval:self.timeoutInterval];
|
||||
if (self.httpHeaderFields != nil) {
|
||||
request.allHTTPHeaderFields = self.httpHeaderFields;
|
||||
}
|
||||
request.networkServiceType = self.networkServiceType;
|
||||
return [request copy];
|
||||
}
|
||||
|
||||
@end
|
||||
Vendored
+2
@@ -23,6 +23,8 @@ typedef void (^SPUUpdateDriverCompletion)(BOOL shouldShowUpdateImmediately, id<S
|
||||
|
||||
- (void)setUpdateShownHandler:(void (^)(void))updateShownHandler;
|
||||
|
||||
- (void)setUpdateWillInstallHandler:(void (^)(void))updateWillInstallHandler;
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders;
|
||||
|
||||
- (void)resumeInstallingUpdate;
|
||||
|
||||
Vendored
+1
@@ -177,6 +177,7 @@ SU_EXPORT @interface SPUUpdater : NSObject
|
||||
this permission request is not performed however.
|
||||
|
||||
Setting this property will persist in the host bundle's user defaults.
|
||||
Only set this property if you need dynamic behavior (e.g. user preferences).
|
||||
|
||||
The update schedule cycle will be reset in a short delay after the property's new value is set.
|
||||
This is to allow reverting this property without kicking off a schedule change immediately
|
||||
|
||||
Vendored
+25
-7
@@ -36,6 +36,12 @@
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
|
||||
@interface NSObject (SPUStandardUserDriverPrivate)
|
||||
|
||||
- (void)_logGentleScheduledUpdateReminderWarningIfNeeded;
|
||||
|
||||
@end
|
||||
|
||||
NSString *const SUUpdaterDidFinishLoadingAppCastNotification = @"SUUpdaterDidFinishLoadingAppCastNotification";
|
||||
NSString *const SUUpdaterDidFindValidUpdateNotification = @"SUUpdaterDidFindValidUpdateNotification";
|
||||
NSString *const SUUpdaterDidNotFindUpdateNotification = @"SUUpdaterDidNotFindUpdateNotification";
|
||||
@@ -94,11 +100,14 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
@synthesize loggedNoSecureKeyWarning = _loggedNoSecureKeyWarning;
|
||||
|
||||
#if DEBUG
|
||||
+ (void)load
|
||||
+ (void)initialize
|
||||
{
|
||||
// We're using NSLog instead of SULog here because we don't want to start Sparkle's logger here,
|
||||
// and because this is not really an error, just a warning notice
|
||||
NSLog(@"WARNING: This is running a Debug build of Sparkle 2; don't use this in production!");
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
// We're using NSLog instead of SULog here because we don't want to start Sparkle's logger here,
|
||||
// and because this is not really an error, just a warning notice
|
||||
NSLog(@"WARNING: This is running a Debug build of Sparkle 2; don't use this in production!");
|
||||
});
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -221,7 +230,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
SUHost *mainBundleHost = self.mainBundleHost;
|
||||
if (validateXPCServices) {
|
||||
// Check that all enabled XPC Services are embedded
|
||||
NSArray<NSString *> *xpcServiceIDs = @[@INSTALLER_LAUNCHER_BUNDLE_ID, @DOWNLOADER_BUNDLE_ID, @INSTALLER_CONNECTION_BUNDLE_ID, @INSTALLER_STATUS_BUNDLE_ID];
|
||||
NSArray<NSString *> *xpcServiceIDs = @[@INSTALLER_LAUNCHER_NAME, @DOWNLOADER_NAME, @INSTALLER_CONNECTION_NAME, @INSTALLER_STATUS_NAME];
|
||||
NSArray<NSString *> *xpcServiceEnabledKeys = @[SUEnableInstallerLauncherServiceKey, SUEnableDownloaderServiceKey, SUEnableInstallerConnectionServiceKey, SUEnableInstallerStatusServiceKey];
|
||||
NSUInteger xpcServiceCount = xpcServiceIDs.count;
|
||||
|
||||
@@ -275,7 +284,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
|
||||
NSBundle *downloaderBundle;
|
||||
if ([mainBundleHost boolForInfoDictionaryKey:SUEnableDownloaderServiceKey]) {
|
||||
NSURL *downloaderServiceBundleURL = [[[self.sparkleBundle.bundleURL URLByAppendingPathComponent:@"XPCServices"] URLByAppendingPathComponent:@DOWNLOADER_BUNDLE_ID] URLByAppendingPathExtension:@"xpc"];
|
||||
NSURL *downloaderServiceBundleURL = [[[self.sparkleBundle.bundleURL URLByAppendingPathComponent:@"XPCServices"] URLByAppendingPathComponent:@DOWNLOADER_NAME] URLByAppendingPathExtension:@"xpc"];
|
||||
downloaderBundle = [NSBundle bundleWithURL:downloaderServiceBundleURL];
|
||||
} else {
|
||||
downloaderBundle = nil;
|
||||
@@ -443,7 +452,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
{
|
||||
[self.updaterTimer invalidate];
|
||||
|
||||
if (![self automaticallyChecksForUpdates]) {
|
||||
if (!firingImmediately && ![self automaticallyChecksForUpdates]) {
|
||||
if ([self.delegate respondsToSelector:@selector(updaterWillNotScheduleUpdateCheck:)]) {
|
||||
[self.delegate updaterWillNotScheduleUpdateCheck:self];
|
||||
}
|
||||
@@ -510,6 +519,11 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
if ([self.delegate respondsToSelector:@selector(updater:willScheduleUpdateCheckAfterDelay:)]) {
|
||||
[self.delegate updater:self willScheduleUpdateCheckAfterDelay:delayUntilCheck];
|
||||
}
|
||||
|
||||
if ([self.userDriver respondsToSelector:@selector(_logGentleScheduledUpdateReminderWarningIfNeeded)]) {
|
||||
[(NSObject *)self.userDriver _logGentleScheduledUpdateReminderWarningIfNeeded];
|
||||
}
|
||||
|
||||
[self.updaterTimer startAndFireAfterDelay:delayUntilCheck];
|
||||
} else {
|
||||
// We're overdue! Run one now.
|
||||
@@ -755,6 +769,10 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
weakSelf.canCheckForUpdates = YES;
|
||||
}];
|
||||
|
||||
[self.driver setUpdateWillInstallHandler:^{
|
||||
[weakSelf updateLastUpdateCheckDate];
|
||||
}];
|
||||
|
||||
if (installerInProgress) {
|
||||
// Resume an update that has already begun installing in the background
|
||||
[self.driver resumeInstallingUpdate];
|
||||
|
||||
Vendored
+16
-20
@@ -85,7 +85,7 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
* If the state.stage is `SPUUserUpdateStateInstalling`, the installing update is also preserved after dismissing. In this state however, the update will also still be installed after the application is terminated.
|
||||
*
|
||||
* A reply of `SPUUserUpdateChoiceSkip` skips this particular version and won't notify the user again, unless they initiate an update check themselves.
|
||||
* If @c appcastItem.majorUpgrade is YES, the major update and any future minor updates to that major release are skipped.
|
||||
* If @c appcastItem.majorUpgrade is YES, the major update and any future minor updates to that major release are skipped, unless a future minor update specifies a `<sparkle:ignoreSkippedUpgradesBelowVersion>` requirement.
|
||||
* If the state.stage is `SPUUpdateStateInstalling`, the installation is also canceled when the update is skipped.
|
||||
*
|
||||
* @param appcastItem The Appcast Item containing information that reflects the new update.
|
||||
@@ -197,15 +197,6 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
*/
|
||||
- (void)showExtractionReceivedProgress:(double)progress;
|
||||
|
||||
/**
|
||||
* Show the user that the update is installing
|
||||
*
|
||||
* Let the user know that the update is currently installing. Sparkle uses this to show an indeterminate progress bar.
|
||||
*
|
||||
* Before this point, `-showExtractionReceivedProgress:` may be called.
|
||||
*/
|
||||
- (void)showInstallingUpdate;
|
||||
|
||||
/**
|
||||
* Show the user that the update is ready to install & relaunch
|
||||
*
|
||||
@@ -218,24 +209,25 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
*
|
||||
* A reply of `SPUUserUpdateChoiceSkip` cancels the current update that has begun installing and dismisses the update. In this circumstance, the update is canceled but this update version is not skipped in the future.
|
||||
*
|
||||
* Before this point, `-showInstallingUpdate` will be called.
|
||||
* Before this point, `-showExtractionReceivedProgress:` or `-showUpdateFoundWithAppcastItem:state:reply:` may be called.
|
||||
*
|
||||
* @param reply The reply which indicates if the update should be installed, dismissed, or skipped. See above discussion for more details.
|
||||
*/
|
||||
- (void)showReadyToInstallAndRelaunch:(void (^)(SPUUserUpdateChoice))reply;
|
||||
|
||||
/**
|
||||
* Show or dismiss progress while a termination signal is being sent to the application from Sparkle's installer
|
||||
* Show the user that the update is installing
|
||||
*
|
||||
* Terminating and relaunching the application (if requested to be relaunched) may happen quickly,
|
||||
* or it may take some time to perform the final installation, or the termination signal can be canceled or delayed by the application or user.
|
||||
* Let the user know that the update is currently installing.
|
||||
*
|
||||
* It is up to the implementor whether or not to decide to continue showing installation progress
|
||||
* or dismissing UI that won't remain obscuring other parts of the user interface.
|
||||
* Before this point, `-showReadyToInstallAndRelaunch:` or `-showUpdateFoundWithAppcastItem:state:reply:` will be called.
|
||||
*
|
||||
* This will not be invoked if the application that is being updated is already terminated.
|
||||
* @param applicationTerminated Indicates if the application has been terminated already.
|
||||
* If the application hasn't been terminated, a quit event is sent to the running application before installing the update.
|
||||
* If the application or user delays or cancels termination, there may be an indefinite period of time before the application fully quits.
|
||||
* It is up to the implementor whether or not to decide to continue showing installation progress in this case.
|
||||
*/
|
||||
- (void)showSendingTerminationSignal;
|
||||
- (void)showInstallingUpdateWithApplicationTerminated:(BOOL)applicationTerminated;
|
||||
|
||||
/**
|
||||
* Show the user that the update installation finished
|
||||
@@ -246,7 +238,7 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
* the updater's lifetime is tied to the application it is updating. This implementation must not try to reference
|
||||
* the old bundle prior to the installation, which will no longer be around.
|
||||
*
|
||||
* Before this point, `-showSendingTerminationSignal` or `-showReadyToInstallAndRelaunch:` may be called.
|
||||
* Before this point, `-showInstallingUpdateWithApplicationTerminated:` will be called.
|
||||
*
|
||||
* @param relaunched Indicates if the update was relaunched.
|
||||
* @param acknowledgement Acknowledge to the updater that the finished installation was shown.
|
||||
@@ -284,7 +276,11 @@ SU_EXPORT @protocol SPUUserDriver <NSObject>
|
||||
|
||||
- (void)showUpdateInstallationDidFinishWithAcknowledgement:(void (^)(void))acknowledgement __deprecated_msg("Implement -showUpdateInstalledAndRelaunched:acknowledgement: instead");
|
||||
|
||||
- (void)dismissUserInitiatedUpdateCheck __deprecated_msg("Transition to new UI appropriately when a new update is shown, when no update is found, or when an update error occurs.");;
|
||||
- (void)dismissUserInitiatedUpdateCheck __deprecated_msg("Transition to new UI appropriately when a new update is shown, when no update is found, or when an update error occurs.");
|
||||
|
||||
- (void)showInstallingUpdate __deprecated_msg("Implement -showInstallingUpdateWithApplicationTerminated: instead.");
|
||||
|
||||
- (void)showSendingTerminationSignal __deprecated_msg("Implement -showInstallingUpdateWithApplicationTerminated: instead.");
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+5
@@ -53,6 +53,11 @@
|
||||
self.updateDidShowHandler = handler;
|
||||
}
|
||||
|
||||
- (void)setUpdateWillInstallHandler:(void (^)(void))updateWillInstallHandler
|
||||
{
|
||||
[self.uiDriver setUpdateWillInstallHandler:updateWillInstallHandler];
|
||||
}
|
||||
|
||||
- (void)checkForUpdatesAtAppcastURL:(NSURL *)appcastURL withUserAgent:(NSString *)userAgent httpHeaders:(NSDictionary * _Nullable)httpHeaders
|
||||
{
|
||||
self.showingUserInitiatedProgress = YES;
|
||||
|
||||
Vendored
+7
-1
@@ -159,11 +159,17 @@
|
||||
NSMutableSet *informationalUpdateVersions = [NSMutableSet set];
|
||||
NSEnumerator *childEnum = [[node children] objectEnumerator];
|
||||
for (NSXMLNode *child in childEnum) {
|
||||
if ([child.name isEqualToString:SUAppcastAttributeVersion]) {
|
||||
if ([child.name isEqualToString:SUAppcastElementVersion]) {
|
||||
NSString *version = child.stringValue;
|
||||
if (version != nil) {
|
||||
[informationalUpdateVersions addObject:version];
|
||||
}
|
||||
} else if ([child.name isEqualToString:SUAppcastElementBelowVersion]) {
|
||||
NSString *version = child.stringValue;
|
||||
if (version != nil) {
|
||||
// Denote version is used as an upper bound by using '<'
|
||||
[informationalUpdateVersions addObject:[NSString stringWithFormat:@"<%@", version]];
|
||||
}
|
||||
}
|
||||
}
|
||||
[dict setObject:[informationalUpdateVersions copy] forKey:name];
|
||||
|
||||
Vendored
+74
-5
@@ -42,6 +42,9 @@
|
||||
@end
|
||||
|
||||
@implementation SUAppcastDriver
|
||||
{
|
||||
NSNumber * _Nullable _hostSupportsDeltaUpdates; // BOOL
|
||||
}
|
||||
|
||||
@synthesize host = _host;
|
||||
@synthesize updater = _updater;
|
||||
@@ -111,7 +114,65 @@
|
||||
{
|
||||
SUAppcastItem *deltaItem = (regularItem != nil) ? [[self class] deltaUpdateFromAppcastItem:regularItem hostVersion:self.host.version] : nil;
|
||||
|
||||
if (deltaItem != nil) {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
|
||||
if (deltaItem != nil && _hostSupportsDeltaUpdates == nil) {
|
||||
// Delta updates are not supported when bundles are transferred over to some file systems like fat32 and exfat systems
|
||||
// This is because they do not preserve permissions completely, which we require for diff'ing.
|
||||
// We shouldn't download delta updates in cases where we can detect they aren't supported
|
||||
// More accurately we will detect if the host bundle's permission bits have been 'tainted'
|
||||
// which is more reliable than checking the underlying file system.
|
||||
// To do this, we will check the Sparkle executable's permission bits, which is produced from us
|
||||
|
||||
NSFileManager *fileManager = NSFileManager.defaultManager;
|
||||
|
||||
NSBundle *hostBundle = self.host.bundle;
|
||||
NSString *sparkleExecutablePath;
|
||||
if ([hostBundle isEqual:NSBundle.mainBundle]) {
|
||||
NSBundle *sparkleBundle = [NSBundle bundleForClass:[self class]];
|
||||
sparkleExecutablePath = sparkleBundle.executableURL.URLByResolvingSymlinksInPath.path;
|
||||
} else {
|
||||
// If we are not updating ourselves, make a good guess to the Sparkle executable location
|
||||
NSURL *frameworksURL = hostBundle.privateFrameworksURL;
|
||||
NSURL *sparkleSymlinkURL = [frameworksURL URLByAppendingPathComponent:@"Sparkle.framework/Sparkle"];
|
||||
NSString *candidateExecutablePath = sparkleSymlinkURL.URLByResolvingSymlinksInPath.path;
|
||||
|
||||
if ([fileManager fileExistsAtPath:candidateExecutablePath]) {
|
||||
sparkleExecutablePath = candidateExecutablePath;
|
||||
} else {
|
||||
sparkleExecutablePath = nil;
|
||||
}
|
||||
}
|
||||
|
||||
// Only skip delta updates if permissions are not 0755
|
||||
BOOL hostSupportsDeltaUpdates;
|
||||
if (sparkleExecutablePath != nil) {
|
||||
NSError *attributesError = nil;
|
||||
NSDictionary<NSFileAttributeKey, id> *attributes = [fileManager attributesOfItemAtPath:sparkleExecutablePath error:&attributesError];
|
||||
if (attributes != nil) {
|
||||
NSNumber *posixPermissions = attributes[NSFilePosixPermissions];
|
||||
if (posixPermissions != nil && posixPermissions.shortValue != 0755) {
|
||||
hostSupportsDeltaUpdates = NO;
|
||||
|
||||
SULog(SULogLevelDefault, @"Encountered irregular POSIX permissions 0%o for Sparkle executable, which is not 0755. Skipping delta updates..", posixPermissions.shortValue);
|
||||
} else {
|
||||
hostSupportsDeltaUpdates = YES;
|
||||
}
|
||||
} else {
|
||||
hostSupportsDeltaUpdates = YES;
|
||||
|
||||
SULog(SULogLevelError, @"Error: Failed to retrieve attributes from Sparkle executable: %@", attributesError.localizedDescription);
|
||||
}
|
||||
} else {
|
||||
hostSupportsDeltaUpdates = YES;
|
||||
|
||||
SULog(SULogLevelError, @"Error: Failed to unexpectably retrieve Sparkle executable URL from %@", hostBundle.bundlePath);
|
||||
}
|
||||
|
||||
_hostSupportsDeltaUpdates = @(hostSupportsDeltaUpdates);
|
||||
}
|
||||
|
||||
if (deltaItem != nil && _hostSupportsDeltaUpdates.boolValue) {
|
||||
if (secondaryUpdate != NULL) {
|
||||
*secondaryUpdate = regularItem;
|
||||
}
|
||||
@@ -122,6 +183,7 @@
|
||||
}
|
||||
return regularItem;
|
||||
}
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
- (SUAppcastItem *)retrieveBestAppcastItemFromAppcast:(SUAppcast *)appcast versionComparator:(id<SUVersionComparison>)versionComparator secondaryUpdate:(SUAppcastItem * __autoreleasing _Nullable *)secondaryAppcastItem
|
||||
@@ -140,7 +202,6 @@
|
||||
regularItemFromDelegate = nil;
|
||||
delegateOptedOutOfSelection = NO;
|
||||
} else {
|
||||
assert(!candidateItem.deltaUpdate);
|
||||
if (candidateItem.deltaUpdate) {
|
||||
// Client would have to go out of their way to examine the .deltaUpdates to return one
|
||||
// We need them to give us a regular update item back instead..
|
||||
@@ -253,6 +314,12 @@
|
||||
return NO;
|
||||
}
|
||||
|
||||
// Delta updates cannot be top-level entries
|
||||
BOOL isDeltaUpdate = [item isDeltaUpdate];
|
||||
if (isDeltaUpdate) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
NSString *channel = item.channel;
|
||||
if (channel == nil) {
|
||||
// Item is on the default channel
|
||||
@@ -334,10 +401,12 @@
|
||||
+ (BOOL)item:(SUAppcastItem *)ui containsSkippedUpdate:(SPUSkippedUpdate * _Nullable)skippedUpdate hostPassesSkippedMajorVersion:(BOOL)hostPassesSkippedMajorVersion versionComparator:(id<SUVersionComparison>)versionComparator
|
||||
{
|
||||
NSString *skippedMajorVersion = skippedUpdate.majorVersion;
|
||||
NSString *skippedMajorSubreleaseVersion = skippedUpdate.majorSubreleaseVersion;
|
||||
|
||||
if (!hostPassesSkippedMajorVersion && skippedMajorVersion != nil && [versionComparator compareVersion:skippedMajorVersion toVersion:ui.versionString] != NSOrderedDescending) {
|
||||
// Item is on a greater or equal version than a major version we've skipped
|
||||
// So we skip this item
|
||||
if (!hostPassesSkippedMajorVersion && skippedMajorVersion != nil && ui.minimumAutoupdateVersion != nil && [versionComparator compareVersion:skippedMajorVersion toVersion:(NSString * _Nonnull)ui.minimumAutoupdateVersion] != NSOrderedAscending && (ui.ignoreSkippedUpgradesBelowVersion == nil || (skippedMajorSubreleaseVersion != nil && [versionComparator compareVersion:skippedMajorSubreleaseVersion toVersion:(NSString * _Nonnull)ui.ignoreSkippedUpgradesBelowVersion] != NSOrderedAscending))) {
|
||||
// If skipped major version is >= than the item's minimumAutoupdateVersion, we can skip the item.
|
||||
// But if there is an ignoreSkippedUpgradesBelowVersion, we can only skip the item if the last skipped subrelease
|
||||
// version is >= than that version provided by the item
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+19
-2
@@ -65,8 +65,10 @@ SU_EXPORT @interface SUAppcastItem : NSObject<NSSecureCoding>
|
||||
This corresponds to the application update's @c CFBundleShortVersionString
|
||||
|
||||
This is extracted from the @c <sparkle:shortVersionString> element, or the @c sparkle:shortVersionString attribute from the @c <enclosure> element.
|
||||
|
||||
If no short version string is available, this falls back to the update's `versionString`.
|
||||
*/
|
||||
@property (copy, readonly, nullable) NSString *displayVersionString;
|
||||
@property (copy, readonly) NSString *displayVersionString;
|
||||
|
||||
/**
|
||||
The file URL to the update item if provided.
|
||||
@@ -265,9 +267,11 @@ SU_EXPORT @interface SUAppcastItem : NSObject<NSSecureCoding>
|
||||
|
||||
Otherwise if the requirement is not met, the user is always prompted to install the update. In this case, the update is assumed to be a `majorUpgrade`.
|
||||
|
||||
If the update is a `majorUpgrade` and the update is skipped by the user, other future update alerts with the same `minimumAutoupdateVersion` will also be skipped.
|
||||
If the update is a `majorUpgrade` and the update is skipped by the user, other future update alerts with the same `minimumAutoupdateVersion` will also be skipped automatically unless an update specifies `ignoreSkippedUpgradesBelowVersion`.
|
||||
|
||||
This version string corresponds to the application's @c CFBundleVersion
|
||||
|
||||
This is extracted from the @c <sparkle:minimumAutoupdateVersion> element.
|
||||
*/
|
||||
@property (copy, readonly, nullable) NSString *minimumAutoupdateVersion;
|
||||
|
||||
@@ -278,6 +282,19 @@ SU_EXPORT @interface SUAppcastItem : NSObject<NSSecureCoding>
|
||||
*/
|
||||
@property (getter=isMajorUpgrade, readonly) BOOL majorUpgrade;
|
||||
|
||||
/**
|
||||
Previously skipped upgrades by the user will be ignored if they skipped an update whose version precedes this version.
|
||||
|
||||
This can only be applied if the update is a `majorUpgrade`.
|
||||
|
||||
This version string corresponds to the application's @c CFBundleVersion
|
||||
|
||||
This is extracted from the @c <sparkle:ignoreSkippedUpgradesBelowVersion> element.
|
||||
|
||||
Old applications must be using Sparkle 2.1 or later, otherwise this property will be ignored.
|
||||
*/
|
||||
@property (nonatomic, readonly, nullable) NSString *ignoreSkippedUpgradesBelowVersion;
|
||||
|
||||
/**
|
||||
Indicates whether or not the update item is critical.
|
||||
|
||||
|
||||
Vendored
+8
@@ -73,6 +73,7 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState";
|
||||
@synthesize propertiesDictionary = _propertiesDictionary;
|
||||
@synthesize installationType = _installationType;
|
||||
@synthesize minimumAutoupdateVersion = _minimumAutoupdateVersion;
|
||||
@synthesize ignoreSkippedUpgradesBelowVersion = _ignoreSkippedUpgradesBelowVersion;
|
||||
@synthesize phasedRolloutInterval = _phasedRolloutInterval;
|
||||
@synthesize state = _state;
|
||||
@synthesize hasCriticalInformation = _hasCriticalInformation;
|
||||
@@ -115,6 +116,7 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState";
|
||||
_maximumSystemVersion = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemMaximumSystemVersionKey] copy];
|
||||
_minimumSystemVersion = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemMinimumSystemVersionKey] copy];
|
||||
_minimumAutoupdateVersion = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastElementMinimumAutoupdateVersion] copy];
|
||||
_ignoreSkippedUpgradesBelowVersion = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastElementIgnoreSkippedUpgradesBelowVersion] copy];
|
||||
_releaseNotesURL = [decoder decodeObjectOfClass:[NSURL class] forKey:SUAppcastItemReleaseNotesURLKey];
|
||||
_fullReleaseNotesURL = [decoder decodeObjectOfClass:[NSURL class] forKey:SUAppcastItemFullReleaseNotesURLKey];
|
||||
_title = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemTitleKey] copy];
|
||||
@@ -183,6 +185,10 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState";
|
||||
[encoder encodeObject:self.minimumAutoupdateVersion forKey:SUAppcastElementMinimumAutoupdateVersion];
|
||||
}
|
||||
|
||||
if (self.ignoreSkippedUpgradesBelowVersion != nil) {
|
||||
[encoder encodeObject:self.ignoreSkippedUpgradesBelowVersion forKey:SUAppcastElementIgnoreSkippedUpgradesBelowVersion];
|
||||
}
|
||||
|
||||
if (self.state != nil) {
|
||||
[encoder encodeObject:self.state forKey:SUAppcastItemStateKey];
|
||||
}
|
||||
@@ -463,6 +469,8 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState";
|
||||
_maximumSystemVersion = [(NSString *)[dict objectForKey:SUAppcastElementMaximumSystemVersion] copy];
|
||||
_minimumAutoupdateVersion = [(NSString *)[dict objectForKey:SUAppcastElementMinimumAutoupdateVersion] copy];
|
||||
|
||||
_ignoreSkippedUpgradesBelowVersion = [(NSString *)[dict objectForKey:SUAppcastElementIgnoreSkippedUpgradesBelowVersion] copy];
|
||||
|
||||
NSString *channel = [dict objectForKey:SUAppcastElementChannel];
|
||||
if (channel != nil) {
|
||||
if (channel.length == 0) {
|
||||
|
||||
Vendored
+12
-3
@@ -12,6 +12,7 @@
|
||||
#import "SUBundleIcon.h"
|
||||
#import "SUHost.h"
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
|
||||
|
||||
@implementation SUApplicationInfo
|
||||
|
||||
@@ -36,9 +37,17 @@
|
||||
// this asumption may not be correct (eg. even though we're not the main bundle, it could be still be a regular app)
|
||||
// but still better than nothing if no icon was included
|
||||
BOOL isMainBundle = [host.bundle isEqualTo:[NSBundle mainBundle]];
|
||||
|
||||
NSString *fileType = isMainBundle ? (__bridge NSString *)kUTTypeApplication : (__bridge NSString *)kUTTypeBundle;
|
||||
icon = [[NSWorkspace sharedWorkspace] iconForFileType:fileType];
|
||||
|
||||
if (@available(macOS 11, *)) {
|
||||
UTType *contentType = isMainBundle ? UTTypeApplication : UTTypeBundle;
|
||||
icon = [[NSWorkspace sharedWorkspace] iconForContentType:contentType];
|
||||
} else {
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
NSString *fileType = isMainBundle ? (__bridge NSString *)kUTTypeApplication : (__bridge NSString *)kUTTypeBundle;
|
||||
icon = [[NSWorkspace sharedWorkspace] iconForFileType:fileType];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
}
|
||||
return icon;
|
||||
}
|
||||
|
||||
Vendored
+3
@@ -42,6 +42,7 @@ extern NSString *const SURelaunchHostBundleKey;
|
||||
extern NSString *const SUShowReleaseNotesKey;
|
||||
extern NSString *const SUSkippedMinorVersionKey;
|
||||
extern NSString *const SUSkippedMajorVersionKey;
|
||||
extern NSString *const SUSkippedMajorSubreleaseVersionKey;
|
||||
extern NSString *const SUScheduledCheckIntervalKey;
|
||||
extern NSString *const SULastCheckTimeKey;
|
||||
extern NSString *const SUExpectsDSASignatureKey;
|
||||
@@ -94,6 +95,8 @@ extern NSString *const SUAppcastElementTags;
|
||||
extern NSString *const SUAppcastElementPhasedRolloutInterval;
|
||||
extern NSString *const SUAppcastElementInformationalUpdate;
|
||||
extern NSString *const SUAppcastElementChannel;
|
||||
extern NSString *const SUAppcastElementBelowVersion;
|
||||
extern NSString *const SUAppcastElementIgnoreSkippedUpgradesBelowVersion;
|
||||
|
||||
extern NSString *const SURSSAttributeURL;
|
||||
extern NSString *const SURSSAttributeLength;
|
||||
|
||||
Vendored
+3
@@ -38,6 +38,7 @@ NSString *const SURelaunchHostBundleKey = @"SURelaunchHostBundle";
|
||||
NSString *const SUShowReleaseNotesKey = @"SUShowReleaseNotes";
|
||||
NSString *const SUSkippedMinorVersionKey = @"SUSkippedVersion";
|
||||
NSString *const SUSkippedMajorVersionKey = @"SUSkippedMajorVersion";
|
||||
NSString *const SUSkippedMajorSubreleaseVersionKey = @"SUSkippedMajorSubreleaseVersion";
|
||||
NSString *const SUScheduledCheckIntervalKey = @"SUScheduledCheckInterval";
|
||||
NSString *const SULastCheckTimeKey = @"SULastCheckTime";
|
||||
NSString *const SUExpectsDSASignatureKey = @"SUExpectsDSASignature";
|
||||
@@ -91,6 +92,8 @@ NSString *const SUAppcastElementTags = @"sparkle:tags";
|
||||
NSString *const SUAppcastElementPhasedRolloutInterval = @"sparkle:phasedRolloutInterval";
|
||||
NSString *const SUAppcastElementInformationalUpdate = @"sparkle:informationalUpdate";
|
||||
NSString *const SUAppcastElementChannel = @"sparkle:channel";
|
||||
NSString *const SUAppcastElementBelowVersion = @"sparkle:belowVersion";
|
||||
NSString *const SUAppcastElementIgnoreSkippedUpgradesBelowVersion = @"sparkle:ignoreSkippedUpgradesBelowVersion";
|
||||
|
||||
NSString *const SURSSAttributeURL = @"url";
|
||||
NSString *const SURSSAttributeLength = @"length";
|
||||
|
||||
Vendored
+2
@@ -73,6 +73,8 @@ typedef NS_ENUM(OSStatus, SUError) {
|
||||
SUInstallationAuthorizeLaterError = 4008,
|
||||
SUNotValidUpdateError = 4009,
|
||||
SUAgentInvalidationError = 4010,
|
||||
SUInstallationRootInteractiveError = 4011,
|
||||
SUInstallationWriteNoPermissionError = 4012,
|
||||
|
||||
// API misuse errors.
|
||||
SUIncorrectAPIUsageError = 5000
|
||||
|
||||
Vendored
+13
-1
@@ -69,7 +69,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
* Otherwise on failure you may need to re-try using move operations. This operation will fail on non-apfs volumes or volumes that don't support rename swapping.
|
||||
* Both originalItemURL and newItemURL must exist.
|
||||
*/
|
||||
- (BOOL)swapItemAtURL:(NSURL *)originalItemURL withItemAtURL:(NSURL *)newItemURL error:(NSError **)error __OSX_AVAILABLE(10.13);
|
||||
- (BOOL)swapItemAtURL:(NSURL *)originalItemURL withItemAtURL:(NSURL *)newItemURL error:(NSError **)error API_AVAILABLE(macos(10.13));
|
||||
|
||||
/**
|
||||
* Copies an item from a source to a destination
|
||||
@@ -108,6 +108,18 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*/
|
||||
- (BOOL)changeOwnerAndGroupOfItemAtRootURL:(NSURL *)targetURL toMatchURL:(NSURL *)matchURL error:(NSError **)error;
|
||||
|
||||
/**
|
||||
Changes the owner and group ID of an item at a specified target URL
|
||||
@param targetURL A URL pointing to the target item whose owner and group IDs to alter. The item at this URL must exist.
|
||||
@param ownerID The new owner ID to set on the item.
|
||||
@param groupID The new group ID to set on the item.
|
||||
@param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in possible errors, you may pass in NULL.
|
||||
@return YES if the target item's owner and group IDs have changed, otherwise NO along with a populated error object.
|
||||
|
||||
Unlike -changeOwnerAndGroupOfItemAtRootURL:toMatchURL:error: this method does not recursively try to change the owner and group IDs if the target item is a directory.
|
||||
*/
|
||||
- (BOOL)changeOwnerAndGroupOfItemAtURL:(NSURL *)targetURL ownerID:(uid_t)ownerID groupID:(gid_t)groupID error:(NSError * __autoreleasing *)error;
|
||||
|
||||
/**
|
||||
* Updates the modification and access time of an item at a specified target URL to the current time
|
||||
* @param targetURL A URL pointing to the target item whose modification and access time to update. The item at this URL must exist.
|
||||
|
||||
Vendored
+16
-113
@@ -21,29 +21,6 @@ extern int renamex_np(const char *, const char *, unsigned int) __attribute__((w
|
||||
|
||||
static char SUAppleQuarantineIdentifier[] = "com.apple.quarantine";
|
||||
|
||||
static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
|
||||
|
||||
char path[PATH_MAX] = {0};
|
||||
if (![url.path getFileSystemRepresentation:path maxLength:sizeof(path)]) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadInvalidFileNameError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"URL of the file (%@) cannot be represented as a file path", url.lastPathComponent] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
OSStatus makeResult = FSPathMakeRefWithOptions((const UInt8 *)path, kFSPathMakeRefDoNotFollowLeafSymlink, ref, NULL);
|
||||
#pragma clang diagnostic pop
|
||||
if (makeResult != noErr) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSOSStatusErrorDomain code:makeResult userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to create file system reference for %@", url.lastPathComponent] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
// Use direct access because it's easier, clearer, and faster
|
||||
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
|
||||
@@ -184,89 +161,15 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
|
||||
return success;
|
||||
}
|
||||
|
||||
/*
|
||||
* Copies an item from one location to another
|
||||
* This intentionally does *not* use copyfile() or any API that uses it such as NSFileManager's copy item method
|
||||
* This is because copyfile() can fail to copy symbolic links from one network mount to another, which will affect copying apps
|
||||
* This failure occurs because the system may think symbolic links on a SMB mount are zero bytes in size
|
||||
* For more info, see bug reports at http://openradar.appspot.com/radar?id=4925873463492608
|
||||
* and http://openradar.appspot.com/radar?id=5024037222744064
|
||||
*/
|
||||
- (BOOL)copyItemAtURL:(NSURL *)sourceURL toURL:(NSURL *)destinationURL error:(NSError * __autoreleasing *)error
|
||||
{
|
||||
if (![self _itemExistsAtURL:sourceURL]) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileNoSuchFileError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Source file to copy (%@) does not exist.", sourceURL.lastPathComponent] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (![self _itemExistsAtURL:destinationURL.URLByDeletingLastPathComponent]) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileNoSuchFileError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Destination parent directory to copy into (%@) does not exist.", destinationURL.URLByDeletingLastPathComponent.lastPathComponent] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
if ([self _itemExistsAtURL:destinationURL]) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteFileExistsError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Destination file to copy to (%@) already exists.", destinationURL.lastPathComponent] }];
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
FSRef sourceRef;
|
||||
if (!SUMakeRefFromURL(sourceURL, &sourceRef, error)) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
FSRef destinationParentRef;
|
||||
if (!SUMakeRefFromURL(destinationURL.URLByDeletingLastPathComponent, &destinationParentRef, error)) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
OSStatus copyResult = FSCopyObjectSync(&sourceRef, &destinationParentRef, (__bridge CFStringRef)(destinationURL.lastPathComponent), NULL, kFSFileOperationDefaultOptions);
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
if (copyResult != noErr) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSOSStatusErrorDomain code:copyResult userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to copy file (%@)", sourceURL.lastPathComponent] }];
|
||||
}
|
||||
}
|
||||
|
||||
return YES;
|
||||
return [_fileManager copyItemAtURL:sourceURL toURL:destinationURL error:error];
|
||||
}
|
||||
|
||||
/*
|
||||
* Retrieves the volume ID that a particular url resides on
|
||||
* The url must point to a file that exists
|
||||
* There is no cocoa equivalent for obtaining the volume ID
|
||||
* Although NSURLVolumeURLForRemountingKey exists as a resource key for NSURL,
|
||||
* that will not return a URL if the mount is not re-mountable and I otherwise don't trust the API
|
||||
*/
|
||||
- (BOOL)_getVolumeID:(FSVolumeRefNum *)volumeID ofItemAtURL:(NSURL *)url
|
||||
- (BOOL)_getVolumeID:(out id _Nullable __autoreleasing * _Nonnull)outVolumeIdentifier ofItemAtURL:(NSURL *)url
|
||||
{
|
||||
FSRef pathRef;
|
||||
if (!SUMakeRefFromURL(url, &pathRef, NULL)) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
FSCatalogInfo catalogInfo;
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
OSErr catalogError = FSGetCatalogInfo(&pathRef, kFSCatInfoVolume, &catalogInfo, NULL, NULL, NULL);
|
||||
#pragma clang diagnostic pop
|
||||
if (catalogError != noErr) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
if (volumeID != NULL) {
|
||||
*volumeID = catalogInfo.volume;
|
||||
}
|
||||
|
||||
return YES;
|
||||
NSError *error = nil;
|
||||
return [url getResourceValue:outVolumeIdentifier forKey:NSURLVolumeIdentifierKey error:&error];
|
||||
}
|
||||
|
||||
- (BOOL)moveItemAtURL:(NSURL *)sourceURL toURL:(NSURL *)destinationURL error:(NSError *__autoreleasing *)error
|
||||
@@ -298,20 +201,20 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
|
||||
// one network mount to another one. This is possibly related to the fact that
|
||||
// moving a file will try to preserve ownership but copying won't
|
||||
|
||||
FSVolumeRefNum sourceVolume = 0;
|
||||
BOOL foundSourceVolume = [self _getVolumeID:&sourceVolume ofItemAtURL:sourceURL];
|
||||
id sourceVolumeIdentifier = nil;
|
||||
BOOL foundSourceVolume = [self _getVolumeID:&sourceVolumeIdentifier ofItemAtURL:sourceURL];
|
||||
|
||||
FSVolumeRefNum destinationVolume = 0;
|
||||
BOOL foundDestinationVolume = [self _getVolumeID:&destinationVolume ofItemAtURL:destinationURLParent];
|
||||
id destinationVolumeIdentifier = nil;
|
||||
BOOL foundDestinationVolume = [self _getVolumeID:&destinationVolumeIdentifier ofItemAtURL:destinationURLParent];
|
||||
|
||||
if (foundSourceVolume && foundDestinationVolume && sourceVolume != destinationVolume) {
|
||||
if (foundSourceVolume && foundDestinationVolume && ![(NSObject *)sourceVolumeIdentifier isEqual:destinationVolumeIdentifier]) {
|
||||
return ([self copyItemAtURL:sourceURL toURL:destinationURL error:error] && [self removeItemAtURL:sourceURL error:error]);
|
||||
}
|
||||
|
||||
return [_fileManager moveItemAtURL:sourceURL toURL:destinationURL error:error];
|
||||
}
|
||||
|
||||
- (BOOL)swapItemAtURL:(NSURL *)originalItemURL withItemAtURL:(NSURL *)newItemURL error:(NSError * __autoreleasing *)error __OSX_AVAILABLE(10.13)
|
||||
- (BOOL)swapItemAtURL:(NSURL *)originalItemURL withItemAtURL:(NSURL *)newItemURL error:(NSError * __autoreleasing *)error API_AVAILABLE(macos(10.13))
|
||||
{
|
||||
char originalPath[PATH_MAX] = {0};
|
||||
if (![originalItemURL.path getFileSystemRepresentation:originalPath maxLength:sizeof(originalPath)]) {
|
||||
@@ -340,7 +243,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)_changeOwnerAndGroupOfItemAtURL:(NSURL *)targetURL ownerID:(NSNumber *)ownerID groupID:(NSNumber *)groupID error:(NSError * __autoreleasing *)error
|
||||
- (BOOL)changeOwnerAndGroupOfItemAtURL:(NSURL *)targetURL ownerID:(uid_t)ownerID groupID:(gid_t)groupID error:(NSError * __autoreleasing *)error
|
||||
{
|
||||
char path[PATH_MAX] = {0};
|
||||
if (![targetURL.path getFileSystemRepresentation:path maxLength:sizeof(path)]) {
|
||||
@@ -359,12 +262,12 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
|
||||
}
|
||||
|
||||
// We use fchown instead of chown because the latter can follow symbolic links
|
||||
BOOL success = (fchown(fileDescriptor, ownerID.unsignedIntValue, groupID.unsignedIntValue) == 0);
|
||||
BOOL success = (fchown(fileDescriptor, ownerID, groupID) == 0);
|
||||
close(fileDescriptor);
|
||||
|
||||
if (!success) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to change owner & group for %@ with owner ID %u and group ID %u.", targetURL.path.lastPathComponent, ownerID.unsignedIntValue, groupID.unsignedIntValue] }];
|
||||
*error = [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to change owner & group for %@ with owner ID %u and group ID %u.", targetURL.path.lastPathComponent, ownerID, groupID] }];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -438,14 +341,14 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
|
||||
// If we can't change both the new owner & group, try to only change the owner
|
||||
// If this works, this is sufficient enough for performing the update
|
||||
NSNumber *groupIDToUse;
|
||||
if (![self _changeOwnerAndGroupOfItemAtURL:targetURL ownerID:ownerID groupID:groupID error:NULL]) {
|
||||
if (![self changeOwnerAndGroupOfItemAtURL:targetURL ownerID:ownerID.unsignedIntValue groupID:groupID.unsignedIntValue error:NULL]) {
|
||||
if ((targetOwnerID != nil && [ownerID isEqualToNumber:targetOwnerID])) {
|
||||
// Assume they're the same even if we don't check every file recursively
|
||||
// Speeds up the common case like above
|
||||
return YES;
|
||||
}
|
||||
|
||||
if (![self _changeOwnerAndGroupOfItemAtURL:targetURL ownerID:ownerID groupID:targetGroupID error:error]) {
|
||||
if (![self changeOwnerAndGroupOfItemAtURL:targetURL ownerID:ownerID.unsignedIntValue groupID:targetGroupID.unsignedIntValue error:error]) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
@@ -457,7 +360,7 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
|
||||
if (isTargetADirectory) {
|
||||
NSDirectoryEnumerator *directoryEnumerator = [_fileManager enumeratorAtURL:targetURL includingPropertiesForKeys:nil options:(NSDirectoryEnumerationOptions)0 errorHandler:nil];
|
||||
for (NSURL *url in directoryEnumerator) {
|
||||
if (![self _changeOwnerAndGroupOfItemAtURL:url ownerID:ownerID groupID:groupIDToUse error:error]) {
|
||||
if (![self changeOwnerAndGroupOfItemAtURL:url ownerID:ownerID.unsignedIntValue groupID:groupIDToUse.unsignedIntValue error:error]) {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+5
@@ -13,6 +13,9 @@
|
||||
#import "SULog.h"
|
||||
#import <WebKit/WebKit.h>
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
@interface SULegacyWebView () <WebPolicyDelegate, WebFrameLoadDelegate, WebUIDelegate>
|
||||
|
||||
@property (nonatomic, readonly) WebView *webView;
|
||||
@@ -163,4 +166,6 @@
|
||||
|
||||
@end
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
#endif
|
||||
Vendored
+24
-15
@@ -10,18 +10,7 @@
|
||||
|
||||
#include <asl.h>
|
||||
#include <Availability.h>
|
||||
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101200
|
||||
#include <os/log.h>
|
||||
#else
|
||||
|
||||
typedef struct os_log_s *os_log_t;
|
||||
#define os_log_create(subsystem, category) nil
|
||||
|
||||
#define os_log(log, format, ...)
|
||||
#define os_log_error(log, format, ...)
|
||||
|
||||
#endif
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
#import "SUOperatingSystem.h"
|
||||
@@ -45,10 +34,11 @@ void SULog(SULogLevel level, NSString *format, ...)
|
||||
dispatch_once(&onceToken, ^{
|
||||
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||
|
||||
hasOSLogging = [SUOperatingSystem isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion){10, 12, 0}];
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 101200
|
||||
hasOSLogging = NO;
|
||||
#endif
|
||||
if (@available(macOS 10.12, *)) {
|
||||
hasOSLogging = YES;
|
||||
} else {
|
||||
hasOSLogging = NO;
|
||||
}
|
||||
|
||||
if (hasOSLogging) {
|
||||
const char *subsystem = SPARKLE_BUNDLE_IDENTIFIER;
|
||||
@@ -65,7 +55,10 @@ void SULog(SULogLevel level, NSString *format, ...)
|
||||
}
|
||||
|
||||
NSString *displayName = [[NSFileManager defaultManager] displayNameAtPath:mainBundle.bundlePath];
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
client = asl_open([displayName stringByAppendingString:@" [Sparkle]"].UTF8String, SPARKLE_BUNDLE_IDENTIFIER, options);
|
||||
#pragma clang diagnostic pop
|
||||
queue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL);
|
||||
}
|
||||
});
|
||||
@@ -103,13 +96,20 @@ void SULog(SULogLevel level, NSString *format, ...)
|
||||
|
||||
// Otherwise use ASL
|
||||
// Make sure we do not async, because if we async, the log may not be delivered deterministically
|
||||
// TODO: When we remove support for macOS 10.11, remove all this asl code
|
||||
dispatch_sync(queue, ^{
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
aslmsg message = asl_new(ASL_TYPE_MSG);
|
||||
#pragma clang diagnostic pop
|
||||
if (message == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
if (asl_set(message, ASL_KEY_MSG, logMessage.UTF8String) != 0) {
|
||||
#pragma clang diagnostic pop
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -117,16 +117,25 @@ void SULog(SULogLevel level, NSString *format, ...)
|
||||
switch (level) {
|
||||
case SULogLevelDefault:
|
||||
// Just use one level below the error level
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
levelSetResult = asl_set(message, ASL_KEY_LEVEL, TO_STRING(ASL_LEVEL_WARNING));
|
||||
#pragma clang diagnostic pop
|
||||
break;
|
||||
case SULogLevelError:
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
levelSetResult = asl_set(message, ASL_KEY_LEVEL, TO_STRING(ASL_LEVEL_ERR));
|
||||
#pragma clang diagnostic pop
|
||||
break;
|
||||
}
|
||||
if (levelSetResult != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
asl_send(client, message);
|
||||
#pragma clang diagnostic pop
|
||||
});
|
||||
}
|
||||
Vendored
-10
@@ -7,18 +7,8 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 101000
|
||||
typedef struct {
|
||||
NSInteger majorVersion;
|
||||
NSInteger minorVersion;
|
||||
NSInteger patchVersion;
|
||||
} NSOperatingSystemVersion;
|
||||
#endif
|
||||
|
||||
@interface SUOperatingSystem : NSObject
|
||||
|
||||
+ (NSOperatingSystemVersion)operatingSystemVersion;
|
||||
+ (BOOL)isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion)version;
|
||||
+ (NSString *)systemVersionString;
|
||||
|
||||
@end
|
||||
Vendored
+1
-47
@@ -10,57 +10,11 @@
|
||||
|
||||
#include "AppKitPrevention.h"
|
||||
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 101000
|
||||
@interface NSProcessInfo ()
|
||||
- (NSOperatingSystemVersion)operatingSystemVersion;
|
||||
@end
|
||||
#endif
|
||||
|
||||
@implementation SUOperatingSystem
|
||||
|
||||
+ (NSOperatingSystemVersion)operatingSystemVersion
|
||||
{
|
||||
#if __MAC_OS_X_VERSION_MIN_REQUIRED < 101000
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wselector"
|
||||
// Xcode 5.1.1: operatingSystemVersion is clearly declared, must warn due to a compiler bug?
|
||||
if (![NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)])
|
||||
#pragma clang diagnostic pop
|
||||
{
|
||||
NSOperatingSystemVersion version = { 0, 0, 0 };
|
||||
NSURL *coreServices = [[NSFileManager defaultManager] URLForDirectory:NSCoreServiceDirectory inDomain:NSSystemDomainMask appropriateForURL:nil create:NO error:nil];
|
||||
NSURL *url = [coreServices URLByAppendingPathComponent:@"SystemVersion.plist"];
|
||||
assert(url != nil);
|
||||
NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOfURL:url];
|
||||
NSArray<NSString *> *components = [ (NSString *)[dictionary objectForKey: @"ProductVersion"] componentsSeparatedByString:@"."];
|
||||
version.majorVersion = components.count > 0 ? [ [components objectAtIndex:0] integerValue] : 0;
|
||||
version.minorVersion = components.count > 1 ? [ [components objectAtIndex:1] integerValue] : 0;
|
||||
version.patchVersion = components.count > 2 ? [ [components objectAtIndex:2] integerValue] : 0;
|
||||
return version;
|
||||
}
|
||||
#endif
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wpartial-availability"
|
||||
return [[NSProcessInfo processInfo] operatingSystemVersion];
|
||||
#pragma clang diagnostic pop
|
||||
}
|
||||
|
||||
+ (BOOL)isOperatingSystemAtLeastVersion:(NSOperatingSystemVersion)version
|
||||
{
|
||||
const NSOperatingSystemVersion systemVersion = self.operatingSystemVersion;
|
||||
if (systemVersion.majorVersion == version.majorVersion) {
|
||||
if (systemVersion.minorVersion == version.minorVersion) {
|
||||
return systemVersion.patchVersion >= version.patchVersion;
|
||||
}
|
||||
return systemVersion.minorVersion >= version.minorVersion;
|
||||
}
|
||||
return systemVersion.majorVersion >= version.majorVersion;
|
||||
}
|
||||
|
||||
+ (NSString *)systemVersionString
|
||||
{
|
||||
NSOperatingSystemVersion version = self.operatingSystemVersion;
|
||||
NSOperatingSystemVersion version = [[NSProcessInfo processInfo] operatingSystemVersion];
|
||||
return [NSString stringWithFormat:@"%ld.%ld.%ld", (long)version.majorVersion, (long)version.minorVersion, (long)version.patchVersion];
|
||||
}
|
||||
|
||||
|
||||
Vendored
-6
@@ -8,12 +8,6 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 1090
|
||||
@interface NSData (SUSignatureVerifier)
|
||||
- (id)initWithBase64Encoding:(NSString *)base64String;
|
||||
@end
|
||||
#endif
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(uint8_t, SUSigningInputStatus) {
|
||||
|
||||
+105
-10
@@ -32,34 +32,75 @@
|
||||
typedef NS_ENUM(NSInteger, SUCharacterType) {
|
||||
kNumberType,
|
||||
kStringType,
|
||||
kSeparatorType,
|
||||
kPeriodSeparatorType,
|
||||
kPunctuationSeparatorType,
|
||||
kWhitespaceSeparatorType,
|
||||
kDashType,
|
||||
};
|
||||
|
||||
- (SUCharacterType)typeOfCharacter:(NSString *)character
|
||||
{
|
||||
if ([character isEqualToString:@"."]) {
|
||||
return kSeparatorType;
|
||||
return kPeriodSeparatorType;
|
||||
} else if ([character isEqualToString:@"-"]) {
|
||||
return kDashType;
|
||||
} else if ([[NSCharacterSet decimalDigitCharacterSet] characterIsMember:[character characterAtIndex:0]]) {
|
||||
return kNumberType;
|
||||
} else if ([[NSCharacterSet whitespaceAndNewlineCharacterSet] characterIsMember:[character characterAtIndex:0]]) {
|
||||
return kSeparatorType;
|
||||
return kWhitespaceSeparatorType;
|
||||
} else if ([[NSCharacterSet punctuationCharacterSet] characterIsMember:[character characterAtIndex:0]]) {
|
||||
return kSeparatorType;
|
||||
return kPunctuationSeparatorType;
|
||||
} else {
|
||||
return kStringType;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSArray *)splitVersionString:(NSString *)version
|
||||
- (BOOL)isSeparatorType:(SUCharacterType)characterType
|
||||
{
|
||||
switch (characterType) {
|
||||
case kNumberType:
|
||||
case kStringType:
|
||||
case kDashType:
|
||||
return NO;
|
||||
case kPeriodSeparatorType:
|
||||
case kPunctuationSeparatorType:
|
||||
case kWhitespaceSeparatorType:
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
// If type A and type B are some sort of separator, consider them to be equal
|
||||
- (BOOL)isEqualCharacterTypeClassForTypeA:(SUCharacterType)typeA typeB:(SUCharacterType)typeB
|
||||
{
|
||||
switch (typeA) {
|
||||
case kNumberType:
|
||||
case kStringType:
|
||||
case kDashType:
|
||||
return (typeA == typeB);
|
||||
case kPeriodSeparatorType:
|
||||
case kPunctuationSeparatorType:
|
||||
case kWhitespaceSeparatorType: {
|
||||
switch (typeB) {
|
||||
case kPeriodSeparatorType:
|
||||
case kPunctuationSeparatorType:
|
||||
case kWhitespaceSeparatorType:
|
||||
return YES;
|
||||
case kNumberType:
|
||||
case kStringType:
|
||||
case kDashType:
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (NSMutableArray<NSString *> *)splitVersionString:(NSString *)version
|
||||
{
|
||||
NSString *character;
|
||||
NSMutableString *s;
|
||||
NSUInteger i, n;
|
||||
SUCharacterType oldType, newType;
|
||||
NSMutableArray *parts = [NSMutableArray array];
|
||||
NSMutableArray<NSString *> *parts = [NSMutableArray array];
|
||||
if ([version length] == 0) {
|
||||
// Nothing to do here
|
||||
return parts;
|
||||
@@ -73,7 +114,7 @@ typedef NS_ENUM(NSInteger, SUCharacterType) {
|
||||
if (newType == kDashType) {
|
||||
break;
|
||||
}
|
||||
if (oldType != newType || oldType == kSeparatorType) {
|
||||
if (oldType != newType || [self isSeparatorType:oldType]) {
|
||||
// We've reached a new segment
|
||||
NSString *aPart = [[NSString alloc] initWithString:s];
|
||||
[parts addObject:aPart];
|
||||
@@ -90,10 +131,64 @@ typedef NS_ENUM(NSInteger, SUCharacterType) {
|
||||
return parts;
|
||||
}
|
||||
|
||||
// This returns the count of number and period parts at the beginning of the version
|
||||
// See -balanceVersionPartsA:partsB below
|
||||
- (NSUInteger)countOfNumberAndPeriodStartingParts:(NSArray<NSString *> *)parts
|
||||
{
|
||||
NSUInteger count = 0;
|
||||
for (NSString *part in parts) {
|
||||
SUCharacterType characterType = [self typeOfCharacter:part];
|
||||
|
||||
if (characterType == kNumberType || characterType == kPeriodSeparatorType) {
|
||||
count++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
// See -balanceVersionPartsA:partsB below
|
||||
- (void)addNumberAndPeriodPartsToParts:(NSMutableArray<NSString *> *)toParts toNumberAndPeriodPartsCount:(NSUInteger)toNumberAndPeriodPartsCount fromParts:(NSArray<NSString *> *)fromParts fromNumberAndPeriodPartsCount:(NSUInteger)fromNumberAndPeriodPartsCount
|
||||
{
|
||||
NSUInteger partsCountDifference = (fromNumberAndPeriodPartsCount - toNumberAndPeriodPartsCount);
|
||||
|
||||
for (NSUInteger insertionIndex = toNumberAndPeriodPartsCount; insertionIndex < toNumberAndPeriodPartsCount + partsCountDifference; insertionIndex++) {
|
||||
SUCharacterType typeA = [self typeOfCharacter:fromParts[insertionIndex]];
|
||||
if (typeA == kPeriodSeparatorType) {
|
||||
[toParts insertObject:@"." atIndex:insertionIndex];
|
||||
} else if (typeA == kNumberType) {
|
||||
[toParts insertObject:@"0" atIndex:insertionIndex];
|
||||
} else {
|
||||
// It should not be possible to get here
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If one version starts with "1.0.0" and the other starts with "1.1" we make sure they're balanced
|
||||
// such that the latter version now becomes "1.1.0". This helps ensure that versions like "1.0" and "1.0.0" are equal.
|
||||
- (void)balanceVersionPartsA:(NSMutableArray<NSString *> *)partsA partsB:(NSMutableArray<NSString *> *)partsB
|
||||
{
|
||||
NSUInteger partANumberAndPeriodPartsCount = [self countOfNumberAndPeriodStartingParts:partsA];
|
||||
NSUInteger partBNumberAndPeriodPartsCount = [self countOfNumberAndPeriodStartingParts:partsB];;
|
||||
|
||||
if (partANumberAndPeriodPartsCount > partBNumberAndPeriodPartsCount) {
|
||||
[self addNumberAndPeriodPartsToParts:partsB toNumberAndPeriodPartsCount:partBNumberAndPeriodPartsCount fromParts:partsA fromNumberAndPeriodPartsCount:partANumberAndPeriodPartsCount];
|
||||
} else if (partBNumberAndPeriodPartsCount > partANumberAndPeriodPartsCount) {
|
||||
[self addNumberAndPeriodPartsToParts:partsA toNumberAndPeriodPartsCount:partANumberAndPeriodPartsCount fromParts:partsB fromNumberAndPeriodPartsCount:partBNumberAndPeriodPartsCount];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSComparisonResult)compareVersion:(NSString *)versionA toVersion:(NSString *)versionB
|
||||
{
|
||||
NSArray *partsA = [self splitVersionString:versionA];
|
||||
NSArray *partsB = [self splitVersionString:versionB];
|
||||
NSMutableArray<NSString *> *splitPartsA = [self splitVersionString:versionA];
|
||||
NSMutableArray<NSString *> *splitPartsB = [self splitVersionString:versionB];
|
||||
|
||||
[self balanceVersionPartsA:splitPartsA partsB:splitPartsB];
|
||||
|
||||
NSArray<NSString *> *partsA = splitPartsA;
|
||||
NSArray<NSString *> *partsB = splitPartsB;
|
||||
|
||||
NSString *partA, *partB;
|
||||
NSUInteger i, n;
|
||||
@@ -109,7 +204,7 @@ typedef NS_ENUM(NSInteger, SUCharacterType) {
|
||||
typeB = [self typeOfCharacter:partB];
|
||||
|
||||
// Compare types
|
||||
if (typeA == typeB) {
|
||||
if ([self isEqualCharacterTypeClassForTypeA:typeA typeB:typeB]) {
|
||||
// Same type; we can compare
|
||||
if (typeA == kNumberType) {
|
||||
valueA = [partA longLongValue];
|
||||
|
||||
Vendored
+7
-6
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="18122" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="20037" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="18122"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="20037"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
@@ -18,6 +18,7 @@
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<window identifier="SUStatus" title="Set in Code" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="5" userLabel="Window">
|
||||
<windowStyleMask key="styleMask" titled="YES"/>
|
||||
<windowCollectionBehavior key="collectionBehavior" fullScreenAuxiliary="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="200" y="222" width="400" height="107"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="875"/>
|
||||
@@ -49,14 +50,14 @@
|
||||
</connections>
|
||||
</textField>
|
||||
<progressIndicator verticalHuggingPriority="750" maxValue="100" bezeled="NO" indeterminate="YES" style="bar" translatesAutoresizingMaskIntoConstraints="NO" id="11">
|
||||
<rect key="frame" x="107" y="47" width="275" height="20"/>
|
||||
<rect key="frame" x="107" y="47" width="273" height="20"/>
|
||||
<connections>
|
||||
<binding destination="-2" name="maxValue" keyPath="maxProgressValue" id="13"/>
|
||||
<binding destination="-2" name="value" keyPath="progressValue" previousBinding="13" id="27"/>
|
||||
</connections>
|
||||
</progressIndicator>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="12">
|
||||
<rect key="frame" x="272" y="12" width="114" height="32"/>
|
||||
<rect key="frame" x="273" y="12" width="114" height="32"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="100" id="3tI-Ef-LLb"/>
|
||||
</constraints>
|
||||
@@ -86,7 +87,7 @@
|
||||
</textField>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="11" secondAttribute="trailing" constant="18" id="1eu-lX-1HN"/>
|
||||
<constraint firstAttribute="trailing" secondItem="11" secondAttribute="trailing" constant="20" id="1eu-lX-1HN"/>
|
||||
<constraint firstItem="12" firstAttribute="top" secondItem="11" secondAttribute="bottom" constant="9" id="3RZ-xs-4zc"/>
|
||||
<constraint firstItem="8" firstAttribute="leading" secondItem="7" secondAttribute="trailing" constant="20" id="5bq-w6-BOU"/>
|
||||
<constraint firstItem="7" firstAttribute="top" secondItem="6" secondAttribute="top" constant="15" id="9Mg-Ac-X6m"/>
|
||||
@@ -97,7 +98,7 @@
|
||||
<constraint firstItem="7" firstAttribute="leading" secondItem="6" secondAttribute="leading" constant="24" id="ZLG-dr-gmv"/>
|
||||
<constraint firstAttribute="bottom" secondItem="12" secondAttribute="bottom" constant="19" id="iY3-LJ-ivz"/>
|
||||
<constraint firstItem="12" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="16" secondAttribute="trailing" constant="25" id="k07-gJ-v9t"/>
|
||||
<constraint firstAttribute="trailing" secondItem="12" secondAttribute="trailing" constant="21" id="onJ-J5-mra"/>
|
||||
<constraint firstAttribute="trailing" secondItem="12" secondAttribute="trailing" constant="20" id="onJ-J5-mra"/>
|
||||
<constraint firstAttribute="trailing" secondItem="8" secondAttribute="trailing" constant="19" id="pHi-Hm-GAw"/>
|
||||
<constraint firstItem="8" firstAttribute="top" secondItem="6" secondAttribute="top" constant="15" id="tAo-wJ-XR0"/>
|
||||
</constraints>
|
||||
|
||||
Loaded 100 of 228 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user