Skip to content

LordOS — a free, fast and secure GNU/Linux distribution based on Debian, with its own desktop environment: display server and Wayland compositor in C, a React UI engine on QuickJS, and private native apps.

Raspberry Pi mirror: publish the MPL-2.0 kms++ source package next to its binaries (pinned 'source' lines, checked against Raspberry Pi's signed Sources index)

Federico Pereira90717370ff42
diff --git a/docs/COMPLIANCE.md b/docs/COMPLIANCE.md
index 04762da..322861a 100644
--- a/docs/COMPLIANCE.md
+++ b/docs/COMPLIANCE.md
@@ -21,11 +21,11 @@ materials (SBOM) published with each release. The website summary is at
copied byte for byte, each with its own `copyright` inside: `rpi-eeprom` (scripts BSD-3-Clause;
bootloader images under Raspberry Pi's binary licence, which allows redistribution of unmodified
binaries for use with Raspberry Pi devices with the notice), `raspi-utils` and its parts
- (BSD-3-Clause) and `kms++` (MPL-2.0). For the MPL-2.0 binaries the corresponding source is the
- `kms++` source package of the same version in Raspberry Pi's archive (`deb-src
- http://archive.raspberrypi.com/debian trixie main`) and upstream at
- `https://github.com/tomba/kmsxx`; before Raspberry Pi's archive drops that version, its source
- package has to be kept next to the binaries (open item).
+ (BSD-3-Clause) and `kms++` (MPL-2.0). For the MPL-2.0 binaries the corresponding source, the
+ `kms++` source package of the same version from Raspberry Pi's archive, is published next to them
+ at https://lordos.org/apt/pool/rpi/source/k/kms++/ (pinned in `rpi-mirror.list` with architecture
+ `source`, verified against Raspberry Pi's signed `Sources` index, kept in the append-only pool);
+ upstream is `https://github.com/tomba/kmsxx`. A new pinned kms++ version needs its `source` line too.
## The SBOM
diff --git a/docs/UPDATES.md b/docs/UPDATES.md
index de2098d..18423a0 100644
--- a/docs/UPDATES.md
+++ b/docs/UPDATES.md
@@ -240,7 +240,10 @@ system by LordOS's packages.
- **Licences** (each package's `debian/copyright`, shipped inside it): the scripts and `raspi-utils`
are BSD-3-Clause; the bootloader images are under Raspberry Pi's binary licence (redistribution in
unmodified binary form, for use with Raspberry Pi devices, with the notice: the `.deb` is copied
- as is); `kms++` is MPL-2.0, its source is Raspberry Pi's `kms++` source package of the pinned version
+ as is); `kms++` is MPL-2.0, and its source, Raspberry Pi's `kms++` source package of the pinned
+ version, is published next to the binaries: https://lordos.org/apt/pool/rpi/source/k/kms++/ (the
+ `.dsc`, `.orig.tar.xz` and `.debian.tar.xz`, pinned in `rpi-mirror.list` with architecture `source`
+ and checked against Raspberry Pi's signed `Sources` index; not indexed for `apt source`)
([COMPLIANCE.md](COMPLIANCE.md)).
- **Which source wins.** On the LordOS Pi image, which also lists Raspberry Pi's archive with
priority 990 for these packages (`/etc/apt/preferences.d/raspberrypi`), apt takes the newest
diff --git a/tools/release/apt-repo.sh b/tools/release/apt-repo.sh
index 426949c..0cc76e5 100755
--- a/tools/release/apt-repo.sh
+++ b/tools/release/apt-repo.sh
@@ -23,7 +23,9 @@
# when Raspberry Pi's InRelease verifies with tools/release/raspberrypi-archive-keyring.pgp (its
# fingerprint checked), the index's SHA-256 matches InRelease, and the file's SHA-256 matches both
# the index and the pinned line. Verified files are kept in $WORKDIR/rpi-cache, so a pinned version
-# can still be published after Raspberry Pi's archive has moved on (docs/UPDATES.md).
+# can still be published after Raspberry Pi's archive has moved on (docs/UPDATES.md). Pinned source
+# packages (MPL-2.0 kms++) go to pool/rpi/source/<letter>/<name>/, checked the same way against the
+# signed Sources index, so their source is offered next to the binaries.
#
# --notes VERSION=SECTION takes the notes of lordos VERSION from CHANGELOG.md section SECTION (for
# example 0.8.1~staging1=Unreleased). By default the section is "VERSION" or "VERSION-<suffix>".
@@ -120,6 +122,7 @@ rpi_import() {
grep -v '^#' "$RPI_LIST" > "$t/list"
while read -r name ver arch sum _; do
[ -n "$name" ] || continue
+ [ "$arch" = source ] && continue # rpi_src_import
case "$name$ver$arch" in *[!A-Za-z0-9.+~:_-]*) rm -rf "$t"; die "rpi-mirror.list: bad line for $name" ;; esac
printf %s "$sum" | grep -Eq '^[0-9a-f]{64}$' || { rm -rf "$t"; die "rpi-mirror.list: bad sha256 for $name"; }
f="$cache/${name}_${ver#*:}_$arch.deb"
@@ -155,6 +158,63 @@ rpi_import() {
rm -rf "$t"
}
+# the pinned Raspberry Pi source packages ("source" lines): the .dsc (pinned SHA-256, also in the
+# signed Sources index) and every file the index lists for it, into $WORKDIR/rpi-cache/src/<name>/;
+# prints those folders
+rpi_src_import() {
+ t=$(mktemp -d)
+ fpr=$(GNUPGHOME=$t gpg --batch --with-colons --show-keys "$RPI_KEYRING" 2>/dev/null | awk -F: '/^fpr/ { print $10; exit }')
+ [ "$fpr" = "$RPI_KEY_FPR" ] || { rm -rf "$t"; die "$RPI_KEYRING has fingerprint $fpr, expected $RPI_KEY_FPR"; }
+ have_index=0
+ grep -v '^#' "$RPI_LIST" | awk '$3 == "source"' > "$t/list"
+ while read -r name ver arch sum _; do
+ [ -n "$name" ] || continue
+ case "$name$ver" in *[!A-Za-z0-9.+~:_-]*) rm -rf "$t"; die "rpi-mirror.list: bad line for $name" ;; esac
+ printf %s "$sum" | grep -Eq '^[0-9a-f]{64}$' || { rm -rf "$t"; die "rpi-mirror.list: bad sha256 for $name"; }
+ dir=$WORKDIR/rpi-cache/src/$name
+ dsc="$dir/${name}_${ver#*:}.dsc"
+ mkdir -p "$dir"
+ if [ "$have_index" = 0 ]; then
+ curl -fsS -o "$t/InRelease" "$RPI_ARCHIVE/dists/trixie/InRelease" || die "cannot download Raspberry Pi's InRelease"
+ gpgv --keyring "$RPI_KEYRING" --output "$t/Release" "$t/InRelease" 2>/dev/null || die "Raspberry Pi's InRelease does not verify with $RPI_KEYRING"
+ want=$(awk '/^SHA256:/ { s = 1; next } /^[^ ]/ { s = 0 } s && $3 == "main/source/Sources.gz" { print $1 }' "$t/Release")
+ [ -n "$want" ] || die "Raspberry Pi's Release lists no main/source/Sources.gz"
+ curl -fsS -o "$t/Sources.gz" "$RPI_ARCHIVE/dists/trixie/main/source/Sources.gz" || die "cannot download Raspberry Pi's Sources index"
+ [ "$(shasum -a 256 "$t/Sources.gz" | cut -d' ' -f1)" = "$want" ] || die "Raspberry Pi's Sources.gz does not match its InRelease"
+ gzip -dc "$t/Sources.gz" > "$t/Sources"
+ have_index=1
+ fi
+ # "<directory>" then "<sha256> <file>" for each file of exactly that source package and version
+ awk -v n="$name" -v v="$ver" 'BEGIN { RS = "" } {
+ pn = pv = pd = ""; k = split($0, L, "\n"); c = 0
+ for (i = 1; i <= k; i++) {
+ if (L[i] ~ /^Package: /) pn = substr(L[i], 10); else if (L[i] ~ /^Version: /) pv = substr(L[i], 10)
+ else if (L[i] ~ /^Directory: /) pd = substr(L[i], 12)
+ else if (L[i] ~ /^Checksums-Sha256:/) c = 1
+ else if (L[i] !~ /^ /) c = 0
+ else if (c) { split(L[i], F, " "); f[++m] = F[1] " " F[3] }
+ }
+ if (pn == n && pv == v) { print pd; for (j = 1; j <= m; j++) print f[j] }
+ m = 0 }' "$t/Sources" > "$t/files"
+ [ -s "$t/files" ] || die "source $name $ver is no longer in Raspberry Pi's archive: keep $dir or pin the new version"
+ path=$(head -n 1 "$t/files")
+ case "$path" in pool/main/*) ;; *) die "$name: unexpected Directory $path" ;; esac
+ grep -qx "$sum $(basename "$dsc")" "$t/files" || die "source $name $ver: Raspberry Pi's index does not list the pinned .dsc ($sum)"
+ tail -n +2 "$t/files" > "$t/want"
+ while read -r fsum file; do
+ case "$file" in "$name"_*) ;; *) die "$name: unexpected file $file" ;; esac
+ case "$file" in *[!A-Za-z0-9.+~_-]*) die "$name: unexpected file $file" ;; esac
+ f="$dir/$file"
+ if [ -f "$f" ] && [ "$(shasum -a 256 "$f" | cut -d' ' -f1)" = "$fsum" ]; then continue; fi
+ curl -fsS -o "$f.part" "$RPI_ARCHIVE/$path/$file" || die "cannot download $path/$file"
+ [ "$(shasum -a 256 "$f.part" | cut -d' ' -f1)" = "$fsum" ] || { rm -f "$f.part"; die "$path/$file: SHA-256 does not match"; }
+ mv "$f.part" "$f"
+ done < "$t/want"
+ echo "$dir"
+ done < "$t/list"
+ rm -rf "$t"
+}
+
# is this package one of the mirrored Raspberry Pi packages? (they go to pool/rpi, arm64 index only)
is_rpi_pkg() { grep -v '^#' "$RPI_LIST" | awk -v n="$1" '$1 == n { f = 1 } END { exit !f }'; }
@@ -202,6 +262,21 @@ do_build() {
echo " $dest"
done
rm -rf "$TREE/incoming"
+ # the sources of the mirrored copyleft packages, next to them and unindexed (append-only too)
+ if [ "$RPI" = 1 ]; then
+ for d in $(rpi_src_import) ; do
+ name=$(basename "$d")
+ dest="pool/rpi/source/$(printf %s "$name" | cut -c1)/$name"
+ mkdir -p "$TREE/$dest"
+ for f in "$d"/*; do
+ if [ -f "$TREE/$dest/${f##*/}" ] && ! cmp -s "$f" "$TREE/$dest/${f##*/}"; then
+ die "$dest/${f##*/} is already published with different contents"
+ fi
+ cp "$f" "$TREE/$dest/"
+ echo " $dest/${f##*/}"
+ done
+ done
+ fi
D=dists/$SUITE
rm -rf "${TREE:?}/dists"
@@ -265,7 +340,13 @@ do_publish() {
check_signatures "$TREE/dists/$SUITE/InRelease" "$TREE/dists/$SUITE/Release" "$TREE/dists/$SUITE/Release.gpg"
# 1. packages (never change once published), 2. indexes, 3. the signed files that point at them
aws s3 sync "$TREE/pool" "s3://$BUCKET/$PREFIX/pool" --cache-control "public, max-age=31536000, immutable" \
- --content-type application/vnd.debian.binary-package --only-show-errors
+ --exclude "rpi/source/*" --content-type application/vnd.debian.binary-package --only-show-errors
+ if [ -d "$TREE/pool/rpi/source" ]; then
+ aws s3 sync "$TREE/pool/rpi/source" "s3://$BUCKET/$PREFIX/pool/rpi/source" --cache-control "public, max-age=31536000, immutable" \
+ --exclude "*" --include "*.dsc" --content-type "text/plain; charset=utf-8" --only-show-errors
+ aws s3 sync "$TREE/pool/rpi/source" "s3://$BUCKET/$PREFIX/pool/rpi/source" --cache-control "public, max-age=31536000, immutable" \
+ --exclude "*.dsc" --content-type application/octet-stream --only-show-errors
+ fi
aws s3 sync "$TREE/dists" "s3://$BUCKET/$PREFIX/dists" --delete --cache-control "no-cache" \
--exclude "*/InRelease" --exclude "*/Release" --exclude "*/Release.gpg" --only-show-errors
for f in Release Release.gpg InRelease; do
@@ -314,6 +395,6 @@ case "$cmd" in
build) do_build "$@" ;;
publish) do_publish ;;
verify) do_verify ;;
- rpi-fetch) rpi_import ;; # only fetch and verify the pinned Raspberry Pi packages (prints their paths)
+ rpi-fetch) rpi_import; rpi_src_import ;; # only fetch and verify the pinned Raspberry Pi packages and sources
*) usage ;;
esac
diff --git a/tools/release/rpi-mirror.list b/tools/release/rpi-mirror.list
index bf62de2..22abdf7 100644
--- a/tools/release/rpi-mirror.list
+++ b/tools/release/rpi-mirror.list
@@ -6,6 +6,10 @@
# fingerprint CF8A 1AF5 02A2 AA2D 763B AE7E 82B1 2992 7FA3 303E). A new upstream version is a new
# line here (the old one may stay: the pool only grows), reviewed like any other change.
#
+# Architecture "source" pins a source package by the SHA-256 of its .dsc: the .dsc and the files it
+# lists (checked against Raspberry Pi's signed Sources index) go to pool/rpi/source/, unindexed, so the
+# source of every copyleft package we mirror (MPL-2.0 kms++) is offered next to its binaries.
+#
# package version arch sha256 (of the .deb) licence (debian/copyright)
rpi-eeprom 28.34-1 all 7c0be1a22e9fb6e947a3f438faa588222453ad1cf1b1c985d747a49187aa2a1f scripts BSD-3; bootloader images: Raspberry Pi licence (unmodified binaries, for Raspberry Pi devices)
raspi-utils 20260626-1 all 2bdb73a551a1a3c155303d1b3486ae8ed1858729e4b1b85f791ae987e1d278b6 BSD-3-Clause
@@ -18,3 +22,4 @@ libgpiolib0 20260626-1 arm64 594956f65e16d1fcbfd7b76
libdtovl0 20260626-1 arm64 4b81f914be83ca68cba2da4d8d4d70bdfe3ee9b3006b7e049e86c46d29968225 BSD-3-Clause
kms++-utils 0~git20250807.1813ada-1 arm64 a4c2cfe1d6e9458d43c508344c2516b672033135d373392a646a3084fbcc7f11 MPL-2.0 (source: archive.raspberrypi.com deb-src kms++)
libkms++0 0~git20250807.1813ada-1 arm64 1a22a36750d8133c1f30868c18c22ab3d5ac526f4183bfb050a34ee1c46da8db MPL-2.0 (source: archive.raspberrypi.com deb-src kms++)
+kms++ 0~git20250807.1813ada-1 source a450a5140a582b7d6c720af2b131b589f9a30064aa8529927b3feba69e028413 MPL-2.0 (the source of kms++-utils and libkms++0 above)