From: Thomas Devoogdt <thomas@devoogdt.com>
To: buildroot@buildroot.org
Cc: Eric Le Bihan <eric.le.bihan.dev@free.fr>,
Fabrice Fontaine <fontaine.fabrice@gmail.com>,
Guillaume Chaye <guillaume.chaye@zeetim.com>,
Thomas Devoogdt <thomas@devoogdt.com>
Subject: [Buildroot] [PATCH v3 1/3] package/pkg-cargo: add support to bundle a custom Cargo.lock file
Date: Thu, 25 Sep 2025 22:06:09 +0200 [thread overview]
Message-ID: <20250925200611.206010-1-thomas@devoogdt.com> (raw)
E.g. https://github.com/lu-zero/cargo-c/releases/tag/v0.10.15
Cargo-c releases a separate Cargo.lock file, but doesn't bundle
one in its normal .tar.gz code source target.
We can't use extra downloads/patches/... as cargo is a vendored
package, which is done quite early in the chain.
This patch allows us to define a custom Cargo.lock source.
Both a local bundled file and remote (only wget) file can be linked.
Usage:
<PKG>_CARGO_LOCK_FILE = <PKG>_PKGDIR/Cargo.lock
<PKG>_CARGO_LOCK_FILE = https://.../Cargo.lock
Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
---
Superseeds https://patchwork.ozlabs.org/project/buildroot/patch/20250324173246.100112-1-guillaume.chaye@zeetim.com/.
v2: no change
v3: no change
---
package/pkg-cargo.mk | 5 +++++
support/download/cargo-post-process | 14 +++++++++++++-
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/package/pkg-cargo.mk b/package/pkg-cargo.mk
index 47a6353f25..626e5ea472 100644
--- a/package/pkg-cargo.mk
+++ b/package/pkg-cargo.mk
@@ -195,6 +195,11 @@ ifneq ($$($(2)_SUBDIR),)
$(2)_DOWNLOAD_POST_PROCESS_OPTS += -m$$($(2)_SUBDIR)/Cargo.toml
endif
+# Allow to download a custom Cargo.lock file.
+ifneq ($$($(3)_CARGO_LOCK_FILE),)
+$(2)_DOWNLOAD_POST_PROCESS_OPTS += -l$$($(3)_CARGO_LOCK_FILE)
+endif
+
# Because we append vendored info, we can't rely on the values being empty
# once we eventually get into the generic-package infra. So, we duplicate
# the heuristics here
diff --git a/support/download/cargo-post-process b/support/download/cargo-post-process
index b0e59ad74d..7913724fe2 100755
--- a/support/download/cargo-post-process
+++ b/support/download/cargo-post-process
@@ -11,11 +11,12 @@ if [ "${BR_CARGO_MANIFEST_PATH}" ]; then
fi
manifest=Cargo.toml
-while getopts "n:o:m:" OPT; do
+while getopts "n:o:m:l:" OPT; do
case "${OPT}" in
o) output="${OPTARG}";;
n) base_name="${OPTARG}";;
m) manifest="${OPTARG}";;
+ l) lockfile="${OPTARG}";;
:) error "option '%s' expects a mandatory argument\n" "${OPTARG}";;
\?) error "unknown option '%s'\n" "${OPTARG}";;
esac
@@ -31,6 +32,17 @@ post_process_unpack "${base_name}" "${output}"
# Do the Cargo vendoring
pushd "${base_name}" > /dev/null
+# Copy the custom lockfile path if given
+# TODO: use --lockfile-path once stable
+if [ -n "${lockfile}" ] ; then
+ rm -f "${lockfile}"
+ if [ -f "${lockfile}" ] ; then
+ cp "${lockfile}" Cargo.lock
+ else
+ ${WGET} "${lockfile}" -O Cargo.lock
+ fi
+fi
+
# Create the local .cargo/config.toml with vendor info
mkdir -p .cargo/
mkdir -p "${CARGO_HOME}"
--
2.43.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next reply other threads:[~2025-09-25 20:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-25 20:06 Thomas Devoogdt [this message]
2025-09-25 20:06 ` [Buildroot] [PATCH v3 2/3] package/cargo-c: add new package Thomas Devoogdt
2025-09-25 20:06 ` [Buildroot] [PATCH v3 3/3] package/librsvg: bump version to 2.61.1 Thomas Devoogdt
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=20250925200611.206010-1-thomas@devoogdt.com \
--to=thomas@devoogdt.com \
--cc=buildroot@buildroot.org \
--cc=eric.le.bihan.dev@free.fr \
--cc=fontaine.fabrice@gmail.com \
--cc=guillaume.chaye@zeetim.com \
/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