diff options
author | Mariano Lopez <mariano.lopez@linux.intel.com> | 2016-01-18 14:33:07 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-20 17:07:15 +0000 |
commit | 571289df7b2b59a3f00c267824931e3efaaabc3b (patch) | |
tree | 906e14dd0dafd1bbf8eb8156d716907f9ea2db43 /meta/lib/oe | |
parent | 6ebda8e659f678a0f4fe1e970d6f38e5e273f5f7 (diff) | |
download | poky-571289df7b2b59a3f00c267824931e3efaaabc3b.tar.gz |
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>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r-- | meta/lib/oe/package_manager.py | 153 |
1 files changed, 0 insertions, 153 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index 6d026307f5..6a6e3e9b7d 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py | |||
@@ -293,10 +293,6 @@ class PkgsList(object): | |||
293 | self.rootfs_dir = rootfs_dir | 293 | self.rootfs_dir = rootfs_dir |
294 | 294 | ||
295 | @abstractmethod | 295 | @abstractmethod |
296 | def list(self, format=None): | ||
297 | pass | ||
298 | |||
299 | @abstractmethod | ||
300 | def list_pkgs(self): | 296 | def list_pkgs(self): |
301 | pass | 297 | pass |
302 | 298 | ||
@@ -416,56 +412,6 @@ class RpmPkgsList(PkgsList): | |||
416 | 412 | ||
417 | return output | 413 | return output |
418 | 414 | ||
419 | def list(self, format=None): | ||
420 | if format == "deps": | ||
421 | if self.rpm_version == 4: | ||
422 | bb.fatal("'deps' format dependency listings are not supported with rpm 4 since rpmresolve does not work") | ||
423 | return self._list_pkg_deps() | ||
424 | |||
425 | cmd = self.rpm_cmd + ' --root ' + self.rootfs_dir | ||
426 | cmd += ' -D "_dbpath /var/lib/rpm" -qa' | ||
427 | if self.rpm_version == 4: | ||
428 | cmd += " --qf '[%{NAME} %{ARCH} %{VERSION}\n]'" | ||
429 | else: | ||
430 | cmd += " --qf '[%{NAME} %{ARCH} %{VERSION} %{PACKAGEORIGIN}\n]'" | ||
431 | |||
432 | try: | ||
433 | # bb.note(cmd) | ||
434 | tmp_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).strip() | ||
435 | |||
436 | except subprocess.CalledProcessError as e: | ||
437 | bb.fatal("Cannot get the installed packages list. Command '%s' " | ||
438 | "returned %d:\n%s" % (cmd, e.returncode, e.output)) | ||
439 | |||
440 | output = list() | ||
441 | for line in tmp_output.split('\n'): | ||
442 | if len(line.strip()) == 0: | ||
443 | continue | ||
444 | pkg = line.split()[0] | ||
445 | arch = line.split()[1] | ||
446 | ver = line.split()[2] | ||
447 | # Skip GPG keys | ||
448 | if pkg == 'gpg-pubkey': | ||
449 | continue | ||
450 | if self.rpm_version == 4: | ||
451 | pkgorigin = "unknown" | ||
452 | else: | ||
453 | pkgorigin = line.split()[3] | ||
454 | new_pkg, new_arch = self._pkg_translate_smart_to_oe(pkg, arch) | ||
455 | |||
456 | if format == "arch": | ||
457 | output.append('%s %s' % (new_pkg, new_arch)) | ||
458 | elif format == "file": | ||
459 | output.append('%s %s %s' % (new_pkg, pkgorigin, new_arch)) | ||
460 | elif format == "ver": | ||
461 | output.append('%s %s %s' % (new_pkg, new_arch, ver)) | ||
462 | else: | ||
463 | output.append('%s' % (new_pkg)) | ||
464 | |||
465 | output.sort() | ||
466 | |||
467 | return '\n'.join(output) | ||
468 | |||
469 | def list_pkgs(self): | 415 | def list_pkgs(self): |
470 | cmd = self.rpm_cmd + ' --root ' + self.rootfs_dir | 416 | cmd = self.rpm_cmd + ' --root ' + self.rootfs_dir |
471 | cmd += ' -D "_dbpath /var/lib/rpm" -qa' | 417 | cmd += ' -D "_dbpath /var/lib/rpm" -qa' |
@@ -528,51 +474,6 @@ class OpkgPkgsList(PkgsList): | |||
528 | self.opkg_args = "-f %s -o %s " % (config_file, rootfs_dir) | 474 | self.opkg_args = "-f %s -o %s " % (config_file, rootfs_dir) |
529 | self.opkg_args += self.d.getVar("OPKG_ARGS", True) | 475 | self.opkg_args += self.d.getVar("OPKG_ARGS", True) |
530 | 476 | ||
531 | def list(self, format=None): | ||
532 | opkg_query_cmd = bb.utils.which(os.getenv('PATH'), "opkg-query-helper.py") | ||
533 | |||
534 | if format == "arch": | ||
535 | cmd = "%s %s status | %s -a" % \ | ||
536 | (self.opkg_cmd, self.opkg_args, opkg_query_cmd) | ||
537 | elif format == "file": | ||
538 | cmd = "%s %s status | %s -f" % \ | ||
539 | (self.opkg_cmd, self.opkg_args, opkg_query_cmd) | ||
540 | elif format == "ver": | ||
541 | cmd = "%s %s status | %s -v" % \ | ||
542 | (self.opkg_cmd, self.opkg_args, opkg_query_cmd) | ||
543 | elif format == "deps": | ||
544 | cmd = "%s %s status | %s" % \ | ||
545 | (self.opkg_cmd, self.opkg_args, opkg_query_cmd) | ||
546 | else: | ||
547 | cmd = "%s %s list_installed | cut -d' ' -f1" % \ | ||
548 | (self.opkg_cmd, self.opkg_args) | ||
549 | |||
550 | try: | ||
551 | # bb.note(cmd) | ||
552 | tmp_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).strip() | ||
553 | |||
554 | except subprocess.CalledProcessError as e: | ||
555 | bb.fatal("Cannot get the installed packages list. Command '%s' " | ||
556 | "returned %d:\n%s" % (cmd, e.returncode, e.output)) | ||
557 | |||
558 | output = list() | ||
559 | for line in tmp_output.split('\n'): | ||
560 | if len(line.strip()) == 0: | ||
561 | continue | ||
562 | if format == "file": | ||
563 | pkg, pkg_file, pkg_arch = line.split() | ||
564 | full_path = os.path.join(self.rootfs_dir, pkg_arch, pkg_file) | ||
565 | if os.path.exists(full_path): | ||
566 | output.append('%s %s %s' % (pkg, full_path, pkg_arch)) | ||
567 | else: | ||
568 | output.append('%s %s %s' % (pkg, pkg_file, pkg_arch)) | ||
569 | else: | ||
570 | output.append(line) | ||
571 | |||
572 | output.sort() | ||
573 | |||
574 | return '\n'.join(output) | ||
575 | |||
576 | def list_pkgs(self, format=None): | 477 | def list_pkgs(self, format=None): |
577 | cmd = "%s %s status" % (self.opkg_cmd, self.opkg_args) | 478 | cmd = "%s %s status" % (self.opkg_cmd, self.opkg_args) |
578 | 479 | ||
@@ -588,60 +489,6 @@ class OpkgPkgsList(PkgsList): | |||
588 | 489 | ||
589 | 490 | ||
590 | class DpkgPkgsList(PkgsList): | 491 | class DpkgPkgsList(PkgsList): |
591 | def list(self, format=None): | ||
592 | cmd = [bb.utils.which(os.getenv('PATH'), "dpkg-query"), | ||
593 | "--admindir=%s/var/lib/dpkg" % self.rootfs_dir, | ||
594 | "-W"] | ||
595 | |||
596 | if format == "arch": | ||
597 | cmd.append("-f=${Package} ${PackageArch}\n") | ||
598 | elif format == "file": | ||
599 | cmd.append("-f=${Package} ${Package}_${Version}_${Architecture}.deb ${PackageArch}\n") | ||
600 | elif format == "ver": | ||
601 | cmd.append("-f=${Package} ${PackageArch} ${Version}\n") | ||
602 | elif format == "deps": | ||
603 | cmd.append("-f=Package: ${Package}\nDepends: ${Depends}\nRecommends: ${Recommends}\n\n") | ||
604 | else: | ||
605 | cmd.append("-f=${Package}\n") | ||
606 | |||
607 | try: | ||
608 | output = subprocess.check_output(cmd, stderr=subprocess.STDOUT).strip() | ||
609 | except subprocess.CalledProcessError as e: | ||
610 | bb.fatal("Cannot get the installed packages list. Command '%s' " | ||
611 | "returned %d:\n%s" % (' '.join(cmd), e.returncode, e.output)) | ||
612 | |||
613 | if format == "file": | ||
614 | tmp_output = "" | ||
615 | for line in tuple(output.split('\n')): | ||
616 | if not line.strip(): | ||
617 | continue | ||
618 | pkg, pkg_file, pkg_arch = line.split() | ||
619 | full_path = os.path.join(self.rootfs_dir, pkg_arch, pkg_file) | ||
620 | if os.path.exists(full_path): | ||
621 | tmp_output += "%s %s %s\n" % (pkg, full_path, pkg_arch) | ||
622 | else: | ||
623 | tmp_output += "%s %s %s\n" % (pkg, pkg_file, pkg_arch) | ||
624 | |||
625 | output = tmp_output | ||
626 | elif format == "deps": | ||
627 | opkg_query_cmd = bb.utils.which(os.getenv('PATH'), "opkg-query-helper.py") | ||
628 | file_out = tempfile.NamedTemporaryFile() | ||
629 | file_out.write(output) | ||
630 | file_out.flush() | ||
631 | |||
632 | try: | ||
633 | output = subprocess.check_output("cat %s | %s" % | ||
634 | (file_out.name, opkg_query_cmd), | ||
635 | stderr=subprocess.STDOUT, | ||
636 | shell=True) | ||
637 | except subprocess.CalledProcessError as e: | ||
638 | file_out.close() | ||
639 | bb.fatal("Cannot compute packages dependencies. Command '%s' " | ||
640 | "returned %d:\n%s" % (e.cmd, e.returncode, e.output)) | ||
641 | |||
642 | file_out.close() | ||
643 | |||
644 | return output | ||
645 | 492 | ||
646 | def list_pkgs(self): | 493 | def list_pkgs(self): |
647 | cmd = [bb.utils.which(os.getenv('PATH'), "dpkg-query"), | 494 | cmd = [bb.utils.which(os.getenv('PATH'), "dpkg-query"), |