[v3,3/3] dpkg-raw: change DPKG_ARCH to all

Message ID 20240926033935.2955085-4-cedric.hombourger@siemens.com
State Accepted, archived
Headers show
Series do not build -compat/-native for dpkg-raw packages | expand

Commit Message

cedric.hombourger@siemens.com Sept. 26, 2024, 3:39 a.m. UTC
Packages created by dpkg-raw are really for configuration and data files
and therefore architecture independent. DPKG_ARCH is now set to "all" and
DEBIAN_MULTI_ARCH will default to "foreign" unless DPKG_ARCH is changed
(it would then be reset to "no").

Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com>
---
 RECIPE-API-CHANGELOG.md       | 10 ++++++++++
 meta/classes/dpkg-raw.bbclass |  4 ++++
 2 files changed, 14 insertions(+)

Comments

Jan Kiszka Oct. 4, 2024, 12:31 p.m. UTC | #1
On 26.09.24 05:39, 'Cedric Hombourger' via isar-users wrote:
> Packages created by dpkg-raw are really for configuration and data files
> and therefore architecture independent. DPKG_ARCH is now set to "all" and
> DEBIAN_MULTI_ARCH will default to "foreign" unless DPKG_ARCH is changed
> (it would then be reset to "no").
> 
> Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com>
> ---
>  RECIPE-API-CHANGELOG.md       | 10 ++++++++++
>  meta/classes/dpkg-raw.bbclass |  4 ++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
> index 21c558d2..57b2205a 100644
> --- a/RECIPE-API-CHANGELOG.md
> +++ b/RECIPE-API-CHANGELOG.md
> @@ -646,3 +646,13 @@ recipe would use the following setting:
>  ```
>  HEADERS_INSTALL_EXTRA += "nvidia"
>  ```
> +
> +### Architecture for dpkg-raw packages
> +
> +The intent of the dpkg-raw class is to easily package configuration and data
> +files into a Debian package. Packages to be compiled should really use other
> +dpkg classes where support for cross-compilation and multiarch is provided
> +and tested. `DPKG_ARCH` is now set to `all` for `dpkg-raw` recipes.

Not fully true. In rare cases, it can also be used for pre-compiled
binaries. This sections should state that the /common/ case is 'all' and
therefore the /default/ is set to 'all'.

> +
> +This change fixes an issue where a `dpkg` package is built for `-compat` or
> +`-native` and `DEPENDS` on a `dpkg-raw` package.

This is misleading. One can still tune DPKG_ARCH and run into such
cases. Warn about them, don't claim they are fixed.

> diff --git a/meta/classes/dpkg-raw.bbclass b/meta/classes/dpkg-raw.bbclass
> index dd7b761f..ac70d5cc 100644
> --- a/meta/classes/dpkg-raw.bbclass
> +++ b/meta/classes/dpkg-raw.bbclass
> @@ -7,6 +7,10 @@ inherit dpkg
>  
>  D = "${WORKDIR}/image"
>  
> +# Create a binary-indep package
> +DPKG_ARCH = "all"

Weak assignment, please.

> +DEBIAN_MULTI_ARCH = "${@ 'foreign' if '${DPKG_ARCH}' == 'all' else 'no' }"
> +
>  # Populate folder that will be picked up as package
>  do_install() {
>  	bbnote "Put your files for this package in $""{D}"

Jan
Uladzimir Bely Nov. 22, 2024, 6:07 a.m. UTC | #2
On Thu, 2024-09-26 at 05:39 +0200, 'Cedric Hombourger' via isar-users
wrote:
> Packages created by dpkg-raw are really for configuration and data
> files
> and therefore architecture independent. DPKG_ARCH is now set to "all"
> and
> DEBIAN_MULTI_ARCH will default to "foreign" unless DPKG_ARCH is
> changed
> (it would then be reset to "no").
> 
> Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com>
> ---
>  RECIPE-API-CHANGELOG.md       | 10 ++++++++++
>  meta/classes/dpkg-raw.bbclass |  4 ++++
>  2 files changed, 14 insertions(+)
> 
> diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
> index 21c558d2..57b2205a 100644
> --- a/RECIPE-API-CHANGELOG.md
> +++ b/RECIPE-API-CHANGELOG.md
> @@ -646,3 +646,13 @@ recipe would use the following setting:
>  ```
>  HEADERS_INSTALL_EXTRA += "nvidia"
>  ```
> +
> +### Architecture for dpkg-raw packages
> +
> +The intent of the dpkg-raw class is to easily package configuration
> and data
> +files into a Debian package. Packages to be compiled should really
> use other
> +dpkg classes where support for cross-compilation and multiarch is
> provided
> +and tested. `DPKG_ARCH` is now set to `all` for `dpkg-raw` recipes.
> +
> +This change fixes an issue where a `dpkg` package is built for `-
> compat` or
> +`-native` and `DEPENDS` on a `dpkg-raw` package.
> diff --git a/meta/classes/dpkg-raw.bbclass b/meta/classes/dpkg-
> raw.bbclass
> index dd7b761f..ac70d5cc 100644
> --- a/meta/classes/dpkg-raw.bbclass
> +++ b/meta/classes/dpkg-raw.bbclass
> @@ -7,6 +7,10 @@ inherit dpkg
>  
>  D = "${WORKDIR}/image"
>  
> +# Create a binary-indep package
> +DPKG_ARCH = "all"
> +DEBIAN_MULTI_ARCH = "${@ 'foreign' if '${DPKG_ARCH}' == 'all' else
> 'no' }"
> +

Playing with isar-apt I've found an issue that existed for a long time
but with this patch it became easier to find.

For the packages with "all" architecture there are no source packages
found in isar-apt.

Steps to reproduce:

1. Run `bitbake libhello hello example-raw sshd-regen-keys`.
2. Check isar-apt contents (e.g. `build/tmp/deploy/isar-apt/debian-
bookworm-amd64/apt/debian-bookworm/pool/main/`)

With current `next` we have in isar-apt:

```
libhello            dsc + deb
hello               dsc + deb
example-raw         only deb
sshd-regen-keys     only deb
```

With this patch reverted (and some followed patches):

```
libhello            dsc + deb
hello               dsc + deb
example-raw         dsc + deb
sshd-regen-keys     only deb
```

Package `sshd-regen-keys` is still affected since it explicitly sets
DPKG_ARCH = "all" in the recipe.

Debugging shows that source package goes to the isar-apt but later
is wrongly removed by `repo_del_package` from `repository.bbclass` due
to "all" architecture.

>  # Populate folder that will be picked up as package
>  do_install() {
>  	bbnote "Put your files for this package in $""{D}"
> -- 
> 2.34.1
>
Uladzimir Bely Nov. 22, 2024, 6:12 a.m. UTC | #3
On Fri, 2024-11-22 at 09:07 +0300, Uladzimir Bely wrote:
> On Thu, 2024-09-26 at 05:39 +0200, 'Cedric Hombourger' via isar-users
> wrote:
> > Packages created by dpkg-raw are really for configuration and data
> > files
> > and therefore architecture independent. DPKG_ARCH is now set to
> > "all"
> > and
> > DEBIAN_MULTI_ARCH will default to "foreign" unless DPKG_ARCH is
> > changed
> > (it would then be reset to "no").
> > 
> > Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com>
> > ---
> >  RECIPE-API-CHANGELOG.md       | 10 ++++++++++
> >  meta/classes/dpkg-raw.bbclass |  4 ++++
> >  2 files changed, 14 insertions(+)
> > 
> > diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
> > index 21c558d2..57b2205a 100644
> > --- a/RECIPE-API-CHANGELOG.md
> > +++ b/RECIPE-API-CHANGELOG.md
> > @@ -646,3 +646,13 @@ recipe would use the following setting:
> >  ```
> >  HEADERS_INSTALL_EXTRA += "nvidia"
> >  ```
> > +
> > +### Architecture for dpkg-raw packages
> > +
> > +The intent of the dpkg-raw class is to easily package
> > configuration
> > and data
> > +files into a Debian package. Packages to be compiled should really
> > use other
> > +dpkg classes where support for cross-compilation and multiarch is
> > provided
> > +and tested. `DPKG_ARCH` is now set to `all` for `dpkg-raw`
> > recipes.
> > +
> > +This change fixes an issue where a `dpkg` package is built for `-
> > compat` or
> > +`-native` and `DEPENDS` on a `dpkg-raw` package.
> > diff --git a/meta/classes/dpkg-raw.bbclass b/meta/classes/dpkg-
> > raw.bbclass
> > index dd7b761f..ac70d5cc 100644
> > --- a/meta/classes/dpkg-raw.bbclass
> > +++ b/meta/classes/dpkg-raw.bbclass
> > @@ -7,6 +7,10 @@ inherit dpkg
> >  
> >  D = "${WORKDIR}/image"
> >  
> > +# Create a binary-indep package
> > +DPKG_ARCH = "all"
> > +DEBIAN_MULTI_ARCH = "${@ 'foreign' if '${DPKG_ARCH}' == 'all' else
> > 'no' }"
> > +
> 
> Playing with isar-apt I've found an issue that existed for a long
> time
> but with this patch it became easier to find.
> 
> For the packages with "all" architecture there are no source packages
> found in isar-apt.
> 
> Steps to reproduce:
> 
> 1. Run `bitbake libhello hello example-raw sshd-regen-keys`.
> 2. Check isar-apt contents (e.g. `build/tmp/deploy/isar-apt/debian-
> bookworm-amd64/apt/debian-bookworm/pool/main/`)
> 
> With current `next` we have in isar-apt:
> 
> ```
> libhello            dsc + deb
> hello               dsc + deb
> example-raw         only deb
> sshd-regen-keys     only deb
> ```
> 
> With this patch reverted (and some followed patches):
> 
> ```
> libhello            dsc + deb
> hello               dsc + deb
> example-raw         dsc + deb
> sshd-regen-keys     only deb
> ```
> 
> Package `sshd-regen-keys` is still affected since it explicitly sets
> DPKG_ARCH = "all" in the recipe.
> 
> Debugging shows that source package goes to the isar-apt but later
> is wrongly removed by `repo_del_package` from `repository.bbclass`
> due
> to "all" architecture.
> 

@Cedric

Oh, while I was writing this email you seem to have sent a patchset
that fixes the issue. Thanks, will check it.

> >  # Populate folder that will be picked up as package
> >  do_install() {
> >  	bbnote "Put your files for this package in $""{D}"
> > -- 
> > 2.34.1
> > 
> 
> -- 
> Best regards,
> Uladzimir.
>
cedric.hombourger@siemens.com Nov. 22, 2024, 6:12 a.m. UTC | #4
On Fri, 2024-11-22 at 09:07 +0300, Uladzimir Bely wrote:
> On Thu, 2024-09-26 at 05:39 +0200, 'Cedric Hombourger' via isar-users
> wrote:
> > Packages created by dpkg-raw are really for configuration and data
> > files
> > and therefore architecture independent. DPKG_ARCH is now set to
> > "all"
> > and
> > DEBIAN_MULTI_ARCH will default to "foreign" unless DPKG_ARCH is
> > changed
> > (it would then be reset to "no").
> > 
> > Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com>
> > ---
> >  RECIPE-API-CHANGELOG.md       | 10 ++++++++++
> >  meta/classes/dpkg-raw.bbclass |  4 ++++
> >  2 files changed, 14 insertions(+)
> > 
> > diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
> > index 21c558d2..57b2205a 100644
> > --- a/RECIPE-API-CHANGELOG.md
> > +++ b/RECIPE-API-CHANGELOG.md
> > @@ -646,3 +646,13 @@ recipe would use the following setting:
> >  ```
> >  HEADERS_INSTALL_EXTRA += "nvidia"
> >  ```
> > +
> > +### Architecture for dpkg-raw packages
> > +
> > +The intent of the dpkg-raw class is to easily package
> > configuration
> > and data
> > +files into a Debian package. Packages to be compiled should really
> > use other
> > +dpkg classes where support for cross-compilation and multiarch is
> > provided
> > +and tested. `DPKG_ARCH` is now set to `all` for `dpkg-raw`
> > recipes.
> > +
> > +This change fixes an issue where a `dpkg` package is built for `-
> > compat` or
> > +`-native` and `DEPENDS` on a `dpkg-raw` package.
> > diff --git a/meta/classes/dpkg-raw.bbclass b/meta/classes/dpkg-
> > raw.bbclass
> > index dd7b761f..ac70d5cc 100644
> > --- a/meta/classes/dpkg-raw.bbclass
> > +++ b/meta/classes/dpkg-raw.bbclass
> > @@ -7,6 +7,10 @@ inherit dpkg
> >  
> >  D = "${WORKDIR}/image"
> >  
> > +# Create a binary-indep package
> > +DPKG_ARCH = "all"
> > +DEBIAN_MULTI_ARCH = "${@ 'foreign' if '${DPKG_ARCH}' == 'all' else
> > 'no' }"
> > +
> 
> Playing with isar-apt I've found an issue that existed for a long
> time
> but with this patch it became easier to find.

See https://groups.google.com/g/isar-users/c/NrVHusKyNTA for a fix
Looks like good timing :)

> 
> For the packages with "all" architecture there are no source packages
> found in isar-apt.
> 
> Steps to reproduce:
> 
> 1. Run `bitbake libhello hello example-raw sshd-regen-keys`.
> 2. Check isar-apt contents (e.g. `build/tmp/deploy/isar-apt/debian-
> bookworm-amd64/apt/debian-bookworm/pool/main/`)
> 
> With current `next` we have in isar-apt:
> 
> ```
> libhello            dsc + deb
> hello               dsc + deb
> example-raw         only deb
> sshd-regen-keys     only deb
> ```
> 
> With this patch reverted (and some followed patches):
> 
> ```
> libhello            dsc + deb
> hello               dsc + deb
> example-raw         dsc + deb
> sshd-regen-keys     only deb
> ```
> 
> Package `sshd-regen-keys` is still affected since it explicitly sets
> DPKG_ARCH = "all" in the recipe.
> 
> Debugging shows that source package goes to the isar-apt but later
> is wrongly removed by `repo_del_package` from `repository.bbclass`
> due
> to "all" architecture.
> 
> >  # Populate folder that will be picked up as package
> >  do_install() {
> >         bbnote "Put your files for this package in $""{D}"
> > -- 
> > 2.34.1
> > 
>

Patch

diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
index 21c558d2..57b2205a 100644
--- a/RECIPE-API-CHANGELOG.md
+++ b/RECIPE-API-CHANGELOG.md
@@ -646,3 +646,13 @@  recipe would use the following setting:
 ```
 HEADERS_INSTALL_EXTRA += "nvidia"
 ```
+
+### Architecture for dpkg-raw packages
+
+The intent of the dpkg-raw class is to easily package configuration and data
+files into a Debian package. Packages to be compiled should really use other
+dpkg classes where support for cross-compilation and multiarch is provided
+and tested. `DPKG_ARCH` is now set to `all` for `dpkg-raw` recipes.
+
+This change fixes an issue where a `dpkg` package is built for `-compat` or
+`-native` and `DEPENDS` on a `dpkg-raw` package.
diff --git a/meta/classes/dpkg-raw.bbclass b/meta/classes/dpkg-raw.bbclass
index dd7b761f..ac70d5cc 100644
--- a/meta/classes/dpkg-raw.bbclass
+++ b/meta/classes/dpkg-raw.bbclass
@@ -7,6 +7,10 @@  inherit dpkg
 
 D = "${WORKDIR}/image"
 
+# Create a binary-indep package
+DPKG_ARCH = "all"
+DEBIAN_MULTI_ARCH = "${@ 'foreign' if '${DPKG_ARCH}' == 'all' else 'no' }"
+
 # Populate folder that will be picked up as package
 do_install() {
 	bbnote "Put your files for this package in $""{D}"