Bug 248967

Summary: USE_GITLAB lacking support for tags
Product: Ports & Packages Reporter: phryk-ports
Component: Ports FrameworkAssignee: Port Management Team <portmgr>
Status: Closed FIXED    
Severity: Affects Only Me CC: kevans, ports-bugs, tcberner, yuri, zirias
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   

Description phryk-ports 2020-08-28 13:12:50 UTC
`USE_GITHUB` has `GH_TAGNAME` while `USE_GITLAB` has no equivalent. This should be added to make porters' lives easier.

Super bonus points for adding something like GL_SIGNING_FINGERPRINT or similar for verifying signatures of cryptographically signed releases. ;)

PS: Like usual, I'm not sure if this is the right category to report this in, but haven't found anything more fitting. ¯\_(ツ)_/¯
Comment 1 Mathieu Arnold freebsd_committer freebsd_triage 2020-08-28 13:38:26 UTC
Well, github supports fetching a just-in-time archive using a commit hash or a tag, gitlab puts the full commit hash is present in the resulting archive in the directory name, so, you need to provide that commit hash anyway.
Comment 2 phryk-ports 2020-08-28 13:47:08 UTC
(In reply to Mathieu Arnold from comment #1)

This isn't true:
https://gitlab.com/sequoia-pgp/sequoia/-/archive/v0.19.0/sequoia-v0.19.0.tar.gz
points to a tagged release only via the tag name "v0.19.0" and even when untaring it, the commit hash doesn't show up anywhere, far as I can tell.

Maybe you're referring to older gitlab behavior?
Comment 3 Mathieu Arnold freebsd_committer freebsd_triage 2020-09-02 13:05:43 UTC
Well, this is not true for gitlab.com that runs the latest gitlab version, but until all the Gitlab instances have migrated to the new url scheme, we do have to keep the old behavior.

Nothing is preventing work on also supporting the newer download scheme though.
Comment 4 Tobias C. Berner freebsd_committer freebsd_triage 2022-09-07 16:23:56 UTC
Moin moin 

This looks like something that could be done. Can you provide a patch with your proposed change?


mfg Tobias
Comment 5 Tobias C. Berner freebsd_committer freebsd_triage 2022-09-07 16:51:44 UTC
*** Bug 242329 has been marked as a duplicate of this bug. ***
Comment 6 Felix Palmen freebsd_committer freebsd_triage 2022-10-21 07:41:55 UTC
Here's a suggestion for supporting tags:
https://reviews.freebsd.org/D37077
Comment 7 Felix Palmen freebsd_committer freebsd_triage 2023-07-12 18:27:14 UTC
Shame on me, after not being sure how to test it reliably, I forgot about it :(

As the change is fully backwards compatible, it's actually very easy to test: just make sure the checksums for distfiles fetched from some gitlab instance still match! (moving to tag names instead of commit hashes must be done for any port individually ...)

Did that now, finally updated the review!
Comment 8 commit-hook freebsd_committer freebsd_triage 2023-07-12 18:58:20 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=16bde072b16daca1c886116e602c94b5fa99c20f

commit 16bde072b16daca1c886116e602c94b5fa99c20f
Author:     Felix Palmen <zirias@FreeBSD.org>
AuthorDate: 2022-10-21 07:10:41 +0000
Commit:     Felix Palmen <zirias@FreeBSD.org>
CommitDate: 2023-07-12 18:55:08 +0000

    bsd.sites.mk: Support tag names with USE_GITLAB

    Since quite some time, it's possible to download generated tarballs from
    gitlab for a tag name without knowing the corresponding git hash. This
    is preferable because you have a single source of truth about the
    software version.

    Support this by replacing GL_COMMIT with GL_TAGNAME which also accepts a
    commit hash, similar to USE_GITHUB. Unfortunately, there's a catch, the
    DISTFILE must be named exactly: ${GL_PROJECT}-${GL_TAGNAME}.tar.bz2,
    otherwise it extracts in a directory that contains the commit hash. So,
    we can't add the gitlab account or the revision suffix to make it work.

    Therefore, detect whether GL_TAGNAME contains a commit hash, and if it
    does, use the old behavior of deriving DISTNAME and DISTFILES.

    Document in CHANGES, also add a DEV_WARNING similar to USE_GITHUB when
    there's an URL in MASTER_SITES that looks like a gitlab URL. With
    support for tags, there shouldn't be any reason left to hardcode such an
    URL in MASTER_SITES.

    PR:                     248967
    Approved by:            portmgr (tcberner, mentor)
    Differential Revision:  https://reviews.freebsd.org/D37077

 CHANGES             | 16 ++++++++++++++
 Mk/Uses/kde.mk      |  2 +-
 Mk/Uses/xorg-cat.mk |  2 +-
 Mk/bsd.options.mk   |  2 +-
 Mk/bsd.port.mk      |  8 +------
 Mk/bsd.sites.mk     | 61 +++++++++++++++++++++++++++++++++++++----------------
 6 files changed, 63 insertions(+), 28 deletions(-)
Comment 9 Felix Palmen freebsd_committer freebsd_triage 2023-07-12 19:01:30 UTC
Should be (finally) fixed now!