diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2018-08-06 15:36:20 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2018-08-06 15:36:20 -0400 |
commit | 6faf57c73c9bf035744080805048121b6a49aa5f (patch) | |
tree | 14ebc44d6a0a9a16a87553eb7ed86ce5fdc14069 /src/chroot-tools/chcleanup.in | |
parent | 7543d0b6dda7ade960c11b60e3b10ff13369af44 (diff) |
chcleanup: Try preloading the scratch DB to speed things up.
Diffstat (limited to 'src/chroot-tools/chcleanup.in')
-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 |