git: 7965c93e4d41 - main - packages: Don't create empty packages
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 21 Feb 2026 20:27:51 UTC
The branch main has been updated by ivy:
URL: https://cgit.FreeBSD.org/src/commit/?id=7965c93e4d4103ba6ed7ac1e5f1599c93cbcdbf7
commit 7965c93e4d4103ba6ed7ac1e5f1599c93cbcdbf7
Author: Lexi Winter <ivy@FreeBSD.org>
AuthorDate: 2026-02-21 20:19:42 +0000
Commit: Lexi Winter <ivy@FreeBSD.org>
CommitDate: 2026-02-21 20:21:59 +0000
packages: Don't create empty packages
If a package plist only contains directories, but no files, do not
create the package.
This fixes an issue where setting "package=foo" in mtree causes the
"foo" package to always be created, even if nothing else installs in
that package, because the mtree entry is always added to the plist.
This most often happens:
* With architecture-specific directories, because mtree can't install
a directory conditionally based on architecture, and
* With packages that are completely empty when a particular src.conf
knob is disabled, because mtree will still create the directories.
Although it's theoretically possible that we might want to create a
package that only contains directories, there are no such packages
today.
MFC after: 2 weeks (stable/15 only)
Reviewed by: manu, des
Differential Revision: https://reviews.freebsd.org/D55412
Sponsored by: https://www.patreon.com/bsdivy
---
Makefile.inc1 | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/Makefile.inc1 b/Makefile.inc1
index 55b41d76801d..93c54e0a0d14 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -2272,17 +2272,24 @@ create-world-packages-jobs: create-world-package-${pkgname}
create-world-package-${pkgname}: .PHONY
@sh ${SRCDIR}/release/packages/generate-ucl.sh -o ${pkgname} \
-s ${SRCDIR} -u ${WSTAGEDIR}/${pkgname}.ucl
- @awk -F\" ' \
- /^name/ { printf("===> Creating %s-", $$2); next } \
- /^version/ { print $$2; next } \
- ' ${WSTAGEDIR}/${pkgname}.ucl
- ${PKG_CMD} -o ABI=${PKG_ABI} -o ALLOW_BASE_SHLIBS=yes \
- -o OSVERSION="${SRCRELDATE}" \
- create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \
- -M ${WSTAGEDIR}/${pkgname}.ucl \
- -p ${WSTAGEDIR}/${pkgname}.plist \
- -r ${WSTAGEDIR} \
- -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}
+ @if [ "$$(grep -vc '^@dir' ${WSTAGEDIR}/${pkgname}.plist)" -gt 0 ]; then \
+ awk -F\" ' \
+ /^name/ { printf("===> Creating %s-", $$2); next } \
+ /^version/ { print $$2; next } \
+ ' ${WSTAGEDIR}/${pkgname}.ucl && \
+ ${PKG_CMD} -o ABI=${PKG_ABI} -o ALLOW_BASE_SHLIBS=yes \
+ -o OSVERSION="${SRCRELDATE}" \
+ create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \
+ -M ${WSTAGEDIR}/${pkgname}.ucl \
+ -p ${WSTAGEDIR}/${pkgname}.plist \
+ -r ${WSTAGEDIR} \
+ -o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}; \
+ else \
+ awk -F\" ' \
+ /^name/ { printf("===> Skipping %s-", $$2); next } \
+ /^version/ { print $$2; next } \
+ ' ${WSTAGEDIR}/${pkgname}.ucl; \
+ fi
.endfor
create-sets-packages-jobs: .PHONY create-sets-packages