mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
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: f944a1be484378c733d7fd835dc17e210f1c2705) 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>
This commit is contained in:
committed by
Steve Sakoman
parent
3d6bbf83ea
commit
9d9325d07b
@@ -365,45 +365,43 @@ class PackageManager(object, metaclass=ABCMeta):
|
||||
for complementary_linguas in (self.d.getVar('IMAGE_LINGUAS_COMPLEMENTARY') or "").split():
|
||||
globs += (" " + complementary_linguas) % lang
|
||||
|
||||
if globs is None:
|
||||
return
|
||||
if globs:
|
||||
# we need to write the list of installed packages to a file because the
|
||||
# oe-pkgdata-util reads it from a file
|
||||
with tempfile.NamedTemporaryFile(mode="w+", prefix="installed-pkgs") as installed_pkgs:
|
||||
pkgs = self.list_installed()
|
||||
|
||||
# we need to write the list of installed packages to a file because the
|
||||
# oe-pkgdata-util reads it from a file
|
||||
with tempfile.NamedTemporaryFile(mode="w+", prefix="installed-pkgs") as installed_pkgs:
|
||||
pkgs = self.list_installed()
|
||||
provided_pkgs = set()
|
||||
for pkg in pkgs.values():
|
||||
provided_pkgs |= set(pkg.get('provs', []))
|
||||
|
||||
provided_pkgs = set()
|
||||
for pkg in pkgs.values():
|
||||
provided_pkgs |= set(pkg.get('provs', []))
|
||||
output = oe.utils.format_pkg_list(pkgs, "arch")
|
||||
installed_pkgs.write(output)
|
||||
installed_pkgs.flush()
|
||||
|
||||
output = oe.utils.format_pkg_list(pkgs, "arch")
|
||||
installed_pkgs.write(output)
|
||||
installed_pkgs.flush()
|
||||
|
||||
cmd = ["oe-pkgdata-util",
|
||||
"-p", self.d.getVar('PKGDATA_DIR'), "glob", installed_pkgs.name,
|
||||
globs]
|
||||
exclude = self.d.getVar('PACKAGE_EXCLUDE_COMPLEMENTARY')
|
||||
if exclude:
|
||||
cmd.extend(['--exclude=' + '|'.join(exclude.split())])
|
||||
try:
|
||||
bb.note('Running %s' % cmd)
|
||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
stdout, stderr = proc.communicate()
|
||||
if stderr: bb.note(stderr.decode("utf-8"))
|
||||
complementary_pkgs = stdout.decode("utf-8")
|
||||
complementary_pkgs = set(complementary_pkgs.split())
|
||||
skip_pkgs = sorted(complementary_pkgs & provided_pkgs)
|
||||
install_pkgs = sorted(complementary_pkgs - provided_pkgs)
|
||||
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)
|
||||
except subprocess.CalledProcessError as e:
|
||||
bb.fatal("Could not compute complementary packages list. Command "
|
||||
"'%s' returned %d:\n%s" %
|
||||
(' '.join(cmd), e.returncode, e.output.decode("utf-8")))
|
||||
cmd = ["oe-pkgdata-util",
|
||||
"-p", self.d.getVar('PKGDATA_DIR'), "glob", installed_pkgs.name,
|
||||
globs]
|
||||
exclude = self.d.getVar('PACKAGE_EXCLUDE_COMPLEMENTARY')
|
||||
if exclude:
|
||||
cmd.extend(['--exclude=' + '|'.join(exclude.split())])
|
||||
try:
|
||||
bb.note('Running %s' % cmd)
|
||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
stdout, stderr = proc.communicate()
|
||||
if stderr: bb.note(stderr.decode("utf-8"))
|
||||
complementary_pkgs = stdout.decode("utf-8")
|
||||
complementary_pkgs = set(complementary_pkgs.split())
|
||||
skip_pkgs = sorted(complementary_pkgs & provided_pkgs)
|
||||
install_pkgs = sorted(complementary_pkgs - provided_pkgs)
|
||||
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)
|
||||
except subprocess.CalledProcessError as e:
|
||||
bb.fatal("Could not compute complementary packages list. Command "
|
||||
"'%s' returned %d:\n%s" %
|
||||
(' '.join(cmd), e.returncode, e.output.decode("utf-8")))
|
||||
|
||||
if self.d.getVar('IMAGE_LOCALES_ARCHIVE') == '1':
|
||||
target_arch = self.d.getVar('TARGET_ARCH')
|
||||
|
||||
Reference in New Issue
Block a user