Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Install dmgbuild from a list pinned by hashes

Țugui Dragoșcd7e5023cedf
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index 35f291e0..816d95b1 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -585,9 +585,10 @@ checks the result with Gatekeeper, and prints the path and SHA-256 of `Peel-<ver
`Peel-<version>.zip`, for Homebrew, and the path of its update feed. The disk image is signed by the certificate
that signed the app, named by its SHA-1 so a renewed certificate of the same name can't make the name ambiguous,
then notarized and stapled too. It opens on a window of the album's paper with an arc from Peel to Applications, which
-`Scripts/make_dmg.sh` lays out with dmgbuild, run by uv, so nothing drives Finder; the background carries no words,
-since Finder writes the names in each Mac's language. It starts only from a committed tree whose package tests pass
-with warnings as errors, builds Sparkle from its source, and refuses a build:
+`Scripts/make_dmg.sh` lays out with dmgbuild, which uv installs into an environment of its own from
+`Scripts/dmgbuild-requirements.txt`, each package pinned by the hashes of its files, so nothing drives Finder; the
+background carries no words, since Finder writes the names in each Mac's language. It starts only from a committed
+tree whose package tests pass with warnings as errors, builds Sparkle from its source, and refuses a build:
- in which any program, Sparkle's included, can be debugged, or is not signed with Peel's Developer ID, the hardened
runtime, and a secure timestamp;
diff --git a/Scripts/dmgbuild-requirements.txt b/Scripts/dmgbuild-requirements.txt
new file mode 100644
index 00000000..1f056e6e
--- /dev/null
+++ b/Scripts/dmgbuild-requirements.txt
@@ -0,0 +1,11 @@
+# dmgbuild and what it needs, each release pinned by the SHA-256 of its wheel and of its source archive, as
+# `uv pip compile --generate-hashes` writes them from `dmgbuild==1.6.7`. make_dmg.sh installs exactly these.
+dmgbuild==1.6.7 \
+ --hash=sha256:37ee5771c377beb3203d9164aae8046ffed8531c06edf9227f5788b3c599b1bf \
+ --hash=sha256:676b17acd448899f6d4a83b2184e0657480444ecb6ac9c4922889efad9e5dbfb
+ds-store==1.3.3 \
+ --hash=sha256:a7380896ea1e880f7ba07c5cdc24bd1530fb86836cad0be531f3e80e2d721ac5 \
+ --hash=sha256:b92a371efbf1b4ccce2a04d1ed13fceacc4736c81ba09cf5aefb74c088160a35
+mac-alias==2.2.3 \
+ --hash=sha256:1c7fa367687d66979f2ce4d1a8b2716cf1c9fb811741cab3cf3ca356555c2beb \
+ --hash=sha256:7362b521d2132ef92f606a37abfed5fcd849ceb2f28b6f9743e014b02af92f0d
diff --git a/Scripts/make_dmg.sh b/Scripts/make_dmg.sh
index 49c3c4ba..e83cd9fe 100755
--- a/Scripts/make_dmg.sh
+++ b/Scripts/make_dmg.sh
@@ -1,6 +1,7 @@
#!/bin/zsh
# Makes Peel's disk image: the app, a link to Applications, and a window that shows where to drag the app.
-# dmgbuild writes the window's layout without opening Finder, run by uv in an environment of its own.
+# dmgbuild writes the window's layout without opening Finder, installed by uv into an environment of its own from
+# dmgbuild-requirements.txt, which pins each package by the hash of its files.
#
# Usage: zsh Scripts/make_dmg.sh <Peel.app> <image.dmg>
set -euo pipefail
@@ -9,7 +10,7 @@ cd "$(dirname "$0")/.."
[ $# -eq 2 ] || { echo "usage: zsh Scripts/make_dmg.sh <Peel.app> <image.dmg>"; exit 64; }
app="$1"
image="$2"
-command -v uvx > /dev/null || { echo "REFUSED: uv is not installed. Install it with: brew install uv"; exit 1; }
+command -v uv > /dev/null || { echo "REFUSED: uv is not installed. Install it with: brew install uv"; exit 1; }
# The window, and each icon's center in points from its top left corner. The background is drawn for these.
width=640
@@ -21,7 +22,11 @@ icons_y=190
background="$(dirname "$image")/disk-image-background"
mkdir -p "$background"
swift Scripts/dmg_background.swift "$background" $width $height $peel_x $applications_x $icons_y
-uvx --from dmgbuild==1.6.7 dmgbuild -s Scripts/dmg_settings.py \
+environment="$(dirname "$image")/dmgbuild-environment"
+uv venv --quiet --clear "$environment"
+uv pip install --quiet --python "$environment/bin/python" --require-hashes \
+ --requirement Scripts/dmgbuild-requirements.txt
+"$environment/bin/dmgbuild" -s Scripts/dmg_settings.py \
-D app="$app" -D background="$background/background.png" \
-D width=$width -D height=$height -D peel_x=$peel_x -D applications_x=$applications_x -D icons_y=$icons_y \
Peel "$image"
diff --git a/Scripts/release.sh b/Scripts/release.sh
index 75d3ceb6..a60346a1 100755
--- a/Scripts/release.sh
+++ b/Scripts/release.sh
@@ -22,7 +22,7 @@ archive="$build/Peel.xcarchive"
export_directory="$build/export"
app="$export_directory/Peel.app"
-if ! command -v uvx > /dev/null; then
+if ! command -v uv > /dev/null; then
echo "REFUSED: uv is not installed, and the disk image needs it. Install it with: brew install uv"
exit 1
fi