[v5] debianize: set appropriate Standards-Version for each debian suite

Message ID 20251104095033.273857-1-srinuvasan.a@siemens.com
State Superseded
Headers show
Series [v5] debianize: set appropriate Standards-Version for each debian suite | expand

Commit Message

srinuvasan.a Nov. 4, 2025, 9:50 a.m. UTC
From: srinuvasan <srinuvasan.a@siemens.com>

The Standards-Version field in debian/control declares the Debian Policy
version that the package complies with. Currently, the custom source packages
use a hard-coded Standards-Version: 3.9.6, which is obsolete and does not align
with the policies of newer Debian releases

Update the packaging to set the correct Standards-Version dynamically based on
the target Debian suite, ensuring compliance with the appropriate Debian Policy
version for each release.

Debian Policy evolves over time, newer versions may add, remove, or deprecate
control fields and packaging behaviors. Using an outdated Standards-Version
can miss required or recommended fields, leading to QA or functional issues.

Examples:
  - Rules-Requires-Root (Policy 4.1.0): declares if root privileges are needed
    during debian/rules execution, improves reproducibility and isolation.
  - Homepage (Policy 3.9.3): provides upstream project link for better metadata.

Older Standards-Version(Policy 3.9.6) may trigger lintian warnings such as:
  W: source: missing-rules-requires-root-field
  W: source: missing-homepage-field

Keeping Standards-Version current ensures clean builds, QA compliance,
and future compatibility.

Signed-off-by: srinuvasan <srinuvasan.a@siemens.com>
---
 RECIPE-API-CHANGELOG.md        |  8 ++++++++
 meta/classes/debianize.bbclass | 12 ++++++++++--
 2 files changed, 18 insertions(+), 2 deletions(-)

Comments

Jan Kiszka Nov. 4, 2025, 12:58 p.m. UTC | #1
On 04.11.25 10:50, srinuvasan.a via isar-users wrote:
> From: srinuvasan <srinuvasan.a@siemens.com>
> 
> The Standards-Version field in debian/control declares the Debian Policy
> version that the package complies with. Currently, the custom source packages
> use a hard-coded Standards-Version: 3.9.6, which is obsolete and does not align
> with the policies of newer Debian releases
> 
> Update the packaging to set the correct Standards-Version dynamically based on
> the target Debian suite, ensuring compliance with the appropriate Debian Policy
> version for each release.
> 
> Debian Policy evolves over time, newer versions may add, remove, or deprecate
> control fields and packaging behaviors. Using an outdated Standards-Version
> can miss required or recommended fields, leading to QA or functional issues.
> 
> Examples:
>   - Rules-Requires-Root (Policy 4.1.0): declares if root privileges are needed
>     during debian/rules execution, improves reproducibility and isolation.
>   - Homepage (Policy 3.9.3): provides upstream project link for better metadata.
> 
> Older Standards-Version(Policy 3.9.6) may trigger lintian warnings such as:
>   W: source: missing-rules-requires-root-field
>   W: source: missing-homepage-field
> 
> Keeping Standards-Version current ensures clean builds, QA compliance,
> and future compatibility.
> 
> Signed-off-by: srinuvasan <srinuvasan.a@siemens.com>
> ---
>  RECIPE-API-CHANGELOG.md        |  8 ++++++++
>  meta/classes/debianize.bbclass | 12 ++++++++++--
>  2 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
> index cf04fa5c..31512561 100644
> --- a/RECIPE-API-CHANGELOG.md
> +++ b/RECIPE-API-CHANGELOG.md
> @@ -242,6 +242,14 @@ consumption by imaging classes.
>  Additional build dependencies of auto-debianized packages can now be defined
>  by setting DEBIAN_BUILD_DEPENDS.
>  
> +### Add DEBIAN_STANDARDS_VERSION as a deb_debianize parameter
> +
> +By default, the Standards-Version field in the debian/control file is automatically
> +set based on the corresponding Debian suite.
> +If you need to override this default value, you can do so by defining
> +the DEBIAN_STANDARDS_VERSION variable in your recipe.
> +E.x: `DEBIAN_STANDARDS_VERSION:<suite-name> = <version>`
> +
>  ### Separation of ${S} and ${D} in dpkg-raw
>  
>  ${S} can now be used for checking out sources without being linked implicitly
> diff --git a/meta/classes/debianize.bbclass b/meta/classes/debianize.bbclass
> index 1f54e8f9..247489ea 100644
> --- a/meta/classes/debianize.bbclass
> +++ b/meta/classes/debianize.bbclass
> @@ -24,6 +24,13 @@ MAINTAINER ??= "Unknown maintainer <unknown@example.com>"
>  
>  DEBIANIZE_BUILD_DEPENDS ?= "debhelper-compat (= ${DEBIAN_COMPAT}), ${DEBIAN_BUILD_DEPENDS}"
>  
> +DEBIAN_STANDARDS_VERSION:buster ?= "4.3.0"
> +DEBIAN_STANDARDS_VERSION:bullseye ?= "4.5.1"
> +DEBIAN_STANDARDS_VERSION:bookworm ?= "4.6.2"
> +DEBIAN_STANDARDS_VERSION:trixie ?= "4.7.2"
> +DEBIAN_STANDARDS_VERSION:sid ?= "4.7.2"
> +DEBIAN_STANDARDS_VERSION ?= "3.9.6"
> +

Maybe even put that into meta/conf/distro/debian*.conf, similar to
DISTRO_GCC? Or define DEBIAN_STANDARDS_VERSION_DEFAULT there and do

DEBIAN_STANDARDS_VERSION ?= "${DEBIAN_STANDARDS_VERSION_DEFAULT}"

here.

>  deb_add_changelog() {
>  	changelog_v="${CHANGELOG_V}"
>  	timestamp="${DEBIAN_CHANGELOG_TIMESTAMP}"
> @@ -80,14 +87,15 @@ deb_create_control[vardeps] += "DEBIANIZE_BUILD_DEPENDS \
>                                  DEBIAN_BREAKS \
>                                  DEBIAN_BUILT_USING \
>                                  DEBIAN_CONFLICTS \
> -                                DEBIAN_RULES_REQUIRES_ROOT"
> +                                DEBIAN_RULES_REQUIRES_ROOT \
> +                                DEBIAN_STANDARDS_VERSION"
>  deb_create_control() {
>  	# Add Source section
>  	cat << EOF > ${S}/debian/control
>  Source: ${BPN}
>  Section: ${@ deb_list_beautify(d, 'DEBIAN_SECTION')}
>  Priority: optional
> -Standards-Version: 3.9.6
> +Standards-Version: ${DEBIAN_STANDARDS_VERSION}
>  Maintainer: ${MAINTAINER}
>  Build-Depends: ${@ deb_list_beautify(d, 'DEBIANIZE_BUILD_DEPENDS')}
>  EOF

Jan

Patch

diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
index cf04fa5c..31512561 100644
--- a/RECIPE-API-CHANGELOG.md
+++ b/RECIPE-API-CHANGELOG.md
@@ -242,6 +242,14 @@  consumption by imaging classes.
 Additional build dependencies of auto-debianized packages can now be defined
 by setting DEBIAN_BUILD_DEPENDS.
 
+### Add DEBIAN_STANDARDS_VERSION as a deb_debianize parameter
+
+By default, the Standards-Version field in the debian/control file is automatically
+set based on the corresponding Debian suite.
+If you need to override this default value, you can do so by defining
+the DEBIAN_STANDARDS_VERSION variable in your recipe.
+E.x: `DEBIAN_STANDARDS_VERSION:<suite-name> = <version>`
+
 ### Separation of ${S} and ${D} in dpkg-raw
 
 ${S} can now be used for checking out sources without being linked implicitly
diff --git a/meta/classes/debianize.bbclass b/meta/classes/debianize.bbclass
index 1f54e8f9..247489ea 100644
--- a/meta/classes/debianize.bbclass
+++ b/meta/classes/debianize.bbclass
@@ -24,6 +24,13 @@  MAINTAINER ??= "Unknown maintainer <unknown@example.com>"
 
 DEBIANIZE_BUILD_DEPENDS ?= "debhelper-compat (= ${DEBIAN_COMPAT}), ${DEBIAN_BUILD_DEPENDS}"
 
+DEBIAN_STANDARDS_VERSION:buster ?= "4.3.0"
+DEBIAN_STANDARDS_VERSION:bullseye ?= "4.5.1"
+DEBIAN_STANDARDS_VERSION:bookworm ?= "4.6.2"
+DEBIAN_STANDARDS_VERSION:trixie ?= "4.7.2"
+DEBIAN_STANDARDS_VERSION:sid ?= "4.7.2"
+DEBIAN_STANDARDS_VERSION ?= "3.9.6"
+
 deb_add_changelog() {
 	changelog_v="${CHANGELOG_V}"
 	timestamp="${DEBIAN_CHANGELOG_TIMESTAMP}"
@@ -80,14 +87,15 @@  deb_create_control[vardeps] += "DEBIANIZE_BUILD_DEPENDS \
                                 DEBIAN_BREAKS \
                                 DEBIAN_BUILT_USING \
                                 DEBIAN_CONFLICTS \
-                                DEBIAN_RULES_REQUIRES_ROOT"
+                                DEBIAN_RULES_REQUIRES_ROOT \
+                                DEBIAN_STANDARDS_VERSION"
 deb_create_control() {
 	# Add Source section
 	cat << EOF > ${S}/debian/control
 Source: ${BPN}
 Section: ${@ deb_list_beautify(d, 'DEBIAN_SECTION')}
 Priority: optional
-Standards-Version: 3.9.6
+Standards-Version: ${DEBIAN_STANDARDS_VERSION}
 Maintainer: ${MAINTAINER}
 Build-Depends: ${@ deb_list_beautify(d, 'DEBIANIZE_BUILD_DEPENDS')}
 EOF