mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-25 04:47:55 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
10d96f2b9b | ||
|
|
a9f370460a | ||
|
|
d7db589432 | ||
|
|
56ad4aa3c8 | ||
|
|
b5350bf58f | ||
|
|
bbe887e160 | ||
|
|
f453625573 | ||
|
|
7918c1c8fc | ||
|
|
4875f83bea | ||
|
|
43403a5068 | ||
|
|
4222fd6179 | ||
|
|
16c2f9b78b | ||
|
|
26d30d7c2b | ||
|
|
b3b5f5f246 | ||
|
|
a49d83dc22 | ||
|
|
08932966b2 | ||
|
|
d80ad46c4f | ||
|
|
4a00b97592 | ||
|
|
a319cb2c90 | ||
|
|
43596bbc5e | ||
|
|
3ed77f975a | ||
|
|
c64d0467b2 | ||
|
|
7b109be51d | ||
|
|
c427650ed8 | ||
|
|
70f58b515d | ||
|
|
65900a1aea | ||
|
|
f601a7a3df | ||
|
|
1ede0bc994 | ||
|
|
5b8ab1b919 | ||
|
|
99dbdcbd96 | ||
|
|
d18ccf12f3 | ||
|
|
a6ff74889e | ||
|
|
a1d0e036fb | ||
|
|
09ab0a5138 | ||
|
|
1c55a7e7fc | ||
|
|
1d9125f8a2 | ||
|
|
bf3c932844 | ||
|
|
b5755d41cb | ||
|
|
8f7fad4d3a | ||
|
|
3d4e4494ad | ||
|
|
f7d830d9ad | ||
|
|
f3db8fb959 | ||
|
|
55394e1359 | ||
|
|
ea14942643 | ||
|
|
a2adcd8407 | ||
|
|
2929333b49 | ||
|
|
c4fcf17050 | ||
|
|
99785ceebb |
No files matched your search
@@ -10,38 +10,47 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
xcode: ['/Applications/Xcode_12.2.app/Contents/Developer', '/Applications/Xcode_11.7.app/Contents/Developer']
|
xcode: ['xcode12.5.1', 'xcode13.1']
|
||||||
|
include:
|
||||||
|
- xcode: 'xcode12.5.1'
|
||||||
|
xcode-path: '/Applications/Xcode_12.5.1.app/Contents/Developer'
|
||||||
|
upload-dist: false
|
||||||
|
- xcode: 'xcode13.1'
|
||||||
|
xcode-path: '/Applications/Xcode_13.1.app/Contents/Developer'
|
||||||
|
upload-dist: true
|
||||||
|
|
||||||
name: Build and Test Sparkle
|
name: Build and Test Sparkle
|
||||||
runs-on: macos-10.15
|
runs-on: macos-11
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
fetch-depth: 0
|
||||||
- name: Build Unit Tests
|
- name: Build Unit Tests
|
||||||
env:
|
env:
|
||||||
DEVELOPER_DIR: ${{ matrix.xcode }}
|
DEVELOPER_DIR: ${{ matrix.xcode-path }}
|
||||||
run: |
|
run: |
|
||||||
xcodebuild build-for-testing -project Sparkle.xcodeproj -scheme Distribution -enableCodeCoverage YES -derivedDataPath build
|
xcodebuild build-for-testing -project Sparkle.xcodeproj -scheme Distribution -enableCodeCoverage YES -derivedDataPath build
|
||||||
- name: Run Unit Tests
|
- name: Run Unit Tests
|
||||||
env:
|
env:
|
||||||
DEVELOPER_DIR: ${{ matrix.xcode }}
|
DEVELOPER_DIR: ${{ matrix.xcode-path }}
|
||||||
run: |
|
run: |
|
||||||
xcodebuild test-without-building -project Sparkle.xcodeproj -scheme Distribution -enableCodeCoverage YES -derivedDataPath build
|
xcodebuild test-without-building -project Sparkle.xcodeproj -scheme Distribution -enableCodeCoverage YES -derivedDataPath build
|
||||||
- name: Build UI Tests
|
- name: Build UI Tests
|
||||||
env:
|
env:
|
||||||
DEVELOPER_DIR: ${{ matrix.xcode }}
|
DEVELOPER_DIR: ${{ matrix.xcode-path }}
|
||||||
run: |
|
run: |
|
||||||
xcodebuild build-for-testing -project Sparkle.xcodeproj -scheme UITests -configuration Debug -derivedDataPath build
|
xcodebuild build-for-testing -project Sparkle.xcodeproj -scheme UITests -configuration Debug -derivedDataPath build
|
||||||
- name: Run UI Tests
|
- name: Run UI Tests
|
||||||
env:
|
env:
|
||||||
DEVELOPER_DIR: ${{ matrix.xcode }}
|
DEVELOPER_DIR: ${{ matrix.xcode-path }}
|
||||||
run: |
|
run: |
|
||||||
xcodebuild test-without-building -project Sparkle.xcodeproj -scheme UITests -configuration Debug -derivedDataPath build
|
xcodebuild test-without-building -project Sparkle.xcodeproj -scheme UITests -configuration Debug -derivedDataPath build
|
||||||
- name: Build Release Distribution
|
- name: Build Release Distribution
|
||||||
env:
|
env:
|
||||||
DEVELOPER_DIR: ${{ matrix.xcode }}
|
DEVELOPER_DIR: ${{ matrix.xcode-path }}
|
||||||
run: |
|
run: |
|
||||||
xcodebuild build -project Sparkle.xcodeproj -scheme Distribution -configuration Release -derivedDataPath build
|
xcodebuild build -project Sparkle.xcodeproj -scheme Distribution -configuration Release -derivedDataPath build
|
||||||
- name: Archive Test Results
|
- name: Archive Test Results
|
||||||
@@ -50,3 +59,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: build-logs
|
name: build-logs
|
||||||
path: build/Logs
|
path: build/Logs
|
||||||
|
- name: Upload Distribution
|
||||||
|
if: ${{ success() && matrix.upload-dist }}
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: Sparkle-distribution-${{ matrix.xcode }}.tar.xz
|
||||||
|
path: build/Build/Products/Release/sparkle-dist.tar.xz
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
name: "Create Draft Release"
|
||||||
|
|
||||||
|
env:
|
||||||
|
BUILDDIR: "build"
|
||||||
|
DEVELOPER_DIR: "/Applications/Xcode_13.1.app/Contents/Developer"
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
marketingVersion:
|
||||||
|
description: "Marketing Version"
|
||||||
|
required: true
|
||||||
|
default: ""
|
||||||
|
|
||||||
|
prereleaseSuffix:
|
||||||
|
description: "Pre-release Suffix"
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
|
||||||
|
buildVersion:
|
||||||
|
description: "Product Build"
|
||||||
|
required: true
|
||||||
|
default: ""
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: publish-release-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
name: "Publish binaries for release"
|
||||||
|
runs-on: macos-11
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: "Checkout sources"
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
|
||||||
|
submodules: true
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: "Extract latest changes from CHANGELOG"
|
||||||
|
run: |
|
||||||
|
./Configurations/generate_latest_changes.py > latest-changes.txt
|
||||||
|
|
||||||
|
- name: "Overwrite project versions in project"
|
||||||
|
run: |
|
||||||
|
IFS='.' read major minor patch <<< "${{ github.event.inputs.marketingVersion }}"
|
||||||
|
sed -E -i '' "s/SPARKLE_VERSION_MAJOR =.+/SPARKLE_VERSION_MAJOR = $major/g" ./Configurations/ConfigCommon.xcconfig
|
||||||
|
sed -E -i '' "s/SPARKLE_VERSION_MINOR =.+/SPARKLE_VERSION_MINOR = $minor/g" ./Configurations/ConfigCommon.xcconfig
|
||||||
|
sed -E -i '' "s/SPARKLE_VERSION_PATCH =.+/SPARKLE_VERSION_PATCH = $patch/g" ./Configurations/ConfigCommon.xcconfig
|
||||||
|
|
||||||
|
if [[ ! -z "${{ github.event.inputs.prereleaseSuffix }}" ]]; then
|
||||||
|
sed -E -i '' "s/SPARKLE_VERSION_SUFFIX =.*/SPARKLE_VERSION_SUFFIX = ${{ github.event.inputs.prereleaseSuffix }}/g" ./Configurations/ConfigCommon.xcconfig
|
||||||
|
else
|
||||||
|
sed -E -i '' "s/SPARKLE_VERSION_SUFFIX =.*/SPARKLE_VERSION_SUFFIX =/g" ./Configurations/ConfigCommon.xcconfig
|
||||||
|
fi
|
||||||
|
|
||||||
|
sed -E -i '' "s/CURRENT_PROJECT_VERSION =.+/CURRENT_PROJECT_VERSION = ${{ github.event.inputs.buildVersion }}/g" ./Configurations/ConfigCommon.xcconfig
|
||||||
|
git add ./Configurations/ConfigCommon.xcconfig
|
||||||
|
|
||||||
|
- name: "Determine if this is a pre-release version"
|
||||||
|
run: |
|
||||||
|
if [[ ! -z "${{ github.event.inputs.prereleaseSuffix }}" ]]; then
|
||||||
|
echo "PRERELEASE_VERSION=true" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "PRERELEASE_VERSION=false" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: "Set up git and create tag"
|
||||||
|
run: |
|
||||||
|
git config user.name Sparkle-Bot
|
||||||
|
git config user.email sparkle.project.bot@gmail.com
|
||||||
|
git tag "${{ github.event.inputs.marketingVersion }}${{ github.event.inputs.prereleaseSuffix }}"
|
||||||
|
|
||||||
|
- name: "Build release distribution"
|
||||||
|
run: make release
|
||||||
|
env:
|
||||||
|
GITHUB_ACTOR: ${{ github.actor }}
|
||||||
|
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
|
||||||
|
|
||||||
|
- name: "Push the updated Swift package description"
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
|
||||||
|
run: git push
|
||||||
|
|
||||||
|
- name: "Draft a release"
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
draft: true
|
||||||
|
prerelease: ${{ env.PRERELEASE_VERSION }}
|
||||||
|
name: "Sparkle ${{ github.event.inputs.marketingVersion }}${{ github.event.inputs.prereleaseSuffix }}"
|
||||||
|
tag_name: "${{ github.event.inputs.marketingVersion }}${{ github.event.inputs.prereleaseSuffix }}"
|
||||||
|
fail_on_unmatched_files: true
|
||||||
|
token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
|
||||||
|
body_path: latest-changes.txt
|
||||||
|
files: |
|
||||||
|
build/Build/Products/Release/Sparkle-*.tar.xz
|
||||||
|
build/Build/Products/Release/Sparkle-for-Swift-Package-Manager.zip
|
||||||
@@ -1,3 +1,34 @@
|
|||||||
|
# 1.27.3
|
||||||
|
|
||||||
|
* Create and use temp extraction directory in generate_appcast again (#2556) (Zorg)
|
||||||
|
|
||||||
|
# 1.27.2
|
||||||
|
|
||||||
|
* Extract archives in a separate directory from the input archive (#2552) (Zorg)
|
||||||
|
* Fix incorrect xz log warning in make release (#2044) (trss)
|
||||||
|
|
||||||
|
# 1.27.1
|
||||||
|
|
||||||
|
* Use px instead of pt when specifying font size to fix default font size in WebView from #1962 (regressed in 1.25.0 with WKWebView adoption) (Daniel Jalkut)
|
||||||
|
* Fix to prevent Sparkle manipulating the host app's high level WebView defaults from #1961 (affecting only macOS versions before 10.11 in 1.x branch) (Daniel Jalkut)
|
||||||
|
* Add safer handling of applying binary delta files from #1990 (Zorg)
|
||||||
|
* Don't use current date unless necessary when scheduling next update from #1991 (Zorg)
|
||||||
|
* Whitelist about:srcdoc as a safe web URL from #1938, #2007 (Louis Pontoise, Zorg)
|
||||||
|
* Backport not hiding update window on deactivation from #2008 (Zorg)
|
||||||
|
|
||||||
|
# 1.27.0
|
||||||
|
|
||||||
|
* Deprecate not using EdDSA and skip DSA verification when possible in #1892 (Zorg)
|
||||||
|
* Pass http headers and user agent when downloading release notes from #1873 (Zorg)
|
||||||
|
* Fix project warnings from #1893 (Zorg)
|
||||||
|
* Update sample appcast from #1895 (Zorg)
|
||||||
|
* Fix appcast pubDate tag generation in different locales from #1898 (Sungbin Jo)
|
||||||
|
* Create valid xar archives for generating binary delta files from #1906 (Zorg)
|
||||||
|
* Fix a few issues with German localization from #1931 (J-rg)
|
||||||
|
* Fix issues with Russian localizations from #1947 (Konstantin Zamyakin)
|
||||||
|
* Fix issues with Czech localizations from #1943 (Vojtěch Koňařík)
|
||||||
|
* Add an automated workflow that builds and publishes official Sparkle releases (Tony Arnold, Zorg)
|
||||||
|
|
||||||
# 1.26.0
|
# 1.26.0
|
||||||
|
|
||||||
* Flat package support from #1745 (Zorg)
|
* Flat package support from #1745 (Zorg)
|
||||||
|
|||||||
@@ -15,12 +15,20 @@ SPARKLE_AUTOMATED_DOWNGRADES = 0
|
|||||||
// following on to always reset the name back to "MyApp":
|
// following on to always reset the name back to "MyApp":
|
||||||
SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME = 0
|
SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME = 0
|
||||||
|
|
||||||
|
// If you change any of these version details, you must increase CURRENT_PROJECT_VERSION
|
||||||
|
// These variables must have a space after the '=' too
|
||||||
SPARKLE_VERSION_MAJOR = 1
|
SPARKLE_VERSION_MAJOR = 1
|
||||||
SPARKLE_VERSION_MINOR = 26
|
SPARKLE_VERSION_MINOR = 27
|
||||||
SPARKLE_VERSION_PATCH = 0
|
SPARKLE_VERSION_PATCH = 3
|
||||||
SPARKLE_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)
|
|
||||||
|
// This should be in SemVer format or empty, ie. "-rc.1"
|
||||||
|
// These variables must have a space after the '=' too
|
||||||
|
SPARKLE_VERSION_SUFFIX =
|
||||||
|
// This is now a monotonically increasing ID number, even across prereleases, but let's keep this below 2.0
|
||||||
|
CURRENT_PROJECT_VERSION = 1.108
|
||||||
|
|
||||||
|
MARKETING_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)$(SPARKLE_VERSION_SUFFIX)
|
||||||
|
|
||||||
CURRENT_PROJECT_VERSION = $(SPARKLE_VERSION)
|
|
||||||
ALWAYS_SEARCH_USER_PATHS = NO
|
ALWAYS_SEARCH_USER_PATHS = NO
|
||||||
ENABLE_STRICT_OBJC_MSGSEND = YES
|
ENABLE_STRICT_OBJC_MSGSEND = YES
|
||||||
GCC_SYMBOLS_PRIVATE_EXTERN = YES
|
GCC_SYMBOLS_PRIVATE_EXTERN = YES
|
||||||
@@ -30,8 +38,10 @@ MACOSX_DEPLOYMENT_TARGET = 10.9
|
|||||||
PRODUCT_NAME = ${TARGET_NAME}
|
PRODUCT_NAME = ${TARGET_NAME}
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle.${PRODUCT_NAME:rfc1034identifier}
|
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle.${PRODUCT_NAME:rfc1034identifier}
|
||||||
|
|
||||||
GCC_PREPROCESSOR_DEFINITIONS_COMMON = SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=$(SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) SPARKLE_AUTOMATED_DOWNGRADES=$(SPARKLE_AUTOMATED_DOWNGRADES) SPARKLE_APPEND_VERSION_NUMBER=$(SPARKLE_APPEND_VERSION_NUMBER) SPARKLE_BUNDLE_IDENTIFIER=\"$(SPARKLE_BUNDLE_IDENTIFIER)\" SPARKLE_RELAUNCH_TOOL_NAME=\"$(SPARKLE_RELAUNCH_TOOL_NAME)\" SPARKLE_FILEOP_TOOL_NAME=\"$(SPARKLE_FILEOP_TOOL_NAME)\"
|
GCC_PREPROCESSOR_DEFINITIONS_COMMON = SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=$(SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) SPARKLE_AUTOMATED_DOWNGRADES=$(SPARKLE_AUTOMATED_DOWNGRADES) SPARKLE_APPEND_VERSION_NUMBER=$(SPARKLE_APPEND_VERSION_NUMBER) SPARKLE_BUNDLE_IDENTIFIER=\"$(SPARKLE_BUNDLE_IDENTIFIER)\" MARKETING_VERSION=\"$(MARKETING_VERSION)\" SPARKLE_RELAUNCH_TOOL_NAME=\"$(SPARKLE_RELAUNCH_TOOL_NAME)\" SPARKLE_FILEOP_TOOL_NAME=\"$(SPARKLE_FILEOP_TOOL_NAME)\"
|
||||||
|
|
||||||
|
CODE_SIGN_IDENTITY = -
|
||||||
|
SDKROOT = macosx
|
||||||
ENABLE_HARDENED_RUNTIME = YES;
|
ENABLE_HARDENED_RUNTIME = YES;
|
||||||
CLANG_ENABLE_OBJC_ARC = YES
|
CLANG_ENABLE_OBJC_ARC = YES
|
||||||
GCC_ENABLE_PASCAL_STRINGS = NO
|
GCC_ENABLE_PASCAL_STRINGS = NO
|
||||||
|
|||||||
@@ -15,3 +15,4 @@ GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS_COMMON)
|
|||||||
DEAD_CODE_STRIPPING = YES
|
DEAD_CODE_STRIPPING = YES
|
||||||
GCC_TREAT_WARNINGS_AS_ERRORS = NO
|
GCC_TREAT_WARNINGS_AS_ERRORS = NO
|
||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES
|
GCC_WARN_UNINITIALIZED_AUTOS = YES
|
||||||
|
COPY_PHASE_STRIP = NO
|
||||||
Executable
+23
@@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import os, sys
|
||||||
|
|
||||||
|
# Ignore the first version line starting with # x.y.z..
|
||||||
|
# and print everything until the second version line starting with # x.y.z..
|
||||||
|
|
||||||
|
hit_first_changelog_note = False
|
||||||
|
with open("CHANGELOG", "r") as changelog_file:
|
||||||
|
for line in changelog_file:
|
||||||
|
if line.startswith("#"):
|
||||||
|
if hit_first_changelog_note:
|
||||||
|
# We are done with printing changes
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
# We haven't hit an important changelog line yet, so continue
|
||||||
|
continue
|
||||||
|
|
||||||
|
if not hit_first_changelog_note and len(line.strip()) == 0:
|
||||||
|
continue
|
||||||
|
|
||||||
|
hit_first_changelog_note = True
|
||||||
|
sys.stdout.write(line)
|
||||||
@@ -1,20 +1,30 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ "$ACTION" = "" ] ; then
|
# Tests the code signing validity of the extracted products within the provided path.
|
||||||
# If using cocoapods, sanity check that the Podspec version matches the Sparkle version
|
# This guards against our archives being corrupt / created incorrectly.
|
||||||
if [ -x "$(command -v pod)" ]; then
|
function verify_code_signatures() {
|
||||||
spec_version=$(printf "require 'cocoapods'\nspec = %s\nprint spec.version" "$(cat "$SRCROOT/Sparkle.podspec")" | LANG=en_US.UTF-8 ruby)
|
verification_directory="$1"
|
||||||
if [ "$spec_version" != "$CURRENT_PROJECT_VERSION" ] ; then
|
|
||||||
echo "podspec version '$spec_version' does not match the current project version '$CURRENT_PROJECT_VERSION'" >&2
|
if [[ -z "$verification_directory" ]]; then
|
||||||
exit 1
|
echo "Provided verification directory does not exist" >&2
|
||||||
fi
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Search the current directory for all instances of the framework to verify them (XCFrameworks can have multiple copies of a framework for different platforms).
|
||||||
|
find "${verification_directory}" -name "Sparkle.framework" -type d -exec codesign --verify -vvv --deep {} \;
|
||||||
|
codesign --verify -vvv --deep "${verification_directory}/Sparkle Test App.app"
|
||||||
|
codesign --verify -vvv --deep "${verification_directory}/bin/BinaryDelta"
|
||||||
|
codesign --verify -vvv --deep "${verification_directory}/bin/generate_appcast"
|
||||||
|
codesign --verify -vvv --deep "${verification_directory}/bin/sign_update"
|
||||||
|
codesign --verify -vvv --deep "${verification_directory}/bin/generate_keys"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$ACTION" = "" ] ; then
|
||||||
rm -rf "$CONFIGURATION_BUILD_DIR/staging"
|
rm -rf "$CONFIGURATION_BUILD_DIR/staging"
|
||||||
rm -rf "$CONFIGURATION_BUILD_DIR/staging-spm"
|
rm -rf "$CONFIGURATION_BUILD_DIR/staging-spm"
|
||||||
rm -f "Sparkle-$CURRENT_PROJECT_VERSION.tar.xz"
|
rm -f "Sparkle-$MARKETING_VERSION.tar.xz"
|
||||||
rm -f "Sparkle-$CURRENT_PROJECT_VERSION.tar.bz2"
|
rm -f "Sparkle-$MARKETING_VERSION.tar.bz2"
|
||||||
rm -f "Sparkle-for-Swift-Package-Manager.zip"
|
rm -f "Sparkle-for-Swift-Package-Manager.zip"
|
||||||
|
|
||||||
mkdir -p "$CONFIGURATION_BUILD_DIR/staging"
|
mkdir -p "$CONFIGURATION_BUILD_DIR/staging"
|
||||||
@@ -45,63 +55,93 @@ if [ "$ACTION" = "" ] ; then
|
|||||||
cp -R "$CONFIGURATION_BUILD_DIR/staging/bin" "$CONFIGURATION_BUILD_DIR/staging-spm"
|
cp -R "$CONFIGURATION_BUILD_DIR/staging/bin" "$CONFIGURATION_BUILD_DIR/staging-spm"
|
||||||
|
|
||||||
cd "$CONFIGURATION_BUILD_DIR/staging"
|
cd "$CONFIGURATION_BUILD_DIR/staging"
|
||||||
|
|
||||||
if [ -x "$(command -v xz)" ]; then
|
if [ -x "$(command -v xz)" ]; then
|
||||||
XZ_EXISTS=1
|
XZ_EXISTS=1
|
||||||
else
|
else
|
||||||
XZ_EXISTS=0
|
XZ_EXISTS=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rm -rf "/tmp/sparkle-extract"
|
||||||
|
mkdir -p "/tmp/sparkle-extract"
|
||||||
|
|
||||||
# Sorted file list groups similar files together, which improves tar compression
|
# Sorted file list groups similar files together, which improves tar compression
|
||||||
if [ "$XZ_EXISTS" -eq 1 ] ; then
|
if [ "$XZ_EXISTS" -eq 1 ] ; then
|
||||||
find . \! -type d | rev | sort | rev | tar cv --files-from=- | xz -9 > "../Sparkle-$CURRENT_PROJECT_VERSION.tar.xz"
|
find . \! -type d | rev | sort | rev | tar cv --files-from=- | xz -9 > "../Sparkle-$MARKETING_VERSION.tar.xz"
|
||||||
|
|
||||||
|
# Copy archived distribution for CI
|
||||||
|
cp -f "../Sparkle-$MARKETING_VERSION.tar.xz" "../sparkle-dist.tar.xz"
|
||||||
|
|
||||||
|
# Extract archive for testing binary validity
|
||||||
|
tar -xf "../Sparkle-$MARKETING_VERSION.tar.xz" -C "/tmp/sparkle-extract"
|
||||||
else
|
else
|
||||||
# Fallback to bz2 compression if xz utility is not available
|
# Fallback to bz2 compression if xz utility is not available
|
||||||
find . \! -type d | rev | sort | rev | tar cjvf "../Sparkle-$CURRENT_PROJECT_VERSION.tar.bz2" --files-from=-
|
find . \! -type d | rev | sort | rev | tar cjvf "../Sparkle-$MARKETING_VERSION.tar.bz2" --files-from=-
|
||||||
|
|
||||||
|
# Extract archive for testing binary validity
|
||||||
|
tar -xf "../Sparkle-$MARKETING_VERSION.tar.bz2" -C "/tmp/sparkle-extract"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Test code signing validity of the extracted products
|
||||||
|
# This guards against our archives being corrupt / created incorrectly
|
||||||
|
verify_code_signatures "/tmp/sparkle-extract"
|
||||||
|
|
||||||
|
rm -rf "/tmp/sparkle-extract"
|
||||||
rm -rf "$CONFIGURATION_BUILD_DIR/staging"
|
rm -rf "$CONFIGURATION_BUILD_DIR/staging"
|
||||||
|
|
||||||
# Generate zip containing the xcframework for SPM
|
# Generate zip containing the xcframework for SPM
|
||||||
|
rm -rf "/tmp/sparkle-spm-extract"
|
||||||
|
mkdir -p "/tmp/sparkle-spm-extract"
|
||||||
cd "$CONFIGURATION_BUILD_DIR/staging-spm"
|
cd "$CONFIGURATION_BUILD_DIR/staging-spm"
|
||||||
#rm -rf "$CONFIGURATION_BUILD_DIR/Sparkle.xcarchive"
|
# rm -rf "$CONFIGURATION_BUILD_DIR/Sparkle.xcarchive"
|
||||||
zip -rqyX -9 "../Sparkle-for-Swift-Package-Manager.zip" *
|
ditto -c -k --zlibCompressionLevel 9 --rsrc . "../Sparkle-for-Swift-Package-Manager.zip"
|
||||||
|
|
||||||
# GitHub actions set the CI environment variable to true
|
# Test code signing validity of the extracted Swift package
|
||||||
if [ "$CI" != true ]; then
|
# This guards against our archives being corrupt / created incorrectly
|
||||||
# Get latest git tag
|
ditto -x -k "../Sparkle-for-Swift-Package-Manager.zip" "/tmp/sparkle-spm-extract"
|
||||||
cd "$SRCROOT"
|
verify_code_signatures "/tmp/sparkle-spm-extract"
|
||||||
latest_git_tag=$(git describe --tags --abbrev=0)
|
|
||||||
# Check semantic versioning
|
rm -rf "/tmp/sparkle-spm-extract"
|
||||||
if [[ $latest_git_tag =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$ ]]; then
|
rm -rf "$CONFIGURATION_BUILD_DIR/staging-spm"
|
||||||
echo "Tag $latest_git_tag follows semantic versioning"
|
|
||||||
else
|
# Get latest git tag
|
||||||
echo "ERROR: Tag $latest_git_tag does not follow semantic versioning! SPM will not be able to resolve the repository" >&2
|
cd "$SRCROOT"
|
||||||
exit 1
|
latest_git_tag=$(git describe --tags --abbrev=0)
|
||||||
fi
|
|
||||||
|
# Check semantic versioning
|
||||||
|
if [[ $latest_git_tag =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$ ]]; then
|
||||||
|
echo "Tag $latest_git_tag follows semantic versioning"
|
||||||
else
|
else
|
||||||
# Dummy placeholder for CI test builds as we don't really need to update Package.swift for building and testing purposes
|
echo "ERROR: Tag $latest_git_tag does not follow semantic versioning! SPM will not be able to resolve the repository" >&2
|
||||||
latest_git_tag="CI_BUILD"
|
exit 1
|
||||||
fi
|
fi
|
||||||
# Generate new Package manifest
|
|
||||||
|
# Generate new Package manifest and podspec
|
||||||
cd "$CONFIGURATION_BUILD_DIR"
|
cd "$CONFIGURATION_BUILD_DIR"
|
||||||
cp "$SRCROOT/Package.swift" "$CONFIGURATION_BUILD_DIR"
|
cp "$SRCROOT/Package.swift" "$CONFIGURATION_BUILD_DIR"
|
||||||
|
cp "$SRCROOT/Sparkle.podspec" "$CONFIGURATION_BUILD_DIR"
|
||||||
if [ "$XCODE_VERSION_MAJOR" -ge "1200" ]; then
|
if [ "$XCODE_VERSION_MAJOR" -ge "1200" ]; then
|
||||||
# is equivalent to shasum -a 256 FILE
|
# is equivalent to shasum -a 256 FILE
|
||||||
spm_checksum=$(swift package compute-checksum "Sparkle-for-Swift-Package-Manager.zip")
|
spm_checksum=$(swift package compute-checksum "Sparkle-for-Swift-Package-Manager.zip")
|
||||||
rm -rf ".build"
|
rm -rf ".build"
|
||||||
sed -E -i '' -e "/let tag/ s/\".+\"/\"$latest_git_tag\"/" -e "/let version/ s/\".+\"/\"$CURRENT_PROJECT_VERSION\"/" -e "/let checksum/ s/[[:xdigit:]]{64}/$spm_checksum/" "Package.swift"
|
sed -E -i '' -e "/let tag/ s/\".+\"/\"$latest_git_tag\"/" -e "/let version/ s/\".+\"/\"$MARKETING_VERSION\"/" -e "/let checksum/ s/[[:xdigit:]]{64}/$spm_checksum/" "Package.swift"
|
||||||
cp "Package.swift" "$SRCROOT"
|
cp "Package.swift" "$SRCROOT"
|
||||||
echo "Package.swift updated with the following values:"
|
echo "Package.swift updated with the following values:"
|
||||||
echo "Version: $CURRENT_PROJECT_VERSION"
|
echo "Version: $MARKETING_VERSION"
|
||||||
echo "Tag: $latest_git_tag"
|
echo "Tag: $latest_git_tag"
|
||||||
echo "Checksum: $spm_checksum"
|
echo "Checksum: $spm_checksum"
|
||||||
|
|
||||||
|
sed -E -i '' -e "/s\.version.+=/ s/\".+\"/\"$MARKETING_VERSION\"/" "Sparkle.podspec"
|
||||||
|
cp "Sparkle.podspec" "$SRCROOT"
|
||||||
|
echo "Sparkle.podspec updated with following values:"
|
||||||
|
echo "Version: $MARKETING_VERSION"
|
||||||
else
|
else
|
||||||
echo "warning: Xcode version $XCODE_VERSION_ACTUAL does not support computing checksums for Swift Packages. Please update the Package manifest manually."
|
echo "warning: Xcode version $XCODE_VERSION_ACTUAL does not support computing checksums for Swift Packages. Please update the Package manifest manually."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$XZ_EXISTS" -eq 1 ] ; then
|
if [ "$XZ_EXISTS" -ne 1 ] ; then
|
||||||
echo "WARNING: xz compression is used for official releases but bz2 is being used instead because xz tool is not installed on your system."
|
echo "WARNING: xz compression is used for official releases but bz2 is being used instead because xz tool is not installed on your system."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf "$CONFIGURATION_BUILD_DIR/staging-spm"
|
rm -rf "$CONFIGURATION_BUILD_DIR/staging-spm"
|
||||||
fi
|
fi
|
||||||
@@ -2,22 +2,32 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Convenience script to automatically commit Package.swift after updating the checksum and move the latest tag
|
# Convenience script to automatically commit Package.swift after updating the checksum and move the latest tag
|
||||||
latest_git_tag=$(git describe --abbrev=0 --tags) # gets the latest tag name
|
latest_git_tag=$(git describe --tags --abbrev=0) # gets the latest tag name
|
||||||
commits_since_tag=$(git rev-list ${latest_git_tag}.. --count)
|
commits_since_tag=$(git rev-list ${latest_git_tag}.. --count)
|
||||||
|
|
||||||
|
function move_tag() {
|
||||||
|
long_message=$(git tag -n99 -l $latest_git_tag) # gets corresponding message
|
||||||
|
long_message=${long_message/$latest_git_tag} # trims tag name
|
||||||
|
long_message="$(echo -e "${long_message}" | sed -e 's/^[[:space:]]*//')" # trim leading whitespace
|
||||||
|
git add Package.swift Sparkle.podspec
|
||||||
|
git commit -m "Update Package.swift and Sparkle.podspec for version ${latest_git_tag}"
|
||||||
|
git tag -fa $latest_git_tag -m "${long_message}"
|
||||||
|
echo "Package.swift and Sparkle.podspec committed and tag '$latest_git_tag' moved."
|
||||||
|
}
|
||||||
|
|
||||||
if [ "$commits_since_tag" -gt 0 ]; then
|
if [ "$commits_since_tag" -gt 0 ]; then
|
||||||
# If there have been commits since the latest tag, it's highly likely that we did not intend to do a full release
|
# If there have been commits since the latest tag, it's highly likely that we did not intend to do a full release
|
||||||
echo "WARNING: $commits_since_tag commit(s) since tag '$latest_git_tag'. Did you tag a new version?"
|
echo "WARNING: $commits_since_tag commit(s) since tag '$latest_git_tag'. Did you tag a new version?"
|
||||||
echo "Package.swift has not been committed and tag has not been moved."
|
echo "Package.swift has not been committed and tag has not been moved."
|
||||||
|
elif [ "$CI" == true ]; then
|
||||||
|
move_tag
|
||||||
else
|
else
|
||||||
# TODO: add sanity check to see if version is actually being updated or not?
|
# TODO: add sanity check to see if version is actually being updated or not?
|
||||||
read -p "Do you want to commit changes to Package.swift and force move tag '$latest_git_tag'? (required for SPM release) [Y/n]" -n 1 -r
|
read -p "Do you want to commit changes to Package.swift and Sparkle.podspec, and force move tag '$latest_git_tag'? (required for official release) [Y/n]" -n 1 -r
|
||||||
echo # (optional) move to a new line
|
echo # (optional) move to a new line
|
||||||
if [[ $REPLY =~ ^[Nn]$ ]]; then
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||||
echo "Package.swift has not been committed and tag has not been moved."
|
move_tag
|
||||||
else
|
else
|
||||||
git add Package.swift
|
echo "Package.swift and Sparkle.podspec have not been committed and tag has not been moved."
|
||||||
git commit -m "Update Package.swift"
|
|
||||||
git tag -f $latest_git_tag
|
|
||||||
echo "Package.swift committed and tag '$latest_git_tag' moved."
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -8,12 +8,12 @@ fi
|
|||||||
if [ -z "$SRCROOT" ] || \
|
if [ -z "$SRCROOT" ] || \
|
||||||
[ -z "$BUILT_PRODUCTS_DIR" ] || \
|
[ -z "$BUILT_PRODUCTS_DIR" ] || \
|
||||||
[ -z "$INFOPLIST_PATH" ] || \
|
[ -z "$INFOPLIST_PATH" ] || \
|
||||||
[ -z "$CURRENT_PROJECT_VERSION" ]; then
|
[ -z "$MARKETING_VERSION" ]; then
|
||||||
echo "$0: Must be run from Xcode!" 1>&2
|
echo "$0: Must be run from Xcode!" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
version="$CURRENT_PROJECT_VERSION"
|
version="$MARKETING_VERSION"
|
||||||
|
|
||||||
# Get version in format 1.x.x-commits-hash
|
# Get version in format 1.x.x-commits-hash
|
||||||
gitversion=$( cd "$SRCROOT"; git describe --tags --match '[12].*' || true )
|
gitversion=$( cd "$SRCROOT"; git describe --tags --match '[12].*' || true )
|
||||||
@@ -22,10 +22,10 @@ if [ -z "$gitversion" ] ; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# remove everything before the first "-" to keep the hash part only
|
# remove everything before the second last "-" to keep the hash part only
|
||||||
versionsuffix=${gitversion#*-};
|
versionsuffix=$( echo "${gitversion}" | sed -E 's/.+((-[^.]+){2})$/\1/' )
|
||||||
if [ "$versionsuffix" != "$gitversion" ]; then
|
if [ "$versionsuffix" != "$gitversion" ]; then
|
||||||
version="$version $versionsuffix"
|
version="$version$versionsuffix"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# and use it to set the CFBundleShortVersionString value
|
# and use it to set the CFBundleShortVersionString value
|
||||||
|
|||||||
+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 = "1.26.0"
|
let version = "1.27.3"
|
||||||
// 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 = "1.26.0"
|
let tag = "1.27.3"
|
||||||
let checksum = "0e7bd37ddfd6785f57f03451fef7397fe4ebee96a8613033cbf7d9bed19a7a60"
|
let checksum = "f0c6b4e6ffc6269a67b0d4ff254e3e8acfc6b3852db7b9957d4c0a5b39044446"
|
||||||
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(
|
||||||
|
|||||||
@@ -6,35 +6,39 @@
|
|||||||
<language>en</language>
|
<language>en</language>
|
||||||
<item>
|
<item>
|
||||||
<title>Version 2.0 (2 bugs fixed; 3 new features)</title>
|
<title>Version 2.0 (2 bugs fixed; 3 new features)</title>
|
||||||
|
<link>https://sparkle-project.org</link>
|
||||||
|
<sparkle:version>2.0</sparkle:version>
|
||||||
<sparkle:releaseNotesLink>
|
<sparkle:releaseNotesLink>
|
||||||
http://you.com/app/2.0.html
|
https://you.com/app/2.0.html
|
||||||
</sparkle:releaseNotesLink>
|
</sparkle:releaseNotesLink>
|
||||||
<pubDate>Wed, 09 Jan 2006 19:20:11 +0000</pubDate>
|
<pubDate>Wed, 09 Jan 2006 19:20:11 +0000</pubDate>
|
||||||
<!-- Sparkle 1.21+ uses sparkle::edSignature="ed25519" instead of sparkle::dsaSignature="deprecated DSA" -->
|
<enclosure url="https://you.com/app/Your%20Great%20App%202.0.zip" length="1623481" type="application/octet-stream" sparkle:edSignature="WVyVJpOx+a5+vNWJVY79TRjFKveNk+VhGJf2iti4CZtJsJewIUGvh/1AKKEAFbH1qUwx+vro1ECuzOsMmumoBA==" />
|
||||||
<enclosure url="http://you.com/app/Your%20Great%20App%202.0.zip" sparkle:version="2.0" length="1623481" type="application/octet-stream" sparkle:dsaSignature="BAFJW4B6B1K1JyW30nbkBwainOzrN6EQuAh" />
|
|
||||||
<sparkle:minimumSystemVersion>10.9</sparkle:minimumSystemVersion>
|
<sparkle:minimumSystemVersion>10.9</sparkle:minimumSystemVersion>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
<item>
|
<item>
|
||||||
<title>Version 1.5 (8 bugs fixed; 2 new features)</title>
|
<title>Version 1.5 (8 bugs fixed; 2 new features)</title>
|
||||||
|
<link>https://sparkle-project.org</link>
|
||||||
|
<sparkle:version>1.5</sparkle:version>
|
||||||
<sparkle:releaseNotesLink>
|
<sparkle:releaseNotesLink>
|
||||||
http://you.com/app/1.5.html
|
https://you.com/app/1.5.html
|
||||||
</sparkle:releaseNotesLink>
|
</sparkle:releaseNotesLink>
|
||||||
<pubDate>Wed, 01 Jan 2006 12:20:11 +0000</pubDate>
|
<pubDate>Wed, 01 Jan 2006 12:20:11 +0000</pubDate>
|
||||||
<!-- Sparkle 1.21+ uses sparkle::edSignature="ed25519" instead of sparkle::dsaSignature="deprecated DSA" -->
|
<enclosure url="https://you.com/app/Your%20Great%20App%201.5.zip" length="1472893" type="application/octet-stream" sparkle:edSignature="pNFd7KbcQSu+Mq7UYrbQXTPq82luht2ACXm/r2utp1u/Uv/5hWqctdT2jwQgMejW7DRoeV/hVr6J4VdZYdwWDw==" />
|
||||||
<enclosure url="http://you.com/app/Your%20Great%20App%201.5.zip" sparkle:version="1.5" length="1472893" type="application/octet-stream" sparkle:dsaSignature="234818feCa1JyW30nbkBwainOzrN6EQuAh" />
|
|
||||||
<sparkle:minimumSystemVersion>10.9</sparkle:minimumSystemVersion>
|
<sparkle:minimumSystemVersion>10.9</sparkle:minimumSystemVersion>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
<!-- Now here's an example of a version with a weird internal version number (like an SVN revision) but a human-readable external one. -->
|
<!-- Now here's an example of a version with a weird internal version number (like an SVN revision) but a human-readable external one. -->
|
||||||
<item>
|
<item>
|
||||||
<title>Version 1.4 (5 bugs fixed; 2 new features)</title>
|
<title>Version 1.4 (5 bugs fixed; 2 new features)</title>
|
||||||
|
<link>https://sparkle-project.org</link>
|
||||||
<sparkle:releaseNotesLink>
|
<sparkle:releaseNotesLink>
|
||||||
http://you.com/app/1.4.html
|
https://you.com/app/1.4.html
|
||||||
</sparkle:releaseNotesLink>
|
</sparkle:releaseNotesLink>
|
||||||
|
<sparkle:version>241</sparkle:version>
|
||||||
|
<sparkle:shortVersionString>1.4</sparkle:shortVersionString>
|
||||||
<pubDate>Wed, 25 Dec 2005 12:20:11 +0000</pubDate>
|
<pubDate>Wed, 25 Dec 2005 12:20:11 +0000</pubDate>
|
||||||
<!-- Sparkle 1.21+ uses sparkle::edSignature="ed25519" instead of sparkle::dsaSignature="deprecated DSA" -->
|
<enclosure url="https://you.com/app/Your%20Great%20App%201.4.zip" sparkle:edSignature="Ody3D/ybSMH4T+P/oNj3LN4F0SA8RJGLEr1TI4UemrBAiJ9aEcDnYV3u58P75AbcFjI13jPYmHDUHXMSTFQbDw==" length="1472349" type="application/octet-stream" />
|
||||||
<enclosure url="http://you.com/app/Your%20Great%20App%201.4.zip" sparkle:version="241" sparkle:shortVersionString="1.4" sparkle:dsaSignature="MC0CFBfeCa1JyW30nbkBwainOzrN6EQuAh=" length="1472349" type="application/octet-stream" />
|
|
||||||
<sparkle:minimumSystemVersion>10.9</sparkle:minimumSystemVersion>
|
<sparkle:minimumSystemVersion>10.9</sparkle:minimumSystemVersion>
|
||||||
</item>
|
</item>
|
||||||
</channel>
|
</channel>
|
||||||
|
|||||||
+4
-4
@@ -1,11 +1,11 @@
|
|||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = "Sparkle"
|
s.name = "Sparkle"
|
||||||
s.version = "1.26.0"
|
s.version = "1.27.3"
|
||||||
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 Cocoa developers."
|
s.description = "Sparkle is an easy-to-use software update framework for Cocoa developers."
|
||||||
s.homepage = "http://sparkle-project.org"
|
s.homepage = "https://sparkle-project.org"
|
||||||
s.documentation_url = "http://sparkle-project.org/documentation/"
|
s.documentation_url = "https://sparkle-project.org/documentation/"
|
||||||
s.screenshot = "http://sparkle-project.org/images/screenshot-noshadow@2x.png"
|
s.screenshot = "https://sparkle-project.org/images/screenshot-noshadow@2x.png"
|
||||||
s.license = {
|
s.license = {
|
||||||
:type => 'MIT',
|
:type => 'MIT',
|
||||||
:file => 'LICENSE'
|
:file => 'LICENSE'
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
895C5DBD24D75F590058A82D /* ShellScript */,
|
895C5DBD24D75F590058A82D /* ShellScript */,
|
||||||
);
|
);
|
||||||
dependencies = (
|
dependencies = (
|
||||||
|
72DA9D4726A0273500B12BB2 /* PBXTargetDependency */,
|
||||||
);
|
);
|
||||||
name = XCFramework;
|
name = XCFramework;
|
||||||
productName = Sparkle.xcframework;
|
productName = Sparkle.xcframework;
|
||||||
@@ -544,6 +545,13 @@
|
|||||||
remoteGlobalIDString = 61B5F90109C4CEE200B25A18;
|
remoteGlobalIDString = 61B5F90109C4CEE200B25A18;
|
||||||
remoteInfo = "Sparkle Test App";
|
remoteInfo = "Sparkle Test App";
|
||||||
};
|
};
|
||||||
|
72DA9D4626A0273500B12BB2 /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||||
|
proxyType = 1;
|
||||||
|
remoteGlobalIDString = 8DC2EF4F0486A6940098B216;
|
||||||
|
remoteInfo = Sparkle;
|
||||||
|
};
|
||||||
895C5DBE24D764DD0058A82D /* PBXContainerItemProxy */ = {
|
895C5DBE24D764DD0058A82D /* PBXContainerItemProxy */ = {
|
||||||
isa = PBXContainerItemProxy;
|
isa = PBXContainerItemProxy;
|
||||||
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
containerPortal = 0867D690FE84028FC02AAC07 /* Project object */;
|
||||||
@@ -2109,23 +2117,25 @@
|
|||||||
attributes = {
|
attributes = {
|
||||||
CLASSPREFIX = SU;
|
CLASSPREFIX = SU;
|
||||||
LastSwiftUpdateCheck = 1000;
|
LastSwiftUpdateCheck = 1000;
|
||||||
LastUpgradeCheck = 1230;
|
LastUpgradeCheck = 1300;
|
||||||
ORGANIZATIONNAME = "Sparkle Project";
|
ORGANIZATIONNAME = "Sparkle Project";
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
5A5ADED6214EDE4900DF0099 = {
|
5A5ADED6214EDE4900DF0099 = {
|
||||||
CreatedOnToolsVersion = 10.0;
|
CreatedOnToolsVersion = 10.0;
|
||||||
|
LastSwiftMigration = 1300;
|
||||||
ProvisioningStyle = Automatic;
|
ProvisioningStyle = Automatic;
|
||||||
};
|
};
|
||||||
5AA96C541E0AE0DB00CA4346 = {
|
5AA96C541E0AE0DB00CA4346 = {
|
||||||
CreatedOnToolsVersion = 8.0;
|
CreatedOnToolsVersion = 8.0;
|
||||||
LastSwiftMigration = 0900;
|
LastSwiftMigration = 1300;
|
||||||
ProvisioningStyle = Automatic;
|
ProvisioningStyle = Automatic;
|
||||||
};
|
};
|
||||||
5AB8F19E214DA72000A1187F = {
|
5AB8F19E214DA72000A1187F = {
|
||||||
|
LastSwiftMigration = 1300;
|
||||||
ProvisioningStyle = Automatic;
|
ProvisioningStyle = Automatic;
|
||||||
};
|
};
|
||||||
612279D80DB5470200AB99EA = {
|
612279D80DB5470200AB99EA = {
|
||||||
LastSwiftMigration = 0900;
|
LastSwiftMigration = 1300;
|
||||||
TestTargetID = 8DC2EF4F0486A6940098B216;
|
TestTargetID = 8DC2EF4F0486A6940098B216;
|
||||||
};
|
};
|
||||||
722954B31D04ADAF00ECF9CA = {
|
722954B31D04ADAF00ECF9CA = {
|
||||||
@@ -2298,14 +2308,13 @@
|
|||||||
files = (
|
files = (
|
||||||
);
|
);
|
||||||
inputPaths = (
|
inputPaths = (
|
||||||
$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH,
|
|
||||||
);
|
);
|
||||||
name = "Run Script: Set Git Version Info";
|
name = "Run Script: Set Git Version Info";
|
||||||
outputPaths = (
|
outputPaths = (
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "\"$SRCROOT/Configurations/set-git-version-info.sh\"";
|
shellScript = "\"$SRCROOT/Configurations/set-git-version-info.sh\"\n";
|
||||||
showEnvVarsInLog = 0;
|
showEnvVarsInLog = 0;
|
||||||
};
|
};
|
||||||
6131B1910DDCDE32005215F0 /* Run Script: Set Git Version Info */ = {
|
6131B1910DDCDE32005215F0 /* Run Script: Set Git Version Info */ = {
|
||||||
@@ -2314,14 +2323,13 @@
|
|||||||
files = (
|
files = (
|
||||||
);
|
);
|
||||||
inputPaths = (
|
inputPaths = (
|
||||||
$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH,
|
|
||||||
);
|
);
|
||||||
name = "Run Script: Set Git Version Info";
|
name = "Run Script: Set Git Version Info";
|
||||||
outputPaths = (
|
outputPaths = (
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "\"$SRCROOT/Configurations/set-git-version-info.sh\"";
|
shellScript = "\"$SRCROOT/Configurations/set-git-version-info.sh\"\n";
|
||||||
showEnvVarsInLog = 0;
|
showEnvVarsInLog = 0;
|
||||||
};
|
};
|
||||||
895C5DBD24D75F590058A82D /* ShellScript */ = {
|
895C5DBD24D75F590058A82D /* ShellScript */ = {
|
||||||
@@ -2721,6 +2729,11 @@
|
|||||||
target = 61B5F90109C4CEE200B25A18 /* Sparkle Test App */;
|
target = 61B5F90109C4CEE200B25A18 /* Sparkle Test App */;
|
||||||
targetProxy = 726B2B621C645FC900388755 /* PBXContainerItemProxy */;
|
targetProxy = 726B2B621C645FC900388755 /* PBXContainerItemProxy */;
|
||||||
};
|
};
|
||||||
|
72DA9D4726A0273500B12BB2 /* PBXTargetDependency */ = {
|
||||||
|
isa = PBXTargetDependency;
|
||||||
|
target = 8DC2EF4F0486A6940098B216 /* Sparkle */;
|
||||||
|
targetProxy = 72DA9D4626A0273500B12BB2 /* PBXContainerItemProxy */;
|
||||||
|
};
|
||||||
895C5DBF24D764DD0058A82D /* PBXTargetDependency */ = {
|
895C5DBF24D764DD0058A82D /* PBXTargetDependency */ = {
|
||||||
isa = PBXTargetDependency;
|
isa = PBXTargetDependency;
|
||||||
target = 895C5DB924D75F370058A82D /* XCFramework */;
|
target = 895C5DB924D75F370058A82D /* XCFramework */;
|
||||||
|
|||||||
@@ -2,6 +2,6 @@
|
|||||||
<Workspace
|
<Workspace
|
||||||
version = "1.0">
|
version = "1.0">
|
||||||
<FileRef
|
<FileRef
|
||||||
location = "self:Sparkle.xcodeproj">
|
location = "self:">
|
||||||
</FileRef>
|
</FileRef>
|
||||||
</Workspace>
|
</Workspace>
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Scheme
|
||||||
|
LastUpgradeVersion = "1310"
|
||||||
|
version = "1.3">
|
||||||
|
<BuildAction
|
||||||
|
parallelizeBuildables = "YES"
|
||||||
|
buildImplicitDependencies = "YES">
|
||||||
|
<BuildActionEntries>
|
||||||
|
<BuildActionEntry
|
||||||
|
buildForTesting = "YES"
|
||||||
|
buildForRunning = "YES"
|
||||||
|
buildForProfiling = "YES"
|
||||||
|
buildForArchiving = "YES"
|
||||||
|
buildForAnalyzing = "YES">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "5D06E8CF0FD68C7C005AE3F6"
|
||||||
|
BuildableName = "BinaryDelta"
|
||||||
|
BlueprintName = "BinaryDelta"
|
||||||
|
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildActionEntry>
|
||||||
|
</BuildActionEntries>
|
||||||
|
</BuildAction>
|
||||||
|
<TestAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||||
|
<Testables>
|
||||||
|
</Testables>
|
||||||
|
</TestAction>
|
||||||
|
<LaunchAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
launchStyle = "0"
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
|
debugDocumentVersioning = "YES"
|
||||||
|
debugServiceExtension = "internal"
|
||||||
|
allowLocationSimulation = "YES">
|
||||||
|
<BuildableProductRunnable
|
||||||
|
runnableDebuggingMode = "0">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "5D06E8CF0FD68C7C005AE3F6"
|
||||||
|
BuildableName = "BinaryDelta"
|
||||||
|
BlueprintName = "BinaryDelta"
|
||||||
|
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildableProductRunnable>
|
||||||
|
</LaunchAction>
|
||||||
|
<ProfileAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
savedToolIdentifier = ""
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
debugDocumentVersioning = "YES">
|
||||||
|
<BuildableProductRunnable
|
||||||
|
runnableDebuggingMode = "0">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "5D06E8CF0FD68C7C005AE3F6"
|
||||||
|
BuildableName = "BinaryDelta"
|
||||||
|
BlueprintName = "BinaryDelta"
|
||||||
|
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildableProductRunnable>
|
||||||
|
</ProfileAction>
|
||||||
|
<AnalyzeAction
|
||||||
|
buildConfiguration = "Debug">
|
||||||
|
</AnalyzeAction>
|
||||||
|
<ArchiveAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
revealArchiveInOrganizer = "YES">
|
||||||
|
</ArchiveAction>
|
||||||
|
</Scheme>
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "0920"
|
LastUpgradeVersion = "1300"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "NO"
|
parallelizeBuildables = "YES"
|
||||||
buildImplicitDependencies = "YES">
|
buildImplicitDependencies = "YES">
|
||||||
<BuildActionEntries>
|
<BuildActionEntries>
|
||||||
<BuildActionEntry
|
<BuildActionEntry
|
||||||
@@ -26,8 +26,16 @@
|
|||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Debug"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
language = ""
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||||
|
<MacroExpansion>
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "14732BC51960F69300593899"
|
||||||
|
BuildableName = "Distribution"
|
||||||
|
BlueprintName = "Distribution"
|
||||||
|
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</MacroExpansion>
|
||||||
<Testables>
|
<Testables>
|
||||||
<TestableReference
|
<TestableReference
|
||||||
skipped = "NO">
|
skipped = "NO">
|
||||||
@@ -40,23 +48,11 @@
|
|||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</TestableReference>
|
</TestableReference>
|
||||||
</Testables>
|
</Testables>
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "14732BC51960F69300593899"
|
|
||||||
BuildableName = "Distribution"
|
|
||||||
BlueprintName = "Distribution"
|
|
||||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</TestAction>
|
</TestAction>
|
||||||
<LaunchAction
|
<LaunchAction
|
||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Debug"
|
||||||
selectedDebuggerIdentifier = ""
|
selectedDebuggerIdentifier = ""
|
||||||
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
|
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
|
||||||
language = ""
|
|
||||||
launchStyle = "0"
|
launchStyle = "0"
|
||||||
useCustomWorkingDirectory = "NO"
|
useCustomWorkingDirectory = "NO"
|
||||||
ignoresPersistentStateOnLaunch = "NO"
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
@@ -72,8 +68,6 @@
|
|||||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</MacroExpansion>
|
</MacroExpansion>
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</LaunchAction>
|
</LaunchAction>
|
||||||
<ProfileAction
|
<ProfileAction
|
||||||
buildConfiguration = "Release"
|
buildConfiguration = "Release"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "1230"
|
LastUpgradeVersion = "1300"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "0920"
|
LastUpgradeVersion = "1300"
|
||||||
version = "2.0">
|
version = "2.0">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
@@ -26,8 +26,16 @@
|
|||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Debug"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
language = ""
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||||
|
<MacroExpansion>
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "8DC2EF4F0486A6940098B216"
|
||||||
|
BuildableName = "Sparkle.framework"
|
||||||
|
BlueprintName = "Sparkle"
|
||||||
|
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</MacroExpansion>
|
||||||
<Testables>
|
<Testables>
|
||||||
<TestableReference
|
<TestableReference
|
||||||
skipped = "NO">
|
skipped = "NO">
|
||||||
@@ -40,23 +48,11 @@
|
|||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</TestableReference>
|
</TestableReference>
|
||||||
</Testables>
|
</Testables>
|
||||||
<MacroExpansion>
|
|
||||||
<BuildableReference
|
|
||||||
BuildableIdentifier = "primary"
|
|
||||||
BlueprintIdentifier = "8DC2EF4F0486A6940098B216"
|
|
||||||
BuildableName = "Sparkle.framework"
|
|
||||||
BlueprintName = "Sparkle"
|
|
||||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
|
||||||
</BuildableReference>
|
|
||||||
</MacroExpansion>
|
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</TestAction>
|
</TestAction>
|
||||||
<LaunchAction
|
<LaunchAction
|
||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Debug"
|
||||||
selectedDebuggerIdentifier = ""
|
selectedDebuggerIdentifier = ""
|
||||||
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
|
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
|
||||||
language = ""
|
|
||||||
launchStyle = "0"
|
launchStyle = "0"
|
||||||
useCustomWorkingDirectory = "NO"
|
useCustomWorkingDirectory = "NO"
|
||||||
ignoresPersistentStateOnLaunch = "NO"
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
@@ -73,8 +69,6 @@
|
|||||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</MacroExpansion>
|
</MacroExpansion>
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</LaunchAction>
|
</LaunchAction>
|
||||||
<ProfileAction
|
<ProfileAction
|
||||||
buildConfiguration = "Release"
|
buildConfiguration = "Release"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "0920"
|
LastUpgradeVersion = "1300"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Debug"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
language = ""
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||||
<Testables>
|
<Testables>
|
||||||
<TestableReference
|
<TestableReference
|
||||||
@@ -24,22 +23,17 @@
|
|||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</TestableReference>
|
</TestableReference>
|
||||||
</Testables>
|
</Testables>
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</TestAction>
|
</TestAction>
|
||||||
<LaunchAction
|
<LaunchAction
|
||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Debug"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
language = ""
|
|
||||||
launchStyle = "0"
|
launchStyle = "0"
|
||||||
useCustomWorkingDirectory = "NO"
|
useCustomWorkingDirectory = "NO"
|
||||||
ignoresPersistentStateOnLaunch = "NO"
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
debugDocumentVersioning = "YES"
|
debugDocumentVersioning = "YES"
|
||||||
debugServiceExtension = "internal"
|
debugServiceExtension = "internal"
|
||||||
allowLocationSimulation = "YES">
|
allowLocationSimulation = "YES">
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</LaunchAction>
|
</LaunchAction>
|
||||||
<ProfileAction
|
<ProfileAction
|
||||||
buildConfiguration = "Release"
|
buildConfiguration = "Release"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "1200"
|
LastUpgradeVersion = "1300"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "0920"
|
LastUpgradeVersion = "1300"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
@@ -26,10 +26,7 @@
|
|||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Debug"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
language = ""
|
|
||||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||||
<Testables>
|
|
||||||
</Testables>
|
|
||||||
<MacroExpansion>
|
<MacroExpansion>
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
@@ -39,14 +36,13 @@
|
|||||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</MacroExpansion>
|
</MacroExpansion>
|
||||||
<AdditionalOptions>
|
<Testables>
|
||||||
</AdditionalOptions>
|
</Testables>
|
||||||
</TestAction>
|
</TestAction>
|
||||||
<LaunchAction
|
<LaunchAction
|
||||||
buildConfiguration = "Release"
|
buildConfiguration = "Release"
|
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
language = ""
|
|
||||||
launchStyle = "0"
|
launchStyle = "0"
|
||||||
useCustomWorkingDirectory = "NO"
|
useCustomWorkingDirectory = "NO"
|
||||||
ignoresPersistentStateOnLaunch = "NO"
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
@@ -63,8 +59,6 @@
|
|||||||
ReferencedContainer = "container:Sparkle.xcodeproj">
|
ReferencedContainer = "container:Sparkle.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</BuildableProductRunnable>
|
</BuildableProductRunnable>
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</LaunchAction>
|
</LaunchAction>
|
||||||
<ProfileAction
|
<ProfileAction
|
||||||
buildConfiguration = "Release"
|
buildConfiguration = "Release"
|
||||||
|
|||||||
+3
-1
@@ -13,7 +13,7 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
<string>${MARKETING_VERSION}</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
@@ -28,6 +28,8 @@
|
|||||||
<string>MainMenu</string>
|
<string>MainMenu</string>
|
||||||
<key>NSPrincipalClass</key>
|
<key>NSPrincipalClass</key>
|
||||||
<string>NSApplication</string>
|
<string>NSApplication</string>
|
||||||
|
<key>LSApplicationCategoryType</key>
|
||||||
|
<string>public.app-category.utilities</string>
|
||||||
<key>CFBundleIconFile</key>
|
<key>CFBundleIconFile</key>
|
||||||
<string>${ASSETCATALOG_COMPILER_APPICON_NAME}.icns</string>
|
<string>${ASSETCATALOG_COMPILER_APPICON_NAME}.icns</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
|||||||
Vendored
+3
-3
@@ -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="17701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="19455" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="macosx"/>
|
<deployment identifier="macosx"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17701"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="19455"/>
|
||||||
<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>
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
</customObject>
|
</customObject>
|
||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||||
<window identifier="SUUpdateAlert" title="Software Update" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hidesOnDeactivate="YES" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="SUUpdateAlert" animationBehavior="default" id="5" userLabel="Update Alert (release notes)">
|
<window identifier="SUUpdateAlert" title="Software Update" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="SUUpdateAlert" animationBehavior="default" id="5" userLabel="Update Alert (release notes)">
|
||||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
||||||
<windowCollectionBehavior key="collectionBehavior" fullScreenAuxiliary="YES"/>
|
<windowCollectionBehavior key="collectionBehavior" fullScreenAuxiliary="YES"/>
|
||||||
<windowPositionMask key="initialPositionMask" topStrut="YES" bottomStrut="YES"/>
|
<windowPositionMask key="initialPositionMask" topStrut="YES" bottomStrut="YES"/>
|
||||||
|
|||||||
Vendored
+3
@@ -10,6 +10,9 @@
|
|||||||
#define SUAPPCASTITEM_H
|
#define SUAPPCASTITEM_H
|
||||||
|
|
||||||
#if __has_feature(modules)
|
#if __has_feature(modules)
|
||||||
|
#if __has_warning("-Watimport-in-framework-header")
|
||||||
|
#pragma clang diagnostic ignored "-Watimport-in-framework-header"
|
||||||
|
#endif
|
||||||
@import Foundation;
|
@import Foundation;
|
||||||
#else
|
#else
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
|
|||||||
Vendored
-1
@@ -61,7 +61,6 @@ static const NSTimeInterval SUAutomaticUpdatePromptImpatienceTimer = 60 * 60 * 2
|
|||||||
// update prompt to behave like a normal window. Otherwise if the window were hidden
|
// update prompt to behave like a normal window. Otherwise if the window were hidden
|
||||||
// there may be no way for the application to be activated to make it visible again.
|
// there may be no way for the application to be activated to make it visible again.
|
||||||
if ([SUApplicationInfo isBackgroundApplication:[NSApplication sharedApplication]]) {
|
if ([SUApplicationInfo isBackgroundApplication:[NSApplication sharedApplication]]) {
|
||||||
[[self.alert window] setHidesOnDeactivate:NO];
|
|
||||||
[NSApp activateIgnoringOtherApps:YES];
|
[NSApp activateIgnoringOtherApps:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+27
-14
@@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
#import "SPUURLRequest.h"
|
#import "SPUURLRequest.h"
|
||||||
#import "SPUDownloaderSession.h"
|
#import "SPUDownloaderSession.h"
|
||||||
|
#import "SPULocalCacheDirectory.h"
|
||||||
|
|
||||||
@interface SUBasicUpdateDriver ()
|
@interface SUBasicUpdateDriver ()
|
||||||
|
|
||||||
@@ -38,6 +39,7 @@
|
|||||||
@property (assign) NSComparisonResult latestAppcastItemComparisonResult;
|
@property (assign) NSComparisonResult latestAppcastItemComparisonResult;
|
||||||
@property (strong) SPUDownloader *download;
|
@property (strong) SPUDownloader *download;
|
||||||
@property (copy) NSString *downloadPath;
|
@property (copy) NSString *downloadPath;
|
||||||
|
@property (copy) NSString *extractionDirectory;
|
||||||
|
|
||||||
@property (strong) SUAppcastItem *nonDeltaUpdateItem;
|
@property (strong) SUAppcastItem *nonDeltaUpdateItem;
|
||||||
@property (copy) NSString *tempDir;
|
@property (copy) NSString *tempDir;
|
||||||
@@ -54,6 +56,7 @@
|
|||||||
@synthesize latestAppcastItemComparisonResult;
|
@synthesize latestAppcastItemComparisonResult;
|
||||||
@synthesize download;
|
@synthesize download;
|
||||||
@synthesize downloadPath;
|
@synthesize downloadPath;
|
||||||
|
@synthesize extractionDirectory = _extractionDirectory;
|
||||||
|
|
||||||
@synthesize nonDeltaUpdateItem;
|
@synthesize nonDeltaUpdateItem;
|
||||||
@synthesize tempDir;
|
@synthesize tempDir;
|
||||||
@@ -383,6 +386,7 @@
|
|||||||
{
|
{
|
||||||
self.tempDir = temporaryDirectory;
|
self.tempDir = temporaryDirectory;
|
||||||
self.downloadPath = [temporaryDirectory stringByAppendingPathComponent:destinationName];
|
self.downloadPath = [temporaryDirectory stringByAppendingPathComponent:destinationName];
|
||||||
|
self.extractionDirectory = [SPULocalCacheDirectory createUniqueDirectoryInDirectory:temporaryDirectory];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)downloaderDidReceiveExpectedContentLength:(int64_t)__unused expectedContentLength
|
- (void)downloaderDidReceiveExpectedContentLength:(int64_t)__unused expectedContentLength
|
||||||
@@ -441,22 +445,30 @@
|
|||||||
|
|
||||||
- (void)extractUpdate
|
- (void)extractUpdate
|
||||||
{
|
{
|
||||||
id<SUUpdaterPrivate> updater = self.updater;
|
|
||||||
id<SUUnarchiverProtocol> unarchiver = [SUUnarchiver unarchiverForPath:self.downloadPath updatingHostBundlePath:self.host.bundlePath decryptionPassword:updater.decryptionPassword];
|
|
||||||
|
|
||||||
BOOL success = NO;
|
BOOL success = NO;
|
||||||
if (!unarchiver) {
|
|
||||||
SULog(SULogLevelError, @"Error: No valid unarchiver for %@!", self.downloadPath);
|
id<SUUpdaterPrivate> updater = self.updater;
|
||||||
|
|
||||||
|
id<SUUnarchiverProtocol> unarchiver;
|
||||||
|
if (self.extractionDirectory == nil) {
|
||||||
|
SULog(SULogLevelError, @"Error: Failed to create temporary extraction directory for %@!", self.downloadPath);
|
||||||
|
unarchiver = nil;
|
||||||
} else {
|
} else {
|
||||||
self.updateValidator = [[SUUpdateValidator alloc] initWithDownloadPath:self.downloadPath signatures:self.updateItem.signatures host:self.host];
|
unarchiver = [SUUnarchiver unarchiverForPath:self.downloadPath extractionDirectory:self.extractionDirectory updatingHostBundlePath:self.host.bundlePath decryptionPassword:updater.decryptionPassword];
|
||||||
|
|
||||||
// Currently unsafe archives are the only case where we can prevalidate before extraction, but that could change in the future
|
if (!unarchiver) {
|
||||||
BOOL needsPrevalidation = [[unarchiver class] mustValidateBeforeExtraction];
|
SULog(SULogLevelError, @"Error: No valid unarchiver for %@!", self.downloadPath);
|
||||||
|
|
||||||
if (needsPrevalidation) {
|
|
||||||
success = [self.updateValidator validateDownloadPath];
|
|
||||||
} else {
|
} else {
|
||||||
success = YES;
|
self.updateValidator = [[SUUpdateValidator alloc] initWithDownloadPath:self.downloadPath signatures:self.updateItem.signatures host:self.host];
|
||||||
|
|
||||||
|
// Currently unsafe archives are the only case where we can prevalidate before extraction, but that could change in the future
|
||||||
|
BOOL needsPrevalidation = [[unarchiver class] mustValidateBeforeExtraction];
|
||||||
|
|
||||||
|
if (needsPrevalidation) {
|
||||||
|
success = [self.updateValidator validateDownloadPath];
|
||||||
|
} else {
|
||||||
|
success = YES;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -560,8 +572,9 @@
|
|||||||
{
|
{
|
||||||
assert(self.updateItem);
|
assert(self.updateItem);
|
||||||
assert(self.updateValidator);
|
assert(self.updateValidator);
|
||||||
|
assert(self.extractionDirectory);
|
||||||
|
|
||||||
BOOL validationCheckSuccess = [self.updateValidator validateWithUpdateDirectory:self.tempDir];
|
BOOL validationCheckSuccess = [self.updateValidator validateWithUpdateDirectory:self.extractionDirectory];
|
||||||
if (!validationCheckSuccess) {
|
if (!validationCheckSuccess) {
|
||||||
NSDictionary *userInfo = @{
|
NSDictionary *userInfo = @{
|
||||||
NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while extracting the archive. Please try again later.", nil),
|
NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while extracting the archive. Please try again later.", nil),
|
||||||
|
|||||||
Vendored
+99
-3
@@ -14,9 +14,22 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <xar/xar.h>
|
#include <xar/xar.h>
|
||||||
|
#include <Availability.h>
|
||||||
|
|
||||||
#include "AppKitPrevention.h"
|
#include "AppKitPrevention.h"
|
||||||
|
|
||||||
|
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 120000
|
||||||
|
#define HAS_XAR_GET_SAFE_PATH 1
|
||||||
|
#else
|
||||||
|
#define HAS_XAR_GET_SAFE_PATH 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if HAS_XAR_GET_SAFE_PATH
|
||||||
|
// This is preferred over xar_get_path (which is deprecated) when it's available
|
||||||
|
// Don't use OS availability for this API
|
||||||
|
extern char *xar_get_safe_path(xar_file_t f) __attribute__((weak_import));
|
||||||
|
#endif
|
||||||
|
|
||||||
static BOOL applyBinaryDeltaToFile(xar_t x, xar_file_t file, NSString *sourceFilePath, NSString *destinationFilePath)
|
static BOOL applyBinaryDeltaToFile(xar_t x, xar_file_t file, NSString *sourceFilePath, NSString *destinationFilePath)
|
||||||
{
|
{
|
||||||
NSString *patchFile = temporaryFilename(@"apply-binary-delta");
|
NSString *patchFile = temporaryFilename(@"apply-binary-delta");
|
||||||
@@ -86,6 +99,8 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (majorDiffVersion < FIRST_DELTA_DIFF_MAJOR_VERSION) {
|
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] }];
|
||||||
}
|
}
|
||||||
@@ -93,18 +108,36 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (majorDiffVersion > LATEST_DELTA_DIFF_MAJOR_VERSION) {
|
if (majorDiffVersion > LATEST_DELTA_DIFF_MAJOR_VERSION) {
|
||||||
|
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: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] }];
|
||||||
}
|
}
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HAS_XAR_GET_SAFE_PATH
|
||||||
|
// Reject patches that did not generate valid hierarchical xar container paths
|
||||||
|
// These will not succeed to patch using recent versions of BinaryDelta
|
||||||
|
if ((majorDiffVersion == SUBinaryDeltaMajorVersion2 && minorDiffVersion < 3) || (majorDiffVersion == SUBinaryDeltaMajorVersion1 && minorDiffVersion < 2)) {
|
||||||
|
xar_close(x);
|
||||||
|
|
||||||
|
if (error != NULL) {
|
||||||
|
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadCorruptFileError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"This patch version (%u.%u) is too old and potentially unsafe to apply. Please re-generate the patch using the latest version of BinaryDelta or generate_appcast. New version %u.%u patches will still be compatible with older versions of Sparkle.", majorDiffVersion, minorDiffVersion, majorDiffVersion, latestMinorVersionForMajorVersion(majorDiffVersion)] }];
|
||||||
|
}
|
||||||
|
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
BOOL usesNewTreeHash = MAJOR_VERSION_IS_AT_LEAST(majorDiffVersion, SUBeigeMajorVersion);
|
BOOL usesNewTreeHash = MAJOR_VERSION_IS_AT_LEAST(majorDiffVersion, SUBinaryDeltaMajorVersion2);
|
||||||
|
|
||||||
NSString *expectedBeforeHash = usesNewTreeHash ? expectedNewBeforeHash : expectedBeforeHashv1;
|
NSString *expectedBeforeHash = usesNewTreeHash ? expectedNewBeforeHash : expectedBeforeHashv1;
|
||||||
NSString *expectedAfterHash = usesNewTreeHash ? expectedNewAfterHash : expectedAfterHashv1;
|
NSString *expectedAfterHash = usesNewTreeHash ? expectedNewAfterHash : expectedAfterHashv1;
|
||||||
|
|
||||||
if (!expectedBeforeHash || !expectedAfterHash) {
|
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." }];
|
||||||
}
|
}
|
||||||
@@ -120,6 +153,8 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
|
|
||||||
NSString *beforeHash = hashOfTreeWithVersion(source, majorDiffVersion);
|
NSString *beforeHash = hashOfTreeWithVersion(source, majorDiffVersion);
|
||||||
if (!beforeHash) {
|
if (!beforeHash) {
|
||||||
|
xar_close(x);
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
@@ -130,6 +165,8 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (![beforeHash isEqualToString:expectedBeforeHash]) {
|
if (![beforeHash isEqualToString:expectedBeforeHash]) {
|
||||||
|
xar_close(x);
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
@@ -146,6 +183,8 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
progressCallback(2/6.0);
|
progressCallback(2/6.0);
|
||||||
|
|
||||||
if (!removeTree(destination)) {
|
if (!removeTree(destination)) {
|
||||||
|
xar_close(x);
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
@@ -158,6 +197,8 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
progressCallback(3/6.0);
|
progressCallback(3/6.0);
|
||||||
|
|
||||||
if (!copyTree(source, destination)) {
|
if (!copyTree(source, destination)) {
|
||||||
|
xar_close(x);
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
@@ -169,7 +210,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
|
|
||||||
progressCallback(4/6.0);
|
progressCallback(4/6.0);
|
||||||
|
|
||||||
BOOL hasExtractKeyAvailable = MAJOR_VERSION_IS_AT_LEAST(majorDiffVersion, SUBeigeMajorVersion);
|
BOOL hasExtractKeyAvailable = MAJOR_VERSION_IS_AT_LEAST(majorDiffVersion, SUBinaryDeltaMajorVersion2);
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\nPatching...");
|
fprintf(stderr, "\nPatching...");
|
||||||
@@ -178,17 +219,65 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
xar_file_t file;
|
xar_file_t file;
|
||||||
xar_iter_t iter = xar_iter_new();
|
xar_iter_t iter = xar_iter_new();
|
||||||
for (file = xar_file_first(x, iter); file; file = xar_file_next(iter)) {
|
for (file = xar_file_first(x, iter); file; file = xar_file_next(iter)) {
|
||||||
NSString *path = @(xar_get_path(file));
|
char *pathCString;
|
||||||
|
#if HAS_XAR_GET_SAFE_PATH
|
||||||
|
if (xar_get_safe_path != NULL) {
|
||||||
|
pathCString = xar_get_safe_path(file);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
pathCString = xar_get_path(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pathCString == NULL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSString *path = @(pathCString);
|
||||||
|
if ([path.pathComponents containsObject:@".."]) {
|
||||||
|
xar_close(x);
|
||||||
|
|
||||||
|
if (error != NULL) {
|
||||||
|
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Relative path '%@' contains '..' path component", path] }];
|
||||||
|
}
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
NSString *sourceFilePath = [source stringByAppendingPathComponent:path];
|
NSString *sourceFilePath = [source stringByAppendingPathComponent:path];
|
||||||
NSString *destinationFilePath = [destination stringByAppendingPathComponent:path];
|
NSString *destinationFilePath = [destination stringByAppendingPathComponent:path];
|
||||||
|
{
|
||||||
|
NSString *destinationParentDirectory = destinationFilePath.stringByDeletingLastPathComponent;
|
||||||
|
NSDictionary<NSFileAttributeKey, id> *destinationParentDirectoryAttributes = [fileManager attributesOfItemAtPath:destinationParentDirectory error:NULL];
|
||||||
|
|
||||||
|
// It is OK for the directory parent to not exist if it has already been removed
|
||||||
|
if (destinationParentDirectoryAttributes != nil) {
|
||||||
|
// But if it does exist, make sure the entry in the parent directory we're looking at is good
|
||||||
|
// If it's inside a symlink, this is not good in any circumstance
|
||||||
|
NSString *fileType = destinationParentDirectoryAttributes[NSFileType];
|
||||||
|
if ([fileType isEqualToString:NSFileTypeSymbolicLink]) {
|
||||||
|
xar_close(x);
|
||||||
|
|
||||||
|
if (error != NULL) {
|
||||||
|
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileWriteUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to create patch because '%@' cannot be a symbolic link.", destinationParentDirectory] }];
|
||||||
|
}
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Don't use -[NSFileManager fileExistsAtPath:] because it will follow symbolic links
|
// Don't use -[NSFileManager fileExistsAtPath:] because it will follow symbolic links
|
||||||
BOOL fileExisted = verbose && [fileManager attributesOfItemAtPath:destinationFilePath error:nil];
|
BOOL fileExisted = verbose && [fileManager attributesOfItemAtPath:destinationFilePath error:nil];
|
||||||
BOOL removedFile = NO;
|
BOOL removedFile = NO;
|
||||||
|
|
||||||
|
// Files that have no property set that we check for will get ignored
|
||||||
|
// This is important because they aren't part of the delta, just part of the directory structure
|
||||||
|
|
||||||
const char *value;
|
const char *value;
|
||||||
if (!xar_prop_get(file, DELETE_KEY, &value) || (!hasExtractKeyAvailable && !xar_prop_get(file, DELETE_THEN_EXTRACT_OLD_KEY, &value))) {
|
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");
|
||||||
}
|
}
|
||||||
@@ -209,6 +298,8 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
|
|
||||||
if (!xar_prop_get(file, BINARY_DELTA_KEY, &value)) {
|
if (!xar_prop_get(file, BINARY_DELTA_KEY, &value)) {
|
||||||
if (!applyBinaryDeltaToFile(x, file, sourceFilePath, destinationFilePath)) {
|
if (!applyBinaryDeltaToFile(x, file, sourceFilePath, destinationFilePath)) {
|
||||||
|
xar_close(x);
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
@@ -224,6 +315,8 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
} 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 ((hasExtractKeyAvailable && !xar_prop_get(file, EXTRACT_KEY, &value)) || (!hasExtractKeyAvailable && xar_prop_get(file, MODIFY_PERMISSIONS_KEY, &value))) { // extract and permission modifications don't coexist
|
||||||
|
|
||||||
if (xar_extract_tofile(x, file, [destinationFilePath fileSystemRepresentation]) != 0) {
|
if (xar_extract_tofile(x, file, [destinationFilePath fileSystemRepresentation]) != 0) {
|
||||||
|
xar_close(x);
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
@@ -247,6 +340,8 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
if (!xar_prop_get(file, MODIFY_PERMISSIONS_KEY, &value)) {
|
if (!xar_prop_get(file, MODIFY_PERMISSIONS_KEY, &value)) {
|
||||||
mode_t mode = (mode_t)[[NSString stringWithUTF8String:value] intValue];
|
mode_t mode = (mode_t)[[NSString stringWithUTF8String:value] intValue];
|
||||||
if (!modifyPermissions(destinationFilePath, mode)) {
|
if (!modifyPermissions(destinationFilePath, mode)) {
|
||||||
|
xar_close(x);
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
@@ -261,6 +356,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *destination, NSString *patchFi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xar_close(x);
|
xar_close(x);
|
||||||
|
|
||||||
progressCallback(5/6.0);
|
progressCallback(5/6.0);
|
||||||
|
|||||||
Vendored
+4
-5
@@ -53,15 +53,14 @@
|
|||||||
|
|
||||||
typedef NS_ENUM(uint16_t, SUBinaryDeltaMajorVersion)
|
typedef NS_ENUM(uint16_t, SUBinaryDeltaMajorVersion)
|
||||||
{
|
{
|
||||||
SUAzureMajorVersion = 1,
|
SUBinaryDeltaMajorVersion1 = 1,
|
||||||
SUBeigeMajorVersion = 2
|
SUBinaryDeltaMajorVersion2 = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FIRST_DELTA_DIFF_MAJOR_VERSION SUAzureMajorVersion
|
#define FIRST_DELTA_DIFF_MAJOR_VERSION SUBinaryDeltaMajorVersion1
|
||||||
#define LATEST_DELTA_DIFF_MAJOR_VERSION SUBeigeMajorVersion
|
#define LATEST_DELTA_DIFF_MAJOR_VERSION SUBinaryDeltaMajorVersion2
|
||||||
|
|
||||||
extern int compareFiles(const FTSENT **a, const FTSENT **b);
|
extern int compareFiles(const FTSENT **a, const FTSENT **b);
|
||||||
extern NSData *hashOfFileContents(FTSENT *ent);
|
|
||||||
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);
|
||||||
|
|||||||
Vendored
+5
-14
@@ -42,10 +42,10 @@ NSString *stringWithFileSystemRepresentation(const char *input)
|
|||||||
int latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion)
|
int latestMinorVersionForMajorVersion(SUBinaryDeltaMajorVersion majorVersion)
|
||||||
{
|
{
|
||||||
switch (majorVersion) {
|
switch (majorVersion) {
|
||||||
case SUAzureMajorVersion:
|
case SUBinaryDeltaMajorVersion1:
|
||||||
return 1;
|
|
||||||
case SUBeigeMajorVersion:
|
|
||||||
return 2;
|
return 2;
|
||||||
|
case SUBinaryDeltaMajorVersion2:
|
||||||
|
return 3;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -137,15 +137,6 @@ static BOOL _hashOfFileContents(unsigned char *hash, FTSENT *ent)
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSData *hashOfFileContents(FTSENT *ent)
|
|
||||||
{
|
|
||||||
unsigned char fileHash[CC_SHA1_DIGEST_LENGTH];
|
|
||||||
if (!_hashOfFileContents(fileHash, ent)) {
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
return [NSData dataWithBytes:fileHash length:CC_SHA1_DIGEST_LENGTH];
|
|
||||||
}
|
|
||||||
|
|
||||||
NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion)
|
NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion)
|
||||||
{
|
{
|
||||||
char pathBuffer[PATH_MAX] = { 0 };
|
char pathBuffer[PATH_MAX] = { 0 };
|
||||||
@@ -171,7 +162,7 @@ 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, SUBeigeMajorVersion)) {
|
if (ent->fts_info == FTS_D && !MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,7 +179,7 @@ NSString *hashOfTreeWithVersion(NSString *path, uint16_t majorVersion)
|
|||||||
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, SUBeigeMajorVersion)) {
|
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2)) {
|
||||||
uint16_t mode = ent->fts_statp->st_mode;
|
uint16_t mode = ent->fts_statp->st_mode;
|
||||||
// permission of symlinks is irrelevant and can't be changed.
|
// permission of symlinks is irrelevant and can't be changed.
|
||||||
// hardcoding a value helps avoid differences between filesystems.
|
// hardcoding a value helps avoid differences between filesystems.
|
||||||
|
|||||||
Vendored
+95
-32
@@ -66,25 +66,23 @@ extern int bsdiff(int argc, const char **argv);
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#define INFO_HASH_KEY @"hash"
|
#define INFO_PATH_KEY @"path"
|
||||||
#define INFO_TYPE_KEY @"type"
|
#define INFO_TYPE_KEY @"type"
|
||||||
#define INFO_PERMISSIONS_KEY @"permissions"
|
#define INFO_PERMISSIONS_KEY @"permissions"
|
||||||
#define INFO_SIZE_KEY @"size"
|
#define INFO_SIZE_KEY @"size"
|
||||||
|
|
||||||
static NSDictionary *infoForFile(FTSENT *ent)
|
static NSDictionary *infoForFile(FTSENT *ent)
|
||||||
{
|
{
|
||||||
NSData *hash = hashOfFileContents(ent);
|
|
||||||
if (!hash) {
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
off_t size = (ent->fts_info != FTS_D) ? ent->fts_statp->st_size : 0;
|
off_t size = (ent->fts_info != FTS_D) ? ent->fts_statp->st_size : 0;
|
||||||
|
|
||||||
assert(ent->fts_statp != NULL);
|
assert(ent->fts_statp != NULL);
|
||||||
|
|
||||||
mode_t permissions = ent->fts_statp->st_mode & PERMISSION_FLAGS;
|
mode_t permissions = ent->fts_statp->st_mode & PERMISSION_FLAGS;
|
||||||
|
|
||||||
return @{ INFO_HASH_KEY: hash,
|
NSString *path = @(ent->fts_path);
|
||||||
|
assert(path != nil);
|
||||||
|
|
||||||
|
return @{ INFO_PATH_KEY: path != nil ? path : @"",
|
||||||
INFO_TYPE_KEY: @(ent->fts_info),
|
INFO_TYPE_KEY: @(ent->fts_info),
|
||||||
INFO_PERMISSIONS_KEY: @(permissions),
|
INFO_PERMISSIONS_KEY: @(permissions),
|
||||||
INFO_SIZE_KEY: @(size) };
|
INFO_SIZE_KEY: @(size) };
|
||||||
@@ -165,7 +163,7 @@ static NSString *temporaryPatchFile(NSString *patchFile)
|
|||||||
|
|
||||||
static BOOL shouldSkipDeltaCompression(NSDictionary *originalInfo, NSDictionary *newInfo)
|
static BOOL shouldSkipDeltaCompression(NSDictionary *originalInfo, NSDictionary *newInfo)
|
||||||
{
|
{
|
||||||
unsigned long long fileSize = [newInfo[INFO_SIZE_KEY] unsignedLongLongValue];
|
unsigned long long fileSize = [(NSNumber *)newInfo[INFO_SIZE_KEY] unsignedLongLongValue];
|
||||||
if (fileSize < MIN_FILE_SIZE_FOR_CREATING_DELTA) {
|
if (fileSize < MIN_FILE_SIZE_FOR_CREATING_DELTA) {
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
@@ -174,12 +172,19 @@ static BOOL shouldSkipDeltaCompression(NSDictionary *originalInfo, NSDictionary
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
|
unsigned short originalInfoType = [(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue];
|
||||||
|
unsigned short newInfoType = [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue];
|
||||||
|
if (originalInfoType != newInfoType) {
|
||||||
|
// File types are different
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([originalInfo[INFO_HASH_KEY] isEqual:newInfo[INFO_HASH_KEY]]) {
|
NSString *originalPath = originalInfo[INFO_PATH_KEY];
|
||||||
// this is possible if just the permissions have changed
|
NSString *newPath = newInfo[INFO_PATH_KEY];
|
||||||
|
|
||||||
|
// Skip delta if both entries are directories, or if the files/symlinks are equal in content
|
||||||
|
if (originalInfoType == FTS_D || [[NSFileManager defaultManager] contentsEqualAtPath:originalPath andPath:newPath]) {
|
||||||
|
// this is possible if just the permissions have changed but contents have not
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,7 +197,7 @@ static BOOL shouldDeleteThenExtract(NSDictionary *originalInfo, NSDictionary *ne
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
|
if ([(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,11 +210,20 @@ static BOOL shouldSkipExtracting(NSDictionary *originalInfo, NSDictionary *newIn
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
|
unsigned short originalInfoType = [(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue];
|
||||||
|
unsigned short newInfoType = [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue];
|
||||||
|
|
||||||
|
if (originalInfoType != newInfoType) {
|
||||||
|
// File types are different
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (![originalInfo[INFO_HASH_KEY] isEqual:newInfo[INFO_HASH_KEY]]) {
|
NSString *originalPath = originalInfo[INFO_PATH_KEY];
|
||||||
|
NSString *newPath = newInfo[INFO_PATH_KEY];
|
||||||
|
|
||||||
|
// Don't skip extract if files/symlinks entries are not equal in content
|
||||||
|
// (note if the entries are directories, they are equal)
|
||||||
|
if (originalInfoType != FTS_D && ![[NSFileManager defaultManager] contentsEqualAtPath:originalPath andPath:newPath]) {
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,17 +236,63 @@ static BOOL shouldChangePermissions(NSDictionary *originalInfo, NSDictionary *ne
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
|
if ([(NSNumber *)originalInfo[INFO_TYPE_KEY] unsignedShortValue] != [(NSNumber *)newInfo[INFO_TYPE_KEY] unsignedShortValue]) {
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([originalInfo[INFO_PERMISSIONS_KEY] unsignedShortValue] == [newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]) {
|
if ([(NSNumber *)originalInfo[INFO_PERMISSIONS_KEY] unsignedShortValue] == [(NSNumber *)newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]) {
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
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, BOOL verbose, NSError *__autoreleasing *error)
|
||||||
{
|
{
|
||||||
assert(source);
|
assert(source);
|
||||||
@@ -379,7 +439,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
// 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 = [info[INFO_PERMISSIONS_KEY] unsignedShortValue];
|
mode_t permissions = [(NSNumber *)info[INFO_PERMISSIONS_KEY] unsignedShortValue];
|
||||||
if (!isSymLink(ent) && !IS_VALID_PERMISSIONS(permissions)) {
|
if (!isSymLink(ent) && !IS_VALID_PERMISSIONS(permissions)) {
|
||||||
permissions = 0755;
|
permissions = 0755;
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
@@ -414,7 +474,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
} else {
|
} else {
|
||||||
newTreeState[key] = info;
|
newTreeState[key] = info;
|
||||||
|
|
||||||
if (oldInfo && [oldInfo[INFO_TYPE_KEY] unsignedShortValue] == FTS_D && [info[INFO_TYPE_KEY] unsignedShortValue] != FTS_D) {
|
if (oldInfo && [(NSNumber *)oldInfo[INFO_TYPE_KEY] unsignedShortValue] == FTS_D && [(NSNumber *)info[INFO_TYPE_KEY] unsignedShortValue] != FTS_D) {
|
||||||
NSArray *parentPathComponents = key.pathComponents;
|
NSArray *parentPathComponents = key.pathComponents;
|
||||||
|
|
||||||
for (NSString *childPath in originalTreeState) {
|
for (NSString *childPath in originalTreeState) {
|
||||||
@@ -467,8 +527,8 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
xar_subdoc_prop_set(attributes, MINOR_DIFF_VERSION_KEY, [[NSString stringWithFormat:@"%u", minorVersion] 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
|
// 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, SUBeigeMajorVersion) ? BEFORE_TREE_SHA1_KEY : BEFORE_TREE_SHA1_OLD_KEY;
|
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, SUBeigeMajorVersion) ? AFTER_TREE_SHA1_KEY : AFTER_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, beforeHashKey, [beforeHash UTF8String]);
|
||||||
xar_subdoc_prop_set(attributes, afterHashKey, [afterHash UTF8String]);
|
xar_subdoc_prop_set(attributes, afterHashKey, [afterHash UTF8String]);
|
||||||
@@ -486,11 +546,14 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
|
|
||||||
return originalTreeState[key1] ? NSOrderedAscending : NSOrderedDescending;
|
return originalTreeState[key1] ? NSOrderedAscending : NSOrderedDescending;
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
NSMutableDictionary<NSString *, NSValue *> *fileTable = [NSMutableDictionary dictionary];
|
||||||
|
|
||||||
for (NSString *key in keys) {
|
for (NSString *key in keys) {
|
||||||
id value = [newTreeState valueForKey:key];
|
id value = [newTreeState valueForKey:key];
|
||||||
|
|
||||||
if ([value isEqual:[NSNull null]]) {
|
if ([(NSObject *)value isEqual:[NSNull null]]) {
|
||||||
xar_file_t newFile = xar_add_frombuffer(x, 0, [key fileSystemRepresentation], (char *)"", 1);
|
xar_file_t newFile = _xarAddFile(fileTable, x, key, NULL);
|
||||||
assert(newFile);
|
assert(newFile);
|
||||||
xar_prop_set(newFile, DELETE_KEY, "true");
|
xar_prop_set(newFile, DELETE_KEY, "true");
|
||||||
|
|
||||||
@@ -503,30 +566,30 @@ 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, SUBeigeMajorVersion) && shouldSkipExtracting(originalInfo, newInfo)) {
|
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2) && shouldSkipExtracting(originalInfo, newInfo)) {
|
||||||
if (shouldChangePermissions(originalInfo, newInfo)) {
|
if (shouldChangePermissions(originalInfo, newInfo)) {
|
||||||
xar_file_t newFile = xar_add_frombuffer(x, 0, [key fileSystemRepresentation], (char *)"", 1);
|
xar_file_t newFile = _xarAddFile(fileTable, x, key, NULL);
|
||||||
assert(newFile);
|
assert(newFile);
|
||||||
xar_prop_set(newFile, MODIFY_PERMISSIONS_KEY, [[NSString stringWithFormat:@"%u", [newInfo[INFO_PERMISSIONS_KEY] unsignedShortValue]] UTF8String]);
|
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], [originalInfo[INFO_PERMISSIONS_KEY] unsignedShortValue], [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];
|
NSString *path = [destination stringByAppendingPathComponent:key];
|
||||||
xar_file_t newFile = xar_add_frompath(x, 0, [key fileSystemRepresentation], [path fileSystemRepresentation]);
|
xar_file_t newFile = _xarAddFile(fileTable, x, key, path);
|
||||||
assert(newFile);
|
assert(newFile);
|
||||||
|
|
||||||
if (shouldDeleteThenExtract(originalInfo, newInfo)) {
|
if (shouldDeleteThenExtract(originalInfo, newInfo)) {
|
||||||
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) {
|
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2)) {
|
||||||
xar_prop_set(newFile, DELETE_KEY, "true");
|
xar_prop_set(newFile, DELETE_KEY, "true");
|
||||||
} else {
|
} else {
|
||||||
xar_prop_set(newFile, DELETE_THEN_EXTRACT_OLD_KEY, "true");
|
xar_prop_set(newFile, DELETE_THEN_EXTRACT_OLD_KEY, "true");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion)) {
|
if (MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2)) {
|
||||||
xar_prop_set(newFile, EXTRACT_KEY, "true");
|
xar_prop_set(newFile, EXTRACT_KEY, "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -540,7 +603,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
NSNumber *permissions =
|
NSNumber *permissions =
|
||||||
(MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBeigeMajorVersion) && shouldChangePermissions(originalInfo, newInfo)) ?
|
(MAJOR_VERSION_IS_AT_LEAST(majorVersion, SUBinaryDeltaMajorVersion2) && shouldChangePermissions(originalInfo, newInfo)) ?
|
||||||
newInfo[INFO_PERMISSIONS_KEY] :
|
newInfo[INFO_PERMISSIONS_KEY] :
|
||||||
nil;
|
nil;
|
||||||
CreateBinaryDeltaOperation *operation = [[CreateBinaryDeltaOperation alloc] initWithRelativePath:key oldTree:source newTree:destination oldPermissions:originalInfo[INFO_PERMISSIONS_KEY] newPermissions:permissions];
|
CreateBinaryDeltaOperation *operation = [[CreateBinaryDeltaOperation alloc] initWithRelativePath:key oldTree:source newTree:destination oldPermissions:originalInfo[INFO_PERMISSIONS_KEY] newPermissions:permissions];
|
||||||
@@ -567,7 +630,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
|
|||||||
fprintf(stderr, "\n🔨 %s %s", VERBOSE_DIFFED, [[operation relativePath] fileSystemRepresentation]);
|
fprintf(stderr, "\n🔨 %s %s", VERBOSE_DIFFED, [[operation relativePath] fileSystemRepresentation]);
|
||||||
}
|
}
|
||||||
|
|
||||||
xar_file_t newFile = xar_add_frompath(x, 0, [[operation relativePath] fileSystemRepresentation], [resultPath fileSystemRepresentation]);
|
xar_file_t newFile = _xarAddFile(fileTable, x, [operation relativePath], resultPath);
|
||||||
assert(newFile);
|
assert(newFile);
|
||||||
xar_prop_set(newFile, BINARY_DELTA_KEY, "true");
|
xar_prop_set(newFile, BINARY_DELTA_KEY, "true");
|
||||||
unlink([resultPath fileSystemRepresentation]);
|
unlink([resultPath fileSystemRepresentation]);
|
||||||
|
|||||||
Vendored
+1
-1
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@interface SUBinaryDeltaUnarchiver : NSObject <SUUnarchiverProtocol>
|
@interface SUBinaryDeltaUnarchiver : NSObject <SUUnarchiverProtocol>
|
||||||
|
|
||||||
- (instancetype)initWithArchivePath:(NSString *)archivePath updateHostBundlePath:(NSString *)updateHostBundlePath;
|
- (instancetype)initWithArchivePath:(NSString *)archivePath extractionDirectory:(NSString *)extractionDirectory updateHostBundlePath:(NSString *)updateHostBundlePath;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
Vendored
+5
-2
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
@property (nonatomic, copy, readonly) NSString *archivePath;
|
@property (nonatomic, copy, readonly) NSString *archivePath;
|
||||||
@property (nonatomic, copy, readonly) NSString *updateHostBundlePath;
|
@property (nonatomic, copy, readonly) NSString *updateHostBundlePath;
|
||||||
|
@property (nonatomic, copy, readonly) NSString *extractionDirectory;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
|
|
||||||
@synthesize archivePath = _archivePath;
|
@synthesize archivePath = _archivePath;
|
||||||
@synthesize updateHostBundlePath = _updateHostBundlePath;
|
@synthesize updateHostBundlePath = _updateHostBundlePath;
|
||||||
|
@synthesize extractionDirectory = _extractionDirectory;
|
||||||
|
|
||||||
+ (BOOL)canUnarchivePath:(NSString *)path
|
+ (BOOL)canUnarchivePath:(NSString *)path
|
||||||
{
|
{
|
||||||
@@ -73,12 +75,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithArchivePath:(NSString *)archivePath updateHostBundlePath:(NSString *)updateHostBundlePath
|
- (instancetype)initWithArchivePath:(NSString *)archivePath extractionDirectory:(NSString *)extractionDirectory updateHostBundlePath:(NSString *)updateHostBundlePath
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self != nil) {
|
if (self != nil) {
|
||||||
_archivePath = [archivePath copy];
|
_archivePath = [archivePath copy];
|
||||||
_updateHostBundlePath = [updateHostBundlePath copy];
|
_updateHostBundlePath = [updateHostBundlePath copy];
|
||||||
|
_extractionDirectory = [extractionDirectory copy];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -96,7 +99,7 @@
|
|||||||
- (void)extractDeltaWithNotifier:(SUUnarchiverNotifier *)notifier
|
- (void)extractDeltaWithNotifier:(SUUnarchiverNotifier *)notifier
|
||||||
{
|
{
|
||||||
NSString *sourcePath = self.updateHostBundlePath;
|
NSString *sourcePath = self.updateHostBundlePath;
|
||||||
NSString *targetPath = [[self.archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:[sourcePath lastPathComponent]];
|
NSString *targetPath = [self.extractionDirectory stringByAppendingPathComponent:[sourcePath lastPathComponent]];
|
||||||
|
|
||||||
NSError *applyDiffError = nil;
|
NSError *applyDiffError = nil;
|
||||||
BOOL success = applyBinaryDelta(sourcePath, targetPath, self.archivePath, NO, ^(double progress){
|
BOOL success = applyBinaryDelta(sourcePath, targetPath, self.archivePath, NO, ^(double progress){
|
||||||
|
|||||||
Vendored
+1
-1
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@interface SUDiskImageUnarchiver : NSObject <SUUnarchiverProtocol>
|
@interface SUDiskImageUnarchiver : NSObject <SUUnarchiverProtocol>
|
||||||
|
|
||||||
- (instancetype)initWithArchivePath:(NSString *)archivePath decryptionPassword:(nullable NSString *)decryptionPassword;
|
- (instancetype)initWithArchivePath:(NSString *)archivePath extractionDirectory:(NSString *)extractionDirectory decryptionPassword:(nullable NSString *)decryptionPassword;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
Vendored
+5
-2
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
@property (nonatomic, copy, readonly) NSString *archivePath;
|
@property (nonatomic, copy, readonly) NSString *archivePath;
|
||||||
@property (nullable, nonatomic, copy, readonly) NSString *decryptionPassword;
|
@property (nullable, nonatomic, copy, readonly) NSString *decryptionPassword;
|
||||||
|
@property (nonatomic, copy, readonly) NSString *extractionDirectory;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -24,6 +25,7 @@
|
|||||||
|
|
||||||
@synthesize archivePath = _archivePath;
|
@synthesize archivePath = _archivePath;
|
||||||
@synthesize decryptionPassword = _decryptionPassword;
|
@synthesize decryptionPassword = _decryptionPassword;
|
||||||
|
@synthesize extractionDirectory = _extractionDirectory;
|
||||||
|
|
||||||
+ (BOOL)canUnarchivePath:(NSString *)path
|
+ (BOOL)canUnarchivePath:(NSString *)path
|
||||||
{
|
{
|
||||||
@@ -35,12 +37,13 @@
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithArchivePath:(NSString *)archivePath decryptionPassword:(nullable NSString *)decryptionPassword
|
- (instancetype)initWithArchivePath:(NSString *)archivePath extractionDirectory:(NSString *)extractionDirectory decryptionPassword:(nullable NSString *)decryptionPassword
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self != nil) {
|
if (self != nil) {
|
||||||
_archivePath = [archivePath copy];
|
_archivePath = [archivePath copy];
|
||||||
_decryptionPassword = [decryptionPassword copy];
|
_decryptionPassword = [decryptionPassword copy];
|
||||||
|
_extractionDirectory = [extractionDirectory copy];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -158,7 +161,7 @@
|
|||||||
for (NSString *item in contents)
|
for (NSString *item in contents)
|
||||||
{
|
{
|
||||||
NSString *fromPath = [mountPoint stringByAppendingPathComponent:item];
|
NSString *fromPath = [mountPoint stringByAppendingPathComponent:item];
|
||||||
NSString *toPath = [[self.archivePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:item];
|
NSString *toPath = [self.extractionDirectory stringByAppendingPathComponent:item];
|
||||||
|
|
||||||
// We skip any files in the DMG which are not readable.
|
// We skip any files in the DMG which are not readable.
|
||||||
if (![manager isReadableFileAtPath:fromPath]) {
|
if (![manager isReadableFileAtPath:fromPath]) {
|
||||||
|
|||||||
Vendored
+1
-1
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
// An unarchiver for flat packages that doesn't really do any unarchiving
|
// An unarchiver for flat packages that doesn't really do any unarchiving
|
||||||
@interface SUFlatPackageUnarchiver : NSObject <SUUnarchiverProtocol>
|
@interface SUFlatPackageUnarchiver : NSObject <SUUnarchiverProtocol>
|
||||||
|
|
||||||
- (instancetype)initWithFlatPackagePath:(NSString *)flatPackagePath;
|
- (instancetype)initWithFlatPackagePath:(NSString *)flatPackagePath extractionDirectory:(NSString *)extractionDirectory;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
Vendored
+18
-3
@@ -16,12 +16,14 @@
|
|||||||
@interface SUFlatPackageUnarchiver ()
|
@interface SUFlatPackageUnarchiver ()
|
||||||
|
|
||||||
@property (nonatomic, readonly) NSString *flatPackagePath;
|
@property (nonatomic, readonly) NSString *flatPackagePath;
|
||||||
|
@property (nonatomic, readonly, copy) NSString *extractionDirectory;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation SUFlatPackageUnarchiver
|
@implementation SUFlatPackageUnarchiver
|
||||||
|
|
||||||
@synthesize flatPackagePath = _flatPackagePath;
|
@synthesize flatPackagePath = _flatPackagePath;
|
||||||
|
@synthesize extractionDirectory = _extractionDirectory;
|
||||||
|
|
||||||
+ (BOOL)canUnarchivePath:(NSString *)path
|
+ (BOOL)canUnarchivePath:(NSString *)path
|
||||||
{
|
{
|
||||||
@@ -34,11 +36,12 @@
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithFlatPackagePath:(NSString *)flatPackagePath;
|
- (instancetype)initWithFlatPackagePath:(NSString *)flatPackagePath extractionDirectory:(NSString *)extractionDirectory
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self != nil) {
|
if (self != nil) {
|
||||||
_flatPackagePath = [flatPackagePath copy];
|
_flatPackagePath = [flatPackagePath copy];
|
||||||
|
_extractionDirectory = [extractionDirectory copy];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -54,8 +57,20 @@
|
|||||||
} else if (![[NSFileManager defaultManager] fileExistsAtPath:self.flatPackagePath isDirectory:&isDirectory] || isDirectory) {
|
} else if (![[NSFileManager defaultManager] fileExistsAtPath:self.flatPackagePath isDirectory:&isDirectory] || isDirectory) {
|
||||||
[notifier notifyFailureWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Flat package does not exist at %@", self.flatPackagePath]}]];
|
[notifier notifyFailureWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Flat package does not exist at %@", self.flatPackagePath]}]];
|
||||||
} else {
|
} else {
|
||||||
[notifier notifyProgress:1.0];
|
// Copying the flat package should be very fast, especially on APFS
|
||||||
[notifier notifySuccess];
|
NSError *copyError = nil;
|
||||||
|
if (![[NSFileManager defaultManager] copyItemAtPath:self.flatPackagePath toPath:[self.extractionDirectory stringByAppendingPathComponent:self.flatPackagePath.lastPathComponent] error:©Error]) {
|
||||||
|
NSMutableDictionary *userInfoDictionary = [NSMutableDictionary dictionaryWithDictionary:@{ NSLocalizedDescriptionKey:[NSString stringWithFormat:@"Flat package (%@) cannot be copied to extraction directory (%@)", self.flatPackagePath, self.extractionDirectory]}];
|
||||||
|
|
||||||
|
if (copyError != nil) {
|
||||||
|
userInfoDictionary[NSUnderlyingErrorKey] = copyError;
|
||||||
|
}
|
||||||
|
|
||||||
|
[notifier notifyFailureWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:userInfoDictionary]];
|
||||||
|
} else {
|
||||||
|
[notifier notifyProgress:1.0];
|
||||||
|
[notifier notifySuccess];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+28
-13
@@ -20,15 +20,6 @@
|
|||||||
|
|
||||||
@implementation SUInstaller
|
@implementation SUInstaller
|
||||||
|
|
||||||
+ (BOOL)isAliasFolderAtPath:(NSString *)path
|
|
||||||
{
|
|
||||||
NSNumber *aliasFlag = nil;
|
|
||||||
[[NSURL fileURLWithPath:path] getResourceValue:&aliasFlag forKey:NSURLIsAliasFileKey error:nil];
|
|
||||||
NSNumber *directoryFlag = nil;
|
|
||||||
[[NSURL fileURLWithPath:path] getResourceValue:&directoryFlag forKey:NSURLIsDirectoryKey error:nil];
|
|
||||||
return aliasFlag.boolValue && directoryFlag.boolValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(nullable BOOL *)isGuidedPtr
|
+ (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host isPackage:(BOOL *)isPackagePtr isGuided:(nullable BOOL *)isGuidedPtr
|
||||||
{
|
{
|
||||||
NSParameterAssert(inUpdateFolder);
|
NSParameterAssert(inUpdateFolder);
|
||||||
@@ -47,6 +38,34 @@
|
|||||||
|
|
||||||
while ((currentFile = [dirEnum nextObject])) {
|
while ((currentFile = [dirEnum nextObject])) {
|
||||||
NSString *currentPath = [inUpdateFolder stringByAppendingPathComponent:currentFile];
|
NSString *currentPath = [inUpdateFolder stringByAppendingPathComponent:currentFile];
|
||||||
|
|
||||||
|
// Ignore all symbolic links and aliases
|
||||||
|
{
|
||||||
|
NSURL *currentPathURL = [NSURL fileURLWithPath:currentPath];
|
||||||
|
|
||||||
|
NSNumber *symbolicLinkFlag = nil;
|
||||||
|
[currentPathURL getResourceValue:&symbolicLinkFlag forKey:NSURLIsSymbolicLinkKey error:NULL];
|
||||||
|
if (symbolicLinkFlag.boolValue) {
|
||||||
|
// NSDirectoryEnumerator won't recurse into symlinked directories
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSNumber *aliasFlag = nil;
|
||||||
|
[currentPathURL getResourceValue:&aliasFlag forKey:NSURLIsAliasFileKey error:NULL];
|
||||||
|
|
||||||
|
if (aliasFlag.boolValue) {
|
||||||
|
NSNumber *directoryFlag = nil;
|
||||||
|
[currentPathURL getResourceValue:&directoryFlag forKey:NSURLIsDirectoryKey error:NULL];
|
||||||
|
|
||||||
|
// Some DMGs have symlinks into /Applications! That's no good!
|
||||||
|
if (directoryFlag.boolValue) {
|
||||||
|
[dirEnum skipDescendents];
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NSString *currentFilename = [currentFile lastPathComponent];
|
NSString *currentFilename = [currentFile lastPathComponent];
|
||||||
NSString *currentExtension = [currentFile pathExtension];
|
NSString *currentExtension = [currentFile pathExtension];
|
||||||
NSString *currentFilenameNoExtension = [currentFilename stringByDeletingPathExtension];
|
NSString *currentFilenameNoExtension = [currentFilename stringByDeletingPathExtension];
|
||||||
@@ -76,10 +95,6 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some DMGs have symlinks into /Applications! That's no good!
|
|
||||||
if ([self isAliasFolderAtPath:currentPath])
|
|
||||||
[dirEnum skipDescendents];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We don't have a valid path. Try to use the fallback package.
|
// We don't have a valid path. Try to use the fallback package.
|
||||||
|
|||||||
Vendored
+3
-2
@@ -39,8 +39,9 @@
|
|||||||
self = [super init];
|
self = [super init];
|
||||||
if (self != nil) {
|
if (self != nil) {
|
||||||
_webView = [[WebView alloc] initWithFrame:NSZeroRect];
|
_webView = [[WebView alloc] initWithFrame:NSZeroRect];
|
||||||
|
|
||||||
WebPreferences *preferences = _webView.preferences;
|
WebPreferences *preferences = [[WebPreferences alloc] initWithIdentifier:@"sparkle-project.org.legacy-web-view"];
|
||||||
|
preferences.autosaves = NO;
|
||||||
preferences.javaScriptEnabled = javaScriptEnabled;
|
preferences.javaScriptEnabled = javaScriptEnabled;
|
||||||
preferences.javaEnabled = NO;
|
preferences.javaEnabled = NO;
|
||||||
preferences.plugInsEnabled = NO;
|
preferences.plugInsEnabled = NO;
|
||||||
|
|||||||
Vendored
+1
-1
@@ -63,7 +63,7 @@ void SULog(SULogLevel level, NSString *format, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NSString *displayName = [[NSFileManager defaultManager] displayNameAtPath:mainBundle.bundlePath];
|
NSString *displayName = [[NSFileManager defaultManager] displayNameAtPath:mainBundle.bundlePath];
|
||||||
client = asl_open([displayName stringByAppendingString:@" [Sparkle " TO_STRING(SPARKLE_VERSION) "]"].UTF8String, SPARKLE_BUNDLE_IDENTIFIER, options);
|
client = asl_open([displayName stringByAppendingString:@" [Sparkle " TO_STRING(MARKETING_VERSION) "]"].UTF8String, SPARKLE_BUNDLE_IDENTIFIER, options);
|
||||||
queue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL);
|
queue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Vendored
+1
-1
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@interface SUPipedUnarchiver : NSObject <SUUnarchiverProtocol>
|
@interface SUPipedUnarchiver : NSObject <SUUnarchiverProtocol>
|
||||||
|
|
||||||
- (instancetype)initWithArchivePath:(NSString *)archivePath;
|
- (instancetype)initWithArchivePath:(NSString *)archivePath extractionDirectory:(NSString *)extractionDirectory;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
Vendored
+5
-2
@@ -17,12 +17,14 @@
|
|||||||
@interface SUPipedUnarchiver ()
|
@interface SUPipedUnarchiver ()
|
||||||
|
|
||||||
@property (nonatomic, copy, readonly) NSString *archivePath;
|
@property (nonatomic, copy, readonly) NSString *archivePath;
|
||||||
|
@property (nonatomic, copy, readonly) NSString *extractionDirectory;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation SUPipedUnarchiver
|
@implementation SUPipedUnarchiver
|
||||||
|
|
||||||
@synthesize archivePath = _archivePath;
|
@synthesize archivePath = _archivePath;
|
||||||
|
@synthesize extractionDirectory = _extractionDirectory;
|
||||||
|
|
||||||
+ (nullable NSArray <NSString *> *)commandAndArgumentsConformingToTypeOfPath:(NSString *)path
|
+ (nullable NSArray <NSString *> *)commandAndArgumentsConformingToTypeOfPath:(NSString *)path
|
||||||
{
|
{
|
||||||
@@ -63,11 +65,12 @@
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithArchivePath:(NSString *)archivePath
|
- (instancetype)initWithArchivePath:(NSString *)archivePath extractionDirectory:(NSString *)extractionDirectory
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self != nil) {
|
if (self != nil) {
|
||||||
_archivePath = [archivePath copy];
|
_archivePath = [archivePath copy];
|
||||||
|
_extractionDirectory = [extractionDirectory copy];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -94,7 +97,7 @@
|
|||||||
// *** GETS CALLED ON NON-MAIN THREAD!!!
|
// *** GETS CALLED ON NON-MAIN THREAD!!!
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
NSError *error = nil;
|
NSError *error = nil;
|
||||||
NSString *destination = [self.archivePath stringByDeletingLastPathComponent];
|
NSString *destination = self.extractionDirectory;
|
||||||
|
|
||||||
SULog(SULogLevelDefault, @"Extracting using '%@' '%@' < '%@' '%@'", command, [args componentsJoinedByString:@"' '"], self.archivePath, destination);
|
SULog(SULogLevelDefault, @"Extracting using '%@' '%@' < '%@' '%@'", command, [args componentsJoinedByString:@"' '"], self.archivePath, destination);
|
||||||
|
|
||||||
|
|||||||
Vendored
+4
-6
@@ -103,7 +103,8 @@
|
|||||||
const unsigned char *edPubKey = self.pubKeys.ed25519PubKey;
|
const unsigned char *edPubKey = self.pubKeys.ed25519PubKey;
|
||||||
|
|
||||||
if (edPubKey && !edSignature) {
|
if (edPubKey && !edSignature) {
|
||||||
SULog(SULogLevelDefault, @"There is no EdDSA signature in the update, but the app is capable of verifying them");
|
SULog(SULogLevelError, @"The app has an EdDSA public key, but there is no EdDSA signature in the update, so the update will be rejected.");
|
||||||
|
return NO;
|
||||||
} if (!edPubKey && edSignature) {
|
} if (!edPubKey && edSignature) {
|
||||||
SULog(SULogLevelDefault, @"The update has an EdDSA signature, but it won't be used, because the old app doesn't have an EdDSA public key");
|
SULog(SULogLevelDefault, @"The update has an EdDSA signature, but it won't be used, because the old app doesn't have an EdDSA public key");
|
||||||
} else if (edPubKey && edSignature) {
|
} else if (edPubKey && edSignature) {
|
||||||
@@ -114,12 +115,9 @@
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
if (ed25519_verify(edSignature, data.bytes, data.length, edPubKey)) {
|
if (ed25519_verify(edSignature, data.bytes, data.length, edPubKey)) {
|
||||||
|
// No need to check DSA when EdDSA verification succeeded
|
||||||
SULog(SULogLevelDefault, @"OK: EdDSA signature is correct");
|
SULog(SULogLevelDefault, @"OK: EdDSA signature is correct");
|
||||||
if (!dsaPubKey) {
|
return YES;
|
||||||
return YES;
|
|
||||||
} else {
|
|
||||||
SULog(SULogLevelDefault, @"This app has a DSA public key, so a DSA signature is required too");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
SULog(SULogLevelError, @"EdDSA signature does not match. Data of the update file being checked is different than data that has been signed, or the public key and the private key are not from the same set.");
|
SULog(SULogLevelError, @"EdDSA signature does not match. Data of the update file being checked is different than data that has been signed, or the public key and the private key are not from the same set.");
|
||||||
if (dsaSignature) {
|
if (dsaSignature) {
|
||||||
|
|||||||
Vendored
+1
-1
@@ -19,7 +19,7 @@ static NSData *decode(NSString *str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
NSString *stripped = [str stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet];
|
NSString *stripped = [str stringByTrimmingCharactersInSet:NSCharacterSet.whitespaceAndNewlineCharacterSet];
|
||||||
return [[NSData alloc] initWithBase64Encoding:stripped];
|
return [[NSData alloc] initWithBase64EncodedString:stripped options:0];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (instancetype)initWithDsa:(NSString * _Nullable)maybeDsa ed:(NSString * _Nullable)maybeEd25519
|
- (instancetype)initWithDsa:(NSString * _Nullable)maybeDsa ed:(NSString * _Nullable)maybeEd25519
|
||||||
|
|||||||
Vendored
+3
-3
@@ -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="17701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="19455" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="macosx"/>
|
<deployment identifier="macosx"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17701"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="19455"/>
|
||||||
<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>
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
</connections>
|
</connections>
|
||||||
</progressIndicator>
|
</progressIndicator>
|
||||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="12">
|
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="12">
|
||||||
<rect key="frame" x="272" y="12" width="114" height="32"/>
|
<rect key="frame" x="272" y="12" width="113" height="32"/>
|
||||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES"/>
|
||||||
<buttonCell key="cell" type="push" title="Button" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="55">
|
<buttonCell key="cell" type="push" title="Button" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="55">
|
||||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||||
|
|||||||
Vendored
+1
-2
@@ -83,7 +83,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.updateAlert = [[SUUpdateAlert alloc] initWithAppcastItem:updateItem host:self.host completionBlock:^(SUUpdateAlertChoice choice) {
|
self.updateAlert = [[SUUpdateAlert alloc] initWithAppcastItem:updateItem httpHeaders:updater.httpHeaders userAgent:updater.userAgentString host:self.host completionBlock:^(SUUpdateAlertChoice choice) {
|
||||||
[self updateAlertFinishedWithChoice:choice forItem:updateItem];
|
[self updateAlertFinishedWithChoice:choice forItem:updateItem];
|
||||||
}];
|
}];
|
||||||
|
|
||||||
@@ -97,7 +97,6 @@
|
|||||||
// update prompt to behave like a normal window. Otherwise if the window were hidden
|
// update prompt to behave like a normal window. Otherwise if the window were hidden
|
||||||
// there may be no way for the application to be activated to make it visible again.
|
// there may be no way for the application to be activated to make it visible again.
|
||||||
if ([SUApplicationInfo isBackgroundApplication:[NSApplication sharedApplication]]) {
|
if ([SUApplicationInfo isBackgroundApplication:[NSApplication sharedApplication]]) {
|
||||||
[[self.updateAlert window] setHidesOnDeactivate:NO];
|
|
||||||
[NSApp activateIgnoringOtherApps:YES];
|
[NSApp activateIgnoringOtherApps:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
@interface SUUnarchiver : NSObject
|
@interface SUUnarchiver : NSObject
|
||||||
|
|
||||||
+ (nullable id <SUUnarchiverProtocol>)unarchiverForPath:(NSString *)path updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword;
|
+ (nullable id <SUUnarchiverProtocol>)unarchiverForPath:(NSString *)path extractionDirectory:(NSString *)extractionDirectory updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
Vendored
+5
-6
@@ -18,21 +18,20 @@
|
|||||||
|
|
||||||
@implementation SUUnarchiver
|
@implementation SUUnarchiver
|
||||||
|
|
||||||
+ (nullable id <SUUnarchiverProtocol>)unarchiverForPath:(NSString *)path updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword
|
+ (nullable id <SUUnarchiverProtocol>)unarchiverForPath:(NSString *)path extractionDirectory:(NSString *)extractionDirectory updatingHostBundlePath:(nullable NSString *)hostPath decryptionPassword:(nullable NSString *)decryptionPassword
|
||||||
{
|
{
|
||||||
if ([SUPipedUnarchiver canUnarchivePath:path]) {
|
if ([SUPipedUnarchiver canUnarchivePath:path]) {
|
||||||
return [[SUPipedUnarchiver alloc] initWithArchivePath:path];
|
return [[SUPipedUnarchiver alloc] initWithArchivePath:path extractionDirectory:extractionDirectory];
|
||||||
|
|
||||||
} else if ([SUDiskImageUnarchiver canUnarchivePath:path]) {
|
} else if ([SUDiskImageUnarchiver canUnarchivePath:path]) {
|
||||||
return [[SUDiskImageUnarchiver alloc] initWithArchivePath:path decryptionPassword:decryptionPassword];
|
return [[SUDiskImageUnarchiver alloc] initWithArchivePath:path extractionDirectory:extractionDirectory decryptionPassword:decryptionPassword];
|
||||||
|
|
||||||
} else if ([SUBinaryDeltaUnarchiver canUnarchivePath:path]) {
|
} else if ([SUBinaryDeltaUnarchiver canUnarchivePath:path]) {
|
||||||
assert(hostPath != nil);
|
assert(hostPath != nil);
|
||||||
NSString *nonNullHostPath = hostPath;
|
NSString *nonNullHostPath = hostPath;
|
||||||
return [[SUBinaryDeltaUnarchiver alloc] initWithArchivePath:path updateHostBundlePath:nonNullHostPath];
|
return [[SUBinaryDeltaUnarchiver alloc] initWithArchivePath:path extractionDirectory:extractionDirectory updateHostBundlePath:nonNullHostPath];
|
||||||
|
|
||||||
} else if ([SUFlatPackageUnarchiver canUnarchivePath:path]) {
|
} else if ([SUFlatPackageUnarchiver canUnarchivePath:path]) {
|
||||||
return [[SUFlatPackageUnarchiver alloc] initWithFlatPackagePath:path];
|
return [[SUFlatPackageUnarchiver alloc] initWithFlatPackagePath:path extractionDirectory:extractionDirectory];
|
||||||
}
|
}
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
@@ -31,6 +31,8 @@
|
|||||||
if (self != nil) {
|
if (self != nil) {
|
||||||
_completionBlock = [completionBlock copy];
|
_completionBlock = [completionBlock copy];
|
||||||
_progressBlock = [progressBlock copy];
|
_progressBlock = [progressBlock copy];
|
||||||
|
} else {
|
||||||
|
assert(false);
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -26,7 +26,7 @@ typedef NS_ENUM(NSInteger, SUUpdateAlertChoice) {
|
|||||||
|
|
||||||
@property (weak) id<SUVersionDisplay> versionDisplayer;
|
@property (weak) id<SUVersionDisplay> versionDisplayer;
|
||||||
|
|
||||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)host completionBlock:(void(^)(SUUpdateAlertChoice))c;
|
- (instancetype)initWithAppcastItem:(SUAppcastItem *)item httpHeaders:(NSDictionary *)httpHeaders userAgent:(NSString *)userAgent host:(SUHost *)host completionBlock:(void(^)(SUUpdateAlertChoice))c;
|
||||||
|
|
||||||
- (IBAction)installUpdate:sender;
|
- (IBAction)installUpdate:sender;
|
||||||
- (IBAction)skipThisVersion:sender;
|
- (IBAction)skipThisVersion:sender;
|
||||||
|
|||||||
Vendored
+23
-2
@@ -49,6 +49,9 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
|
|||||||
|
|
||||||
@property (nonatomic) id<SUWebView> webView;
|
@property (nonatomic) id<SUWebView> webView;
|
||||||
|
|
||||||
|
@property (nonatomic) NSDictionary *httpHeaders;
|
||||||
|
@property (nonatomic) NSString *userAgent;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation SUUpdateAlert
|
@implementation SUUpdateAlert
|
||||||
@@ -74,7 +77,10 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
|
|||||||
|
|
||||||
@synthesize webView = _webView;
|
@synthesize webView = _webView;
|
||||||
|
|
||||||
- (instancetype)initWithAppcastItem:(SUAppcastItem *)item host:(SUHost *)aHost completionBlock:(void (^)(SUUpdateAlertChoice))block
|
@synthesize httpHeaders = _httpHeaders;
|
||||||
|
@synthesize userAgent = _userAgent;
|
||||||
|
|
||||||
|
- (instancetype)initWithAppcastItem:(SUAppcastItem *)item httpHeaders:(NSDictionary *)httpHeaders userAgent:(NSString *)userAgent host:(SUHost *)aHost completionBlock:(void (^)(SUUpdateAlertChoice))block
|
||||||
{
|
{
|
||||||
self = [super initWithWindowNibName:@"SUUpdateAlert"];
|
self = [super initWithWindowNibName:@"SUUpdateAlert"];
|
||||||
if (self)
|
if (self)
|
||||||
@@ -82,6 +88,8 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
|
|||||||
self.completionBlock = block;
|
self.completionBlock = block;
|
||||||
host = aHost;
|
host = aHost;
|
||||||
updateItem = item;
|
updateItem = item;
|
||||||
|
_httpHeaders = httpHeaders;
|
||||||
|
_userAgent = userAgent;
|
||||||
[self setShouldCascadeWindows:NO];
|
[self setShouldCascadeWindows:NO];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
@@ -145,8 +153,21 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
|
|||||||
// If there's a release notes URL, load it; otherwise, just stick the contents of the description into the web view.
|
// If there's a release notes URL, load it; otherwise, just stick the contents of the description into the web view.
|
||||||
if ([self.updateItem releaseNotesURL])
|
if ([self.updateItem releaseNotesURL])
|
||||||
{
|
{
|
||||||
|
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[self.updateItem releaseNotesURL] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30];
|
||||||
|
|
||||||
|
if (self.userAgent) {
|
||||||
|
[request setValue:self.userAgent forHTTPHeaderField:@"User-Agent"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self.httpHeaders) {
|
||||||
|
for (NSString *key in self.httpHeaders) {
|
||||||
|
NSString *value = [self.httpHeaders objectForKey:key];
|
||||||
|
[request setValue:value forHTTPHeaderField:key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
__weak __typeof__(self) weakSelf = self;
|
__weak __typeof__(self) weakSelf = self;
|
||||||
[self.webView loadRequest:[NSURLRequest requestWithURL:[self.updateItem releaseNotesURL] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:30] completionHandler:^(NSError * _Nullable error) {
|
[self.webView loadRequest:request completionHandler:^(NSError * _Nullable error) {
|
||||||
if (error != nil) {
|
if (error != nil) {
|
||||||
SULog(SULogLevelError, @"Failed to load URL request from web view: %@", error);
|
SULog(SULogLevelError, @"Failed to load URL request from web view: %@", error);
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+9
@@ -67,6 +67,10 @@ static NSString *const SUUpdatePermissionPromptTouchBarIndentifier = @"" SPARKLE
|
|||||||
systemProfileInformationArray = profile;
|
systemProfileInformationArray = profile;
|
||||||
[self setShouldCascadeWindows:NO];
|
[self setShouldCascadeWindows:NO];
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +83,12 @@ static NSString *const SUUpdatePermissionPromptTouchBarIndentifier = @"" SPARKLE
|
|||||||
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
|
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#if __has_warning("-Wcompletion-handler")
|
||||||
|
#pragma clang diagnostic ignored "-Wcompletion-handler"
|
||||||
|
#endif
|
||||||
if (![NSApp modalWindow]) { // do not prompt if there is is another modal window on screen
|
if (![NSApp modalWindow]) { // do not prompt if there is is another modal window on screen
|
||||||
|
#pragma clang diagnostic pop
|
||||||
SUUpdatePermissionPrompt *prompt = [(SUUpdatePermissionPrompt *)[[self class] alloc] initWithHost:host systemProfile:profile reply:reply];
|
SUUpdatePermissionPrompt *prompt = [(SUUpdatePermissionPrompt *)[[self class] alloc] initWithHost:host systemProfile:profile reply:reply];
|
||||||
NSWindow *window = [prompt window];
|
NSWindow *window = [prompt window];
|
||||||
if (window) {
|
if (window) {
|
||||||
|
|||||||
Vendored
+42
-26
@@ -40,11 +40,12 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
|||||||
@property (strong) NSTimer *checkTimer;
|
@property (strong) NSTimer *checkTimer;
|
||||||
@property (assign) BOOL shouldRescheduleOnWake;
|
@property (assign) BOOL shouldRescheduleOnWake;
|
||||||
@property (strong) NSBundle *sparkleBundle;
|
@property (strong) NSBundle *sparkleBundle;
|
||||||
|
@property (nonatomic) BOOL loggedNoSecureKeyWarning;
|
||||||
|
|
||||||
- (instancetype)initForBundle:(NSBundle *)bundle;
|
- (instancetype)initForBundle:(NSBundle *)bundle;
|
||||||
- (void)startUpdateCycle;
|
- (void)startUpdateCycle;
|
||||||
- (void)checkForUpdatesWithDriver:(SUUpdateDriver *)updateDriver;
|
- (void)checkForUpdatesWithDriver:(SUUpdateDriver *)updateDriver;
|
||||||
- (void)scheduleNextUpdateCheck;
|
- (void)scheduleNextUpdateCheckUsingCurrentDate:(BOOL)usingCurrentDate;
|
||||||
- (void)registerAsObserver;
|
- (void)registerAsObserver;
|
||||||
- (void)unregisterAsObserver;
|
- (void)unregisterAsObserver;
|
||||||
- (void)updateDriverDidFinish:(NSNotification *)note;
|
- (void)updateDriverDidFinish:(NSNotification *)note;
|
||||||
@@ -69,6 +70,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
|||||||
@synthesize sparkleBundle;
|
@synthesize sparkleBundle;
|
||||||
@synthesize decryptionPassword;
|
@synthesize decryptionPassword;
|
||||||
@synthesize updateLastCheckedDate;
|
@synthesize updateLastCheckedDate;
|
||||||
|
@synthesize loggedNoSecureKeyWarning = _loggedNoSecureKeyWarning;
|
||||||
|
|
||||||
static NSMutableDictionary *sharedUpdaters = nil;
|
static NSMutableDictionary *sharedUpdaters = nil;
|
||||||
static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObservationContext";
|
static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObservationContext";
|
||||||
@@ -147,7 +149,9 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
|||||||
}
|
}
|
||||||
|
|
||||||
-(void)checkIfConfiguredProperly {
|
-(void)checkIfConfiguredProperly {
|
||||||
BOOL hasPublicKey = self.host.publicKeys.dsaPubKey != nil || self.host.publicKeys.ed25519PubKey != nil;
|
BOOL hasDSAPublicKey = (self.host.publicKeys.dsaPubKey != nil);
|
||||||
|
BOOL hasEdDSAPublicKey = (self.host.publicKeys.ed25519PubKey != nil);
|
||||||
|
BOOL hasPublicKey = (hasDSAPublicKey || hasEdDSAPublicKey);
|
||||||
BOOL isMainBundle = [self.host.bundle isEqualTo:[NSBundle mainBundle]];
|
BOOL isMainBundle = [self.host.bundle isEqualTo:[NSBundle mainBundle]];
|
||||||
BOOL hostIsCodeSigned = [SUCodeSigningVerifier bundleAtURLIsCodeSigned:self.host.bundle.bundleURL];
|
BOOL hostIsCodeSigned = [SUCodeSigningVerifier bundleAtURLIsCodeSigned:self.host.bundle.bundleURL];
|
||||||
NSURL *feedURL = [self feedURL];
|
NSURL *feedURL = [self feedURL];
|
||||||
@@ -165,8 +169,20 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
|||||||
} else if (!servingOverHttps) {
|
} else if (!servingOverHttps) {
|
||||||
[self showAlertText:SULocalizedString(@"Auto-update not configured", nil)
|
[self showAlertText:SULocalizedString(@"Auto-update not configured", nil)
|
||||||
informativeText:[NSString stringWithFormat:SULocalizedString(@"For security reasons, updates to %@ need to be served over HTTPS and/or signed with an EdDSA key. See https://sparkle-project.org/documentation/ for more information.", nil), name]];
|
informativeText:[NSString stringWithFormat:SULocalizedString(@"For security reasons, updates to %@ need to be served over HTTPS and/or signed with an EdDSA key. See https://sparkle-project.org/documentation/ for more information.", nil), name]];
|
||||||
|
} else {
|
||||||
|
if (!self.loggedNoSecureKeyWarning) {
|
||||||
|
SULog(SULogLevelError, @"Error: Serving updates without an EdDSA key and only using Apple Code Signing is deprecated and may be unsupported in a future release. Visit Sparkle's documentation for more information: https://sparkle-project.org/documentation/#3-segue-for-security-concerns");
|
||||||
|
|
||||||
|
self.loggedNoSecureKeyWarning = YES;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (!hasEdDSAPublicKey) {
|
||||||
|
if (!self.loggedNoSecureKeyWarning) {
|
||||||
|
SULog(SULogLevelError, @"Error: Serving updates without an EdDSA key is insecure and deprecated. DSA support may be removed in a future Sparkle release. Please migrate to using EdDSA (ed25519). Visit Sparkle's documentation for migration information: https://sparkle-project.org/documentation/#3-segue-for-security-concerns");
|
||||||
|
|
||||||
|
self.loggedNoSecureKeyWarning = YES;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101100
|
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 101100
|
||||||
@@ -239,7 +255,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
|||||||
// We start the update checks and register as observer for changes after the prompt finishes
|
// We start the update checks and register as observer for changes after the prompt finishes
|
||||||
} else {
|
} else {
|
||||||
// We check if the user's said they want updates, or they haven't said anything, and the default is set to checking.
|
// We check if the user's said they want updates, or they haven't said anything, and the default is set to checking.
|
||||||
[self scheduleNextUpdateCheck];
|
[self scheduleNextUpdateCheckUsingCurrentDate:YES];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +271,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
|||||||
{
|
{
|
||||||
self.driver = nil;
|
self.driver = nil;
|
||||||
[self updateLastUpdateCheckDate];
|
[self updateLastUpdateCheckDate];
|
||||||
[self scheduleNextUpdateCheck];
|
[self scheduleNextUpdateCheckUsingCurrentDate:NO];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,7 +293,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
|||||||
[self didChangeValueForKey:@"lastUpdateCheckDate"];
|
[self didChangeValueForKey:@"lastUpdateCheckDate"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)scheduleNextUpdateCheck
|
- (void)scheduleNextUpdateCheckUsingCurrentDate:(BOOL)usingCurrentDate
|
||||||
{
|
{
|
||||||
if (self.checkTimer)
|
if (self.checkTimer)
|
||||||
{
|
{
|
||||||
@@ -287,9 +303,20 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
|||||||
if (![self automaticallyChecksForUpdates]) return;
|
if (![self automaticallyChecksForUpdates]) return;
|
||||||
|
|
||||||
// How long has it been since last we checked for an update?
|
// How long has it been since last we checked for an update?
|
||||||
NSDate *lastCheckDate = [self lastUpdateCheckDate];
|
NSTimeInterval intervalSinceCheck;
|
||||||
if (!lastCheckDate) { lastCheckDate = [NSDate distantPast]; }
|
if (usingCurrentDate) {
|
||||||
NSTimeInterval intervalSinceCheck = [[NSDate date] timeIntervalSinceDate:lastCheckDate];
|
NSDate *lastCheckDate = [self lastUpdateCheckDate];
|
||||||
|
if (!lastCheckDate) { lastCheckDate = [NSDate distantPast]; }
|
||||||
|
intervalSinceCheck = [[NSDate date] timeIntervalSinceDate:lastCheckDate];
|
||||||
|
if (intervalSinceCheck < 0) {
|
||||||
|
// Last update check date is in the future and bogus, so reset it to current date
|
||||||
|
[self updateLastUpdateCheckDate];
|
||||||
|
|
||||||
|
intervalSinceCheck = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
intervalSinceCheck = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Now we want to figure out how long until we check again.
|
// Now we want to figure out how long until we check again.
|
||||||
NSTimeInterval delayUntilCheck, updateCheckInterval = [self updateCheckInterval];
|
NSTimeInterval delayUntilCheck, updateCheckInterval = [self updateCheckInterval];
|
||||||
@@ -317,23 +344,13 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
|||||||
- (void)receiveWakeNote
|
- (void)receiveWakeNote
|
||||||
{
|
{
|
||||||
if (self.shouldRescheduleOnWake) // the reason for rescheduling the update-check timer is that NSTimer does behave as if the time the Mac spends asleep did not exist at all, which can significantly prolong the time between update checks
|
if (self.shouldRescheduleOnWake) // the reason for rescheduling the update-check timer is that NSTimer does behave as if the time the Mac spends asleep did not exist at all, which can significantly prolong the time between update checks
|
||||||
[self scheduleNextUpdateCheck];
|
[self scheduleNextUpdateCheckUsingCurrentDate:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)checkForUpdatesInBackground
|
- (void)checkForUpdatesInBackground
|
||||||
{
|
{
|
||||||
BOOL automatic = [self automaticallyDownloadsUpdates];
|
BOOL automatic = [self automaticallyDownloadsUpdates];
|
||||||
if (!automatic) {
|
|
||||||
NSUserDefaults *defaults = [[NSUserDefaults alloc] initWithSuiteName:@"com.apple.notificationcenterui"];
|
|
||||||
BOOL dnd = [defaults boolForKey:@"doNotDisturb"];
|
|
||||||
if (dnd) {
|
|
||||||
SULog(SULogLevelDefault, @"Delayed update, because Do Not Disturb is on");
|
|
||||||
[self updateLastUpdateCheckDate];
|
|
||||||
[self scheduleNextUpdateCheck];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do not use reachability for a preflight check. This can be deceptive and a bad idea. Apple does not recommend doing it.
|
// Do not use reachability for a preflight check. This can be deceptive and a bad idea. Apple does not recommend doing it.
|
||||||
SUUpdateDriver *theUpdateDriver = [(SUBasicUpdateDriver *)[(automatic ? [SUAutomaticUpdateDriver class] : [SUScheduledUpdateDriver class])alloc] initWithUpdater:self];
|
SUUpdateDriver *theUpdateDriver = [(SUBasicUpdateDriver *)[(automatic ? [SUAutomaticUpdateDriver class] : [SUScheduledUpdateDriver class])alloc] initWithUpdater:self];
|
||||||
|
|
||||||
@@ -380,7 +397,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
|||||||
|
|
||||||
if( [self.delegate respondsToSelector: @selector(updaterMayCheckForUpdates:)] && ![self.delegate updaterMayCheckForUpdates: self] )
|
if( [self.delegate respondsToSelector: @selector(updaterMayCheckForUpdates:)] && ![self.delegate updaterMayCheckForUpdates: self] )
|
||||||
{
|
{
|
||||||
[self scheduleNextUpdateCheck];
|
[self scheduleNextUpdateCheckUsingCurrentDate:NO];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -389,7 +406,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
|||||||
// If we're not given a driver at all, just schedule the next update check and bail.
|
// If we're not given a driver at all, just schedule the next update check and bail.
|
||||||
if (!self.driver)
|
if (!self.driver)
|
||||||
{
|
{
|
||||||
[self scheduleNextUpdateCheck];
|
[self scheduleNextUpdateCheckUsingCurrentDate:NO];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -441,7 +458,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
|||||||
- (void)resetUpdateCycle
|
- (void)resetUpdateCycle
|
||||||
{
|
{
|
||||||
[[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(resetUpdateCycle) object:nil];
|
[[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(resetUpdateCycle) object:nil];
|
||||||
[self scheduleNextUpdateCheck];
|
[self scheduleNextUpdateCheckUsingCurrentDate:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setAutomaticallyChecksForUpdates:(BOOL)automaticallyCheckForUpdates
|
- (void)setAutomaticallyChecksForUpdates:(BOOL)automaticallyCheckForUpdates
|
||||||
@@ -518,9 +535,8 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
|
|||||||
if (customUserAgentString) {
|
if (customUserAgentString) {
|
||||||
return customUserAgentString;
|
return customUserAgentString;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString *version = [self.sparkleBundle objectForInfoDictionaryKey:(__bridge NSString *)kCFBundleVersionKey];
|
NSString *userAgent = [NSString stringWithFormat:@"%@/%@ Sparkle/%@", [self.host name], [self.host displayVersion], @""MARKETING_VERSION];
|
||||||
NSString *userAgent = [NSString stringWithFormat:@"%@/%@ Sparkle/%@", [self.host name], [self.host displayVersion], version ? version : @"?"];
|
|
||||||
NSData *cleanedAgent = [userAgent dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
|
NSData *cleanedAgent = [userAgent dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
|
||||||
return [[NSString alloc] initWithData:cleanedAgent encoding:NSASCIIStringEncoding];
|
return [[NSString alloc] initWithData:cleanedAgent encoding:NSASCIIStringEncoding];
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+4
-1
@@ -77,7 +77,10 @@ static WKUserScript *_userScriptWithInjectedStyleSource(NSString *styleSource)
|
|||||||
// that involves implementing a delegate method that is only available on macOS 11.. to get it properly working.
|
// that involves implementing a delegate method that is only available on macOS 11.. to get it properly working.
|
||||||
// To simplify things, just rely on deprecated property for now.
|
// To simplify things, just rely on deprecated property for now.
|
||||||
// Future reader: if you change how JS is disabled, please be sure to test that JS code is properly disabled in HTML release notes.
|
// Future reader: if you change how JS is disabled, please be sure to test that JS code is properly disabled in HTML release notes.
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
configuration.preferences.javaScriptEnabled = javaScriptEnabled;
|
configuration.preferences.javaScriptEnabled = javaScriptEnabled;
|
||||||
|
#pragma clang diagnostic pop
|
||||||
configuration.preferences.javaScriptCanOpenWindowsAutomatically = NO;
|
configuration.preferences.javaScriptCanOpenWindowsAutomatically = NO;
|
||||||
|
|
||||||
NSError *colorStyleContentsError = nil;
|
NSError *colorStyleContentsError = nil;
|
||||||
@@ -85,7 +88,7 @@ static WKUserScript *_userScriptWithInjectedStyleSource(NSString *styleSource)
|
|||||||
|
|
||||||
WKUserContentController *userContentController = [[WKUserContentController alloc] init];
|
WKUserContentController *userContentController = [[WKUserContentController alloc] init];
|
||||||
|
|
||||||
NSString *fontStyleContents = [NSString stringWithFormat:@"body { font-family: %@; font-size: %dpt; }", fontFamily, fontPointSize];
|
NSString *fontStyleContents = [NSString stringWithFormat:@"body { font-family: %@; font-size: %dpx; }", fontFamily, fontPointSize];
|
||||||
|
|
||||||
NSString *finalStyleContents;
|
NSString *finalStyleContents;
|
||||||
if (colorStyleContents == nil) {
|
if (colorStyleContents == nil) {
|
||||||
|
|||||||
Vendored
+1
-1
@@ -11,7 +11,7 @@
|
|||||||
BOOL SUWebViewIsSafeURL(NSURL *url, BOOL *isAboutBlankURL)
|
BOOL SUWebViewIsSafeURL(NSURL *url, BOOL *isAboutBlankURL)
|
||||||
{
|
{
|
||||||
NSString *scheme = url.scheme;
|
NSString *scheme = url.scheme;
|
||||||
BOOL isAboutBlank = [url.absoluteString isEqualToString:@"about:blank"];
|
BOOL isAboutBlank = [url.absoluteString isEqualToString:@"about:blank"] || [url.absoluteString isEqualToString:@"about:srcdoc"];
|
||||||
BOOL whitelistedSafe = isAboutBlank || [@[@"http", @"https", @"macappstore", @"macappstores", @"itms-apps", @"itms-appss"] containsObject:scheme];
|
BOOL whitelistedSafe = isAboutBlank || [@[@"http", @"https", @"macappstore", @"macappstores", @"itms-apps", @"itms-appss"] containsObject:scheme];
|
||||||
|
|
||||||
*isAboutBlankURL = isAboutBlank;
|
*isAboutBlankURL = isAboutBlank;
|
||||||
|
|||||||
Vendored
+1
-1
@@ -17,7 +17,7 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>FMWK</string>
|
<string>FMWK</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
<string>${MARKETING_VERSION}</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
|
|||||||
+1
-1
@@ -20,4 +20,4 @@
|
|||||||
"180.title" = "Odeslat anonymní systémový profil";
|
"180.title" = "Odeslat anonymní systémový profil";
|
||||||
|
|
||||||
/* Class = "NSTextFieldCell"; title = "Anonymous system profile information is used to help us plan future development work.\nPlease contact us if you have any questions about this.\n\nThis is the information that would be sent:"; ObjectID = "183"; */
|
/* Class = "NSTextFieldCell"; title = "Anonymous system profile information is used to help us plan future development work.\nPlease contact us if you have any questions about this.\n\nThis is the information that would be sent:"; ObjectID = "183"; */
|
||||||
"183.title" = "Informace z anonymního systémového profilu pomáhají vývojářům lépe plánovat budoucí vývoj aplikace.\nBudete-li mít nějaký dotaz, obraťte se na nás.\n\nTyto informace by měly být odeslány:";
|
"183.title" = "Informace z anonymního systémového profilu pomáhají vývojářům lépe plánovat budoucí vývoj aplikace.\nBudete-li mít nějaký dotaz, obraťte se na nás.\n\nToto jsou informace, které budou odeslány:";
|
||||||
Vendored
+3
-3
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ wurde geladen und steht zur Installation bereit! Möchtest du %1$@ jetzt durch die neue Version ersetzen und neu starten?";
|
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ wurde geladen und steht zur Installation bereit! Möchtest du %1$@ jetzt durch die neue Version ersetzen und neu starten?";
|
||||||
|
|
||||||
"%1$@ can't be updated, because it was opened from a read-only or a temporary location." = "%1$@ kann nicht aktualisiert werden, da es aus dem Downloads-Order, oder von einer DMG Datei oder Laufwerk ohne Schreibzugriff gestartet wurde.";
|
"%1$@ can't be updated, because it was opened from a read-only or a temporary location." = "%1$@ kann nicht aktualisiert werden, da es aus dem Downloads-Order, oder von einer DMG-Datei oder einem Laufwerk ohne Schreibzugriff gestartet wurde.";
|
||||||
|
|
||||||
"Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "Kopiere %1$@ in den Programmeordner, starte es von dort aus und versuche es erneut zu aktualisieren.";
|
"Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "Kopiere %1$@ in den Programmeordner, starte es von dort aus und versuche es erneut zu aktualisieren.";
|
||||||
|
|
||||||
"Quit %1$@, move it into your Applications folder, relaunch it from there and try again." = "Beenden Sie „%1$@“, bewegen Sie es in den Ordner „Programme“, starten Sie das Programm von dort erneut und versuchen Sie es noch einmal.";
|
"Quit %1$@, move it into your Applications folder, relaunch it from there and try again." = "Beende „%1$@“, bewege es in den Ordner „Programme“, starte das Programm von dort erneut und versuche es noch einmal.";
|
||||||
|
|
||||||
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "„%1$@“ kann nicht aktualisiert werden, wenn das Programm von dem Ort ausgeführt wird, an den es heruntergeladen wurde.";
|
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "„%1$@“ kann nicht aktualisiert werden, wenn das Programm von dem Ort ausgeführt wird, an den es heruntergeladen wurde.";
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
"A new version of %@ is ready to install!" = "Eine neue Version von %@ steht zur Installation bereit!";
|
"A new version of %@ is ready to install!" = "Eine neue Version von %@ steht zur Installation bereit!";
|
||||||
|
|
||||||
"An error occurred in retrieving update information. Please try again later." = "Beim Laden der Updateinformationen trat ein Fehler auf. Bitte versuche es später erneut.";
|
"An error occurred in retrieving update information. Please try again later." = "Beim Laden der Updateinformationen ist ein Fehler aufgetreten. Bitte versuche es später erneut.";
|
||||||
|
|
||||||
"An error occurred while downloading the update. Please try again later." = "Beim Laden des Updates ist ein Fehler aufgetreten. Bitte versuche es später erneut.";
|
"An error occurred while downloading the update. Please try again later." = "Beim Laden des Updates ist ein Fehler aufgetreten. Bitte versuche es später erneut.";
|
||||||
|
|
||||||
|
|||||||
Vendored
+4
-4
@@ -1,15 +1,15 @@
|
|||||||
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ загружен и готов к использованию! Хотите установить и перезапустить %1$@?";
|
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ загружен и готов к использованию! Хотите установить и перезапустить %1$@?";
|
||||||
|
|
||||||
"%1$@ can't be updated, because it was opened from a read-only or a temporary location." = "Во время работы %1$@ с тома, предназначенного только для чтения, как например, образа диска или накопителя на оптических дисках, его невозможно обновить.";
|
"%1$@ can't be updated, because it was opened from a read-only or a temporary location." = "Не удаётся обновить %1$@ с тома, предназначенного только для чтения.";
|
||||||
|
|
||||||
"Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "Переместите %1$@ в Папку приложений, перезапустите его оттуда и повторите попытку.";
|
"Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again." = "Переместите %1$@ в Папку приложений, перезапустите его оттуда и повторите попытку.";
|
||||||
|
|
||||||
"%@ %@ is currently the newest version available." = "В настоящий момент %1$@ %2$@ является новейшей версией.";
|
"%@ %@ is currently the newest version available." = "В настоящий момент %1$@ %2$@ является новейшей версией.";
|
||||||
|
|
||||||
"%@ %@ is currently the newest version available.\n(You are currently running version %@.)" = "В настоящий момент %1$@ %2$@ является новейшей версией.\n(You are currently running version %3$@.)";
|
"%@ %@ is currently the newest version available.\n(You are currently running version %@.)" = "В настоящий момент %1$@ %2$@ является новейшей версией.\n(У вас установлена %3$@.)";
|
||||||
|
|
||||||
/* Description text for SUUpdateAlert when the update is downloadable. */
|
/* Description text for SUUpdateAlert when the update is downloadable. */
|
||||||
"%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@ теперь доступен – вы имеете %3$@. Хотите загрузить его сейчас?";
|
"%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@ теперь доступен – у вас установлен %3$@. Хотите загрузить его сейчас?";
|
||||||
|
|
||||||
/* Description text for SUUpdateAlert when the update informational with no download. */
|
/* Description text for SUUpdateAlert when the update informational with no download. */
|
||||||
"%@ %@ is now available--you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ is now available--you have %3$@. Would you like to learn more about this update on the web?";
|
"%@ %@ is now available--you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ is now available--you have %3$@. Would you like to learn more about this update on the web?";
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
"An error occurred while installing the update. Please try again later." = "Произошла ошибка при установке обновления. Повторите попытку позже.";
|
"An error occurred while installing the update. Please try again later." = "Произошла ошибка при установке обновления. Повторите попытку позже.";
|
||||||
|
|
||||||
"An error occurred while parsing the update feed." = "Ошибка произошла при извлечении канала обновления.";
|
"An error occurred while parsing the update feed." = "Произошла ошибка при извлечении канала обновления.";
|
||||||
|
|
||||||
"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@." = "Произошла ошибка при перезапуске %1$@, но при последующем запуске %1$@ будет доступна новая версия.";
|
"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@." = "Произошла ошибка при перезапуске %1$@, но при последующем запуске %1$@ будет доступна новая версия.";
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ static NSString * const UPDATED_VERSION = @"2.0";
|
|||||||
|
|
||||||
ed25519_sign(signature, archive.bytes, archive.length, public_key, self_sign_demo_only_insecure_hack);
|
ed25519_sign(signature, archive.bytes, archive.length, public_key, self_sign_demo_only_insecure_hack);
|
||||||
|
|
||||||
NSString *signatureString = [[NSData dataWithBytes:signature length:64] base64Encoding];
|
NSString *signatureString = [[NSData dataWithBytes:signature length:64] base64EncodedStringWithOptions:0];
|
||||||
|
|
||||||
// Obtain the file attributes to get the file size of our update later
|
// Obtain the file attributes to get the file size of our update later
|
||||||
NSError *fileAttributesError = nil;
|
NSError *fileAttributesError = nil;
|
||||||
|
|||||||
@@ -352,7 +352,7 @@ typedef void (^SUDeltaHandler)(NSFileManager *fileManager, NSString *sourceDirec
|
|||||||
// Make sure old version patches still work for simple cases
|
// Make sure old version patches still work for simple cases
|
||||||
- (void)testRegularFileAddedWithAzureVersion
|
- (void)testRegularFileAddedWithAzureVersion
|
||||||
{
|
{
|
||||||
XCTAssertTrue([self createAndApplyPatchUsingVersion:SUAzureMajorVersion beforeDiffHandler:^(NSFileManager *__unused fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
|
XCTAssertTrue([self createAndApplyPatchUsingVersion:SUBinaryDeltaMajorVersion1 beforeDiffHandler:^(NSFileManager *__unused fileManager, NSString *sourceDirectory, NSString *destinationDirectory) {
|
||||||
NSString *sourceFile = [sourceDirectory stringByAppendingPathComponent:@"A"];
|
NSString *sourceFile = [sourceDirectory stringByAppendingPathComponent:@"A"];
|
||||||
NSString *destinationFile = [destinationDirectory stringByAppendingPathComponent:@"A"];
|
NSString *destinationFile = [destinationDirectory stringByAppendingPathComponent:@"A"];
|
||||||
NSString *destinationFile2 = [destinationDirectory stringByAppendingPathComponent:@"B"];
|
NSString *destinationFile2 = [destinationDirectory stringByAppendingPathComponent:@"B"];
|
||||||
|
|||||||
@@ -24,10 +24,9 @@ class SUUnarchiverTest: XCTestCase
|
|||||||
let unarchivedSuccessExpectation = super.expectation(description: "Unarchived Success (format: \(archiveExtension))")
|
let unarchivedSuccessExpectation = super.expectation(description: "Unarchived Success (format: \(archiveExtension))")
|
||||||
let unarchivedFailureExpectation = super.expectation(description: "Unarchived Failure (format: \(archiveExtension))")
|
let unarchivedFailureExpectation = super.expectation(description: "Unarchived Failure (format: \(archiveExtension))")
|
||||||
|
|
||||||
let tempArchiveURL = tempDirectoryURL.appendingPathComponent(archiveResourceURL.lastPathComponent)
|
|
||||||
let extractedAppURL = tempDirectoryURL.appendingPathComponent(appName).appendingPathExtension("app")
|
let extractedAppURL = tempDirectoryURL.appendingPathComponent(appName).appendingPathExtension("app")
|
||||||
|
|
||||||
self.unarchiveTestAppWithExtension(archiveExtension, appName: appName, tempDirectoryURL: tempDirectoryURL, tempArchiveURL: tempArchiveURL, archiveResourceURL: archiveResourceURL, password: password, expectingSuccess: expectingSuccess, testExpectation: unarchivedSuccessExpectation)
|
self.unarchiveTestAppWithExtension(archiveExtension, appName: appName, tempDirectoryURL: tempDirectoryURL, archiveResourceURL: archiveResourceURL, password: password, expectingSuccess: expectingSuccess, testExpectation: unarchivedSuccessExpectation)
|
||||||
self.unarchiveNonExistentFileTestFailureAppWithExtension(archiveExtension, tempDirectoryURL: tempDirectoryURL, password: password, testExpectation: unarchivedFailureExpectation)
|
self.unarchiveNonExistentFileTestFailureAppWithExtension(archiveExtension, tempDirectoryURL: tempDirectoryURL, password: password, testExpectation: unarchivedFailureExpectation)
|
||||||
|
|
||||||
super.waitForExpectations(timeout: 30.0, handler: nil)
|
super.waitForExpectations(timeout: 30.0, handler: nil)
|
||||||
@@ -40,7 +39,7 @@ class SUUnarchiverTest: XCTestCase
|
|||||||
|
|
||||||
func unarchiveNonExistentFileTestFailureAppWithExtension(_ archiveExtension: String, tempDirectoryURL: URL, password: String?, testExpectation: XCTestExpectation) {
|
func unarchiveNonExistentFileTestFailureAppWithExtension(_ archiveExtension: String, tempDirectoryURL: URL, password: String?, testExpectation: XCTestExpectation) {
|
||||||
let tempArchiveURL = tempDirectoryURL.appendingPathComponent("error-invalid").appendingPathExtension(archiveExtension)
|
let tempArchiveURL = tempDirectoryURL.appendingPathComponent("error-invalid").appendingPathExtension(archiveExtension)
|
||||||
let unarchiver = SUUnarchiver.unarchiver(forPath: tempArchiveURL.path, updatingHostBundlePath: nil, decryptionPassword: password)!
|
let unarchiver = SUUnarchiver.unarchiver(forPath: tempArchiveURL.path, extractionDirectory: tempDirectoryURL.path, updatingHostBundlePath: nil, decryptionPassword: password)!
|
||||||
|
|
||||||
unarchiver.unarchive(completionBlock: {(error: Error?) -> Void in
|
unarchiver.unarchive(completionBlock: {(error: Error?) -> Void in
|
||||||
XCTAssertNotNil(error)
|
XCTAssertNotNil(error)
|
||||||
@@ -49,13 +48,8 @@ class SUUnarchiverTest: XCTestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
// swiftlint:disable function_parameter_count
|
// swiftlint:disable function_parameter_count
|
||||||
func unarchiveTestAppWithExtension(_ archiveExtension: String, appName: String, tempDirectoryURL: URL, tempArchiveURL: URL, archiveResourceURL: URL, password: String?, expectingSuccess: Bool, testExpectation: XCTestExpectation) {
|
func unarchiveTestAppWithExtension(_ archiveExtension: String, appName: String, tempDirectoryURL: URL, archiveResourceURL: URL, password: String?, expectingSuccess: Bool, testExpectation: XCTestExpectation) {
|
||||||
|
let unarchiver = SUUnarchiver.unarchiver(forPath: archiveResourceURL.path, extractionDirectory: tempDirectoryURL.path, updatingHostBundlePath: nil, decryptionPassword: password)!
|
||||||
let fileManager = FileManager.default
|
|
||||||
|
|
||||||
try! fileManager.copyItem(at: archiveResourceURL, to: tempArchiveURL)
|
|
||||||
|
|
||||||
let unarchiver = SUUnarchiver.unarchiver(forPath: tempArchiveURL.path, updatingHostBundlePath: nil, decryptionPassword: password)!
|
|
||||||
|
|
||||||
unarchiver.unarchive(completionBlock: {(error: Error?) -> Void in
|
unarchiver.unarchive(completionBlock: {(error: Error?) -> Void in
|
||||||
if expectingSuccess {
|
if expectingSuccess {
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class SUTestApplicationTest: XCTestCase
|
|||||||
menuBarsQuery.menuBarItems["Sparkle Test App"].click()
|
menuBarsQuery.menuBarItems["Sparkle Test App"].click()
|
||||||
}
|
}
|
||||||
|
|
||||||
app.dialogs["SUUpdateAlert"].buttons["Install Update"].click()
|
app.windows["SUUpdateAlert"].buttons["Install Update"].click()
|
||||||
|
|
||||||
// Give some time for the update to finish downloading / extracting
|
// Give some time for the update to finish downloading / extracting
|
||||||
sleep(30)
|
sleep(30)
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
for file in "dsaparam.pem" "dsa_priv.pem" "dsa_pub.pem"; do
|
|
||||||
if [ -e "$file" ]; then
|
|
||||||
echo "There's already a $file here! Move it aside or be more careful!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
openssl="/usr/bin/openssl"
|
|
||||||
$openssl gendsa <($openssl dsaparam 2047) -out dsa_priv.pem
|
|
||||||
chmod 0400 dsa_priv.pem
|
|
||||||
$openssl dsa -in dsa_priv.pem -pubout -out dsa_pub.pem
|
|
||||||
|
|
||||||
echo "
|
|
||||||
Generated two files:
|
|
||||||
dsa_priv.pem: your private key. Keep it secret and don't share it!
|
|
||||||
dsa_pub.pem: public counterpart to include in the app bundle.
|
|
||||||
|
|
||||||
BACK UP YOUR PRIVATE KEY AND KEEP IT SAFE!
|
|
||||||
If you lose it, your users will be unable to upgrade!
|
|
||||||
"
|
|
||||||
|
|
||||||
open -R dsa_priv.pem
|
|
||||||
@@ -24,7 +24,7 @@ class DeltaUpdate {
|
|||||||
class func create(from: ArchiveItem, to: ArchiveItem, archivePath: URL) throws -> DeltaUpdate {
|
class func create(from: ArchiveItem, to: ArchiveItem, archivePath: URL) throws -> DeltaUpdate {
|
||||||
var applyDiffError: NSError?
|
var applyDiffError: NSError?
|
||||||
|
|
||||||
if !createBinaryDelta(from.appPath.path, to.appPath.path, archivePath.path, .beigeMajorVersion, false, &applyDiffError) {
|
if !createBinaryDelta(from.appPath.path, to.appPath.path, archivePath.path, .version2, false, &applyDiffError) {
|
||||||
throw applyDiffError!
|
throw applyDiffError!
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,6 +141,7 @@ class ArchiveItem: CustomStringConvertible {
|
|||||||
var pubDate: String {
|
var pubDate: String {
|
||||||
let date = self.archiveFileAttributes[.creationDate] as! Date
|
let date = self.archiveFileAttributes[.creationDate] as! Date
|
||||||
let formatter = DateFormatter()
|
let formatter = DateFormatter()
|
||||||
|
formatter.locale = Locale(identifier: "en_US_POSIX")
|
||||||
formatter.dateFormat = "EEE, dd MMM yyyy HH:mm:ss ZZ"
|
formatter.dateFormat = "EEE, dd MMM yyyy HH:mm:ss ZZ"
|
||||||
return formatter.string(from: date)
|
return formatter.string(from: date)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,38 +8,26 @@ import Foundation
|
|||||||
func unarchive(itemPath: URL, archiveDestDir: URL, callback: @escaping (Error?) -> Void) {
|
func unarchive(itemPath: URL, archiveDestDir: URL, callback: @escaping (Error?) -> Void) {
|
||||||
let fileManager = FileManager.default
|
let fileManager = FileManager.default
|
||||||
let tempDir = archiveDestDir.appendingPathExtension("tmp")
|
let tempDir = archiveDestDir.appendingPathExtension("tmp")
|
||||||
let itemCopy = tempDir.appendingPathComponent(itemPath.lastPathComponent)
|
|
||||||
|
|
||||||
|
_ = try? fileManager.removeItem(at: tempDir)
|
||||||
_ = try? fileManager.createDirectory(at: tempDir, withIntermediateDirectories: true, attributes: [:])
|
_ = try? fileManager.createDirectory(at: tempDir, withIntermediateDirectories: true, attributes: [:])
|
||||||
|
|
||||||
do {
|
if let unarchiver = SUUnarchiver.unarchiver(forPath: itemPath.path, extractionDirectory: tempDir.path, updatingHostBundlePath: nil, decryptionPassword: nil) {
|
||||||
do {
|
unarchiver.unarchive(completionBlock: { (error: Error?) in
|
||||||
try fileManager.linkItem(at: itemPath, to: itemCopy)
|
if error != nil {
|
||||||
} catch {
|
callback(error)
|
||||||
try fileManager.copyItem(at: itemPath, to: itemCopy)
|
return
|
||||||
}
|
}
|
||||||
if let unarchiver = SUUnarchiver.unarchiver(forPath: itemCopy.path, updatingHostBundlePath: nil, decryptionPassword: nil) {
|
|
||||||
unarchiver.unarchive(completionBlock: { (error: Error?) in
|
|
||||||
if error != nil {
|
|
||||||
callback(error)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
_ = try? fileManager.removeItem(at: itemCopy)
|
do {
|
||||||
do {
|
try fileManager.moveItem(at: tempDir, to: archiveDestDir)
|
||||||
try fileManager.moveItem(at: tempDir, to: archiveDestDir)
|
callback(nil)
|
||||||
callback(nil)
|
} catch {
|
||||||
} catch {
|
callback(error)
|
||||||
callback(error)
|
}
|
||||||
}
|
}, progressBlock: nil)
|
||||||
}, progressBlock: nil)
|
} else {
|
||||||
} else {
|
callback(makeError(code: .unarchivingError, "Not a supported archive format: \(itemPath.path)"))
|
||||||
_ = try? fileManager.removeItem(at: itemCopy)
|
|
||||||
callback(makeError(code: .unarchivingError, "Not a supported archive format: \(itemCopy)"))
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
_ = try? fileManager.removeItem(at: tempDir)
|
|
||||||
callback(error)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user