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