mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Michael Olbrich <m.olbrich@pengutronix.de>
To: Michael Riesch <michael.riesch@wolfvision.net>
Cc: ptxdist@pengutronix.de, m.tretter@pengutronix.de
Subject: Re: [ptxdist] [PATCH v5 3/5] scripts: add helper to inject files into a source directory
Date: Fri, 28 Jan 2022 13:27:44 +0100	[thread overview]
Message-ID: <YfPhQJguhFwa4R2a@pengutronix.de> (raw)
In-Reply-To: <20220124120942.557161-4-michael.riesch@wolfvision.net>

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 <michael.riesch@wolfvision.net>
> ---
>  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 <michael.riesch@wolfvision.net>
> +#
> +# 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 <michael.riesch@wolfvision.net>
> +#
> +# 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 <PKG>_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


  reply	other threads:[~2022-01-28 12:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-24 12:09 [ptxdist] [PATCH v5 0/5] Add support for Rockchip firmware blobs Michael Riesch
2022-01-24 12:09 ` [ptxdist] [PATCH v5 1/5] platforms: add section for non-free " Michael Riesch
2022-01-24 12:09 ` [ptxdist] [PATCH v5 2/5] add package for rockchip firmware binaries Michael Riesch
2022-01-28 12:31   ` Michael Olbrich
2022-01-28 12:46     ` Michael Riesch
2022-01-28 12:59       ` Michael Olbrich
2022-01-28 13:46         ` Michael Riesch
2022-01-24 12:09 ` [ptxdist] [PATCH v5 3/5] scripts: add helper to inject files into a source directory Michael Riesch
2022-01-28 12:27   ` Michael Olbrich [this message]
2022-01-24 12:09 ` [ptxdist] [PATCH v5 4/5] barebox: add integration of firmware blobs Michael Riesch
2022-01-28 12:28   ` Michael Olbrich
2022-01-24 12:09 ` [ptxdist] [RFC PATCH v5 5/5] barebox.rockchip: add binary firmware blobs for quartz64 and rk3568-evb1 Michael Riesch
2022-01-28 12:33   ` Michael Olbrich
2022-01-28 15:26     ` Michael Riesch
2022-01-28 16:10       ` Michael Olbrich
2022-01-28 16:48         ` Michael Riesch
2022-01-28 20:08           ` Michael Olbrich

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=YfPhQJguhFwa4R2a@pengutronix.de \
    --to=m.olbrich@pengutronix.de \
    --cc=m.tretter@pengutronix.de \
    --cc=michael.riesch@wolfvision.net \
    --cc=ptxdist@pengutronix.de \
    /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