Page MenuHomeFreeBSD

pkgbase: fix incremental generation of packages
ClosedPublic

Authored by bapt on Oct 2 2024, 12:12 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 10, 4:30 AM
Unknown Object (File)
Oct 8 2024, 1:37 PM
Unknown Object (File)
Oct 8 2024, 3:46 AM
Unknown Object (File)
Oct 8 2024, 3:46 AM
Unknown Object (File)
Oct 8 2024, 3:12 AM
Unknown Object (File)
Oct 6 2024, 10:40 AM
Unknown Object (File)
Oct 4 2024, 5:02 PM
Unknown Object (File)
Oct 4 2024, 8:52 AM

Details

Summary

Replace the regex trying to catch the branch name of the existing
repository which was too naive with simpler glob matching.

As a result the only case when we only use the new packages are:
moving from alpha to beta
moving from beta to rc
moving from rc to release
changing the major version number for the main git branch

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 59868
Build 56753: arc lint + arc unit

Event Timeline

bapt requested review of this revision.Oct 2 2024, 12:12 PM

Hi. This doesn't seem to work on main. I did make update-packages thrice with already built world and still each time all the packages are "new":

==> Checking for new packages (comparing 15.snap20241003021833 to 15.snap20241003021430)
==> New package FreeBSD-acct-15.snap20241003021833.pkg
[...]

BRANCH_EXT_FROM = 15..snap
BRANCH_EXT =

fix BRANCH_EXT_FROM on current

I don't understand why BRANCH_EXT is empty in your case, are you just invoking make update-packages or do you have more in your command line and env?

I don't understand why BRANCH_EXT is empty in your case, are you just invoking make update-packages or do you have more in your command line and env?

I follow FreeBSD Wiki "pkgbase" article as of Revision 67 as of 2023-10-18T20:32:31+0000, the last revision that mentions make update-packages when updating from source.

As of updated diff: BRANCH_EXT_FROM = 15.snap, BRANCH_EXT = , _BRANCH = CURRENT, PKG_VERSION = 15.snap20241008153903

I sprinkled echo around and found that line 581 (BRANCH_EXT= ${MAJOR_REVISION}.snap) and its related block don't get executed (PKG_VERSION is defined). Then I realized that I see two if and three endif lines, applied hack:

diff --git a/Makefile.inc1 b/Makefile.inc1
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -576,6 +576,8 @@ _PKG_REVISION=	${_REVISION}
 _STRTIMENOW=	%Y%m%d%H%M%S
 _TIMENOW=	${_STRTIMENOW:gmtime}
 BRANCH_EXT=
+PKG_VERSION:=	${_PKG_REVISION}${EXTRA_REVISION:C/[[:space:]]//g}
+.endif
 .if ${_BRANCH:MCURRENT*} || ${_BRANCH:MSTABLE*} || ${_BRANCH:MPRERELEASE*}
 _PKG_REVISION=	${MAJOR_REVISION}
 BRANCH_EXT=	snap
@@ -593,8 +595,6 @@ EXTRA_REVISION=	.${BRANCH_EXT}.${_TIMENOW}
 BRANCH_EXT=	p${_BRANCH:C/.*-p([0-9]+$)/\1/}
 EXTRA_REVISION=	${BRANCH_EXT}
 .endif
-PKG_VERSION:=	${_PKG_REVISION}${EXTRA_REVISION:C/[[:space:]]//g}
-.endif
 .endif	# !defined(PKG_VERSION)
 
 .if !defined(PKG_TIMESTAMP)

did make update-packages again, and now I get:

==> Checking for new packages (comparing 15.0.snap20241008160805 to 15.snap20241008144334)
==> Keeping old FreeBSD-acct-15.snap20241008144334.pkg
[...]

The 15.0.snap20241008160805 part is wrong, I don't propose this. I have shown here that the current logic doesn't set BRANCH_EXT on main when doing make update-packages, maybe due to if block mismatch.

I can't provide further suggestions or even attempt review at the moment due to unrelated exhaustion.

Edit: I realized that I reported earlier hack rather than the hack that restored "keeping old" for me, added local hack as patch (applied on main without D46874 applied).

oh thank you for opening my eyes, the error is obvious now I should be able to fix tomorrow

Makefile.inc1
2045

Is this supposed to match both old and new branch extensions? I would add a comment explaining this, as it looks very confusing to me.

note after some testing this is still wrong :(

Makefile.inc1
2045

yes it is, I will add the comments.

Fix: BRANCH_EXT was not define when PKG_VERSION is specified from command line
which is always the case during make update-package

While here add a comment explaning the branch determination

bapt marked an inline comment as done.Wed, Oct 9, 1:22 PM

now it works for real!

This revision was not accepted when it landed; it landed in state Needs Review.Thu, Oct 10, 6:49 AM
This revision was automatically updated to reflect the committed changes.