[Bug 270157] ports-mgmt/portupgrade: with portupgrade -P install of ports-mgmt/pkg fails

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 12 Mar 2023 14:55:45 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=270157

            Bug ID: 270157
           Summary: ports-mgmt/portupgrade: with portupgrade -P install of
                    ports-mgmt/pkg fails
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: fabian@wenks.ch
                CC: bdrewery@FreeBSD.org, pkg@FreeBSD.org
                CC: bdrewery@FreeBSD.org, pkg@FreeBSD.org

I am running a hand full of servers and in the past I have build and installed
all the ports on each server individually. As some of them are not so powerful
I have create a kind of an unusual setup to build packages only on the most
powerful server. The packages are stored in the NFS shared
/usr/ports/packages/All/ directory.

My workflow is like this:

1) on all servers I run (at the same time):
cd /usr/ports/ && nice -n 5 make update && nice -n 5 make fetchindex && nice -n
5 portupgrade -an
2) on the build server I run:
nice -n 5 portupgrade -ap
and then an own script to remove outdated packages, create .txz link to .pkg
and also run:
pkg repo /usr/ports/packages
3) on all other server then I run:
nice -n 5 portupgrade -akP

As not all ports are installed on the build server, other servers will build
the port locally (mostly small stuff which does not need a lot to build).
With the use of 'portupgrade -P' ports installed from packages are done with
'pkg', but when the port is build locally, then 'pkg-static' is used (as it
also is the case when -P is not used).
With an update of ports-mgmt/pkg on the build server it gets build and a
package  is created and stored in /usr/ports/packages/All/. But then on the
other server the installation fails as the installed ports-mgmt/pkg gets
removed and pkg is not there any more to install. Why is 'portupgrade -P' using
'pkg' instead of 'pkg-static' to upgrade from a packages?

My workaround currently is like this (needs to be done before running
'portupgrade -akP'):
pkg install /usr/ports/packages/All/pkg-1.19.1_1.pkg

I am aware that I could create a proper build environment with a jail and
poudriere, but what I currently have works fine for my use case. My next
improvements will be to also use a NFS share for /usr/ports/ (to only run 'make
update' and 'make fetchindex' on one server) and /var/db/ports/ and use
something like 'WRKDIRPREFIX=/path/to/ports-workdir portupgrade' to avoid
building over NFS.

-- 
You are receiving this mail because:
You are the assignee for the bug.