summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2022-06-24 16:31:04 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-06-28 23:49:37 +0100
commit4705dd264681d908f144dd4d9bf1f6175f68d8b9 (patch)
treeefd7301a7b394e9f87d81630f4cab19766258303 /meta/lib
parente8f188c510a4438c10731e09b379023859992f82 (diff)
downloadpoky-4705dd264681d908f144dd4d9bf1f6175f68d8b9.tar.gz
package_manager: Change complementary package handling to not include soft dependencies
We've some long standing bugs where the RDEPENDS from -dev packages causes problems, e.g. dropbear and openssh components on an image working fine together but then the SDK failing to build as the main openssh and dropbear packages conflict with each other (pulled in by openssh-dev and dropbear-dev). We propose changing the behavour of complementary package installation to ignore RRECOMMENDS. If we then change the ${PN}-dev dependency on ${PN} to a RRECOMMENDS, we can avoid many of the issues people run into yet still have the desired behaviour of ${PN}-dev pulling in ${PN}. This therefore changes the package manager code so that it doesn't follow RRECOMMENDS for completementary package globs. [RP: Added deb support] (From OE-Core rev: b44b0b9294675f89aa51ff84f532664f4c479677) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/package_manager/__init__.py4
-rw-r--r--meta/lib/oe/package_manager/deb/__init__.py10
-rw-r--r--meta/lib/oe/package_manager/ipk/__init__.py4
-rw-r--r--meta/lib/oe/package_manager/rpm/__init__.py4
4 files changed, 14 insertions, 8 deletions
diff --git a/meta/lib/oe/package_manager/__init__.py b/meta/lib/oe/package_manager/__init__.py
index 80bc1a6bc6..d3b45705ec 100644
--- a/meta/lib/oe/package_manager/__init__.py
+++ b/meta/lib/oe/package_manager/__init__.py
@@ -266,7 +266,7 @@ class PackageManager(object, metaclass=ABCMeta):
266 pass 266 pass
267 267
268 @abstractmethod 268 @abstractmethod
269 def install(self, pkgs, attempt_only=False): 269 def install(self, pkgs, attempt_only=False, hard_depends_only=False):
270 """ 270 """
271 Install a list of packages. 'pkgs' is a list object. If 'attempt_only' is 271 Install a list of packages. 'pkgs' is a list object. If 'attempt_only' is
272 True, installation failures are ignored. 272 True, installation failures are ignored.
@@ -396,7 +396,7 @@ class PackageManager(object, metaclass=ABCMeta):
396 bb.note("Installing complementary packages ... %s (skipped already provided packages %s)" % ( 396 bb.note("Installing complementary packages ... %s (skipped already provided packages %s)" % (
397 ' '.join(install_pkgs), 397 ' '.join(install_pkgs),
398 ' '.join(skip_pkgs))) 398 ' '.join(skip_pkgs)))
399 self.install(install_pkgs) 399 self.install(install_pkgs, hard_depends_only=True)
400 except subprocess.CalledProcessError as e: 400 except subprocess.CalledProcessError as e:
401 bb.fatal("Could not compute complementary packages list. Command " 401 bb.fatal("Could not compute complementary packages list. Command "
402 "'%s' returned %d:\n%s" % 402 "'%s' returned %d:\n%s" %
diff --git a/meta/lib/oe/package_manager/deb/__init__.py b/meta/lib/oe/package_manager/deb/__init__.py
index 86ddb130ad..b96ea0bad4 100644
--- a/meta/lib/oe/package_manager/deb/__init__.py
+++ b/meta/lib/oe/package_manager/deb/__init__.py
@@ -289,14 +289,18 @@ class DpkgPM(OpkgDpkgPM):
289 289
290 self.deploy_dir_unlock() 290 self.deploy_dir_unlock()
291 291
292 def install(self, pkgs, attempt_only=False): 292 def install(self, pkgs, attempt_only=False, hard_depends_only=False):
293 if attempt_only and len(pkgs) == 0: 293 if attempt_only and len(pkgs) == 0:
294 return 294 return
295 295
296 os.environ['APT_CONFIG'] = self.apt_conf_file 296 os.environ['APT_CONFIG'] = self.apt_conf_file
297 297
298 cmd = "%s %s install --allow-downgrades --allow-remove-essential --allow-change-held-packages --allow-unauthenticated --no-remove %s" % \ 298 extra_args = ""
299 (self.apt_get_cmd, self.apt_args, ' '.join(pkgs)) 299 if hard_depends_only:
300 extra_args = "--no-install-recommends"
301
302 cmd = "%s %s install --allow-downgrades --allow-remove-essential --allow-change-held-packages --allow-unauthenticated --no-remove %s %s" % \
303 (self.apt_get_cmd, self.apt_args, extra_args, ' '.join(pkgs))
300 304
301 try: 305 try:
302 bb.note("Installing the following packages: %s" % ' '.join(pkgs)) 306 bb.note("Installing the following packages: %s" % ' '.join(pkgs))
diff --git a/meta/lib/oe/package_manager/ipk/__init__.py b/meta/lib/oe/package_manager/ipk/__init__.py
index 4cd3963111..6fd2f021b6 100644
--- a/meta/lib/oe/package_manager/ipk/__init__.py
+++ b/meta/lib/oe/package_manager/ipk/__init__.py
@@ -337,7 +337,7 @@ class OpkgPM(OpkgDpkgPM):
337 337
338 self.deploy_dir_unlock() 338 self.deploy_dir_unlock()
339 339
340 def install(self, pkgs, attempt_only=False): 340 def install(self, pkgs, attempt_only=False, hard_depends_only=False):
341 if not pkgs: 341 if not pkgs:
342 return 342 return
343 343
@@ -346,6 +346,8 @@ class OpkgPM(OpkgDpkgPM):
346 cmd += " --add-exclude %s" % exclude 346 cmd += " --add-exclude %s" % exclude
347 for bad_recommendation in (self.d.getVar("BAD_RECOMMENDATIONS") or "").split(): 347 for bad_recommendation in (self.d.getVar("BAD_RECOMMENDATIONS") or "").split():
348 cmd += " --add-ignore-recommends %s" % bad_recommendation 348 cmd += " --add-ignore-recommends %s" % bad_recommendation
349 if hard_depends_only:
350 cmd += " --no-install-recommends"
349 cmd += " install " 351 cmd += " install "
350 cmd += " ".join(pkgs) 352 cmd += " ".join(pkgs)
351 353
diff --git a/meta/lib/oe/package_manager/rpm/__init__.py b/meta/lib/oe/package_manager/rpm/__init__.py
index b392581069..d97dab3293 100644
--- a/meta/lib/oe/package_manager/rpm/__init__.py
+++ b/meta/lib/oe/package_manager/rpm/__init__.py
@@ -181,7 +181,7 @@ class RpmPM(PackageManager):
181 os.environ['NATIVE_ROOT'] = self.d.getVar('STAGING_DIR_NATIVE') 181 os.environ['NATIVE_ROOT'] = self.d.getVar('STAGING_DIR_NATIVE')
182 182
183 183
184 def install(self, pkgs, attempt_only = False): 184 def install(self, pkgs, attempt_only=False, hard_depends_only=False):
185 if len(pkgs) == 0: 185 if len(pkgs) == 0:
186 return 186 return
187 self._prepare_pkg_transaction() 187 self._prepare_pkg_transaction()
@@ -192,7 +192,7 @@ class RpmPM(PackageManager):
192 192
193 output = self._invoke_dnf((["--skip-broken"] if attempt_only else []) + 193 output = self._invoke_dnf((["--skip-broken"] if attempt_only else []) +
194 (["-x", ",".join(exclude_pkgs)] if len(exclude_pkgs) > 0 else []) + 194 (["-x", ",".join(exclude_pkgs)] if len(exclude_pkgs) > 0 else []) +
195 (["--setopt=install_weak_deps=False"] if self.d.getVar('NO_RECOMMENDATIONS') == "1" else []) + 195 (["--setopt=install_weak_deps=False"] if (hard_depends_only or self.d.getVar('NO_RECOMMENDATIONS') == "1") else []) +
196 (["--nogpgcheck"] if self.d.getVar('RPM_SIGN_PACKAGES') != '1' else ["--setopt=gpgcheck=True"]) + 196 (["--nogpgcheck"] if self.d.getVar('RPM_SIGN_PACKAGES') != '1' else ["--setopt=gpgcheck=True"]) +
197 ["install"] + 197 ["install"] +
198 pkgs) 198 pkgs)