diff options
author | Michał Górny <mgorny@gentoo.org> | 2024-05-15 20:02:03 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2024-05-15 20:02:03 +0200 |
commit | ec0d09c191f0b047aec7c9dad3abca98973fb972 (patch) | |
tree | 261a956ec98118d0c01a01f22bb41c73ae2b8348 /eclass/cargo.eclass | |
parent | dev-python/hatchling: Enable testing on py3.13 (diff) | |
download | gentoo-ec0d09c191f0b047aec7c9dad3abca98973fb972.tar.gz gentoo-ec0d09c191f0b047aec7c9dad3abca98973fb972.tar.bz2 gentoo-ec0d09c191f0b047aec7c9dad3abca98973fb972.zip |
cargo.eclass: Revert "Optimize crate unpacking"
Reverts: 32928116fdcf631b6999705c78640e5718bd7a27
Bug: https://bugs.gentoo.org/931955
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/cargo.eclass')
-rw-r--r-- | eclass/cargo.eclass | 56 |
1 files changed, 23 insertions, 33 deletions
diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass index 5a16d3a30528..0f2da982f60c 100644 --- a/eclass/cargo.eclass +++ b/eclass/cargo.eclass @@ -329,50 +329,40 @@ _cargo_gen_git_config() { cargo_src_unpack() { debug-print-function ${FUNCNAME} "$@" - mkdir -p "${ECARGO_VENDOR}" "${S}" || die + mkdir -p "${ECARGO_VENDOR}" || die + mkdir -p "${S}" || die local archive shasum pkg - local crates=() for archive in ${A}; do case "${archive}" in *.crate) - crates+=( "${archive}" ) + # when called by pkgdiff-mg, do not unpack crates + [[ ${PKGBUMPING} == ${PVR} ]] && continue + + ebegin "Loading ${archive} into Cargo registry" + tar -xf "${DISTDIR}"/${archive} -C "${ECARGO_VENDOR}/" || die + # generate sha256sum of the crate itself as cargo needs this + shasum=$(sha256sum "${DISTDIR}"/${archive} | cut -d ' ' -f 1) + pkg=$(basename ${archive} .crate) + cat <<- EOF > ${ECARGO_VENDOR}/${pkg}/.cargo-checksum.json + { + "package": "${shasum}", + "files": {} + } + EOF + # if this is our target package we need it in ${WORKDIR} too + # to make ${S} (and handle any revisions too) + if [[ ${P} == ${pkg}* ]]; then + tar -xf "${DISTDIR}"/${archive} -C "${WORKDIR}" || die + fi + eend $? ;; *) - unpack "${archive}" + unpack ${archive} ;; esac done - if [[ ${PKGBUMPING} != ${PVR} ]]; then - pushd "${DISTDIR}" >/dev/null || die - - ebegin "Unpacking crates" - printf '%s\0' "${crates[@]}" | - xargs -0 -P "$(makeopts_jobs)" -n 1 -- \ - tar -x -C "${ECARGO_VENDOR}" -f - assert - eend $? - - while read -d '' -r shasum archive; do - pkg=${archive%.crate} - cat <<- EOF > ${ECARGO_VENDOR}/${pkg}/.cargo-checksum.json || die - { - "package": "${shasum}", - "files": {} - } - EOF - - # if this is our target package we need it in ${WORKDIR} too - # to make ${S} (and handle any revisions too) - if [[ ${P} == ${pkg}* ]]; then - tar -xf "${archive}" -C "${WORKDIR}" || die - fi - done < <(sha256sum -z "${crates[@]}" || die) - - popd >/dev/null || die - fi - cargo_gen_config } |