From f38e706a807d7f0fb9821f9760bd0f9fa13272a4 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Fri, 7 Jun 2024 19:05:49 +0200 Subject: [PATCH] support/download: pass post-process options to post-process helper Currently, we have no explicit, dedicated way to pass information to the download post-process scripts, even though we do already need to pass the path to the manifest when it is not the default, which we do with an environment variable. We'll soon need to be able to pass additional information to post-process scripts, like instructing cargo to not use a lock file when the package is not locked. Extend the dl-wrapper with a new option with an argument, where the argument will be passed as-is to the post-process script. We explicitly do not document this new variable, as it is expected to only be used in our package infrastructures (although there is currently exactly one package that will directly need it, and we hope to drop that in the future). Signed-off-by: Yann E. MORIN Cc: Thomas Petazzoni Signed-off-by: Arnout Vandecappelle --- package/pkg-generic.mk | 1 + support/download/dl-wrapper | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index 06d2c9560e..0d84fc3773 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -186,6 +186,7 @@ $(BUILD_DIR)/%/.stamp_downloaded: $(call DOWNLOAD, \ $($(PKG)_MAIN_DOWNLOAD), \ $(patsubst %,-p '%',$($(PKG)_DOWNLOAD_POST_PROCESS)) \ + $(patsubst %,-P '%',$($(PKG)_DOWNLOAD_POST_PROCESS_OPTS)) \ ) \ ) $(foreach p,$($(PKG)_ADDITIONAL_DOWNLOADS),$(call DOWNLOAD,$(p))$(sep)) diff --git a/support/download/dl-wrapper b/support/download/dl-wrapper index 239bdfa359..5445aad5a7 100755 --- a/support/download/dl-wrapper +++ b/support/download/dl-wrapper @@ -25,10 +25,10 @@ export BR_BACKEND_DL_GETOPTS=":hc:d:o:n:N:H:lru:qf:e" main() { local OPT OPTARG local backend output large_file recurse quiet rc - local -a uris hfiles backend_opts + local -a uris hfiles backend_opts post_process_opts # Parse our options; anything after '--' is for the backend - while getopts ":c:d:D:o:n:N:H:lrf:u:qp:" OPT; do + while getopts ":c:d:D:o:n:N:H:lrf:u:qp:P:" OPT; do case "${OPT}" in c) cset="${OPTARG}";; d) dl_dir="${OPTARG}";; @@ -42,6 +42,7 @@ main() { f) filename="${OPTARG}";; u) uris+=( "${OPTARG}" );; p) post_process="${OPTARG}";; + P) post_process_opts+=( "${OPTARG}" );; q) quiet="-q";; :) error "option '%s' expects a mandatory argument\n" "${OPTARG}";; \?) error "unknown option '%s'\n" "${OPTARG}";; @@ -152,7 +153,8 @@ main() { if [ -n "${post_process}" ] ; then if ! "${OLDPWD}/support/download/${post_process}-post-process" \ -o "${tmpf}" \ - -n "${raw_base_name}" + -n "${raw_base_name}" \ + "${post_process_opts[@]}" then # cd back to keep path coherence cd "${OLDPWD}"