On 5/19/24 13:58, David Holland wrote:
On Sun, May 19, 2024 at 10:04:11AM -0500, Jason Bacon wrote:
> I'm curious if there is a reason for this distinction in bsd.pkg.mk:
>
> .if defined(GITHUB_TAG)
> WRKSRC?=
${WRKDIR}/${GITHUB_PROJECT}-${GITHUB_TAG:C/^v//}
> .else
> WRKSRC?= ${WRKDIR}/${DISTNAME:U${PKGNAME_NOREV}}
> .endif
At one point the reason was that it ineracted with the fetch behavior
and the naming generated upstream by github to make the default WRKSRC
be useful in both cases.
If things have changed, it should be updated accordingly.
> As far as I can tell, ${GITHUB_PROJECT}-${GITHUB_TAG:C/^v//} produces
> the correct WRKSRC whenever GITHUB_PROJECT is defined. I.e.,
GITHUB_TAG
> defaults to the package version.
GITHUB_TAG is in general whatever the tag on the upstream git repo is,
which can be stuff like "release-5.001.003" or "interim-6-oct15", and
I believe that's also what comes through in the download tarball.
The alternative approach using DISTNAME + PKGNAME instead of DISTNAME +
GITHUB_PROJECT doesn't work in all cases either.
The patch below is sufficient for my simple test cases to get consistent
behavior when defining GITHUB_PROJECT, with or without GITHUB_TAG:
--- bsd.pkg.mk 4 May 2024 17:58:53 -0000 1.2055
+++ bsd.pkg.mk 20 May 2024 11:53:38 -0000
@@ -98,7 +98,7 @@
PKGWILDCARD?= ${PKGBASE}-[0-9]*
TEST_DEPENDS?= # empty
TOOL_DEPENDS?= # empty
-.if defined(GITHUB_TAG)
+.if defined(GITHUB_PROJECT)
WRKSRC?= ${WRKDIR}/${GITHUB_PROJECT}-${GITHUB_TAG:C/^v//}
.else
WRKSRC?= ${WRKDIR}/${DISTNAME:U${PKGNAME_NOREV}}
This works with both release and between-release cases:
DISTNAME= lpjs-0.0.4
CATEGORIES= sysutils
MASTER_SITES= ${MASTER_SITE_GITHUB:=outpaddling/}
GITHUB_PROJECT= LPJS
DISTNAME= lpjs-0.0.4.3
CATEGORIES= sysutils
MASTER_SITES= ${MASTER_SITE_GITHUB:=outpaddling/}
GITHUB_PROJECT= LPJS
GITHUB_TAG= 2b891a0f6513f9922386504fd1d0a5b13b000f15
If we can't trust the default GITHUB_TAG, it might be easy to fix by
adding a 3rd case using GITHUB_PROJECT + PKGVERSION_NOREV, e.g.
.if defined(GITHUB_PROJECT)
.if defined(GITHUB_TAG)
# Github with explicit tag provided by package
WRKSRC?= ${WRKDIR}/${GITHUB_PROJECT}-${GITHUB_TAG:C/^v//}
.else
# Github without explicit tag (e.g. a release)
WRKSRC?= ${WRKDIR}/${GITHUB_PROJECT}-${PKGVERSION_NOREV}
.endif
.else
# Not Github
WRKSRC?= ${WRKDIR}/${DISTNAME:U${PKGNAME_NOREV}}
.endif
--
Life is a game. Play hard. Play fair. Have fun.