Skip to content

Commit 78fa696

Browse files
committed
vmimage.subr: Don't log missing files from pkgs
When installing "extra" packages (aka those built from the ports tree), we record everything being installed in METALOG.pkg; the contents of that file is appended to METALOG before we generate the filesystem. There are two cases when files recorded in METALOG.pkg will no longer exist by the time we create the final disk image: 1. If a pkg bug results in false dependencies being installed which are later removed by "pkg autoremove", and 2. If the pkg we build and install from /usr/ports is older than the pkg on pkg.freebsd.org, and pkg gets upgraded automatically as part of installing extra packages. The ultimate issue in both cases is that there's no mechanism for removing entries from METALOG when we run 'pkg delete'. Address this build breakage by checking, line by line, if filesystem objects mentioned in METALOG.pkg exist before appending them to METALOG. Fixes: 6a13aea ("vmimage.subr: pkg autoremove after pkg install") MFC after: immediately (needed for 15.0-RC1)
1 parent 509dfd3 commit 78fa696

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

release/tools/vmimage.subr

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,15 @@ vm_extra_pkg_rmcache() {
292292
buildfs() {
293293
local md tmppool
294294

295+
# Copy entries from METALOG.pkg into METALOG, but first check to
296+
# make sure that filesystem objects still exist; some things may
297+
# have been logged which no longer exist if a package was removed.
295298
if [ -f ${DESTDIR}/METALOG.pkg ]; then
296-
cat ${DESTDIR}/METALOG.pkg >> ${DESTDIR}/METALOG
299+
while read F REST; do
300+
if [ -e ${DESTDIR}/${F} ]; then
301+
echo "${F} ${REST}" >> ${DESTDIR}/METALOG
302+
fi
303+
done < ${DESTDIR}/METALOG.pkg
297304
fi
298305

299306
if [ -n "${NO_ROOT}" ]; then

0 commit comments

Comments
 (0)