mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-28 05:14:34 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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
@@ -16,4 +16,4 @@ assignees: ''
|
|||||||
|
|
||||||
## Version
|
## 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.]
|
||||||
@@ -2,18 +2,12 @@
|
|||||||
|
|
||||||
Fixes # (issue)
|
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 requires a documentation update on [Sparkle's website repository](https://github.com/sparkle-project/sparkle-project.github.io)
|
||||||
- [ ] 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.
|
- [ ] My change requires changes to generate_appcast, generate_keys, or sign_update
|
||||||
- [ ] I have reviewed and commented my code, particularly in hard-to-understand areas.
|
|
||||||
|
|
||||||
## Type of change
|
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.
|
||||||
|
|
||||||
- [ ] 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
|
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
xcode: ['xcode12.5.1', 'xcode13.1']
|
xcode: ['xcode12.5.1', 'xcode13.2.1']
|
||||||
include:
|
include:
|
||||||
- xcode: 'xcode12.5.1'
|
- xcode: 'xcode12.5.1'
|
||||||
xcode-path: '/Applications/Xcode_12.5.1.app/Contents/Developer'
|
xcode-path: '/Applications/Xcode_12.5.1.app/Contents/Developer'
|
||||||
upload-dist: false
|
upload-dist: false
|
||||||
run-analyzer: false
|
run-analyzer: false
|
||||||
- xcode: 'xcode13.1'
|
- xcode: 'xcode13.2.1'
|
||||||
xcode-path: '/Applications/Xcode_13.1.app/Contents/Developer'
|
xcode-path: '/Applications/Xcode_13.2.1.app/Contents/Developer'
|
||||||
upload-dist: true
|
upload-dist: true
|
||||||
run-analyzer: true
|
run-analyzer: true
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ name: "Create Draft Release"
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
BUILDDIR: "build"
|
BUILDDIR: "build"
|
||||||
DEVELOPER_DIR: "/Applications/Xcode_13.1.app/Contents/Developer"
|
DEVELOPER_DIR: "/Applications/Xcode_13.2.1.app/Contents/Developer"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|||||||
@@ -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 "SUBinaryDeltaApply.h"
|
||||||
#import "SUBinaryDeltaCommon.h"
|
#import "SUBinaryDeltaCommon.h"
|
||||||
#include <CommonCrypto/CommonDigest.h>
|
#import "SPUDeltaArchiveProtocol.h"
|
||||||
|
#import "SPUDeltaArchive.h"
|
||||||
|
#import <CommonCrypto/CommonDigest.h>
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#include "bspatch.h"
|
#include "bspatch.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <xar/xar.h>
|
#import <sys/stat.h>
|
||||||
#include <Availability.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include "AppKitPrevention.h"
|
#include "AppKitPrevention.h"
|
||||||
|
|
||||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 120000
|
static BOOL applyBinaryDeltaToFile(NSString *patchFile, NSString *sourceFilePath, NSString *destinationFilePath)
|
||||||
#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)
|
|
||||||
{
|
{
|
||||||
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]};
|
const char *argv[] = {"/usr/bin/bspatch", [sourceFilePath fileSystemRepresentation], [destinationFilePath fileSystemRepresentation], [patchFile fileSystemRepresentation]};
|
||||||
BOOL success = (bspatch(4, argv) == 0);
|
BOOL success = (bspatch(4, argv) == 0);
|
||||||
unlink([patchFile fileSystemRepresentation]);
|
unlink([patchFile fileSystemRepresentation]);
|
||||||
return success;
|
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);
|
SPUDeltaArchiveHeader *header = nil;
|
||||||
if (!x) {
|
id<SPUDeltaArchiveProtocol> archive = SPUDeltaArchiveReadPatchAndHeader(patchFile, &header);
|
||||||
|
if (archive.error != nil) {
|
||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Unable to open %@. Giving up.", patchFile] }];
|
*error = archive.error;
|
||||||
}
|
}
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
SUBinaryDeltaMajorVersion majorDiffVersion = FIRST_DELTA_DIFF_MAJOR_VERSION;
|
progressCallback(0/7.0);
|
||||||
int minorDiffVersion = 0;
|
|
||||||
|
|
||||||
NSString *expectedBeforeHashv1 = nil;
|
SUBinaryDeltaMajorVersion majorDiffVersion = header.majorVersion;
|
||||||
NSString *expectedAfterHashv1 = nil;
|
uint16_t minorDiffVersion = header.minorVersion;
|
||||||
|
|
||||||
NSString *expectedNewBeforeHash = nil;
|
unsigned char *expectedBeforeHash = header.beforeTreeHash;
|
||||||
NSString *expectedNewAfterHash = nil;
|
unsigned char *expectedAfterHash = header.afterTreeHash;
|
||||||
|
|
||||||
progressCallback(0/6.0);
|
if (majorDiffVersion < SUBinaryDeltaMajorVersionFirst) {
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadCorruptFileError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Unable to identify diff-version %u in delta. Giving up.", majorDiffVersion] }];
|
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadCorruptFileError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Unable to identify diff-version %u in delta. Giving up.", majorDiffVersion] }];
|
||||||
}
|
}
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (majorDiffVersion > LATEST_DELTA_DIFF_MAJOR_VERSION) {
|
if (majorDiffVersion < SUBinaryDeltaMajorVersionFirstSupported) {
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (error != NULL) {
|
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;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_XAR_GET_SAFE_PATH
|
|
||||||
// Reject patches that did not generate valid hierarchical xar container paths
|
// Reject patches that did not generate valid hierarchical xar container paths
|
||||||
// These will not succeed to patch using recent versions of BinaryDelta
|
// These will not succeed to patch using recent versions of BinaryDelta
|
||||||
if ((majorDiffVersion == SUBinaryDeltaMajorVersion2 && minorDiffVersion < 3) || (majorDiffVersion == SUBinaryDeltaMajorVersion1 && minorDiffVersion < 2)) {
|
if ([[archive class] maySupportSafeExtraction] && majorDiffVersion == SUBinaryDeltaMajorVersion2 && minorDiffVersion < 3) {
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (error != NULL) {
|
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)] }];
|
*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;
|
return NO;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
BOOL usesNewTreeHash = MAJOR_VERSION_IS_AT_LEAST(majorDiffVersion, SUBinaryDeltaMajorVersion2);
|
if (expectedBeforeHash == nil || expectedAfterHash == nil) {
|
||||||
|
|
||||||
NSString *expectedBeforeHash = usesNewTreeHash ? expectedNewBeforeHash : expectedBeforeHashv1;
|
|
||||||
NSString *expectedAfterHash = usesNewTreeHash ? expectedNewAfterHash : expectedAfterHashv1;
|
|
||||||
|
|
||||||
if (!expectedBeforeHash || !expectedAfterHash) {
|
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadCorruptFileError userInfo:@{ NSLocalizedDescriptionKey: @"Unable to find before-sha1 or after-sha1 metadata in delta. Giving up." }];
|
*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...");
|
fprintf(stderr, "Verifying source...");
|
||||||
}
|
}
|
||||||
|
|
||||||
progressCallback(1/6.0);
|
progressCallback(1/7.0);
|
||||||
|
|
||||||
NSString *beforeHash = hashOfTreeWithVersion(source, majorDiffVersion);
|
unsigned char beforeHash[CC_SHA1_DIGEST_LENGTH] = {0};
|
||||||
if (!beforeHash) {
|
if (!getRawHashOfTreeWithVersion(beforeHash, source, majorDiffVersion)) {
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
@@ -165,14 +103,12 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (![beforeHash isEqualToString:expectedBeforeHash]) {
|
if (memcmp(beforeHash, expectedBeforeHash, CC_SHA1_DIGEST_LENGTH) != 0) {
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
if (error != NULL) {
|
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;
|
return NO;
|
||||||
}
|
}
|
||||||
@@ -181,11 +117,19 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
fprintf(stderr, "\nCopying files...");
|
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)) {
|
if (!removeTree(destination)) {
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
@@ -195,11 +139,9 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
progressCallback(3/6.0);
|
progressCallback(3/7.0);
|
||||||
|
|
||||||
if (!copyTree(source, destination)) {
|
if (!copyTree(source, destination)) {
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
@@ -209,44 +151,31 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
progressCallback(4/6.0);
|
progressCallback(4/7.0);
|
||||||
|
|
||||||
BOOL hasExtractKeyAvailable = MAJOR_VERSION_IS_AT_LEAST(majorDiffVersion, SUBinaryDeltaMajorVersion2);
|
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\nPatching...");
|
fprintf(stderr, "\nPatching...");
|
||||||
}
|
}
|
||||||
NSFileManager *fileManager = [[NSFileManager alloc] init];
|
NSFileManager *fileManager = [[NSFileManager alloc] init];
|
||||||
xar_file_t file;
|
|
||||||
xar_iter_t iter = xar_iter_new();
|
// Ensure error is cleared out in advance
|
||||||
for (file = xar_file_first(x, iter); file; file = xar_file_next(iter)) {
|
if (error != NULL) {
|
||||||
char *pathCString;
|
*error = nil;
|
||||||
#if HAS_XAR_GET_SAFE_PATH
|
}
|
||||||
if (xar_get_safe_path != NULL) {
|
|
||||||
pathCString = xar_get_safe_path(file);
|
[archive enumerateItems:^(SPUDeltaArchiveItem *item, BOOL *stop) {
|
||||||
}
|
NSString *relativePath = item.relativeFilePath;
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
pathCString = xar_get_path(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pathCString == NULL) {
|
if ([relativePath.pathComponents containsObject:@".."]) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSString *path = @(pathCString);
|
|
||||||
if ([path.pathComponents containsObject:@".."]) {
|
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (error != NULL) {
|
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 *sourceFilePath = [source stringByAppendingPathComponent:relativePath];
|
||||||
NSString *destinationFilePath = [destination stringByAppendingPathComponent:path];
|
NSString *destinationFilePath = [destination stringByAppendingPathComponent:relativePath];
|
||||||
{
|
{
|
||||||
NSString *destinationParentDirectory = destinationFilePath.stringByDeletingLastPathComponent;
|
NSString *destinationParentDirectory = destinationFilePath.stringByDeletingLastPathComponent;
|
||||||
NSDictionary<NSFileAttributeKey, id> *destinationParentDirectoryAttributes = [fileManager attributesOfItemAtPath:destinationParentDirectory error:NULL];
|
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
|
// If it's inside a symlink, this is not good in any circumstance
|
||||||
NSString *fileType = destinationParentDirectoryAttributes[NSFileType];
|
NSString *fileType = destinationParentDirectoryAttributes[NSFileType];
|
||||||
if ([fileType isEqualToString:NSFileTypeSymbolicLink]) {
|
if ([fileType isEqualToString:NSFileTypeSymbolicLink]) {
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to create patch because '%@' cannot be a symbolic link.", destinationParentDirectory] }];
|
*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
|
// 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
|
// This is important because they aren't part of the delta, just part of the directory structure
|
||||||
|
SPUDeltaItemCommands commands = item.commands;
|
||||||
const char *value;
|
if ((commands & SPUDeltaItemCommandDelete) != 0) {
|
||||||
if (!xar_prop_get(file, DELETE_KEY, &value) || (!hasExtractKeyAvailable && !xar_prop_get(file, DELETE_THEN_EXTRACT_OLD_KEY, &value))) {
|
|
||||||
if (!removeTree(destinationFilePath)) {
|
if (!removeTree(destinationFilePath)) {
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
if (error != NULL) {
|
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;
|
*stop = YES;
|
||||||
}
|
return;
|
||||||
if (!hasExtractKeyAvailable && !xar_prop_get(file, DELETE_KEY, &value)) {
|
|
||||||
if (verbose) {
|
|
||||||
fprintf(stderr, "\n❌ %s %s", VERBOSE_DELETED, [path fileSystemRepresentation]);
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
removedFile = YES;
|
removedFile = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!xar_prop_get(file, BINARY_DELTA_KEY, &value)) {
|
if ((commands & SPUDeltaItemCommandClone) != 0 && (commands & SPUDeltaItemCommandBinaryDiff) == 0) {
|
||||||
if (!applyBinaryDeltaToFile(x, file, sourceFilePath, destinationFilePath)) {
|
NSString *clonedRelativePath = item.clonedRelativePath;
|
||||||
xar_close(x);
|
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) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Unable to patch %@ to destination %@", sourceFilePath, destinationFilePath] }];
|
*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) {
|
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
|
} else if ((commands & SPUDeltaItemCommandExtract) != 0) { // extract and permission modifications don't coexist
|
||||||
|
item.itemFilePath = destinationFilePath;
|
||||||
if (xar_extract_tofile(x, file, [destinationFilePath fileSystemRepresentation]) != 0) {
|
if (![archive extractItem:item]) {
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
if (error != NULL) {
|
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 (verbose) {
|
||||||
if (fileExisted) {
|
if (fileExisted) {
|
||||||
fprintf(stderr, "\n✏️ %s %s", VERBOSE_UPDATED, [path fileSystemRepresentation]);
|
fprintf(stderr, "\n✏️ %s %s", VERBOSE_UPDATED, [relativePath fileSystemRepresentation]);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "\n✅ %s %s", VERBOSE_ADDED, [path fileSystemRepresentation]);
|
fprintf(stderr, "\n✅ %s %s", VERBOSE_ADDED, [relativePath fileSystemRepresentation]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (verbose && removedFile) {
|
} 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)) {
|
if ((commands & SPUDeltaItemCommandModifyPermissions) != 0) {
|
||||||
mode_t mode = (mode_t)[[NSString stringWithUTF8String:value] intValue];
|
mode_t mode = (mode_t)item.mode;
|
||||||
if (!modifyPermissions(destinationFilePath, mode)) {
|
if (!modifyPermissions(destinationFilePath, mode)) {
|
||||||
xar_close(x);
|
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
if (error != NULL) {
|
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) {
|
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);
|
[archive close];
|
||||||
|
|
||||||
progressCallback(5/6.0);
|
// Set error from enumerating items if we have encountered an error and haven't set it yet
|
||||||
|
NSError *archiveError = archive.error;
|
||||||
if (verbose) {
|
if (archiveError != nil) {
|
||||||
fprintf(stderr, "\nVerifying destination...");
|
|
||||||
}
|
|
||||||
NSString *afterHash = hashOfTreeWithVersion(destination, majorDiffVersion);
|
|
||||||
if (!afterHash) {
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
if (error != NULL) {
|
if (error != NULL && *error == nil) {
|
||||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Unable to calculate hash of tree %@", destination] }];
|
*error = archiveError;
|
||||||
}
|
|
||||||
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] }];
|
|
||||||
}
|
}
|
||||||
removeTree(destination);
|
removeTree(destination);
|
||||||
return NO;
|
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) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\nDone!\n");
|
fprintf(stderr, "\nDone!\n");
|
||||||
|
|||||||
@@ -10,33 +10,16 @@
|
|||||||
#define SUBINARYDELTACOMMON_H
|
#define SUBINARYDELTACOMMON_H
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
#import "SPUDeltaCompressionMode.h"
|
||||||
#include <fts.h>
|
#include <fts.h>
|
||||||
|
|
||||||
#define PERMISSION_FLAGS (S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX)
|
#define PERMISSION_FLAGS (S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX)
|
||||||
|
#define VALID_SYMBOLIC_LINK_PERMISSIONS 0755
|
||||||
#define IS_VALID_PERMISSIONS(mode) \
|
|
||||||
(((mode & PERMISSION_FLAGS) == 0755) || ((mode & PERMISSION_FLAGS) == 0644))
|
|
||||||
|
|
||||||
#define APPLE_CODE_SIGN_XATTR_CODE_DIRECTORY_KEY "com.apple.cs.CodeDirectory"
|
#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_REQUIREMENTS_KEY "com.apple.cs.CodeRequirements"
|
||||||
#define APPLE_CODE_SIGN_XATTR_CODE_SIGNATURE_KEY "com.apple.cs.CodeSignature"
|
#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_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_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
|
#define VERBOSE_ADDED "Added" // file is added to the patch or file system
|
||||||
@@ -44,23 +27,37 @@
|
|||||||
#define VERBOSE_PATCHED "Patched" // file is patched when applying a patch
|
#define VERBOSE_PATCHED "Patched" // file is patched when applying a patch
|
||||||
#define VERBOSE_UPDATED "Updated" // file's contents are updated
|
#define VERBOSE_UPDATED "Updated" // file's contents are updated
|
||||||
#define VERBOSE_MODIFIED "Modified" // file's metadata is modified
|
#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)
|
#define MAJOR_VERSION_IS_AT_LEAST(actualMajor, expectedMajor) (actualMajor >= expectedMajor)
|
||||||
|
|
||||||
// Each major version will be assigned a name of a color
|
|
||||||
// Changes that break backwards compatibility will have different major versions
|
// Changes that break backwards compatibility will have different major versions
|
||||||
// Changes that affect creating but not applying patches will have different minor versions
|
// Changes that affect creating but not applying patches will have different minor versions
|
||||||
|
|
||||||
typedef NS_ENUM(uint16_t, SUBinaryDeltaMajorVersion)
|
typedef NS_ENUM(uint16_t, SUBinaryDeltaMajorVersion)
|
||||||
{
|
{
|
||||||
|
// Note: support for creating or applying version 1 deltas have been removed
|
||||||
SUBinaryDeltaMajorVersion1 = 1,
|
SUBinaryDeltaMajorVersion1 = 1,
|
||||||
SUBinaryDeltaMajorVersion2 = 2
|
SUBinaryDeltaMajorVersion2 = 2,
|
||||||
|
SUBinaryDeltaMajorVersion3 = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FIRST_DELTA_DIFF_MAJOR_VERSION SUBinaryDeltaMajorVersion1
|
extern SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionDefault;
|
||||||
#define LATEST_DELTA_DIFF_MAJOR_VERSION SUBinaryDeltaMajorVersion2
|
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);
|
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 *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion);
|
||||||
extern NSString *hashOfTree(NSString *path);
|
extern NSString *hashOfTree(NSString *path);
|
||||||
extern BOOL removeTree(NSString *path);
|
extern BOOL removeTree(NSString *path);
|
||||||
@@ -70,5 +67,5 @@ extern NSString *pathRelativeToDirectory(NSString *directory, NSString *path);
|
|||||||
NSString *temporaryFilename(NSString *base);
|
NSString *temporaryFilename(NSString *base);
|
||||||
NSString *temporaryDirectory(NSString *base);
|
NSString *temporaryDirectory(NSString *base);
|
||||||
NSString *stringWithFileSystemRepresentation(const char*);
|
NSString *stringWithFileSystemRepresentation(const char*);
|
||||||
int latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion);
|
uint16_t latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion);
|
||||||
#endif
|
#endif
|
||||||
@@ -16,13 +16,81 @@
|
|||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <xar/xar.h>
|
#include <xlocale.h>
|
||||||
|
|
||||||
#include "AppKitPrevention.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)
|
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)
|
NSString *pathRelativeToDirectory(NSString *directory, NSString *path)
|
||||||
@@ -39,13 +107,15 @@ NSString *stringWithFileSystemRepresentation(const char *input)
|
|||||||
return [[NSFileManager defaultManager] stringWithFileSystemRepresentation:input length:strlen(input)];
|
return [[NSFileManager defaultManager] stringWithFileSystemRepresentation:input length:strlen(input)];
|
||||||
}
|
}
|
||||||
|
|
||||||
int latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion)
|
uint16_t latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion)
|
||||||
{
|
{
|
||||||
switch (majorVersion) {
|
switch (majorVersion) {
|
||||||
case SUBinaryDeltaMajorVersion1:
|
case SUBinaryDeltaMajorVersion1:
|
||||||
return 2;
|
return 2;
|
||||||
case SUBinaryDeltaMajorVersion2:
|
case SUBinaryDeltaMajorVersion2:
|
||||||
return 3;
|
return 3;
|
||||||
|
case SUBinaryDeltaMajorVersion3:
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -96,7 +166,7 @@ static void _hashOfBuffer(unsigned char *hash, const char *buffer, ssize_t buffe
|
|||||||
CC_SHA1_Final(hash, &hashContext);
|
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) {
|
if (ent->fts_info == FTS_SL) {
|
||||||
char linkDestination[MAXPATHLEN + 1];
|
char linkDestination[MAXPATHLEN + 1];
|
||||||
@@ -108,27 +178,37 @@ static BOOL _hashOfFileContents(unsigned char *hash, FTSENT *ent)
|
|||||||
|
|
||||||
_hashOfBuffer(hash, linkDestination, linkDestinationLength);
|
_hashOfBuffer(hash, linkDestination, linkDestinationLength);
|
||||||
} else if (ent->fts_info == FTS_F) {
|
} 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;
|
ssize_t fileSize = ent->fts_statp->st_size;
|
||||||
if (fileSize == 0) {
|
if (fileSize <= 0) {
|
||||||
_hashOfBuffer(hash, NULL, 0);
|
_hashOfBuffer(hash, NULL, 0);
|
||||||
} else {
|
} else {
|
||||||
void *buffer = mmap(0, (size_t)fileSize, PROT_READ, MAP_FILE | MAP_PRIVATE, fileDescriptor, 0);
|
FILE *file = fopen(ent->fts_path, "rb");
|
||||||
if (buffer == (void *)-1) {
|
if (file == NULL) {
|
||||||
close(fileDescriptor);
|
perror("fopen");
|
||||||
perror("mmap");
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
_hashOfBuffer(hash, buffer, fileSize);
|
CC_SHA1_CTX hashContext;
|
||||||
munmap(buffer, (size_t)fileSize);
|
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) {
|
} else if (ent->fts_info == FTS_D) {
|
||||||
memset(hash, 0xdd, CC_SHA1_DIGEST_LENGTH);
|
memset(hash, 0xdd, CC_SHA1_DIGEST_LENGTH);
|
||||||
} else {
|
} else {
|
||||||
@@ -137,18 +217,31 @@ static BOOL _hashOfFileContents(unsigned char *hash, FTSENT *ent)
|
|||||||
return YES;
|
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 };
|
char pathBuffer[PATH_MAX] = { 0 };
|
||||||
if (![path getFileSystemRepresentation:pathBuffer maxLength:sizeof(pathBuffer)]) {
|
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 };
|
char *const sourcePaths[] = { pathBuffer, 0 };
|
||||||
FTS *fts = fts_open(sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles);
|
FTS *fts = fts_open(sourcePaths, FTS_PHYSICAL | FTS_NOCHDIR, compareFiles);
|
||||||
if (!fts) {
|
if (!fts) {
|
||||||
perror("fts_open");
|
perror("fts_open");
|
||||||
return nil;
|
free(tempBuffer);
|
||||||
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
CC_SHA1_CTX hashContext;
|
CC_SHA1_CTX hashContext;
|
||||||
@@ -162,53 +255,94 @@ NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion)
|
|||||||
if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D)
|
if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ent->fts_info == FTS_D && !MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
NSString *relativePath = pathRelativeToDirectory(normalizedPath, stringWithFileSystemRepresentation(ent->fts_path));
|
NSString *relativePath = pathRelativeToDirectory(normalizedPath, stringWithFileSystemRepresentation(ent->fts_path));
|
||||||
if (relativePath.length == 0)
|
if (relativePath.length == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
unsigned char fileHash[CC_SHA1_DIGEST_LENGTH];
|
unsigned char fileHash[CC_SHA1_DIGEST_LENGTH];
|
||||||
if (!_hashOfFileContents(fileHash, ent)) {
|
if (!_hashOfFileContents(fileHash, ent, tempBuffer, tempBufferSize)) {
|
||||||
return nil;
|
fts_close(fts);
|
||||||
|
free(tempBuffer);
|
||||||
|
return NO;
|
||||||
}
|
}
|
||||||
CC_SHA1_Update(&hashContext, fileHash, sizeof(fileHash));
|
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];
|
const char *relativePathBytes = [relativePath fileSystemRepresentation];
|
||||||
CC_SHA1_Update(&hashContext, relativePathBytes, (CC_LONG)strlen(relativePathBytes));
|
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;
|
||||||
uint16_t mode = ent->fts_statp->st_mode;
|
uint16_t type = ent->fts_info;
|
||||||
// permission of symlinks is irrelevant and can't be changed.
|
uint16_t permissions = mode & PERMISSION_FLAGS;
|
||||||
// hardcoding a value helps avoid differences between filesystems.
|
|
||||||
if (ent->fts_info == FTS_SL) {
|
// permission of symlinks are 0777 on some linux file systems and can't be changed,
|
||||||
mode = 0755;
|
// differing from the 0755 macOS default.
|
||||||
}
|
// hardcoding a value helps avoid differences between filesystems.
|
||||||
uint16_t type = ent->fts_info;
|
uint16_t hashedPermissions = (ent->fts_info == FTS_SL) ? VALID_SYMBOLIC_LINK_PERMISSIONS : permissions;
|
||||||
uint16_t permissions = mode & PERMISSION_FLAGS;
|
|
||||||
|
|
||||||
CC_SHA1_Update(&hashContext, &type, sizeof(type));
|
CC_SHA1_Update(&hashContext, &type, sizeof(type));
|
||||||
CC_SHA1_Update(&hashContext, &permissions, sizeof(permissions));
|
CC_SHA1_Update(&hashContext, &hashedPermissions, sizeof(hashedPermissions));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(tempBuffer);
|
||||||
|
|
||||||
fts_close(fts);
|
fts_close(fts);
|
||||||
|
|
||||||
unsigned char hash[CC_SHA1_DIGEST_LENGTH];
|
CC_SHA1_Final(hashBuffer, &hashContext);
|
||||||
CC_SHA1_Final(hash, &hashContext);
|
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
char hexHash[CC_SHA1_DIGEST_LENGTH * 2 + 1];
|
void getRawHashFromDisplayHash(unsigned char *hash, NSString *hexHash)
|
||||||
size_t i;
|
{
|
||||||
for (i = 0; i < CC_SHA1_DIGEST_LENGTH; i++)
|
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]);
|
sprintf(hexHash + i * 2, "%02x", hash[i]);
|
||||||
|
}
|
||||||
return @(hexHash);
|
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)
|
extern NSString *hashOfTree(NSString *path)
|
||||||
{
|
{
|
||||||
return hashOfTreeWithVersion(path, LATEST_DELTA_DIFF_MAJOR_VERSION);
|
return hashOfTreeWithVersion(path, SUBinaryDeltaMajorVersionLatest);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL removeTree(NSString *path)
|
BOOL removeTree(NSString *path)
|
||||||
|
|||||||
@@ -10,8 +10,9 @@
|
|||||||
#define SUBINARYDELTACREATE_H
|
#define SUBINARYDELTACREATE_H
|
||||||
|
|
||||||
#import "SUBinaryDeltaCommon.h"
|
#import "SUBinaryDeltaCommon.h"
|
||||||
|
#import "SPUDeltaArchiveProtocol.h"
|
||||||
|
|
||||||
@class NSString;
|
@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
|
#endif
|
||||||
+440
-144
@@ -9,6 +9,9 @@
|
|||||||
#import "SUBinaryDeltaCreate.h"
|
#import "SUBinaryDeltaCreate.h"
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#include "SUBinaryDeltaCommon.h"
|
#include "SUBinaryDeltaCommon.h"
|
||||||
|
#import "SPUDeltaArchiveProtocol.h"
|
||||||
|
#import "SPUSparkleDeltaArchive.h"
|
||||||
|
#import "SPUXarDeltaArchive.h"
|
||||||
#import <CommonCrypto/CommonDigest.h>
|
#import <CommonCrypto/CommonDigest.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <fts.h>
|
#include <fts.h>
|
||||||
@@ -19,7 +22,7 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/xattr.h>
|
#include <sys/xattr.h>
|
||||||
#include <xar/xar.h>
|
|
||||||
|
|
||||||
#include "AppKitPrevention.h"
|
#include "AppKitPrevention.h"
|
||||||
|
|
||||||
@@ -27,29 +30,40 @@ extern int bsdiff(int argc, const char **argv);
|
|||||||
|
|
||||||
@interface CreateBinaryDeltaOperation : NSOperation
|
@interface CreateBinaryDeltaOperation : NSOperation
|
||||||
@property (copy) NSString *relativePath;
|
@property (copy) NSString *relativePath;
|
||||||
|
@property (copy) NSString *clonedRelativePath;
|
||||||
@property (strong) NSString *resultPath;
|
@property (strong) NSString *resultPath;
|
||||||
@property (strong) NSNumber *oldPermissions;
|
@property (strong) NSNumber *oldPermissions;
|
||||||
@property (strong) NSNumber *permissions;
|
@property (strong) NSNumber *permissions;
|
||||||
|
@property (nonatomic) BOOL changingPermissions;
|
||||||
@property (strong) NSString *_fromPath;
|
@property (strong) NSString *_fromPath;
|
||||||
@property (strong) NSString *_toPath;
|
@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
|
@end
|
||||||
|
|
||||||
@implementation CreateBinaryDeltaOperation
|
@implementation CreateBinaryDeltaOperation
|
||||||
@synthesize relativePath = _relativePath;
|
@synthesize relativePath = _relativePath;
|
||||||
|
@synthesize clonedRelativePath = _clonedRelativePath;
|
||||||
@synthesize resultPath = _resultPath;
|
@synthesize resultPath = _resultPath;
|
||||||
@synthesize oldPermissions = _oldPermissions;
|
@synthesize oldPermissions = _oldPermissions;
|
||||||
@synthesize permissions = _permissions;
|
@synthesize permissions = _permissions;
|
||||||
|
@synthesize changingPermissions = _changingPermissions;
|
||||||
@synthesize _fromPath = _fromPath;
|
@synthesize _fromPath = _fromPath;
|
||||||
@synthesize _toPath = _toPath;
|
@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])) {
|
if ((self = [super init])) {
|
||||||
self.relativePath = relativePath;
|
self.relativePath = relativePath;
|
||||||
|
self.clonedRelativePath = clonedRelativePath;
|
||||||
self.oldPermissions = oldPermissions;
|
self.oldPermissions = oldPermissions;
|
||||||
self.permissions = permissions;
|
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];
|
self._toPath = [newTree stringByAppendingPathComponent:relativePath];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
@@ -88,15 +102,6 @@ static NSDictionary *infoForFile(FTSENT *ent)
|
|||||||
INFO_SIZE_KEY: @(size) };
|
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)
|
static bool aclExists(const FTSENT *ent)
|
||||||
{
|
{
|
||||||
// macOS does not currently support ACLs for symlinks
|
// 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 originalInfoType = [(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue];
|
||||||
unsigned short newInfoType = [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue];
|
unsigned short newInfoType = [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue];
|
||||||
if (originalInfoType != newInfoType) {
|
if (originalInfoType != newInfoType || originalInfoType != FTS_F) {
|
||||||
// File types are different
|
// File types are different or they're not regular files
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString *originalPath = originalInfo[INFO_PATH_KEY];
|
NSString *originalPath = originalInfo[INFO_PATH_KEY];
|
||||||
NSString *newPath = newInfo[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
|
// Skip delta if the files are equal in content
|
||||||
if (originalInfoType == FTS_D || [[NSFileManager defaultManager] contentsEqualAtPath:originalPath andPath:newPath]) {
|
if ([[NSFileManager defaultManager] contentsEqualAtPath:originalPath andPath:newPath]) {
|
||||||
// this is possible if just the permissions have changed but contents have not
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,72 +240,171 @@ static BOOL shouldChangePermissions(NSDictionary *originalInfo, NSDictionary *ne
|
|||||||
if (!originalInfo) {
|
if (!originalInfo) {
|
||||||
return NO;
|
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;
|
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 NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
return YES;
|
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;
|
// Avoid clones for small files. Small files can compress very well, sometimes better than tracking clones.
|
||||||
// Relative path must at least have starting "/" component and one more path component
|
if ([(NSNumber *)newInfo[INFO_SIZE_KEY] unsignedLongLongValue] <= MIN_SIZE_FOR_CLONE) {
|
||||||
if (rootRelativePathComponents.count < 2) {
|
return nil;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
{
|
||||||
|
NSData *keyHash = afterFileKeyToHashDictionary[key];
|
||||||
// Build parent files as needed until we get to our final file we want to add
|
if (keyHash != nil) {
|
||||||
// So if we get "Contents/Resources/foo.txt", we will first add "Contents" parent,
|
// Check for identical clones first
|
||||||
// then "Resources" parent, then "foo.txt" as the final entry we want to add
|
for (NSString *oldRelativePath in beforeHashToFileKeyDictionary[keyHash]) {
|
||||||
// We store every file we add into a fileTable for easy referencing
|
NSDictionary *oldCloneInfo = originalTreeState[oldRelativePath];
|
||||||
// Note if a diff has Contents/Resources/foo/ and Contents/Resources/foo/bar.txt,
|
if (oldCloneInfo == nil) {
|
||||||
// due to sorting order we will add the foo directory first and won't end up with
|
continue;
|
||||||
// mis-ordering bugs
|
}
|
||||||
xar_file_t lastParent = NULL;
|
|
||||||
for (NSUInteger componentIndex = 0; componentIndex < relativePathComponentsCount; componentIndex++) {
|
if ([(NSNumber *)oldCloneInfo[INFO_TYPE_KEY] unsignedShortValue] != FTS_F) {
|
||||||
NSArray<NSString *> *subpathComponents = [relativePathComponents subarrayWithRange:NSMakeRange(0, componentIndex + 1)];
|
continue;
|
||||||
NSString *subpathKey = [subpathComponents componentsJoinedByString:@"/"];
|
}
|
||||||
|
|
||||||
xar_file_t cachedFile = [fileTable[subpathKey] pointerValue];
|
NSString *clonePath = oldCloneInfo[INFO_PATH_KEY];
|
||||||
if (cachedFile != NULL) {
|
NSString *newPath = newInfo[INFO_PATH_KEY];
|
||||||
lastParent = cachedFile;
|
|
||||||
} else {
|
if (![[NSFileManager defaultManager] contentsEqualAtPath:clonePath andPath:newPath]) {
|
||||||
xar_file_t newParent;
|
continue;
|
||||||
|
}
|
||||||
BOOL atLastIndex = (componentIndex == relativePathComponentsCount - 1);
|
|
||||||
|
NSNumber *newPermissions = newInfo[INFO_PERMISSIONS_KEY];
|
||||||
NSString *lastPathComponent = subpathComponents.lastObject;
|
if (outNewPermissions != NULL) {
|
||||||
if (atLastIndex && filePath != nil) {
|
*outNewPermissions = newPermissions;
|
||||||
newParent = xar_add_frompath(x, lastParent, lastPathComponent.fileSystemRepresentation, filePath.fileSystemRepresentation);
|
}
|
||||||
} else {
|
|
||||||
newParent = xar_add_frombuffer(x, lastParent, lastPathComponent.fileSystemRepresentation, "", 1);
|
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(source);
|
||||||
assert(destination);
|
assert(destination);
|
||||||
assert(patchFile);
|
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];
|
NSMutableDictionary *originalTreeState = [NSMutableDictionary dictionary];
|
||||||
|
|
||||||
@@ -323,7 +426,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (verbose) {
|
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]);
|
fprintf(stderr, "Processing source, %s...", [source fileSystemRepresentation]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -372,9 +475,11 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
}
|
}
|
||||||
fts_close(fts);
|
fts_close(fts);
|
||||||
|
|
||||||
NSString *beforeHash = hashOfTreeWithVersion(source, majorVersion);
|
// This dictionary will help us keep track of clones
|
||||||
|
NSMutableDictionary<NSData *, NSMutableArray<NSString *> *> *beforeHashToFileKeyDictionary = MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion3) ? [NSMutableDictionary dictionary] : nil;
|
||||||
if (!beforeHash) {
|
|
||||||
|
unsigned char beforeHash[CC_SHA1_DIGEST_LENGTH] = {0};
|
||||||
|
if (!getRawHashOfTreeAndFileTablesWithVersion(beforeHash, source, majorVersion, beforeHashToFileKeyDictionary, nil)) {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
@@ -412,7 +517,11 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
}
|
}
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool foundFilesystemCompression = false;
|
||||||
|
|
||||||
|
uint32_t warningsCount = 0;
|
||||||
|
const uint32_t maxWarningsToPrint = 16;
|
||||||
while ((ent = fts_read(fts))) {
|
while ((ent = fts_read(fts))) {
|
||||||
if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D) {
|
if (ent->fts_info != FTS_F && ent->fts_info != FTS_SL && ent->fts_info != FTS_D) {
|
||||||
continue;
|
continue;
|
||||||
@@ -434,23 +543,10 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We should validate permissions and ACLs even if we don't store the info in the diff in the case of ACLs,
|
// We should validate 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
|
|
||||||
|
|
||||||
// We should also not allow files with code signed extended attributes since Apple doesn't recommend inserting these
|
// 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
|
// 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 (aclExists(ent)) {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
@@ -470,10 +566,50 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
}
|
}
|
||||||
return NO;
|
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];
|
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];
|
[newTreeState removeObjectForKey:key];
|
||||||
} else {
|
} else {
|
||||||
newTreeState[key] = info;
|
newTreeState[key] = info;
|
||||||
@@ -493,8 +629,11 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
}
|
}
|
||||||
fts_close(fts);
|
fts_close(fts);
|
||||||
|
|
||||||
NSString *afterHash = hashOfTreeWithVersion(destination, majorVersion);
|
// This dictionary will help us keep track of clones
|
||||||
if (!afterHash) {
|
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) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
@@ -512,31 +651,27 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\nWriting to temporary file %s...", [temporaryFile fileSystemRepresentation]);
|
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) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to write to %@", temporaryFile] }];
|
*error = archive.error;
|
||||||
}
|
}
|
||||||
return NO;
|
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];
|
NSOperationQueue *deltaQueue = [[NSOperationQueue alloc] init];
|
||||||
NSMutableArray *deltaOperations = [NSMutableArray array];
|
NSMutableArray *deltaOperations = [NSMutableArray array];
|
||||||
|
|
||||||
@@ -551,15 +686,104 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
return originalTreeState[key1] ? NSOrderedAscending : NSOrderedDescending;
|
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) {
|
for (NSString *key in keys) {
|
||||||
id value = [newTreeState valueForKey:key];
|
id value = [newTreeState valueForKey:key];
|
||||||
|
|
||||||
if ([(NSObject *)value isEqual:[NSNull null]]) {
|
if ([(NSObject *)value isEqual:[NSNull null]]) {
|
||||||
xar_file_t newFile = _xarAddFile(fileTable, x, key, NULL);
|
[archive addItem:[[SPUDeltaArchiveItem alloc] initWithRelativeFilePath:key commands:SPUDeltaItemCommandDelete mode:0]];
|
||||||
assert(newFile);
|
|
||||||
xar_prop_set(newFile, DELETE_KEY, "true");
|
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n❌ %s %s", VERBOSE_REMOVED, [key fileSystemRepresentation]);
|
fprintf(stderr, "\n❌ %s %s", VERBOSE_REMOVED, [key fileSystemRepresentation]);
|
||||||
@@ -570,47 +794,73 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
NSDictionary *originalInfo = originalTreeState[key];
|
NSDictionary *originalInfo = originalTreeState[key];
|
||||||
NSDictionary *newInfo = newTreeState[key];
|
NSDictionary *newInfo = newTreeState[key];
|
||||||
if (shouldSkipDeltaCompression(originalInfo, newInfo)) {
|
if (shouldSkipDeltaCompression(originalInfo, newInfo)) {
|
||||||
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2) && shouldSkipExtracting(originalInfo, newInfo)) {
|
if (shouldSkipExtracting(originalInfo, newInfo)) {
|
||||||
if (shouldChangePermissions(originalInfo, newInfo)) {
|
if (shouldChangePermissions(originalInfo, newInfo)) {
|
||||||
xar_file_t newFile = _xarAddFile(fileTable, x, key, NULL);
|
[archive addItem:[[SPUDeltaArchiveItem alloc] initWithRelativeFilePath:key commands:SPUDeltaItemCommandModifyPermissions mode:[(NSNumber *)newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]]];
|
||||||
assert(newFile);
|
|
||||||
xar_prop_set(newFile, MODIFY_PERMISSIONS_KEY, [[NSString stringWithFormat:@"%u", [(NSNumber *)newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]] UTF8String]);
|
|
||||||
|
|
||||||
if (verbose) {
|
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]);
|
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 {
|
} else {
|
||||||
NSString *path = [destination stringByAppendingPathComponent:key];
|
// Check if the new file can be cloned from an old existing one located at a different path
|
||||||
xar_file_t newFile = _xarAddFile(fileTable, x, key, path);
|
NSNumber *newPermissions = nil;
|
||||||
assert(newFile);
|
BOOL clonePermissionsChanged = NO;
|
||||||
|
BOOL clonedBinaryDiff = NO;
|
||||||
if (shouldDeleteThenExtract(originalInfo, newInfo)) {
|
NSString *clonedRelativePath = MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion3) ? cloneableRelativePath(afterFileKeyToHashDictionary, beforeHashToFileKeyDictionary, frameworkVersionsSubstitutes, fileSubstitutes, originalTreeState, newInfo, key, &newPermissions, &clonePermissionsChanged, &clonedBinaryDiff) : nil;
|
||||||
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2)) {
|
if (clonedRelativePath != nil) {
|
||||||
xar_prop_set(newFile, DELETE_KEY, "true");
|
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 {
|
} 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)) {
|
if (verbose) {
|
||||||
xar_prop_set(newFile, EXTRACT_KEY, "true");
|
if (originalInfo) {
|
||||||
}
|
fprintf(stderr, "\n✏️ %s %s", VERBOSE_UPDATED, [key fileSystemRepresentation]);
|
||||||
|
} else {
|
||||||
if (verbose) {
|
fprintf(stderr, "\n✅ %s %s", VERBOSE_ADDED, [key fileSystemRepresentation]);
|
||||||
if (originalInfo) {
|
}
|
||||||
fprintf(stderr, "\n✏️ %s %s", VERBOSE_UPDATED, [key fileSystemRepresentation]);
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, "\n✅ %s %s", VERBOSE_ADDED, [key fileSystemRepresentation]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
NSNumber *permissions =
|
NSNumber *permissions = newInfo[INFO_PERMISSIONS_KEY];
|
||||||
(MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2) && shouldChangePermissions(originalInfo, newInfo)) ?
|
|
||||||
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)];
|
||||||
nil;
|
|
||||||
CreateBinaryDeltaOperation *operation = [[CreateBinaryDeltaOperation alloc] initWithRelativePath:key oldTree:source newTree:destination oldPermissions:originalInfo[INFO_PERMISSIONS_KEY] newPermissions:permissions];
|
|
||||||
[deltaQueue addOperation:operation];
|
[deltaQueue addOperation:operation];
|
||||||
[deltaOperations addObject:operation];
|
[deltaOperations addObject:operation];
|
||||||
}
|
}
|
||||||
@@ -618,37 +868,83 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
|
|
||||||
[deltaQueue waitUntilAllOperationsAreFinished];
|
[deltaQueue waitUntilAllOperationsAreFinished];
|
||||||
|
|
||||||
|
BOOL deltaOperationsFailed = NO;
|
||||||
for (CreateBinaryDeltaOperation *operation in deltaOperations) {
|
for (CreateBinaryDeltaOperation *operation in deltaOperations) {
|
||||||
NSString *resultPath = [operation resultPath];
|
NSString *resultPath = [operation resultPath];
|
||||||
if (!resultPath) {
|
if (resultPath == nil) {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
if (error != NULL) {
|
if (error != NULL) {
|
||||||
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to create patch from source %@ and destination %@", operation.relativePath, resultPath] }];
|
*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) {
|
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);
|
if (operation.changingPermissions) {
|
||||||
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 (verbose) {
|
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;
|
NSFileManager *filemgr;
|
||||||
filemgr = [NSFileManager defaultManager];
|
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>
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
@interface SUCodeSigningVerifier : NSObject
|
@interface SUCodeSigningVerifier : NSObject
|
||||||
|
|
||||||
+ (BOOL)codeSignatureAtBundleURL:(NSURL *)oldBundleURL matchesSignatureAtBundleURL:(NSURL *)newBundleURL error:(NSError **)error;
|
+ (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;
|
+ (BOOL)bundleAtURLIsCodeSigned:(NSURL *)bundleURL;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@@ -127,6 +127,11 @@ finally:
|
|||||||
}
|
}
|
||||||
|
|
||||||
+ (BOOL)codeSignatureIsValidAtBundleURL:(NSURL *)bundleURL error:(NSError *__autoreleasing *)error
|
+ (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;
|
OSStatus result;
|
||||||
SecStaticCodeRef staticCode = NULL;
|
SecStaticCodeRef staticCode = NULL;
|
||||||
@@ -143,8 +148,12 @@ finally:
|
|||||||
goto 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);
|
SecCSFlags flags = (SecCSFlags) (kSecCSDefaultFlags | kSecCSCheckAllArchitectures);
|
||||||
|
if (checkNestedCode) {
|
||||||
|
flags |= kSecCSCheckNestedCode;
|
||||||
|
}
|
||||||
|
|
||||||
result = SecStaticCodeCheckValidityWithErrors(staticCode, flags, NULL, &cfError);
|
result = SecStaticCodeCheckValidityWithErrors(staticCode, flags, NULL, &cfError);
|
||||||
|
|
||||||
if (result != errSecSuccess) {
|
if (result != errSecSuccess) {
|
||||||
|
|||||||
@@ -191,13 +191,13 @@
|
|||||||
NSString *fromPath = [mountPoint stringByAppendingPathComponent:item];
|
NSString *fromPath = [mountPoint stringByAppendingPathComponent:item];
|
||||||
NSString *toPath = [[self.archivePath stringByDeletingLastPathComponent] 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]) {
|
if (![manager isReadableFileAtPath:fromPath]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
itemsCopied += 1.0;
|
|
||||||
[notifier notifyProgress:0.5 + itemsCopied/(totalItems*2.0)];
|
|
||||||
|
|
||||||
SULog(SULogLevelDefault, @"copyItemAtPath:%@ toPath:%@", fromPath, toPath);
|
SULog(SULogLevelDefault, @"copyItemAtPath:%@ toPath:%@", fromPath, toPath);
|
||||||
|
|
||||||
|
|||||||
@@ -265,7 +265,11 @@
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sparkle's DSA support is deprecated
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
__block SecGroupTransformRef group = SecTransformCreateGroupTransform();
|
__block SecGroupTransformRef group = SecTransformCreateGroupTransform();
|
||||||
|
#pragma clang diagnostic pop
|
||||||
__block SecTransformRef dataReadTransform = NULL;
|
__block SecTransformRef dataReadTransform = NULL;
|
||||||
__block SecTransformRef dataDigestTransform = NULL;
|
__block SecTransformRef dataDigestTransform = NULL;
|
||||||
__block SecTransformRef dataVerifyTransform = NULL;
|
__block SecTransformRef dataVerifyTransform = NULL;
|
||||||
@@ -318,7 +322,10 @@
|
|||||||
return cleanup();
|
return cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
SecTransformConnectTransforms(dataReadTransform, kSecTransformOutputAttributeName, dataDigestTransform, kSecTransformInputAttributeName, group, &error);
|
SecTransformConnectTransforms(dataReadTransform, kSecTransformOutputAttributeName, dataDigestTransform, kSecTransformInputAttributeName, group, &error);
|
||||||
|
#pragma clang diagnostic pop
|
||||||
if (error) {
|
if (error) {
|
||||||
if (outError != NULL) {
|
if (outError != NULL) {
|
||||||
*outError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{NSLocalizedDescriptionKey : @"Failed to connect data read transform", NSUnderlyingErrorKey: (__bridge NSError *)error}];
|
*outError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{NSLocalizedDescriptionKey : @"Failed to connect data read transform", NSUnderlyingErrorKey: (__bridge NSError *)error}];
|
||||||
@@ -327,7 +334,10 @@
|
|||||||
return cleanup();
|
return cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
SecTransformConnectTransforms(dataDigestTransform, kSecTransformOutputAttributeName, dataVerifyTransform, kSecTransformInputAttributeName, group, &error);
|
SecTransformConnectTransforms(dataDigestTransform, kSecTransformOutputAttributeName, dataVerifyTransform, kSecTransformInputAttributeName, group, &error);
|
||||||
|
#pragma clang diagnostic pop
|
||||||
if (error) {
|
if (error) {
|
||||||
if (outError != NULL) {
|
if (outError != NULL) {
|
||||||
*outError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{NSLocalizedDescriptionKey : @"Failed to connect data digest transform", NSUnderlyingErrorKey: (__bridge NSError *)error}];
|
*outError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{NSLocalizedDescriptionKey : @"Failed to connect data digest transform", NSUnderlyingErrorKey: (__bridge NSError *)error}];
|
||||||
@@ -336,7 +346,10 @@
|
|||||||
return cleanup();
|
return cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
NSNumber *result = CFBridgingRelease(SecTransformExecute(group, &error));
|
NSNumber *result = CFBridgingRelease(SecTransformExecute(group, &error));
|
||||||
|
#pragma clang diagnostic pop
|
||||||
if (error) {
|
if (error) {
|
||||||
SULog(SULogLevelError, @"DSA signature verification failed: %@", error);
|
SULog(SULogLevelError, @"DSA signature verification failed: %@", error);
|
||||||
if (outError != NULL) {
|
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,32 @@
|
|||||||
|
# 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
|
# 2.0.0
|
||||||
|
|
||||||
* Support for Sandboxed Applications (Zorg)
|
* Support for Sandboxed Applications (Zorg)
|
||||||
@@ -12,7 +41,7 @@
|
|||||||
* API Changes
|
* API Changes
|
||||||
* Introduced new SPUStandardUpdaterController, SPUUpdater, SPUUserDriver classes/protocols (Zorg)
|
* Introduced new SPUStandardUpdaterController, SPUUpdater, SPUUserDriver classes/protocols (Zorg)
|
||||||
* Decoupled AppKit and UI logic in the framework from core functionality (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)
|
* 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)
|
* `-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)
|
* Delegation methods may have been removed or added to the newer updater API. Please review `SPUUpdaterDelegate` if using `SPUUpdater`. (Zorg)
|
||||||
@@ -43,7 +72,7 @@
|
|||||||
|
|
||||||
Please visit [Sparkle's website](http://sparkle-project.org) for more information on documentation and migration.
|
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.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"}
|
||||||
@@ -1 +0,0 @@
|
|||||||
// BinaryDelta tool only
|
|
||||||
@@ -34,13 +34,13 @@ SPARKLE_ICON_NAME = AppIcon
|
|||||||
// If you change any of these version details, you must increase CURRENT_PROJECT_VERSION
|
// If you change any of these version details, you must increase CURRENT_PROJECT_VERSION
|
||||||
// These variables must have a space after the '=' too
|
// These variables must have a space after the '=' too
|
||||||
SPARKLE_VERSION_MAJOR = 2
|
SPARKLE_VERSION_MAJOR = 2
|
||||||
SPARKLE_VERSION_MINOR = 0
|
SPARKLE_VERSION_MINOR = 1
|
||||||
SPARKLE_VERSION_PATCH = 0
|
SPARKLE_VERSION_PATCH = 0
|
||||||
|
|
||||||
// This should be in SemVer format or empty, ie. "-beta.1"
|
// This should be in SemVer format or empty, ie. "-beta.1"
|
||||||
// These variables must have a space after the '=' too
|
// These variables must have a space after the '=' too
|
||||||
SPARKLE_VERSION_SUFFIX =
|
SPARKLE_VERSION_SUFFIX =
|
||||||
CURRENT_PROJECT_VERSION = 2008
|
CURRENT_PROJECT_VERSION = 2013
|
||||||
|
|
||||||
MARKETING_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)$(SPARKLE_VERSION_SUFFIX)
|
MARKETING_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)$(SPARKLE_VERSION_SUFFIX)
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO
|
ALWAYS_SEARCH_USER_PATHS = NO
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
// Copyright © 2019 Sparkle Project. All rights reserved.
|
// Copyright © 2019 Sparkle Project. All rights reserved.
|
||||||
|
|
||||||
#include "bsdiff-Shared.xcconfig"
|
#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/Entitlements"
|
||||||
mkdir -p "$CONFIGURATION_BUILD_DIR/staging-spm/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/Entitlements/$DOWNLOADER_BUNDLE_ID.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-spm/Entitlements/$DOWNLOADER_BUNDLE_ID.entitlements"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "$CONFIGURATION_BUILD_DIR/staging/Symbols"
|
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/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/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/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/${INSTALLER_LAUNCHER_BUNDLE_ID}.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/${DOWNLOADER_BUNDLE_ID}.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
|
||||||
fi
|
fi
|
||||||
cp -R "$CONFIGURATION_BUILD_DIR/staging/bin" "$CONFIGURATION_BUILD_DIR/staging-spm"
|
cp -R "$CONFIGURATION_BUILD_DIR/staging/bin" "$CONFIGURATION_BUILD_DIR/staging-spm"
|
||||||
cp -R "$CONFIGURATION_BUILD_DIR/staging/Symbols" "$CONFIGURATION_BUILD_DIR/staging-spm"
|
cp -R "$CONFIGURATION_BUILD_DIR/staging/Symbols" "$CONFIGURATION_BUILD_DIR/staging-spm"
|
||||||
|
|||||||
@@ -159,9 +159,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.downloadFilename = location.path;
|
||||||
[self downloadDidFinish]; // file is already in a system temp dir
|
[self downloadDidFinish]; // file is already in a system temp dir
|
||||||
|
|||||||
+3
-3
@@ -2,10 +2,10 @@
|
|||||||
import PackageDescription
|
import PackageDescription
|
||||||
|
|
||||||
// Version is technically not required here, SPM doesn't check
|
// Version is technically not required here, SPM doesn't check
|
||||||
let version = "2.0.0"
|
let version = "2.1.0"
|
||||||
// Tag is required to point towards the right asset. SPM requires the tag to follow semantic versioning to be able to resolve it.
|
// Tag is required to point towards the right asset. SPM requires the tag to follow semantic versioning to be able to resolve it.
|
||||||
let tag = "2.0.0"
|
let tag = "2.1.0"
|
||||||
let checksum = "bed3158a836fd946bc910f9643ba7878e53ccd05538291f599d8a75456f26818"
|
let checksum = "6a540f9bd4ef096b6229f134a6b98dea265c8f89ede418b50d49fc49d7fe0b46"
|
||||||
let url = "https://github.com/sparkle-project/Sparkle/releases/download/\(tag)/Sparkle-for-Swift-Package-Manager.zip"
|
let url = "https://github.com/sparkle-project/Sparkle/releases/download/\(tag)/Sparkle-for-Swift-Package-Manager.zip"
|
||||||
|
|
||||||
let package = Package(
|
let package = Package(
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = "Sparkle"
|
s.name = "Sparkle"
|
||||||
s.version = "2.0.0"
|
s.version = "2.1.0"
|
||||||
s.summary = "A software update framework for macOS"
|
s.summary = "A software update framework for macOS"
|
||||||
s.description = "Sparkle is an easy-to-use software update framework for macOS."
|
s.description = "Sparkle is an easy-to-use software update framework for macOS."
|
||||||
s.homepage = "https://sparkle-project.org"
|
s.homepage = "https://sparkle-project.org"
|
||||||
@@ -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 = { :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.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.public_header_files = 'Sparkle.framework/Versions/B/Headers/*.h'
|
||||||
s.vendored_frameworks = 'Sparkle.framework'
|
s.vendored_frameworks = 'Sparkle.framework'
|
||||||
s.xcconfig = {
|
s.xcconfig = {
|
||||||
|
|||||||
@@ -137,6 +137,8 @@
|
|||||||
720AC2C92618E89500E25A3E /* SUAppcastItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B5FC5409C5182000B25A18 /* SUAppcastItem.m */; };
|
720AC2C92618E89500E25A3E /* SUAppcastItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 61B5FC5409C5182000B25A18 /* SUAppcastItem.m */; };
|
||||||
720AC2DC2618E8A500E25A3E /* SPUSecureCoding.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E075B1CA3A6D6001A286B /* SPUSecureCoding.m */; };
|
720AC2DC2618E8A500E25A3E /* SPUSecureCoding.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E075B1CA3A6D6001A286B /* SPUSecureCoding.m */; };
|
||||||
720B16451C66433D006985FB /* SUTestApplicationTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 720B16431C66433D006985FB /* SUTestApplicationTest.swift */; };
|
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 */; };
|
720E217B1D0D00BF003A311C /* SPUUpdaterCycle.h in Headers */ = {isa = PBXBuildFile; fileRef = 720E21791D0D00BF003A311C /* SPUUpdaterCycle.h */; };
|
||||||
720E217C1D0D00BF003A311C /* SPUUpdaterCycle.m in Sources */ = {isa = PBXBuildFile; fileRef = 720E217A1D0D00BF003A311C /* SPUUpdaterCycle.m */; };
|
720E217C1D0D00BF003A311C /* SPUUpdaterCycle.m in Sources */ = {isa = PBXBuildFile; fileRef = 720E217A1D0D00BF003A311C /* SPUUpdaterCycle.m */; };
|
||||||
7210C7681B9A9A1500EB90AC /* SUUnarchiverTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7210C7671B9A9A1500EB90AC /* SUUnarchiverTest.swift */; };
|
7210C7681B9A9A1500EB90AC /* SUUnarchiverTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7210C7671B9A9A1500EB90AC /* SUUnarchiverTest.swift */; };
|
||||||
@@ -215,9 +217,22 @@
|
|||||||
725602D51C83551C00DAA70E /* SUApplicationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 725602D31C83551C00DAA70E /* SUApplicationInfo.h */; };
|
725602D51C83551C00DAA70E /* SUApplicationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 725602D31C83551C00DAA70E /* SUApplicationInfo.h */; };
|
||||||
725602D61C83551C00DAA70E /* SUApplicationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 725602D41C83551C00DAA70E /* SUApplicationInfo.m */; };
|
725602D61C83551C00DAA70E /* SUApplicationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 725602D41C83551C00DAA70E /* SUApplicationInfo.m */; };
|
||||||
725B3A82263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml in Resources */ = {isa = PBXBuildFile; fileRef = 725B3A81263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml */; };
|
725B3A82263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml in Resources */ = {isa = PBXBuildFile; fileRef = 725B3A81263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml */; };
|
||||||
|
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, ); }; };
|
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, ); }; };
|
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 */; };
|
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 */; };
|
725F97771C8A62F500265BE4 /* SUAdHocCodeSigning.m in Sources */ = {isa = PBXBuildFile; fileRef = 725F97751C8A62F500265BE4 /* SUAdHocCodeSigning.m */; };
|
||||||
725F97781C8A65AC00265BE4 /* 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 */; };
|
725F97841C8AA90000265BE4 /* SUPopUpTitlebarUserDriver.m in Sources */ = {isa = PBXBuildFile; fileRef = 725F97831C8AA90000265BE4 /* SUPopUpTitlebarUserDriver.m */; };
|
||||||
@@ -229,7 +244,6 @@
|
|||||||
7267E5781D3D895B00D1BF90 /* SUBinaryDeltaCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5711D3D895B00D1BF90 /* SUBinaryDeltaCommon.m */; };
|
7267E5781D3D895B00D1BF90 /* SUBinaryDeltaCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5711D3D895B00D1BF90 /* SUBinaryDeltaCommon.m */; };
|
||||||
7267E5791D3D895B00D1BF90 /* SUBinaryDeltaCreate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5731D3D895B00D1BF90 /* SUBinaryDeltaCreate.m */; };
|
7267E5791D3D895B00D1BF90 /* SUBinaryDeltaCreate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5731D3D895B00D1BF90 /* SUBinaryDeltaCreate.m */; };
|
||||||
7267E57A1D3D895B00D1BF90 /* 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 */; };
|
7267E57F1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E57E1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.m */; };
|
||||||
7267E5861D3D89B300D1BF90 /* SUDiskImageUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5811D3D89B300D1BF90 /* SUDiskImageUnarchiver.m */; };
|
7267E5861D3D89B300D1BF90 /* SUDiskImageUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5811D3D89B300D1BF90 /* SUDiskImageUnarchiver.m */; };
|
||||||
7267E5871D3D89B300D1BF90 /* SUPipedUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5831D3D89B300D1BF90 /* SUPipedUnarchiver.m */; };
|
7267E5871D3D89B300D1BF90 /* SUPipedUnarchiver.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5831D3D89B300D1BF90 /* SUPipedUnarchiver.m */; };
|
||||||
@@ -320,10 +334,15 @@
|
|||||||
728337A61C9E6FF40085AA99 /* SPUProbeInstallStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = 728337A41C9E6FF40085AA99 /* SPUProbeInstallStatus.h */; };
|
728337A61C9E6FF40085AA99 /* SPUProbeInstallStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = 728337A41C9E6FF40085AA99 /* SPUProbeInstallStatus.h */; };
|
||||||
728337A71C9E6FF40085AA99 /* SPUProbeInstallStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 728337A51C9E6FF40085AA99 /* SPUProbeInstallStatus.m */; };
|
728337A71C9E6FF40085AA99 /* SPUProbeInstallStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 728337A51C9E6FF40085AA99 /* SPUProbeInstallStatus.m */; };
|
||||||
728638ED1CAF50CE00783084 /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; };
|
728638ED1CAF50CE00783084 /* SUConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 61299A5F09CA6EB100B7442F /* SUConstants.m */; };
|
||||||
|
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 */; };
|
729051E41DC82AC0003DEA7F /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; };
|
||||||
7293A1AE1CEE933800B957A7 /* SPUURLRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 7293A1AC1CEE933800B957A7 /* SPUURLRequest.h */; };
|
7293A1AE1CEE933800B957A7 /* SPUURLRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 7293A1AC1CEE933800B957A7 /* SPUURLRequest.h */; };
|
||||||
7293A1AF1CEE933800B957A7 /* SPUURLRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7293A1AD1CEE933800B957A7 /* SPUURLRequest.m */; };
|
7293A1AF1CEE933800B957A7 /* SPUURLRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7293A1AD1CEE933800B957A7 /* SPUURLRequest.m */; };
|
||||||
7293A1B11CEE9B9F00B957A7 /* 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 */; };
|
729924941DF4A45000DBCDF5 /* SUUpdateValidator.m in Sources */ = {isa = PBXBuildFile; fileRef = 729924931DF4A45000DBCDF5 /* SUUpdateValidator.m */; };
|
||||||
729F7EAC27366353004592DC /* test-links.xml in Resources */ = {isa = PBXBuildFile; fileRef = 729F7EAB27366353004592DC /* test-links.xml */; };
|
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, ); }; };
|
729F7EAF273F1840004592DC /* SPUUserAgent+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 729F7EAD273F1840004592DC /* SPUUserAgent+Private.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||||
@@ -390,6 +409,16 @@
|
|||||||
72EF30C42675CFA1008CE987 /* SPUAppcastItemState.m in Sources */ = {isa = PBXBuildFile; fileRef = 72EF30BB2675CF38008CE987 /* SPUAppcastItemState.m */; };
|
72EF30C42675CFA1008CE987 /* SPUAppcastItemState.m in Sources */ = {isa = PBXBuildFile; fileRef = 72EF30BB2675CF38008CE987 /* SPUAppcastItemState.m */; };
|
||||||
72EF30C52675CFA1008CE987 /* SPUAppcastItemStateResolver.m in Sources */ = {isa = PBXBuildFile; fileRef = 72EF30BC2675CF38008CE987 /* SPUAppcastItemStateResolver.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, ); }; };
|
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 */; };
|
72F94F581CC44DE1002DEE68 /* SPUXPCServiceInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 72F94F561CC44DE1002DEE68 /* SPUXPCServiceInfo.h */; };
|
||||||
72F94F591CC44DE1002DEE68 /* SPUXPCServiceInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F94F571CC44DE1002DEE68 /* SPUXPCServiceInfo.m */; };
|
72F94F591CC44DE1002DEE68 /* SPUXPCServiceInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F94F571CC44DE1002DEE68 /* SPUXPCServiceInfo.m */; };
|
||||||
72F94F5A1CC450DE002DEE68 /* SUInstallerLauncher.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E07B11CAF08D6001A286B /* SUInstallerLauncher.m */; };
|
72F94F5A1CC450DE002DEE68 /* SUInstallerLauncher.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E07B11CAF08D6001A286B /* SUInstallerLauncher.m */; };
|
||||||
@@ -867,7 +896,6 @@
|
|||||||
5D06E8D00FD68C7C005AE3F6 /* BinaryDelta */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = BinaryDelta; sourceTree = BUILT_PRODUCTS_DIR; };
|
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>"; };
|
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>"; };
|
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; };
|
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; };
|
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; };
|
5D1AF58F0FD767AD0065DB48 /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; };
|
||||||
@@ -947,6 +975,8 @@
|
|||||||
720B16431C66433D006985FB /* SUTestApplicationTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SUTestApplicationTest.swift; path = UITests/SUTestApplicationTest.swift; 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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
7210C7671B9A9A1500EB90AC /* SUUnarchiverTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SUUnarchiverTest.swift; sourceTree = "<group>"; };
|
||||||
@@ -1128,10 +1158,19 @@
|
|||||||
725602D41C83551C00DAA70E /* SUApplicationInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUApplicationInfo.m; sourceTree = "<group>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
725F97821C8AA90000265BE4 /* SUPopUpTitlebarUserDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUPopUpTitlebarUserDriver.h; sourceTree = "<group>"; };
|
||||||
@@ -1145,7 +1184,6 @@
|
|||||||
7267E5711D3D895B00D1BF90 /* SUBinaryDeltaCommon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUBinaryDeltaCommon.m; path = Autoupdate/SUBinaryDeltaCommon.m; sourceTree = SOURCE_ROOT; };
|
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; };
|
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; };
|
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; };
|
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; };
|
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; };
|
7267E5801D3D89B300D1BF90 /* SUDiskImageUnarchiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUDiskImageUnarchiver.h; path = Autoupdate/SUDiskImageUnarchiver.h; sourceTree = SOURCE_ROOT; };
|
||||||
@@ -1226,6 +1264,8 @@
|
|||||||
728337A41C9E6FF40085AA99 /* SPUProbeInstallStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUProbeInstallStatus.h; sourceTree = "<group>"; };
|
728337A41C9E6FF40085AA99 /* SPUProbeInstallStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUProbeInstallStatus.h; sourceTree = "<group>"; };
|
||||||
728337A51C9E6FF40085AA99 /* SPUProbeInstallStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUProbeInstallStatus.m; sourceTree = "<group>"; };
|
728337A51C9E6FF40085AA99 /* SPUProbeInstallStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUProbeInstallStatus.m; sourceTree = "<group>"; };
|
||||||
728638EE1CAF589C00783084 /* ConfigDownloader.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigDownloader.xcconfig; sourceTree = "<group>"; };
|
728638EE1CAF589C00783084 /* ConfigDownloader.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigDownloader.xcconfig; sourceTree = "<group>"; };
|
||||||
|
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; };
|
||||||
7293A1AC1CEE933800B957A7 /* SPUURLRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUURLRequest.h; 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>"; };
|
7293A1AD1CEE933800B957A7 /* SPUURLRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUURLRequest.m; sourceTree = "<group>"; };
|
||||||
729924921DF4A45000DBCDF5 /* SUUpdateValidator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUUpdateValidator.h; path = Sparkle/SUUpdateValidator.h; sourceTree = SOURCE_ROOT; };
|
729924921DF4A45000DBCDF5 /* SUUpdateValidator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUUpdateValidator.h; path = Sparkle/SUUpdateValidator.h; sourceTree = SOURCE_ROOT; };
|
||||||
@@ -1306,6 +1346,7 @@
|
|||||||
72EF30BC2675CF38008CE987 /* SPUAppcastItemStateResolver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPUAppcastItemStateResolver.m; sourceTree = "<group>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
72F94EDA1CC36C37002DEE68 /* ConfigTestAppDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = ConfigTestAppDebug.xcconfig; sourceTree = "<group>"; };
|
||||||
@@ -1383,6 +1424,7 @@
|
|||||||
files = (
|
files = (
|
||||||
EA1E281922B645D9004AA304 /* libbsdiff.a in Frameworks */,
|
EA1E281922B645D9004AA304 /* libbsdiff.a in Frameworks */,
|
||||||
5D06E9050FD68D7D005AE3F6 /* Foundation.framework in Frameworks */,
|
5D06E9050FD68D7D005AE3F6 /* Foundation.framework in Frameworks */,
|
||||||
|
725C2EAC2782EF3C007CB7B5 /* ArgumentParser in Frameworks */,
|
||||||
5D06E8FF0FD68D6D005AE3F6 /* libbz2.dylib in Frameworks */,
|
5D06E8FF0FD68D6D005AE3F6 /* libbz2.dylib in Frameworks */,
|
||||||
5D1AF58B0FD7678C0065DB48 /* libxar.1.dylib in Frameworks */,
|
5D1AF58B0FD7678C0065DB48 /* libxar.1.dylib in Frameworks */,
|
||||||
5D1AF5900FD767AD0065DB48 /* libxml2.dylib in Frameworks */,
|
5D1AF5900FD767AD0065DB48 /* libxml2.dylib in Frameworks */,
|
||||||
@@ -1394,6 +1436,7 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
725B81FB2781CD930041746F /* libcompression.tbd in Frameworks */,
|
||||||
5A06357323FE333600478A72 /* libed25519.a in Frameworks */,
|
5A06357323FE333600478A72 /* libed25519.a in Frameworks */,
|
||||||
EA1E281822B645CE004AA304 /* libbsdiff.a in Frameworks */,
|
EA1E281822B645CE004AA304 /* libbsdiff.a in Frameworks */,
|
||||||
14732BD119610A1200593899 /* AppKit.framework in Frameworks */,
|
14732BD119610A1200593899 /* AppKit.framework in Frameworks */,
|
||||||
@@ -1409,6 +1452,9 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
72F0EC4D278A5BCA002A876A /* libbsdiff.a in Frameworks */,
|
||||||
|
72F0EC4C278A5BB9002A876A /* libbz2.tbd in Frameworks */,
|
||||||
|
72F0EC4B278A5BB2002A876A /* libxar.tbd in Frameworks */,
|
||||||
5A06357423FE33A400478A72 /* libed25519.a in Frameworks */,
|
5A06357423FE33A400478A72 /* libed25519.a in Frameworks */,
|
||||||
14950073195FCE4E00BC5B5B /* AppKit.framework in Frameworks */,
|
14950073195FCE4E00BC5B5B /* AppKit.framework in Frameworks */,
|
||||||
14950072195FCE4B00BC5B5B /* Foundation.framework in Frameworks */,
|
14950072195FCE4B00BC5B5B /* Foundation.framework in Frameworks */,
|
||||||
@@ -1487,6 +1533,7 @@
|
|||||||
EA1E281722B645AE004AA304 /* libbsdiff.a in Frameworks */,
|
EA1E281722B645AE004AA304 /* libbsdiff.a in Frameworks */,
|
||||||
7267E5C91D3D8C4300D1BF90 /* CoreServices.framework in Frameworks */,
|
7267E5C91D3D8C4300D1BF90 /* CoreServices.framework in Frameworks */,
|
||||||
7267E5CA1D3D8C4800D1BF90 /* Foundation.framework in Frameworks */,
|
7267E5CA1D3D8C4800D1BF90 /* Foundation.framework in Frameworks */,
|
||||||
|
725B81FA2781AEAF0041746F /* libcompression.tbd in Frameworks */,
|
||||||
5A06357023FE332300478A72 /* libed25519.a in Frameworks */,
|
5A06357023FE332300478A72 /* libed25519.a in Frameworks */,
|
||||||
7267E5D61D3D8D3500D1BF90 /* libbz2.tbd in Frameworks */,
|
7267E5D61D3D8D3500D1BF90 /* libbz2.tbd in Frameworks */,
|
||||||
7267E5D51D3D8D2800D1BF90 /* libxar.tbd in Frameworks */,
|
7267E5D51D3D8D2800D1BF90 /* libxar.tbd in Frameworks */,
|
||||||
@@ -1507,6 +1554,7 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
725B81FC2781CDC20041746F /* libcompression.tbd in Frameworks */,
|
||||||
1495006F195FCE1800BC5B5B /* Foundation.framework in Frameworks */,
|
1495006F195FCE1800BC5B5B /* Foundation.framework in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@@ -1589,6 +1637,7 @@
|
|||||||
0867D69AFE84028FC02AAC07 /* Frameworks */ = {
|
0867D69AFE84028FC02AAC07 /* Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
725B81F92781AEA40041746F /* libcompression.tbd */,
|
||||||
0867D6A5FE840307C02AAC07 /* AppKit.framework */,
|
0867D6A5FE840307C02AAC07 /* AppKit.framework */,
|
||||||
721BC2081D17A553002BC71E /* Carbon.framework */,
|
721BC2081D17A553002BC71E /* Carbon.framework */,
|
||||||
525A278F133D6AE900FD8D70 /* Cocoa.framework */,
|
525A278F133D6AE900FD8D70 /* Cocoa.framework */,
|
||||||
@@ -1719,6 +1768,8 @@
|
|||||||
5AD0FA7E1C73F2E2004BCEFF /* testappcast.xml */,
|
5AD0FA7E1C73F2E2004BCEFF /* testappcast.xml */,
|
||||||
723EDC3E26885A8E000BCBA4 /* testappcast_channels.xml */,
|
723EDC3E26885A8E000BCBA4 /* testappcast_channels.xml */,
|
||||||
725B3A81263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml */,
|
725B3A81263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml */,
|
||||||
|
720DC50327A51A6500DFF3EC /* testappcast_minimumAutoupdateVersionSkipping.xml */,
|
||||||
|
720DC50527A62CDC00DFF3EC /* testappcast_minimumAutoupdateVersionSkipping2.xml */,
|
||||||
7202DC99269ABD3500737EC4 /* testappcast_phasedRollout.xml */,
|
7202DC99269ABD3500737EC4 /* testappcast_phasedRollout.xml */,
|
||||||
722545B526805FF80036465C /* testappcast_info_updates.xml */,
|
722545B526805FF80036465C /* testappcast_info_updates.xml */,
|
||||||
5F1510A11C96E591006E1629 /* testnamespaces.xml */,
|
5F1510A11C96E591006E1629 /* testnamespaces.xml */,
|
||||||
@@ -1760,9 +1811,18 @@
|
|||||||
7267E5711D3D895B00D1BF90 /* SUBinaryDeltaCommon.m */,
|
7267E5711D3D895B00D1BF90 /* SUBinaryDeltaCommon.m */,
|
||||||
7267E5721D3D895B00D1BF90 /* SUBinaryDeltaCreate.h */,
|
7267E5721D3D895B00D1BF90 /* SUBinaryDeltaCreate.h */,
|
||||||
7267E5731D3D895B00D1BF90 /* SUBinaryDeltaCreate.m */,
|
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 */,
|
7267E57D1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.h */,
|
||||||
7267E57E1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.m */,
|
7267E57E1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.m */,
|
||||||
|
725C2EA92782EC61007CB7B5 /* main.swift */,
|
||||||
|
725C2EA82782EC44007CB7B5 /* Bridging-Header.h */,
|
||||||
);
|
);
|
||||||
name = "Binary Delta";
|
name = "Binary Delta";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -1935,6 +1995,7 @@
|
|||||||
72E45CF51B640DAE005C701A /* SUUpdateSettingsWindowController.m */,
|
72E45CF51B640DAE005C701A /* SUUpdateSettingsWindowController.m */,
|
||||||
72E45CF61B640DAE005C701A /* SUUpdateSettingsWindowController.xib */,
|
72E45CF61B640DAE005C701A /* SUUpdateSettingsWindowController.xib */,
|
||||||
61B5F90409C4CEE200B25A18 /* TestApplication-Info.plist */,
|
61B5F90409C4CEE200B25A18 /* TestApplication-Info.plist */,
|
||||||
|
72F0EC44278A55CA002A876A /* screenshot.png */,
|
||||||
);
|
);
|
||||||
name = "Test Application";
|
name = "Test Application";
|
||||||
path = TestApplication;
|
path = TestApplication;
|
||||||
@@ -2301,7 +2362,6 @@
|
|||||||
EA1E286822B664FD004AA304 /* CommandLineTool-Debug.xcconfig */,
|
EA1E286822B664FD004AA304 /* CommandLineTool-Debug.xcconfig */,
|
||||||
EA1E286722B664FD004AA304 /* CommandLineTool-Release.xcconfig */,
|
EA1E286722B664FD004AA304 /* CommandLineTool-Release.xcconfig */,
|
||||||
EA1E286922B664FD004AA304 /* CommandLineTool-Shared.xcconfig */,
|
EA1E286922B664FD004AA304 /* CommandLineTool-Shared.xcconfig */,
|
||||||
5D06E8F10FD68D21005AE3F6 /* ConfigBinaryDelta.xcconfig */,
|
|
||||||
FA1941D00D94A70100DD942E /* ConfigCommon.xcconfig */,
|
FA1941D00D94A70100DD942E /* ConfigCommon.xcconfig */,
|
||||||
149B78631B7D3A0C00D7D62C /* ConfigCommonCoverage.xcconfig */,
|
149B78631B7D3A0C00D7D62C /* ConfigCommonCoverage.xcconfig */,
|
||||||
FA1941CF0D94A70100DD942E /* ConfigCommonDebug.xcconfig */,
|
FA1941CF0D94A70100DD942E /* ConfigCommonDebug.xcconfig */,
|
||||||
@@ -2476,6 +2536,9 @@
|
|||||||
376769AF23442F320077B8F7 /* PBXTargetDependency */,
|
376769AF23442F320077B8F7 /* PBXTargetDependency */,
|
||||||
);
|
);
|
||||||
name = BinaryDelta;
|
name = BinaryDelta;
|
||||||
|
packageProductDependencies = (
|
||||||
|
725C2EAB2782EF3C007CB7B5 /* ArgumentParser */,
|
||||||
|
);
|
||||||
productName = BinaryDelta;
|
productName = BinaryDelta;
|
||||||
productReference = 5D06E8D00FD68C7C005AE3F6 /* BinaryDelta */;
|
productReference = 5D06E8D00FD68C7C005AE3F6 /* BinaryDelta */;
|
||||||
productType = "com.apple.product-type.tool";
|
productType = "com.apple.product-type.tool";
|
||||||
@@ -2812,6 +2875,9 @@
|
|||||||
LastUpgradeCheck = 1300;
|
LastUpgradeCheck = 1300;
|
||||||
ORGANIZATIONNAME = "Sparkle Project";
|
ORGANIZATIONNAME = "Sparkle Project";
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
|
5D06E8CF0FD68C7C005AE3F6 = {
|
||||||
|
LastSwiftMigration = 1320;
|
||||||
|
};
|
||||||
612279D80DB5470200AB99EA = {
|
612279D80DB5470200AB99EA = {
|
||||||
LastSwiftMigration = 0800;
|
LastSwiftMigration = 0800;
|
||||||
TestTargetID = 8DC2EF4F0486A6940098B216;
|
TestTargetID = 8DC2EF4F0486A6940098B216;
|
||||||
@@ -2976,6 +3042,7 @@
|
|||||||
725B3A82263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml in Resources */,
|
725B3A82263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml in Resources */,
|
||||||
14958C6E19AEBC950061B14F /* signed-test-file.txt in Resources */,
|
14958C6E19AEBC950061B14F /* signed-test-file.txt in Resources */,
|
||||||
723EDC3F26885A8E000BCBA4 /* testappcast_channels.xml in Resources */,
|
723EDC3F26885A8E000BCBA4 /* testappcast_channels.xml in Resources */,
|
||||||
|
720DC50427A51A6500DFF3EC /* testappcast_minimumAutoupdateVersionSkipping.xml in Resources */,
|
||||||
72AC6B2E1B9B218C00F62325 /* SparkleTestCodeSignApp.dmg in Resources */,
|
72AC6B2E1B9B218C00F62325 /* SparkleTestCodeSignApp.dmg in Resources */,
|
||||||
C23E885B1BE7B24F0050BB73 /* SparkleTestCodeSignApp.enc.dmg in Resources */,
|
C23E885B1BE7B24F0050BB73 /* SparkleTestCodeSignApp.enc.dmg in Resources */,
|
||||||
72AC6B281B9AAD6700F62325 /* SparkleTestCodeSignApp.tar in Resources */,
|
72AC6B281B9AAD6700F62325 /* SparkleTestCodeSignApp.tar in Resources */,
|
||||||
@@ -2989,6 +3056,7 @@
|
|||||||
14958C6F19AEBC980061B14F /* test-pubkey.pem in Resources */,
|
14958C6F19AEBC980061B14F /* test-pubkey.pem in Resources */,
|
||||||
5AF6C74F1AEA46D10014A3AB /* test.pkg in Resources */,
|
5AF6C74F1AEA46D10014A3AB /* test.pkg in Resources */,
|
||||||
72BC6C3D275027BF0083F14B /* SparkleTestCodeSign_apfs.dmg in Resources */,
|
72BC6C3D275027BF0083F14B /* SparkleTestCodeSign_apfs.dmg in Resources */,
|
||||||
|
720DC50627A62CDC00DFF3EC /* testappcast_minimumAutoupdateVersionSkipping2.xml in Resources */,
|
||||||
5AD0FA7F1C73F2E2004BCEFF /* testappcast.xml in Resources */,
|
5AD0FA7F1C73F2E2004BCEFF /* testappcast.xml in Resources */,
|
||||||
FA30773D24CBC295007BA37D /* testlocalizedreleasenotesappcast.xml in Resources */,
|
FA30773D24CBC295007BA37D /* testlocalizedreleasenotesappcast.xml in Resources */,
|
||||||
72CCDEBE27421FD500B53718 /* SparkleTestCodeSignApp_bad_header.zip in Resources */,
|
72CCDEBE27421FD500B53718 /* SparkleTestCodeSignApp_bad_header.zip in Resources */,
|
||||||
@@ -3008,6 +3076,7 @@
|
|||||||
72E45CFC1B641961005C701A /* sparkletestcast.xml in Resources */,
|
72E45CFC1B641961005C701A /* sparkletestcast.xml in Resources */,
|
||||||
725F97A61C8B304D00265BE4 /* SUInstallUpdateViewController.xib in Resources */,
|
725F97A61C8B304D00265BE4 /* SUInstallUpdateViewController.xib in Resources */,
|
||||||
723ABE02259A9E9E00BDB4FA /* MainMenu.xib in Resources */,
|
723ABE02259A9E9E00BDB4FA /* MainMenu.xib in Resources */,
|
||||||
|
72F0EC45278A55CA002A876A /* screenshot.png in Resources */,
|
||||||
72E45CF81B640DAE005C701A /* SUUpdateSettingsWindowController.xib in Resources */,
|
72E45CF81B640DAE005C701A /* SUUpdateSettingsWindowController.xib in Resources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
@@ -3154,10 +3223,13 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
725EE482277BF44A00D820CE /* SPUXarDeltaArchive.m in Sources */,
|
||||||
|
728ED34C277DA23400D9238F /* SPUSparkleDeltaArchive.m in Sources */,
|
||||||
|
725C2EAA2782EC61007CB7B5 /* main.swift in Sources */,
|
||||||
7267E5761D3D895B00D1BF90 /* SUBinaryDeltaApply.m in Sources */,
|
7267E5761D3D895B00D1BF90 /* SUBinaryDeltaApply.m in Sources */,
|
||||||
|
725EE487277D376000D820CE /* SPUDeltaArchive.m in Sources */,
|
||||||
7267E5781D3D895B00D1BF90 /* SUBinaryDeltaCommon.m in Sources */,
|
7267E5781D3D895B00D1BF90 /* SUBinaryDeltaCommon.m in Sources */,
|
||||||
7267E57A1D3D895B00D1BF90 /* SUBinaryDeltaCreate.m in Sources */,
|
7267E57A1D3D895B00D1BF90 /* SUBinaryDeltaCreate.m in Sources */,
|
||||||
7267E57C1D3D895B00D1BF90 /* SUBinaryDeltaTool.m in Sources */,
|
|
||||||
726F2CE81BC9C48F001971A4 /* SUConstants.m in Sources */,
|
726F2CE81BC9C48F001971A4 /* SUConstants.m in Sources */,
|
||||||
7267E5EA1D3D90AA00D1BF90 /* SUFileManager.m in Sources */,
|
7267E5EA1D3D90AA00D1BF90 /* SUFileManager.m in Sources */,
|
||||||
726F2CE91BC9C499001971A4 /* SUOperatingSystem.m in Sources */,
|
726F2CE91BC9C499001971A4 /* SUOperatingSystem.m in Sources */,
|
||||||
@@ -3168,6 +3240,8 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
725EE488277D398100D820CE /* SPUDeltaArchive.m in Sources */,
|
||||||
|
725EE483277C767A00D820CE /* SPUXarDeltaArchive.m in Sources */,
|
||||||
7269E4982648D3460088C213 /* SPUSkippedUpdate.m in Sources */,
|
7269E4982648D3460088C213 /* SPUSkippedUpdate.m in Sources */,
|
||||||
721D5ABC25C680A300D23BEA /* SUFlatPackageUnarchiver.m in Sources */,
|
721D5ABC25C680A300D23BEA /* SUFlatPackageUnarchiver.m in Sources */,
|
||||||
725F97771C8A62F500265BE4 /* SUAdHocCodeSigning.m in Sources */,
|
725F97771C8A62F500265BE4 /* SUAdHocCodeSigning.m in Sources */,
|
||||||
@@ -3175,6 +3249,7 @@
|
|||||||
7267E5EE1D3D915900D1BF90 /* SUBinaryDeltaApply.m in Sources */,
|
7267E5EE1D3D915900D1BF90 /* SUBinaryDeltaApply.m in Sources */,
|
||||||
7267E5EF1D3D915900D1BF90 /* SUBinaryDeltaCommon.m in Sources */,
|
7267E5EF1D3D915900D1BF90 /* SUBinaryDeltaCommon.m in Sources */,
|
||||||
7267E5F01D3D915900D1BF90 /* SUBinaryDeltaCreate.m in Sources */,
|
7267E5F01D3D915900D1BF90 /* SUBinaryDeltaCreate.m in Sources */,
|
||||||
|
728ED34B277DA23400D9238F /* SPUSparkleDeltaArchive.m in Sources */,
|
||||||
142E0E0919A83AAC00E4312B /* SUBinaryDeltaTest.m in Sources */,
|
142E0E0919A83AAC00E4312B /* SUBinaryDeltaTest.m in Sources */,
|
||||||
7267E5F11D3D917A00D1BF90 /* SUBinaryDeltaUnarchiver.m in Sources */,
|
7267E5F11D3D917A00D1BF90 /* SUBinaryDeltaUnarchiver.m in Sources */,
|
||||||
F8761EB11ADC5068000C9034 /* SUCodeSigningVerifierTest.m in Sources */,
|
F8761EB11ADC5068000C9034 /* SUCodeSigningVerifierTest.m in Sources */,
|
||||||
@@ -3204,6 +3279,12 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
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 */,
|
61B5F93009C4CFDC00B25A18 /* main.m in Sources */,
|
||||||
726F2CEB1BC9C733001971A4 /* SUConstants.m in Sources */,
|
726F2CEB1BC9C733001971A4 /* SUConstants.m in Sources */,
|
||||||
725F97A51C8B304D00265BE4 /* SUInstallUpdateViewController.m in Sources */,
|
725F97A51C8B304D00265BE4 /* SUInstallUpdateViewController.m in Sources */,
|
||||||
@@ -3218,6 +3299,9 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
729743AB279D1BD2009910B2 /* SUCodeSigningVerifier.m in Sources */,
|
||||||
|
725EE489277D39B400D820CE /* SPUDeltaArchive.m in Sources */,
|
||||||
|
725EE48A277D39B400D820CE /* SPUXarDeltaArchive.m in Sources */,
|
||||||
721D5B1B25C692BB00D23BEA /* SUFlatPackageUnarchiver.m in Sources */,
|
721D5B1B25C692BB00D23BEA /* SUFlatPackageUnarchiver.m in Sources */,
|
||||||
72464F7C1E2097F600FB341C /* SUOperatingSystem.m in Sources */,
|
72464F7C1E2097F600FB341C /* SUOperatingSystem.m in Sources */,
|
||||||
7205C44C1E1304CE00E370AE /* Appcast.swift in Sources */,
|
7205C44C1E1304CE00E370AE /* Appcast.swift in Sources */,
|
||||||
@@ -3225,6 +3309,7 @@
|
|||||||
7205C44E1E1304CE00E370AE /* Signatures.swift in Sources */,
|
7205C44E1E1304CE00E370AE /* Signatures.swift in Sources */,
|
||||||
7205C44F1E1304CE00E370AE /* FeedXML.swift in Sources */,
|
7205C44F1E1304CE00E370AE /* FeedXML.swift in Sources */,
|
||||||
7205C4411E13049400E370AE /* main.swift in Sources */,
|
7205C4411E13049400E370AE /* main.swift in Sources */,
|
||||||
|
728ED34D277DA23400D9238F /* SPUSparkleDeltaArchive.m in Sources */,
|
||||||
7205C45F1E13066F00E370AE /* SUBinaryDeltaApply.m in Sources */,
|
7205C45F1E13066F00E370AE /* SUBinaryDeltaApply.m in Sources */,
|
||||||
7205C4621E1306A600E370AE /* SUBinaryDeltaCommon.m in Sources */,
|
7205C4621E1306A600E370AE /* SUBinaryDeltaCommon.m in Sources */,
|
||||||
FA30773F24CBC3E9007BA37D /* URL+Hashing.swift in Sources */,
|
FA30773F24CBC3E9007BA37D /* URL+Hashing.swift in Sources */,
|
||||||
@@ -3346,6 +3431,8 @@
|
|||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
725EE480277BF13B00D820CE /* SPUXarDeltaArchive.m in Sources */,
|
||||||
|
728ED34A277DA23400D9238F /* SPUSparkleDeltaArchive.m in Sources */,
|
||||||
72EF30C42675CFA1008CE987 /* SPUAppcastItemState.m in Sources */,
|
72EF30C42675CFA1008CE987 /* SPUAppcastItemState.m in Sources */,
|
||||||
72EF30C52675CFA1008CE987 /* SPUAppcastItemStateResolver.m in Sources */,
|
72EF30C52675CFA1008CE987 /* SPUAppcastItemStateResolver.m in Sources */,
|
||||||
72464F701E1F31E000FB341C /* SUOperatingSystem.m in Sources */,
|
72464F701E1F31E000FB341C /* SUOperatingSystem.m in Sources */,
|
||||||
@@ -3359,6 +3446,7 @@
|
|||||||
7267E5CD1D3D8C7200D1BF90 /* SPUSecureCoding.m in Sources */,
|
7267E5CD1D3D8C7200D1BF90 /* SPUSecureCoding.m in Sources */,
|
||||||
7267E5CB1D3D8C6400D1BF90 /* SUAppcastItem.m in Sources */,
|
7267E5CB1D3D8C6400D1BF90 /* SUAppcastItem.m in Sources */,
|
||||||
7267E5751D3D895B00D1BF90 /* SUBinaryDeltaApply.m in Sources */,
|
7267E5751D3D895B00D1BF90 /* SUBinaryDeltaApply.m in Sources */,
|
||||||
|
725EE486277D375F00D820CE /* SPUDeltaArchive.m in Sources */,
|
||||||
7267E5771D3D895B00D1BF90 /* SUBinaryDeltaCommon.m in Sources */,
|
7267E5771D3D895B00D1BF90 /* SUBinaryDeltaCommon.m in Sources */,
|
||||||
7267E5791D3D895B00D1BF90 /* SUBinaryDeltaCreate.m in Sources */,
|
7267E5791D3D895B00D1BF90 /* SUBinaryDeltaCreate.m in Sources */,
|
||||||
7267E57F1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.m in Sources */,
|
7267E57F1D3D896700D1BF90 /* SUBinaryDeltaUnarchiver.m in Sources */,
|
||||||
@@ -3902,7 +3990,7 @@
|
|||||||
};
|
};
|
||||||
149B785E1B7D398100D7D62C /* Coverage */ = {
|
149B785E1B7D398100D7D62C /* Coverage */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
baseConfigurationReference = 5D06E8F10FD68D21005AE3F6 /* ConfigBinaryDelta.xcconfig */;
|
baseConfigurationReference = EA1E286722B664FD004AA304 /* CommandLineTool-Release.xcconfig */;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
};
|
};
|
||||||
name = Coverage;
|
name = Coverage;
|
||||||
@@ -3949,14 +4037,14 @@
|
|||||||
};
|
};
|
||||||
5D06E8D20FD68C7D005AE3F6 /* Debug */ = {
|
5D06E8D20FD68C7D005AE3F6 /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
baseConfigurationReference = 5D06E8F10FD68D21005AE3F6 /* ConfigBinaryDelta.xcconfig */;
|
baseConfigurationReference = EA1E286822B664FD004AA304 /* CommandLineTool-Debug.xcconfig */;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
5D06E8D30FD68C7D005AE3F6 /* Release */ = {
|
5D06E8D30FD68C7D005AE3F6 /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
baseConfigurationReference = 5D06E8F10FD68D21005AE3F6 /* ConfigBinaryDelta.xcconfig */;
|
baseConfigurationReference = EA1E286722B664FD004AA304 /* CommandLineTool-Release.xcconfig */;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
@@ -4544,6 +4632,11 @@
|
|||||||
/* End XCRemoteSwiftPackageReference section */
|
/* End XCRemoteSwiftPackageReference section */
|
||||||
|
|
||||||
/* Begin XCSwiftPackageProductDependency section */
|
/* Begin XCSwiftPackageProductDependency section */
|
||||||
|
725C2EAB2782EF3C007CB7B5 /* ArgumentParser */ = {
|
||||||
|
isa = XCSwiftPackageProductDependency;
|
||||||
|
package = 727DBAE326B5BBFD00111F0C /* XCRemoteSwiftPackageReference "swift-argument-parser" */;
|
||||||
|
productName = ArgumentParser;
|
||||||
|
};
|
||||||
727DBAE426B5BBFD00111F0C /* ArgumentParser */ = {
|
727DBAE426B5BBFD00111F0C /* ArgumentParser */ = {
|
||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
package = 727DBAE326B5BBFD00111F0C /* XCRemoteSwiftPackageReference "swift-argument-parser" */;
|
package = 727DBAE326B5BBFD00111F0C /* XCRemoteSwiftPackageReference "swift-argument-parser" */;
|
||||||
|
|||||||
Vendored
-3
@@ -95,9 +95,6 @@
|
|||||||
/* Title confirmation for skipping major upgrade and future updates */
|
/* 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?";
|
"Are you sure you want to skip this upgrade?" = "Are you sure you want to skip this upgrade?";
|
||||||
|
|
||||||
/* 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 */
|
/* Skipping major upgrade */
|
||||||
"Skip Upgrade" = "Skip Upgrade";
|
"Skip Upgrade" = "Skip Upgrade";
|
||||||
|
|
||||||
|
|||||||
@@ -331,7 +331,7 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Note: we can launch application bundles or open plug-in bundles
|
// 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);
|
SULog(SULogLevelError, @"Error: Failed to relaunch bundle at %@", pathToRelaunch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-1
@@ -98,8 +98,22 @@
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSString *hostVersion = self.hostVersion;
|
||||||
|
|
||||||
// Informational update only for a set of host versions we're updating from
|
// Informational update only for a set of host versions we're updating from
|
||||||
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
|
- (SPUAppcastItemState *)resolveStateWithInformationalUpdateVersions:(NSSet<NSString *> * _Nullable)informationalUpdateVersions minimumOperatingSystemVersion:(NSString * _Nullable)minimumOperatingSystemVersion maximumOperatingSystemVersion:(NSString * _Nullable)maximumOperatingSystemVersion minimumAutoupdateVersion:(NSString * _Nullable)minimumAutoupdateVersion criticalUpdateDictionary:(NSDictionary * _Nullable)criticalUpdateDictionary
|
||||||
|
|||||||
Vendored
+1
-3
@@ -38,12 +38,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
- (void)coreDriverDidStartExtractingUpdate;
|
- (void)coreDriverDidStartExtractingUpdate;
|
||||||
|
|
||||||
- (void)installerDidStartInstalling;
|
- (void)installerDidStartInstallingWithApplicationTerminated:(BOOL)applicationTerminated;
|
||||||
|
|
||||||
- (void)installerDidExtractUpdateWithProgress:(double)progress;
|
- (void)installerDidExtractUpdateWithProgress:(double)progress;
|
||||||
|
|
||||||
- (void)installerIsSendingAppTerminationSignal;
|
|
||||||
|
|
||||||
- (void)installerDidFinishInstallationAndRelaunched:(BOOL)relaunched acknowledgement:(void(^)(void))acknowledgement;
|
- (void)installerDidFinishInstallationAndRelaunched:(BOOL)relaunched acknowledgement:(void(^)(void))acknowledgement;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
Vendored
+3
-11
@@ -261,10 +261,10 @@
|
|||||||
[self.delegate coreDriverIsRequestingAbortUpdateWithError:error];
|
[self.delegate coreDriverIsRequestingAbortUpdateWithError:error];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)installerDidStartInstalling
|
- (void)installerDidStartInstallingWithApplicationTerminated:(BOOL)applicationTerminated
|
||||||
{
|
{
|
||||||
if ([self.delegate respondsToSelector:@selector(installerDidStartInstalling)]) {
|
if ([self.delegate respondsToSelector:@selector(installerDidStartInstallingWithApplicationTerminated:)]) {
|
||||||
[self.delegate installerDidStartInstalling];
|
[self.delegate installerDidStartInstallingWithApplicationTerminated:applicationTerminated];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -324,14 +324,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
|
- (void)installerIsRequestingAbortInstallWithError:(nullable NSError *)error
|
||||||
{
|
{
|
||||||
[self.delegate coreDriverIsRequestingAbortUpdateWithError:error];
|
[self.delegate coreDriverIsRequestingAbortUpdateWithError:error];
|
||||||
|
|||||||
Vendored
+1
-2
@@ -15,11 +15,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@protocol SPUInstallerDriverDelegate <NSObject>
|
@protocol SPUInstallerDriverDelegate <NSObject>
|
||||||
|
|
||||||
- (void)installerDidStartInstalling;
|
- (void)installerDidStartInstallingWithApplicationTerminated:(BOOL)applicationTerminated;
|
||||||
- (void)installerDidStartExtracting;
|
- (void)installerDidStartExtracting;
|
||||||
- (void)installerDidExtractUpdateWithProgress:(double)progress;
|
- (void)installerDidExtractUpdateWithProgress:(double)progress;
|
||||||
- (void)installerDidFinishPreparationAndWillInstallImmediately:(BOOL)willInstallImmediately silently:(BOOL)willInstallSilently;
|
- (void)installerDidFinishPreparationAndWillInstallImmediately:(BOOL)willInstallImmediately silently:(BOOL)willInstallSilently;
|
||||||
- (void)installerIsSendingAppTerminationSignal;
|
|
||||||
- (void)installerWillFinishInstallationAndRelaunch:(BOOL)relaunch;
|
- (void)installerWillFinishInstallationAndRelaunch:(BOOL)relaunch;
|
||||||
- (void)installerDidFinishInstallationAndRelaunched:(BOOL)relaunch acknowledgement:(void(^)(void))acknowledgement;
|
- (void)installerDidFinishInstallationAndRelaunched:(BOOL)relaunch acknowledgement:(void(^)(void))acknowledgement;
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-14
@@ -43,7 +43,6 @@
|
|||||||
@property (nonatomic, readonly) NSBundle *applicationBundle;
|
@property (nonatomic, readonly) NSBundle *applicationBundle;
|
||||||
@property (nonatomic, weak, readonly) id<SPUInstallerDriverDelegate> delegate;
|
@property (nonatomic, weak, readonly) id<SPUInstallerDriverDelegate> delegate;
|
||||||
@property (nonatomic) SPUInstallerMessageType currentStage;
|
@property (nonatomic) SPUInstallerMessageType currentStage;
|
||||||
@property (nonatomic) BOOL startedInstalling;
|
|
||||||
|
|
||||||
@property (nonatomic) id<SUInstallerConnectionProtocol> installerConnection;
|
@property (nonatomic) id<SUInstallerConnectionProtocol> installerConnection;
|
||||||
|
|
||||||
@@ -70,7 +69,6 @@
|
|||||||
@synthesize applicationBundle = _applicationBundle;
|
@synthesize applicationBundle = _applicationBundle;
|
||||||
@synthesize delegate = _delegate;
|
@synthesize delegate = _delegate;
|
||||||
@synthesize currentStage = _currentStage;
|
@synthesize currentStage = _currentStage;
|
||||||
@synthesize startedInstalling = _startedInstalling;
|
|
||||||
@synthesize installerConnection = _installerConnection;
|
@synthesize installerConnection = _installerConnection;
|
||||||
@synthesize extractionAttempts = _extractionAttempts;
|
@synthesize extractionAttempts = _extractionAttempts;
|
||||||
@synthesize postponedOnce = _postponedOnce;
|
@synthesize postponedOnce = _postponedOnce;
|
||||||
@@ -278,9 +276,6 @@
|
|||||||
self.currentStage = identifier;
|
self.currentStage = identifier;
|
||||||
} else if (identifier == SPUInstallationStartedStage1) {
|
} else if (identifier == SPUInstallationStartedStage1) {
|
||||||
self.currentStage = identifier;
|
self.currentStage = identifier;
|
||||||
[self.delegate installerDidStartInstalling];
|
|
||||||
self.startedInstalling = YES;
|
|
||||||
|
|
||||||
} else if (identifier == SPUInstallationFinishedStage1) {
|
} else if (identifier == SPUInstallationFinishedStage1) {
|
||||||
self.currentStage = identifier;
|
self.currentStage = identifier;
|
||||||
|
|
||||||
@@ -308,12 +303,6 @@
|
|||||||
} else if (identifier == SPUInstallationFinishedStage2) {
|
} else if (identifier == SPUInstallationFinishedStage2) {
|
||||||
self.currentStage = identifier;
|
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;
|
BOOL hasTargetTerminated = NO;
|
||||||
if (data.length >= sizeof(uint8_t)) {
|
if (data.length >= sizeof(uint8_t)) {
|
||||||
hasTargetTerminated = (BOOL)*((const uint8_t *)data.bytes);
|
hasTargetTerminated = (BOOL)*((const uint8_t *)data.bytes);
|
||||||
@@ -321,9 +310,7 @@
|
|||||||
|
|
||||||
[self.delegate installerWillFinishInstallationAndRelaunch:self.relaunch];
|
[self.delegate installerWillFinishInstallationAndRelaunch:self.relaunch];
|
||||||
|
|
||||||
if (!hasTargetTerminated) {
|
[self.delegate installerDidStartInstallingWithApplicationTerminated:hasTargetTerminated];
|
||||||
[self.delegate installerIsSendingAppTerminationSignal];
|
|
||||||
}
|
|
||||||
} else if (identifier == SPUInstallationFinishedStage3) {
|
} else if (identifier == SPUInstallationFinishedStage3) {
|
||||||
self.currentStage = identifier;
|
self.currentStage = identifier;
|
||||||
|
|
||||||
|
|||||||
Vendored
+47
-22
@@ -16,33 +16,58 @@ static NSString *SURootObjectArchiveKey = @"SURootObjectArchive";
|
|||||||
|
|
||||||
NSData * _Nullable SPUArchiveRootObjectSecurely(id<NSSecureCoding> rootObject)
|
NSData * _Nullable SPUArchiveRootObjectSecurely(id<NSSecureCoding> rootObject)
|
||||||
{
|
{
|
||||||
NSMutableData *data = [NSMutableData data];
|
if (@available(macOS 10.13, *)) {
|
||||||
NSKeyedArchiver *keyedArchiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data];
|
NSError *error = nil;
|
||||||
keyedArchiver.requiresSecureCoding = YES;
|
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:rootObject requiringSecureCoding:YES error:&error];
|
||||||
|
if (data == nil) {
|
||||||
@try {
|
SULog(SULogLevelError, @"Error while securely archiving object: %@", error);
|
||||||
[keyedArchiver encodeObject:rootObject forKey:SURootObjectArchiveKey];
|
}
|
||||||
[keyedArchiver finishEncoding];
|
return data;
|
||||||
return [data copy];
|
} else {
|
||||||
} @catch (NSException *exception) {
|
NSMutableData *data = [NSMutableData data];
|
||||||
SULog(SULogLevelError, @"Exception while securely archiving object: %@", exception);
|
|
||||||
[keyedArchiver finishEncoding];
|
#pragma clang diagnostic push
|
||||||
return nil;
|
#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)
|
id<NSSecureCoding> _Nullable SPUUnarchiveRootObjectSecurely(NSData *data, Class klass)
|
||||||
{
|
{
|
||||||
NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:data];
|
if (@available(macOS 10.13, *)) {
|
||||||
unarchiver.requiresSecureCoding = YES;
|
NSError *error = nil;
|
||||||
|
id<NSSecureCoding> rootObject = [NSKeyedUnarchiver unarchivedObjectOfClass:klass fromData:data error:&error];
|
||||||
@try {
|
if (rootObject == nil) {
|
||||||
id<NSSecureCoding> rootObject = [unarchiver decodeObjectOfClass:klass forKey:SURootObjectArchiveKey];
|
SULog(SULogLevelError, @"Error while securely unarchiving object: %@", error);
|
||||||
[unarchiver finishDecoding];
|
}
|
||||||
return rootObject;
|
return rootObject;
|
||||||
} @catch (NSException *exception) {
|
} else {
|
||||||
SULog(SULogLevelError, @"Exception while securely unarchiving object: %@", exception);
|
#pragma clang diagnostic push
|
||||||
[unarchiver finishDecoding];
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
return nil;
|
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;
|
+ (void)skipUpdate:(SUAppcastItem *)updateItem host:(SUHost *)host;
|
||||||
|
|
||||||
// At least one of minorVersion or majorVersion should be non-nil
|
// 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 *minorVersion;
|
||||||
@property (nonatomic, readonly, nullable) NSString *majorVersion;
|
@property (nonatomic, readonly, nullable) NSString *majorVersion;
|
||||||
|
|
||||||
|
@property (nonatomic, readonly, nullable) NSString *majorSubreleaseVersion;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
Vendored
+9
-3
@@ -18,13 +18,15 @@
|
|||||||
|
|
||||||
@synthesize minorVersion = _minorVersion;
|
@synthesize minorVersion = _minorVersion;
|
||||||
@synthesize majorVersion = _majorVersion;
|
@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];
|
self = [super init];
|
||||||
if (self != nil) {
|
if (self != nil) {
|
||||||
_minorVersion = [minorVersion copy];
|
_minorVersion = [minorVersion copy];
|
||||||
_majorVersion = [majorVersion copy];
|
_majorVersion = [majorVersion copy];
|
||||||
|
_majorSubreleaseVersion = [majorSubreleaseVersion copy];
|
||||||
|
|
||||||
assert(_minorVersion != nil || _majorVersion != nil);
|
assert(_minorVersion != nil || _majorVersion != nil);
|
||||||
}
|
}
|
||||||
@@ -35,9 +37,10 @@
|
|||||||
{
|
{
|
||||||
NSString *minorVersion = [host objectForUserDefaultsKey:SUSkippedMinorVersionKey];
|
NSString *minorVersion = [host objectForUserDefaultsKey:SUSkippedMinorVersionKey];
|
||||||
NSString *majorVersion = [host objectForUserDefaultsKey:SUSkippedMajorVersionKey];
|
NSString *majorVersion = [host objectForUserDefaultsKey:SUSkippedMajorVersionKey];
|
||||||
|
NSString *majorSubreleaseVersion = [host objectForUserDefaultsKey:SUSkippedMajorSubreleaseVersionKey];
|
||||||
|
|
||||||
if (minorVersion != nil || majorVersion != nil) {
|
if (minorVersion != nil || majorVersion != nil) {
|
||||||
return [[SPUSkippedUpdate alloc] initWithMinorVersion:minorVersion majorVersion:majorVersion];
|
return [[SPUSkippedUpdate alloc] initWithMinorVersion:minorVersion majorVersion:majorVersion majorSubreleaseVersion:majorSubreleaseVersion];
|
||||||
} else {
|
} else {
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
@@ -47,17 +50,20 @@
|
|||||||
{
|
{
|
||||||
[host setObject:nil forUserDefaultsKey:SUSkippedMinorVersionKey];
|
[host setObject:nil forUserDefaultsKey:SUSkippedMinorVersionKey];
|
||||||
[host setObject:nil forUserDefaultsKey:SUSkippedMajorVersionKey];
|
[host setObject:nil forUserDefaultsKey:SUSkippedMajorVersionKey];
|
||||||
|
[host setObject:nil forUserDefaultsKey:SUSkippedMajorSubreleaseVersionKey];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (void)skipUpdate:(SUAppcastItem *)updateItem host:(SUHost *)host
|
+ (void)skipUpdate:(SUAppcastItem *)updateItem host:(SUHost *)host
|
||||||
{
|
{
|
||||||
|
NSString *version = updateItem.versionString;
|
||||||
|
|
||||||
if (updateItem.majorUpgrade) {
|
if (updateItem.majorUpgrade) {
|
||||||
NSString *majorVersion = updateItem.minimumAutoupdateVersion;
|
NSString *majorVersion = updateItem.minimumAutoupdateVersion;
|
||||||
assert(majorVersion != nil);
|
assert(majorVersion != nil);
|
||||||
|
|
||||||
[host setObject:majorVersion forUserDefaultsKey:SUSkippedMajorVersionKey];
|
[host setObject:majorVersion forUserDefaultsKey:SUSkippedMajorVersionKey];
|
||||||
|
[host setObject:version forUserDefaultsKey:SUSkippedMajorSubreleaseVersionKey];
|
||||||
} else {
|
} else {
|
||||||
NSString *version = updateItem.versionString;
|
|
||||||
[host setObject:version forUserDefaultsKey:SUSkippedMinorVersionKey];
|
[host setObject:version forUserDefaultsKey:SUSkippedMinorVersionKey];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+36
-30
@@ -42,6 +42,9 @@
|
|||||||
@property (nonatomic) SUStatusController *statusController;
|
@property (nonatomic) SUStatusController *statusController;
|
||||||
@property (nonatomic) SUUpdatePermissionPrompt *permissionPrompt;
|
@property (nonatomic) SUUpdatePermissionPrompt *permissionPrompt;
|
||||||
|
|
||||||
|
@property (nonatomic) uint64_t expectedContentLength;
|
||||||
|
@property (nonatomic) uint64_t bytesDownloaded;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation SPUStandardUserDriver
|
@implementation SPUStandardUserDriver
|
||||||
@@ -56,6 +59,8 @@
|
|||||||
@synthesize activeUpdateAlert = _activeUpdateAlert;
|
@synthesize activeUpdateAlert = _activeUpdateAlert;
|
||||||
@synthesize statusController = _statusController;
|
@synthesize statusController = _statusController;
|
||||||
@synthesize permissionPrompt = _permissionPrompt;
|
@synthesize permissionPrompt = _permissionPrompt;
|
||||||
|
@synthesize expectedContentLength = _expectedContentLength;
|
||||||
|
@synthesize bytesDownloaded = _bytesDownloaded;
|
||||||
|
|
||||||
#pragma mark Birth
|
#pragma mark Birth
|
||||||
|
|
||||||
@@ -366,8 +371,12 @@
|
|||||||
self.cancellation = cancellation;
|
self.cancellation = cancellation;
|
||||||
|
|
||||||
[self createAndShowStatusController];
|
[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.statusController setButtonTitle:SULocalizedString(@"Cancel", nil) target:self action:@selector(cancelDownload:) isDefault:NO];
|
||||||
|
|
||||||
|
self.bytesDownloaded = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)cancelDownload:(id)__unused sender
|
- (void)cancelDownload:(id)__unused sender
|
||||||
@@ -382,7 +391,10 @@
|
|||||||
{
|
{
|
||||||
assert(NSThread.isMainThread);
|
assert(NSThread.isMainThread);
|
||||||
|
|
||||||
[self.statusController setMaxProgressValue:expectedContentLength];
|
self.expectedContentLength = expectedContentLength;
|
||||||
|
if (expectedContentLength == 0) {
|
||||||
|
[self.statusController setMaxProgressValue:0.0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSString *)localizedStringFromByteCount:(long long)value
|
- (NSString *)localizedStringFromByteCount:(long long)value
|
||||||
@@ -419,18 +431,17 @@
|
|||||||
{
|
{
|
||||||
assert(NSThread.isMainThread);
|
assert(NSThread.isMainThread);
|
||||||
|
|
||||||
double newProgressValue = [self.statusController progressValue] + (double)length;
|
self.bytesDownloaded += length;
|
||||||
|
|
||||||
// In case our expected content length was incorrect
|
if (self.expectedContentLength > 0.0) {
|
||||||
if (newProgressValue > [self.statusController maxProgressValue]) {
|
double newProgressValue = (double)self.bytesDownloaded / (double)self.expectedContentLength;
|
||||||
[self.statusController setMaxProgressValue:newProgressValue];
|
|
||||||
|
[self.statusController setProgressValue:MIN(newProgressValue, 1.0)];
|
||||||
|
|
||||||
|
[self.statusController setStatusText:[NSString stringWithFormat:SULocalizedString(@"%@ of %@", nil), [self localizedStringFromByteCount:(long long)self.bytesDownloaded], [self localizedStringFromByteCount:(long long)MAX(self.bytesDownloaded, self.expectedContentLength)]]];
|
||||||
|
} else {
|
||||||
|
[self.statusController setStatusText:[NSString stringWithFormat:SULocalizedString(@"%@ downloaded", nil), [self localizedStringFromByteCount:(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
|
- (void)showDownloadDidStartExtractingUpdate
|
||||||
@@ -440,7 +451,8 @@
|
|||||||
self.cancellation = nil;
|
self.cancellation = nil;
|
||||||
|
|
||||||
[self createAndShowStatusController];
|
[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 setButtonTitle:SULocalizedString(@"Cancel", nil) target:nil action:nil isDefault:NO];
|
||||||
[self.statusController setButtonEnabled:NO];
|
[self.statusController setButtonEnabled:NO];
|
||||||
}
|
}
|
||||||
@@ -449,18 +461,23 @@
|
|||||||
{
|
{
|
||||||
assert(NSThread.isMainThread);
|
assert(NSThread.isMainThread);
|
||||||
|
|
||||||
if ([self.statusController maxProgressValue] == 0.0) {
|
|
||||||
[self.statusController setMaxProgressValue:1];
|
|
||||||
}
|
|
||||||
[self.statusController setProgressValue:progress];
|
[self.statusController setProgressValue:progress];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)showInstallingUpdate
|
- (void)showInstallingUpdateWithApplicationTerminated:(BOOL)applicationTerminated
|
||||||
{
|
{
|
||||||
assert(NSThread.isMainThread);
|
assert(NSThread.isMainThread);
|
||||||
|
|
||||||
[self.statusController beginActionWithTitle:SULocalizedString(@"Installing update...", @"Take care not to overflow the status window.") maxProgressValue:0.0 statusText:nil];
|
if (applicationTerminated) {
|
||||||
[self.statusController setButtonEnabled:NO];
|
[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
|
- (void)showUpdateInstalledAndRelaunched:(BOOL)relaunched acknowledgement:(void (^)(void))acknowledgement
|
||||||
@@ -504,17 +521,6 @@
|
|||||||
|
|
||||||
#pragma mark Aborting Everything
|
#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
|
- (void)dismissUpdateInstallation
|
||||||
{
|
{
|
||||||
assert(NSThread.isMainThread);
|
assert(NSThread.isMainThread);
|
||||||
|
|||||||
Vendored
+17
-7
@@ -310,9 +310,24 @@
|
|||||||
[self.userDriver showDownloadDidStartExtractingUpdate];
|
[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
|
- (void)installerDidExtractUpdateWithProgress:(double)progress
|
||||||
@@ -331,11 +346,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)installerIsSendingAppTerminationSignal
|
|
||||||
{
|
|
||||||
[self.userDriver showSendingTerminationSignal];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)installerDidFinishInstallationAndRelaunched:(BOOL)relaunched acknowledgement:(void(^)(void))acknowledgement
|
- (void)installerDidFinishInstallationAndRelaunched:(BOOL)relaunched acknowledgement:(void(^)(void))acknowledgement
|
||||||
{
|
{
|
||||||
if ([self.userDriver respondsToSelector:@selector(showUpdateInstalledAndRelaunched:acknowledgement:)]) {
|
if ([self.userDriver respondsToSelector:@selector(showUpdateInstalledAndRelaunched:acknowledgement:)]) {
|
||||||
|
|||||||
Vendored
+1
@@ -177,6 +177,7 @@ SU_EXPORT @interface SPUUpdater : NSObject
|
|||||||
this permission request is not performed however.
|
this permission request is not performed however.
|
||||||
|
|
||||||
Setting this property will persist in the host bundle's user defaults.
|
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.
|
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
|
This is to allow reverting this property without kicking off a schedule change immediately
|
||||||
|
|||||||
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.
|
* 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.
|
* 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.
|
* 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.
|
* @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;
|
- (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
|
* 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.
|
* 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.
|
* @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;
|
- (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,
|
* Let the user know that the update is currently installing.
|
||||||
* 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.
|
|
||||||
*
|
*
|
||||||
* It is up to the implementor whether or not to decide to continue showing installation progress
|
* Before this point, `-showReadyToInstallAndRelaunch:` or `-showUpdateFoundWithAppcastItem:state:reply:` will be called.
|
||||||
* or dismissing UI that won't remain obscuring other parts of the user interface.
|
|
||||||
*
|
*
|
||||||
* 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
|
* 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 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.
|
* 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 relaunched Indicates if the update was relaunched.
|
||||||
* @param acknowledgement Acknowledge to the updater that the finished installation was shown.
|
* @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)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
|
@end
|
||||||
|
|
||||||
|
|||||||
Vendored
+7
-1
@@ -159,11 +159,17 @@
|
|||||||
NSMutableSet *informationalUpdateVersions = [NSMutableSet set];
|
NSMutableSet *informationalUpdateVersions = [NSMutableSet set];
|
||||||
NSEnumerator *childEnum = [[node children] objectEnumerator];
|
NSEnumerator *childEnum = [[node children] objectEnumerator];
|
||||||
for (NSXMLNode *child in childEnum) {
|
for (NSXMLNode *child in childEnum) {
|
||||||
if ([child.name isEqualToString:SUAppcastAttributeVersion]) {
|
if ([child.name isEqualToString:SUAppcastElementVersion]) {
|
||||||
NSString *version = child.stringValue;
|
NSString *version = child.stringValue;
|
||||||
if (version != nil) {
|
if (version != nil) {
|
||||||
[informationalUpdateVersions addObject:version];
|
[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];
|
[dict setObject:[informationalUpdateVersions copy] forKey:name];
|
||||||
|
|||||||
Vendored
+5
-3
@@ -334,10 +334,12 @@
|
|||||||
+ (BOOL)item:(SUAppcastItem *)ui containsSkippedUpdate:(SPUSkippedUpdate * _Nullable)skippedUpdate hostPassesSkippedMajorVersion:(BOOL)hostPassesSkippedMajorVersion versionComparator:(id<SUVersionComparison>)versionComparator
|
+ (BOOL)item:(SUAppcastItem *)ui containsSkippedUpdate:(SPUSkippedUpdate * _Nullable)skippedUpdate hostPassesSkippedMajorVersion:(BOOL)hostPassesSkippedMajorVersion versionComparator:(id<SUVersionComparison>)versionComparator
|
||||||
{
|
{
|
||||||
NSString *skippedMajorVersion = skippedUpdate.majorVersion;
|
NSString *skippedMajorVersion = skippedUpdate.majorVersion;
|
||||||
|
NSString *skippedMajorSubreleaseVersion = skippedUpdate.majorSubreleaseVersion;
|
||||||
|
|
||||||
if (!hostPassesSkippedMajorVersion && skippedMajorVersion != nil && [versionComparator compareVersion:skippedMajorVersion toVersion:ui.versionString] != NSOrderedDescending) {
|
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))) {
|
||||||
// Item is on a greater or equal version than a major version we've skipped
|
// If skipped major version is >= than the item's minimumAutoupdateVersion, we can skip the item.
|
||||||
// So we skip this 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;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+16
-1
@@ -265,9 +265,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`.
|
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 version string corresponds to the application's @c CFBundleVersion
|
||||||
|
|
||||||
|
This is extracted from the @c <sparkle:minimumAutoupdateVersion> element.
|
||||||
*/
|
*/
|
||||||
@property (copy, readonly, nullable) NSString *minimumAutoupdateVersion;
|
@property (copy, readonly, nullable) NSString *minimumAutoupdateVersion;
|
||||||
|
|
||||||
@@ -278,6 +280,19 @@ SU_EXPORT @interface SUAppcastItem : NSObject<NSSecureCoding>
|
|||||||
*/
|
*/
|
||||||
@property (getter=isMajorUpgrade, readonly) BOOL majorUpgrade;
|
@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.
|
Indicates whether or not the update item is critical.
|
||||||
|
|
||||||
|
|||||||
Vendored
+8
@@ -73,6 +73,7 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState";
|
|||||||
@synthesize propertiesDictionary = _propertiesDictionary;
|
@synthesize propertiesDictionary = _propertiesDictionary;
|
||||||
@synthesize installationType = _installationType;
|
@synthesize installationType = _installationType;
|
||||||
@synthesize minimumAutoupdateVersion = _minimumAutoupdateVersion;
|
@synthesize minimumAutoupdateVersion = _minimumAutoupdateVersion;
|
||||||
|
@synthesize ignoreSkippedUpgradesBelowVersion = _ignoreSkippedUpgradesBelowVersion;
|
||||||
@synthesize phasedRolloutInterval = _phasedRolloutInterval;
|
@synthesize phasedRolloutInterval = _phasedRolloutInterval;
|
||||||
@synthesize state = _state;
|
@synthesize state = _state;
|
||||||
@synthesize hasCriticalInformation = _hasCriticalInformation;
|
@synthesize hasCriticalInformation = _hasCriticalInformation;
|
||||||
@@ -115,6 +116,7 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState";
|
|||||||
_maximumSystemVersion = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemMaximumSystemVersionKey] copy];
|
_maximumSystemVersion = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemMaximumSystemVersionKey] copy];
|
||||||
_minimumSystemVersion = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemMinimumSystemVersionKey] copy];
|
_minimumSystemVersion = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemMinimumSystemVersionKey] copy];
|
||||||
_minimumAutoupdateVersion = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastElementMinimumAutoupdateVersion] 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];
|
_releaseNotesURL = [decoder decodeObjectOfClass:[NSURL class] forKey:SUAppcastItemReleaseNotesURLKey];
|
||||||
_fullReleaseNotesURL = [decoder decodeObjectOfClass:[NSURL class] forKey:SUAppcastItemFullReleaseNotesURLKey];
|
_fullReleaseNotesURL = [decoder decodeObjectOfClass:[NSURL class] forKey:SUAppcastItemFullReleaseNotesURLKey];
|
||||||
_title = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemTitleKey] copy];
|
_title = [(NSString *)[decoder decodeObjectOfClass:[NSString class] forKey:SUAppcastItemTitleKey] copy];
|
||||||
@@ -183,6 +185,10 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState";
|
|||||||
[encoder encodeObject:self.minimumAutoupdateVersion forKey:SUAppcastElementMinimumAutoupdateVersion];
|
[encoder encodeObject:self.minimumAutoupdateVersion forKey:SUAppcastElementMinimumAutoupdateVersion];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (self.ignoreSkippedUpgradesBelowVersion != nil) {
|
||||||
|
[encoder encodeObject:self.ignoreSkippedUpgradesBelowVersion forKey:SUAppcastElementIgnoreSkippedUpgradesBelowVersion];
|
||||||
|
}
|
||||||
|
|
||||||
if (self.state != nil) {
|
if (self.state != nil) {
|
||||||
[encoder encodeObject:self.state forKey:SUAppcastItemStateKey];
|
[encoder encodeObject:self.state forKey:SUAppcastItemStateKey];
|
||||||
}
|
}
|
||||||
@@ -463,6 +469,8 @@ static NSString *SUAppcastItemStateKey = @"SUAppcastItemState";
|
|||||||
_maximumSystemVersion = [(NSString *)[dict objectForKey:SUAppcastElementMaximumSystemVersion] copy];
|
_maximumSystemVersion = [(NSString *)[dict objectForKey:SUAppcastElementMaximumSystemVersion] copy];
|
||||||
_minimumAutoupdateVersion = [(NSString *)[dict objectForKey:SUAppcastElementMinimumAutoupdateVersion] copy];
|
_minimumAutoupdateVersion = [(NSString *)[dict objectForKey:SUAppcastElementMinimumAutoupdateVersion] copy];
|
||||||
|
|
||||||
|
_ignoreSkippedUpgradesBelowVersion = [(NSString *)[dict objectForKey:SUAppcastElementIgnoreSkippedUpgradesBelowVersion] copy];
|
||||||
|
|
||||||
NSString *channel = [dict objectForKey:SUAppcastElementChannel];
|
NSString *channel = [dict objectForKey:SUAppcastElementChannel];
|
||||||
if (channel != nil) {
|
if (channel != nil) {
|
||||||
if (channel.length == 0) {
|
if (channel.length == 0) {
|
||||||
|
|||||||
Vendored
+3
@@ -42,6 +42,7 @@ extern NSString *const SURelaunchHostBundleKey;
|
|||||||
extern NSString *const SUShowReleaseNotesKey;
|
extern NSString *const SUShowReleaseNotesKey;
|
||||||
extern NSString *const SUSkippedMinorVersionKey;
|
extern NSString *const SUSkippedMinorVersionKey;
|
||||||
extern NSString *const SUSkippedMajorVersionKey;
|
extern NSString *const SUSkippedMajorVersionKey;
|
||||||
|
extern NSString *const SUSkippedMajorSubreleaseVersionKey;
|
||||||
extern NSString *const SUScheduledCheckIntervalKey;
|
extern NSString *const SUScheduledCheckIntervalKey;
|
||||||
extern NSString *const SULastCheckTimeKey;
|
extern NSString *const SULastCheckTimeKey;
|
||||||
extern NSString *const SUExpectsDSASignatureKey;
|
extern NSString *const SUExpectsDSASignatureKey;
|
||||||
@@ -94,6 +95,8 @@ extern NSString *const SUAppcastElementTags;
|
|||||||
extern NSString *const SUAppcastElementPhasedRolloutInterval;
|
extern NSString *const SUAppcastElementPhasedRolloutInterval;
|
||||||
extern NSString *const SUAppcastElementInformationalUpdate;
|
extern NSString *const SUAppcastElementInformationalUpdate;
|
||||||
extern NSString *const SUAppcastElementChannel;
|
extern NSString *const SUAppcastElementChannel;
|
||||||
|
extern NSString *const SUAppcastElementBelowVersion;
|
||||||
|
extern NSString *const SUAppcastElementIgnoreSkippedUpgradesBelowVersion;
|
||||||
|
|
||||||
extern NSString *const SURSSAttributeURL;
|
extern NSString *const SURSSAttributeURL;
|
||||||
extern NSString *const SURSSAttributeLength;
|
extern NSString *const SURSSAttributeLength;
|
||||||
|
|||||||
Vendored
+3
@@ -38,6 +38,7 @@ NSString *const SURelaunchHostBundleKey = @"SURelaunchHostBundle";
|
|||||||
NSString *const SUShowReleaseNotesKey = @"SUShowReleaseNotes";
|
NSString *const SUShowReleaseNotesKey = @"SUShowReleaseNotes";
|
||||||
NSString *const SUSkippedMinorVersionKey = @"SUSkippedVersion";
|
NSString *const SUSkippedMinorVersionKey = @"SUSkippedVersion";
|
||||||
NSString *const SUSkippedMajorVersionKey = @"SUSkippedMajorVersion";
|
NSString *const SUSkippedMajorVersionKey = @"SUSkippedMajorVersion";
|
||||||
|
NSString *const SUSkippedMajorSubreleaseVersionKey = @"SUSkippedMajorSubreleaseVersion";
|
||||||
NSString *const SUScheduledCheckIntervalKey = @"SUScheduledCheckInterval";
|
NSString *const SUScheduledCheckIntervalKey = @"SUScheduledCheckInterval";
|
||||||
NSString *const SULastCheckTimeKey = @"SULastCheckTime";
|
NSString *const SULastCheckTimeKey = @"SULastCheckTime";
|
||||||
NSString *const SUExpectsDSASignatureKey = @"SUExpectsDSASignature";
|
NSString *const SUExpectsDSASignatureKey = @"SUExpectsDSASignature";
|
||||||
@@ -91,6 +92,8 @@ NSString *const SUAppcastElementTags = @"sparkle:tags";
|
|||||||
NSString *const SUAppcastElementPhasedRolloutInterval = @"sparkle:phasedRolloutInterval";
|
NSString *const SUAppcastElementPhasedRolloutInterval = @"sparkle:phasedRolloutInterval";
|
||||||
NSString *const SUAppcastElementInformationalUpdate = @"sparkle:informationalUpdate";
|
NSString *const SUAppcastElementInformationalUpdate = @"sparkle:informationalUpdate";
|
||||||
NSString *const SUAppcastElementChannel = @"sparkle:channel";
|
NSString *const SUAppcastElementChannel = @"sparkle:channel";
|
||||||
|
NSString *const SUAppcastElementBelowVersion = @"sparkle:belowVersion";
|
||||||
|
NSString *const SUAppcastElementIgnoreSkippedUpgradesBelowVersion = @"sparkle:ignoreSkippedUpgradesBelowVersion";
|
||||||
|
|
||||||
NSString *const SURSSAttributeURL = @"url";
|
NSString *const SURSSAttributeURL = @"url";
|
||||||
NSString *const SURSSAttributeLength = @"length";
|
NSString *const SURSSAttributeLength = @"length";
|
||||||
|
|||||||
Vendored
+9
-106
@@ -21,29 +21,6 @@ extern int renamex_np(const char *, const char *, unsigned int) __attribute__((w
|
|||||||
|
|
||||||
static char SUAppleQuarantineIdentifier[] = "com.apple.quarantine";
|
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
|
#pragma clang diagnostic push
|
||||||
// Use direct access because it's easier, clearer, and faster
|
// Use direct access because it's easier, clearer, and faster
|
||||||
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
|
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
|
||||||
@@ -184,89 +161,15 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
|
|||||||
return success;
|
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
|
- (BOOL)copyItemAtURL:(NSURL *)sourceURL toURL:(NSURL *)destinationURL error:(NSError * __autoreleasing *)error
|
||||||
{
|
{
|
||||||
if (![self _itemExistsAtURL:sourceURL]) {
|
return [_fileManager copyItemAtURL:sourceURL toURL:destinationURL error:error];
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
- (BOOL)_getVolumeID:(out id _Nullable __autoreleasing * _Nonnull)outVolumeIdentifier ofItemAtURL:(NSURL *)url
|
||||||
* 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
|
|
||||||
{
|
{
|
||||||
FSRef pathRef;
|
NSError *error = nil;
|
||||||
if (!SUMakeRefFromURL(url, &pathRef, NULL)) {
|
return [url getResourceValue:outVolumeIdentifier forKey:NSURLVolumeIdentifierKey error:&error];
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)moveItemAtURL:(NSURL *)sourceURL toURL:(NSURL *)destinationURL error:(NSError *__autoreleasing *)error
|
- (BOOL)moveItemAtURL:(NSURL *)sourceURL toURL:(NSURL *)destinationURL error:(NSError *__autoreleasing *)error
|
||||||
@@ -298,13 +201,13 @@ static BOOL SUMakeRefFromURL(NSURL *url, FSRef *ref, NSError **error) {
|
|||||||
// one network mount to another one. This is possibly related to the fact that
|
// 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
|
// moving a file will try to preserve ownership but copying won't
|
||||||
|
|
||||||
FSVolumeRefNum sourceVolume = 0;
|
id sourceVolumeIdentifier = nil;
|
||||||
BOOL foundSourceVolume = [self _getVolumeID:&sourceVolume ofItemAtURL:sourceURL];
|
BOOL foundSourceVolume = [self _getVolumeID:&sourceVolumeIdentifier ofItemAtURL:sourceURL];
|
||||||
|
|
||||||
FSVolumeRefNum destinationVolume = 0;
|
id destinationVolumeIdentifier = nil;
|
||||||
BOOL foundDestinationVolume = [self _getVolumeID:&destinationVolume ofItemAtURL:destinationURLParent];
|
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 ([self copyItemAtURL:sourceURL toURL:destinationURL error:error] && [self removeItemAtURL:sourceURL error:error]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+5
@@ -13,6 +13,9 @@
|
|||||||
#import "SULog.h"
|
#import "SULog.h"
|
||||||
#import <WebKit/WebKit.h>
|
#import <WebKit/WebKit.h>
|
||||||
|
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
|
||||||
@interface SULegacyWebView () <WebPolicyDelegate, WebFrameLoadDelegate, WebUIDelegate>
|
@interface SULegacyWebView () <WebPolicyDelegate, WebFrameLoadDelegate, WebUIDelegate>
|
||||||
|
|
||||||
@property (nonatomic, readonly) WebView *webView;
|
@property (nonatomic, readonly) WebView *webView;
|
||||||
@@ -163,4 +166,6 @@
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Vendored
+19
@@ -65,7 +65,10 @@ void SULog(SULogLevel level, NSString *format, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NSString *displayName = [[NSFileManager defaultManager] displayNameAtPath:mainBundle.bundlePath];
|
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);
|
client = asl_open([displayName stringByAppendingString:@" [Sparkle]"].UTF8String, SPARKLE_BUNDLE_IDENTIFIER, options);
|
||||||
|
#pragma clang diagnostic pop
|
||||||
queue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL);
|
queue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -103,13 +106,20 @@ void SULog(SULogLevel level, NSString *format, ...)
|
|||||||
|
|
||||||
// Otherwise use ASL
|
// Otherwise use ASL
|
||||||
// Make sure we do not async, because if we async, the log may not be delivered deterministically
|
// 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, ^{
|
dispatch_sync(queue, ^{
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
aslmsg message = asl_new(ASL_TYPE_MSG);
|
aslmsg message = asl_new(ASL_TYPE_MSG);
|
||||||
|
#pragma clang diagnostic pop
|
||||||
if (message == NULL) {
|
if (message == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
if (asl_set(message, ASL_KEY_MSG, logMessage.UTF8String) != 0) {
|
if (asl_set(message, ASL_KEY_MSG, logMessage.UTF8String) != 0) {
|
||||||
|
#pragma clang diagnostic pop
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,16 +127,25 @@ void SULog(SULogLevel level, NSString *format, ...)
|
|||||||
switch (level) {
|
switch (level) {
|
||||||
case SULogLevelDefault:
|
case SULogLevelDefault:
|
||||||
// Just use one level below the error level
|
// 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));
|
levelSetResult = asl_set(message, ASL_KEY_LEVEL, TO_STRING(ASL_LEVEL_WARNING));
|
||||||
|
#pragma clang diagnostic pop
|
||||||
break;
|
break;
|
||||||
case SULogLevelError:
|
case SULogLevelError:
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
levelSetResult = asl_set(message, ASL_KEY_LEVEL, TO_STRING(ASL_LEVEL_ERR));
|
levelSetResult = asl_set(message, ASL_KEY_LEVEL, TO_STRING(ASL_LEVEL_ERR));
|
||||||
|
#pragma clang diagnostic pop
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (levelSetResult != 0) {
|
if (levelSetResult != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
asl_send(client, message);
|
asl_send(client, message);
|
||||||
|
#pragma clang diagnostic pop
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
+105
-10
@@ -32,34 +32,75 @@
|
|||||||
typedef NS_ENUM(NSInteger, SUCharacterType) {
|
typedef NS_ENUM(NSInteger, SUCharacterType) {
|
||||||
kNumberType,
|
kNumberType,
|
||||||
kStringType,
|
kStringType,
|
||||||
kSeparatorType,
|
kPeriodSeparatorType,
|
||||||
|
kPunctuationSeparatorType,
|
||||||
|
kWhitespaceSeparatorType,
|
||||||
kDashType,
|
kDashType,
|
||||||
};
|
};
|
||||||
|
|
||||||
- (SUCharacterType)typeOfCharacter:(NSString *)character
|
- (SUCharacterType)typeOfCharacter:(NSString *)character
|
||||||
{
|
{
|
||||||
if ([character isEqualToString:@"."]) {
|
if ([character isEqualToString:@"."]) {
|
||||||
return kSeparatorType;
|
return kPeriodSeparatorType;
|
||||||
} else if ([character isEqualToString:@"-"]) {
|
} else if ([character isEqualToString:@"-"]) {
|
||||||
return kDashType;
|
return kDashType;
|
||||||
} else if ([[NSCharacterSet decimalDigitCharacterSet] characterIsMember:[character characterAtIndex:0]]) {
|
} else if ([[NSCharacterSet decimalDigitCharacterSet] characterIsMember:[character characterAtIndex:0]]) {
|
||||||
return kNumberType;
|
return kNumberType;
|
||||||
} else if ([[NSCharacterSet whitespaceAndNewlineCharacterSet] characterIsMember:[character characterAtIndex:0]]) {
|
} else if ([[NSCharacterSet whitespaceAndNewlineCharacterSet] characterIsMember:[character characterAtIndex:0]]) {
|
||||||
return kSeparatorType;
|
return kWhitespaceSeparatorType;
|
||||||
} else if ([[NSCharacterSet punctuationCharacterSet] characterIsMember:[character characterAtIndex:0]]) {
|
} else if ([[NSCharacterSet punctuationCharacterSet] characterIsMember:[character characterAtIndex:0]]) {
|
||||||
return kSeparatorType;
|
return kPunctuationSeparatorType;
|
||||||
} else {
|
} else {
|
||||||
return kStringType;
|
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;
|
NSString *character;
|
||||||
NSMutableString *s;
|
NSMutableString *s;
|
||||||
NSUInteger i, n;
|
NSUInteger i, n;
|
||||||
SUCharacterType oldType, newType;
|
SUCharacterType oldType, newType;
|
||||||
NSMutableArray *parts = [NSMutableArray array];
|
NSMutableArray<NSString *> *parts = [NSMutableArray array];
|
||||||
if ([version length] == 0) {
|
if ([version length] == 0) {
|
||||||
// Nothing to do here
|
// Nothing to do here
|
||||||
return parts;
|
return parts;
|
||||||
@@ -73,7 +114,7 @@ typedef NS_ENUM(NSInteger, SUCharacterType) {
|
|||||||
if (newType == kDashType) {
|
if (newType == kDashType) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (oldType != newType || oldType == kSeparatorType) {
|
if (oldType != newType || [self isSeparatorType:oldType]) {
|
||||||
// We've reached a new segment
|
// We've reached a new segment
|
||||||
NSString *aPart = [[NSString alloc] initWithString:s];
|
NSString *aPart = [[NSString alloc] initWithString:s];
|
||||||
[parts addObject:aPart];
|
[parts addObject:aPart];
|
||||||
@@ -90,10 +131,64 @@ typedef NS_ENUM(NSInteger, SUCharacterType) {
|
|||||||
return parts;
|
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
|
- (NSComparisonResult)compareVersion:(NSString *)versionA toVersion:(NSString *)versionB
|
||||||
{
|
{
|
||||||
NSArray *partsA = [self splitVersionString:versionA];
|
NSMutableArray<NSString *> *splitPartsA = [self splitVersionString:versionA];
|
||||||
NSArray *partsB = [self splitVersionString:versionB];
|
NSMutableArray<NSString *> *splitPartsB = [self splitVersionString:versionB];
|
||||||
|
|
||||||
|
[self balanceVersionPartsA:splitPartsA partsB:splitPartsB];
|
||||||
|
|
||||||
|
NSArray<NSString *> *partsA = splitPartsA;
|
||||||
|
NSArray<NSString *> *partsB = splitPartsB;
|
||||||
|
|
||||||
NSString *partA, *partB;
|
NSString *partA, *partB;
|
||||||
NSUInteger i, n;
|
NSUInteger i, n;
|
||||||
@@ -109,7 +204,7 @@ typedef NS_ENUM(NSInteger, SUCharacterType) {
|
|||||||
typeB = [self typeOfCharacter:partB];
|
typeB = [self typeOfCharacter:partB];
|
||||||
|
|
||||||
// Compare types
|
// Compare types
|
||||||
if (typeA == typeB) {
|
if ([self isEqualCharacterTypeClassForTypeA:typeA typeB:typeB]) {
|
||||||
// Same type; we can compare
|
// Same type; we can compare
|
||||||
if (typeA == kNumberType) {
|
if (typeA == kNumberType) {
|
||||||
valueA = [partA longLongValue];
|
valueA = [partA longLongValue];
|
||||||
|
|||||||
Vendored
+6
-6
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="18122" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="19529" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="macosx"/>
|
<deployment identifier="macosx"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="18122"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="19529"/>
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
@@ -49,14 +49,14 @@
|
|||||||
</connections>
|
</connections>
|
||||||
</textField>
|
</textField>
|
||||||
<progressIndicator verticalHuggingPriority="750" maxValue="100" bezeled="NO" indeterminate="YES" style="bar" translatesAutoresizingMaskIntoConstraints="NO" id="11">
|
<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>
|
<connections>
|
||||||
<binding destination="-2" name="maxValue" keyPath="maxProgressValue" id="13"/>
|
<binding destination="-2" name="maxValue" keyPath="maxProgressValue" id="13"/>
|
||||||
<binding destination="-2" name="value" keyPath="progressValue" previousBinding="13" id="27"/>
|
<binding destination="-2" name="value" keyPath="progressValue" previousBinding="13" id="27"/>
|
||||||
</connections>
|
</connections>
|
||||||
</progressIndicator>
|
</progressIndicator>
|
||||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="12">
|
<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>
|
<constraints>
|
||||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="100" id="3tI-Ef-LLb"/>
|
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="100" id="3tI-Ef-LLb"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
</textField>
|
</textField>
|
||||||
</subviews>
|
</subviews>
|
||||||
<constraints>
|
<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="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="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"/>
|
<constraint firstItem="7" firstAttribute="top" secondItem="6" secondAttribute="top" constant="15" id="9Mg-Ac-X6m"/>
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
<constraint firstItem="7" firstAttribute="leading" secondItem="6" secondAttribute="leading" constant="24" id="ZLG-dr-gmv"/>
|
<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 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 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 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"/>
|
<constraint firstItem="8" firstAttribute="top" secondItem="6" secondAttribute="top" constant="15" id="tAo-wJ-XR0"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
|||||||
Vendored
+1
-17
@@ -141,23 +141,7 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
|
|||||||
|
|
||||||
- (IBAction)skipThisVersion:(id)__unused sender
|
- (IBAction)skipThisVersion:(id)__unused sender
|
||||||
{
|
{
|
||||||
if (self.updateItem.majorUpgrade) {
|
[self endWithSelection:SPUUserUpdateChoiceSkip];
|
||||||
NSAlert *alert = [[NSAlert alloc] init];
|
|
||||||
alert.alertStyle = NSAlertStyleInformational;
|
|
||||||
alert.informativeText = SULocalizedString(@"Skipping this major upgrade will opt out of alerts for future updates.", nil);
|
|
||||||
alert.messageText = SULocalizedString(@"Are you sure you want to skip this upgrade?", nil);
|
|
||||||
|
|
||||||
[alert addButtonWithTitle:SULocalizedString(@"Skip Upgrade", nil)];
|
|
||||||
[alert addButtonWithTitle:SULocalizedString(@"Don't Skip", nil)];
|
|
||||||
|
|
||||||
[alert beginSheetModalForWindow:(NSWindow * _Nonnull)self.window completionHandler:^(NSModalResponse response) {
|
|
||||||
if (response == NSAlertFirstButtonReturn) {
|
|
||||||
[self endWithSelection:SPUUserUpdateChoiceSkip];
|
|
||||||
}
|
|
||||||
}];
|
|
||||||
} else {
|
|
||||||
[self endWithSelection:SPUUserUpdateChoiceSkip];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)remindMeLater:(id)__unused sender
|
- (IBAction)remindMeLater:(id)__unused sender
|
||||||
|
|||||||
Vendored
-3
@@ -155,9 +155,6 @@
|
|||||||
/* Skipping major upgrade */
|
/* Skipping major upgrade */
|
||||||
"Skip Upgrade" = "Update überspringen";
|
"Skip Upgrade" = "Update überspringen";
|
||||||
|
|
||||||
/* Confirmation message for skipping major upgrade and future updates */
|
|
||||||
"Skipping this major upgrade will opt out of alerts for future updates." = "Wenn du dieses Hauptupdate überspringst, wirst du keine Hinweise für zukünftige Updates erhalten.";
|
|
||||||
|
|
||||||
/* (No Comment) */
|
/* (No Comment) */
|
||||||
"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" = "Das Aktualisierungsprogramm wurde nicht richtig gestartet. Du solltest den App-Entwickler kontaktieren, um diesen Fehler zu melden und zu prüfen, ob du die neueste Version hast.";
|
"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" = "Das Aktualisierungsprogramm wurde nicht richtig gestartet. Du solltest den App-Entwickler kontaktieren, um diesen Fehler zu melden und zu prüfen, ob du die neueste Version hast.";
|
||||||
|
|
||||||
|
|||||||
Vendored
-3
@@ -91,9 +91,6 @@
|
|||||||
/* Title confirmation for skipping major upgrade and future updates */
|
/* 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?" = "このアップグレードをスキップしてもよろしいですか?";
|
||||||
|
|
||||||
/* Confirmation message for skipping major upgrade and future updates */
|
|
||||||
"Skipping this major upgrade will opt out of alerts for future updates." = "このメジャーアップグレードをスキップすると、今後のアップデートも通知されなくなります。";
|
|
||||||
|
|
||||||
/* Skipping major upgrade */
|
/* Skipping major upgrade */
|
||||||
"Skip Upgrade" = "アップグレードをスキップ";
|
"Skip Upgrade" = "アップグレードをスキップ";
|
||||||
|
|
||||||
|
|||||||
Vendored
-3
@@ -155,9 +155,6 @@
|
|||||||
/* Skipping major upgrade */
|
/* Skipping major upgrade */
|
||||||
"Skip Upgrade" = "Sla update over";
|
"Skip Upgrade" = "Sla update over";
|
||||||
|
|
||||||
/* Confirmation message for skipping major upgrade and future updates */
|
|
||||||
"Skipping this major upgrade will opt out of alerts for future updates." = "Als je deze hoofdupdate overslaat, zul je geen meldingen voor toekomstige updates ontvangen.";
|
|
||||||
|
|
||||||
/* (No Comment) */
|
/* (No Comment) */
|
||||||
"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" = "Het bijwerkprogramma is niet goed gestart. Je kunt wellicht met de app-ontwikkelaar contact opnemen om de fout te melden en te controleren dat je de nieuwste versie hebt";
|
"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" = "Het bijwerkprogramma is niet goed gestart. Je kunt wellicht met de app-ontwikkelaar contact opnemen om de fout te melden en te controleren dat je de nieuwste versie hebt";
|
||||||
|
|
||||||
|
|||||||
@@ -251,15 +251,14 @@
|
|||||||
[self addUpdateButtonWithTitle:[NSString stringWithFormat:@"Extracting (%d%%)…", (int)(progress * 100)]];
|
[self addUpdateButtonWithTitle:[NSString stringWithFormat:@"Extracting (%d%%)…", (int)(progress * 100)]];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)showInstallingUpdate
|
- (void)showInstallingUpdateWithApplicationTerminated:(BOOL)applicationTerminated
|
||||||
{
|
{
|
||||||
[self addUpdateButtonWithTitle:@"Installing…"];
|
if (applicationTerminated) {
|
||||||
}
|
[self addUpdateButtonWithTitle:@"Installing…"];
|
||||||
|
} else {
|
||||||
- (void)showSendingTerminationSignal
|
// In case our termination request fails or is delayed
|
||||||
{
|
[self removeUpdateButton];
|
||||||
// In case our termination request fails or is delayed
|
}
|
||||||
[self removeUpdateButton];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)showUpdateInstalledAndRelaunched:(BOOL)__unused relaunched acknowledgement:(void (^)(void))acknowledgement
|
- (void)showUpdateInstalledAndRelaunched:(BOOL)__unused relaunched acknowledgement:(void (^)(void))acknowledgement
|
||||||
|
|||||||
@@ -14,12 +14,14 @@
|
|||||||
#import "ed25519.h" // Run `git submodule update --init` if you get an error here
|
#import "ed25519.h" // Run `git submodule update --init` if you get an error here
|
||||||
#import <Sparkle/Sparkle.h>
|
#import <Sparkle/Sparkle.h>
|
||||||
#import "SUPopUpTitlebarUserDriver.h"
|
#import "SUPopUpTitlebarUserDriver.h"
|
||||||
|
#import "SUBinaryDeltaCreate.h"
|
||||||
|
|
||||||
@interface SUTestApplicationDelegate ()
|
@interface SUTestApplicationDelegate () <NSMenuItemValidation, SPUUpdaterDelegate>
|
||||||
|
|
||||||
@property (nonatomic) SPUUpdater *updater;
|
@property (nonatomic) SPUUpdater *updater;
|
||||||
@property (nonatomic) SUUpdateSettingsWindowController *updateSettingsWindowController;
|
@property (nonatomic) SUUpdateSettingsWindowController *updateSettingsWindowController;
|
||||||
@property (nonatomic) SUTestWebServer *webServer;
|
@property (nonatomic) SUTestWebServer *webServer;
|
||||||
|
@property (nonatomic, copy) NSString *testMode;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -28,15 +30,26 @@
|
|||||||
@synthesize updater = _updater;
|
@synthesize updater = _updater;
|
||||||
@synthesize updateSettingsWindowController = _updateSettingsWindowController;
|
@synthesize updateSettingsWindowController = _updateSettingsWindowController;
|
||||||
@synthesize webServer = _webServer;
|
@synthesize webServer = _webServer;
|
||||||
|
@synthesize testMode = _testMode;
|
||||||
static NSString * const UPDATED_VERSION = @"2.0";
|
|
||||||
|
|
||||||
- (void)applicationDidFinishLaunching:(NSNotification * __unused)notification
|
- (void)applicationDidFinishLaunching:(NSNotification * __unused)notification
|
||||||
{
|
{
|
||||||
NSBundle *mainBundle = [NSBundle mainBundle];
|
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||||
|
|
||||||
|
NSString *testModeEnv = [[[NSProcessInfo processInfo] environment] objectForKey:@"TEST_MODE"];
|
||||||
|
NSString *testMode;
|
||||||
|
if (testModeEnv == nil) {
|
||||||
|
testMode = @"REGULAR";
|
||||||
|
} else {
|
||||||
|
testMode = testModeEnv;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.testMode = testMode;
|
||||||
|
|
||||||
// Check if we are already up to date
|
// Check if we are already up to date
|
||||||
if ([(NSString *)[mainBundle objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey] isEqualToString:UPDATED_VERSION]) {
|
NSString *mainBundleVersion = (NSString *)[mainBundle objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
|
||||||
|
|
||||||
|
if (([mainBundleVersion hasPrefix:@"2."] && [testMode isEqualToString:@"REGULAR"]) || (([mainBundleVersion isEqualToString:@"2.1"] || [mainBundleVersion isEqualToString:@"2.2"]) && [testMode isEqualToString:@"DELTA"]) || ([mainBundleVersion isEqualToString:@"2.2"] && [testMode isEqualToString:@"AUTOMATIC"])) {
|
||||||
NSAlert *alreadyUpdatedAlert = [[NSAlert alloc] init];
|
NSAlert *alreadyUpdatedAlert = [[NSAlert alloc] init];
|
||||||
alreadyUpdatedAlert.messageText = @"Update succeeded!";
|
alreadyUpdatedAlert.messageText = @"Update succeeded!";
|
||||||
alreadyUpdatedAlert.informativeText = @"This is the updated version of Sparkle Test App.\n\nDelete and rebuild the app to test updates again.";
|
alreadyUpdatedAlert.informativeText = @"This is the updated version of Sparkle Test App.\n\nDelete and rebuild the app to test updates again.";
|
||||||
@@ -107,57 +120,50 @@ static NSString * const UPDATED_VERSION = @"2.0";
|
|||||||
BOOL infoFileExists = [infoURL checkResourceIsReachableAndReturnError:nil];
|
BOOL infoFileExists = [infoURL checkResourceIsReachableAndReturnError:nil];
|
||||||
assert(infoFileExists);
|
assert(infoFileExists);
|
||||||
|
|
||||||
|
NSString *finalUpdatedVersion;
|
||||||
|
if ([testMode isEqualToString:@"REGULAR"]) {
|
||||||
|
finalUpdatedVersion = @"2.0";
|
||||||
|
} else if ([testMode isEqualToString:@"DELTA"]) {
|
||||||
|
finalUpdatedVersion = @"2.1";
|
||||||
|
} else if ([testMode isEqualToString:@"AUTOMATIC"]) {
|
||||||
|
finalUpdatedVersion = @"2.2";
|
||||||
|
} else {
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
NSMutableDictionary *infoDictionary = [[NSMutableDictionary alloc] initWithContentsOfURL:infoURL];
|
NSMutableDictionary *infoDictionary = [[NSMutableDictionary alloc] initWithContentsOfURL:infoURL];
|
||||||
[infoDictionary setObject:UPDATED_VERSION forKey:(__bridge NSString *)kCFBundleVersionKey];
|
[infoDictionary setObject:finalUpdatedVersion forKey:(__bridge NSString *)kCFBundleVersionKey];
|
||||||
[infoDictionary setObject:UPDATED_VERSION forKey:@"CFBundleShortVersionString"];
|
[infoDictionary setObject:finalUpdatedVersion forKey:@"CFBundleShortVersionString"];
|
||||||
|
|
||||||
BOOL wroteInfoFile = [infoDictionary writeToURL:infoURL atomically:NO];
|
BOOL wroteInfoFile = [infoDictionary writeToURL:infoURL atomically:NO];
|
||||||
assert(wroteInfoFile);
|
assert(wroteInfoFile);
|
||||||
|
|
||||||
|
// Overwrite and add new data
|
||||||
|
{
|
||||||
|
NSURL *screenshotURL = [[[[destinationBundleURL URLByAppendingPathComponent:@"Contents"] URLByAppendingPathComponent:@"Resources"] URLByAppendingPathComponent:@"screenshot"] URLByAppendingPathExtension:@"png"];
|
||||||
|
assert([screenshotURL checkResourceIsReachableAndReturnError:NULL]);
|
||||||
|
|
||||||
|
NSMutableData *screenshotData = [NSMutableData dataWithContentsOfURL:screenshotURL];
|
||||||
|
|
||||||
|
uint32_t garbage = 1337;
|
||||||
|
[screenshotData appendBytes:&garbage length:sizeof(garbage)];
|
||||||
|
|
||||||
|
BOOL wroteData = [screenshotData writeToURL:screenshotURL atomically:NO];
|
||||||
|
assert(wroteData);
|
||||||
|
|
||||||
|
NSURL *newDataURL = [[screenshotURL URLByDeletingLastPathComponent] URLByAppendingPathComponent:@"new_file"];
|
||||||
|
assert(newDataURL != nil);
|
||||||
|
|
||||||
|
BOOL wroteNewData = [[NSData dataWithBytes:&garbage length:sizeof(garbage)] writeToURL:newDataURL atomically:NO];
|
||||||
|
assert(wroteNewData);
|
||||||
|
}
|
||||||
|
|
||||||
[self signApplicationIfRequiredAtPath:destinationBundleURL.path completion:^{
|
[self signApplicationIfRequiredAtPath:destinationBundleURL.path completion:^{
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
// Change current working directory so web server knows where to list files
|
// Change current working directory so web server knows where to list files
|
||||||
NSString *serverDirectoryPath = serverDirectoryURL.path;
|
NSString *serverDirectoryPath = serverDirectoryURL.path;
|
||||||
assert(serverDirectoryPath != nil);
|
assert(serverDirectoryPath != nil);
|
||||||
|
|
||||||
// Create the archive for our update
|
|
||||||
NSString *zipName = @"Sparkle_Test_App.zip";
|
|
||||||
NSTask *dittoTask = [[NSTask alloc] init];
|
|
||||||
dittoTask.launchPath = @"/usr/bin/ditto";
|
|
||||||
dittoTask.arguments = @[@"-c", @"-k", @"--sequesterRsrc", @"--keepParent", (NSString *)destinationBundleURL.lastPathComponent, zipName];
|
|
||||||
dittoTask.currentDirectoryPath = serverDirectoryPath;
|
|
||||||
[dittoTask launch];
|
|
||||||
[dittoTask waitUntilExit];
|
|
||||||
|
|
||||||
assert(dittoTask.terminationStatus == 0);
|
|
||||||
|
|
||||||
[fileManager removeItemAtURL:destinationBundleURL error:NULL];
|
|
||||||
|
|
||||||
// Don't ever do this at home, kids (seriously)
|
|
||||||
// (that is, including the private key inside of your application)
|
|
||||||
const unsigned char self_sign_demo_only_insecure_hack[64] = {200, 238, 135, 84, 10, 189, 3, 193, 61, 208, 203, 30, 133, 47, 12, 22, 19, 52, 252, 99, 110, 205, 209, 94, 215, 144, 201, 70, 27, 162, 163, 108, 0, 164, 68, 184, 226, 93, 121, 199, 172, 17, 26, 64, 89, 68, 232, 41, 2, 26, 245, 175, 158, 165, 42, 55, 5, 97, 8, 243, 251, 164, 93, 9};
|
|
||||||
// in normal app this goes to Info.plist
|
|
||||||
const unsigned char public_key[32] = {121, 17, 79, 45, 155, 141, 51, 169, 188, 110, 91, 102, 182, 147, 215, 225, 252, 202, 110, 231, 200, 215, 62, 171, 40, 145, 237, 128, 130, 44, 150, 89};
|
|
||||||
unsigned char signature[64];
|
|
||||||
|
|
||||||
NSURL *archiveURL = [serverDirectoryURL URLByAppendingPathComponent:zipName];
|
|
||||||
NSData *archive = [NSData dataWithContentsOfURL:archiveURL];
|
|
||||||
assert(archive != nil);
|
|
||||||
|
|
||||||
ed25519_sign(signature, archive.bytes, archive.length, public_key, self_sign_demo_only_insecure_hack);
|
|
||||||
|
|
||||||
NSString *signatureString = [[NSData dataWithBytes:signature length:64] base64EncodedStringWithOptions:0];
|
|
||||||
|
|
||||||
// Obtain the file attributes to get the file size of our update later
|
|
||||||
NSError *fileAttributesError = nil;
|
|
||||||
NSString *archiveURLPath = archiveURL.path;
|
|
||||||
assert(archiveURLPath != nil);
|
|
||||||
NSDictionary *archiveFileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:archiveURLPath error:&fileAttributesError];
|
|
||||||
if (archiveFileAttributes == nil) {
|
|
||||||
NSLog(@"Failed to retrieve file attributes from archive with error %@", fileAttributesError);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
NSString * const appcastName = @"sparkletestcast";
|
NSString * const appcastName = @"sparkletestcast";
|
||||||
NSString * const appcastExtension = @"xml";
|
NSString * const appcastExtension = @"xml";
|
||||||
|
|
||||||
@@ -180,18 +186,97 @@ static NSString * const UPDATED_VERSION = @"2.0";
|
|||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
NSUInteger numberOfLengthReplacements = [appcastContents replaceOccurrencesOfString:@"$INSERT_ARCHIVE_LENGTH" withString:[NSString stringWithFormat:@"%llu", archiveFileAttributes.fileSize] options:NSLiteralSearch range:NSMakeRange(0, appcastContents.length)];
|
// Don't ever do this at home, kids (seriously)
|
||||||
assert(numberOfLengthReplacements == 1);
|
// (that is, including the private key inside of your application)
|
||||||
|
const unsigned char self_sign_demo_only_insecure_hack[64] = {200, 238, 135, 84, 10, 189, 3, 193, 61, 208, 203, 30, 133, 47, 12, 22, 19, 52, 252, 99, 110, 205, 209, 94, 215, 144, 201, 70, 27, 162, 163, 108, 0, 164, 68, 184, 226, 93, 121, 199, 172, 17, 26, 64, 89, 68, 232, 41, 2, 26, 245, 175, 158, 165, 42, 55, 5, 97, 8, 243, 251, 164, 93, 9};
|
||||||
|
// in normal app this goes to Info.plist
|
||||||
|
const unsigned char public_key[32] = {121, 17, 79, 45, 155, 141, 51, 169, 188, 110, 91, 102, 182, 147, 215, 225, 252, 202, 110, 231, 200, 215, 62, 171, 40, 145, 237, 128, 130, 44, 150, 89};
|
||||||
|
unsigned char signature[64];
|
||||||
|
|
||||||
NSUInteger numberOfSignatureReplacements = [appcastContents replaceOccurrencesOfString:@"$INSERT_EDDSA_SIGNATURE" withString:signatureString options:NSLiteralSearch range:NSMakeRange(0, appcastContents.length)];
|
if ([testMode isEqualToString:@"DELTA"]) {
|
||||||
assert(numberOfSignatureReplacements == 1);
|
NSError *deltaCreationError = nil;
|
||||||
|
NSURL *patchURL = [serverDirectoryURL URLByAppendingPathComponent:@"patch.delta"];
|
||||||
NSError *writeAppcastError = nil;
|
if (!createBinaryDelta(bundleURL.path, destinationBundleURL.path, patchURL.path, SUBinaryDeltaMajorVersionDefault, SPUDeltaCompressionModeDefault, 0, NO, &deltaCreationError)) {
|
||||||
if (![appcastContents writeToURL:appcastDestinationURL atomically:NO encoding:NSUTF8StringEncoding error:&writeAppcastError]) {
|
NSLog(@"Failed to create binary delta patch: %@", deltaCreationError);
|
||||||
NSLog(@"Failed to write updated appcast with error %@", writeAppcastError);
|
abort();
|
||||||
abort();
|
}
|
||||||
|
|
||||||
|
NSData *archive = [NSData dataWithContentsOfURL:patchURL];
|
||||||
|
assert(archive != nil);
|
||||||
|
|
||||||
|
ed25519_sign(signature, archive.bytes, archive.length, public_key, self_sign_demo_only_insecure_hack);
|
||||||
|
|
||||||
|
NSString *signatureString = [[NSData dataWithBytes:signature length:64] base64EncodedStringWithOptions:0];
|
||||||
|
|
||||||
|
// Obtain the file attributes to get the file size of our update later
|
||||||
|
NSError *fileAttributesError = nil;
|
||||||
|
NSString *archiveURLPath = patchURL.path;
|
||||||
|
assert(archiveURLPath != nil);
|
||||||
|
NSDictionary *archiveFileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:archiveURLPath error:&fileAttributesError];
|
||||||
|
if (archiveFileAttributes == nil) {
|
||||||
|
NSLog(@"Failed to retrieve file attributes from delta archive with error %@", fileAttributesError);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
NSUInteger numberOfLengthReplacements = [appcastContents replaceOccurrencesOfString:@"$INSERT_DELTA_ARCHIVE_LENGTH" withString:[NSString stringWithFormat:@"%llu", archiveFileAttributes.fileSize] options:NSLiteralSearch range:NSMakeRange(0, appcastContents.length)];
|
||||||
|
assert(numberOfLengthReplacements == 1);
|
||||||
|
|
||||||
|
NSUInteger numberOfSignatureReplacements = [appcastContents replaceOccurrencesOfString:@"$INSERT_DELTA_EDDSA_SIGNATURE" withString:signatureString options:NSLiteralSearch range:NSMakeRange(0, appcastContents.length)];
|
||||||
|
assert(numberOfSignatureReplacements == 1);
|
||||||
|
|
||||||
|
NSUInteger numberOfFromVersionReplacements = [appcastContents replaceOccurrencesOfString:@"$INSERT_DELTA_FROM_VERSION" withString:mainBundleVersion options:NSLiteralSearch range:NSMakeRange(0, appcastContents.length)];
|
||||||
|
assert(numberOfFromVersionReplacements == 1);
|
||||||
|
|
||||||
|
NSError *writeAppcastError = nil;
|
||||||
|
if (![appcastContents writeToURL:appcastDestinationURL atomically:NO encoding:NSUTF8StringEncoding error:&writeAppcastError]) {
|
||||||
|
NSLog(@"Failed to write updated appcast with error %@", writeAppcastError);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Create the archive for our update
|
||||||
|
NSString *zipName = @"Sparkle_Test_App.zip";
|
||||||
|
NSTask *dittoTask = [[NSTask alloc] init];
|
||||||
|
dittoTask.launchPath = @"/usr/bin/ditto";
|
||||||
|
dittoTask.arguments = @[@"-c", @"-k", @"--sequesterRsrc", @"--keepParent", (NSString *)destinationBundleURL.lastPathComponent, zipName];
|
||||||
|
dittoTask.currentDirectoryPath = serverDirectoryPath;
|
||||||
|
[dittoTask launch];
|
||||||
|
[dittoTask waitUntilExit];
|
||||||
|
|
||||||
|
assert(dittoTask.terminationStatus == 0);
|
||||||
|
|
||||||
|
NSURL *archiveURL = [serverDirectoryURL URLByAppendingPathComponent:zipName];
|
||||||
|
NSData *archive = [NSData dataWithContentsOfURL:archiveURL];
|
||||||
|
assert(archive != nil);
|
||||||
|
|
||||||
|
ed25519_sign(signature, archive.bytes, archive.length, public_key, self_sign_demo_only_insecure_hack);
|
||||||
|
|
||||||
|
NSString *signatureString = [[NSData dataWithBytes:signature length:64] base64EncodedStringWithOptions:0];
|
||||||
|
|
||||||
|
// Obtain the file attributes to get the file size of our update later
|
||||||
|
NSError *fileAttributesError = nil;
|
||||||
|
NSString *archiveURLPath = archiveURL.path;
|
||||||
|
assert(archiveURLPath != nil);
|
||||||
|
NSDictionary *archiveFileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:archiveURLPath error:&fileAttributesError];
|
||||||
|
if (archiveFileAttributes == nil) {
|
||||||
|
NSLog(@"Failed to retrieve file attributes from archive with error %@", fileAttributesError);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
NSUInteger numberOfLengthReplacements = [appcastContents replaceOccurrencesOfString:@"$INSERT_ARCHIVE_LENGTH" withString:[NSString stringWithFormat:@"%llu", archiveFileAttributes.fileSize] options:NSLiteralSearch range:NSMakeRange(0, appcastContents.length)];
|
||||||
|
assert(numberOfLengthReplacements == 2);
|
||||||
|
|
||||||
|
NSUInteger numberOfSignatureReplacements = [appcastContents replaceOccurrencesOfString:@"$INSERT_EDDSA_SIGNATURE" withString:signatureString options:NSLiteralSearch range:NSMakeRange(0, appcastContents.length)];
|
||||||
|
assert(numberOfSignatureReplacements == 2);
|
||||||
|
|
||||||
|
NSError *writeAppcastError = nil;
|
||||||
|
if (![appcastContents writeToURL:appcastDestinationURL atomically:NO encoding:NSUTF8StringEncoding error:&writeAppcastError]) {
|
||||||
|
NSLog(@"Failed to write updated appcast with error %@", writeAppcastError);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[fileManager removeItemAtURL:destinationBundleURL error:NULL];
|
||||||
|
|
||||||
// Finally start the server
|
// Finally start the server
|
||||||
SUTestWebServer *webServer = [[SUTestWebServer alloc] initWithPort:1337 workingDirectory:serverDirectoryPath];
|
SUTestWebServer *webServer = [[SUTestWebServer alloc] initWithPort:1337 workingDirectory:serverDirectoryPath];
|
||||||
if (!webServer) {
|
if (!webServer) {
|
||||||
@@ -220,7 +305,7 @@ static NSString * const UPDATED_VERSION = @"2.0";
|
|||||||
userDriver = [[SUPopUpTitlebarUserDriver alloc] initWithWindow:settingsWindow];
|
userDriver = [[SUPopUpTitlebarUserDriver alloc] initWithWindow:settingsWindow];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SPUUpdater *updater = [[SPUUpdater alloc] initWithHostBundle:hostBundle applicationBundle:applicationBundle userDriver:userDriver delegate:nil];
|
SPUUpdater *updater = [[SPUUpdater alloc] initWithHostBundle:hostBundle applicationBundle:applicationBundle userDriver:userDriver delegate:self];
|
||||||
|
|
||||||
self.updater = updater;
|
self.updater = updater;
|
||||||
self.updateSettingsWindowController.updater = updater;
|
self.updateSettingsWindowController.updater = updater;
|
||||||
@@ -242,6 +327,17 @@ static NSString * const UPDATED_VERSION = @"2.0";
|
|||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSSet<NSString *> *)allowedChannelsForUpdater:(SPUUpdater *)updater
|
||||||
|
{
|
||||||
|
if ([self.testMode isEqualToString:@"DELTA"]) {
|
||||||
|
return [NSSet setWithObject:@"delta"];
|
||||||
|
} else if ([self.testMode isEqualToString:@"AUTOMATIC"]) {
|
||||||
|
return [NSSet setWithObject:@"automatic"];
|
||||||
|
} else {
|
||||||
|
return [NSSet set];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
- (void)signApplicationIfRequiredAtPath:(NSString *)applicationPath completion:(void (^)(void))completionBlock
|
- (void)signApplicationIfRequiredAtPath:(NSString *)applicationPath completion:(void (^)(void))completionBlock
|
||||||
{
|
{
|
||||||
// This is unfortunately necessary for testing sandboxing
|
// This is unfortunately necessary for testing sandboxing
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 110 KiB |
@@ -4,7 +4,51 @@
|
|||||||
<title>Sparkle Test App Changelog</title>
|
<title>Sparkle Test App Changelog</title>
|
||||||
<description>Most recent changes with links to updates.</description>
|
<description>Most recent changes with links to updates.</description>
|
||||||
<language>en</language>
|
<language>en</language>
|
||||||
<item>
|
<item>
|
||||||
|
<title>Version 2.2</title>
|
||||||
|
<sparkle:version>2.2</sparkle:version>
|
||||||
|
<link>https://sparkle-project.org</link>
|
||||||
|
<sparkle:channel>automatic</sparkle:channel>
|
||||||
|
<sparkle:fullReleaseNotesLink>releasenotes.html</sparkle:fullReleaseNotesLink>
|
||||||
|
<description>
|
||||||
|
<![CDATA[
|
||||||
|
<ul>
|
||||||
|
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
|
||||||
|
</ul>
|
||||||
|
]]>
|
||||||
|
</description>
|
||||||
|
<pubDate>Sat, 26 Jul 2014 15:20:11 +0000</pubDate>
|
||||||
|
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" length="$INSERT_ARCHIVE_LENGTH" type="application/octet-stream" sparkle:edSignature="$INSERT_EDDSA_SIGNATURE" />
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<title>Version 2.1</title>
|
||||||
|
<sparkle:version>2.1</sparkle:version>
|
||||||
|
<link>https://sparkle-project.org</link>
|
||||||
|
<sparkle:channel>delta</sparkle:channel>
|
||||||
|
<sparkle:fullReleaseNotesLink>releasenotes.html</sparkle:fullReleaseNotesLink>
|
||||||
|
<description>
|
||||||
|
<![CDATA[
|
||||||
|
<ul>
|
||||||
|
<li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
|
||||||
|
<li>Suspendisse sed felis ac ante ultrices rhoncus. Etiam quis elit vel nibh placerat facilisis in id leo.</li>
|
||||||
|
</ul>
|
||||||
|
]]>
|
||||||
|
</description>
|
||||||
|
<pubDate>Sat, 26 Jul 2014 15:20:11 +0000</pubDate>
|
||||||
|
<!-- Note: this file won't actually exist to ensure delta update works -->
|
||||||
|
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" length="100000" type="application/octet-stream" sparkle:edSignature="ootgYIwmnS1wa7Q/5SXDXnOVdKnjkjrFhm/D7ukW77k=" />
|
||||||
|
|
||||||
|
<sparkle:deltas>
|
||||||
|
<enclosure url="http://localhost:1337/patch.delta"
|
||||||
|
sparkle:deltaFrom="$INSERT_DELTA_FROM_VERSION"
|
||||||
|
length="$INSERT_DELTA_ARCHIVE_LENGTH"
|
||||||
|
type="application/octet-stream"
|
||||||
|
sparkle:edSignature="$INSERT_DELTA_EDDSA_SIGNATURE" />
|
||||||
|
</sparkle:deltas>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item>
|
||||||
<title>Version 2.0</title>
|
<title>Version 2.0</title>
|
||||||
<sparkle:version>2.0</sparkle:version>
|
<sparkle:version>2.0</sparkle:version>
|
||||||
<link>https://sparkle-project.org</link>
|
<link>https://sparkle-project.org</link>
|
||||||
@@ -21,6 +65,6 @@
|
|||||||
</description>
|
</description>
|
||||||
<pubDate>Sat, 26 Jul 2014 15:20:11 +0000</pubDate>
|
<pubDate>Sat, 26 Jul 2014 15:20:11 +0000</pubDate>
|
||||||
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" length="$INSERT_ARCHIVE_LENGTH" type="application/octet-stream" sparkle:edSignature="$INSERT_EDDSA_SIGNATURE" />
|
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" length="$INSERT_ARCHIVE_LENGTH" type="application/octet-stream" sparkle:edSignature="$INSERT_EDDSA_SIGNATURE" />
|
||||||
</item>
|
</item>
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
<sparkle:informationalUpdate>
|
<sparkle:informationalUpdate>
|
||||||
<sparkle:version>2.5</sparkle:version>
|
<sparkle:version>2.5</sparkle:version>
|
||||||
<sparkle:version>2.4</sparkle:version>
|
<sparkle:version>2.4</sparkle:version>
|
||||||
|
<sparkle:belowVersion>0.5</sparkle:belowVersion>
|
||||||
</sparkle:informationalUpdate>
|
</sparkle:informationalUpdate>
|
||||||
<link>http://sparkle-project.org</link>
|
<link>http://sparkle-project.org</link>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
|
||||||
|
<channel>
|
||||||
|
<title>For unit test only</title>
|
||||||
|
<item>
|
||||||
|
<title>Version 4.1</title>
|
||||||
|
<sparkle:version>4.1</sparkle:version>
|
||||||
|
<sparkle:minimumAutoupdateVersion>4.0</sparkle:minimumAutoupdateVersion>
|
||||||
|
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" length="1346234" />
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<title>Version 4.0</title>
|
||||||
|
<sparkle:version>4.0</sparkle:version>
|
||||||
|
<sparkle:minimumAutoupdateVersion>4.0</sparkle:minimumAutoupdateVersion>
|
||||||
|
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" length="1346234" />
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<title>Version 3.9</title>
|
||||||
|
<sparkle:version>3.9</sparkle:version>
|
||||||
|
<sparkle:minimumAutoupdateVersion>3.0</sparkle:minimumAutoupdateVersion>
|
||||||
|
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" length="1346234" />
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<title>Version 3.0</title>
|
||||||
|
<sparkle:version>3.0</sparkle:version>
|
||||||
|
<sparkle:minimumAutoupdateVersion>3.0</sparkle:minimumAutoupdateVersion>
|
||||||
|
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" length="1346234" />
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<title>Version 2.0</title>
|
||||||
|
<sparkle:version>2.0</sparkle:version>
|
||||||
|
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" length="1346234" />
|
||||||
|
</item>
|
||||||
|
</channel>
|
||||||
|
</rss>
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
|
||||||
|
<channel>
|
||||||
|
<title>For unit test only</title>
|
||||||
|
<item>
|
||||||
|
<title>Version 4.1</title>
|
||||||
|
<sparkle:version>4.1</sparkle:version>
|
||||||
|
<sparkle:minimumAutoupdateVersion>4.0</sparkle:minimumAutoupdateVersion>
|
||||||
|
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" length="1346234" />
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<title>Version 4.0</title>
|
||||||
|
<sparkle:version>4.0</sparkle:version>
|
||||||
|
<sparkle:minimumAutoupdateVersion>4.0</sparkle:minimumAutoupdateVersion>
|
||||||
|
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" length="1346234" />
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<title>Version 3.9</title>
|
||||||
|
<sparkle:version>3.9</sparkle:version>
|
||||||
|
<sparkle:minimumAutoupdateVersion>3.0</sparkle:minimumAutoupdateVersion>
|
||||||
|
<sparkle:ignoreSkippedUpgradesBelowVersion>3.5</sparkle:ignoreSkippedUpgradesBelowVersion>
|
||||||
|
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" length="1346234" />
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<title>Version 3.0</title>
|
||||||
|
<sparkle:version>3.0</sparkle:version>
|
||||||
|
<sparkle:minimumAutoupdateVersion>3.0</sparkle:minimumAutoupdateVersion>
|
||||||
|
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" length="1346234" />
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<title>Version 2.0</title>
|
||||||
|
<!-- this should have no effect because there is no minimumAutoupdateVersion -->
|
||||||
|
<sparkle:ignoreSkippedUpgradesBelowVersion>2.0</sparkle:ignoreSkippedUpgradesBelowVersion>
|
||||||
|
<sparkle:version>2.0</sparkle:version>
|
||||||
|
<enclosure url="http://localhost:1337/Sparkle_Test_App.zip" length="1346234" />
|
||||||
|
</item>
|
||||||
|
</channel>
|
||||||
|
</rss>
|
||||||
+269
-9
@@ -205,6 +205,16 @@ class SUAppcastTest: XCTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test informational updates from version 2.3
|
||||||
|
do {
|
||||||
|
let hostVersion = "2.3"
|
||||||
|
let stateResolver = SPUAppcastItemStateResolver(hostVersion: hostVersion, applicationVersionComparator: versionComparator, standardVersionComparator: versionComparator)
|
||||||
|
|
||||||
|
let appcast = try SUAppcast(xmlData: testData, relativeTo: nil, stateResolver: stateResolver)
|
||||||
|
|
||||||
|
XCTAssertFalse(appcast.items[1].isInformationOnlyUpdate)
|
||||||
|
}
|
||||||
|
|
||||||
// Test informational updates from version 2.4
|
// Test informational updates from version 2.4
|
||||||
do {
|
do {
|
||||||
let hostVersion = "2.4"
|
let hostVersion = "2.4"
|
||||||
@@ -235,6 +245,36 @@ class SUAppcastTest: XCTestCase {
|
|||||||
XCTAssertFalse(appcast.items[1].isInformationOnlyUpdate)
|
XCTAssertFalse(appcast.items[1].isInformationOnlyUpdate)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test informational updates from version 0.5
|
||||||
|
do {
|
||||||
|
let hostVersion = "0.5"
|
||||||
|
let stateResolver = SPUAppcastItemStateResolver(hostVersion: hostVersion, applicationVersionComparator: versionComparator, standardVersionComparator: versionComparator)
|
||||||
|
|
||||||
|
let appcast = try SUAppcast(xmlData: testData, relativeTo: nil, stateResolver: stateResolver)
|
||||||
|
|
||||||
|
XCTAssertFalse(appcast.items[1].isInformationOnlyUpdate)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test informational updates from version 0.4
|
||||||
|
do {
|
||||||
|
let hostVersion = "0.4"
|
||||||
|
let stateResolver = SPUAppcastItemStateResolver(hostVersion: hostVersion, applicationVersionComparator: versionComparator, standardVersionComparator: versionComparator)
|
||||||
|
|
||||||
|
let appcast = try SUAppcast(xmlData: testData, relativeTo: nil, stateResolver: stateResolver)
|
||||||
|
|
||||||
|
XCTAssertTrue(appcast.items[1].isInformationOnlyUpdate)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Test informational updates from version 0.0
|
||||||
|
do {
|
||||||
|
let hostVersion = "0.0"
|
||||||
|
let stateResolver = SPUAppcastItemStateResolver(hostVersion: hostVersion, applicationVersionComparator: versionComparator, standardVersionComparator: versionComparator)
|
||||||
|
|
||||||
|
let appcast = try SUAppcast(xmlData: testData, relativeTo: nil, stateResolver: stateResolver)
|
||||||
|
|
||||||
|
XCTAssertTrue(appcast.items[1].isInformationOnlyUpdate)
|
||||||
|
}
|
||||||
|
|
||||||
} catch let err as NSError {
|
} catch let err as NSError {
|
||||||
NSLog("%@", err)
|
NSLog("%@", err)
|
||||||
XCTFail(err.localizedDescription)
|
XCTFail(err.localizedDescription)
|
||||||
@@ -318,7 +358,7 @@ class SUAppcastTest: XCTestCase {
|
|||||||
|
|
||||||
// There should be no items if 2.0 is skipped from 1.0 and 3.0 fails minimum autoupdate version
|
// There should be no items if 2.0 is skipped from 1.0 and 3.0 fails minimum autoupdate version
|
||||||
do {
|
do {
|
||||||
let skippedUpdate = SPUSkippedUpdate(minorVersion: "2.0", majorVersion: nil)
|
let skippedUpdate = SPUSkippedUpdate(minorVersion: "2.0", majorVersion: nil, majorSubreleaseVersion: nil)
|
||||||
|
|
||||||
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: true)
|
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: true)
|
||||||
|
|
||||||
@@ -327,7 +367,7 @@ class SUAppcastTest: XCTestCase {
|
|||||||
|
|
||||||
// Try again but allowing minimum autoupdate version to fail
|
// Try again but allowing minimum autoupdate version to fail
|
||||||
do {
|
do {
|
||||||
let skippedUpdate = SPUSkippedUpdate(minorVersion: "2.0", majorVersion: nil)
|
let skippedUpdate = SPUSkippedUpdate(minorVersion: "2.0", majorVersion: nil, majorSubreleaseVersion: nil)
|
||||||
|
|
||||||
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: false)
|
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: false)
|
||||||
|
|
||||||
@@ -340,7 +380,7 @@ class SUAppcastTest: XCTestCase {
|
|||||||
|
|
||||||
// Allow minimum autoupdate version to fail and only skip 3.0
|
// Allow minimum autoupdate version to fail and only skip 3.0
|
||||||
do {
|
do {
|
||||||
let skippedUpdate = SPUSkippedUpdate(minorVersion: nil, majorVersion: "3.0")
|
let skippedUpdate = SPUSkippedUpdate(minorVersion: nil, majorVersion: "3.0", majorSubreleaseVersion: nil)
|
||||||
|
|
||||||
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: false)
|
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: false)
|
||||||
|
|
||||||
@@ -353,7 +393,7 @@ class SUAppcastTest: XCTestCase {
|
|||||||
|
|
||||||
// Allow minimum autoupdate version to fail skipping both 2.0 and 3.0
|
// Allow minimum autoupdate version to fail skipping both 2.0 and 3.0
|
||||||
do {
|
do {
|
||||||
let skippedUpdate = SPUSkippedUpdate(minorVersion: "2.0", majorVersion: "3.0")
|
let skippedUpdate = SPUSkippedUpdate(minorVersion: "2.0", majorVersion: "3.0", majorSubreleaseVersion: nil)
|
||||||
|
|
||||||
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: false)
|
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: false)
|
||||||
|
|
||||||
@@ -363,7 +403,7 @@ class SUAppcastTest: XCTestCase {
|
|||||||
// Allow minimum autoupdate version to fail and only skip "2.5"
|
// Allow minimum autoupdate version to fail and only skip "2.5"
|
||||||
// This should implicitly only skip 2.0
|
// This should implicitly only skip 2.0
|
||||||
do {
|
do {
|
||||||
let skippedUpdate = SPUSkippedUpdate(minorVersion: "2.5", majorVersion: nil)
|
let skippedUpdate = SPUSkippedUpdate(minorVersion: "2.5", majorVersion: nil, majorSubreleaseVersion: nil)
|
||||||
|
|
||||||
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: false)
|
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: false)
|
||||||
|
|
||||||
@@ -376,7 +416,7 @@ class SUAppcastTest: XCTestCase {
|
|||||||
|
|
||||||
// This should not skip anything but require passing minimum autoupdate version
|
// This should not skip anything but require passing minimum autoupdate version
|
||||||
do {
|
do {
|
||||||
let skippedUpdate = SPUSkippedUpdate(minorVersion: "1.5", majorVersion: nil)
|
let skippedUpdate = SPUSkippedUpdate(minorVersion: "1.5", majorVersion: nil, majorSubreleaseVersion: nil)
|
||||||
|
|
||||||
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: true)
|
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: true)
|
||||||
|
|
||||||
@@ -389,7 +429,7 @@ class SUAppcastTest: XCTestCase {
|
|||||||
|
|
||||||
// This should not skip anything but allow failing minimum autoupdate version
|
// This should not skip anything but allow failing minimum autoupdate version
|
||||||
do {
|
do {
|
||||||
let skippedUpdate = SPUSkippedUpdate(minorVersion: "1.5", majorVersion: nil)
|
let skippedUpdate = SPUSkippedUpdate(minorVersion: "1.5", majorVersion: nil, majorSubreleaseVersion: nil)
|
||||||
|
|
||||||
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: false)
|
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: false)
|
||||||
|
|
||||||
@@ -402,7 +442,7 @@ class SUAppcastTest: XCTestCase {
|
|||||||
|
|
||||||
// This should not skip anything but require passing minimum autoupdate version
|
// This should not skip anything but require passing minimum autoupdate version
|
||||||
do {
|
do {
|
||||||
let skippedUpdate = SPUSkippedUpdate(minorVersion: "1.5", majorVersion: "1.0")
|
let skippedUpdate = SPUSkippedUpdate(minorVersion: "1.5", majorVersion: "1.0", majorSubreleaseVersion: nil)
|
||||||
|
|
||||||
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: true)
|
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: true)
|
||||||
|
|
||||||
@@ -415,7 +455,7 @@ class SUAppcastTest: XCTestCase {
|
|||||||
|
|
||||||
// This should not skip anything but allow failing minimum autoupdate version
|
// This should not skip anything but allow failing minimum autoupdate version
|
||||||
do {
|
do {
|
||||||
let skippedUpdate = SPUSkippedUpdate(minorVersion: "1.5", majorVersion: "1.0")
|
let skippedUpdate = SPUSkippedUpdate(minorVersion: "1.5", majorVersion: "1.0", majorSubreleaseVersion: nil)
|
||||||
|
|
||||||
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: false)
|
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: false)
|
||||||
|
|
||||||
@@ -432,6 +472,226 @@ class SUAppcastTest: XCTestCase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testMinimumAutoupdateVersionAdvancedSkipping() {
|
||||||
|
let testURL = Bundle(for: SUAppcastTest.self).url(forResource: "testappcast_minimumAutoupdateVersionSkipping", withExtension: "xml")!
|
||||||
|
|
||||||
|
do {
|
||||||
|
let testData = try Data(contentsOf: testURL)
|
||||||
|
|
||||||
|
let versionComparator = SUStandardVersionComparator()
|
||||||
|
|
||||||
|
do {
|
||||||
|
// Test appcast without a filter
|
||||||
|
|
||||||
|
let hostVersion = "1.0"
|
||||||
|
|
||||||
|
let stateResolver = SPUAppcastItemStateResolver(hostVersion: hostVersion, applicationVersionComparator: versionComparator, standardVersionComparator: versionComparator)
|
||||||
|
let appcast = try SUAppcast(xmlData: testData, relativeTo: nil, stateResolver: stateResolver)
|
||||||
|
|
||||||
|
XCTAssertEqual(5, appcast.items.count)
|
||||||
|
}
|
||||||
|
|
||||||
|
let currentDate = Date()
|
||||||
|
// Because 3.0 has minimum autoupdate version of 3.0, and 4.0 has minimum autoupdate version of 4.0, we should be offered 2.0
|
||||||
|
do {
|
||||||
|
let hostVersion = "1.0"
|
||||||
|
|
||||||
|
let stateResolver = SPUAppcastItemStateResolver(hostVersion: hostVersion, applicationVersionComparator: versionComparator, standardVersionComparator: versionComparator)
|
||||||
|
let appcast = try SUAppcast(xmlData: testData, relativeTo: nil, stateResolver: stateResolver)
|
||||||
|
|
||||||
|
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: nil, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: true)
|
||||||
|
|
||||||
|
XCTAssertEqual(1, supportedAppcast.items.count)
|
||||||
|
|
||||||
|
let bestAppcastItem = SUAppcastDriver.bestItem(fromAppcastItems: supportedAppcast.items, getDeltaItem: nil, withHostVersion: hostVersion, comparator: versionComparator)
|
||||||
|
|
||||||
|
XCTAssertEqual(bestAppcastItem.versionString, "2.0")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow minimum autoupdate version to fail and only skip major version "3.0"
|
||||||
|
// This should skip all 3.x versions, but not 4.x versions nor 2.x versions
|
||||||
|
do {
|
||||||
|
let hostVersion = "1.0"
|
||||||
|
|
||||||
|
let stateResolver = SPUAppcastItemStateResolver(hostVersion: hostVersion, applicationVersionComparator: versionComparator, standardVersionComparator: versionComparator)
|
||||||
|
let appcast = try SUAppcast(xmlData: testData, relativeTo: nil, stateResolver: stateResolver)
|
||||||
|
|
||||||
|
let skippedUpdate = SPUSkippedUpdate(minorVersion: nil, majorVersion: "3.0", majorSubreleaseVersion: nil)
|
||||||
|
|
||||||
|
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: false)
|
||||||
|
|
||||||
|
XCTAssertEqual(3, supportedAppcast.items.count)
|
||||||
|
|
||||||
|
let bestAppcastItem = SUAppcastDriver.bestItem(fromAppcastItems: supportedAppcast.items, getDeltaItem: nil, withHostVersion: hostVersion, comparator: versionComparator)
|
||||||
|
|
||||||
|
XCTAssertEqual(bestAppcastItem.versionString, "4.1")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow minimum autoupdate version to pass and only skip major version "3.0"
|
||||||
|
// This should only return back the latest minor version available
|
||||||
|
do {
|
||||||
|
let hostVersion = "1.0"
|
||||||
|
|
||||||
|
let stateResolver = SPUAppcastItemStateResolver(hostVersion: hostVersion, applicationVersionComparator: versionComparator, standardVersionComparator: versionComparator)
|
||||||
|
let appcast = try SUAppcast(xmlData: testData, relativeTo: nil, stateResolver: stateResolver)
|
||||||
|
|
||||||
|
let skippedUpdate = SPUSkippedUpdate(minorVersion: nil, majorVersion: "3.0", majorSubreleaseVersion: nil)
|
||||||
|
|
||||||
|
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: true)
|
||||||
|
|
||||||
|
XCTAssertEqual(1, supportedAppcast.items.count)
|
||||||
|
|
||||||
|
let bestAppcastItem = SUAppcastDriver.bestItem(fromAppcastItems: supportedAppcast.items, getDeltaItem: nil, withHostVersion: hostVersion, comparator: versionComparator)
|
||||||
|
|
||||||
|
XCTAssertEqual(bestAppcastItem.versionString, "2.0")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow minimum autoupdate version to fail and only skip major version "4.0"
|
||||||
|
// This should skip all 3.x versions and 4.x versions but not 2.x versions
|
||||||
|
do {
|
||||||
|
let hostVersion = "1.0"
|
||||||
|
|
||||||
|
let stateResolver = SPUAppcastItemStateResolver(hostVersion: hostVersion, applicationVersionComparator: versionComparator, standardVersionComparator: versionComparator)
|
||||||
|
let appcast = try SUAppcast(xmlData: testData, relativeTo: nil, stateResolver: stateResolver)
|
||||||
|
|
||||||
|
let skippedUpdate = SPUSkippedUpdate(minorVersion: nil, majorVersion: "4.0", majorSubreleaseVersion: nil)
|
||||||
|
|
||||||
|
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: false)
|
||||||
|
|
||||||
|
XCTAssertEqual(1, supportedAppcast.items.count)
|
||||||
|
|
||||||
|
let bestAppcastItem = SUAppcastDriver.bestItem(fromAppcastItems: supportedAppcast.items, getDeltaItem: nil, withHostVersion: hostVersion, comparator: versionComparator)
|
||||||
|
|
||||||
|
XCTAssertEqual(bestAppcastItem.versionString, "2.0")
|
||||||
|
}
|
||||||
|
} catch let err as NSError {
|
||||||
|
NSLog("%@", err)
|
||||||
|
XCTFail(err.localizedDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func testMinimumAutoupdateVersionIgnoringSkipping() {
|
||||||
|
let testURL = Bundle(for: SUAppcastTest.self).url(forResource: "testappcast_minimumAutoupdateVersionSkipping2", withExtension: "xml")!
|
||||||
|
|
||||||
|
do {
|
||||||
|
let testData = try Data(contentsOf: testURL)
|
||||||
|
|
||||||
|
let versionComparator = SUStandardVersionComparator()
|
||||||
|
|
||||||
|
let currentDate = Date()
|
||||||
|
|
||||||
|
do {
|
||||||
|
let hostVersion = "1.0"
|
||||||
|
|
||||||
|
let stateResolver = SPUAppcastItemStateResolver(hostVersion: hostVersion, applicationVersionComparator: versionComparator, standardVersionComparator: versionComparator)
|
||||||
|
let appcast = try SUAppcast(xmlData: testData, relativeTo: nil, stateResolver: stateResolver)
|
||||||
|
|
||||||
|
// Allow minimum autoupdate version to fail and only skip major version "3.0" with no subrelease version
|
||||||
|
// This should skip all 3.x versions except for 3.9 which ignores skipped upgrades below 3.5, but not 4.x versions nor 2.x versions
|
||||||
|
do {
|
||||||
|
let skippedUpdate = SPUSkippedUpdate(minorVersion: nil, majorVersion: "3.0", majorSubreleaseVersion: nil)
|
||||||
|
|
||||||
|
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: false)
|
||||||
|
|
||||||
|
XCTAssertEqual(4, supportedAppcast.items.count)
|
||||||
|
|
||||||
|
XCTAssertEqual(supportedAppcast.items[0].versionString, "4.1")
|
||||||
|
XCTAssertEqual(supportedAppcast.items[1].versionString, "4.0")
|
||||||
|
XCTAssertEqual(supportedAppcast.items[2].versionString, "3.9")
|
||||||
|
XCTAssertEqual(supportedAppcast.items[3].versionString, "2.0")
|
||||||
|
|
||||||
|
let bestAppcastItem = SUAppcastDriver.bestItem(fromAppcastItems: supportedAppcast.items, getDeltaItem: nil, withHostVersion: hostVersion, comparator: versionComparator)
|
||||||
|
|
||||||
|
XCTAssertEqual(bestAppcastItem.versionString, "4.1")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow minimum autoupdate version to fail and only skip major version "3.0" with subrelease version 3.4
|
||||||
|
// This should skip all 3.x versions except for 3.9 which ignores skipped upgrades below 3.5, but not 4.x versions nor 2.x versions
|
||||||
|
do {
|
||||||
|
let skippedUpdate = SPUSkippedUpdate(minorVersion: nil, majorVersion: "3.4", majorSubreleaseVersion: nil)
|
||||||
|
|
||||||
|
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: false)
|
||||||
|
|
||||||
|
XCTAssertEqual(4, supportedAppcast.items.count)
|
||||||
|
|
||||||
|
XCTAssertEqual(supportedAppcast.items[0].versionString, "4.1")
|
||||||
|
XCTAssertEqual(supportedAppcast.items[1].versionString, "4.0")
|
||||||
|
XCTAssertEqual(supportedAppcast.items[2].versionString, "3.9")
|
||||||
|
XCTAssertEqual(supportedAppcast.items[3].versionString, "2.0")
|
||||||
|
|
||||||
|
let bestAppcastItem = SUAppcastDriver.bestItem(fromAppcastItems: supportedAppcast.items, getDeltaItem: nil, withHostVersion: hostVersion, comparator: versionComparator)
|
||||||
|
|
||||||
|
XCTAssertEqual(bestAppcastItem.versionString, "4.1")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow minimum autoupdate version to fail and only skip major version "3.0" with subrelease version 3.5
|
||||||
|
// This should skip all 3.x versions, but not 4.x versions nor 2.x versions
|
||||||
|
do {
|
||||||
|
let skippedUpdate = SPUSkippedUpdate(minorVersion: nil, majorVersion: "3.0", majorSubreleaseVersion: "3.5")
|
||||||
|
|
||||||
|
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: false)
|
||||||
|
|
||||||
|
XCTAssertEqual(3, supportedAppcast.items.count)
|
||||||
|
|
||||||
|
XCTAssertEqual(supportedAppcast.items[0].versionString, "4.1")
|
||||||
|
XCTAssertEqual(supportedAppcast.items[1].versionString, "4.0")
|
||||||
|
XCTAssertEqual(supportedAppcast.items[2].versionString, "2.0")
|
||||||
|
|
||||||
|
let bestAppcastItem = SUAppcastDriver.bestItem(fromAppcastItems: supportedAppcast.items, getDeltaItem: nil, withHostVersion: hostVersion, comparator: versionComparator)
|
||||||
|
|
||||||
|
XCTAssertEqual(bestAppcastItem.versionString, "4.1")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow minimum autoupdate version to fail and only skip major version "3.0" with subrelease version 3.5.1
|
||||||
|
// This should skip all 3.x versions, but not 4.x versions nor 2.x versions
|
||||||
|
do {
|
||||||
|
let skippedUpdate = SPUSkippedUpdate(minorVersion: nil, majorVersion: "3.0", majorSubreleaseVersion: "3.5.1")
|
||||||
|
|
||||||
|
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: false)
|
||||||
|
|
||||||
|
XCTAssertEqual(3, supportedAppcast.items.count)
|
||||||
|
|
||||||
|
XCTAssertEqual(supportedAppcast.items[0].versionString, "4.1")
|
||||||
|
XCTAssertEqual(supportedAppcast.items[1].versionString, "4.0")
|
||||||
|
XCTAssertEqual(supportedAppcast.items[2].versionString, "2.0")
|
||||||
|
|
||||||
|
let bestAppcastItem = SUAppcastDriver.bestItem(fromAppcastItems: supportedAppcast.items, getDeltaItem: nil, withHostVersion: hostVersion, comparator: versionComparator)
|
||||||
|
|
||||||
|
XCTAssertEqual(bestAppcastItem.versionString, "4.1")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow minimum autoupdate version to fail and only skip major version "4.0" with subrelease version 4.0
|
||||||
|
// This should skip all 3.x versions and 4.x versions, but not 2.x versions
|
||||||
|
do {
|
||||||
|
let skippedUpdate = SPUSkippedUpdate(minorVersion: nil, majorVersion: "4.0", majorSubreleaseVersion: "4.0")
|
||||||
|
|
||||||
|
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: false)
|
||||||
|
|
||||||
|
XCTAssertEqual(1, supportedAppcast.items.count)
|
||||||
|
|
||||||
|
XCTAssertEqual(supportedAppcast.items[0].versionString, "2.0")
|
||||||
|
|
||||||
|
let bestAppcastItem = SUAppcastDriver.bestItem(fromAppcastItems: supportedAppcast.items, getDeltaItem: nil, withHostVersion: hostVersion, comparator: versionComparator)
|
||||||
|
|
||||||
|
XCTAssertEqual(bestAppcastItem.versionString, "2.0")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow minimum autoupdate version to fail and only skip major version "4.0" with subrelease version 4.0, and skip minor version 2.1
|
||||||
|
// This should skip everything
|
||||||
|
do {
|
||||||
|
let skippedUpdate = SPUSkippedUpdate(minorVersion: "2.1", majorVersion: "4.0", majorSubreleaseVersion: "4.0")
|
||||||
|
|
||||||
|
let supportedAppcast = SUAppcastDriver.filterSupportedAppcast(appcast, phasedUpdateGroup: nil, skippedUpdate: skippedUpdate, currentDate: currentDate, hostVersion: hostVersion, versionComparator: versionComparator, testOSVersion: true, testMinimumAutoupdateVersion: false)
|
||||||
|
|
||||||
|
XCTAssertEqual(0, supportedAppcast.items.count)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch let err as NSError {
|
||||||
|
NSLog("%@", err)
|
||||||
|
XCTFail(err.localizedDescription)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func testPhasedGroupRollouts() {
|
func testPhasedGroupRollouts() {
|
||||||
let testURL = Bundle(for: SUAppcastTest.self).url(forResource: "testappcast_phasedRollout", withExtension: "xml")!
|
let testURL = Bundle(for: SUAppcastTest.self).url(forResource: "testappcast_phasedRollout", withExtension: "xml")!
|
||||||
|
|
||||||
|
|||||||
+802
-43
File diff suppressed because it is too large.
Load diff
@@ -31,6 +31,9 @@
|
|||||||
SUAssertDescending(comparator, @"0.1", @"0.0.1");
|
SUAssertDescending(comparator, @"0.1", @"0.0.1");
|
||||||
//SUAssertDescending(comparator, @".1", @"0.0.1"); Known bug, but I'm not sure I care.
|
//SUAssertDescending(comparator, @".1", @"0.0.1"); Known bug, but I'm not sure I care.
|
||||||
SUAssertAscending(comparator, @"0.1", @"0.1.2");
|
SUAssertAscending(comparator, @"0.1", @"0.1.2");
|
||||||
|
|
||||||
|
SUAssertEqual(comparator, @"1.0", @"1.0.0");
|
||||||
|
SUAssertEqual(comparator, @"1.0.0", @"1.0");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testCommitSHAs
|
- (void)testCommitSHAs
|
||||||
@@ -40,6 +43,9 @@
|
|||||||
SUAssertAscending(comparator, @"1.5.5-335d3e2", @"1.5.6-b252311");
|
SUAssertAscending(comparator, @"1.5.5-335d3e2", @"1.5.6-b252311");
|
||||||
SUAssertEqual(comparator, @"1.5.5-335d3e2", @"1.5.5-a655360");
|
SUAssertEqual(comparator, @"1.5.5-335d3e2", @"1.5.5-a655360");
|
||||||
SUAssertDescending(comparator, @"1.5.6-b252311", @"1.5.5-335d3e2");
|
SUAssertDescending(comparator, @"1.5.6-b252311", @"1.5.5-335d3e2");
|
||||||
|
|
||||||
|
SUAssertEqual(comparator, @"1.5-335d3e2", @"1.5.0-335d3e2");
|
||||||
|
SUAssertEqual(comparator, @"1.5.0-335d3e2", @"1.5-335d3e2");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testPrereleases
|
- (void)testPrereleases
|
||||||
@@ -59,6 +65,9 @@
|
|||||||
SUAssertAscending(comparator, @"1.0rc", @"1.0");
|
SUAssertAscending(comparator, @"1.0rc", @"1.0");
|
||||||
SUAssertAscending(comparator, @"1.0b", @"1.0");
|
SUAssertAscending(comparator, @"1.0b", @"1.0");
|
||||||
SUAssertAscending(comparator, @"1.0pre1", @"1.0");
|
SUAssertAscending(comparator, @"1.0pre1", @"1.0");
|
||||||
|
|
||||||
|
SUAssertEqual(comparator, @"1.0pre1", @"1.0.0pre1");
|
||||||
|
SUAssertEqual(comparator, @"1.0.0pre1", @"1.0pre1");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testVersionsWithBuildNumbers
|
- (void)testVersionsWithBuildNumbers
|
||||||
@@ -74,6 +83,13 @@
|
|||||||
SUAssertAscending(comparator, @"1.1.1.1818", @"2.0.0.2430");
|
SUAssertAscending(comparator, @"1.1.1.1818", @"2.0.0.2430");
|
||||||
|
|
||||||
SUAssertAscending(comparator, @"3.3 (5847)", @"3.3.1b1 (5902)");
|
SUAssertAscending(comparator, @"3.3 (5847)", @"3.3.1b1 (5902)");
|
||||||
|
|
||||||
|
SUAssertEqual(comparator, @"3.3 (5847)", @"3.3.0 (5847)");
|
||||||
|
SUAssertEqual(comparator, @"3.3.0 (5847)", @"3.3 (5847)");
|
||||||
|
SUAssertEqual(comparator, @"1.1.1.1818", @"1.1.1.1818.0");
|
||||||
|
SUAssertEqual(comparator, @"1.1.1.1818.0", @"1.1.1.1818");
|
||||||
|
SUAssertEqual(comparator, @"3.3b1 (5902)", @"3.3.0b1 (5902)");
|
||||||
|
SUAssertEqual(comparator, @"3.3.0b1 (5902)", @"3.3b1 (5902)");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testWordsWithSpaceInFront
|
- (void)testWordsWithSpaceInFront
|
||||||
@@ -92,6 +108,9 @@
|
|||||||
SUStandardVersionComparator *comparator = [[SUStandardVersionComparator alloc] init];
|
SUStandardVersionComparator *comparator = [[SUStandardVersionComparator alloc] init];
|
||||||
|
|
||||||
SUAssertAscending(comparator, @"201210251627", @"201211051041");
|
SUAssertAscending(comparator, @"201210251627", @"201211051041");
|
||||||
|
|
||||||
|
SUAssertEqual(comparator, @"201210251627.0", @"201210251627");
|
||||||
|
SUAssertEqual(comparator, @"201210251627", @"201210251627.0");
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -8,6 +8,9 @@
|
|||||||
|
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
|
// The debugger may catch the Test app receiving a SIGTERM signal when Sparkle quits the app before installing the new one
|
||||||
|
// So you may have better luck running these tests from the command line without the debugger attached:
|
||||||
|
// xcodebuild -scheme UITests -configuration Debug test
|
||||||
class SUTestApplicationTest: XCTestCase
|
class SUTestApplicationTest: XCTestCase
|
||||||
{
|
{
|
||||||
// TODO: don't hardcode bundle ID?
|
// TODO: don't hardcode bundle ID?
|
||||||
@@ -20,24 +23,30 @@ class SUTestApplicationTest: XCTestCase
|
|||||||
return runningApplications[0]
|
return runningApplications[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
// The debugger may catch the Test app receiving a SIGTERM signal when Sparkle quits the app before installing the new one
|
func runTestApplication(testMode: String, automatic: Bool, expectedFinalVersion: String, launchSleep: UInt32, extractSleep: UInt32) {
|
||||||
// So you may have better luck running this test from the command line without the debugger attached:
|
|
||||||
// xcodebuild -scheme UITests -configuration Debug test
|
|
||||||
func testRegularUpdate()
|
|
||||||
{
|
|
||||||
let app = XCUIApplication()
|
let app = XCUIApplication()
|
||||||
app.launchArguments = [
|
app.launchArguments = [
|
||||||
"-AppleLanguages",
|
"-AppleLanguages",
|
||||||
"(en)"
|
"(en)",
|
||||||
|
"-SUHasLaunchedBefore",
|
||||||
|
automatic ? "YES" : "NO",
|
||||||
|
"-SUEnableAutomaticChecks",
|
||||||
|
automatic ? "YES" : "NO",
|
||||||
|
"-SUAutomaticallyUpdate",
|
||||||
|
automatic ? "YES" : "NO",
|
||||||
|
"-SUScheduledCheckInterval",
|
||||||
|
"60"
|
||||||
]
|
]
|
||||||
|
app.launchEnvironment = ["TEST_MODE": testMode]
|
||||||
app.launch()
|
app.launch()
|
||||||
|
|
||||||
XCTAssertFalse(app.dialogs["alert"].staticTexts["Update succeeded!"].exists, "Update is already installed; please do a clean build")
|
XCTAssertFalse(app.dialogs["alert"].staticTexts["Update succeeded!"].exists, "Update is already installed; please do a clean build")
|
||||||
|
|
||||||
let initialRunningApplication = runningTestApplication()
|
let initialRunningApplication = runningTestApplication()
|
||||||
|
let bundleURL = initialRunningApplication.bundleURL!
|
||||||
|
|
||||||
// Give some time for the Test App to initialize its web server, create an update, and start its updater
|
// Give some time for the Test App to initialize its web server, create an update, and start its updater
|
||||||
sleep(60)
|
sleep(launchSleep)
|
||||||
|
|
||||||
let menuBarsQuery = app.menuBars
|
let menuBarsQuery = app.menuBars
|
||||||
menuBarsQuery.menuBarItems["Sparkle Test App"].click()
|
menuBarsQuery.menuBarItems["Sparkle Test App"].click()
|
||||||
@@ -50,14 +59,21 @@ class SUTestApplicationTest: XCTestCase
|
|||||||
// in this case click the main menu again to deactivate it
|
// in this case click the main menu again to deactivate it
|
||||||
menuBarsQuery.menuBarItems["Sparkle Test App"].click()
|
menuBarsQuery.menuBarItems["Sparkle Test App"].click()
|
||||||
}
|
}
|
||||||
|
|
||||||
app.windows["SUUpdateAlert"].buttons["Install Update"].click()
|
|
||||||
|
|
||||||
// Give some time for the update to finish downloading / extracting
|
if !automatic {
|
||||||
sleep(30)
|
app.windows["SUUpdateAlert"].buttons["Install Update"].click()
|
||||||
|
|
||||||
|
// Give some time for the update to finish downloading / extracting
|
||||||
|
sleep(extractSleep)
|
||||||
|
|
||||||
|
app.windows["SUStatus"].buttons["Install and Relaunch"].click()
|
||||||
|
} else {
|
||||||
|
XCTAssertTrue(app.windows["SUUpdateAlert"].buttons["Install and Relaunch"].exists)
|
||||||
|
|
||||||
|
// The app should install automatically on termination
|
||||||
|
app.terminate()
|
||||||
|
}
|
||||||
|
|
||||||
app.windows["SUStatus"].buttons["Install and Relaunch"].click()
|
|
||||||
|
|
||||||
// Wait for the new updated app to finish launching so we can test if it's the frontmost app
|
// Wait for the new updated app to finish launching so we can test if it's the frontmost app
|
||||||
sleep(10)
|
sleep(10)
|
||||||
|
|
||||||
@@ -66,19 +82,35 @@ class SUTestApplicationTest: XCTestCase
|
|||||||
// Our new updated app should be launched now. Test if it's the active app and the old app is terminated.
|
// Our new updated app should be launched now. Test if it's the active app and the old app is terminated.
|
||||||
// We used to run into timing issues where the updated app sometimes may not show up as the frontmost one
|
// We used to run into timing issues where the updated app sometimes may not show up as the frontmost one
|
||||||
XCTAssertTrue(initialRunningApplication.isTerminated)
|
XCTAssertTrue(initialRunningApplication.isTerminated)
|
||||||
|
|
||||||
let newRunningApplication = self.runningTestApplication()
|
|
||||||
XCTAssertTrue(newRunningApplication.isActive)
|
|
||||||
|
|
||||||
// Verify the new bundle version
|
// Verify the new bundle version
|
||||||
|
|
||||||
let infoCFDictionary = CFBundleCopyInfoDictionaryInDirectory(newRunningApplication.bundleURL! as CFURL)
|
let infoCFDictionary = CFBundleCopyInfoDictionaryInDirectory(bundleURL as CFURL)
|
||||||
let infoDictionary = infoCFDictionary! as Dictionary
|
let infoDictionary = infoCFDictionary! as Dictionary
|
||||||
|
|
||||||
let updatedVersion = infoDictionary[kCFBundleVersionKey] as! String
|
let updatedVersion = infoDictionary[kCFBundleVersionKey] as! String
|
||||||
XCTAssertEqual(updatedVersion, "2.0")
|
XCTAssertEqual(updatedVersion, expectedFinalVersion)
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
newRunningApplication.forceTerminate()
|
if !automatic {
|
||||||
|
let newRunningApplication = self.runningTestApplication()
|
||||||
|
XCTAssertTrue(newRunningApplication.isActive)
|
||||||
|
|
||||||
|
newRunningApplication.forceTerminate()
|
||||||
|
}
|
||||||
|
|
||||||
|
sleep(10)
|
||||||
|
}
|
||||||
|
|
||||||
|
func test1RegularUpdate() {
|
||||||
|
runTestApplication(testMode: "REGULAR", automatic: false, expectedFinalVersion: "2.0", launchSleep: 60, extractSleep: 30)
|
||||||
|
}
|
||||||
|
|
||||||
|
func test2DeltaUpdate() {
|
||||||
|
runTestApplication(testMode: "DELTA", automatic: false, expectedFinalVersion: "2.1", launchSleep: 75, extractSleep: 45)
|
||||||
|
}
|
||||||
|
|
||||||
|
func test3AutomaticUpdate() {
|
||||||
|
runTestApplication(testMode: "AUTOMATIC", automatic: true, expectedFinalVersion: "2.2", launchSleep: 75, extractSleep: 30)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,10 +11,10 @@ func makeError(code: SUError, _ description: String) -> NSError {
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeAppcast(archivesSourceDir: URL, cacheDirectory cacheDir: URL, keys: PrivateKeys, versions: Set<String>?, maximumDeltas: Int, verbose: Bool) throws -> [String: [ArchiveItem]] {
|
func makeAppcast(archivesSourceDir: URL, cacheDirectory cacheDir: URL, keys: PrivateKeys, versions: Set<String>?, maximumDeltas: Int, deltaCompressionModeDescription: String, deltaCompressionLevel: UInt8, disableNestedCodeCheck: Bool, verbose: Bool) throws -> [String: [ArchiveItem]] {
|
||||||
let comparator = SUStandardVersionComparator()
|
let comparator = SUStandardVersionComparator()
|
||||||
|
|
||||||
let allUpdates = (try unarchiveUpdates(archivesSourceDir: archivesSourceDir, archivesDestDir: cacheDir, verbose: verbose))
|
let allUpdates = (try unarchiveUpdates(archivesSourceDir: archivesSourceDir, archivesDestDir: cacheDir, disableNestedCodeCheck: disableNestedCodeCheck, verbose: verbose))
|
||||||
.sorted(by: {
|
.sorted(by: {
|
||||||
.orderedDescending == comparator.compareVersion($0.version, toVersion: $1.version)
|
.orderedDescending == comparator.compareVersion($0.version, toVersion: $1.version)
|
||||||
})
|
})
|
||||||
@@ -108,8 +108,70 @@ func makeAppcast(archivesSourceDir: URL, cacheDirectory cacheDir: URL, keys: Pri
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if !fm.fileExists(atPath: deltaPath.path) {
|
if !fm.fileExists(atPath: deltaPath.path) {
|
||||||
|
// Test if old and new app have the same code signing signature. If not, omit a warning.
|
||||||
|
// This is a good time to do this check because our delta handling code sets a marker
|
||||||
|
// to avoid this path each time generate_appcast is called.
|
||||||
|
let oldAppCodeSigned = SUCodeSigningVerifier.bundle(atURLIsCodeSigned: item.appPath)
|
||||||
|
let newAppCodeSigned = SUCodeSigningVerifier.bundle(atURLIsCodeSigned: latestItem.appPath)
|
||||||
|
|
||||||
|
if oldAppCodeSigned != newAppCodeSigned && !newAppCodeSigned {
|
||||||
|
print("Warning: New app is not code signed but older version (\(item)) is: \(latestItem)")
|
||||||
|
} else if oldAppCodeSigned && newAppCodeSigned {
|
||||||
|
do {
|
||||||
|
try SUCodeSigningVerifier.codeSignature(atBundleURL: item.appPath, matchesSignatureAtBundleURL: latestItem.appPath)
|
||||||
|
} catch {
|
||||||
|
print("Warning: found mismatch code signing identity between \(item) and \(latestItem)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
delta = try DeltaUpdate.create(from: item, to: latestItem, archivePath: deltaPath)
|
// Decide the most appropriate delta version
|
||||||
|
let deltaVersion: SUBinaryDeltaMajorVersion
|
||||||
|
if let frameworkVersion = item.frameworkVersion {
|
||||||
|
switch comparator.compareVersion(frameworkVersion, toVersion: "2010") {
|
||||||
|
case .orderedSame:
|
||||||
|
fallthrough
|
||||||
|
case .orderedDescending:
|
||||||
|
deltaVersion = .version3
|
||||||
|
case .orderedAscending:
|
||||||
|
deltaVersion = .version2
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
deltaVersion = SUBinaryDeltaMajorVersionDefault
|
||||||
|
print("Warning: Sparkle.framework version for \(item.appPath.lastPathComponent) (\(item.shortVersion) (\(item.version))) was not found. Falling back to generating delta using default delta version..")
|
||||||
|
}
|
||||||
|
|
||||||
|
let requestedDeltaCompressionMode = deltaCompressionModeFromDescription(deltaCompressionModeDescription, nil)
|
||||||
|
|
||||||
|
// Version 2 formats only support bzip2, none, and default options
|
||||||
|
let deltaCompressionMode: SPUDeltaCompressionMode
|
||||||
|
if deltaVersion == .version2 {
|
||||||
|
switch requestedDeltaCompressionMode {
|
||||||
|
case .LZFSE:
|
||||||
|
fallthrough
|
||||||
|
case .LZ4:
|
||||||
|
fallthrough
|
||||||
|
case .LZMA:
|
||||||
|
fallthrough
|
||||||
|
case .ZLIB:
|
||||||
|
deltaCompressionMode = .bzip2
|
||||||
|
print("Warning: Delta compression mode '\(deltaCompressionModeDescription)' was requested but using default compression instead because version 2 delta file from version \(item.version) needs to be generated..")
|
||||||
|
case SPUDeltaCompressionModeDefault:
|
||||||
|
fallthrough
|
||||||
|
case .none:
|
||||||
|
fallthrough
|
||||||
|
case .bzip2:
|
||||||
|
deltaCompressionMode = requestedDeltaCompressionMode
|
||||||
|
@unknown default:
|
||||||
|
// This shouldn't happen
|
||||||
|
print("Warning: failed to parse delta compression mode \(deltaCompressionModeDescription). There is a logic bug in generate_appcast.")
|
||||||
|
deltaCompressionMode = SPUDeltaCompressionModeDefault
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
deltaCompressionMode = requestedDeltaCompressionMode
|
||||||
|
}
|
||||||
|
|
||||||
|
delta = try DeltaUpdate.create(from: item, to: latestItem, deltaVersion: deltaVersion, deltaCompressionMode: deltaCompressionMode, deltaCompressionLevel: deltaCompressionLevel, archivePath: deltaPath)
|
||||||
} catch {
|
} catch {
|
||||||
print("Could not create delta update", deltaPath.path, error)
|
print("Could not create delta update", deltaPath.path, error)
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -5,9 +5,6 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
// CDATA text must contain less characters than this threshold
|
|
||||||
let CDATA_HTML_FRAGMENT_THRESHOLD = 1000
|
|
||||||
|
|
||||||
class DeltaUpdate {
|
class DeltaUpdate {
|
||||||
let fromVersion: String
|
let fromVersion: String
|
||||||
let archivePath: URL
|
let archivePath: URL
|
||||||
@@ -24,12 +21,27 @@ class DeltaUpdate {
|
|||||||
return (archiveFileAttributes[.size] as! NSNumber).int64Value
|
return (archiveFileAttributes[.size] as! NSNumber).int64Value
|
||||||
}
|
}
|
||||||
|
|
||||||
class func create(from: ArchiveItem, to: ArchiveItem, archivePath: URL) throws -> DeltaUpdate {
|
class func create(from: ArchiveItem, to: ArchiveItem, deltaVersion: SUBinaryDeltaMajorVersion, deltaCompressionMode: SPUDeltaCompressionMode, deltaCompressionLevel: UInt8, archivePath: URL) throws -> DeltaUpdate {
|
||||||
var applyDiffError: NSError?
|
var createDiffError: NSError?
|
||||||
|
|
||||||
if !createBinaryDelta(from.appPath.path, to.appPath.path, archivePath.path, .version2, false, &applyDiffError) {
|
if !createBinaryDelta(from.appPath.path, to.appPath.path, archivePath.path, deltaVersion, deltaCompressionMode, deltaCompressionLevel, false, &createDiffError) {
|
||||||
|
throw createDiffError!
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure applying the diff also succeeds
|
||||||
|
let fileManager = FileManager.default
|
||||||
|
|
||||||
|
let tempApplyToPath = to.appPath.deletingLastPathComponent().appendingPathComponent(".temp_" + to.appPath.lastPathComponent)
|
||||||
|
let _ = try? fileManager.removeItem(at: tempApplyToPath)
|
||||||
|
|
||||||
|
var applyDiffError: NSError?
|
||||||
|
if !applyBinaryDelta(from.appPath.path, tempApplyToPath.path, archivePath.path, false, { _ in
|
||||||
|
}, &applyDiffError) {
|
||||||
|
let _ = try? fileManager.removeItem(at: archivePath)
|
||||||
throw applyDiffError!
|
throw applyDiffError!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let _ = try? fileManager.removeItem(at: tempApplyToPath)
|
||||||
|
|
||||||
return DeltaUpdate(fromVersion: from.version, archivePath: archivePath)
|
return DeltaUpdate(fromVersion: from.version, archivePath: archivePath)
|
||||||
}
|
}
|
||||||
@@ -40,6 +52,7 @@ class ArchiveItem: CustomStringConvertible {
|
|||||||
// swiftlint:disable identifier_name
|
// swiftlint:disable identifier_name
|
||||||
let _shortVersion: String?
|
let _shortVersion: String?
|
||||||
let minimumSystemVersion: String
|
let minimumSystemVersion: String
|
||||||
|
let frameworkVersion: String?
|
||||||
let archivePath: URL
|
let archivePath: URL
|
||||||
let appPath: URL
|
let appPath: URL
|
||||||
let feedURL: URL?
|
let feedURL: URL?
|
||||||
@@ -53,11 +66,12 @@ class ArchiveItem: CustomStringConvertible {
|
|||||||
var downloadUrlPrefix: URL?
|
var downloadUrlPrefix: URL?
|
||||||
var releaseNotesURLPrefix: URL?
|
var releaseNotesURLPrefix: URL?
|
||||||
|
|
||||||
init(version: String, shortVersion: String?, feedURL: URL?, minimumSystemVersion: String?, publicEdKey: String?, supportsDSA: Bool, appPath: URL, archivePath: URL) throws {
|
init(version: String, shortVersion: String?, feedURL: URL?, minimumSystemVersion: String?, frameworkVersion: String?, publicEdKey: String?, supportsDSA: Bool, appPath: URL, archivePath: URL) throws {
|
||||||
self.version = version
|
self.version = version
|
||||||
self._shortVersion = shortVersion
|
self._shortVersion = shortVersion
|
||||||
self.feedURL = feedURL
|
self.feedURL = feedURL
|
||||||
self.minimumSystemVersion = minimumSystemVersion ?? "10.11"
|
self.minimumSystemVersion = minimumSystemVersion ?? "10.11"
|
||||||
|
self.frameworkVersion = frameworkVersion
|
||||||
self.archivePath = archivePath
|
self.archivePath = archivePath
|
||||||
self.appPath = appPath
|
self.appPath = appPath
|
||||||
self.supportsDSA = supportsDSA
|
self.supportsDSA = supportsDSA
|
||||||
@@ -71,7 +85,7 @@ class ArchiveItem: CustomStringConvertible {
|
|||||||
self.deltas = []
|
self.deltas = []
|
||||||
}
|
}
|
||||||
|
|
||||||
convenience init(fromArchive archivePath: URL, unarchivedDir: URL) throws {
|
convenience init(fromArchive archivePath: URL, unarchivedDir: URL, validateBundle: Bool, disableNestedCodeCheck: Bool) throws {
|
||||||
let resourceKeys = [URLResourceKey.typeIdentifierKey]
|
let resourceKeys = [URLResourceKey.typeIdentifierKey]
|
||||||
let items = try FileManager.default.contentsOfDirectory(at: unarchivedDir, includingPropertiesForKeys: resourceKeys, options: .skipsHiddenFiles)
|
let items = try FileManager.default.contentsOfDirectory(at: unarchivedDir, includingPropertiesForKeys: resourceKeys, options: .skipsHiddenFiles)
|
||||||
|
|
||||||
@@ -88,6 +102,12 @@ class ArchiveItem: CustomStringConvertible {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let appPath = bundles[0]
|
let appPath = bundles[0]
|
||||||
|
|
||||||
|
// If requested to validate the bundle, ensure it is properly signed
|
||||||
|
if validateBundle && SUCodeSigningVerifier.bundle(atURLIsCodeSigned: appPath) {
|
||||||
|
try SUCodeSigningVerifier.codeSignatureIsValid(atBundleURL: appPath, checkNestedCode: !disableNestedCodeCheck)
|
||||||
|
}
|
||||||
|
|
||||||
guard let infoPlist = NSDictionary(contentsOf: appPath.appendingPathComponent("Contents/Info.plist")) else {
|
guard let infoPlist = NSDictionary(contentsOf: appPath.appendingPathComponent("Contents/Info.plist")) else {
|
||||||
throw makeError(code: .unarchivingError, "No plist \(appPath.path)")
|
throw makeError(code: .unarchivingError, "No plist \(appPath.path)")
|
||||||
}
|
}
|
||||||
@@ -106,11 +126,28 @@ class ArchiveItem: CustomStringConvertible {
|
|||||||
feedURL = feedURL!.appendingPathComponent("appcast.xml")
|
feedURL = feedURL!.appendingPathComponent("appcast.xml")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var frameworkVersion: String? = nil
|
||||||
|
if let appBundle = Bundle(url: appPath), let frameworksURL = appBundle.privateFrameworksURL {
|
||||||
|
let sparkleBundleURL = frameworksURL.appendingPathComponent("Sparkle").appendingPathExtension("framework")
|
||||||
|
|
||||||
|
if let sparkleBundle = Bundle(url: sparkleBundleURL), let infoDictionary = sparkleBundle.infoDictionary {
|
||||||
|
frameworkVersion = infoDictionary[kCFBundleVersionKey as String] as? String
|
||||||
|
} else {
|
||||||
|
// Try legacy SparkleCore framework that was shipping in early 2.0 betas
|
||||||
|
let sparkleCoreBundleURL = frameworksURL.appendingPathComponent("SparkleCore").appendingPathExtension("framework")
|
||||||
|
|
||||||
|
if let sparkleBundle = Bundle(url: sparkleCoreBundleURL), let infoDictionary = sparkleBundle.infoDictionary {
|
||||||
|
frameworkVersion = infoDictionary[kCFBundleVersionKey as String] as? String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
try self.init(version: version,
|
try self.init(version: version,
|
||||||
shortVersion: shortVersion,
|
shortVersion: shortVersion,
|
||||||
feedURL: feedURL,
|
feedURL: feedURL,
|
||||||
minimumSystemVersion: infoPlist["LSMinimumSystemVersion"] as? String,
|
minimumSystemVersion: infoPlist["LSMinimumSystemVersion"] as? String,
|
||||||
|
frameworkVersion: frameworkVersion,
|
||||||
publicEdKey: publicEdKey,
|
publicEdKey: publicEdKey,
|
||||||
supportsDSA: supportsDSA,
|
supportsDSA: supportsDSA,
|
||||||
appPath: appPath,
|
appPath: appPath,
|
||||||
@@ -165,9 +202,9 @@ class ArchiveItem: CustomStringConvertible {
|
|||||||
return releaseNotes
|
return releaseNotes
|
||||||
}
|
}
|
||||||
|
|
||||||
private func getReleaseNotesAsHTMLFragment(_ path: URL) -> String? {
|
private func getReleaseNotesAsHTMLFragment(_ path: URL, _ maxCDATAThreshold: Int) -> String? {
|
||||||
if let html = try? String(contentsOf: path) {
|
if let html = try? String(contentsOf: path) {
|
||||||
if html.utf8.count < CDATA_HTML_FRAGMENT_THRESHOLD &&
|
if html.utf8.count <= maxCDATAThreshold &&
|
||||||
!html.localizedCaseInsensitiveContains("<!DOCTYPE") &&
|
!html.localizedCaseInsensitiveContains("<!DOCTYPE") &&
|
||||||
!html.localizedCaseInsensitiveContains("<body") {
|
!html.localizedCaseInsensitiveContains("<body") {
|
||||||
return html
|
return html
|
||||||
@@ -175,20 +212,20 @@ class ArchiveItem: CustomStringConvertible {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var releaseNotesHTML: String? {
|
func releaseNotesHTML(maxCDATAThreshold: Int) -> String? {
|
||||||
if let path = self.releaseNotesPath {
|
if let path = self.releaseNotesPath {
|
||||||
return self.getReleaseNotesAsHTMLFragment(path)
|
return self.getReleaseNotesAsHTMLFragment(path, maxCDATAThreshold)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var releaseNotesURL: URL? {
|
func releaseNotesURL(maxCDATAThreshold: Int) -> URL? {
|
||||||
guard let path = self.releaseNotesPath else {
|
guard let path = self.releaseNotesPath else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// The file is already used as inline description
|
// The file is already used as inline description
|
||||||
if self.getReleaseNotesAsHTMLFragment(path) != nil {
|
if self.getReleaseNotesAsHTMLFragment(path, maxCDATAThreshold) != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return self.releaseNoteURL(for: path.lastPathComponent)
|
return self.releaseNoteURL(for: path.lastPathComponent)
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
#import "SUUnarchiver.h"
|
#import "SUUnarchiver.h"
|
||||||
#import "SUBinaryDeltaUnarchiver.h"
|
#import "SUBinaryDeltaUnarchiver.h"
|
||||||
#import "SUBinaryDeltaCreate.h"
|
#import "SUBinaryDeltaCreate.h"
|
||||||
|
#import "SUBinaryDeltaApply.h"
|
||||||
|
#import "SUBinaryDeltaCommon.h"
|
||||||
#import "SUSignatures.h"
|
#import "SUSignatures.h"
|
||||||
|
#import "SUCodeSigningVerifier.h"
|
||||||
#import "SPUInstallationType.h"
|
#import "SPUInstallationType.h"
|
||||||
#import "ed25519.h" // Run `git submodule update --init` if you get an error here
|
#import "ed25519.h" // Run `git submodule update --init` if you get an error here
|
||||||
@@ -49,7 +49,7 @@ func extractVersion(parent: XMLNode) -> String? {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem], newVersions: Set<String>?, maxNewVersionsInFeed: Int, fullReleaseNotesLink: String?, link: String?, newChannel: String?, majorVersion: String?, phasedRolloutInterval: Int?, criticalUpdateVersion: String?, informationalUpdateVersions: [String]?) throws -> (numNewUpdates: Int, numExistingUpdates: Int) {
|
func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem], newVersions: Set<String>?, maxNewVersionsInFeed: Int, fullReleaseNotesLink: String?, maxCDATAThreshold: Int, link: String?, newChannel: String?, majorVersion: String?, ignoreSkippedUpgradesBelowVersion: String?, phasedRolloutInterval: Int?, criticalUpdateVersion: String?, informationalUpdateVersions: [String]?) throws -> (numNewUpdates: Int, numExistingUpdates: Int) {
|
||||||
let appBaseName = updates[0].appPath.deletingPathExtension().lastPathComponent
|
let appBaseName = updates[0].appPath.deletingPathExtension().lastPathComponent
|
||||||
|
|
||||||
let sparkleNS = "http://www.andymatuschak.org/xml-namespaces/sparkle"
|
let sparkleNS = "http://www.andymatuschak.org/xml-namespaces/sparkle"
|
||||||
@@ -188,6 +188,12 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem], newVersions: Set
|
|||||||
item.addChild(minimumAutoupdateVersionElement)
|
item.addChild(minimumAutoupdateVersionElement)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set ignore skipped upgrades below version
|
||||||
|
if let ignoreSkippedUpgradesBelowVersion = ignoreSkippedUpgradesBelowVersion, let ignoreSkippedUpgradesBelowVersionElement = XMLElement.element(withName: SUAppcastElementIgnoreSkippedUpgradesBelowVersion, uri: sparkleNS) as? XMLElement {
|
||||||
|
ignoreSkippedUpgradesBelowVersionElement.setChildren([text(ignoreSkippedUpgradesBelowVersion)])
|
||||||
|
item.addChild(ignoreSkippedUpgradesBelowVersionElement)
|
||||||
|
}
|
||||||
|
|
||||||
// Set phased rollout interval
|
// Set phased rollout interval
|
||||||
if let phasedRolloutInterval = phasedRolloutInterval,
|
if let phasedRolloutInterval = phasedRolloutInterval,
|
||||||
let phasedRolloutIntervalElement = XMLElement.element(withName: SUAppcastElementPhasedRolloutInterval, uri: sparkleNS) as? XMLElement {
|
let phasedRolloutIntervalElement = XMLElement.element(withName: SUAppcastElementPhasedRolloutInterval, uri: sparkleNS) as? XMLElement {
|
||||||
@@ -208,8 +214,17 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem], newVersions: Set
|
|||||||
if let informationalUpdateVersions = informationalUpdateVersions,
|
if let informationalUpdateVersions = informationalUpdateVersions,
|
||||||
let informationalUpdateElement = XMLElement.element(withName: SUAppcastElementInformationalUpdate, uri: sparkleNS) as? XMLElement {
|
let informationalUpdateElement = XMLElement.element(withName: SUAppcastElementInformationalUpdate, uri: sparkleNS) as? XMLElement {
|
||||||
let versionElements: [XMLElement] = informationalUpdateVersions.compactMap({ informationalUpdateVersion in
|
let versionElements: [XMLElement] = informationalUpdateVersions.compactMap({ informationalUpdateVersion in
|
||||||
let element = XMLElement.element(withName: SUAppcastAttributeVersion, uri: sparkleNS) as? XMLElement
|
let element: XMLElement?
|
||||||
element?.setChildren([text(informationalUpdateVersion)])
|
let informationalVersionText: String
|
||||||
|
if informationalUpdateVersion.hasPrefix("<") {
|
||||||
|
element = XMLElement.element(withName: SUAppcastElementBelowVersion, uri: sparkleNS) as? XMLElement
|
||||||
|
informationalVersionText = String(informationalUpdateVersion.dropFirst())
|
||||||
|
} else {
|
||||||
|
element = XMLElement.element(withName: SUAppcastElementVersion, uri: sparkleNS) as? XMLElement
|
||||||
|
informationalVersionText = informationalUpdateVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
element?.setChildren([text(informationalVersionText)])
|
||||||
return element
|
return element
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -232,7 +247,7 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem], newVersions: Set
|
|||||||
}
|
}
|
||||||
shortVersionElement?.setChildren([text(update.shortVersion)])
|
shortVersionElement?.setChildren([text(update.shortVersion)])
|
||||||
|
|
||||||
if let html = update.releaseNotesHTML {
|
if let html = update.releaseNotesHTML(maxCDATAThreshold: maxCDATAThreshold) {
|
||||||
let descElement = findOrCreateElement(name: "description", parent: item)
|
let descElement = findOrCreateElement(name: "description", parent: item)
|
||||||
let cdata = XMLNode(kind: .text, options: .nodeIsCDATA)
|
let cdata = XMLNode(kind: .text, options: .nodeIsCDATA)
|
||||||
cdata.stringValue = html
|
cdata.stringValue = html
|
||||||
@@ -260,7 +275,7 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem], newVersions: Set
|
|||||||
.contains(where: { $0.name == SUXMLLanguage }) }
|
.contains(where: { $0.name == SUXMLLanguage }) }
|
||||||
let relElement = results?.first
|
let relElement = results?.first
|
||||||
|
|
||||||
if let url = update.releaseNotesURL {
|
if let url = update.releaseNotesURL(maxCDATAThreshold: maxCDATAThreshold) {
|
||||||
// The update includes a valid release notes URL
|
// The update includes a valid release notes URL
|
||||||
if let existingReleaseNotesElement = relElement {
|
if let existingReleaseNotesElement = relElement {
|
||||||
// The existing item includes a release notes element. Update it.
|
// The existing item includes a release notes element. Update it.
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ func unarchive(itemPath: URL, archiveDestDir: URL, callback: @escaping (Error?)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func unarchiveUpdates(archivesSourceDir: URL, archivesDestDir: URL, verbose: Bool) throws -> [ArchiveItem] {
|
func unarchiveUpdates(archivesSourceDir: URL, archivesDestDir: URL, disableNestedCodeCheck: Bool, verbose: Bool) throws -> [ArchiveItem] {
|
||||||
if verbose {
|
if verbose {
|
||||||
print("Unarchiving to temp directory", archivesDestDir.path)
|
print("Unarchiving to temp directory", archivesDestDir.path)
|
||||||
}
|
}
|
||||||
@@ -71,9 +71,9 @@ func unarchiveUpdates(archivesSourceDir: URL, archivesDestDir: URL, verbose: Boo
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
let addItem = {
|
let addItem = { (validateBundle: Bool) in
|
||||||
do {
|
do {
|
||||||
let item = try ArchiveItem(fromArchive: itemPath, unarchivedDir: archiveDestDir)
|
let item = try ArchiveItem(fromArchive: itemPath, unarchivedDir: archiveDestDir, validateBundle: validateBundle, disableNestedCodeCheck: disableNestedCodeCheck)
|
||||||
if verbose {
|
if verbose {
|
||||||
print("Found archive", item)
|
print("Found archive", item)
|
||||||
}
|
}
|
||||||
@@ -81,21 +81,19 @@ func unarchiveUpdates(archivesSourceDir: URL, archivesDestDir: URL, verbose: Boo
|
|||||||
unarchived.append(item)
|
unarchived.append(item)
|
||||||
objc_sync_exit(unarchived)
|
objc_sync_exit(unarchived)
|
||||||
} catch {
|
} catch {
|
||||||
if verbose {
|
print("Skipped", item, error)
|
||||||
print("Skipped", item, error)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if fileManager.fileExists(atPath: archiveDestDir.path) {
|
if fileManager.fileExists(atPath: archiveDestDir.path) {
|
||||||
addItem()
|
addItem(false)
|
||||||
} else {
|
} else {
|
||||||
group.enter()
|
group.enter()
|
||||||
unarchive(itemPath: itemPath, archiveDestDir: archiveDestDir) { (error: Error?) in
|
unarchive(itemPath: itemPath, archiveDestDir: archiveDestDir) { (error: Error?) in
|
||||||
if let error = error {
|
if let error = error {
|
||||||
print("Could not unarchive", itemPath.path, error)
|
print("Could not unarchive", itemPath.path, error)
|
||||||
} else {
|
} else {
|
||||||
addItem()
|
addItem(true)
|
||||||
}
|
}
|
||||||
group.leave()
|
group.leave()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import ArgumentParser
|
import ArgumentParser
|
||||||
|
|
||||||
func loadPrivateKeys(_ privateDSAKey: SecKey?, _ privateEdString: String?) -> PrivateKeys {
|
func loadPrivateKeys(_ account: String, _ privateDSAKey: SecKey?, _ privateEdString: String?) -> PrivateKeys {
|
||||||
var privateEdKey: Data?
|
var privateEdKey: Data?
|
||||||
var publicEdKey: Data?
|
var publicEdKey: Data?
|
||||||
var item: CFTypeRef?
|
var item: CFTypeRef?
|
||||||
@@ -28,14 +28,14 @@ func loadPrivateKeys(_ privateDSAKey: SecKey?, _ privateEdString: String?) -> Pr
|
|||||||
let res = SecItemCopyMatching([
|
let res = SecItemCopyMatching([
|
||||||
kSecClass as String: kSecClassGenericPassword,
|
kSecClass as String: kSecClassGenericPassword,
|
||||||
kSecAttrService as String: "https://sparkle-project.org",
|
kSecAttrService as String: "https://sparkle-project.org",
|
||||||
kSecAttrAccount as String: "ed25519",
|
kSecAttrAccount as String: account,
|
||||||
kSecAttrProtocol as String: kSecAttrProtocolSSH,
|
kSecAttrProtocol as String: kSecAttrProtocolSSH,
|
||||||
kSecReturnData as String: kCFBooleanTrue!,
|
kSecReturnData as String: kCFBooleanTrue!,
|
||||||
] as CFDictionary, &item)
|
] as CFDictionary, &item)
|
||||||
if res == errSecSuccess, let encoded = item as? Data, let data = Data(base64Encoded: encoded) {
|
if res == errSecSuccess, let encoded = item as? Data, let data = Data(base64Encoded: encoded) {
|
||||||
keys = data
|
keys = data
|
||||||
} else {
|
} else {
|
||||||
print("Warning: Private key not found in the Keychain (\(res)). Please run the generate_keys tool")
|
print("Warning: Private key for account \(account) not found in the Keychain (\(res)). Please run the generate_keys tool")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,6 +46,8 @@ func loadPrivateKeys(_ privateDSAKey: SecKey?, _ privateEdString: String?) -> Pr
|
|||||||
return PrivateKeys(privateDSAKey: privateDSAKey, privateEdKey: privateEdKey, publicEdKey: publicEdKey)
|
return PrivateKeys(privateDSAKey: privateDSAKey, privateEdKey: privateEdKey, publicEdKey: publicEdKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let DEFAULT_MAX_CDATA_THRESHOLD = 1000
|
||||||
|
|
||||||
struct GenerateAppcast: ParsableCommand {
|
struct GenerateAppcast: ParsableCommand {
|
||||||
static let programName = "generate_appcast"
|
static let programName = "generate_appcast"
|
||||||
static let programNamePath: String = CommandLine.arguments.first ?? "./\(programName)"
|
static let programNamePath: String = CommandLine.arguments.first ?? "./\(programName)"
|
||||||
@@ -54,6 +56,9 @@ struct GenerateAppcast: ParsableCommand {
|
|||||||
static let DEFAULT_MAX_NEW_VERSIONS_IN_FEED = 5
|
static let DEFAULT_MAX_NEW_VERSIONS_IN_FEED = 5
|
||||||
static let DEFAULT_MAXIMUM_DELTAS = 5
|
static let DEFAULT_MAXIMUM_DELTAS = 5
|
||||||
|
|
||||||
|
@Option(help: ArgumentHelp("The account name in your keychain associated with your private EdDSA (ed25519) key to use for signing new updates."))
|
||||||
|
var account : String = "ed25519"
|
||||||
|
|
||||||
@Option(name: .customShort("s"), help: ArgumentHelp("The private EdDSA string (128 characters). If not specified, the private EdDSA key will be read from the Keychain instead.", valueName: "private-EdDSA-key"))
|
@Option(name: .customShort("s"), help: ArgumentHelp("The private EdDSA string (128 characters). If not specified, the private EdDSA key will be read from the Keychain instead.", valueName: "private-EdDSA-key"))
|
||||||
var privateEdString : String?
|
var privateEdString : String?
|
||||||
|
|
||||||
@@ -84,19 +89,28 @@ struct GenerateAppcast: ParsableCommand {
|
|||||||
@Option(name: .long, help: ArgumentHelp("The maximum number of delta items to create for the latest update for each minimum required operating system.", valueName: "maximum-deltas"))
|
@Option(name: .long, help: ArgumentHelp("The maximum number of delta items to create for the latest update for each minimum required operating system.", valueName: "maximum-deltas"))
|
||||||
var maximumDeltas: Int = DEFAULT_MAXIMUM_DELTAS
|
var maximumDeltas: Int = DEFAULT_MAXIMUM_DELTAS
|
||||||
|
|
||||||
|
@Option(name: .long, help: ArgumentHelp(COMPRESSION_METHOD_ARGUMENT_DESCRIPTION, valueName: "delta-compression"))
|
||||||
|
var deltaCompression: String = "default"
|
||||||
|
|
||||||
|
@Option(name: .long, help: ArgumentHelp(COMPRESSION_LEVEL_ARGUMENT_DESCRIPTION, valueName: "delta-compression-level"))
|
||||||
|
var deltaCompressionLevel: UInt8 = 0
|
||||||
|
|
||||||
@Option(name: .long, help: ArgumentHelp("The Sparkle channel name that will be used for generating new updates. By default, no channel is used. Old applications need to be using Sparkle 2 to use this feature.", valueName: "channel-name"))
|
@Option(name: .long, help: ArgumentHelp("The Sparkle channel name that will be used for generating new updates. By default, no channel is used. Old applications need to be using Sparkle 2 to use this feature.", valueName: "channel-name"))
|
||||||
var channel: String?
|
var channel: String?
|
||||||
|
|
||||||
@Option(name: .long, help: ArgumentHelp("The last major or minimum autoupdate sparkle:version that will be used for generating new updates. By default, no last major version is used.", valueName: "major-version"))
|
@Option(name: .long, help: ArgumentHelp("The last major or minimum autoupdate sparkle:version that will be used for generating new updates. By default, no last major version is used.", valueName: "major-version"))
|
||||||
var majorVersion: String?
|
var majorVersion: String?
|
||||||
|
|
||||||
|
@Option(name: .long, help: ArgumentHelp("Ignore skipped major upgrades below this specified version. Only applicable for major upgrades.", valueName: "below-version"))
|
||||||
|
var ignoreSkippedUpgradesBelowVersion: String?
|
||||||
|
|
||||||
@Option(name: .long, help: ArgumentHelp("The phased rollout interval in seconds that will be used for generating new updates. By default, no phased rollout interval is used.", valueName: "phased-rollout-interval"), transform: { Int($0) })
|
@Option(name: .long, help: ArgumentHelp("The phased rollout interval in seconds that will be used for generating new updates. By default, no phased rollout interval is used.", valueName: "phased-rollout-interval"), transform: { Int($0) })
|
||||||
var phasedRolloutInterval: Int?
|
var phasedRolloutInterval: Int?
|
||||||
|
|
||||||
@Option(name: .long, help: ArgumentHelp("The last critical update sparkle:version that will be used for generating new updates. An empty string argument will treat this update as critical coming from any application version. By default, no last critical update version is used. Old applications need to be using Sparkle 2 to use this feature.", valueName: "critical-update-version"))
|
@Option(name: .long, help: ArgumentHelp("The last critical update sparkle:version that will be used for generating new updates. An empty string argument will treat this update as critical coming from any application version. By default, no last critical update version is used. Old applications need to be using Sparkle 2 to use this feature.", valueName: "critical-update-version"))
|
||||||
var criticalUpdateVersion: String?
|
var criticalUpdateVersion: String?
|
||||||
|
|
||||||
@Option(name: .long, help: ArgumentHelp("A comma delimited list of application sparkle:version's that will see newly generated updates as being informational only. An empty string argument will treat this update as informational coming from any application version. By default, updates are not informational only. --link must also be provided. Old applications need to be using Sparkle 2 to use this feature.", valueName: "informational-update-versions"), transform: { $0.components(separatedBy: ",").filter({$0.count > 0}) })
|
@Option(name: .long, help: ArgumentHelp("A comma delimited list of application sparkle:version's that will see newly generated updates as being informational only. An empty string argument will treat this update as informational coming from any application version. Prefix a version string with '<' to indicate (eg \"<2.5\") to indicate older versions than the one specified should treat the update as informational only. By default, updates are not informational only. --link must also be provided. Old applications need to be using Sparkle 2 to use this feature, and 2.1 or later to use the '<' upper bound feature.", valueName: "informational-update-versions"), transform: { $0.components(separatedBy: ",").filter({$0.count > 0}) })
|
||||||
var informationalUpdateVersions: [String]?
|
var informationalUpdateVersions: [String]?
|
||||||
|
|
||||||
@Option(name: .customShort("o"), help: ArgumentHelp("Path to filename for the generated appcast (allowed when only one will be created).", valueName: "output-path"), transform: { URL(fileURLWithPath: $0) })
|
@Option(name: .customShort("o"), help: ArgumentHelp("Path to filename for the generated appcast (allowed when only one will be created).", valueName: "output-path"), transform: { URL(fileURLWithPath: $0) })
|
||||||
@@ -114,6 +128,13 @@ struct GenerateAppcast: ParsableCommand {
|
|||||||
@Flag(help: .hidden)
|
@Flag(help: .hidden)
|
||||||
var verbose: Bool = false
|
var verbose: Bool = false
|
||||||
|
|
||||||
|
// CDATA text must contain <= this number of characters
|
||||||
|
@Option(name: .customLong("max-cdata-threshold"), help: .hidden)
|
||||||
|
var maxCDATAThreshold: Int = DEFAULT_MAX_CDATA_THRESHOLD
|
||||||
|
|
||||||
|
@Flag(name: .customLong("disable-nested-code-check"), help: .hidden)
|
||||||
|
var disableNestedCodeCheck: Bool = false
|
||||||
|
|
||||||
static var configuration = CommandConfiguration(
|
static var configuration = CommandConfiguration(
|
||||||
abstract: "Generate appcast from a directory of Sparkle update archives.",
|
abstract: "Generate appcast from a directory of Sparkle update archives.",
|
||||||
discussion: """
|
discussion: """
|
||||||
@@ -123,7 +144,7 @@ struct GenerateAppcast: ParsableCommand {
|
|||||||
Old entries in the appcast are kept intact. Otherwise, a new appcast file will be generated and written.
|
Old entries in the appcast are kept intact. Otherwise, a new appcast file will be generated and written.
|
||||||
|
|
||||||
.html files that have the same filename as an archive (except for the file extension) will be used for release notes for that item.
|
.html files that have the same filename as an archive (except for the file extension) will be used for release notes for that item.
|
||||||
If the contents of these files are short (< \(CDATA_HTML_FRAGMENT_THRESHOLD) characters) and do not include a DOCTYPE or body tags, they will be treated as embedded CDATA release notes.
|
If the contents of these files are short (< \(DEFAULT_MAX_CDATA_THRESHOLD) characters) and do not include a DOCTYPE or body tags, they will be treated as embedded CDATA release notes.
|
||||||
|
|
||||||
For new update entries, Sparkle infers the minimum system OS requirement based on your update's LSMinimumSystemVersion provided
|
For new update entries, Sparkle infers the minimum system OS requirement based on your update's LSMinimumSystemVersion provided
|
||||||
by your application's Info.plist. If none is found, \(programName) defaults to Sparkle's own minimum system requirement (macOS 10.11).
|
by your application's Info.plist. If none is found, \(programName) defaults to Sparkle's own minimum system requirement (macOS 10.11).
|
||||||
@@ -166,6 +187,16 @@ struct GenerateAppcast: ParsableCommand {
|
|||||||
guard (informationalUpdateVersions == nil) || (link != nil) else {
|
guard (informationalUpdateVersions == nil) || (link != nil) else {
|
||||||
throw ValidationError("--link must be specified if --informational-update-versions is specified.")
|
throw ValidationError("--link must be specified if --informational-update-versions is specified.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guard deltaCompressionLevel >= 0 && deltaCompressionLevel <= 9 else {
|
||||||
|
throw ValidationError("Invalid --delta-compression-level value was passed.")
|
||||||
|
}
|
||||||
|
|
||||||
|
var validCompression: ObjCBool = false
|
||||||
|
let _ = deltaCompressionModeFromDescription(deltaCompression, &validCompression)
|
||||||
|
if !validCompression.boolValue {
|
||||||
|
throw ValidationError("Invalid --delta-compression \(deltaCompression) was passed.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func run() throws {
|
func run() throws {
|
||||||
@@ -189,10 +220,10 @@ struct GenerateAppcast: ParsableCommand {
|
|||||||
privateDSAKey = nil
|
privateDSAKey = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
let keys = loadPrivateKeys(privateDSAKey, privateEdString)
|
let keys = loadPrivateKeys(account, privateDSAKey, privateEdString)
|
||||||
|
|
||||||
do {
|
do {
|
||||||
let allUpdates = try makeAppcast(archivesSourceDir: archivesSourceDir, cacheDirectory: GenerateAppcast.cacheDirectory, keys: keys, versions: versions, maximumDeltas: maximumDeltas, verbose: verbose)
|
let allUpdates = try makeAppcast(archivesSourceDir: archivesSourceDir, cacheDirectory: GenerateAppcast.cacheDirectory, keys: keys, versions: versions, maximumDeltas: maximumDeltas, deltaCompressionModeDescription: deltaCompression, deltaCompressionLevel: deltaCompressionLevel, disableNestedCodeCheck: disableNestedCodeCheck, verbose: verbose)
|
||||||
|
|
||||||
// If a URL prefix was provided, set on the archive items
|
// If a URL prefix was provided, set on the archive items
|
||||||
if downloadURLPrefix != nil || releaseNotesURLPrefix != nil {
|
if downloadURLPrefix != nil || releaseNotesURLPrefix != nil {
|
||||||
@@ -223,7 +254,7 @@ struct GenerateAppcast: ParsableCommand {
|
|||||||
relativeTo: archivesSourceDir)
|
relativeTo: archivesSourceDir)
|
||||||
|
|
||||||
// Write the appcast
|
// Write the appcast
|
||||||
let (numNewUpdates, numExistingUpdates) = try writeAppcast(appcastDestPath: appcastDestPath, updates: updates, newVersions: versions, maxNewVersionsInFeed: maxNewVersionsInFeed, fullReleaseNotesLink: fullReleaseNotesURL, link: link, newChannel: channel, majorVersion: majorVersion, phasedRolloutInterval: phasedRolloutInterval, criticalUpdateVersion: criticalUpdateVersion, informationalUpdateVersions: informationalUpdateVersions)
|
let (numNewUpdates, numExistingUpdates) = try writeAppcast(appcastDestPath: appcastDestPath, updates: updates, newVersions: versions, maxNewVersionsInFeed: maxNewVersionsInFeed, fullReleaseNotesLink: fullReleaseNotesURL, maxCDATAThreshold: maxCDATAThreshold, link: link, newChannel: channel, majorVersion: majorVersion, ignoreSkippedUpgradesBelowVersion: ignoreSkippedUpgradesBelowVersion, phasedRolloutInterval: phasedRolloutInterval, criticalUpdateVersion: criticalUpdateVersion, informationalUpdateVersions: informationalUpdateVersions)
|
||||||
|
|
||||||
// Inform the user, pluralizing "update" if necessary
|
// Inform the user, pluralizing "update" if necessary
|
||||||
let pluralizeUpdates = { $0 == 1 ? "update" : "updates" }
|
let pluralizeUpdates = { $0 == 1 ? "update" : "updates" }
|
||||||
|
|||||||
+14
-11
@@ -12,7 +12,7 @@ import ArgumentParser
|
|||||||
|
|
||||||
let PRIVATE_KEY_LABEL = "Private key for signing Sparkle updates"
|
let PRIVATE_KEY_LABEL = "Private key for signing Sparkle updates"
|
||||||
|
|
||||||
private func commonKeychainItemAttributes() -> [String: Any] {
|
private func commonKeychainItemAttributes(account: String) -> [String: Any] {
|
||||||
/// Attributes used for both adding a new item and matching an existing one.
|
/// Attributes used for both adding a new item and matching an existing one.
|
||||||
return [
|
return [
|
||||||
/// The type of the item (a generic password).
|
/// The type of the item (a generic password).
|
||||||
@@ -22,7 +22,7 @@ private func commonKeychainItemAttributes() -> [String: Any] {
|
|||||||
kSecAttrService as String: "https://sparkle-project.org",
|
kSecAttrService as String: "https://sparkle-project.org",
|
||||||
|
|
||||||
/// The account name for the item (in this case, the key type).
|
/// The account name for the item (in this case, the key type).
|
||||||
kSecAttrAccount as String: "ed25519",
|
kSecAttrAccount as String: account,
|
||||||
|
|
||||||
/// The protocol used by the service (not actually used, so we claim SSH).
|
/// The protocol used by the service (not actually used, so we claim SSH).
|
||||||
kSecAttrProtocol as String: kSecAttrProtocolSSH as String,
|
kSecAttrProtocol as String: kSecAttrProtocolSSH as String,
|
||||||
@@ -40,9 +40,9 @@ private func failure(_ message: String) -> Never {
|
|||||||
exit(1)
|
exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
func findKeyPair() -> Data? {
|
func findKeyPair(account: String) -> Data? {
|
||||||
var item: CFTypeRef?
|
var item: CFTypeRef?
|
||||||
let res = SecItemCopyMatching(commonKeychainItemAttributes().merging([
|
let res = SecItemCopyMatching(commonKeychainItemAttributes(account: account).merging([
|
||||||
/// Return a matched item's value as a CFData object.
|
/// Return a matched item's value as a CFData object.
|
||||||
kSecReturnData as String: kCFBooleanTrue!,
|
kSecReturnData as String: kCFBooleanTrue!,
|
||||||
], uniquingKeysWith: { $1 }) as CFDictionary, &item)
|
], uniquingKeysWith: { $1 }) as CFDictionary, &item)
|
||||||
@@ -102,8 +102,8 @@ func generateKeyPair() -> (publicEdKey: Data, privateEdKey: Data) {
|
|||||||
return (Data(publicEdKey), Data(privateEdKey))
|
return (Data(publicEdKey), Data(privateEdKey))
|
||||||
}
|
}
|
||||||
|
|
||||||
func storeKeyPair(publicEdKey: Data, privateEdKey: Data) {
|
func storeKeyPair(account: String, publicEdKey: Data, privateEdKey: Data) {
|
||||||
let query = commonKeychainItemAttributes().merging([
|
let query = commonKeychainItemAttributes(account: account).merging([
|
||||||
/// Mark the new item as sensitive (requires keychain password to export - e.g. a private key).
|
/// Mark the new item as sensitive (requires keychain password to export - e.g. a private key).
|
||||||
kSecAttrIsSensitive as String: kCFBooleanTrue!,
|
kSecAttrIsSensitive as String: kCFBooleanTrue!,
|
||||||
|
|
||||||
@@ -157,6 +157,9 @@ func printNewPublicKeyUsage(_ publicKey: Data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct GenerateKeys: ParsableCommand {
|
struct GenerateKeys: ParsableCommand {
|
||||||
|
@Option(help: ArgumentHelp("The account name to use when generating or looking up keys from your keychain. If this is not specified, a default global account is used instead. We recommend using different accounts for different organizations."))
|
||||||
|
var account: String = "ed25519"
|
||||||
|
|
||||||
@Flag(name: .customShort("p"), help: ArgumentHelp("Looks up and just prints the existing public key stored in the Keychain."))
|
@Flag(name: .customShort("p"), help: ArgumentHelp("Looks up and just prints the existing public key stored in the Keychain."))
|
||||||
var lookUpPublicKey: Bool = false
|
var lookUpPublicKey: Bool = false
|
||||||
|
|
||||||
@@ -203,7 +206,7 @@ struct GenerateKeys: ParsableCommand {
|
|||||||
func run() throws {
|
func run() throws {
|
||||||
if lookUpPublicKey {
|
if lookUpPublicKey {
|
||||||
/// Lookup mode - print just the pubkey and exit
|
/// Lookup mode - print just the pubkey and exit
|
||||||
if let keyPair = findKeyPair() {
|
if let keyPair = findKeyPair(account: account) {
|
||||||
let pubKey = keyPair[64...]
|
let pubKey = keyPair[64...]
|
||||||
print(pubKey.base64EncodedString())
|
print(pubKey.base64EncodedString())
|
||||||
} else {
|
} else {
|
||||||
@@ -216,7 +219,7 @@ struct GenerateKeys: ParsableCommand {
|
|||||||
failure("private-key-file already exists: \(exportURL.path)")
|
failure("private-key-file already exists: \(exportURL.path)")
|
||||||
}
|
}
|
||||||
|
|
||||||
guard let keyPair = findKeyPair() else {
|
guard let keyPair = findKeyPair(account: account) else {
|
||||||
failure("No existing signing key found!")
|
failure("No existing signing key found!")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,12 +251,12 @@ struct GenerateKeys: ParsableCommand {
|
|||||||
let publicKey = privateAndPublicKey[64...]
|
let publicKey = privateAndPublicKey[64...]
|
||||||
let privateKey = privateAndPublicKey[0..<64]
|
let privateKey = privateAndPublicKey[0..<64]
|
||||||
|
|
||||||
storeKeyPair(publicEdKey: publicKey, privateEdKey: privateKey)
|
storeKeyPair(account: account, publicEdKey: publicKey, privateEdKey: privateKey)
|
||||||
|
|
||||||
printNewPublicKeyUsage(publicKey)
|
printNewPublicKeyUsage(publicKey)
|
||||||
} else {
|
} else {
|
||||||
/// Default mode - find an existing public key and print its usage, or generate new keys
|
/// Default mode - find an existing public key and print its usage, or generate new keys
|
||||||
if let keyPair = findKeyPair() {
|
if let keyPair = findKeyPair(account: account) {
|
||||||
let pubKey = keyPair[64...]
|
let pubKey = keyPair[64...]
|
||||||
print("""
|
print("""
|
||||||
A pre-existing signing key was found. This is how it should appear in your Info.plist:
|
A pre-existing signing key was found. This is how it should appear in your Info.plist:
|
||||||
@@ -266,7 +269,7 @@ struct GenerateKeys: ParsableCommand {
|
|||||||
print("Generating a new signing key. This may take a moment, depending on your machine.")
|
print("Generating a new signing key. This may take a moment, depending on your machine.")
|
||||||
|
|
||||||
let (pubKey, privKey) = generateKeyPair()
|
let (pubKey, privKey) = generateKeyPair()
|
||||||
storeKeyPair(publicEdKey: pubKey, privateEdKey: privKey)
|
storeKeyPair(account: account, publicEdKey: pubKey, privateEdKey: privKey)
|
||||||
|
|
||||||
printNewPublicKeyUsage(pubKey)
|
printNewPublicKeyUsage(pubKey)
|
||||||
}
|
}
|
||||||
|
|||||||
+51
-10
@@ -10,19 +10,19 @@ import Foundation
|
|||||||
import Security
|
import Security
|
||||||
import ArgumentParser
|
import ArgumentParser
|
||||||
|
|
||||||
func findKeysInKeychain() throws -> (Data, Data) {
|
func findKeysInKeychain(account: String) throws -> (Data, Data) {
|
||||||
var item: CFTypeRef?
|
var item: CFTypeRef?
|
||||||
let res = SecItemCopyMatching([
|
let res = SecItemCopyMatching([
|
||||||
kSecClass as String: kSecClassGenericPassword,
|
kSecClass as String: kSecClassGenericPassword,
|
||||||
kSecAttrService as String: "https://sparkle-project.org",
|
kSecAttrService as String: "https://sparkle-project.org",
|
||||||
kSecAttrAccount as String: "ed25519",
|
kSecAttrAccount as String: account,
|
||||||
kSecAttrProtocol as String: kSecAttrProtocolSSH,
|
kSecAttrProtocol as String: kSecAttrProtocolSSH,
|
||||||
kSecReturnData as String: kCFBooleanTrue!,
|
kSecReturnData as String: kCFBooleanTrue!,
|
||||||
] as CFDictionary, &item)
|
] as CFDictionary, &item)
|
||||||
if res == errSecSuccess, let encoded = item as? Data, let keys = Data(base64Encoded: encoded) {
|
if res == errSecSuccess, let encoded = item as? Data, let keys = Data(base64Encoded: encoded) {
|
||||||
return (keys[0..<64], keys[64..<(64+32)])
|
return (keys[0..<64], keys[64..<(64+32)])
|
||||||
} else if res == errSecItemNotFound {
|
} else if res == errSecItemNotFound {
|
||||||
print("ERROR! Signing key not found. Please run generate_keys tool first or provide key with -f <private_key_file> or -s <private_key> parameter.")
|
print("ERROR! Signing key not found for account \(account). Please run generate_keys tool first or provide key with -f <private_key_file> or -s <private_key> parameter.")
|
||||||
} else if res == errSecAuthFailed {
|
} else if res == errSecAuthFailed {
|
||||||
print("ERROR! Access denied. Can't get keys from the keychain.")
|
print("ERROR! Access denied. Can't get keys from the keychain.")
|
||||||
print("Go to Keychain Access.app, lock the login keychain, then unlock it again.")
|
print("Go to Keychain Access.app, lock the login keychain, then unlock it again.")
|
||||||
@@ -70,8 +70,11 @@ func edSignature(data: Data, publicEdKey: Data, privateEdKey: Data) -> String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct SignUpdate: ParsableCommand {
|
struct SignUpdate: ParsableCommand {
|
||||||
@Argument(help: "The update archive, delta update, or package (pkg) to sign.")
|
@Option(help: ArgumentHelp("The account name in your keychain associated with your private EdDSA (ed25519) key to use for signing the update."))
|
||||||
var updatePath: String
|
var account: String = "ed25519"
|
||||||
|
|
||||||
|
@Flag(help: ArgumentHelp("Verify that the update is signed correctly. If this is set, a second argument <verify-signature> denoting the signature must be passed after the <update-path>.", valueName: "verify"))
|
||||||
|
var verify: Bool = false
|
||||||
|
|
||||||
@Option(name: .customShort("s"), help: ArgumentHelp("The private EdDSA (ed25519) key.", valueName: "private-key"))
|
@Option(name: .customShort("s"), help: ArgumentHelp("The private EdDSA (ed25519) key.", valueName: "private-key"))
|
||||||
var privateKey: String?
|
var privateKey: String?
|
||||||
@@ -79,14 +82,24 @@ struct SignUpdate: ParsableCommand {
|
|||||||
@Option(name: .customShort("f"), help: ArgumentHelp("Path to the file containing the private EdDSA (ed25519) key.", valueName: "private-key-file"))
|
@Option(name: .customShort("f"), help: ArgumentHelp("Path to the file containing the private EdDSA (ed25519) key.", valueName: "private-key-file"))
|
||||||
var privateKeyFile: String?
|
var privateKeyFile: String?
|
||||||
|
|
||||||
|
@Argument(help: "The update archive, delta update, or package (pkg) to sign or verify.")
|
||||||
|
var updatePath: String
|
||||||
|
|
||||||
|
@Argument(help: "The signature to verify when --verify is passed.")
|
||||||
|
var verifySignature: String?
|
||||||
|
|
||||||
static var configuration: CommandConfiguration = CommandConfiguration(
|
static var configuration: CommandConfiguration = CommandConfiguration(
|
||||||
abstract: "Sign an update using your private EdDSA (ed25519) key.",
|
abstract: "Sign or verify an update using your EdDSA (ed25519) keys.",
|
||||||
discussion: "The private EdDSA key is automatically read from the Keychain if no <private-key> or <private-key-file> is specified.\n\nThis tool will output an EdDSA signature and length attributes to use for your update's appcast item enclosure.")
|
discussion: "The EdDSA keys are automatically read from the Keychain if no <private-key> or <private-key-file> is specified.\n\nWhen signing, this tool will output an EdDSA signature and length attributes to use for your update's appcast item enclosure.")
|
||||||
|
|
||||||
func validate() throws {
|
func validate() throws {
|
||||||
guard privateKey == nil || privateKeyFile == nil else {
|
guard privateKey == nil || privateKeyFile == nil else {
|
||||||
throw ValidationError("Both -s <private-key> and -f <private-key-file> options cannot be provided.")
|
throw ValidationError("Both -s <private-key> and -f <private-key-file> options cannot be provided.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guard !verify || verifySignature != nil else {
|
||||||
|
throw ValidationError("<verify-signature> must be passed as a second argument after <update-path> if --verify is passed.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func run() throws {
|
func run() throws {
|
||||||
@@ -97,12 +110,40 @@ struct SignUpdate: ParsableCommand {
|
|||||||
} else if let privateKeyFile = privateKeyFile {
|
} else if let privateKeyFile = privateKeyFile {
|
||||||
(priv, pub) = try findKeys(inFile: privateKeyFile)
|
(priv, pub) = try findKeys(inFile: privateKeyFile)
|
||||||
} else {
|
} else {
|
||||||
(priv, pub) = try findKeysInKeychain()
|
(priv, pub) = try findKeysInKeychain(account: account)
|
||||||
}
|
}
|
||||||
|
|
||||||
let data = try Data.init(contentsOf: URL.init(fileURLWithPath: updatePath), options: .mappedIfSafe)
|
let data = try Data.init(contentsOf: URL.init(fileURLWithPath: updatePath), options: .mappedIfSafe)
|
||||||
let sig = edSignature(data: data, publicEdKey: pub, privateEdKey: priv)
|
if verify {
|
||||||
print("sparkle:edSignature=\"\(sig)\" length=\"\(data.count)\"")
|
// Verify the signature
|
||||||
|
guard let verifySignature = verifySignature else {
|
||||||
|
print("Error: failed to unwrap verifySignature, which is unexpected")
|
||||||
|
throw ExitCode.failure
|
||||||
|
}
|
||||||
|
|
||||||
|
guard let signatureData = Data(base64Encoded: verifySignature, options: .ignoreUnknownCharacters) else {
|
||||||
|
print("Error: failed to decode base64 signature: \(verifySignature)")
|
||||||
|
throw ExitCode.failure
|
||||||
|
}
|
||||||
|
|
||||||
|
let signatureBytes = Array(signatureData)
|
||||||
|
guard signatureBytes.count == 64 else {
|
||||||
|
print("Error: signature passed in has an invalid byte count.")
|
||||||
|
throw ExitCode.failure
|
||||||
|
}
|
||||||
|
|
||||||
|
let dataBytes = Array(data)
|
||||||
|
let publicKeyBytes = Array(pub)
|
||||||
|
|
||||||
|
if ed25519_verify(signatureBytes, dataBytes, data.count, publicKeyBytes) == 0 {
|
||||||
|
print("Error: failed to pass signing verification.")
|
||||||
|
throw ExitCode.failure
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Sign the update
|
||||||
|
let sig = edSignature(data: data, publicEdKey: pub, privateEdKey: priv)
|
||||||
|
print("sparkle:edSignature=\"\(sig)\" length=\"\(data.count)\"")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -217,7 +217,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)showInstallingUpdate
|
- (void)showInstallingUpdateWithApplicationTerminated:(BOOL)__unused applicationTerminated
|
||||||
{
|
{
|
||||||
if (self.verbose) {
|
if (self.verbose) {
|
||||||
fprintf(stderr, "Installing Update...\n");
|
fprintf(stderr, "Installing Update...\n");
|
||||||
@@ -237,9 +237,4 @@
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)showSendingTerminationSignal
|
|
||||||
{
|
|
||||||
// We are already showing that the update is installing, so there is no need to do anything here
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
Reference in new issue
Block a user