Skip to content

Commit

Permalink
Merge pull request #5001 from jeamland/jeamland/repeatable-dist
Browse files Browse the repository at this point in the history
Replace the mtime of vendored files with the commit timestamp when making a distribution tarball
  • Loading branch information
cgwalters authored Jun 20, 2024
2 parents a172e48 + 04964b0 commit 3f71bb9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packaging/Makefile.dist-packaging
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

GITREV = $$(git describe --always --tags)
GITREV_FOR_PKG = $(shell echo "$(GITREV)" | sed -e 's,-,\.,g' -e 's,^v,,')
GITTIMESTAMP = $$(git show --no-patch --format=%ci)

srcdir=$(shell dirname `pwd`)
PACKAGE=rpm-ostree
Expand All @@ -10,7 +11,7 @@ PKG_VER = $(PACKAGE)-$(GITREV_FOR_PKG)
PKG_CLIENT_VER = $(PACKAGE)-client-$(GITREV_FOR_PKG)

dist-snapshot:
./make-git-snapshot.sh "$(srcdir)" "$(PKG_VER)" "$(GITREV)"
./make-git-snapshot.sh "$(srcdir)" "$(PKG_VER)" "$(GITREV)" "$(GITTIMESTAMP)"
rm -f $(PKG_VER).tar.xz
xz -T0 $(PKG_VER).tar

Expand Down
4 changes: 3 additions & 1 deletion packaging/make-git-snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ PKG_VER=$1
shift
GITREV=$1
shift
GITTIMESTAMP=$1
shift

TARFILE=${PKG_VER}.tar
TARFILE_TMP=$(pwd)/${TARFILE}.tmp
Expand Down Expand Up @@ -49,7 +51,7 @@ fi
mkdir -p .cargo
(cd ${TOP} && ${vendor_cmd} ${tmpd}/vendor | sed -e "s,^directory *=.*,directory = './vendor',") > .cargo/config
cp ${TOP}/Cargo.lock .
tar --owner=0 --group=0 --transform="s,^,${PKG_VER}/," -rf ${TARFILE_TMP} * .cargo/
tar --owner=0 --group=0 --transform="s,^,${PKG_VER}/," --mtime="${GITTIMESTAMP}" -rf ${TARFILE_TMP} * .cargo/
)

mv ${TARFILE_TMP} ${TARFILE}

0 comments on commit 3f71bb9

Please sign in to comment.