From: srinuvasan <
srinuv...@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.
Signed-off-by: srinuvasan <
srinuv...@siemens.com>
---
 RECIPE-API-CHANGELOG.md        |  7 +++++++
 meta/classes/debianize.bbclass | 14 ++++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
index cf04fa5c..bb5f9b9c 100644
--- a/RECIPE-API-CHANGELOG.md
+++ b/RECIPE-API-CHANGELOG.md
@@ -242,6 +242,13 @@ consumption by imaging classes.
 Additional build dependencies of auto-debianized packages can now be defined
 by setting DEBIAN_BUILD_DEPENDS.
 
+### Add 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 STANDARDS_VERSION variable in your recipe.
+
 ### 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..2fad991a 100644
--- a/meta/classes/debianize.bbclass
+++ b/meta/classes/debianize.bbclass
@@ -80,14 +80,24 @@ deb_create_control[vardeps] += "DEBIANIZE_BUILD_DEPENDS \
                                 DEBIAN_BREAKS \
                                 DEBIAN_BUILT_USING \
                                 DEBIAN_CONFLICTS \
-                                DEBIAN_RULES_REQUIRES_ROOT"
+                                DEBIAN_RULES_REQUIRES_ROOT \
+                                STANDARDS_VERSION"
 deb_create_control() {
 	# Add Source section
+	if [ -z "${STANDARDS_VERSION}" ]; then
+		case "${BASE_DISTRO_CODENAME}" in
+			buster)   STANDARDS_VERSION="4.3.0" ;;
+			bullseye) STANDARDS_VERSION="4.5.1" ;;
+			bookworm) STANDARDS_VERSION="4.6.2" ;;
+			trixie|sid|*) STANDARDS_VERSION="4.7.2" ;;
+		esac
+	fi
+
 	cat << EOF > ${S}/debian/control
 Source: ${BPN}
 Section: ${@ deb_list_beautify(d, 'DEBIAN_SECTION')}
 Priority: optional
-Standards-Version: 3.9.6
+Standards-Version: ${STANDARDS_VERSION}
 Maintainer: ${MAINTAINER}
 Build-Depends: ${@ deb_list_beautify(d, 'DEBIANIZE_BUILD_DEPENDS')}
 EOF
-- 
2.39.5