diff options
-rw-r--r-- | src/chroot-tools/chcleanup.in | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/chroot-tools/chcleanup.in b/src/chroot-tools/chcleanup.in index 89339a6..e311d4b 100644 --- a/src/chroot-tools/chcleanup.in +++ b/src/chroot-tools/chcleanup.in @@ -86,6 +86,19 @@ cp -a -t "${TEMPDIR}/db" -- /var/lib/pacman/sync done done pacman=(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 +# safety of this optimization assumes that none of CHROOTPKG, +# CHROOTEXTRAPKG, *or their dependancies* are virtual packages. We +# don't include DEPENDS in this optimization, because this assumption +# doesn't hold for them. +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[@]}") + # 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 |