debianize: introduce DEBIAN_SECTION

Message ID 20251016094326.4192938-1-srinuvasan.a@siemens.com
State Accepted, archived
Headers show
Series debianize: introduce DEBIAN_SECTION | expand

Commit Message

srinuvasan.a Oct. 16, 2025, 9:43 a.m. UTC
From: srinuvasan <srinuvasan.a@siemens.com>

Add support for setting the Section field in auto-generated control files.
This allows users to specify a custom section for their packages, making
it easier to categorize and identify them within the Debian archive.

By default, the section is set to "misc".

Also update the section for the isar-exclude-docs package as a demonstration.

Example:
  DEBIAN_SECTION = "ui"     # For UI-related packages
  DEBIAN_SECTION = "utils"  # For miscellaneous utilities

Signed-off-by: srinuvasan <srinuvasan.a@siemens.com>
---
 doc/user_manual.md                                            | 1 +
 meta/classes/debianize.bbclass                                | 4 +++-
 .../isar-exclude-docs/isar-exclude-docs_0.2.2.bb              | 2 ++
 3 files changed, 6 insertions(+), 1 deletion(-)

Comments

Zhihang Wei Oct. 24, 2025, 3:57 p.m. UTC | #1
Applied to next, thanks.

Best regards,
Zhihang

On 10/16/25 11:43, srinuvasan.a via isar-users wrote:
> From: srinuvasan <srinuvasan.a@siemens.com>
>
> Add support for setting the Section field in auto-generated control files.
> This allows users to specify a custom section for their packages, making
> it easier to categorize and identify them within the Debian archive.
>
> By default, the section is set to "misc".
>
> Also update the section for the isar-exclude-docs package as a demonstration.
>
> Example:
>    DEBIAN_SECTION = "ui"     # For UI-related packages
>    DEBIAN_SECTION = "utils"  # For miscellaneous utilities
>
> Signed-off-by: srinuvasan <srinuvasan.a@siemens.com>
> ---
>   doc/user_manual.md                                            | 1 +
>   meta/classes/debianize.bbclass                                | 4 +++-
>   .../isar-exclude-docs/isar-exclude-docs_0.2.2.bb              | 2 ++
>   3 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/doc/user_manual.md b/doc/user_manual.md
> index 6778d15c..4d81370e 100644
> --- a/doc/user_manual.md
> +++ b/doc/user_manual.md
> @@ -1006,6 +1006,7 @@ Other (optional) customization variables include:
>    - `DEBIAN_PROVIDES` - declare a virtual package to satisfy dependencies
>    - `DEBIAN_REPLACES` - to replace a package with another
>    - `DEBIAN_BREAKS` - Packages which break other packages
> + - `DEBIAN_SECTION` - Specifies the category under which the package is classified
>   
>   ### Prebuilt .deb packages from somewhere
>   
> diff --git a/meta/classes/debianize.bbclass b/meta/classes/debianize.bbclass
> index 4989c601..dff7110b 100644
> --- a/meta/classes/debianize.bbclass
> +++ b/meta/classes/debianize.bbclass
> @@ -8,6 +8,7 @@
>   CHANGELOG_V ??= "${PV}"
>   DPKG_ARCH ??= "any"
>   DEBIAN_BUILD_DEPENDS ??= ""
> +DEBIAN_SECTION ??= "misc"
>   DEBIAN_DEPENDS ??= ""
>   DEBIAN_PROVIDES ??= ""
>   DEBIAN_REPLACES ??= ""
> @@ -70,6 +71,7 @@ EOF
>   
>   
>   deb_create_control[vardeps] += "DEBIANIZE_BUILD_DEPENDS \
> +                                DEBIAN_SECTION \
>                                   DEBIAN_DEPENDS \
>                                   DEBIAN_PROVIDES \
>                                   DEBIAN_REPLACES \
> @@ -78,7 +80,7 @@ deb_create_control[vardeps] += "DEBIANIZE_BUILD_DEPENDS \
>   deb_create_control() {
>   	cat << EOF > ${S}/debian/control
>   Source: ${BPN}
> -Section: misc
> +Section: ${@ deb_list_beautify(d, 'DEBIAN_SECTION')}
>   Priority: optional
>   Standards-Version: 3.9.6
>   Maintainer: ${MAINTAINER}
> diff --git a/meta/recipes-support/isar-exclude-docs/isar-exclude-docs_0.2.2.bb b/meta/recipes-support/isar-exclude-docs/isar-exclude-docs_0.2.2.bb
> index 2b844bed..acca67c8 100644
> --- a/meta/recipes-support/isar-exclude-docs/isar-exclude-docs_0.2.2.bb
> +++ b/meta/recipes-support/isar-exclude-docs/isar-exclude-docs_0.2.2.bb
> @@ -4,6 +4,8 @@ inherit dpkg-raw
>   DESCRIPTION = "Configuration to exclude most documentation"
>   MAINTAINER = "isar-users <isar-users@googlegroups.com>"
>   
> +DEBIAN_SECTION = "utils"
> +
>   SRC_URI = "file://${BPN} \
>   	   file://postinst"
>

Patch

diff --git a/doc/user_manual.md b/doc/user_manual.md
index 6778d15c..4d81370e 100644
--- a/doc/user_manual.md
+++ b/doc/user_manual.md
@@ -1006,6 +1006,7 @@  Other (optional) customization variables include:
  - `DEBIAN_PROVIDES` - declare a virtual package to satisfy dependencies
  - `DEBIAN_REPLACES` - to replace a package with another
  - `DEBIAN_BREAKS` - Packages which break other packages
+ - `DEBIAN_SECTION` - Specifies the category under which the package is classified
 
 ### Prebuilt .deb packages from somewhere
 
diff --git a/meta/classes/debianize.bbclass b/meta/classes/debianize.bbclass
index 4989c601..dff7110b 100644
--- a/meta/classes/debianize.bbclass
+++ b/meta/classes/debianize.bbclass
@@ -8,6 +8,7 @@ 
 CHANGELOG_V ??= "${PV}"
 DPKG_ARCH ??= "any"
 DEBIAN_BUILD_DEPENDS ??= ""
+DEBIAN_SECTION ??= "misc"
 DEBIAN_DEPENDS ??= ""
 DEBIAN_PROVIDES ??= ""
 DEBIAN_REPLACES ??= ""
@@ -70,6 +71,7 @@  EOF
 
 
 deb_create_control[vardeps] += "DEBIANIZE_BUILD_DEPENDS \
+                                DEBIAN_SECTION \
                                 DEBIAN_DEPENDS \
                                 DEBIAN_PROVIDES \
                                 DEBIAN_REPLACES \
@@ -78,7 +80,7 @@  deb_create_control[vardeps] += "DEBIANIZE_BUILD_DEPENDS \
 deb_create_control() {
 	cat << EOF > ${S}/debian/control
 Source: ${BPN}
-Section: misc
+Section: ${@ deb_list_beautify(d, 'DEBIAN_SECTION')}
 Priority: optional
 Standards-Version: 3.9.6
 Maintainer: ${MAINTAINER}
diff --git a/meta/recipes-support/isar-exclude-docs/isar-exclude-docs_0.2.2.bb b/meta/recipes-support/isar-exclude-docs/isar-exclude-docs_0.2.2.bb
index 2b844bed..acca67c8 100644
--- a/meta/recipes-support/isar-exclude-docs/isar-exclude-docs_0.2.2.bb
+++ b/meta/recipes-support/isar-exclude-docs/isar-exclude-docs_0.2.2.bb
@@ -4,6 +4,8 @@  inherit dpkg-raw
 DESCRIPTION = "Configuration to exclude most documentation"
 MAINTAINER = "isar-users <isar-users@googlegroups.com>"
 
+DEBIAN_SECTION = "utils"
+
 SRC_URI = "file://${BPN} \
 	   file://postinst"