logo

live-bootstrap

Mirror of <https://github.com/fosslinux/live-bootstrap>
commit: ca0e701ee8e0687856775428fde3c702bac03dd4
parent 9179f4bd013fbd323d11d861a0c15f37a94f8c5b
Author: fosslinux <fosslinux@aussies.space>
Date:   Wed, 27 Dec 2023 22:59:11 +0000

Merge pull request #360 from eduardosm/fixes

Avoid deleting sources that will be needed in future builds and fix updating checksums with `--update-checksums`

Diffstat:

Dsteps/improve/clean_ram.sh15---------------
Asteps/improve/clean_sources.sh43+++++++++++++++++++++++++++++++++++++++++++
Asteps/improve/update_checksums.sh7+++++++
Msteps/linux-4.9.10/pass1.sh8--------
Msteps/manifest2++
5 files changed, 52 insertions(+), 23 deletions(-)

diff --git a/steps/improve/clean_ram.sh b/steps/improve/clean_ram.sh @@ -1,15 +0,0 @@ -# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space> -# -# SPDX-License-Identifier: GPL-3.0-or-later - -# Save because linux deletes all distfiles to save space -cp "${DISTFILES}"/musl-1.2.4.tar.gz /tmp -cp "${DISTFILES}"/curl-7.88.1.tar.bz2 /tmp - -# Clear up some RAM space -grep --no-filename '^build' "${SOURCES}"/run*.sh | grep -v musl-1.2.4 | sed "s/build //" | sed "s/ .*$//" | while read -r p ; do - rm -rf "${SOURCES:?}/${p:?}" -done - -mv /tmp/musl-1.2.4.tar.gz "${DISTFILES}" -mv /tmp/curl-7.88.1.tar.bz2 "${DISTFILES}" diff --git a/steps/improve/clean_sources.sh b/steps/improve/clean_sources.sh @@ -0,0 +1,43 @@ +# SPDX-FileCopyrightText: 2023 Eduardo Sánchez Muñoz <eduardosm-dev@e64.io> +# +# SPDX-License-Identifier: GPL-3.0-or-later + +# Delete sources of packages before linux kernel + +get_source_filename() { + local url="${1}" + local fname="${3}" + # Default to basename of url if not given + echo "${fname:-$(basename "${url}")}" +} + +# List all packages from linux kernel onwards +# Ideally, we would use arrays here, but they are not supported by +# the bash version we have at this point. +pkgs="$(awk '/^build:/ { print $2 }' "${SRCDIR}/manifest" | awk '/^linux-[0-9]/,EOF { print $0 }')" + +# Gather source names for all packages in pkgs, which we want to keep +keep_sources="" +for pkg in ${pkgs}; do + while read line; do + keep_sources="${keep_sources} $(get_source_filename ${line})" + done < "${SRCDIR}/${pkg}/sources" +done + +for source in "${DISTFILES}/"*; do + source_name="$(basename "${source}")" + for keep_source in ${keep_sources}; do + if [ "${keep_source}" = "${source_name}" ]; then + # Countinue the outer loop to skip deletion + continue 2 + fi + done + + # Delete this source + rm "${source}" +done + +unset get_source_filename +unset pkgs pkg line +unset keep_sources keep_source +unset source source_name diff --git a/steps/improve/update_checksums.sh b/steps/improve/update_checksums.sh @@ -0,0 +1,7 @@ +# SPDX-FileCopyrightText: 2023 Eduardo Sánchez Muñoz <eduardosm-dev@e64.io> +# +# SPDX-License-Identifier: GPL-3.0-or-later + +pushd /external/repo +sha256sum -- * | tee "${SRCDIR}/SHA256SUMS.pkgs" +popd diff --git a/steps/linux-4.9.10/pass1.sh b/steps/linux-4.9.10/pass1.sh @@ -6,14 +6,6 @@ # XXX: Fix package after builder-hex0 src_unpack() { - # Remove all previous source tarballs - mkdir /tmp/keep - for keep in deblob-4.9 ${pkg}.tar.gz musl-1.2.4.tar.gz curl-7.88.1.tar.bz2; do - mv "${DISTFILES}/${keep}" /tmp/keep - done - rm -r "${DISTFILES}/"* - mv /tmp/keep/* "${DISTFILES}" - mkdir "${pkg}" mv "${DISTFILES}/deblob-4.9" "${pkg}/" default || true # Predictable link errors - not a problem diff --git a/steps/manifest b/steps/manifest @@ -114,6 +114,7 @@ build: bc-1.07.1 define: BUILD_LINUX = ( CHROOT == False || BUILD_KERNELS == True ) build: kexec-linux-1.0.0 ( BUILD_LINUX == True ) build: kexec-tools-2.0.22 ( BUILD_LINUX == True ) +improve: clean_sources build: linux-4.9.10 ( BUILD_LINUX == True ) jump: break ( INTERNAL_CI == pass1 ) jump: linux ( CHROOT == False ) @@ -180,3 +181,4 @@ build: gcc-10.4.0 build: binutils-2.41 build: gcc-13.1.0 improve: null_time ( FORCE_TIMESTAMPS == True ) +improve: update_checksums ( UPDATE_CHECKSUMS == True )