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
This commit is contained in:
fosslinux 2022-02-10 21:55:06 +11:00
parent a343dcf6ed
commit 931490551a
15 changed files with 71 additions and 32 deletions

View File

@ -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"
}

View File

@ -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() {

View File

@ -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() {

View File

@ -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 \

View File

@ -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=''

View File

@ -14,6 +14,7 @@ set -e
export PREFIX=/usr
export SOURCES=/after
export DESTDIR="/tmp/destdir"
create_sysb() {
# Copy everything in

View File

@ -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

View File

@ -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"
}

View File

@ -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"
}

View File

@ -2,7 +2,6 @@
#
# SPDX-License-Identifier: GPL-3.0-or-later
checksum=708d854632c90e3706194a1a7555a3dc2fafb7ccae65872ad3420083f2781143
src_prepare() {
./bootstrap

View File

@ -4,7 +4,6 @@
# SPDX-License-Identifier: GPL-3.0-or-later
checksum=3960567fc3f358d85b58a6441d3fb97442821a6d51847df72109eec547617b0b
src_prepare() {
default

View File

@ -45,4 +45,7 @@ src_install() {
rm -rf "${PREFIX}"/lib/perl5/
default
# Remove messed up manpages
rm -r "${DESTDIR}/"*.0
}

View File

@ -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

View File

@ -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.'

View File

@ -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