%rust_arches x86_64 i686 armv7hl aarch64 ppc64 ppc64le s390x %version_no_tilde() %{lua: local sep = rpm.expand('%1') local ver = rpm.expand('%2') \ if sep == '%1' then sep = '-' end \ if ver == '%2' then ver = rpm.expand('%version') end ver = ver:gsub('~', sep) \ print(ver) } %__crates_url https://crates.io/api/v1/crates/ %crates_source() %{lua: local crate = rpm.expand('%1') local version = rpm.expand('%2') local url = rpm.expand('%__crates_url') \ if crate == '%1' then crate = rpm.expand('%real_crate') end if crate == '%real_crate' then crate = rpm.expand('%crate') end if crate == '%crate' then crate = rpm.expand('%name') end \ if version == '%2' then version = rpm.expand('%version') end version = version:gsub('~', '-') \ print(url .. crate .. '/' .. version .. '/download#/' .. crate .. '-' .. version .. '.crate') }