summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorAndre McCurdy <armccurdy@gmail.com>2015-10-01 17:22:01 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-10-07 00:09:11 +0100
commit8ee9a933a5bfc8c1de95aa1770bfd64add12f927 (patch)
tree86147914196166d048f51430482ec214ae966e96 /meta
parent37c54af056747f3091ac940f80ee32a42287fc44 (diff)
downloadpoky-8ee9a933a5bfc8c1de95aa1770bfd64add12f927.tar.gz
package_manager.py: sort output of OpkgPkgsList().list
Without explicit sorting, the output generated by OpkgPkgsList().list follows the order of packages in /var/lib/opkg/status, which appears to be "random". Add sorting to make OpkgPkgsList().list behaviour consistent with that of RpmPkgsList().list. (From OE-Core rev: f06fb68a07b82e4b8f25d5cdf556cf8893ddf208) Signed-off-by: Andre McCurdy <armccurdy@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oe/package_manager.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 630b957ba9..c34e4366bf 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -434,24 +434,30 @@ class OpkgPkgsList(PkgsList):
434 (self.opkg_cmd, self.opkg_args) 434 (self.opkg_cmd, self.opkg_args)
435 435
436 try: 436 try:
437 output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).strip() 437 # bb.note(cmd)
438 tmp_output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).strip()
439
438 except subprocess.CalledProcessError as e: 440 except subprocess.CalledProcessError as e:
439 bb.fatal("Cannot get the installed packages list. Command '%s' " 441 bb.fatal("Cannot get the installed packages list. Command '%s' "
440 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 442 "returned %d:\n%s" % (cmd, e.returncode, e.output))
441 443
442 if output and format == "file": 444 output = list()
443 tmp_output = "" 445 for line in tmp_output.split('\n'):
444 for line in output.split('\n'): 446 if len(line.strip()) == 0:
447 continue
448 if format == "file":
445 pkg, pkg_file, pkg_arch = line.split() 449 pkg, pkg_file, pkg_arch = line.split()
446 full_path = os.path.join(self.rootfs_dir, pkg_arch, pkg_file) 450 full_path = os.path.join(self.rootfs_dir, pkg_arch, pkg_file)
447 if os.path.exists(full_path): 451 if os.path.exists(full_path):
448 tmp_output += "%s %s %s\n" % (pkg, full_path, pkg_arch) 452 output.append('%s %s %s' % (pkg, full_path, pkg_arch))
449 else: 453 else:
450 tmp_output += "%s %s %s\n" % (pkg, pkg_file, pkg_arch) 454 output.append('%s %s %s' % (pkg, pkg_file, pkg_arch))
455 else:
456 output.append(line)
451 457
452 output = tmp_output 458 output.sort()
453 459
454 return output 460 return '\n'.join(output)
455 461
456 462
457class DpkgPkgsList(PkgsList): 463class DpkgPkgsList(PkgsList):