summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2018-08-06 01:37:27 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2018-08-06 01:41:24 -0400
commit91ce49fd62af3f3b0631cbc144cb1f4506b78fc4 (patch)
treeac7ef0981562861c44aa0f2b37cd9b33b8f04c96 /src
parent1ca4001b39a4b243a2102d32bb20268c726e028b (diff)
chcleanup: Do the package list creating in tiers
This avoids something like a dep on 'systemd-tools' from resolving to 'notsystemd', causing a conflict with 'systemd' in 'base-devel', which had the 'systemd-tools' dep already filled. On the downside, this is much slower.
Diffstat (limited to 'src')
-rw-r--r--src/chroot-tools/chcleanup.in20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/chroot-tools/chcleanup.in b/src/chroot-tools/chcleanup.in
index 317bf10..d114080 100644
--- a/src/chroot-tools/chcleanup.in
+++ b/src/chroot-tools/chcleanup.in
@@ -59,8 +59,9 @@ if [[ -f ./PKGBUILD ]]; then
sudo -u "#$(stat -c %u -- ./PKGBUILD)" sh -c 'makepkg --printsrcinfo > .SRCINFO'
fi
CARCH="$(. /etc/makepkg.conf; printf '%s' "$CARCH")"
- mapfile -t all_depends < <(sed -nE "s/^\\s+(|make|check)depends(|_${CARCH}) = //p" < .SRCINFO)
- CHROOTEXTRAPKG+=("${all_depends[@]}")
+ mapfile -t DEPENDS < <(sed -nE "s/^\\s+(|make|check)depends(|_${CARCH}) = //p" < .SRCINFO)
+else
+ DEPENDS=()
fi
msg "Cleaning chroot..."
@@ -77,13 +78,14 @@ pkglist="${TEMPDIR}"/pkglist.txt
# Get the full list of packages needed by dependencies, including the base system
msg2 "Creating a full list of packages..."
-pacman -b "${TEMPDIR}" \
- -Sp --print-format "%n" base-devel "${CHROOTEXTRAPKG[@]}" >"$pkglist" || {
- ret=$?
- error "Could not create a full list of packages, exiting."
- plain "This is likely caused by a dependency that could not be found."
- exit $ret
-}
+pacman --dbpath="$TEMPDIR" --hookdir=/var/empty -Sq --needed --dbonly --noconfirm -- base-devel >/dev/null
+if (( ${#CHROOTEXTRAPKG[@]} > 0 )); then
+ pacman --dbpath="$TEMPDIR" --hookdir=/var/empty -Sq --needed --dbonly --noconfirm -- "${CHROOTEXTRAPKG[@]}" >/dev/null
+fi
+if (( ${#DEPENDS[@]} > 0 )); then
+ pacman --dbpath="$TEMPDIR" --hookdir=/var/empty -Sq --needed --dbonly --noconfirm -- "${DEPENDS[@]}" >/dev/null
+fi
+pacman --dbpath="$TEMPDIR" -Qq >"$pkglist"
# Diff installed packages against a clean chroot then remove leftovers
packages=($(comm -23 <(pacman -Qq | sort -u) \