From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Fri, 28 Jan 2022 13:27:55 +0100 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nDQM7-00FykC-IZ for lore@lore.pengutronix.de; Fri, 28 Jan 2022 13:27:55 +0100 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1nDQM6-0002jA-QC; Fri, 28 Jan 2022 13:27:54 +0100 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nDQLy-0002hF-9I; Fri, 28 Jan 2022 13:27:46 +0100 Received: from [2a0a:edc0:0:1101:1d::39] (helo=dude03.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1nDQLy-00CyiN-7k; Fri, 28 Jan 2022 13:27:45 +0100 Received: from mol by dude03.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1nDQLw-00GprF-EC; Fri, 28 Jan 2022 13:27:44 +0100 Date: Fri, 28 Jan 2022 13:27:44 +0100 From: Michael Olbrich To: Michael Riesch Message-ID: Mail-Followup-To: Michael Riesch , ptxdist@pengutronix.de, m.tretter@pengutronix.de References: <20220124120942.557161-1-michael.riesch@wolfvision.net> <20220124120942.557161-4-michael.riesch@wolfvision.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220124120942.557161-4-michael.riesch@wolfvision.net> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain Subject: Re: [ptxdist] [PATCH v5 3/5] scripts: add helper to inject files into a source directory X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Cc: ptxdist@pengutronix.de, m.tretter@pengutronix.de Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false On Mon, Jan 24, 2022 at 01:09:40PM +0100, Michael Riesch wrote: > Some packages may require certain files that are maintained > or generated outside of their source repository. For example, > binary firmware blobs could be excluded from the sources due > to licensing issues. Add a helper that allows to inject certain > files into the source directory (usually in the prepare stage). > > Signed-off-by: Michael Riesch > --- > rules/post/ptxd_make_world_inject.make | 19 ++++++++++++ > scripts/lib/ptxd_make_world_inject.sh | 42 ++++++++++++++++++++++++++ > 2 files changed, 61 insertions(+) > create mode 100644 rules/post/ptxd_make_world_inject.make > create mode 100644 scripts/lib/ptxd_make_world_inject.sh > > diff --git a/rules/post/ptxd_make_world_inject.make b/rules/post/ptxd_make_world_inject.make > new file mode 100644 > index 000000000..b7d28e92f > --- /dev/null > +++ b/rules/post/ptxd_make_world_inject.make > @@ -0,0 +1,19 @@ > +# -*-makefile-*- > +# > +# Copyright (C) 2021 by Michael Riesch > +# > +# For further information about the PTXdist project and license conditions > +# see the README file. > +# > + > +world/inject/env = \ > + $(call world/env, $(1)) \ > + pkg_inject_path="$($(1)_INJECT_PATH)" \ > + pkg_inject_files="$($(1)_INJECT_FILES)" \ > + pkg_source="$($(1)_DIR)" > + > +world/inject = \ > + $(call world/inject/env,$(strip $(1))) \ > + ptxd_make_world_inject > + > +# vim: syntax=make > diff --git a/scripts/lib/ptxd_make_world_inject.sh b/scripts/lib/ptxd_make_world_inject.sh > new file mode 100644 > index 000000000..c2e45ad42 > --- /dev/null > +++ b/scripts/lib/ptxd_make_world_inject.sh > @@ -0,0 +1,42 @@ > +#!/bin/bash > +# > +# Copyright (C) 2021 by Michael Riesch > +# > +# For further information about the PTXdist project and license conditions > +# see the README file. > +# > + > +ptxd_make_inject() { > + local source target > + > + source="$(echo ${inject_file} | cut -d ":" -f 1)" > + target="${pkg_source}/$(echo ${inject_file} | cut -d ":" -f 2)" > + if [ -z "${target}" ]; then > + target="${source}" > + fi > + > + if [[ "${source}" =~ ^/.* ]]; then > + ptxd_bailout "'${source}' must not be an absolute path!" \ > + "Use _INJECT_PATH to specify the search path." > + fi > + > + if ! ptxd_in_path pkg_inject_path "${source}"; then > + ptxd_bailout "Blob '${source}' not found in '${pkg_inject_path}'." > + fi > + source="${ptxd_reply}" > + > + echo -e "\nInject file $(ptxd_print_path ${source}) into" \ > + "$(ptxd_print_path ${target})..." > + cp ${source} ${target} > +} > +export -f ptxd_make_inject > + > + > +ptxd_make_world_inject() { > + ptxd_make_world_init || break 'return' instead of 'break' > + > + for inject_file in ${pkg_inject_files}; do > + ptxd_make_inject || break same here. Otherwise, the failure won't be propagated. I missed that in the last review but luckily it failed when I tested it because the barebox version I used didn't have the target directory... Michael > + done > +} > +export -f ptxd_make_world_inject > -- > 2.30.2 > > > _______________________________________________ > ptxdist mailing list > ptxdist@pengutronix.de > To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de