debianize: introduce DEBIAN_PROVIDES and DEBIAN_REPLACES

Message ID 20231114190550.288591-1-cedric.hombourger@siemens.com
State Superseded, archived
Headers show
Series debianize: introduce DEBIAN_PROVIDES and DEBIAN_REPLACES | expand

Commit Message

Cedric Hombourger Nov. 14, 2023, 7:05 p.m. UTC
When optimizing an embedded system (and mostly for advanced users),
dpkg-raw may be used to generate virtual packages to replace larger
packages that would otherwise be pulled to satisfy image dependencies.

Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com>
---
 doc/user_manual.md             | 4 ++++
 meta/classes/debianize.bbclass | 2 ++
 2 files changed, 6 insertions(+)

Comments

Uladzimir Bely Nov. 16, 2023, 7:07 a.m. UTC | #1
On Tue, 2023-11-14 at 20:05 +0100, 'Cedric Hombourger' via isar-users
wrote:
> When optimizing an embedded system (and mostly for advanced users),
> dpkg-raw may be used to generate virtual packages to replace larger
> packages that would otherwise be pulled to satisfy image
> dependencies.
> 
> Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com>
> ---
>  doc/user_manual.md             | 4 ++++
>  meta/classes/debianize.bbclass | 2 ++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/doc/user_manual.md b/doc/user_manual.md
> index ecb987f4..0649ceeb 100644
> --- a/doc/user_manual.md
> +++ b/doc/user_manual.md
> @@ -906,6 +906,10 @@ For the variables please have a look at the
> previous example, the following new
>  Have a look at the `example-raw` recipe to get an idea how the
> `dpkg-raw` class can be used to customize your image.
>  Note that the package will be build using the whole debian package
> workflow, so your package will be checked by many debhelper scripts.
> If those helpers point out quality issues it might be a good idea to
> fix them. But `example-raw` also shows how rules can still be
> violated.
>  
> +Other (optional) customization variables include:
> + - `DEBIAN_PROVIDES` - declare a virtual package to satisfy
> dependencies
> + - `DEBIAN_REPLACES` - to replace a package with another
> +
>  ### Prebuilt .deb packages from somewhere
>  
>  In some cases you might find yourself having a `.deb` that someone
> else built,
> diff --git a/meta/classes/debianize.bbclass
> b/meta/classes/debianize.bbclass
> index 16f3638d..df7c5b50 100644
> --- a/meta/classes/debianize.bbclass
> +++ b/meta/classes/debianize.bbclass
> @@ -78,6 +78,8 @@ Package: ${BPN}
>  Architecture: ${DPKG_ARCH}
>  Depends: ${DEBIAN_DEPENDS}
>  Conflicts: ${DEBIAN_CONFLICTS}
> +Provides: ${DEBIAN_PROVIDES}
> +Replaces: ${DEBIAN_REPLACES}

Would not this somehow lead to broken control file if these new
variables are not defined / not used in the recipe? For other vars here
(e.g., DEBIAN_CONFLICTS, DEBIAN_DEPENDS) we at least have a weak
assignments (??= "") on top of debianize.bbclass.

>  Multi-Arch: ${DEBIAN_MULTI_ARCH}
>  Description: ${DESCRIPTION}
>  EOF
> -- 
> 2.39.2
>

Patch

diff --git a/doc/user_manual.md b/doc/user_manual.md
index ecb987f4..0649ceeb 100644
--- a/doc/user_manual.md
+++ b/doc/user_manual.md
@@ -906,6 +906,10 @@  For the variables please have a look at the previous example, the following new
 Have a look at the `example-raw` recipe to get an idea how the `dpkg-raw` class can be used to customize your image.
 Note that the package will be build using the whole debian package workflow, so your package will be checked by many debhelper scripts. If those helpers point out quality issues it might be a good idea to fix them. But `example-raw` also shows how rules can still be violated.
 
+Other (optional) customization variables include:
+ - `DEBIAN_PROVIDES` - declare a virtual package to satisfy dependencies
+ - `DEBIAN_REPLACES` - to replace a package with another
+
 ### Prebuilt .deb packages from somewhere
 
 In some cases you might find yourself having a `.deb` that someone else built,
diff --git a/meta/classes/debianize.bbclass b/meta/classes/debianize.bbclass
index 16f3638d..df7c5b50 100644
--- a/meta/classes/debianize.bbclass
+++ b/meta/classes/debianize.bbclass
@@ -78,6 +78,8 @@  Package: ${BPN}
 Architecture: ${DPKG_ARCH}
 Depends: ${DEBIAN_DEPENDS}
 Conflicts: ${DEBIAN_CONFLICTS}
+Provides: ${DEBIAN_PROVIDES}
+Replaces: ${DEBIAN_REPLACES}
 Multi-Arch: ${DEBIAN_MULTI_ARCH}
 Description: ${DESCRIPTION}
 EOF