diff mbox series

[RFC,master] populate_sdk_base: Add SDKIMAGE_INSTALL_COMPLEMENTARY_HARD_DEPENDS_ONLY

Message ID 20240927132040.200122-1-claus.stovgaard@gmail.com
State New
Headers show
Series [RFC,master] populate_sdk_base: Add SDKIMAGE_INSTALL_COMPLEMENTARY_HARD_DEPENDS_ONLY | expand

Commit Message

Claus Stovgaard Sept. 27, 2024, 1:20 p.m. UTC
SDKIMAGE_INSTALL_COMPLEMENTARY_HARD_DEPENDS_ONLY is a new variable to
enable installation of recommended complementary packages in the classic
sdk. Use it to get populate_sdk behave like Kirkstone and earlier.

As installing complementary recommended packages is known to cause bugs
it was disabled. Though it can be usefull when having dummy packages
with DEPENDS to create SDK's. Use this variable with caution.

Signed-off-by: Claus Stovgaard <claus.stovgaard@gmail.com>
---
 documentation/ref-manual/variables.rst        | 7 +++++++
 meta/classes-recipe/populate_sdk_base.bbclass | 1 +
 meta/conf/documentation.conf                  | 1 +
 meta/lib/oe/package_manager/__init__.py       | 4 ++--
 meta/lib/oe/package_manager/deb/sdk.py        | 4 +++-
 meta/lib/oe/package_manager/ipk/sdk.py        | 4 +++-
 meta/lib/oe/package_manager/rpm/sdk.py        | 6 ++++--
 7 files changed, 21 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst
index 32c9e7407d..44ec6d59a6 100644
--- a/documentation/ref-manual/variables.rst
+++ b/documentation/ref-manual/variables.rst
@@ -7658,6 +7658,13 @@  system and gives an overview of their function and contents.
 
          $ bitbake -c populate_sdk imagename
 
+   :term:`SDKIMAGE_INSTALL_COMPLEMENTARY_HARD_DEPENDS_ONLY`
+      Set to '0' to install recommended complementary packages as part of populate_sdk.
+      Used to make the clasical sdk behave like Kirkstone and earlier yocto releases.
+      Complementary recommended packages was disabled for default because of long standing
+      bugs where RDEPENDS from -dev packages causes problems in sdk. Example with conflict
+      for main openssh and dropbear packages. Use with caution.
+
    :term:`SDKMACHINE`
       The machine for which the SDK is built. In other words, the SDK is built
       such that it runs on the target you specify with the :term:`SDKMACHINE`
diff --git a/meta/classes-recipe/populate_sdk_base.bbclass b/meta/classes-recipe/populate_sdk_base.bbclass
index 16013d5872..09e9c5b61c 100644
--- a/meta/classes-recipe/populate_sdk_base.bbclass
+++ b/meta/classes-recipe/populate_sdk_base.bbclass
@@ -37,6 +37,7 @@  def complementary_globs(featurevar, d):
 SDKIMAGE_FEATURES ??= "dev-pkgs dbg-pkgs src-pkgs ${@bb.utils.contains('DISTRO_FEATURES', 'api-documentation', 'doc-pkgs', '', d)}"
 SDKIMAGE_INSTALL_COMPLEMENTARY = '${@complementary_globs("SDKIMAGE_FEATURES", d)}'
 SDKIMAGE_INSTALL_COMPLEMENTARY[vardeps] += "SDKIMAGE_FEATURES"
+SDKIMAGE_INSTALL_COMPLEMENTARY_HARD_DEPENDS_ONLY ??= "1"
 
 PACKAGE_ARCHS:append:task-populate-sdk = " sdk-provides-dummy-target"
 SDK_PACKAGE_ARCHS += "sdk-provides-dummy-${SDKPKGSUFFIX}"
diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
index 3f130120c0..84e2fef688 100644
--- a/meta/conf/documentation.conf
+++ b/meta/conf/documentation.conf
@@ -376,6 +376,7 @@  SDK_DIR[doc] = "The parent directory used by the OpenEmbedded build system when
 SDK_NAME[doc] = "The base name for SDK output files."
 SDK_OUTPUT[doc] = "The location used by the OpenEmbedded build system when creating SDK output."
 SDKIMAGE_FEATURES[doc] = "Equivalent to IMAGE_FEATURES. However, this variable applies to the SDK generated from an image using the command 'bitbake -c populate_sdk imagename'."
+SDKIMAGE_INSTALL_COMPLEMENTARY_HARD_DEPENDS_ONLY[doc] = "Set to something else than '1' to install recommended complementary packages as part of sdk. Used to make populate_sdk behave like Kirkstone and earlier"
 SDKMACHINE[doc] = "Specifies the architecture (i.e. i686 or x86_64) for which to build SDK and ADT items."
 SECTION[doc] = "The section in which packages should be categorized. Package management utilities can make use of this variable."
 SELECTED_OPTIMIZATION[doc] = "The variable takes the value of FULL_OPTIMIZATION unless DEBUG_BUILD = '1'. In this case, the value of DEBUG_OPTIMIZATION is used."
diff --git a/meta/lib/oe/package_manager/__init__.py b/meta/lib/oe/package_manager/__init__.py
index d3b2317894..50e78c4017 100644
--- a/meta/lib/oe/package_manager/__init__.py
+++ b/meta/lib/oe/package_manager/__init__.py
@@ -344,7 +344,7 @@  class PackageManager(object, metaclass=ABCMeta):
                          "'%s' returned %d:\n%s" %
                          (' '.join(cmd), e.returncode, e.output.decode("utf-8")))
 
-    def install_complementary(self, globs=None):
+    def install_complementary(self, globs=None, hard_depends_only=True):
         """
         Install complementary packages based upon the list of currently installed
         packages e.g. locales, *-dev, *-dbg, etc. Note: every backend needs to
@@ -399,7 +399,7 @@  class PackageManager(object, metaclass=ABCMeta):
                 bb.note("Installing complementary packages ... %s (skipped already provided packages %s)" % (
                     ' '.join(install_pkgs),
                     ' '.join(skip_pkgs)))
-                self.install(install_pkgs, hard_depends_only=True)
+                self.install(install_pkgs, hard_depends_only=hard_depends_only)
             except subprocess.CalledProcessError as e:
                 bb.fatal("Could not compute complementary packages list. Command "
                          "'%s' returned %d:\n%s" %
diff --git a/meta/lib/oe/package_manager/deb/sdk.py b/meta/lib/oe/package_manager/deb/sdk.py
index 6f3005053e..6232c47f4a 100644
--- a/meta/lib/oe/package_manager/deb/sdk.py
+++ b/meta/lib/oe/package_manager/deb/sdk.py
@@ -65,7 +65,9 @@  class PkgSdk(Sdk):
         bb.note("Installing TARGET packages")
         self._populate_sysroot(self.target_pm, self.target_manifest)
 
-        self.target_pm.install_complementary(self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY'))
+        hard_depends_only = (self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY_HARD_DEPENDS_ONLY') == '1')
+        self.target_pm.install_complementary(self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY'),
+            hard_depends_only)
 
         self.target_pm.run_pre_post_installs()
 
diff --git a/meta/lib/oe/package_manager/ipk/sdk.py b/meta/lib/oe/package_manager/ipk/sdk.py
index 3acd55f548..e8663523df 100644
--- a/meta/lib/oe/package_manager/ipk/sdk.py
+++ b/meta/lib/oe/package_manager/ipk/sdk.py
@@ -61,7 +61,9 @@  class PkgSdk(Sdk):
         bb.note("Installing TARGET packages")
         self._populate_sysroot(self.target_pm, self.target_manifest)
 
-        self.target_pm.install_complementary(self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY'))
+        hard_depends_only = (self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY_HARD_DEPENDS_ONLY') == '1')
+        self.target_pm.install_complementary(self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY'),
+            hard_depends_only)
 
         env_bkp = os.environ.copy()
         os.environ['PATH'] = self.d.expand("${COREBASE}/scripts/nativesdk-intercept") + \
diff --git a/meta/lib/oe/package_manager/rpm/sdk.py b/meta/lib/oe/package_manager/rpm/sdk.py
index ea79fe050b..a3f505c023 100644
--- a/meta/lib/oe/package_manager/rpm/sdk.py
+++ b/meta/lib/oe/package_manager/rpm/sdk.py
@@ -65,8 +65,10 @@  class PkgSdk(Sdk):
         bb.note("Installing TARGET packages")
         self._populate_sysroot(self.target_pm, self.target_manifest)
 
-        self.target_pm.install_complementary(self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY'))
-
+        hard_depends_only = (self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY_HARD_DEPENDS_ONLY') == '1')
+        self.target_pm.install_complementary(self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY'),
+            hard_depends_only)
+        
         env_bkp = os.environ.copy()
         os.environ['PATH'] = self.d.expand("${COREBASE}/scripts/nativesdk-intercept") + \
                              os.pathsep + os.environ["PATH"]