Date: Mon, 3 Nov 2025 21:40:37 GMT From: Colin Percival <cperciva@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 6a13aeac3c1f - main - vmimage.subr: pkg autoremove after pkg install Message-ID: <202511032140.5A3LebFp091596@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=6a13aeac3c1f98db7cf156f24a4d6bc8d3c321f6 commit 6a13aeac3c1f98db7cf156f24a4d6bc8d3c321f6 Author: Colin Percival <cperciva@FreeBSD.org> AuthorDate: 2025-11-03 01:16:19 +0000 Commit: Colin Percival <cperciva@FreeBSD.org> CommitDate: 2025-11-03 21:40:17 +0000 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 --- release/tools/vmimage.subr | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/release/tools/vmimage.subr b/release/tools/vmimage.subr index 3bfef585f613..8531e9b8f2d6 100644 --- a/release/tools/vmimage.subr +++ b/release/tools/vmimage.subr @@ -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 0help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202511032140.5A3LebFp091596>
