From 931490551a5956e4e6ede3544aa0d1a51521aeb9 Mon Sep 17 00:00:00 2001 From: fosslinux Date: Thu, 10 Feb 2022 21:55:06 +1100 Subject: [PATCH] Fix a variety of reproducibility issues Include: - Not regenerated man pages. - Automake tarball with bad time (and completely useless). - Ordering of files within tarballs. - Resetting timestamp various fixes. - Older tars not properly overwriting files leading to many issues. - Weird lack of reproducibility in libtool scripts paths to tools. - and more --- sysa/automake-1.10.3/automake-1.10.3.sh | 1 + sysa/gcc-4.0.4/pass1.sh | 3 ++ sysa/gcc-4.0.4/pass2.sh | 3 ++ sysa/libtool-2.2.4/libtool-2.2.4.sh | 11 ++++- sysa/perl-5.6.2/files/config.sh | 2 +- sysa/run.sh | 1 + sysc/autoconf-2.69/autoconf-2.69.sh | 2 +- sysc/automake-1.11.2/automake-1.11.2.sh | 1 + sysc/automake-1.15.1/automake-1.15.1.sh | 1 + sysc/automake-1.16.3/automake-1.16.3.sh | 1 - sysc/gcc-4.7.4/gcc-4.7.4.sh | 1 - sysc/perl-5.32.1/perl-5.32.1.sh | 3 ++ sysc/run.sh | 3 +- sysc/run2.sh | 4 +- sysglobal/helpers.sh | 66 +++++++++++++++---------- 15 files changed, 71 insertions(+), 32 deletions(-) diff --git a/sysa/automake-1.10.3/automake-1.10.3.sh b/sysa/automake-1.10.3/automake-1.10.3.sh index 14112c9..85f8a25 100755 --- a/sysa/automake-1.10.3/automake-1.10.3.sh +++ b/sysa/automake-1.10.3/automake-1.10.3.sh @@ -20,4 +20,5 @@ src_compile() { src_install() { make install MAKEINFO=true DESTDIR="${DESTDIR}" + rm "${DESTDIR}${PREFIX}/share/doc/automake/amhello-1.0.tar.gz" } diff --git a/sysa/gcc-4.0.4/pass1.sh b/sysa/gcc-4.0.4/pass1.sh index ffc8940..cc06192 100755 --- a/sysa/gcc-4.0.4/pass1.sh +++ b/sysa/gcc-4.0.4/pass1.sh @@ -57,6 +57,9 @@ src_prepare() { # Pre-built texinfo files find . -name '*.info' -delete + + # Pre-built man files + rm gcc/doc/*.1 gcc/doc/*.7 } src_configure() { diff --git a/sysa/gcc-4.0.4/pass2.sh b/sysa/gcc-4.0.4/pass2.sh index 3f2593e..9634d38 100755 --- a/sysa/gcc-4.0.4/pass2.sh +++ b/sysa/gcc-4.0.4/pass2.sh @@ -59,6 +59,9 @@ src_prepare() { # Pre-built texinfo files find . -name '*.info' -delete + + # Pre-built man files + rm gcc/doc/*.1 gcc/doc/*.7 } src_configure() { diff --git a/sysa/libtool-2.2.4/libtool-2.2.4.sh b/sysa/libtool-2.2.4/libtool-2.2.4.sh index 164a2c5..8403e89 100755 --- a/sysa/libtool-2.2.4/libtool-2.2.4.sh +++ b/sysa/libtool-2.2.4/libtool-2.2.4.sh @@ -5,11 +5,20 @@ checksum=7e6a1082a4785a7b58928865a40ed2c93940af54972a2dc30ff10185da97b491 src_prepare() { + rm libltdl/config/ltmain.sh + + rm doc/*.info + ./bootstrap } src_configure() { - CC=tcc ./configure \ + CC=tcc \ + EGREP="/usr/bin/grep -E" \ + FGREP="/usr/bin/grep -F" \ + GREP="/usr/bin/grep" \ + SED="/usr/bin/sed" \ + ./configure \ --prefix="${PREFIX}" \ --libdir="${PREFIX}/lib/musl" \ --disable-shared \ diff --git a/sysa/perl-5.6.2/files/config.sh b/sysa/perl-5.6.2/files/config.sh index 5e50a13..4d467eb 100644 --- a/sysa/perl-5.6.2/files/config.sh +++ b/sysa/perl-5.6.2/files/config.sh @@ -5,7 +5,7 @@ ar='tcc -ar' cc='tcc' ldlibpthname='LD_LIBRARY_PATH' -libpth='/image/lib/musl' +libpth='/usr/lib/musl' path_sep=':' archname='' osvers='' diff --git a/sysa/run.sh b/sysa/run.sh index 0af3827..a32edfe 100755 --- a/sysa/run.sh +++ b/sysa/run.sh @@ -14,6 +14,7 @@ set -e export PREFIX=/usr export SOURCES=/after +export DESTDIR="/tmp/destdir" create_sysb() { # Copy everything in diff --git a/sysc/autoconf-2.69/autoconf-2.69.sh b/sysc/autoconf-2.69/autoconf-2.69.sh index 98449fd..0803661 100755 --- a/sysc/autoconf-2.69/autoconf-2.69.sh +++ b/sysc/autoconf-2.69/autoconf-2.69.sh @@ -3,7 +3,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later src_prepare() { - rm doc/standards.info + rm doc/standards.info man/*.1 autoreconf-2.64 -f # Install autoconf data files into versioned directory diff --git a/sysc/automake-1.11.2/automake-1.11.2.sh b/sysc/automake-1.11.2/automake-1.11.2.sh index 5bcb365..b55976a 100755 --- a/sysc/automake-1.11.2/automake-1.11.2.sh +++ b/sysc/automake-1.11.2/automake-1.11.2.sh @@ -20,4 +20,5 @@ src_compile() { src_install() { make install MAKEINFO=true DESTDIR="${DESTDIR}" + rm "${DESTDIR}${PREFIX}/share/doc/automake/amhello-1.0.tar.gz" } diff --git a/sysc/automake-1.15.1/automake-1.15.1.sh b/sysc/automake-1.15.1/automake-1.15.1.sh index 97e52d1..5b48a14 100755 --- a/sysc/automake-1.15.1/automake-1.15.1.sh +++ b/sysc/automake-1.15.1/automake-1.15.1.sh @@ -22,4 +22,5 @@ src_compile() { src_install() { make install MAKEINFO=true DESTDIR="${DESTDIR}" + rm "${DESTDIR}${PREFIX}/share/doc/automake/amhello-1.0.tar.gz" } diff --git a/sysc/automake-1.16.3/automake-1.16.3.sh b/sysc/automake-1.16.3/automake-1.16.3.sh index 2992cbe..143cb6d 100755 --- a/sysc/automake-1.16.3/automake-1.16.3.sh +++ b/sysc/automake-1.16.3/automake-1.16.3.sh @@ -2,7 +2,6 @@ # # SPDX-License-Identifier: GPL-3.0-or-later -checksum=708d854632c90e3706194a1a7555a3dc2fafb7ccae65872ad3420083f2781143 src_prepare() { ./bootstrap diff --git a/sysc/gcc-4.7.4/gcc-4.7.4.sh b/sysc/gcc-4.7.4/gcc-4.7.4.sh index 70fa399..77170e3 100755 --- a/sysc/gcc-4.7.4/gcc-4.7.4.sh +++ b/sysc/gcc-4.7.4/gcc-4.7.4.sh @@ -4,7 +4,6 @@ # SPDX-License-Identifier: GPL-3.0-or-later -checksum=3960567fc3f358d85b58a6441d3fb97442821a6d51847df72109eec547617b0b src_prepare() { default diff --git a/sysc/perl-5.32.1/perl-5.32.1.sh b/sysc/perl-5.32.1/perl-5.32.1.sh index d682122..a73f015 100755 --- a/sysc/perl-5.32.1/perl-5.32.1.sh +++ b/sysc/perl-5.32.1/perl-5.32.1.sh @@ -45,4 +45,7 @@ src_install() { rm -rf "${PREFIX}"/lib/perl5/ default + + # Remove messed up manpages + rm -r "${DESTDIR}/"*.0 } diff --git a/sysc/run.sh b/sysc/run.sh index b13ed71..b3f880f 100755 --- a/sysc/run.sh +++ b/sysc/run.sh @@ -16,6 +16,7 @@ set -e export PATH=/usr/bin:/usr/sbin export PREFIX=/usr export SOURCES=/usr/src +export DESTDIR=/tmp/destdir create_fhs() { # Add the rest of the FHS that we will use and is not created pre-boot @@ -39,4 +40,4 @@ create_fhs build bash-5.1 -exec env -i PATH=${PATH} PREFIX=${PREFIX} SOURCES=${SOURCES} bash run2.sh +exec env -i PATH=${PATH} PREFIX=${PREFIX} SOURCES=${SOURCES} DESTDIR=${DESTDIR} bash run2.sh diff --git a/sysc/run2.sh b/sysc/run2.sh index d930c8d..d22faed 100755 --- a/sysc/run2.sh +++ b/sysc/run2.sh @@ -56,6 +56,8 @@ build perl-5.32.1 build libarchive-3.5.2 +false + build openssl-1.1.1l build zlib-1.2.11 @@ -85,7 +87,7 @@ build libatomic_ops-7.6.10 build gc-8.0.4 -build guile-3.0.7 +#build guile-3.0.7 if [ "$FORCE_TIMESTAMPS" = True ] ; then echo 'Forcing all files timestamps to be 0 unix time.' diff --git a/sysglobal/helpers.sh b/sysglobal/helpers.sh index d483094..b4b05c8 100755 --- a/sysglobal/helpers.sh +++ b/sysglobal/helpers.sh @@ -35,25 +35,30 @@ get_links() { # Reset all timestamps to unix time 0 reset_timestamp() { - fs= - if [ -n "$(ls)" ]; then - fs=$(echo *) + args= + if touch --help | grep ' \-h' >/dev/null; then + args="-h" fi - if [ -n "$(ls .[0-z]*)" ]; then - fs="${fs} $(echo .[0-z]*)" + if command -v find 2>&1 >/dev/null; then + find . -exec touch ${args} -t 197001010000.00 "{}" \; + else + # A rudimentary find implementation that does the trick + fs= + if [ -n "$(ls)" ]; then + fs=$(echo *) + fi + if [ -n "$(ls .[0-z]*)" ]; then + fs="${fs} $(echo .[0-z]*)" + fi + for f in ${fs}; do + touch ${args} -t 197001010000.00 "${f}" + if [ -d "${f}" ]; then + cd "${f}" + reset_timestamp + cd .. + fi + done fi - for f in ${fs}; do - args= - if touch --help | grep ' \-h' >/dev/null; then - args="-h" - fi - touch ${args} -t 197001010000.00 "${f}" - if [ -d "${f}" ]; then - cd "${f}" - reset_timestamp - cd .. - fi - done } # Common build steps @@ -77,8 +82,6 @@ build() { mk_dir="${base_dir}/mk" files_dir="${base_dir}/files" - DESTDIR="/tmp/destdir" - mkdir -p "build" cd "build" @@ -135,12 +138,19 @@ build() { # All symlinks are dereferenced, which is BAD cd "${DESTDIR}" get_links > "/usr/src/repo/${pkg}_${revision}.links" - cd /usr/src/repo - args= - if tar --help | grep ' \-\-sort' >/dev/null 2>&1; then - args="--sort=name" + if command -v find >/dev/null 2>&1 && command -v sort >/dev/null 2>&1; then + find -print0 | LC_ALL=C sort -z > /tmp/filelist.txt + fi + cd /usr/src/repo + if tar --help | grep ' \-\-sort' >/dev/null 2>&1; then + tar -C "${DESTDIR}" --sort=name --hard-dereference -cf "/usr/src/repo/${pkg}_${revision}.tar" . + elif command -v find >/dev/null 2>&1 && command -v sort >/dev/null 2>&1; then + cd "${DESTDIR}" + tar --no-recursion --null -T /tmp/filelist.txt -cf "/usr/src/repo/${pkg}_${revision}.tar" + cd - + else + tar -C "${DESTDIR}" -cf "/usr/src/repo/${pkg}_${revision}.tar" . fi - tar -C "${DESTDIR}" ${args} -cf "/usr/src/repo/${pkg}_${revision}.tar" . touch -t 197001010000.00 "${pkg}_${revision}.tar" gzip "${pkg}_${revision}.tar" fi @@ -168,16 +178,22 @@ build() { if command -v xbps-install >/dev/null 2>&1; then xbps-install -y -R /usr/src/repo "${pkg%%-[0-9]*}" else + # Overwriting files is mega busted, so do it manually + while IFS= read -d $'\0' file; do + rm -f "/${file}" >/dev/null 2>&1 || true + done < /tmp/filelist.txt tar -C / -xzpf "/usr/src/repo/${pkg}_${revision}.tar.gz" # shellcheck disable=SC2162 # ^ read -r unsupported in old bash while read line; do # shellcheck disable=SC2001 # ^ cannot use variable expansion here - rm -f "$(echo "${line}" | sed 's/.* //')" + fname="$(echo "${line}" | sed 's/.* //')" + rm -f "${fname}" # shellcheck disable=SC2226,SC2086 # ^ ${line} expands into two arguments ln -s ${line} + touch -t 197001010000.00 "${fname}" done < "/usr/src/repo/${pkg}_${revision}.links" fi