Bug 295085 - pkgbase: "make update-packages" is not idempotent
Summary: pkgbase: "make update-packages" is not idempotent
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 15.0-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: Alan Somers
URL: https://reviews.freebsd.org/D56872
Keywords:
Depends on:
Blocks:
 
Reported: 2026-05-07 17:52 UTC by Alan Somers
Modified: 2026-05-14 19:05 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Somers freebsd_committer freebsd_triage 2026-05-07 17:52:06 UTC
When working from a release branch, it's recommended to run "make update-packages" after every SA and EN to rebuild the base packages.  However, that does NOT work if BRANCH was not increased.  This is not so much a problem for manual use, but it's a problem for CI setups that want to run "make update-packages" every time the src tree is updated.

The build will fail in the same way whether or not any files were modified, as long as BRANCH was not.

Steps to Reproduce
==================

1) Checkout releng/15.0.0-p4
2) Do make buildworld && make buildkernel && make packages # it works
3) Checkout releng/15.0.0-p5
4) Do make buildworld && make buildkernel && make update-packages # it works
5) Optionally, modify any file, for example sys/fs/fuse/fuse_vnops.c .  
6) Do make buildworld && make buildkernel && make update-packages # it fails
7) Manually increment BRANCH in sys/conf/newvers.sh
8) Do make buildworld && make buildkernel && make update-packages # it works

Error message
=============

In the failure case, "make update-packages" fails like this:

==> Checking for new packages (comparing 15.0p5 to 15.0p5)
==> Keeping old FreeBSD-acct-15.0p5.pkg
cp: /usr/obj/usr/home/somers/src/freebsd.org/src/15.0/repo/FreeBSD:15:amd64/15.0p5/FreeBSD-acct-15.0p5.pkg: No such file or directory
*** [real-update-packages] Error code 1

Suggested remedy
================

It would be very helpful if "make update-packages" could be idempotent.  Even if it means not attempting to rebuild packages if BRANCH does not change.
Comment 1 commit-hook freebsd_committer freebsd_triage 2026-05-08 15:18:46 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=bd1e789b8452a8c2f166a3b4defb95330c71dadd

commit bd1e789b8452a8c2f166a3b4defb95330c71dadd
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2026-05-07 18:18:29 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2026-05-08 15:17:57 +0000

    Make "make update-packages" idempotent

    If the user runs "make update-packages" without bumping BRANCH, then it
    isn't possible to copy packages from the old location to the new one
    (because the two locations are the same).  So just skip that step.

    Sponsored by:           ConnectWise
    PR:                     295085
    MFC after:              1 week
    Reviewed by:            ivy, emaste
    Differential Revision:  https://reviews.freebsd.org/D56872

 Makefile.inc1 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Comment 2 commit-hook freebsd_committer freebsd_triage 2026-05-13 19:24:51 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=89a0148521aefe0a190d4b62749186c705962d32

commit 89a0148521aefe0a190d4b62749186c705962d32
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2026-05-07 18:18:29 +0000
Commit:     Alan Somers <asomers@FreeBSD.org>
CommitDate: 2026-05-13 17:23:07 +0000

    Make "make update-packages" idempotent

    If the user runs "make update-packages" without bumping BRANCH, then it
    isn't possible to copy packages from the old location to the new one
    (because the two locations are the same).  So just skip that step.

    Sponsored by:           ConnectWise
    PR:                     295085
    Reviewed by:            ivy, emaste
    Differential Revision:  https://reviews.freebsd.org/D56872

    (cherry picked from commit bd1e789b8452a8c2f166a3b4defb95330c71dadd)

 Makefile.inc1 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Comment 3 commit-hook freebsd_committer freebsd_triage 2026-05-14 19:05:46 UTC
A commit in branch releng/15.1 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=09a53a56b7a6892935509e2cda1954fff8078c3f

commit 09a53a56b7a6892935509e2cda1954fff8078c3f
Author:     Alan Somers <asomers@FreeBSD.org>
AuthorDate: 2026-05-07 18:18:29 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2026-05-14 19:04:52 +0000

    Make "make update-packages" idempotent

    If the user runs "make update-packages" without bumping BRANCH, then it
    isn't possible to copy packages from the old location to the new one
    (because the two locations are the same).  So just skip that step.

    Approved by:    re (cperciva)
    Sponsored by:           ConnectWise
    PR:                     295085
    Reviewed by:            ivy, emaste
    Differential Revision:  https://reviews.freebsd.org/D56872

    (cherry picked from commit bd1e789b8452a8c2f166a3b4defb95330c71dadd)
    (cherry picked from commit 89a0148521aefe0a190d4b62749186c705962d32)

 Makefile.inc1 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)