lib/oe/package_manager.py: Remove list() from PkgsList class

Now that the method list() is not used anymore, remove it.

[YOCTO #7427]

(From OE-Core rev: 01e7dfbce972cfb926668e5ee194c83838e1e1b6)

Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Mariano Lopez
2016-01-18 14:33:07 +00:00
committed by Richard Purdie
parent 6ebda8e659
commit 571289df7b

View File

@@ -292,10 +292,6 @@ class PkgsList(object):
self.d = d
self.rootfs_dir = rootfs_dir
@abstractmethod
def list(self, format=None):
pass
@abstractmethod
def list_pkgs(self):
pass
@@ -416,56 +412,6 @@ class RpmPkgsList(PkgsList):
return output
def list(self, format=None):
if format == "deps":
if self.rpm_version == 4:
bb.fatal("'deps' format dependency listings are not supported with rpm 4 since rpmresolve does not work")
return self._list_pkg_deps()
cmd = self.rpm_cmd + ' --root ' + self.rootfs_dir
cmd += ' -D "_dbpath /var/lib/rpm" -qa'
if self.rpm_version == 4:
cmd += " --qf '[%{NAME} %{ARCH} %{VERSION}\n]'"
else:
cmd += " --qf '[%{NAME} %{ARCH} %{VERSION} %{PACKAGEORIGIN}\n]'"
try:
# bb.note(cmd)
tmp_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).strip()
except subprocess.CalledProcessError as e:
bb.fatal("Cannot get the installed packages list. Command '%s' "
"returned %d:\n%s" % (cmd, e.returncode, e.output))
output = list()
for line in tmp_output.split('\n'):
if len(line.strip()) == 0:
continue
pkg = line.split()[0]
arch = line.split()[1]
ver = line.split()[2]
# Skip GPG keys
if pkg == 'gpg-pubkey':
continue
if self.rpm_version == 4:
pkgorigin = "unknown"
else:
pkgorigin = line.split()[3]
new_pkg, new_arch = self._pkg_translate_smart_to_oe(pkg, arch)
if format == "arch":
output.append('%s %s' % (new_pkg, new_arch))
elif format == "file":
output.append('%s %s %s' % (new_pkg, pkgorigin, new_arch))
elif format == "ver":
output.append('%s %s %s' % (new_pkg, new_arch, ver))
else:
output.append('%s' % (new_pkg))
output.sort()
return '\n'.join(output)
def list_pkgs(self):
cmd = self.rpm_cmd + ' --root ' + self.rootfs_dir
cmd += ' -D "_dbpath /var/lib/rpm" -qa'
@@ -528,51 +474,6 @@ class OpkgPkgsList(PkgsList):
self.opkg_args = "-f %s -o %s " % (config_file, rootfs_dir)
self.opkg_args += self.d.getVar("OPKG_ARGS", True)
def list(self, format=None):
opkg_query_cmd = bb.utils.which(os.getenv('PATH'), "opkg-query-helper.py")
if format == "arch":
cmd = "%s %s status | %s -a" % \
(self.opkg_cmd, self.opkg_args, opkg_query_cmd)
elif format == "file":
cmd = "%s %s status | %s -f" % \
(self.opkg_cmd, self.opkg_args, opkg_query_cmd)
elif format == "ver":
cmd = "%s %s status | %s -v" % \
(self.opkg_cmd, self.opkg_args, opkg_query_cmd)
elif format == "deps":
cmd = "%s %s status | %s" % \
(self.opkg_cmd, self.opkg_args, opkg_query_cmd)
else:
cmd = "%s %s list_installed | cut -d' ' -f1" % \
(self.opkg_cmd, self.opkg_args)
try:
# bb.note(cmd)
tmp_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).strip()
except subprocess.CalledProcessError as e:
bb.fatal("Cannot get the installed packages list. Command '%s' "
"returned %d:\n%s" % (cmd, e.returncode, e.output))
output = list()
for line in tmp_output.split('\n'):
if len(line.strip()) == 0:
continue
if format == "file":
pkg, pkg_file, pkg_arch = line.split()
full_path = os.path.join(self.rootfs_dir, pkg_arch, pkg_file)
if os.path.exists(full_path):
output.append('%s %s %s' % (pkg, full_path, pkg_arch))
else:
output.append('%s %s %s' % (pkg, pkg_file, pkg_arch))
else:
output.append(line)
output.sort()
return '\n'.join(output)
def list_pkgs(self, format=None):
cmd = "%s %s status" % (self.opkg_cmd, self.opkg_args)
@@ -588,60 +489,6 @@ class OpkgPkgsList(PkgsList):
class DpkgPkgsList(PkgsList):
def list(self, format=None):
cmd = [bb.utils.which(os.getenv('PATH'), "dpkg-query"),
"--admindir=%s/var/lib/dpkg" % self.rootfs_dir,
"-W"]
if format == "arch":
cmd.append("-f=${Package} ${PackageArch}\n")
elif format == "file":
cmd.append("-f=${Package} ${Package}_${Version}_${Architecture}.deb ${PackageArch}\n")
elif format == "ver":
cmd.append("-f=${Package} ${PackageArch} ${Version}\n")
elif format == "deps":
cmd.append("-f=Package: ${Package}\nDepends: ${Depends}\nRecommends: ${Recommends}\n\n")
else:
cmd.append("-f=${Package}\n")
try:
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).strip()
except subprocess.CalledProcessError as e:
bb.fatal("Cannot get the installed packages list. Command '%s' "
"returned %d:\n%s" % (' '.join(cmd), e.returncode, e.output))
if format == "file":
tmp_output = ""
for line in tuple(output.split('\n')):
if not line.strip():
continue
pkg, pkg_file, pkg_arch = line.split()
full_path = os.path.join(self.rootfs_dir, pkg_arch, pkg_file)
if os.path.exists(full_path):
tmp_output += "%s %s %s\n" % (pkg, full_path, pkg_arch)
else:
tmp_output += "%s %s %s\n" % (pkg, pkg_file, pkg_arch)
output = tmp_output
elif format == "deps":
opkg_query_cmd = bb.utils.which(os.getenv('PATH'), "opkg-query-helper.py")
file_out = tempfile.NamedTemporaryFile()
file_out.write(output)
file_out.flush()
try:
output = subprocess.check_output("cat %s | %s" %
(file_out.name, opkg_query_cmd),
stderr=subprocess.STDOUT,
shell=True)
except subprocess.CalledProcessError as e:
file_out.close()
bb.fatal("Cannot compute packages dependencies. Command '%s' "
"returned %d:\n%s" % (e.cmd, e.returncode, e.output))
file_out.close()
return output
def list_pkgs(self):
cmd = [bb.utils.which(os.getenv('PATH'), "dpkg-query"),