When vendoring dependencies and using %{cargo_vendor_manifest}, the generated cargo-vendor.txt has invalid tokens:
%{cargo_vendor_manifest}
Invalid version: '0.4.2 (https://github.com/jackpot51/rust-atomicwrites#043ab485)' error: Dependency tokens must begin with alpha-numeric, '_' or '/': *** FATAL ERROR *** Provides: application() application(com.system76.CosmicBackground.desktop) bundled(crate(addr2line)) = 0.21.0 bundled(crate(adler)) = 1.0.2 cosmic-bg = 0.1.0~20240327.03-1.fc40 cosmic-bg(aarch-64) = 0.1.0~20240327.03-1.fc40 metainfo() metainfo(com.system76.CosmicBackground.metainfo.xml) Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 Requires: libc.so.6()(64bit) libc.so.6(GLIBC_2.17)(64bit) libc.so.6(GLIBC_2.18)(64bit) libc.so.6(GLIBC_2.25)(64bit) libc.so.6(GLIBC_2.28)(64bit) libc.so.6(GLIBC_2.32)(64bit) libc.so.6(GLIBC_2.33)(64bit) libc.so.6(GLIBC_2.34)(64bit) libgcc_s.so.1()(64bit) libgcc_s.so.1(GCC_3.0)(64bit) libgcc_s.so.1(GCC_3.3)(64bit) libgcc_s.so.1(GCC_4.2.0)(64bit) libm.so.6()(64bit) libm.so.6(GLIBC_2.17)(64bit) libm.so.6(GLIBC_2.27)(64bit) libm.so.6(GLIBC_2.29)(64bit) libm.so.6(GLIBC_2.38)(64bit) libxkbcommon.so.0()(64bit) rtld(GNU_HASH) RPM build errors: Dependency tokens must begin with alpha-numeric, '_' or '/': *** FATAL ERROR ***
It looks like the git snapshot information is just appended to the version ... not sure what the correct solution would be here? I would rather want to avoid brittle parsing of this string (I don't know if it's stable).
Would it be acceptable to skip git dependencies like this and require the packager to specify the correct bundled(crate(...)) virtual Provides manually?
bundled(crate(...))
Maybe? I'm not too familiar with the process. But if it's not too cumbersome then it might be okay
You can also just straight up just not make it versioned and say = git or something like that.
= git
An example of what I did for one such thing (that you can choose to mimic yourself) is construct a valid version string before the generator processes it.
Like this:
# fix broken version string for forked bindgen sed -e 's|bindgen v0.64.0 (https://evilpiepirate.org/git/rust-bindgen.git#f773267b)|bindgen v0.64.0+bcfsmod.git20230227.f773267b|' -i cargo-vendor.txt
So you could rewrite the version string as VERSION^gitSHORTCOMMIT.
VERSION^gitSHORTCOMMIT
This issue will be fixed by moving to cargo2rpm v0.3.0, which has more robust parsing rules for cargo-vendor.txt. This will accompany the v28 release of rust-packaging.
Metadata Update from @decathorpe: - Issue status updated to: Closed (was: Open)