Re: pkg/poudriere: dangling symlink to pkg.pkg.sig [inline patch fixed]

From: Stefan Esser <se_at_freebsd.org>
Date: Thu, 29 Jul 2021 09:18:19 UTC
[Resending, the inline diff had significant white-space issues ...]

Am 29.07.21 um 09:41 schrieb Baptiste Daroussin:
> On Tue, Jul 27, 2021 at 02:05:14PM -0700, Craig Leres wrote:
>>
>> For the last few days, approximately corresponding to when the pkg port
>> upgraded to 1.17.0, the poudriere build process has been creating a dangling
>> symlink from pkg.txz.sig to pkg.pkg.sig. Posting an issue to
>> github.com/freebsd/pkg did not prove useful; does anyone understand what
>> broke (and how to fix it)?
>>
>> I ran into this because I use a cron job to archive poudriere build trees;
>> the job does a diff -r of the latest pkg tree vs. the most recent archived
>> tree (to decide if the new tree is worth archiving).
>>
>> 		Craig
>>
> I told you to have a look at the commit in the ports tree in the github issue,
> which apparently you did not.
> 
> In particular:
> https://cgit.freebsd.org/ports/commit/Mk/bsd.port.mk?id=ec2764d5ec4933f52cb0718663f60f1e1b1eed7f
> 
> This is not done by pkg, so this is not a pkg bug, neither done by poudriere,
> this is done by the ports tree, this is a transition so that when someone is
> signing his own repo, he has valid signature for FreeBSD 12.2 and 11.4 which are
> the 2 systems which do not know about .pkg extention for the bootstrap of pkg.
> 
> The safest way to do that was to create a dead symlink so the when pkg.pkg.sig
> appears the symlink is not dead anymore and bootstrap signature can be checked.
> 
> 1 improvements that can be done, (I don't have time to do it right now: limit
> this to only be created on FreeBSD 12 and 11, limit it to cluster package
> building)

The attached patch limits the creation of the symlink to FreeBSD
versions before 13.

Inline version for easy review (white-space might be damaged):

diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index c9532fa5af2e..1a942e8abc0c 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -3461,7 +3461,10 @@ ${PKGLATESTFILE}: ${PKGFILE} ${PKGLATESTREPOSITORY}
 	${INSTALL} -l rs ${PKGFILE} ${PKGLATESTFILE}

 .if !defined(_PKG_TRANSITIONING_TO_NEW_EXT)
-_EXTRA_PACKAGE_TARGET_DEP+=	${PKGOLDLATESTFILE} ${PKGOLDSIGFILE}
+_EXTRA_PACKAGE_TARGET_DEP+=	${PKGOLDLATESTFILE}
+.if ${OSVERSION} < 1300000
+_EXTRA_PACKAGE_TARGET_DEP+=	${PKGOLDSIGFILE}
+.endif

 ${PKGOLDLATESTFILE}: ${PKGOLDFILE} ${PKGLATESTREPOSITORY}
 	${INSTALL} -l rs ${PKGOLDFILE} ${PKGOLDLATESTFILE}

Do you approve the commit?

Regards, STefan