summaryrefslogtreecommitdiff
path: root/eclass/cargo.eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2019-09-06 10:28:05 +0100
committerV3n3RiX <venerix@redcorelinux.org>2019-09-06 10:28:05 +0100
commitf1af93971b7490792d8541bc790e0d8c6d787059 (patch)
treea38046712bbc3a3844d77452d16c84e716caa3d4 /eclass/cargo.eclass
parentfc637fb28da700da71ec2064d65ca5a7a31b9c6c (diff)
gentoo resync : 06.08.2019
Diffstat (limited to 'eclass/cargo.eclass')
-rw-r--r--eclass/cargo.eclass27
1 files changed, 26 insertions, 1 deletions
diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
index b16e0e9d6336..44d11cdb8380 100644
--- a/eclass/cargo.eclass
+++ b/eclass/cargo.eclass
@@ -12,7 +12,12 @@
if [[ -z ${_CARGO_ECLASS} ]]; then
_CARGO_ECLASS=1
-CARGO_DEPEND="virtual/cargo"
+if [[ ${PV} == *9999* ]]; then
+ # we need at least this for cargo vendor subommand
+ CARGO_DEPEND=">=virtual/cargo-1.37.0"
+else
+ CARGO_DEPEND="virtual/cargo"
+fi
case ${EAPI} in
6) DEPEND="${CARGO_DEPEND}";;
@@ -97,6 +102,26 @@ cargo_src_unpack() {
cargo_gen_config
}
+# @FUNCTION: cargo_live_src_unpack
+# @DESCRIPTION:
+# Runs 'cargo fetch' and vendors downloaded crates for offline use, used in live ebuilds
+
+cargo_live_src_unpack() {
+ debug-print-function ${FUNCNAME} "$@"
+
+ [[ "${PV}" == *9999* ]] || die "${FUNCNAME} only allowed in live/9999 ebuilds"
+ [[ "${EBUILD_PHASE}" == unpack ]] || die "${FUNCNAME} only allowed in src_unpack"
+
+ mkdir -p "${S}" || die
+
+ pushd "${S}" > /dev/null || die
+ CARGO_HOME="${ECARGO_HOME}" cargo fetch || die
+ CARGO_HOME="${ECARGO_HOME}" cargo vendor "${ECARGO_VENDOR}" || die
+ popd > /dev/null || die
+
+ cargo_gen_config
+}
+
# @FUNCTION: cargo_gen_config
# @DESCRIPTION:
# Generate the $CARGO_HOME/config necessary to use our local registry