Control: tags 970130 patch

On 2020-09-12, Chris Lamb wrote:
> I think there are problems with the construction of
> /usr/src/bluez.tar.bz2 in the bluez-source package:
>
>   $ tar xfj usr/src/bluez.tar.bz2
>   $ tree -d
>   .
>   ├── bluez-source-tmp <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>   │   ├── android
...
>   │   ├── tools
>   │   │   ├── mesh
>   │   │   ├── mesh-gatt
>   │   │   └── parser
>   │   └── unit
>   ..
>
> In addition, this file is not reproducible as it varies on the build
> umask, and it also contains symlinks back to the original build tree,
> but this might all be a symptom of a larger problem.

Attached are several patches fixing these and related reproducibility
issues.

The first three I'm fairly confident about.

I'm not 100% sure about the last patch "Exclude autogenerated files ..."
The patch removes autogenerated files which contain paths unlikely to be
present on the end-user's system, so I presume anything relying on
bluez-source will re-run the appropriate autotools and/or libtool
commands.


live well,
  vagrant
From 26348953a91b70bbe16f86a77051d81eca20fa7d Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagr...@reproducible-builds.org>
Date: Thu, 24 Sep 2020 21:54:19 +0000
Subject: [PATCH 1/4] Add patch to use relative symlinks for the
 lib/bluetooth/*.h headers.

Using the absolute build path only works during the build; the
symlinks are included in the tarball, which results in broken symlinks
in the tarball included in the bluez-source package.
---
 .../headers-use-releative-symlinks.patch      | 21 +++++++++++++++++++
 debian/patches/series                         |  1 +
 2 files changed, 22 insertions(+)
 create mode 100644 debian/patches/headers-use-releative-symlinks.patch

diff --git a/debian/patches/headers-use-releative-symlinks.patch b/debian/patches/headers-use-releative-symlinks.patch
new file mode 100644
index 000000000..c40488d6b
--- /dev/null
+++ b/debian/patches/headers-use-releative-symlinks.patch
@@ -0,0 +1,21 @@
+From: vagr...@reproducible-builds.org
+Subject: Use relative symlinks when linking to headers.
+Date: 2020-09-24
+
+Using the absolute build path only works during the build; the
+symlinks are included in the tarball, which results in broken symlinks
+in the tarball included in the bluez-source package.
+
+Index: bluez/Makefile.am
+===================================================================
+--- bluez.orig/Makefile.am
++++ bluez/Makefile.am
+@@ -612,7 +612,7 @@ $(lib_libbluetooth_la_OBJECTS): $(local_
+ 
+ lib/bluetooth/%.h: lib/%.h
+ 	$(AM_V_at)$(MKDIR_P) lib/bluetooth
+-	$(AM_V_GEN)$(LN_S) -f $(abspath $<) $@
++	$(AM_V_GEN)$(LN_S) -f ../$(shell basename $@) $@
+ 
+ ell/internal: Makefile
+ 	$(AM_V_at)$(MKDIR_P) ell
diff --git a/debian/patches/series b/debian/patches/series
index d4709adf3..effeb7fe2 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -9,3 +9,4 @@ org.bluez.obex.service.in.patch
 Fix-typo.patch
 shared-gatt-client-Fix-segfault-after-PIN-entry.patch
 main.conf-Add-more-details-Closes-904212.patch
+headers-use-releative-symlinks.patch
-- 
2.28.0

From 51c21eda7871ab4434ae3c827bdd906843069520 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagr...@reproducible-builds.org>
Date: Thu, 24 Sep 2020 21:55:51 +0000
Subject: [PATCH 2/4] debian/rules: Unpack source tarball in
 debian/tmp-source/bluez-source, to avoid "tmp-" ending up in the tarball.

---
 debian/rules | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/rules b/debian/rules
index ca4d04a33..a00250ff0 100755
--- a/debian/rules
+++ b/debian/rules
@@ -70,7 +70,7 @@ override_dh_fixperms-indep:
 	chmod 0644 debian/bluez-test-scripts/usr/share/doc/bluez-test-scripts/examples/*
 
 override_dh_auto_install-indep: build_bluez-source
-BUILDDIRSOURCE := $(shell pwd)/debian/bluez-source-tmp
+BUILDDIRSOURCE := $(shell pwd)/debian/tmp-source/bluez-source
 build_bluez-source:
 	install -d debian/bluez-source/usr/src
 	mkdir -p $(BUILDDIRSOURCE)
-- 
2.28.0

From 08bf9e0419aef57c6af1e19da4eea52ee3122072 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagr...@reproducible-builds.org>
Date: Thu, 24 Sep 2020 21:58:06 +0000
Subject: [PATCH 3/4] debian/rules: Pass arguments to tar to ensure consistant
 sort order, timestamps, uid, gid and umask when generating bluez-source
 tarball.

---
 debian/rules | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/debian/rules b/debian/rules
index a00250ff0..26f26abb4 100755
--- a/debian/rules
+++ b/debian/rules
@@ -76,5 +76,9 @@ build_bluez-source:
 	mkdir -p $(BUILDDIRSOURCE)
 	tar --exclude debian --exclude .git --exclude .pc -cf - . | (cd $(BUILDDIRSOURCE) && tar -xf -)
 	cd $(dir $(BUILDDIRSOURCE)) \
-		&& tar -cjf $(shell pwd)/debian/bluez-source/usr/src/bluez.tar.bz2 \
+		&& tar --sort=name \
+			--mtime="@${SOURCE_DATE_EPOCH}" \
+			--owner=0 --group=0 --numeric-owner \
+			--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
+			-cjf $(shell pwd)/debian/bluez-source/usr/src/bluez.tar.bz2 \
 		$(notdir $(BUILDDIRSOURCE))
-- 
2.28.0

From 3d61269fe92a3d15c8ff9fa2159887c16ad6b470 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagr...@reproducible-builds.org>
Date: Thu, 24 Sep 2020 22:01:19 +0000
Subject: [PATCH 4/4] debian/rules: Exclude autogenerated files from
 bluez-source tarball.

---
 debian/rules | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/debian/rules b/debian/rules
index 26f26abb4..868c733c9 100755
--- a/debian/rules
+++ b/debian/rules
@@ -74,7 +74,13 @@ BUILDDIRSOURCE := $(shell pwd)/debian/tmp-source/bluez-source
 build_bluez-source:
 	install -d debian/bluez-source/usr/src
 	mkdir -p $(BUILDDIRSOURCE)
-	tar --exclude debian --exclude .git --exclude .pc -cf - . | (cd $(BUILDDIRSOURCE) && tar -xf -)
+	tar --exclude debian --exclude .git --exclude .pc \
+		--exclude autom4te.cache \
+		--exclude config.log \
+		--exclude config.status \
+		--exclude Makefile \
+		--exclude libtool \
+		-cf - . | (cd $(BUILDDIRSOURCE) && tar -xf -)
 	cd $(dir $(BUILDDIRSOURCE)) \
 		&& tar --sort=name \
 			--mtime="@${SOURCE_DATE_EPOCH}" \
-- 
2.28.0

Attachment: signature.asc
Description: PGP signature

Reply via email to