Update stage0-posix, help2man fix, refactor
- stage0-posix update to correctly exist on fail. - help2man reproducibility fix for month. - refactor some bits into functions.
This commit is contained in:
parent
f76fb8259b
commit
7366647595
|
@ -17,6 +17,7 @@ bindir=${prefix}/bin
|
|||
libdir=${prefix}/lib
|
||||
incdir=${prefix}/include
|
||||
tmpdir=/tmp # tmpdir is needed for patch to work
|
||||
TMPDIR=/tmp
|
||||
|
||||
# Environmental variables needed for mes
|
||||
NYACC_PKG=nyacc-1.00.2
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
SPDX-FileCopyrightText: 2022 fosslinux <fosslinux@aussies.space>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
help2man manpages hardcode the current month and date into the generated
|
||||
manpage.
|
||||
|
||||
This makes manpages not reproducible.
|
||||
|
||||
diff --color -ru help2man.PL help2man.PL
|
||||
--- help2man.PL 2022-04-02 10:20:20.100234930 +1100
|
||||
+++ help2man.PL 2022-04-02 10:20:21.866247540 +1100
|
||||
@@ -303,7 +303,7 @@
|
||||
$_, $ARGV[0]
|
||||
} $help_option, $version_option;
|
||||
|
||||
-my $date = strftime "%B %Y", localtime;
|
||||
+my $date = "";
|
||||
(my $program = $ARGV[0]) =~ s!.*/!!;
|
||||
my $package = $program;
|
||||
my $version;
|
11
sysa/run.sh
11
sysa/run.sh
|
@ -92,12 +92,6 @@ fi
|
|||
|
||||
echo "Thank you! All done."
|
||||
|
||||
# Clear up some RAM space
|
||||
grep '^pkg=' /after.kaem | sed 's/pkg="//' | sed 's/=$//' | while read -r p ; do
|
||||
rm -rf "${SOURCES:?}/${p:?}"
|
||||
done
|
||||
rm -rf "${SOURCES}/mes"
|
||||
|
||||
# Write to bootstrap.cfg
|
||||
rm "${SOURCES}/bootstrap.cfg"
|
||||
for var in CHROOT FORCE_TIMESTAMPS DISK ARCH; do
|
||||
|
@ -241,6 +235,11 @@ build kbd-1.15
|
|||
build make-3.82
|
||||
|
||||
# Clear up some RAM space
|
||||
grep '^pkg=' /after.kaem | sed 's/pkg="//' | sed 's/"$//' | while read -r p ; do
|
||||
rm -rf "${SOURCES:?}/${p:?}"
|
||||
done
|
||||
rm -rf "${SOURCES}/mes"
|
||||
|
||||
grep '^build' "${SOURCES}/run.sh" | sed "s/build //" | sed "s/ .*$//" | while read -r p ; do
|
||||
rm -rf "${SOURCES:?}/${p:?}"
|
||||
done
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 649b6a555822d83a4cdc8a6d41dc8d9f34a0dec1
|
||||
Subproject commit 74f1e36f35c28d7854eddfde963917c404764ede
|
|
@ -34,7 +34,7 @@ src_configure() {
|
|||
PKG_CONFIG_PATH="${PREFIX}/lib/musl/pkgconfig" ./configure \
|
||||
--prefix="${PREFIX}" \
|
||||
--libdir="${PREFIX}/lib/musl" \
|
||||
--build=i386-unknown-linux-musl \
|
||||
--build=i386-unknown-linux-musl \
|
||||
--disable-shared \
|
||||
--disable-jit
|
||||
}
|
||||
|
|
|
@ -27,16 +27,16 @@ e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 autoconf-2.61_
|
|||
48032a5174c2d346f43f43e00e82610cda23ca868c1202f001e241033d15a206 autoconf-2.64_0.links
|
||||
a13a7569b9b9a050b0278c066ec86e7d65966af27e3808a4da7ae4934e73421c autoconf-2.64_0.tar.gz
|
||||
6c73d920d88a96d1f971f98afe04dbc456522383777a42bb758f765630019f26 autoconf-2.69_0.links
|
||||
0ee2fad2079801d00720707f43848d2da7a8f825316f5a705d54497486f4f989 autoconf-2.69_0.tar.gz
|
||||
2dbbb16b7c723c7dd4dba772a1e03a4d6f15faf17eb7c2e1854a28e2fb747a6a autoconf-2.69_0.tar.gz
|
||||
d713ac1840e82250414ee4f7cd75c79ee44ecb4e8dfc659704eed3d75e7d348c autoconf-2.71_0.x86.xbps
|
||||
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 autoconf-archive-2021.02.19_0.links
|
||||
3f6c27d6743f926c9b08cccd921c3d6179105c681dd5aa9ab362895c71c106c9 autoconf-archive-2021.02.19_0.tar.gz
|
||||
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 automake-1.10.3_0.links
|
||||
e59fa265f406bae304def01402e2320275a26df24c7160602e7d29afe607c31c automake-1.10.3_0.tar.gz
|
||||
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 automake-1.11.2_0.links
|
||||
59852e998868383fc1708b1d9494c6a2b29cabf8d0718070421885291066a02f automake-1.11.2_0.tar.gz
|
||||
8d367d6144ead0aa37e561f62a9873c5019adcba3973c9fe44772c0774a04997 automake-1.11.2_0.tar.gz
|
||||
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 automake-1.15.1_0.links
|
||||
14276d441c54ae77bb5365bac03730a85c01a701ea92da3d5c6fc31c54be2c3a automake-1.15.1_0.tar.gz
|
||||
e09245752b6c221c0127ba9dc4cc10db0e62d9301fd79766ae09103c356655ca automake-1.15.1_0.tar.gz
|
||||
708d854632c90e3706194a1a7555a3dc2fafb7ccae65872ad3420083f2781143 automake-1.16.3_0.x86.xbps
|
||||
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 automake-1.4-p6_0.links
|
||||
2e603260980ec9d6f0cd560e02350a002575bb6fb2279229430c57d45cb29f86 automake-1.4-p6_0.tar.gz
|
||||
|
@ -71,7 +71,7 @@ e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 bison-3.4.1_1.
|
|||
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 bison-3.4.1_2.links
|
||||
d0a309628ecc5a9f331a8e4275412689b1c27509f7ebf255a8df2324a591381c bison-3.4.1_2.tar.gz
|
||||
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 bison-3.4.2_0.links
|
||||
49164d8663e149da80511684d2fb8d4ae9f6d7ab6f96c6ed85f6e98fefef1ad5 bison-3.4.2_0.tar.gz
|
||||
6bf1432ff37e582d5a6d5b4195adeaa2bdf181b9bf976996c45a8ed39ff2546a bison-3.4.2_0.tar.gz
|
||||
07fee627dcf30aaa9beab40ffeacc3bec7afe3488d2fbc7e8a72ae782a85869a bzip2-1.0.8_0.links
|
||||
02c4d6e6a01c911593eb20bdbc72761cdc977ff48c3ca3b46af4255083cd2679 bzip2-1.0.8_0.tar.gz
|
||||
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 coreutils-5.0_0.links
|
||||
|
|
|
@ -36,8 +36,11 @@ get_links() {
|
|||
# Reset all timestamps to unix time 0
|
||||
reset_timestamp() {
|
||||
args=
|
||||
if touch --help | grep ' \-h' >/dev/null; then
|
||||
args="-h"
|
||||
# touch -h is not avaliable until after grep is built.
|
||||
if command -v grep >/dev/null 2>&1; then
|
||||
if touch --help | grep ' \-h' >/dev/null; then
|
||||
args="-h"
|
||||
fi
|
||||
fi
|
||||
if command -v find >/dev/null 2>&1; then
|
||||
# find does not error out on exec error
|
||||
|
@ -63,15 +66,19 @@ reset_timestamp() {
|
|||
}
|
||||
|
||||
# Fake grep
|
||||
fake_grep() {
|
||||
_grep() {
|
||||
text="${1}"
|
||||
fname="${2}"
|
||||
# shellcheck disable=SC2162
|
||||
while read line; do
|
||||
case "${line}" in *"${text}"*)
|
||||
echo "${line}" ;;
|
||||
esac
|
||||
done < "${fname}"
|
||||
if command -v grep >/dev/null 2>&1; then
|
||||
grep "${text}" "${fname}"
|
||||
else
|
||||
# shellcheck disable=SC2162
|
||||
while read line; do
|
||||
case "${line}" in *"${text}"*)
|
||||
echo "${line}" ;;
|
||||
esac
|
||||
done < "${fname}"
|
||||
fi
|
||||
}
|
||||
|
||||
# Common build steps
|
||||
|
@ -139,46 +146,13 @@ build() {
|
|||
fi
|
||||
|
||||
echo "${pkg}: creating package."
|
||||
cd "${DESTDIR}"
|
||||
src_pkg
|
||||
# Various shenanigans must be implemented for repoducibility
|
||||
# as a result of timestamps
|
||||
cd "${DESTDIR}"
|
||||
touch -t 197001010000.00 .
|
||||
reset_timestamp
|
||||
cd /usr/src/repo
|
||||
if command -v xbps-create >/dev/null 2>&1; then
|
||||
xbps-create -A "${ARCH}" -n "${pkg}_${revision}" -s "${pkg}" --compression xz "${DESTDIR}"
|
||||
else
|
||||
# All symlinks are dereferenced, which is BAD
|
||||
cd "${DESTDIR}"
|
||||
get_links > "/usr/src/repo/${pkg}_${revision}.links"
|
||||
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
|
||||
touch -t 197001010000.00 "${pkg}_${revision}.tar"
|
||||
gzip "${pkg}_${revision}.tar"
|
||||
fi
|
||||
|
||||
echo "${pkg}: checksumming created package."
|
||||
if command -v grep >/dev/null 2>&1; then
|
||||
grep "${pkg}_${revision}" "${SOURCES}/SHA256SUMS.pkgs" | sha256sum -c
|
||||
else
|
||||
fake_grep "${pkg}_${revision}" "${SOURCES}/SHA256SUMS.pkgs" | sha256sum -c
|
||||
fi
|
||||
|
||||
if command -v xbps-rindex >/dev/null 2>&1; then
|
||||
echo "${pkg}: adding package to repository."
|
||||
xbps-rindex --compression xz -a "/usr/src/repo/${pkg}_${revision}.${ARCH}.xbps"
|
||||
fi
|
||||
_grep "${pkg}_${revision}" "${SOURCES}/SHA256SUMS.pkgs" | sha256sum -c
|
||||
|
||||
echo "${pkg}: cleaning up."
|
||||
rm -rf "${SOURCES}/${pkg}/build"
|
||||
|
@ -186,28 +160,7 @@ build() {
|
|||
mkdir -p /tmp/destdir/
|
||||
|
||||
echo "${pkg}: installing package."
|
||||
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
|
||||
# shellcheck disable=SC2162
|
||||
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
|
||||
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
|
||||
src_apply
|
||||
|
||||
echo "${pkg}: build successful"
|
||||
|
||||
|
@ -283,6 +236,69 @@ default_src_install() {
|
|||
make -f Makefile install PREFIX="${PREFIX}" DESTDIR="${DESTDIR}"
|
||||
}
|
||||
|
||||
create_tarball_pkg() {
|
||||
# If grep is unavaliable, then tar --sort is unavaliable.
|
||||
# So this does not need a command -v grep.
|
||||
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
|
||||
touch -t 197001010000.00 "${pkg}_${revision}.tar"
|
||||
gzip "${pkg}_${revision}.tar"
|
||||
}
|
||||
|
||||
src_pkg() {
|
||||
touch -t 197001010000.00 .
|
||||
reset_timestamp
|
||||
if command -v xbps-create >/dev/null 2>&1; then
|
||||
cd /usr/src/repo
|
||||
xbps-create -A "${ARCH}" -n "${pkg}_${revision}" -s "${pkg}" --compression xz "${DESTDIR}"
|
||||
echo "${pkg}: adding package to repository."
|
||||
xbps-rindex --compression xz -a "/usr/src/repo/${pkg}_${revision}.${ARCH}.xbps"
|
||||
else
|
||||
cd "${DESTDIR}"
|
||||
# All symlinks are dereferenced, which is BAD
|
||||
get_links > "/usr/src/repo/${pkg}_${revision}.links"
|
||||
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
|
||||
create_tarball_pkg
|
||||
fi
|
||||
}
|
||||
|
||||
src_apply() {
|
||||
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
|
||||
# shellcheck disable=SC2162
|
||||
if [ -e /tmp/filelist.txt ]; then
|
||||
while IFS= read -d $'\0' file; do
|
||||
rm -f "/${file}" >/dev/null 2>&1 || true
|
||||
done < /tmp/filelist.txt
|
||||
fi
|
||||
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
|
||||
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
|
||||
}
|
||||
|
||||
# Check if bash function exists
|
||||
fn_exists() {
|
||||
test "$(type -t "$1")" == 'function'
|
||||
|
|
Loading…
Reference in New Issue