Skip to contentSkip to conversation

bash: Remove .build files for reproducible builds

PATCH Superseded Joshua Watt 2 participants 4 messages Jun 20, 2019 – Jun 21, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bash: Remove .build files for reproducible builds

Bash has an internal "build number" that it tracks and automatically increments ever time a given builds is made from the same sandbox. However, this can make builds non-reproducible in the event that a build directory is reused multiple times.

Remove the .build files after every build if reproducible builds have been requested which will reset the build build number for the next build.

---
 meta/recipes-extended/bash/bash.inc | 8 ++++++++
 1 file changed, 8 insertions(+)
meta/recipes-extended/bash/bash.inc +8 -0
index c91cc8ada8d..e2844dffbad 100644
@@ -39,6 +39,14 @@ RDEPENDS_${PN}-ptest_append_libc-glibc = " \
 
 CACHED_CONFIGUREVARS += "headersdir=${includedir}/${PN}"
 
+do_compile_prepend() {
+    # If reproducible builds are requested, remove any leftover .build files.
+    # This ensures that bash always has the same version number
+    if [ "${BUILD_REPRODUCIBLE_BINARIES}" == "1" ]; then
+        rm -f ${B}/.build
+    fi
+}
+
 do_compile_ptest () {
 	oe_runmake buildtest
 }
Signature · 1 line
2.21.0
#1 lore raw

Is it easier to just always delete those files? Do they serve any useful purpose?

Ross

Quoted 42 lines · Joshua Watt

Bash has an internal "build number" that it tracks and automatically increments ever time a given builds is made from the same sandbox. However, this can make builds non-reproducible in the event that a build directory is reused multiple times.

Remove the .build files after every build if reproducible builds have been requested which will reset the build build number for the next build.

---
 meta/recipes-extended/bash/bash.inc | 8 ++++++++
 1 file changed, 8 insertions(+)
meta/recipes-extended/bash/bash.inc +8 -1
index c91cc8ada8d..e2844dffbad 100644
@@ -39,6 +39,14 @@ RDEPENDS_${PN}-ptest_append_libc-glibc = " \
 
 CACHED_CONFIGUREVARS += "headersdir=${includedir}/${PN}"
 
+do_compile_prepend() {
+    # If reproducible builds are requested, remove any leftover .build files.
+    # This ensures that bash always has the same version number
+    if [ "${BUILD_REPRODUCIBLE_BINARIES}" == "1" ]; then
+        rm -f ${B}/.build
+    fi
+}
+
 do_compile_ptest () {
        oe_runmake buildtest
 }
--

2.21.0

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#2 lore raw
Quoted 3 lines · Ross

Is it easier to just always delete those files? Do they serve any useful purpose?

Probably not for our uses. I'll post a V2 unless someone complains

Quoted 48 lines

Ross

Quoted 10 lines · Joshua Watt

Bash has an internal "build number" that it tracks and automatically increments ever time a given builds is made from the same sandbox. However, this can make builds non-reproducible in the event that a build directory is reused multiple times.

Remove the .build files after every build if reproducible builds have been requested which will reset the build build number for the next build.

Review

Quoted 6 lines
---
 meta/recipes-extended/bash/bash.inc | 8 ++++++++
 1 file changed, 8 insertions(+)
(quoted diff) +0 -0

b/meta/recipes-extended/bash/bash.inc

meta/recipes-extended/bash/bash.inc RDEPENDS_${PN}-ptest_append_libc-glibc = " \ · line 43

Quoted 9 lines

index c91cc8ada8d..e2844dffbad 100644

meta/recipes-extended/bash/bash.inc +2 -0
@@ -39,6 +39,14 @@ RDEPENDS_${PN}-ptest_append_libc-glibc = " \
 
 CACHED_CONFIGUREVARS += "headersdir=${includedir}/${PN}"
 
+do_compile_prepend() {
+    # If reproducible builds are requested, remove any leftover .build

files.

Quoted 17 lines
meta/recipes-extended/bash/bash.inc +6 -1
+    # This ensures that bash always has the same version number
+    if [ "${BUILD_REPRODUCIBLE_BINARIES}" == "1" ]; then
+        rm -f ${B}/.build
+    fi
+}
+
 do_compile_ptest () {
        oe_runmake buildtest
 }
--

2.21.0

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#3 lore raw

PATCH v2 1/1 bash: Remove .build files for reproducible builds

In reply to Joshua Watt

Bash has an internal "build number" that it tracks and automatically increments ever time a given builds is made from the same sandbox. However, this can make builds non-reproducible in the event that a build directory is reused multiple times.

Remove the .build files after every build if reproducible builds have been requested which will reset the build build number for the next build.

---
 meta/recipes-extended/bash/bash.inc | 6 ++++++
 1 file changed, 6 insertions(+)
meta/recipes-extended/bash/bash.inc +6 -0
index c91cc8ada8d..039b8687a24 100644
@@ -39,6 +39,12 @@ RDEPENDS_${PN}-ptest_append_libc-glibc = " \
 
 CACHED_CONFIGUREVARS += "headersdir=${includedir}/${PN}"
 
+do_compile_prepend() {
+    # Remove any leftover .build files. This ensures that bash always has the
+    # same version number and keeps builds reproducible
+    rm -f ${B}/.build
+}
+
 do_compile_ptest () {
 	oe_runmake buildtest
 }
Signature · 1 line
2.21.0