mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-10 14:36:58 +02:00
eclass/cargo: Sync with Gentoo
It's from Gentoo commit f41ee85b85c4f4b953e71f9dcee4d0b87e9a2943.
This commit is contained in:
parent
11610ca99c
commit
fdb6c5329c
@ -245,6 +245,16 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo"
|
|||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# List of URIs to put in SRC_URI created from CRATES variable.
|
# List of URIs to put in SRC_URI created from CRATES variable.
|
||||||
|
|
||||||
|
# @FUNCTION: _cargo_check_initialized
|
||||||
|
# @INTERNAL
|
||||||
|
# @DESCRIPTION:
|
||||||
|
# Checks if rust_pkg_setup has been run.
|
||||||
|
_cargo_check_initialized() {
|
||||||
|
if [[ -z "${CARGO}" ]]; then
|
||||||
|
die "CARGO is not set; was rust_pkg_setup run?"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# @FUNCTION: _cargo_set_crate_uris
|
# @FUNCTION: _cargo_set_crate_uris
|
||||||
# @USAGE: <crates>
|
# @USAGE: <crates>
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
@ -468,9 +478,7 @@ cargo_target_dir() {
|
|||||||
cargo_update_crates () {
|
cargo_update_crates () {
|
||||||
debug-print-function ${FUNCNAME} "$@"
|
debug-print-function ${FUNCNAME} "$@"
|
||||||
|
|
||||||
if [[ -z ${CARGO} ]]; then
|
_cargo_check_initialized
|
||||||
die "CARGO is not set; was rust_pkg_setup run?"
|
|
||||||
fi
|
|
||||||
|
|
||||||
local path=${1:-"${S}/Cargo.toml"}
|
local path=${1:-"${S}/Cargo.toml"}
|
||||||
if [[ $# -gt 1 ]]; then
|
if [[ $# -gt 1 ]]; then
|
||||||
@ -534,7 +542,7 @@ cargo_src_unpack() {
|
|||||||
popd >/dev/null || die
|
popd >/dev/null || die
|
||||||
|
|
||||||
if [[ ${#crates[@]} -ge 300 ]]; then
|
if [[ ${#crates[@]} -ge 300 ]]; then
|
||||||
eqawarn "This package uses a very large number of CRATES. Please provide"
|
eqawarn "QA Notice: This package uses a very large number of CRATES. Please provide"
|
||||||
eqawarn "a crate tarball instead and fetch it via SRC_URI. You can use"
|
eqawarn "a crate tarball instead and fetch it via SRC_URI. You can use"
|
||||||
eqawarn "'pycargoebuild --crate-tarball' to create one."
|
eqawarn "'pycargoebuild --crate-tarball' to create one."
|
||||||
fi
|
fi
|
||||||
@ -553,6 +561,8 @@ cargo_live_src_unpack() {
|
|||||||
[[ "${PV}" == *9999* ]] || die "${FUNCNAME} only allowed in live/9999 ebuilds"
|
[[ "${PV}" == *9999* ]] || die "${FUNCNAME} only allowed in live/9999 ebuilds"
|
||||||
[[ "${EBUILD_PHASE}" == unpack ]] || die "${FUNCNAME} only allowed in src_unpack"
|
[[ "${EBUILD_PHASE}" == unpack ]] || die "${FUNCNAME} only allowed in src_unpack"
|
||||||
|
|
||||||
|
_cargo_check_initialized
|
||||||
|
|
||||||
mkdir -p "${S}" || die
|
mkdir -p "${S}" || die
|
||||||
mkdir -p "${ECARGO_VENDOR}" || die
|
mkdir -p "${ECARGO_VENDOR}" || die
|
||||||
mkdir -p "${ECARGO_HOME}" || die
|
mkdir -p "${ECARGO_HOME}" || die
|
||||||
@ -778,9 +788,7 @@ cargo_env() {
|
|||||||
cargo_src_compile() {
|
cargo_src_compile() {
|
||||||
debug-print-function ${FUNCNAME} "$@"
|
debug-print-function ${FUNCNAME} "$@"
|
||||||
|
|
||||||
if [[ -z "${CARGO}" ]]; then
|
_cargo_check_initialized
|
||||||
die "CARGO is not set; was rust_pkg_setup run?"
|
|
||||||
fi
|
|
||||||
|
|
||||||
set -- "${CARGO}" build $(usex debug "" --release) ${ECARGO_ARGS[@]} "$@"
|
set -- "${CARGO}" build $(usex debug "" --release) ${ECARGO_ARGS[@]} "$@"
|
||||||
einfo "${@}"
|
einfo "${@}"
|
||||||
@ -796,9 +804,7 @@ cargo_src_compile() {
|
|||||||
cargo_src_install() {
|
cargo_src_install() {
|
||||||
debug-print-function ${FUNCNAME} "$@"
|
debug-print-function ${FUNCNAME} "$@"
|
||||||
|
|
||||||
if [[ -z "${CARGO}" ]]; then
|
_cargo_check_initialized
|
||||||
die "CARGO is not set; was rust_pkg_setup run?"
|
|
||||||
fi
|
|
||||||
|
|
||||||
set -- "${CARGO}" install $(has --path ${@} || echo --path ./) \
|
set -- "${CARGO}" install $(has --path ${@} || echo --path ./) \
|
||||||
--root "${ED}/usr" \
|
--root "${ED}/usr" \
|
||||||
@ -818,9 +824,7 @@ cargo_src_install() {
|
|||||||
cargo_src_test() {
|
cargo_src_test() {
|
||||||
debug-print-function ${FUNCNAME} "$@"
|
debug-print-function ${FUNCNAME} "$@"
|
||||||
|
|
||||||
if [[ -z "${CARGO}" ]]; then
|
_cargo_check_initialized
|
||||||
die "CARGO is not set; was rust_pkg_setup run?"
|
|
||||||
fi
|
|
||||||
|
|
||||||
set -- "${CARGO}" test $(usex debug "" --release) ${ECARGO_ARGS[@]} "$@"
|
set -- "${CARGO}" test $(usex debug "" --release) ${ECARGO_ARGS[@]} "$@"
|
||||||
einfo "${@}"
|
einfo "${@}"
|
||||||
|
Loading…
Reference in New Issue
Block a user