Re: [Reproducible-builds] Bug#834993: oss4: please make the build reproducible

2016-08-21 Thread Reiner Herrmann
On Sun, Aug 21, 2016 at 01:37:47PM +0200, Reiner Herrmann wrote:
> The attached patch fixes several issues:

Sorry, forgot to attach the patch.
diff --git a/debian/control b/debian/control
index be2fd60..ebadea0 100644
--- a/debian/control
+++ b/debian/control
@@ -8,6 +8,7 @@ Uploaders: Sebastien NOEL ,
Benda Xu 
 Build-Depends: cdbs,
debhelper (>= 9),
+   tar (>= 1.28),
dkms [linux-any],
gawk,
libgtk2.0-dev,
diff --git a/debian/create-ma-tree.sh b/debian/create-ma-tree.sh
index 34ae919..1232e00 100644
--- a/debian/create-ma-tree.sh
+++ b/debian/create-ma-tree.sh
@@ -45,7 +45,7 @@ for i in ac97 audio midi midi_stubs mixer osscore remux sndstat uart401 vmix_cor
 	[ -d "$i" ] || continue
 	NAME="`basename $i`"
 	pushd "$i"
-	for j in `ls *.c`; do
+	for j in `LC_ALL=C ls *.c`; do
 		SOURCES="$SOURCES $j"
 		SRCCOUNT=$((SRCCOUNT + 1))
 	done
@@ -90,7 +90,7 @@ for i in kernel/drv/*; do
 	pushd $i
 	SOURCES=""
 	SRCCOUNT=0
-	for j in `ls *.c`; do
+	for j in `LC_ALL=C ls *.c`; do
 		if [ "$j" = "$NAME.c" ]; then
 			mv $j ${NAME}driver.c
 			SOURCES="$SOURCES ${NAME}driver.c"
diff --git a/debian/patches/102_use_system_txt2man.patch b/debian/patches/102_use_system_txt2man.patch
index e790a34..06d2bda 100644
--- a/debian/patches/102_use_system_txt2man.patch
+++ b/debian/patches/102_use_system_txt2man.patch
@@ -1,6 +1,11 @@
 oss-v4.2-build2006-src-gpl/setup/Linux/build.sh.orig	2012-02-18 18:53:51.707280520 +0100
-+++ oss-v4.2-build2006-src-gpl/setup/Linux/build.sh	2012-02-18 18:54:01.955280417 +0100
-@@ -8,7 +8,7 @@
+--- a/setup/Linux/build.sh
 b/setup/Linux/build.sh
+@@ -4,11 +4,11 @@
+ 
+ if gawk '' >/dev/null
+ then
+-   TXT2MAN=$SRCDIR/setup/txt2man
++   TXT2MAN=/usr/bin/txt2man
  else
 echo "No gawk found. Using lesser replacement" >&2
 cc -o txt2man origdir/setup/txt2man.c
diff --git a/debian/patches/reproducible-build.patch b/debian/patches/reproducible-build.patch
new file mode 100644
index 000..b0f6ad9
--- /dev/null
+++ b/debian/patches/reproducible-build.patch
@@ -0,0 +1,11 @@
+--- a/setup/setupdir.sh
 b/setup/setupdir.sh
+@@ -200,7 +200,7 @@
+ 
+ touch .depend
+ 
+-if date -u +%Y%m%d%H%M > build.id.new 2>/dev/null
++if date -u +%Y%m%d%H%M -d "@${SOURCE_DATE_EPOCH:-$(date +%s)}" > build.id.new 2>/dev/null
+ then
+ 	rm -f build.id
+ 	mv build.id.new build.id
diff --git a/debian/patches/series b/debian/patches/series
index e219784..3d89d4d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -19,3 +19,4 @@
 #generic_srccconf.patch (seems completely broken to me)
 501_linux_version.patch
 502_linux_io.patch
+reproducible-build.patch
diff --git a/debian/rules b/debian/rules
index cde4f26..f2981f4 100755
--- a/debian/rules
+++ b/debian/rules
@@ -30,7 +30,7 @@ stamp-build-oss4:
 ifeq ($(DEB_HOST_ARCH_OS),linux)
 	# TODO: rewrite upstream's 'build.sh' from scratch
 	cat `find $(CURDIR)/build-tree/oss-build/kernel/drv -name .devices`| grep -v '^#' \
-	| sort | grep -v '^osscore' | grep -v '^oss_audiocs' | grep -v '^oss_sadasupport' \
+	| LC_ALL=C sort | grep -v '^osscore' | grep -v '^oss_audiocs' | grep -v '^oss_sadasupport' \
 	> $(CURDIR)/build-tree/oss-build/prototype/usr/lib/oss/etc/devices.list
 
 	for n in `cat $(CURDIR)/build-tree/oss-build/prototype/usr/lib/oss/etc/devices.list | cut -f 1 | uniq` ; do \
@@ -57,7 +57,7 @@ build/oss4-source:: stamp-source-oss4
 	cp debian/copyright build-tree/modules/oss4/debian/
 	cp debian/changelog build-tree/modules/oss4/debian/
 	chmod 755 build-tree/modules/oss4/debian/rules
-	cd build-tree/ &&  tar cjf oss4.tar.bz2 modules/
+	cd build-tree/ &&  tar --mtime="@$(SOURCE_DATE_EPOCH)" --sort=name --mode=go=rX,u+rw,a-s -cjf oss4.tar.bz2 modules/
 
 build/oss4-dkms:: stamp-source-oss4
 	sed -e 's#_VERSION_#$(UPSTREAM_VERSION)#' < debian/oss4-dkms.install.in > debian/oss4-dkms.install


signature.asc
Description: PGP signature
___
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

[Reproducible-builds] Bug#834993: oss4: please make the build reproducible

2016-08-21 Thread Reiner Herrmann
Source: oss4
Version: 4.2-build2010-5
Severity: wishlist
Tags: patch upstream
User: reproducible-builds@lists.alioth.debian.org
Usertags: locale timestamps fileordering umask
X-Debbugs-Cc: reproducible-builds@lists.alioth.debian.org

Hi!

While working on the "reproducible builds" effort [1], we have noticed
that oss4 could not be built reproducibly.

The attached patch fixes several issues:
- Use system txt2man in upstream build script (build.sh), which supports
  SOURCE_DATE_EPOCH.
- Use SOURCE_DATE_EPOCH for the generated build-id.
- Sort files in modules tarball, fix permissions and timestamps.
- Fix ordering issues in some other places.

Regards,
 Reiner

[1]: https://wiki.debian.org/ReproducibleBuilds


signature.asc
Description: PGP signature
___
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds