From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Fri, 19 Apr 2024 11:49:16 +0200 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rxkrs-007H14-0x for lore@lore.pengutronix.de; Fri, 19 Apr 2024 11:49:16 +0200 Received: from localhost ([127.0.0.1] helo=metis.whiteo.stw.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1rxkrs-0005Ez-0R; Fri, 19 Apr 2024 11:49:16 +0200 Received: from mail.thorsis.com ([217.92.40.78]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rxkrV-0005Eg-GD; Fri, 19 Apr 2024 11:48:54 +0200 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 9C994148D4F0; Fri, 19 Apr 2024 11:48:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thorsis.com; s=dkim; t=1713520132; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=rtvAn7ATiTxiwsBT6lIL3MLSRgsKfy/NIxh4gvBsIIg=; b=G24EZ69E9nVhvrurUTh54sLBvAkz3+okbURQtRCt63QG/MA36kFlJY7RJCOWVekAhDrh27 m4TOQv/8Sfl0KUWJvdidNyTTa+h7AXCI5fenQNFNDqll+Due1tn5v1wqrsrJOoyGSy2b3p RxnCD2t8pgiQdYYF7GwwZNn/nA1wHCaFCOv6YsoTWmuW8hfTByKi3a8ycTbSUne5401o7c U0j5k69uE3rF+luntspiftGniqlbSMQn1hCN/zMS96I2ldZQiOxQOt5Gp4oPG+Haym0Fxl VtTqufC9nr38d8I5r3vpB2L6Qft8dr1VRmUenOpNM8qePdISqrTadXQoBKiYSw== From: Alexander Dahl To: ptxdist@pengutronix.de Date: Fri, 19 Apr 2024 11:48:51 +0200 Message-ID: <2397228.ElGaqSPkdT@ada-pc> In-Reply-To: <20220129070330.2601433-4-michael.riesch@wolfvision.net> References: <20220129070330.2601433-1-michael.riesch@wolfvision.net> <20220129070330.2601433-4-michael.riesch@wolfvision.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Clacks-Overhead: GNU Terry Pratchett X-Last-TLS-Session-Version: TLSv1.3 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.whiteo.stw.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-3.0 required=4.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Subject: Re: [ptxdist] [PATCH v6 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: Michael Olbrich , m.tretter@pengutronix.de, Michael Riesch 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.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false Hei hei, sorry for digging up this old discussion, but I kind of want to use this=20 approach and =E2=80=A6 see below. Am Samstag, 29. Januar 2022, 08:03:28 CEST schrieb Michael Riesch: > 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). Currently trying to build recent U-Boot for i.MX8 and i.MX9 based boards wh= ich=20 require additional firmware. However I still want to build OOT to keep my= =20 source tree clean, especially when building with an external tree (after=20 `ptxdist local-src u-boot $HOME/src/u-boot`). Now U-Boot needs those binaries in the build tree, it does not work using t= his=20 nice inject mechanism putting it in the source tree. >=20 > Signed-off-by: Michael Riesch > --- >=20 > Notes: > v6: > - replaced 'break' with 'return' >=20 > 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 >=20 > 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 conditio= ns > +# see the README file. > +# > + > +world/inject/env =3D \ > + $(call world/env, $(1)) \ > + pkg_inject_path=3D"$($(1)_INJECT_PATH)" \ > + pkg_inject_files=3D"$($(1)_INJECT_FILES)" \ > + pkg_source=3D"$($(1)_DIR)" Here _DIR is assigned to pkg_source which makes the source dir the tar= get=20 folder. Did anyone already think of how to extend this approach to be more flexible= =20 for the target folder? Maybe even without damaging existing use cases? Maybe adding a new optional variable _INJECT_DEST which defaults to=20 _DIR and can be overridden? Greets Alex > + > +world/inject =3D \ > + $(call world/inject/env,$(strip $(1))) \ > + ptxd_make_world_inject > + > +# vim: syntax=3Dmake > diff --git a/scripts/lib/ptxd_make_world_inject.sh > b/scripts/lib/ptxd_make_world_inject.sh new file mode 100644 > index 000000000..fe4eb8363 > --- /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 conditio= ns > +# see the README file. > +# > + > +ptxd_make_inject() { > + local source target > + > + source=3D"$(echo ${inject_file} | cut -d ":" -f 1)" > + target=3D"${pkg_source}/$(echo ${inject_file} | cut -d ":" -f 2)" > + if [ -z "${target}" ]; then > + target=3D"${source}" > + fi > + > + if [[ "${source}" =3D~ ^/.* ]]; 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=3D"${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 || return > + > + for inject_file in ${pkg_inject_files}; do > + ptxd_make_inject || return > + done > +} > +export -f ptxd_make_world_inject