tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Problem downloading some Rust crates



Am 02.12.2024 um 21:32 schrieb Adam:
> I came across a problem with downloading some Rust/Cargo crates like
> curl-sys-0.4.78+curl-8.11.0. The regex in lang/rust/cargo.mk
> (${crate:C/-[0-9]+\.[0-9.]+.*$//}/${crate:C/^.*-([0-9]+\.[0-9.]+.*)$/
> \1/}) tries to make up an URL by extracting the last version
> component, in this case 8.11.0, but that is wrong. The correct
> version is 0.4.78+curl-8.11.0 (the full URL: https://crates.io/api/
> v1/crates/curl-sys/0.4.78+curl-8.11.0/download). I am not sure how
> to fix this. Any suggestions?

To try it out, you can add the following snippet anywhere in a makefile:

> .for crate in curl-sys-0.4.78+curl-8.11.0
> .  for base wrong version in \
>     ${crate:C/-[0-9]+\.[0-9.]+.*$//} \
>     ${crate:C/^.*-([0-9]+\.[0-9.]+.*)$/\1/} \
>     ${crate:S,^${crate:C/-[0-9]+\.[0-9.]+.*$//}-,,}
> .    info base=${base} wrong=${wrong} version=${version}
> .  endfor
> .endfor

The expression for the correct version part is essentially
${crate:S,^${base}-,,}, just inlined.

If you replace the wrong expression with the version expression, it
should work in all other cases as well.

Roland


Home | Main Index | Thread Index | Old Index