Skip to contentSkip to conversation

classes: Move package RDEPENDS processing out of debian.bbclass

PATCH Superseded [email protected] 2 participants 2 messages Nov 3, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 classes: Move package RDEPENDS processing out of debian.bbclass

From: Sergei Zhmylev <[email protected]>

INHERIT_DIRSTO by default includes debian.bbclass which in turn properly establishes dependencies between package management tasks and build process. Debian class also unconditionally renames several packages in a Debian way. In order to allow disabling of such renaming rules, the logic of RDEPENDS handling is moved to a separate package-deptasks.bbclass. This commit also solves the SDK building issue without debian.bbclass.

---
 meta/classes-global/debian.bbclass           | 22 +++-------------
 meta/classes-global/package-deptasks.bbclass | 27 ++++++++++++++++++++
 meta/conf/distro/defaultsetup.conf           |  2 +-
 3 files changed, 32 insertions(+), 19 deletions(-)
 create mode 100644 meta/classes-global/package-deptasks.bbclass
meta/classes-global/debian.bbclass +4 -18
index 7135d74837c..074c1c306cf 100644
@@ -14,25 +14,13 @@
 #
 # Better expressed as ensure all RDEPENDS package before we package
 # This means we can't have circular RDEPENDS/RRECOMMENDS
+#
+# Logic of processing dependencies moved to a separate package-deptasks.bbclass
+# to allow removing inheritance on debian.bbclass
 
 AUTO_LIBNAME_PKGS = "${PACKAGES}"
 
-inherit package
-
-DEBIANRDEP = "do_packagedata"
-do_package_write_ipk[deptask] = "${DEBIANRDEP}"
-do_package_write_deb[deptask] = "${DEBIANRDEP}"
-do_package_write_tar[deptask] = "${DEBIANRDEP}"
-do_package_write_rpm[deptask] = "${DEBIANRDEP}"
-do_package_write_ipk[rdeptask] = "${DEBIANRDEP}"
-do_package_write_deb[rdeptask] = "${DEBIANRDEP}"
-do_package_write_tar[rdeptask] = "${DEBIANRDEP}"
-do_package_write_rpm[rdeptask] = "${DEBIANRDEP}"
-
-python () {
-    if not d.getVar("PACKAGES"):
-        d.setVar("DEBIANRDEP", "")
-}
+inherit package package-deptasks
 
 python debian_package_name_hook () {
     import glob, copy, stat, errno, re, pathlib, subprocess
@@ -152,5 +140,3 @@ python debian_package_name_hook () {
 }
 
 EXPORT_FUNCTIONS package_name_hook
-
-DEBIAN_NAMES = "1"
meta/classes-global/package-deptasks.bbclass new file +27 -0
new file mode 100644
index 00000000000..0339cbc3a24
@@ -0,0 +1,27 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+# This class ensures all the runtime packages built by the time
+# dynamic renaming occures.
+# This part moved here from debian.bbclass (see for reference) in
+# order to allow disabling default inheritance on debian package renaming.
+
+inherit package
+
+DEBIANRDEP = "do_packagedata"
+do_package_write_ipk[deptask] = "${DEBIANRDEP}"
+do_package_write_deb[deptask] = "${DEBIANRDEP}"
+do_package_write_tar[deptask] = "${DEBIANRDEP}"
+do_package_write_rpm[deptask] = "${DEBIANRDEP}"
+do_package_write_ipk[rdeptask] = "${DEBIANRDEP}"
+do_package_write_deb[rdeptask] = "${DEBIANRDEP}"
+do_package_write_tar[rdeptask] = "${DEBIANRDEP}"
+do_package_write_rpm[rdeptask] = "${DEBIANRDEP}"
+
+python () {
+    if not d.getVar("PACKAGES"):
+        d.setVar("DEBIANRDEP", "")
+}
meta/conf/distro/defaultsetup.conf +1 -1
index 90b68057ad4..02a874b4198 100644
@@ -14,7 +14,7 @@ TMPDIR .= "${TCLIBCAPPEND}"
 
 USER_CLASSES ?= ""
 PACKAGE_CLASSES ?= "package_ipk"
-INHERIT_DISTRO ?= "debian devshell sstate license remove-libtool create-spdx"
+INHERIT_DISTRO ?= "package-deptasks debian devshell sstate license remove-libtool create-spdx"
 INHERIT += "${PACKAGE_CLASSES} ${USER_CLASSES} ${INHERIT_DISTRO}"
 
 INIT_MANAGER ??= "none"
Signature · 1 line
2.40.0
#1 lore raw
Quoted 9 lines · Sergey Zhmylev

From: Sergei Zhmylev <[email protected]>

INHERIT_DIRSTO by default includes debian.bbclass which in turn properly establishes dependencies between package management tasks and build process. Debian class also unconditionally renames several packages in a Debian way. In order to allow disabling of such renaming rules, the logic of RDEPENDS handling is moved to a separate package-deptasks.bbclass. This commit also solves the SDK building issue without debian.bbclass.

Quoted 7 lines
---
 meta/classes-global/debian.bbclass           | 22 +++-------------
 meta/classes-global/package-deptasks.bbclass | 27 ++++++++++++++++++++
 meta/conf/distro/defaultsetup.conf           |  2 +-
 3 files changed, 32 insertions(+), 19 deletions(-)
 create mode 100644 meta/classes-global/package-deptasks.bbclass

I think this patch does raise a good point, PKG_ renaming doesn't work unless you have the dependencies in debian.bbclass.

Since we rely on PKG renaming in places, I suspect we should move the dependencies into package.bbclass or the main classes unconditionally since they're not really optional this point?

Cheers,

Richard