vmimage.subr: pkg autoremove after pkg install
A bug in pkg, which somehow only surfaced as a consequence of pkgbase, results in pkg install sometimes pulling in false dependencies. This problem might be limited to cases when the lib32 pkgbase packages are not installed. In the case of EC2 "small" images, installing the ebsnvme-id package results in binutils, gcc12-devel, gmp, indexinfo, liblz4, mpc, mpfr, and zstd packages being installed. These false dependencies are however not recorded as dependencies -- at some level pkg does understand that they're not needed -- so running pkg autoremove immediately after pkg install cleans them up. Note: This does not remove lines from METALOG corresponding to these packages, and makefs emits an error when it attempts to create the filesystem but cannot find the files listed in METALOG -- but makefs does seem to complete normally despite the error messages. This change should be reverted once the pkg issue has been located and fixed. Reviewed by: ivy MFC after: 3 days Sponsored by: https://www.patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D53543
This commit is contained in:
@@ -212,6 +212,13 @@ vm_extra_install_packages() {
|
||||
-r ${DESTDIR} \
|
||||
install -y -r ${PKG_REPO_NAME} $pkg
|
||||
done
|
||||
INSTALL_AS_USER=yes \
|
||||
${PKG_CMD} \
|
||||
-o ABI=${PKG_ABI} \
|
||||
-o REPOS_DIR=${PKG_REPOS_DIR} \
|
||||
-o PKG_DBDIR=${DESTDIR}/var/db/pkg \
|
||||
-r ${DESTDIR} \
|
||||
autoremove
|
||||
metalog_add_data ./var/db/pkg/local.sqlite
|
||||
else
|
||||
if [ -n "${WITHOUT_QEMU}" ]; then
|
||||
@@ -224,6 +231,8 @@ vm_extra_install_packages() {
|
||||
chroot ${DESTDIR} ${EMULATOR} env ASSUME_ALWAYS_YES=yes \
|
||||
/usr/sbin/pkg install -y ${p}
|
||||
done
|
||||
chroot ${DESTDIR} ${EMULATOR} env ASSUME_ALWAYS_YES=yes \
|
||||
/usr/sbin/pkg autoremove
|
||||
fi
|
||||
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user