Re: [ptxdist] [PATCH 1/2] ppp: patch: Makefile add chap_ms.h into headers

2023-11-10 Thread Michael Olbrich
On Tue, Nov 07, 2023 at 03:02:09PM +0100, Lars Pedersen wrote:
> Patch to fix compile error in NetworkManager pppd part:
> 
> nm-pppd-compat.c:50:10: fatal error: pppd/chap_ms.h: No such file or
> directory

No. This file is installed with PTXCONF_PPP_MS_CHAP=y. NetworkManager needs
to select that.

Michael

> Signed-off-by: Lars Pedersen 
> ---
>  ...02-makefile-add-chap_ms-into-headers.patch | 25 +++
>  patches/ppp-2.4.9/series  |  1 +
>  2 files changed, 26 insertions(+)
>  create mode 100644 
> patches/ppp-2.4.9/0202-makefile-add-chap_ms-into-headers.patch
> 
> diff --git a/patches/ppp-2.4.9/0202-makefile-add-chap_ms-into-headers.patch 
> b/patches/ppp-2.4.9/0202-makefile-add-chap_ms-into-headers.patch
> new file mode 100644
> index 0..bd05aafff
> --- /dev/null
> +++ b/patches/ppp-2.4.9/0202-makefile-add-chap_ms-into-headers.patch
> @@ -0,0 +1,25 @@
> +From 2ea8d8a07be3af9693eed1f1bf867f499c61a762 Mon Sep 17 00:00:00 2001
> +From: Lars Pedersen 
> +Date: Sat, 4 Nov 2023 13:49:08 +
> +Subject: [PATCH 1/1] Add chap_ms.h header
> +
> +---
> + pppd/Makefile.linux | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/pppd/Makefile.linux b/pppd/Makefile.linux
> +index 9b0119463c1f..ae2a1d80192d 100644
> +--- a/pppd/Makefile.linux
>  b/pppd/Makefile.linux
> +@@ -21,7 +21,7 @@ PPPDSRCS = main.c magic.c fsm.c lcp.c ipcp.c upap.c 
> chap-new.c ccp.c \
> + 
> + HEADERS = ccp.h session.h chap-new.h ecp.h fsm.h ipcp.h \
> + ipxcp.h lcp.h magic.h patchlevel.h pathnames.h pppd.h \
> +-upap.h eap.h
> ++upap.h eap.h chap_ms.h
> + 
> + MANPAGES = pppd.8
> + PPPDOBJS = main.o magic.o fsm.o lcp.o ipcp.o upap.o chap-new.o ccp.o \
> +-- 
> +2.41.0
> +
> diff --git a/patches/ppp-2.4.9/series b/patches/ppp-2.4.9/series
> index 4028f0892..7655fc9f7 100644
> --- a/patches/ppp-2.4.9/series
> +++ b/patches/ppp-2.4.9/series
> @@ -14,4 +14,5 @@
>  #tag:ptx --start-number 200
>  0200-pppd-make-makefile-sysroot-aware.patch
>  0201-pppd-make-the-self-made-configure-cross-aware.patch
> +0202-makefile-add-chap_ms-into-headers.patch
>  # 9c9016a8956cf8c0dc84ee8dbe803cf3  - git-ptx-patches magic
> -- 
> 2.41.0
> 
> 
> 

-- 
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- |



[ptxdist] [PATCH] ptxd_make_nested: Fix parameter passing for --dirty, --force and --pedantic

2023-11-10 Thread Uwe Kleine-König
Some variables corresponding to ptxdist parameters use "true" as value
when given, others use "1". PTXDIST_DIRTY, PTXDIST_FORCE and
PTXDIST_PEDANTIC are in the first group according to

git grep -E 'PTXDIST_(DIRTY|FORCE|FEDANTIC)='

. Adapt ptxd_make_nested_ptxdist() accordingly.

Fixes: 5169ae99daf8 ("add support for nested PTXdist execution")
Signed-off-by: Uwe Kleine-König 
---
 scripts/lib/ptxd_make_nested.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/lib/ptxd_make_nested.sh b/scripts/lib/ptxd_make_nested.sh
index cae12bceb377..2c4af5337207 100644
--- a/scripts/lib/ptxd_make_nested.sh
+++ b/scripts/lib/ptxd_make_nested.sh
@@ -46,13 +46,13 @@ ptxd_make_nested_ptxdist() {
 fi
 args=( "cd" "${pkg_workspace}" "&&" "${PTXDIST_TOPDIR}/bin/ptxdist" )
 
-if [ "${PTXDIST_DIRTY}" = 1 ]; then
+if [ "${PTXDIST_DIRTY}" = true ]; then
args[${#args[*]}]="--dirty"
 fi
-if [ "${PTXDIST_FORCE}" = 1 ]; then
+if [ "${PTXDIST_FORCE}" = true ]; then
args[${#args[*]}]="--force"
 fi
-if [ "${PTXDIST_PEDANTIC}" = 1 ]; then
+if [ "${PTXDIST_PEDANTIC}" = true ]; then
args[${#args[*]}]="--pedantic"
 fi
 if [ "${PTXDIST_QUIET}" = 1 ]; then
-- 
2.42.0




[ptxdist] [PATCH] nodejs: explicitly call configure with 'python3'

2023-11-10 Thread Michael Olbrich
This will result in explicitly using the system Python. Otherwise
host-python may be used instead and it may lack support for bz2.

Signed-off-by: Michael Olbrich 
---

Can you try if this patch helps?

Michael

 rules/nodejs.make | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/rules/nodejs.make b/rules/nodejs.make
index 0053f0d71dbb..35521227536a 100644
--- a/rules/nodejs.make
+++ b/rules/nodejs.make
@@ -83,7 +83,8 @@ endif
 $(STATEDIR)/nodejs.prepare:
@$(call targetinfo)
 
-   @$(call world/prepare, NODEJS)
+   @$(call world/execute, NODEJS, \
+   python3 ./configure $(NODEJS_CONF_OPT))
@mkdir -p $(NODEJS_DIR)/out/Release/
@ ln -svf $(PTXDIST_SYSROOT_CROSS)/usr/bin/qemu-cross \
$(NODEJS_DIR)/out/Release/tool-wrapper
-- 
2.39.2




Re: [ptxdist] Error building nodejs in 2023.10.0

2023-11-10 Thread Jean-Claude Monnin
Hi Michael,

Thanks for the reply. I'm using ptxdist-2023.10.0.
Python is called by the node build system, and it looks like it was using the 
host python in my case. Possibly it's because another package selects host 
python; maybe it works if host python isn't there at all.
I'm happy with the workaround, but I see your point of wanting to use system 
python instead. Is there any way to check/fix why it selects host python on my 
system?

Jean-Claude

On Fri, Nov 10, 2023, at 9:00 AM, Michael Olbrich wrote:
> Hallo,
>
> On Wed, Nov 01, 2023 at 05:04:30PM +0100, Jean-Claude Monnin wrote:
>> When trying to build nodejs with the latest ptxdist, I faced an error about 
>> missing a python module `ModuleNotFoundError: No module named '_bz2'` (see 
>> [1]).
>> 
>> I'm not very proficient with ptxdist, so I would like to check if the 
>> solution I came up is correct. Feedback welcome. If solution is ok, feel 
>> free to apply it upstream or ask for a proper email patch.
>> 
>> I think it's due to following issues:
>> - The host python is missing the option to support BZIP2. I added an option 
>> for that.
>> - nodejs.in says it depends on HOST_SYSTEM_PYTHON3, however it seems like 
>> the build isn't using system python but host python built by ptxdist. I 
>> think it should depend on HOST_PYTHON3 and the new HOST_PYTHON3_BZIP2.
>> 
>> See [2] for the patch I applied.
>
> Python in PTXdist is a bit tricky. We don't want to compile Python itself
> just to run a few Python scripts at build-time. That's what
> "host-system-python3" is for. It does not build anything, it just checks
> if Python3 and required packages are installed.
>
> "host-python3" is used when building Python packages for the target.
>
> In this case, it looks like the wrong Python is used. Which ptxdist version
> are you using?
>
> Michael
>
>> Kind regards,
>> Jean-Claude
>> 
>> 
>> [1] Error message
>> 
>> --
>> target: nodejs.prepare
>> --
>> 
>> Node.js configure: Found Python 3.11.2...
>> Traceback (most recent call last):
>>   File 
>> "/home/jean-claude/code/test-ptxdist/platform-nanopi-rk3588/build-target/node-v18.13.0/./configure",
>>  line 28, in 
>> import configure
>>   File 
>> "/home/jean-claude/code/test-ptxdist/platform-nanopi-rk3588/build-target/node-v18.13.0/configure.py",
>>  line 14, in 
>> import bz2
>>   File 
>> "/home/jean-claude/code/test-ptxdist/platform-nanopi-rk3588/sysroot-target/usr/lib/python3.11/bz2.py",
>>  line 17, in 
>> from _bz2 import BZ2Compressor, BZ2Decompressor
>> ModuleNotFoundError: No module named '_bz2'
>> 
>> 
>> [2] possible patch
>> 
>> diff --git a/rules/host-python3.in b/rules/host-python3.in
>> index e15b90571..64f34affa 100644
>> --- a/rules/host-python3.in
>> +++ b/rules/host-python3.in
>> @@ -6,6 +6,7 @@ config HOST_PYTHON3
>> select HOST_LIBFFI
>> select HOST_OPENSSL
>> select HOST_ZLIBif HOST_PYTHON3_ZLIB
>> +   select HOST_BZIP2   if HOST_PYTHON3_BZIP2
>> default y if ALLYES
>> help
>>   Python is an interpreted, interactive,
>> @@ -16,4 +17,7 @@ if HOST_PYTHON3
>>  config HOST_PYTHON3_ZLIB
>> bool
>>  
>> +config HOST_PYTHON3_BZIP2
>> +   bool
>> +
>>  endif
>> diff --git a/rules/nodejs.in b/rules/nodejs.in
>> index 80c6aec21..c75480953 100644
>> --- a/rules/nodejs.in
>> +++ b/rules/nodejs.in
>> @@ -3,7 +3,8 @@
>>  config NODEJS
>> tristate
>> prompt "Node.js   "
>> -   select HOST_SYSTEM_PYTHON3
>> +   select HOST_PYTHON3
>> +   select HOST_PYTHON3_BZIP2
>> select HOST_QEMU
>> select HOST_QEMU_USR
>> select C_ARES
>> 
>> 
>
> -- 
> 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- |



Re: [ptxdist] [PATCH] image-rauc: pick up hook script if it exists

2023-11-10 Thread Michael Olbrich
On Mon, Nov 06, 2023 at 11:55:35AM +0100, Roland Hieber wrote:
> Look for a hook script in any config/images/rauc-hooks.sh in the usual
> search locations, and if one is found, package it into the RAUC bundle
> and reference it in the manifest. Otherwise leave the [hooks] section
> in the manifest empty.

No. This must be explicit. Otherwise, accidentally placing the file in the
wrong location does not result in an error.
Please add an option for it and error out if no script is found.

Michael

> As hooks that should be called by RAUC need to be mentioned in the
> manifest too (in the relevant slot or the [bundle] section), the image
> config will still need to be forked by BSPs in order to adapt the
> manifest for that use case. However, the mechanism to find the hook
> script is then already in place, and can be used as-is.
> 
> Signed-off-by: Roland Hieber 
> ---
>  config/images/rauc.config |  4 
>  platforms/image-rauc.in   |  4 
>  rules/image-rauc.make | 15 +++
>  3 files changed, 23 insertions(+)
> 
> diff --git a/config/images/rauc.config b/config/images/rauc.config
> index e4169cc8cd95..4a6b34deee29 100644
> --- a/config/images/rauc.config
> +++ b/config/images/rauc.config
> @@ -1,6 +1,7 @@
>  image @IMAGE@ {
>   rauc {
>   file root.tar.gz { image = "root.tgz" }
> + @RAUC_HOOK_FILE@
>   manifest = "
>   [update]
>   compatible=@RAUC_BUNDLE_COMPATIBLE@
> @@ -11,6 +12,9 @@ image @IMAGE@ {
>   [bundle]
>   format=@RAUC_BUNDLE_FORMAT@
>  
> + [hooks]
> + @RAUC_HOOK_MANIFEST@
> +
>   [image.rootfs]
>   filename=root.tar.gz
>   "
> diff --git a/platforms/image-rauc.in b/platforms/image-rauc.in
> index 391956a42f81..2850045c313e 100644
> --- a/platforms/image-rauc.in
> +++ b/platforms/image-rauc.in
> @@ -17,6 +17,10 @@ menuconfig IMAGE_RAUC
> To customize the bundle, copy and adapt the genimage configuration
> in configs/images/rauc.config.
>  
> +   If you create a file config/images/rauc-hooks.sh in any PTXDIST_PATH
> +   component, it will be included in the bundle and declared as a hook
> +   script in the manifest.
> +
>  if IMAGE_RAUC
>  
>  config IMAGE_RAUC_DESCRIPTION
> diff --git a/rules/image-rauc.make b/rules/image-rauc.make
> index 23d8d83b5251..860f69834687 100644
> --- a/rules/image-rauc.make
> +++ b/rules/image-rauc.make
> @@ -19,6 +19,10 @@ IMAGE_RAUC := image-rauc
>  IMAGE_RAUC_DIR   := $(BUILDDIR)/$(IMAGE_RAUC)
>  IMAGE_RAUC_IMAGE := $(IMAGEDIR)/update.raucb
>  IMAGE_RAUC_CONFIG:= rauc.config
> +IMAGE_RAUC_HOOK_SCRIPT   := $(call ptx/in-path, PTXDIST_PATH, 
> config/images/rauc-hooks.sh)
> +
> +$(call ptx/cfghash, IMAGE_RAUC, $(IMAGE_RAUC_HOOK_SCRIPT))
> +$(call ptx/cfghash-file, IMAGE_RAUC, $(IMAGE_RAUC_HOOK_SCRIPT))
>  
>  # 
> 
>  # Image
> @@ -36,6 +40,16 @@ ifdef PTXCONF_IMAGE_RAUC_BUNDLE_FORMAT_CRYPT
>  IMAGE_RAUC_BUNDLE_FORMAT := "crypt"
>  endif
>  
> +ifneq ($(IMAGE_RAUC_HOOK_SCRIPT),)
> +IMAGE_RAUC_ENV_HOOK = \
> + RAUC_HOOK_FILE="file hooks.sh { image = \\"$(IMAGE_RAUC_HOOK_SCRIPT)\\" 
> }" \
> + RAUC_HOOK_MANIFEST="filename=hooks.sh"
> +else
> +IMAGE_RAUC_ENV_HOOK = \
> + RAUC_HOOK_FILE="" \
> + RAUC_HOOK_MANIFEST=""
> +endif
> +
>  IMAGE_RAUC_ENV   = \
>   $(CODE_SIGNING_ENV) \
>   RAUC_BUNDLE_COMPATIBLE="$(call 
> remove_quotes,$(PTXCONF_RAUC_COMPATIBLE))" \
> @@ -43,6 +57,7 @@ IMAGE_RAUC_ENV  = \
>   RAUC_BUNDLE_VERSION="$(call remove_quotes, 
> $(PTXCONF_RAUC_BUNDLE_VERSION))" \
>   RAUC_BUNDLE_BUILD=$(call ptx/sh, date +%FT%T%z) \
>   RAUC_BUNDLE_DESCRIPTION=$(PTXCONF_IMAGE_RAUC_DESCRIPTION) \
> + $(IMAGE_RAUC_ENV_HOOK) \
>   RAUC_KEY="$(shell cs_get_uri update)" \
>   RAUC_CERT="$(shell cs_get_uri update)" \
>   RAUC_KEYRING="$(shell cs_get_ca update)" \
> -- 
> 2.39.2
> 
> 
> 

-- 
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- |



Re: [ptxdist] Error building nodejs in 2023.10.0

2023-11-10 Thread Michael Olbrich
Hallo,

On Wed, Nov 01, 2023 at 05:04:30PM +0100, Jean-Claude Monnin wrote:
> When trying to build nodejs with the latest ptxdist, I faced an error about 
> missing a python module `ModuleNotFoundError: No module named '_bz2'` (see 
> [1]).
> 
> I'm not very proficient with ptxdist, so I would like to check if the 
> solution I came up is correct. Feedback welcome. If solution is ok, feel free 
> to apply it upstream or ask for a proper email patch.
> 
> I think it's due to following issues:
> - The host python is missing the option to support BZIP2. I added an option 
> for that.
> - nodejs.in says it depends on HOST_SYSTEM_PYTHON3, however it seems like the 
> build isn't using system python but host python built by ptxdist. I think it 
> should depend on HOST_PYTHON3 and the new HOST_PYTHON3_BZIP2.
> 
> See [2] for the patch I applied.

Python in PTXdist is a bit tricky. We don't want to compile Python itself
just to run a few Python scripts at build-time. That's what
"host-system-python3" is for. It does not build anything, it just checks
if Python3 and required packages are installed.

"host-python3" is used when building Python packages for the target.

In this case, it looks like the wrong Python is used. Which ptxdist version
are you using?

Michael

> Kind regards,
> Jean-Claude
> 
> 
> [1] Error message
> 
> --
> target: nodejs.prepare
> --
> 
> Node.js configure: Found Python 3.11.2...
> Traceback (most recent call last):
>   File 
> "/home/jean-claude/code/test-ptxdist/platform-nanopi-rk3588/build-target/node-v18.13.0/./configure",
>  line 28, in 
> import configure
>   File 
> "/home/jean-claude/code/test-ptxdist/platform-nanopi-rk3588/build-target/node-v18.13.0/configure.py",
>  line 14, in 
> import bz2
>   File 
> "/home/jean-claude/code/test-ptxdist/platform-nanopi-rk3588/sysroot-target/usr/lib/python3.11/bz2.py",
>  line 17, in 
> from _bz2 import BZ2Compressor, BZ2Decompressor
> ModuleNotFoundError: No module named '_bz2'
> 
> 
> [2] possible patch
> 
> diff --git a/rules/host-python3.in b/rules/host-python3.in
> index e15b90571..64f34affa 100644
> --- a/rules/host-python3.in
> +++ b/rules/host-python3.in
> @@ -6,6 +6,7 @@ config HOST_PYTHON3
> select HOST_LIBFFI
> select HOST_OPENSSL
> select HOST_ZLIBif HOST_PYTHON3_ZLIB
> +   select HOST_BZIP2   if HOST_PYTHON3_BZIP2
> default y if ALLYES
> help
>   Python is an interpreted, interactive,
> @@ -16,4 +17,7 @@ if HOST_PYTHON3
>  config HOST_PYTHON3_ZLIB
> bool
>  
> +config HOST_PYTHON3_BZIP2
> +   bool
> +
>  endif
> diff --git a/rules/nodejs.in b/rules/nodejs.in
> index 80c6aec21..c75480953 100644
> --- a/rules/nodejs.in
> +++ b/rules/nodejs.in
> @@ -3,7 +3,8 @@
>  config NODEJS
> tristate
> prompt "Node.js   "
> -   select HOST_SYSTEM_PYTHON3
> +   select HOST_PYTHON3
> +   select HOST_PYTHON3_BZIP2
> select HOST_QEMU
> select HOST_QEMU_USR
> select C_ARES
> 
> 

-- 
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- |