lang/rust: Extract .cargo without making a copy in ${WRKDIR}

This commit is contained in:
minskim 2018-10-23 16:39:29 +00:00
parent b7dff8a3f7
commit 4b82a59c7e
2 changed files with 6 additions and 6 deletions

View file

@ -1,4 +1,4 @@
# $NetBSD: cargo.mk,v 1.3 2018/09/21 21:26:33 minskim Exp $
# $NetBSD: cargo.mk,v 1.4 2018/10/23 16:39:29 minskim Exp $
#
# Common logic that can be used by packages that depend on cargo crates
# from crates.io. This lets existing pkgsrc infrastructure fetch and verify
@ -29,6 +29,7 @@ DISTFILES?= ${DEFAULT_DISTFILES}
.for _crate in ${CARGO_CRATE_DEPENDS}
DISTFILES+= ${_crate}.crate
SITES.${_crate}.crate+= -${MASTER_SITE_CRATESIO}${_crate:C/-[0-9.]+$//}/${_crate:C/^.*-([0-9.]+)$/\1/}/download
EXTRACT_DIR.${_crate}.crate?= ${CARGO_VENDOR_DIR}
.endfor
post-extract: cargo-vendor-crates
@ -39,9 +40,8 @@ cargo-vendor-crates:
${RUN}${PRINTF} "[source.crates-io]\nreplace-with = \"vendored-sources\"\n[source.vendored-sources]\ndirectory = \"${CARGO_VENDOR_DIR}\"\n" >> ${WRKSRC}/.cargo/config
${RUN}${MKDIR} ${CARGO_VENDOR_DIR}
.for _crate in ${CARGO_CRATE_DEPENDS}
${RUN}${TOOLS_PATH.bsdtar} -C ${CARGO_VENDOR_DIR} -xzf ${WRKDIR}/${_crate}.crate
${RUN}${PRINTF} '{"package":"%s","files":{}}' \
$$(${DIGEST} sha256 < ${WRKDIR}/${_crate}.crate) \
$$(${DIGEST} sha256 < ${_DISTDIR}/${_crate}.crate) \
> ${CARGO_VENDOR_DIR}/${_crate}/.cargo-checksum.json
.endfor

View file

@ -1,6 +1,6 @@
#!/bin/sh
#
# $NetBSD: extract,v 1.17 2018/08/22 20:48:37 maya Exp $
# $NetBSD: extract,v 1.18 2018/10/23 16:39:29 minskim Exp $
#
# Copyright (c) 2006 The NetBSD Foundation, Inc.
# All rights reserved.
@ -175,7 +175,7 @@ esac
# Derive the compression format of the archive based on the file extension.
case "$distfile" in
*.gz|*.tgz|*.z) _cformat=gzip ;;
*.gz|*.tgz|*.z|*.crate) _cformat=gzip ;;
*.7z) _cformat=7z ;;
*.bz2|*.tbz|*.tbz2|*.bz) _cformat=bzip ;;
*.lz) _cformat=lzip ;;
@ -202,7 +202,7 @@ esac
# Derive the format of the archive based on the file extension.
case "$distfile" in
*.tar.gz|*.tgz|*-tar.gz|*_tar.gz|*.tar.bz2|*.tbz|*.tbz2|*.tar.lz|*.tar.lzma|*.tar.xz|*.tar.Z|*.tar.z|*.tar|*.tar.bz|*.tar.7z)
*.tar.gz|*.tgz|*-tar.gz|*_tar.gz|*.tar.bz2|*.tbz|*.tbz2|*.tar.lz|*.tar.lzma|*.tar.xz|*.tar.Z|*.tar.z|*.tar|*.tar.bz|*.tar.7z|*.crate)
_format=tar ;;
*.cpio|*.cpio.gz|*.cpio.bz2)
_format=cpio ;;