Bug 266724 - Mk/Uses/cargo.mk: _CARGO_GIT_SOURCES generates invalid WRKSRC with GitLab "tag"
Summary: Mk/Uses/cargo.mk: _CARGO_GIT_SOURCES generates invalid WRKSRC with GitLab "tag"
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: FreeBSD Rust Team
URL:
Keywords: needs-patch
Depends on:
Blocks:
 
Reported: 2022-09-30 13:20 UTC by Jan Beich
Modified: 2022-11-08 09:22 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 Jan Beich freebsd_committer freebsd_triage 2022-09-30 13:20:29 UTC
As noticed in bug 242329 when automatic archive for a tag is downloaded full Git hash is appended to the extracted directory with sources unless URL is constructed in a certain way. For example,

https://gitlab.com/snakedye/snui/-/archive/v0.1.3.tar.gz?dummy=/snakedye-snui-v0.1.3_GL0.tar.gz

should be

https://gitlab.com/snakedye/snui/-/archive/v0.1.3/snui-v0.1.3.tar.gz?dummy=/snakedye-snui-v0.1.3_GL0.tar.gz

$ cd x11/salut
$ make cargo-crates-merge
$ make clean all
[...]
===>  Configuring for salut-0.2.3
===>   Cargo config:
find: /wrkdirs/usr/ports/x11/salut/work/snui-v0.1.3: No such file or directory
find: /wrkdirs/usr/ports/x11/salut/work/snui-v0.1.3: No such file or directory
find: /wrkdirs/usr/ports/x11/salut/work/snui-v0.1.3: No such file or directory
[source.cargo]
directory = '/wrkdirs/usr/ports/x11/salut/work/salut-9dc0ba82713515cf660b2fb75a411909fa1b4ae1/cargo-crates'
[source.crates-io]
replace-with = 'cargo'
[patch.'https://github.com/RazrFalcon/resvg.git']
resvg = { path = '/wrkdirs/usr/ports/x11/salut/work/resvg-a739aef5d01360ec238c886bc50674f31458df00' }
usvg = { path = '/wrkdirs/usr/ports/x11/salut/work/resvg-a739aef5d01360ec238c886bc50674f31458df00/usvg' }
[patch.'https://github.com/rust-x-bindings/xkbcommon-rs']
xkbcommon = { path = '/wrkdirs/usr/ports/x11/salut/work/xkbcommon-rs-4e491bee1b850625ae077134901f89836edb6e81' }
[patch.'https://gitlab.com/snakedye/snui.git']
snui = { path = '/wrkdirs/usr/ports/x11/salut/work/snui-v0.1.3' }
snui-derive = { path = '/wrkdirs/usr/ports/x11/salut/work/snui-v0.1.3' }
snui-wayland = { path = '/wrkdirs/usr/ports/x11/salut/work/snui-v0.1.3' }
[patch.'https://github.com/Smithay/client-toolkit.git']
smithay-client-toolkit = { path = '/wrkdirs/usr/ports/x11/salut/work/client-toolkit-87424f2cd10d50422d81ee0444e92becb45d43c4' }
===>   Updating Cargo.lock
error: failed to load source for dependency `snui`

Caused by:
  Unable to update /wrkdirs/usr/ports/x11/salut/work/snui-v0.1.3

Caused by:
  failed to read `/wrkdirs/usr/ports/x11/salut/work/snui-v0.1.3/Cargo.toml`

Caused by:
  No such file or directory (os error 2)
*** Error code 101

Stop.
make: stopped in /usr/ports/x11/salut
Comment 1 commit-hook freebsd_committer freebsd_triage 2022-10-08 12:24:05 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=18052912af5ddbea5d2008e750c568dda0d97b43

commit 18052912af5ddbea5d2008e750c568dda0d97b43
Author:     Tobias Kortkamp <tobik@FreeBSD.org>
AuthorDate: 2022-10-08 12:21:19 +0000
Commit:     Tobias Kortkamp <tobik@FreeBSD.org>
CommitDate: 2022-10-08 12:21:19 +0000

    Uses/cargo: Fix invalid WRKSRC for crates fetched from GitLab with tag

    When using tags the archive fetched from GitLab has the
    corresponding commit hash appended to the directory root too.

    snui@git+https://gitlab.com/snakedye/snui.git?tag=v0.1.4\#83873f1e148a9c84471c10f166c9a945a44d3e64

    would result in

    WRKSRC_crate_snui=      ${WRKDIR}/snui-v0.1.4

    but it must be

    WRKSRC_crate_snui=      ${WRKDIR}/snui-v0.1.4-83873f1e148a9c84471c10f166c9a945a44d3e64

    PR:             266724
    Reported by:    jbeich

 Mk/Scripts/cargo-crates-git-common.awk | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
Comment 2 Tobias Kortkamp freebsd_committer freebsd_triage 2022-11-08 09:22:36 UTC
I'm assuming it's fixed. Feel free to merge it to 2022Q4 if you need it there.