sdk.py: fix conflicts of packages
PATCH 1/1 sdk.py: fix conflicts of packages
If packages are conveyed to smart to install at the same time, conflicts will not happen.
Try to install packages into sdk image at the same time
Signed-off-by Jian Liu <[email protected]>
--- sdk.py | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 96 insertions(+), 12 deletions(-)
meta/lib/oe/sdk.py +96 -12
@@ -107,10 +107,38 @@ class RpmSdk(Sdk): pm.dump_all_available_pkgs() pm.update() - for pkg_type in self.install_order: - if pkg_type in pkgs_to_install: - pm.install(pkgs_to_install[pkg_type], - [False, True][pkg_type == Manifest.PKG_TYPE_ATTEMPT_ONLY]) + except_pkgs = self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY', True).replace("*","").split() + + # Here is only a workaround. + # The packages are separated into 3 parts --- + # -- attempt only (in pkgs_to_install) + # -- must install (in pkgs_to_install) + # -- comlementary (add -dev and -dbg after the packages in pkgs_to_install) + # If pkgs_to_install contains libxml2-dev and lib32-libxml2, the result will be + # libxml2-dev is installed but lib32-libxml2-dev will not be. + # Reason is that smart can not handle conflicts unless lib32-libxml2-dev and libxml2-dev + # is installed at the same time. That is "pm.install('lib32-libxml2-dev libxml2-dev'). + # But the situation is "pm.install('lib32-libxml2-dev'); pm.install('libxml2-dev')" + # Here try to put lib32-libxml2-dev and libxml2-dev in comlementary packages, so that + # they can be installed at the same time + pkgs = [] + pkgs_attempt = [] + for pkg_type in pkgs_to_install: + for pkg in pkgs_to_install[pkg_type]: + for except_pkg in except_pkgs: + if "packagegroup" not in pkg and pkg.endswith(except_pkg): + pkg = pkg[:-len(except_pkg)] + + if pkg_type == Manifest.PKG_TYPE_ATTEMPT_ONLY: + if pkg not in pkgs_attempt: + pkgs_attempt.append(pkg) + else: + if pkg not in pkgs_attempt: + pkgs.append(pkg) + + pm.install(pkgs) + + pm.install(pkgs_attempt, True) def _populate(self): bb.note("Installing TARGET packages")
@@ -184,10 +212,38 @@ class OpkgSdk(Sdk): pm.update() - for pkg_type in self.install_order: - if pkg_type in pkgs_to_install: - pm.install(pkgs_to_install[pkg_type], - [False, True][pkg_type == Manifest.PKG_TYPE_ATTEMPT_ONLY]) + except_pkgs = self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY', True).replace("*","").split() + + # Here is only a workaround. + # The packages are separated into 3 parts --- + # -- attempt only (in pkgs_to_install) + # -- must install (in pkgs_to_install) + # -- comlementary (add -dev and -dbg after the packages in pkgs_to_install) + # If pkgs_to_install contains libxml2-dev and lib32-libxml2, the result will be + # libxml2-dev is installed but lib32-libxml2-dev will not be. + # Reason is that smart can not handle conflicts unless lib32-libxml2-dev and libxml2-dev + # is installed at the same time. That is "pm.install('lib32-libxml2-dev libxml2-dev'). + # But the situation is "pm.install('lib32-libxml2-dev'); pm.install('libxml2-dev')" + # Here try to put lib32-libxml2-dev and libxml2-dev in comlementary packages, so that + # they can be installed at the same time + pkgs = [] + pkgs_attempt = [] + for pkg_type in pkgs_to_install: + for pkg in pkgs_to_install[pkg_type]: + for except_pkg in except_pkgs: + if "packagegroup" not in pkg and pkg.endswith(except_pkg): + pkg = pkg[:-len(except_pkg)] + + if pkg_type == Manifest.PKG_TYPE_ATTEMPT_ONLY: + if pkg not in pkgs_attempt: + pkgs_attempt.append(pkg) + else: + if pkg not in pkgs_attempt: + pkgs.append(pkg) + + pm.install(pkgs) + + pm.install(pkgs_attempt, True) def _populate(self): bb.note("Installing TARGET packages")
@@ -260,10 +316,38 @@ class DpkgSdk(Sdk): pm.write_index() pm.update() - for pkg_type in self.install_order: - if pkg_type in pkgs_to_install: - pm.install(pkgs_to_install[pkg_type], - [False, True][pkg_type == Manifest.PKG_TYPE_ATTEMPT_ONLY]) + except_pkgs = self.d.getVar('SDKIMAGE_INSTALL_COMPLEMENTARY', True).replace("*","").split() + + # Here is only a workaround. + # The packages are separated into 3 parts --- + # -- attempt only (in pkgs_to_install) + # -- must install (in pkgs_to_install) + # -- comlementary (add -dev and -dbg after the packages in pkgs_to_install) + # If pkgs_to_install contains libxml2-dev and lib32-libxml2, the result will be + # libxml2-dev is installed but lib32-libxml2-dev will not be. + # Reason is that smart can not handle conflicts unless lib32-libxml2-dev and libxml2-dev + # is installed at the same time. That is "pm.install('lib32-libxml2-dev libxml2-dev'). + # But the situation is "pm.install('lib32-libxml2-dev'); pm.install('libxml2-dev')" + # Here try to put lib32-libxml2-dev and libxml2-dev in comlementary packages, so that + # they can be installed at the same time + pkgs = [] + pkgs_attempt = [] + for pkg_type in pkgs_to_install: + for pkg in pkgs_to_install[pkg_type]: + for except_pkg in except_pkgs: + if "packagegroup" not in pkg and pkg.endswith(except_pkg): + pkg = pkg[:-len(except_pkg)] + + if pkg_type == Manifest.PKG_TYPE_ATTEMPT_ONLY: + if pkg not in pkgs_attempt: + pkgs_attempt.append(pkg) + else: + if pkg not in pkgs_attempt: + pkgs.append(pkg) + + pm.install(pkgs) + + pm.install(pkgs_attempt, True) def _populate(self): bb.note("Installing TARGET packages")