mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH 1/2] script: add ptxd_make_world_inject from ptxdist
       [not found] <20250801-yoga-tamale-cc41d69ec18e@thorsis.com>
@ 2025-08-01  9:45 ` Lars Schmidt
  2025-08-01  9:45   ` [ptxdist] [PATCH 2/2] scripts: create target path in ptxd_make_world_inject Lars Schmidt
  2025-08-01 11:53   ` [ptxdist] [PATCH 1/2] script: add ptxd_make_world_inject from ptxdist Alexander Dahl via ptxdist
  0 siblings, 2 replies; 3+ messages in thread
From: Lars Schmidt @ 2025-08-01  9:45 UTC (permalink / raw)
  To: ptxdist; +Cc: Lars Schmidt

Copy the script from ptxdist v2025.07.0 as preparation for
upcoming changes.

Signed-off-by: Lars Schmidt <l.schmidt@pengutronix.de>
---

Hi Alex,

good point. I've changed the commit message accordingly.

Greets
Lars

 scripts/lib/ptxd_make_world_inject.sh | 60 +++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 scripts/lib/ptxd_make_world_inject.sh

diff --git a/scripts/lib/ptxd_make_world_inject.sh b/scripts/lib/ptxd_make_world_inject.sh
new file mode 100644
index 0000000..e8e94fb
--- /dev/null
+++ b/scripts/lib/ptxd_make_world_inject.sh
@@ -0,0 +1,60 @@
+#!/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="${inject_dest}/$(echo ${inject_file} | cut -d ":" -f 2)"
+
+    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 || return
+
+    if [ -z "${pkg_inject_oot}" ]; then
+	pkg_inject_oot=NO
+    fi
+
+    case "${pkg_inject_oot}" in
+	"YES") inject_dest="${pkg_build_dir}" ;;
+	"NO")  inject_dest="${pkg_dir}" ;;
+	*)     ptxd_bailout "<PKG>_INJECT_OOT: please set to YES or NO" ;;
+    esac
+
+    if [ "${pkg_build_oot:-NO}" = 'NO' ] && [ "${pkg_inject_oot}" != 'NO' ]; then
+	ptxd_warning "<PKG>_BUILD_OOT and <PKG>_INJECT_OOT contradict each other." \
+	    "Using $(ptxd_print_path ${inject_dest}) as inject destination anyways."
+    fi
+
+    if [ ! -d "${inject_dest}" ]; then
+	ptxd_bailout "<PKG> inject destination dir missing." \
+	    "Correct placement of world/inject depends on <PKG>_BUILD_OOT and <PKG>_INJECT_OOT." \
+	    "Check order of calls in prepare stage!"
+    fi
+
+    for inject_file in ${pkg_inject_files}; do
+	ptxd_make_inject || return
+    done
+}
+export -f ptxd_make_world_inject
-- 
2.39.5




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

* [ptxdist] [PATCH 2/2] scripts: create target path in ptxd_make_world_inject
  2025-08-01  9:45 ` [ptxdist] [PATCH 1/2] script: add ptxd_make_world_inject from ptxdist Lars Schmidt
@ 2025-08-01  9:45   ` Lars Schmidt
  2025-08-01 11:53   ` [ptxdist] [PATCH 1/2] script: add ptxd_make_world_inject from ptxdist Alexander Dahl via ptxdist
  1 sibling, 0 replies; 3+ messages in thread
From: Lars Schmidt @ 2025-08-01  9:45 UTC (permalink / raw)
  To: ptxdist; +Cc: Lars Schmidt

If the target path does not exist, the files are not copied.
To avoid that, create the target path in advance to copying the files.
Patch copied from ptxdist, see [1].

[1]: https://lore.ptxdist.org/ptxdist/20250801092153.610071-1-l.schmidt@pengutronix.de/

Signed-off-by: Lars Schmidt <l.schmidt@pengutronix.de>
---

Added a reference to the ptxdist patch

 scripts/lib/ptxd_make_world_inject.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/lib/ptxd_make_world_inject.sh b/scripts/lib/ptxd_make_world_inject.sh
index e8e94fb..a31184d 100644
--- a/scripts/lib/ptxd_make_world_inject.sh
+++ b/scripts/lib/ptxd_make_world_inject.sh
@@ -24,6 +24,7 @@ ptxd_make_inject() {
 
     echo -e "\nInject file $(ptxd_print_path ${source}) into" \
 	 "$(ptxd_print_path ${target})..."
+    mkdir -p "$(dirname "${target}")"
     cp ${source} ${target}
 }
 export -f ptxd_make_inject
-- 
2.39.5




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

* Re: [ptxdist] [PATCH 1/2] script: add ptxd_make_world_inject from ptxdist
  2025-08-01  9:45 ` [ptxdist] [PATCH 1/2] script: add ptxd_make_world_inject from ptxdist Lars Schmidt
  2025-08-01  9:45   ` [ptxdist] [PATCH 2/2] scripts: create target path in ptxd_make_world_inject Lars Schmidt
@ 2025-08-01 11:53   ` Alexander Dahl via ptxdist
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Dahl via ptxdist @ 2025-08-01 11:53 UTC (permalink / raw)
  To: Lars Schmidt; +Cc: Alexander Dahl, ptxdist

Hello Lars,

Am Fri, Aug 01, 2025 at 11:45:02AM +0200 schrieb Lars Schmidt:
> Copy the script from ptxdist v2025.07.0 as preparation for
> upcoming changes.
> 
> Signed-off-by: Lars Schmidt <l.schmidt@pengutronix.de>
> ---
> 
> Hi Alex,
> 
> good point. I've changed the commit message accordingly.

This series should have gone to the DistroKit list, right? ;-)

Greets
Alex



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

end of thread, other threads:[~2025-08-01 11:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20250801-yoga-tamale-cc41d69ec18e@thorsis.com>
2025-08-01  9:45 ` [ptxdist] [PATCH 1/2] script: add ptxd_make_world_inject from ptxdist Lars Schmidt
2025-08-01  9:45   ` [ptxdist] [PATCH 2/2] scripts: create target path in ptxd_make_world_inject Lars Schmidt
2025-08-01 11:53   ` [ptxdist] [PATCH 1/2] script: add ptxd_make_world_inject from ptxdist Alexander Dahl via ptxdist

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox