Message ID | 20240917070048.577-3-cedric.hombourger@siemens.com |
---|---|
State | Superseded, archived |
Headers | show |
Series | do not build -compat/-native for dpkg-raw packages | expand |
On 17.09.24 09:00, '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 > a warning will be produced if changed by the recipe (this will later be > turned into an error). Well, this is generally correct, but not always. We may also package a prebuilt arch-dependent thing here, and then the result would no longer be "all". Such cases should remain expressible correctly. That said, changing the default is not a bad move. Jan > > Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com> > --- > RECIPE-API-CHANGELOG.md | 11 +++++++++++ > meta/classes/dpkg-raw.bbclass | 8 ++++++++ > 2 files changed, 19 insertions(+) > > diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md > index 21c558d2..d40827d0 100644 > --- a/RECIPE-API-CHANGELOG.md > +++ b/RECIPE-API-CHANGELOG.md > @@ -646,3 +646,14 @@ 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 and a > +deprecation warning will be raised if overriden. > + > +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..cbaf298c 100644 > --- a/meta/classes/dpkg-raw.bbclass > +++ b/meta/classes/dpkg-raw.bbclass > @@ -7,6 +7,9 @@ inherit dpkg > > D = "${WORKDIR}/image" > > +# Create a binary-indep package > +DPKG_ARCH = "all" > + > # Populate folder that will be picked up as package > do_install() { > bbnote "Put your files for this package in $""{D}" > @@ -17,6 +20,11 @@ addtask install after do_patch do_transform_template before do_prepare_build > > do_prepare_build[cleandirs] += "${S}/debian" > do_prepare_build() { > + if [ "${DPKG_ARCH}" != "all" ]; then > + bbwarn "support for building binary-arch packages with " \ > + "dpkg-raw is deprecated and will be removed" > + fi > + > cd ${D} > find . -maxdepth 1 ! -name .. -and ! -name . -and ! -name debian | \ > sed 's:^./::' > ${S}/debian/${PN}.install
On Thu, 2024-09-26 at 05:39 +0200, 'Cedric Hombourger' via isar-users wrote: > 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 defaulting to `all` for `dpkg-raw` > recipes. > > Despite this change, Isar may still build dpkg-raw packages a second > time > when pulled by a -compat or -native package. multiarch is changed to > check > if DPKG_ARCH is "all" and will add -compat and -native to the > PROVIDES of > the package (this condition will be checked for all dpkg variants) > > It shall be noted that setting DPKG_ARCH in a recipe is a contract, > the > user declares that generated package(s) are either architecture > dependent > or independent. > > Changes in v3: > * Do not warn if DPKG_ARCH is not "all" as users may use this class > to create a Debian package from a prebuilt binaries (shared > libraries, > applications, etc.) > * Set DEBIAN_MULTI_ARCH to "foreign" in dpkg-raw if DPKG_ARCH is > "all" > * Introduce helpers in a separate commit to ease reviews (a "fast" > ci_build run was used to validate this intermediate step). > > Changes in v2: > * v1 used a completely different approach where we were ensuring > that > do_install was called whether sources were built or pulled from > isar_apt (do_fetch_common_source) since override_dh_install is > pulling contents of dpkg-raw packages outside of the source tree > (${PP}/image) > > Cedric Hombourger (3): > multiarch: introduce some helpers to later handle corner cases > multiarch: avoid separate builds when DPKG_ARCH is all > dpkg-raw: change DPKG_ARCH to all > > RECIPE-API-CHANGELOG.md | 10 ++++++++++ > meta/classes/dpkg-raw.bbclass | 4 ++++ > meta/classes/multiarch.bbclass | 34 ++++++++++++++++++++++++-------- > -- > 3 files changed, 38 insertions(+), 10 deletions(-) > > -- > 2.34.1 > Applied to next, thanks.
On 04.10.24 13:54, Uladzimir Bely wrote: > On Thu, 2024-09-26 at 05:39 +0200, 'Cedric Hombourger' via isar-users > wrote: >> 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 defaulting to `all` for `dpkg-raw` >> recipes. >> >> Despite this change, Isar may still build dpkg-raw packages a second >> time >> when pulled by a -compat or -native package. multiarch is changed to >> check >> if DPKG_ARCH is "all" and will add -compat and -native to the >> PROVIDES of >> the package (this condition will be checked for all dpkg variants) >> >> It shall be noted that setting DPKG_ARCH in a recipe is a contract, >> the >> user declares that generated package(s) are either architecture >> dependent >> or independent. >> >> Changes in v3: >> * Do not warn if DPKG_ARCH is not "all" as users may use this class >> to create a Debian package from a prebuilt binaries (shared >> libraries, >> applications, etc.) >> * Set DEBIAN_MULTI_ARCH to "foreign" in dpkg-raw if DPKG_ARCH is >> "all" >> * Introduce helpers in a separate commit to ease reviews (a "fast" >> ci_build run was used to validate this intermediate step). >> >> Changes in v2: >> * v1 used a completely different approach where we were ensuring >> that >> do_install was called whether sources were built or pulled from >> isar_apt (do_fetch_common_source) since override_dh_install is >> pulling contents of dpkg-raw packages outside of the source tree >> (${PP}/image) >> >> Cedric Hombourger (3): >> multiarch: introduce some helpers to later handle corner cases >> multiarch: avoid separate builds when DPKG_ARCH is all >> dpkg-raw: change DPKG_ARCH to all >> >> RECIPE-API-CHANGELOG.md | 10 ++++++++++ >> meta/classes/dpkg-raw.bbclass | 4 ++++ >> meta/classes/multiarch.bbclass | 34 ++++++++++++++++++++++++-------- >> -- >> 3 files changed, 38 insertions(+), 10 deletions(-) >> >> -- >> 2.34.1 >> > > Applied to next, thanks. > Sorry, forgotten to review. We will need fixes on top now. Jan
diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md index 21c558d2..d40827d0 100644 --- a/RECIPE-API-CHANGELOG.md +++ b/RECIPE-API-CHANGELOG.md @@ -646,3 +646,14 @@ 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 and a +deprecation warning will be raised if overriden. + +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..cbaf298c 100644 --- a/meta/classes/dpkg-raw.bbclass +++ b/meta/classes/dpkg-raw.bbclass @@ -7,6 +7,9 @@ inherit dpkg D = "${WORKDIR}/image" +# Create a binary-indep package +DPKG_ARCH = "all" + # Populate folder that will be picked up as package do_install() { bbnote "Put your files for this package in $""{D}" @@ -17,6 +20,11 @@ addtask install after do_patch do_transform_template before do_prepare_build do_prepare_build[cleandirs] += "${S}/debian" do_prepare_build() { + if [ "${DPKG_ARCH}" != "all" ]; then + bbwarn "support for building binary-arch packages with " \ + "dpkg-raw is deprecated and will be removed" + fi + cd ${D} find . -maxdepth 1 ! -name .. -and ! -name . -and ! -name debian | \ sed 's:^./::' > ${S}/debian/${PN}.install
Packages created by dpkg-raw are really for configuration and data files and therefore architecture independent. DPKG_ARCH is now set to all and a warning will be produced if changed by the recipe (this will later be turned into an error). Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com> --- RECIPE-API-CHANGELOG.md | 11 +++++++++++ meta/classes/dpkg-raw.bbclass | 8 ++++++++ 2 files changed, 19 insertions(+)