HomeFreeBSD

packages: Don't create empty packages

Description

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

Details

Provenance
ivyAuthored on Feb 21 2026, 8:19 PM
Reviewer
manu
Differential Revision
D55412: packages: Don't create empty packages
Parents
rGfa77660a3ccb: pipe: Avoid unnecessary priv_check() calls in pipespace_new()
Branches
Unknown
Tags
Unknown