aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib
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-03 00:01:26 +0100
commitf06fb68a07b82e4b8f25d5cdf556cf8893ddf208 (patch)
tree438ff60663afc12cbc48b5589057dbf60f4ec024 /meta/lib
parentff8bf4907ff3b1a9c479fe158c31607da07f9b55 (diff)
downloadopenembedded-core-contrib-f06fb68a07b82e4b8f25d5cdf556cf8893ddf208.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. Signed-off-by: Andre McCurdy <armccurdy@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-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 630b957ba99..c34e4366bf8 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -434,24 +434,30 @@ class OpkgPkgsList(PkgsList):
(self.opkg_cmd, self.opkg_args)
try:
- output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True).strip()
+ # 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))
- if output and format == "file":
- tmp_output = ""
- for line in output.split('\n'):
+ 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):
- tmp_output += "%s %s %s\n" % (pkg, full_path, pkg_arch)
+ output.append('%s %s %s' % (pkg, full_path, pkg_arch))
else:
- tmp_output += "%s %s %s\n" % (pkg, pkg_file, pkg_arch)
+ output.append('%s %s %s' % (pkg, pkg_file, pkg_arch))
+ else:
+ output.append(line)
- output = tmp_output
+ output.sort()
- return output
+ return '\n'.join(output)
class DpkgPkgsList(PkgsList):