public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-dev] [PATCH] cargo.eclass: Support PKGBUMPING to avoid fetching/unpacking crates
Date: Sun, 24 Dec 2023 13:31:15 +0100	[thread overview]
Message-ID: <20231224123115.87410-1-mgorny@gentoo.org> (raw)

Support using the PKGBUMPING variable set by pkgbump/pkgdiff-mg to avoid
respectively fetching and unpacking crates, to speed up using these
tools.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/cargo.eclass | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
index 1e1a6e3ddfe2..b66b7247bd97 100644
--- a/eclass/cargo.eclass
+++ b/eclass/cargo.eclass
@@ -175,6 +175,9 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo"
 # If no arguments are provided, it uses the CRATES variable.
 # The value is set as CARGO_CRATE_URIS.
 _cargo_set_crate_uris() {
+	# when called by pkgbump, do not fetch crates
+	[[ ${PKGBUMPING} == ${PVR} ]] && return
+
 	local -r regex='^([a-zA-Z0-9_\-]+)-([0-9]+\.[0-9]+\.[0-9]+.*)$'
 	local crates=${1}
 	local crate
@@ -331,6 +334,9 @@ cargo_src_unpack() {
 	for archive in ${A}; do
 		case "${archive}" in
 			*.crate)
+				# 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
-- 
2.43.0



                 reply	other threads:[~2023-12-24 12:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231224123115.87410-1-mgorny@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox