[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#786615: kfreebsd-10: source tarballs have unreproducible file order



Steven Chamberlain wrote:
> The attached patch will

be attached.
Index: debian/rules
===================================================================
--- debian/rules	(revision 5678)
+++ debian/rules	(working copy)
@@ -95,7 +95,12 @@
 	rm -rf $(ORIG_DIR)
 	svn export --ignore-keywords -r $(svn_revision) $(SVN)/sys $(ORIG_DIR)/sys
 	cd $(ORIG_DIR) && $(CURDIR)/debian/prune.sh
-	tar --numeric-owner --owner 0 --group 0 -cJf ../$(ORIG_TAR) $(ORIG_DIR)
+	# Create tarball with files sorted in a stable order, see
+	# https://wiki.debian.org/ReproducibleBuilds/FileOrderInTarballs
+	find $(ORIG_DIR) -print0 | LC_ALL=C sort -z \
+	 | tar --null --no-recursion --files-from - \
+	    --numeric-owner --owner 0 --group 0 \
+	    -cJf ../$(ORIG_TAR)
 	rm -rf $(ORIG_DIR)
 
 control: clean
@@ -166,7 +171,11 @@
 	chown -R root.src $(SRC_DIR)
 	# Avoid the top-level directory timestamp changing
 	touch $(SRC_DIR) --reference=$(SRC_DIR)/sys
-	tar cfJ $(SOURCE_PACKAGE)/usr/src/$(SRC_TAR) $(SRC_DIR)
+	# Create tarball with files sorted in a stable order, see
+	# https://wiki.debian.org/ReproducibleBuilds/FileOrderInTarballs
+	find $(SRC_DIR) -print0 | LC_ALL=C sort -z \
+	 | tar --null --no-recursion --files-from - \
+	    -cJf $(SOURCE_PACKAGE)/usr/src/$(SRC_TAR)
 
 	touch install-indep-stamp
 

Reply to: