summaryrefslogtreecommitdiff
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
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.
-rw-r--r--po/es/libretools.po16
-rw-r--r--src/chroot-tools/chcleanup.in20
2 files changed, 17 insertions, 19 deletions
diff --git a/po/es/libretools.po b/po/es/libretools.po
index f5e9583..de1e684 100644
--- a/po/es/libretools.po
+++ b/po/es/libretools.po
@@ -508,31 +508,27 @@ msgstr "chroot '%s' no está a la versión %s. Por favor reconstruir."
msgid "(chcleanup): Must be run inside of a chroot"
msgstr "(chcleanup): Debe ser ejecutado dentro de un chroot"
-#: src/chroot-tools/chcleanup:91
+#: src/chroot-tools/chcleanup:92
msgid "Cleaning chroot..."
msgstr "Limpiando un chroot..."
-#: src/chroot-tools/chcleanup:104
+#: src/chroot-tools/chcleanup:105
msgid "Creating a full list of packages..."
msgstr "Creando una lista completa de paquetes..."
-#: src/chroot-tools/chcleanup:108
-msgid "Could not create a full list of packages, exiting."
-msgstr "No se pudo crear una lista completa de paquetes, saliendo."
-
-#: src/chroot-tools/chcleanup:117
+#: src/chroot-tools/chcleanup:119
msgid "No packages to remove"
msgstr "No hay paquetes para remover"
-#: src/chroot-tools/chcleanup:119
+#: src/chroot-tools/chcleanup:121
msgid "Removing %d packages"
msgstr "Removiendo %d paquetes"
-#: src/chroot-tools/chcleanup:132
+#: src/chroot-tools/chcleanup:134
msgid "No packages to add"
msgstr ""
-#: src/chroot-tools/chcleanup:134
+#: src/chroot-tools/chcleanup:136
msgid "Adding %d packages"
msgstr ""
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) \