Skip to content

Commit 323552c

Browse files
committed
ci(ppa): make orig tarball reproducible across matrix jobs
1 parent a689b8e commit 323552c

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

.github/workflows/ppa-publish.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,13 @@ jobs:
119119
run: |
120120
set -eu
121121
# 3.0 (quilt) source format requires ../rdmatop_<upstream>.orig.tar.gz.
122-
# We synthesise one from the current source tree (which already
123-
# contains vendor/ and .cargo/ — Launchpad's builders need both for
124-
# offline cargo builds). debian/ and VCS metadata are excluded.
122+
# The orig tarball is shared across all matrix series uploads, so it
123+
# MUST be byte-identical regardless of which job builds it first.
124+
# Launchpad rejects re-uploads of the same orig name with different
125+
# SHA. We synthesise it deterministically: stable mtime, sorted
126+
# entries, fixed owner, gzip with no embedded timestamp.
125127
PKG_DIR="rdmatop-${VERSION}"
126128
mkdir -p "/tmp/${PKG_DIR}"
127-
# Anchor with a leading / so excludes apply only at the root
128-
# of the transfer; vendored crates have their own .github/ dirs
129-
# that must remain in the orig tarball or dpkg-source sees them
130-
# as "unexpected upstream changes".
131129
rsync -a \
132130
--exclude='/.git' \
133131
--exclude='/.github' \
@@ -136,9 +134,19 @@ jobs:
136134
--exclude='/target' \
137135
--exclude='/out' \
138136
./ "/tmp/${PKG_DIR}/"
139-
tar -czf "../rdmatop_${VERSION}.orig.tar.gz" -C /tmp "${PKG_DIR}"
137+
# Pin every file's mtime to the tag's commit time so the tarball
138+
# contents are reproducible across matrix jobs.
139+
SOURCE_DATE_EPOCH="$(git -C ./ log -1 --pretty=%ct 2>/dev/null || echo 0)"
140+
export SOURCE_DATE_EPOCH
141+
find "/tmp/${PKG_DIR}" -exec touch -h -d "@${SOURCE_DATE_EPOCH}" {} +
142+
tar --sort=name \
143+
--mtime="@${SOURCE_DATE_EPOCH}" \
144+
--owner=0 --group=0 --numeric-owner \
145+
--format=gnu \
146+
-cf - -C /tmp "${PKG_DIR}" \
147+
| gzip -n -9 > "../rdmatop_${VERSION}.orig.tar.gz"
140148
rm -rf "/tmp/${PKG_DIR}"
141-
ls -la ../rdmatop_*.orig.tar.gz
149+
sha256sum "../rdmatop_${VERSION}.orig.tar.gz"
142150
143151
- name: Strip CI metadata from working tree
144152
run: |

0 commit comments

Comments
 (0)