commit: ec0d09c191f0b047aec7c9dad3abca98973fb972 Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Wed May 15 18:02:03 2024 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Wed May 15 18:02:03 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ec0d09c1
cargo.eclass: Revert "Optimize crate unpacking" Reverts: 32928116fdcf631b6999705c78640e5718bd7a27 Bug: https://bugs.gentoo.org/931955 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> eclass/cargo.eclass | 56 ++++++++++++++++++++++------------------------------- 1 file 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 }