From 06ec1bec5322256a25d00a70f21388682c40b8bd Mon Sep 17 00:00:00 2001 From: bill-auger Date: Mon, 8 Mar 2021 22:58:37 -0500 Subject: housekeeping --- src/chroot-tools/chcleanup.in | 24 ++++++++++++------------ src/chroot-tools/libremakepkg | 3 ++- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/chroot-tools/chcleanup.in b/src/chroot-tools/chcleanup.in index 10256dd..a76dd67 100644 --- a/src/chroot-tools/chcleanup.in +++ b/src/chroot-tools/chcleanup.in @@ -63,7 +63,7 @@ fi # NOTE: The in-chroot pkgconfdir is non-configurable. # This is intentionally hard-coded. -source /etc/libretools.d/chroot.conf +source /etc/libretools.d/chroot.conf # sets $CHROOTEXTRAPKG # NOTE: ARM chroots require 'fakeroot-tcp' (BR #2775) fakeroot_pkg=fakeroot$( [[ "$(uname -m)" == 'armv7l' ]] && echo '-tcp' ) @@ -100,7 +100,7 @@ cp -a -t "${TEMPDIR}/db" -- /var/lib/pacman/sync ln -sfT -- /dev/null "$TEMPDIR/hooks/${hook##*/}" done done -pacman=(pacman --dbpath="$TEMPDIR/db" --hookdir="$TEMPDIR/hooks") +pkglist_cmd=(pacman --dbpath="$TEMPDIR/db" --hookdir="$TEMPDIR/hooks") # Do our best to preload the scratch DB with CHROOTPKG and # CHROOTEXTRAPKG packages. This is purely an optimization step. The @@ -112,29 +112,29 @@ while read -r pkg; do if [[ -d /var/lib/pacman/local/$pkg ]]; then cp -a -T -- "/var/lib/pacman/local/$pkg" "$TEMPDIR/db/local/$pkg" fi -done < <("${pacman[@]}" -Sp --print-format='%n-%v' -- "${CHROOTPKG[@]}" "${CHROOTEXTRAPKG[@]}") +done < <("${pkglist_cmd[@]}" -Sp --print-format='%n-%v' -- "${CHROOTPKG[@]}" "${CHROOTEXTRAPKG[@]}") # Get the full list of packages needed by dependencies, including the base system msg2 "Creating a full list of packages..." -for var in CHROOTPKG CHROOTEXTRAPKG DEPENDS; do - declare -n pkgsref="$var" - if [[ $var = DEPENDS ]]; then - mapfile -t pkgs < <("${pacman[@]}" -T -- "${pkgsref[@]}") +for pkglist in CHROOTPKG CHROOTEXTRAPKG DEPENDS; do + declare -n pkgsref="$pkglist" + if [[ $pkglist = DEPENDS ]]; then + mapfile -t pkgs < <("${pkglist_cmd[@]}" -T -- "${pkgsref[@]}") else pkgs=("${pkgsref[@]}") fi - if (( ${#pkgs[@]} == 0 )); then - continue + (( ${#pkgs[@]} > 0 )) || continue + fi - "${pacman[@]}" -S --dbonly --noscriptlet --needed --noconfirm -- "${pkgs[@]}" <&- >& "$TEMPDIR/pacman.txt" || ret=$? + "${pkglist_cmd[@]}" -S --dbonly --noscriptlet --needed --noconfirm -- "${pkgs[@]}" <&- >& "$TEMPDIR/pacman.txt" || ret=$? if (( ret != 0 )); then error "Could not create a full list of packages, exiting." plain "This is likely caused by a dependency that could not be found." - sed 's/^/ > /' <"$TEMPDIR/pacman.txt" >&2 + sed 's/^/ > /' < "$TEMPDIR/pacman.txt" >&2 exit $ret fi done -"${pacman[@]}" -Qq >"$TEMPDIR/pkglist.txt" +"${pkglist_cmd[@]}" -Qq > "$TEMPDIR/pkglist.txt" # Diff installed packages against a clean chroot then remove leftovers packages=($(comm -23 <(pacman -Qq | sort -u) \ diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg index 995a7ad..14ec0ff 100755 --- a/src/chroot-tools/libremakepkg +++ b/src/chroot-tools/libremakepkg @@ -184,7 +184,7 @@ usage() { this unless you have a special reason, its use is a violation of Parabola policy." \ '-R' 'Repackage contents of the package without rebuilding' \ - "-S <$(_ FILE)>" 'Use an existing --allsource source-package (not-yrt-implemented)' \ + "-S <$(_ FILE)>" 'Use an existing --allsource source-package (not-yet-implemented)' \ '-h' 'Show this message' } @@ -269,6 +269,7 @@ main() { # Make sure that the various *DEST directories exist sudo -u "$LIBREUSER" mkdir -p -- "$PKGDEST" "$SRCDEST" "$SRCPKGDEST" "$LOGDEST" + # OK, we are starting now ############################################## if $INCHROOT; then -- cgit v1.2.2