All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v5 1/3] package/pkg-cargo: add support to bundle a custom Cargo.lock file
@ 2025-09-30  8:07 Thomas Devoogdt
  2025-09-30  8:07 ` [Buildroot] [PATCH v5 2/3] package/cargo-c: add new package Thomas Devoogdt
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Thomas Devoogdt @ 2025-09-30  8:07 UTC (permalink / raw)
  To: buildroot
  Cc: Eric Le Bihan, Fabrice Fontaine, Guillaume Chaye, Thomas Devoogdt

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
v4: no change
v4: 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

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-02-04 14:10 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-30  8:07 [Buildroot] [PATCH v5 1/3] package/pkg-cargo: add support to bundle a custom Cargo.lock file Thomas Devoogdt
2025-09-30  8:07 ` [Buildroot] [PATCH v5 2/3] package/cargo-c: add new package Thomas Devoogdt
2025-09-30  8:07 ` [Buildroot] [PATCH v5 3/3] package/librsvg: bump version to 2.61.1 Thomas Devoogdt
2025-10-11  8:56 ` [Buildroot] [PATCH v5 1/3] package/pkg-cargo: add support to bundle a custom Cargo.lock file Thomas Devoogdt
2025-10-19  6:45   ` [Buildroot] [PATCH v6 " Thomas Devoogdt
2025-10-19  6:45     ` [Buildroot] [PATCH v6 2/3] package/cargo-c: add new package Thomas Devoogdt
2025-10-19  6:45     ` [Buildroot] [PATCH v6] package/librsvg: bump version to 2.61.1 Thomas Devoogdt
2026-01-01 17:00       ` Thomas Petazzoni via buildroot
2026-01-03 11:20         ` Thomas Devoogdt
2026-01-01 16:36     ` [Buildroot] [PATCH v6 1/3] package/pkg-cargo: add support to bundle a custom Cargo.lock file Thomas Petazzoni via buildroot
2026-02-04 14:10       ` [Buildroot] [PATCH v7 1/2] package/pkg-cargo: add support for prevendored Cargo.lock Thomas Devoogdt
2026-02-04 14:10         ` [Buildroot] [PATCH v7 2/2] package/cargo-c: add new package Thomas Devoogdt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.