Commit 28b86334 authored by Steven Chamberlain's avatar Steven Chamberlain Committed by Cyril Brulebois
Browse files

New build/util/gen-tarball for reproducibility (Closes: #805321)



Add a new utility build/util/gen-tarball to make reproducible
tarballs, and use it for:
- netboot.tar.gz
- debian-cd_info.tar.gz
- the overall debian-installer-images tar.gz file.

(cherry picked from commit c182491b)

Conflicts:
    debian/changelog

Signed-off-by: default avatarCyril Brulebois <kibi@debian.org>
parent e4154814
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -805,7 +805,7 @@ $(TEMP_MINIISO): $(TEMP_BOOT_SCREENS) arch_miniiso

# various kinds of information, for use on debian-cd isos
$(DEBIAN_CD_INFO): $(TEMP_BOOT_SCREENS) $(TEMP_CD_INFO_DIR)
	(cd $(TEMP_CD_INFO_DIR); tar czf - .) > $@
	gen-tarball $(TEMP_CD_INFO_DIR) $@
	update-manifest $@ $(MANIFEST-DEBIAN_CD_INFO)

# a directory full of files for netbooting
@@ -824,7 +824,7 @@ $(NETBOOT_TAR): $(TEMP_NETBOOT_DIR)
	# Create an version info file.
	echo 'Debian version:  $(DEBIAN_VERSION)' > $(TEMP_NETBOOT_DIR)/version.info
	echo 'Installer build: $(BUILD_DATE)' >> $(TEMP_NETBOOT_DIR)/version.info
	(cd $(TEMP_NETBOOT_DIR); tar czf - .) > $@
	gen-tarball $(TEMP_NETBOOT_DIR) $@
	update-manifest $@ $(MANIFEST-NETBOOT_TAR) $(UDEB_LISTS)

$(TEMP_BOOT_SCREENS): arch_boot_screens

build/util/gen-tarball

0 → 100755
+31 −0
Original line number Diff line number Diff line
#!/bin/sh

# Helper script to generate a tarball from a directory, with
# particular attention to giving reproducible output.
#
# Note: if output_file is not an absolute path, it will be assumed
# relative to the current working directory, not source_directory.

set -e

SOURCE_DIR="$1"
OUTPUT_FILE="$2"

if [ -z "$SOURCE_DIR" ] || [ -z "$OUTPUT_FILE" ]; then
	echo "usage: $0 source_directory output_file"
	exit 1
fi

# Clamp timestamps to be no later than SOURCE_DATE_EPOCH, if defined in
# the environment.  Typically it is the time of the most recent entry in
# debian/changelog
if [ -n "$SOURCE_DATE_EPOCH" ]; then
	# See https://wiki.debian.org/ReproducibleBuilds/TimestampsInTarball
	find "$SOURCE_DIR" -newermt "@$SOURCE_DATE_EPOCH" -print0 | xargs -0r touch --no-dereference --date="@$SOURCE_DATE_EPOCH"
fi

# Create tarball with files sorted in a stable order, see
# https://wiki.debian.org/ReproducibleBuilds/FileOrderInTarballs
# and without timestamp in the gzip header, see
# https://wiki.debian.org/ReproducibleBuilds/TimestampsInGzipHeaders
( cd "$SOURCE_DIR" && find . -print0 | LC_ALL=C sort -z | GZIP=-n tar --no-recursion --null -T - -czvf -) > "$OUTPUT_FILE"
+13 −0
Original line number Diff line number Diff line
@@ -14,6 +14,19 @@ debian-installer (20151024) UNRELEASED; urgency=medium
  [ Vagrant Cascadian ]
  * bootscr.mainline_common: Prefer newer u-boot distro_bootpart variable.

  [ Cyril Brulebois ]
  * Cherry-pick the following changes by Steven Chamberlain from the
    jessie-kfreebsd branch.

  [ Steven Chamberlain ]
  * Improve reproducibility of debian-installer netboot images
    (Closes: #805321):
  * Add a new utility build/util/gen-tarball to make reproducible
    tarballs, and use it for:
    - netboot.tar.gz
    - debian-cd_info.tar.gz
    - the overall debian-installer-images tar.gz file.

 -- Karsten Merker <karsten@eirene>  Wed, 28 Oct 2015 23:10:45 +0100

debian-installer (20151023) unstable; urgency=medium
+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ binary-arch: install
	dh_gencontrol
	dh_md5sums
	dh_builddeb
	cd debian/tmp && tar czvf ../../../$(TARNAME) .
	./build/util/gen-tarball debian/tmp ../$(TARNAME)
	dpkg-distaddfile $(TARNAME) raw-installer -

binary-indep: