summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorClaus Stovgaard <claus.stovgaard@gmail.com>2024-10-07 22:39:46 +0200
committerSteve Sakoman <steve@sakoman.com>2024-11-26 05:37:09 -0800
commit28bf1ab6759606a1bfc7526e02eda466173d0cd7 (patch)
treecee3ca3b4afec79847b3e51a6327dd3a097abac2 /meta
parent3d90719ae34e5ebcd79bb512d0fe3b7009b607f7 (diff)
downloadpoky-28bf1ab6759606a1bfc7526e02eda466173d0cd7.tar.gz
lib/oe/package-manager: skip processing installed-pkgs with empty globs
We can skip processing the installed-pkgs file if globs is empty. This is the case if self.d.getVar for IMAGE_INSTALL_COMPLEMENTARY returns an empty string. If globs is an empty string the result from processing with empty glob in oe-pkgdata-util will always be 0 packages to install. Instead of return early on this we just skip and still generate the locale archive if needed. (From OE-Core rev: be4dbec9e79b51b9b72670291ba02c4f6d3258dd) Signed-off-by: Claus Stovgaard <claus.stovgaard@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 160c45c83d5addf01e4834cf896af871bd6fca7f) Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oe/package_manager/__init__.py76
1 files changed, 37 insertions, 39 deletions
diff --git a/meta/lib/oe/package_manager/__init__.py b/meta/lib/oe/package_manager/__init__.py
index d3b2317894..2100a97c12 100644
--- a/meta/lib/oe/package_manager/__init__.py
+++ b/meta/lib/oe/package_manager/__init__.py
@@ -365,45 +365,43 @@ class PackageManager(object, metaclass=ABCMeta):
365 for complementary_linguas in (self.d.getVar('IMAGE_LINGUAS_COMPLEMENTARY') or "").split(): 365 for complementary_linguas in (self.d.getVar('IMAGE_LINGUAS_COMPLEMENTARY') or "").split():
366 globs += (" " + complementary_linguas) % lang 366 globs += (" " + complementary_linguas) % lang
367 367
368 if globs is None: 368 if globs:
369 return 369 # we need to write the list of installed packages to a file because the
370 370 # oe-pkgdata-util reads it from a file
371 # we need to write the list of installed packages to a file because the 371 with tempfile.NamedTemporaryFile(mode="w+", prefix="installed-pkgs") as installed_pkgs:
372 # oe-pkgdata-util reads it from a file 372 pkgs = self.list_installed()
373 with tempfile.NamedTemporaryFile(mode="w+", prefix="installed-pkgs") as installed_pkgs: 373
374 pkgs = self.list_installed() 374 provided_pkgs = set()
375 375 for pkg in pkgs.values():
376 provided_pkgs = set() 376 provided_pkgs |= set(pkg.get('provs', []))
377 for pkg in pkgs.values(): 377
378 provided_pkgs |= set(pkg.get('provs', [])) 378 output = oe.utils.format_pkg_list(pkgs, "arch")
379 379 installed_pkgs.write(output)
380 output = oe.utils.format_pkg_list(pkgs, "arch") 380 installed_pkgs.flush()
381 installed_pkgs.write(output) 381
382 installed_pkgs.flush() 382 cmd = ["oe-pkgdata-util",
383 383 "-p", self.d.getVar('PKGDATA_DIR'), "glob", installed_pkgs.name,
384 cmd = ["oe-pkgdata-util", 384 globs]
385 "-p", self.d.getVar('PKGDATA_DIR'), "glob", installed_pkgs.name, 385 exclude = self.d.getVar('PACKAGE_EXCLUDE_COMPLEMENTARY')
386 globs] 386 if exclude:
387 exclude = self.d.getVar('PACKAGE_EXCLUDE_COMPLEMENTARY') 387 cmd.extend(['--exclude=' + '|'.join(exclude.split())])
388 if exclude: 388 try:
389 cmd.extend(['--exclude=' + '|'.join(exclude.split())]) 389 bb.note('Running %s' % cmd)
390 try: 390 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
391 bb.note('Running %s' % cmd) 391 stdout, stderr = proc.communicate()
392 proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 392 if stderr: bb.note(stderr.decode("utf-8"))
393 stdout, stderr = proc.communicate() 393 complementary_pkgs = stdout.decode("utf-8")
394 if stderr: bb.note(stderr.decode("utf-8")) 394 complementary_pkgs = set(complementary_pkgs.split())
395 complementary_pkgs = stdout.decode("utf-8") 395 skip_pkgs = sorted(complementary_pkgs & provided_pkgs)
396 complementary_pkgs = set(complementary_pkgs.split()) 396 install_pkgs = sorted(complementary_pkgs - provided_pkgs)
397 skip_pkgs = sorted(complementary_pkgs & provided_pkgs) 397 bb.note("Installing complementary packages ... %s (skipped already provided packages %s)" % (
398 install_pkgs = sorted(complementary_pkgs - provided_pkgs) 398 ' '.join(install_pkgs),
399 bb.note("Installing complementary packages ... %s (skipped already provided packages %s)" % ( 399 ' '.join(skip_pkgs)))
400 ' '.join(install_pkgs), 400 self.install(install_pkgs, hard_depends_only=True)
401 ' '.join(skip_pkgs))) 401 except subprocess.CalledProcessError as e:
402 self.install(install_pkgs, hard_depends_only=True) 402 bb.fatal("Could not compute complementary packages list. Command "
403 except subprocess.CalledProcessError as e: 403 "'%s' returned %d:\n%s" %
404 bb.fatal("Could not compute complementary packages list. Command " 404 (' '.join(cmd), e.returncode, e.output.decode("utf-8")))
405 "'%s' returned %d:\n%s" %
406 (' '.join(cmd), e.returncode, e.output.decode("utf-8")))
407 405
408 if self.d.getVar('IMAGE_LOCALES_ARCHIVE') == '1': 406 if self.d.getVar('IMAGE_LOCALES_ARCHIVE') == '1':
409 target_arch = self.d.getVar('TARGET_ARCH') 407 target_arch = self.d.getVar('TARGET_ARCH')