diff mbox series

classes: Move package RDEPENDS processing out of debian.bbclass

Message ID 20231103131428.2620444-1-s.zhmylev@yadro.com
State Accepted, archived
Commit 8313a4201cde39c444aa6fbe82e46a767fc31f6b
Headers show
Series classes: Move package RDEPENDS processing out of debian.bbclass | expand

Commit Message

Sergey Zhmylev Nov. 3, 2023, 1:14 p.m. UTC
From: Sergei Zhmylev <s.zhmylev@yadro.com>

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.

Signed-off-by: Sergei Zhmylev <s.zhmylev@yadro.com>
---
 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

Comments

Richard Purdie Nov. 3, 2023, 1:48 p.m. UTC | #1
On Fri, 2023-11-03 at 16:14 +0300, Sergey Zhmylev wrote:
> From: Sergei Zhmylev <s.zhmylev@yadro.com>
> 
> 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.
> 
> Signed-off-by: Sergei Zhmylev <s.zhmylev@yadro.com>
> ---
>  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
diff mbox series

Patch

diff --git a/meta/classes-global/debian.bbclass b/meta/classes-global/debian.bbclass
index 7135d74837c..074c1c306cf 100644
--- a/meta/classes-global/debian.bbclass
+++ b/meta/classes-global/debian.bbclass
@@ -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"
diff --git a/meta/classes-global/package-deptasks.bbclass b/meta/classes-global/package-deptasks.bbclass
new file mode 100644
index 00000000000..0339cbc3a24
--- /dev/null
+++ b/meta/classes-global/package-deptasks.bbclass
@@ -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", "")
+}
diff --git a/meta/conf/distro/defaultsetup.conf b/meta/conf/distro/defaultsetup.conf
index 90b68057ad4..02a874b4198 100644
--- a/meta/conf/distro/defaultsetup.conf
+++ b/meta/conf/distro/defaultsetup.conf
@@ -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"