Am 05.11.25 um 12:35 schrieb Jan Henrik Sylvester:
On 11/5/25 1:23 AM, Tatsuki Makino wrote:
portmaster is merely one of the entities through which that operation is carried out.

I do not think so. Line 3913 and following of portmaster explicitly removes / usr/local/lib/compat/pkg (in many cases):

[ -z "$temp" ] && temp=`find $LOCALBASE_COMPAT -type d -empty 2>/dev/null`
if pm_isdir "$temp"; then
     pm_sv Deleting the empty $LOCALBASE_COMPAT
     pm_rmdir_s $temp
fi
unset temp

I have no idea why this was added by the original author, but I'm going
to remove that section. In fact /usr/local/lib/compat/pkg is neither
defined in the base system's mtree files, nor included anywhere in the
*.mk files, except for

PKGCOMPATDIR?=          ${LOCALBASE}/lib/compat/pkg

in /usr/ports/Mk/bsd.port.mk - but without ${PKGCOMPATDIR} being used
anywhere in the base system or ports system.

The package command has grown some support for compat/pkg if the
BACKUP_LIBRARIES option of pkg upgrade is used, but that does not
affect package building.

After that, you cannot create a package of pkg anymore. (If you let portmaster itself create a package in the same run, it happens before that line.)

I have tried to recreate the issue by renaming the compat/pkg directory
out of the way and then building the pkg command.

And the build did actually fail, but not for the reason I expected: It
failed when portmaster was creating a backup of the previously installed
version before replacing it with the newly built one:

===>>> Creating a backup package for old version pkg-2.3.1
Creating package for pkg-2.3.1
pkg-static: dir '/usr/local/lib/compat/pkg' is missing
pkg-static: package creation failed

I could not make the build fail due to a  missing compat/pkg directory
in any other way than when creating a backup package.

But the OP did have "pkg" not "pkg-static" in the posted log message,
which seems to indicate that it was actually output from "make package",
and that command makes pkg build the package from the contents of the
work/stage directory only, with no regard to the presence of compat/pkg
on the base system.

BTW: I was trying to output the verbose message to see when it happens, but pm_sv needs PM_SU_VERBOSE to be set, which is never set by portmaster, but unset at the beginning if you are root. (And I should stop looking here, because the find command should probably have a depth 0 check...)

There shouldn't be any directories below compat/pkg, and therefore a
depth check would not make a difference.

Regards, STefan

Reply via email to