diff options
author | Jason Pepas <cell@ices.utexas.edu> | 2006-08-25 13:47:23 +0000 |
---|---|---|
committer | Jason Pepas <cell@ices.utexas.edu> | 2006-08-25 13:47:23 +0000 |
commit | 7af374b0d38e4507a9f2606fc682cb06fb959a9b (patch) | |
tree | 7827abc5f240916b1c61429d9a5ef7f48be7811b | |
parent | 2e0d46f2539189e8773f4827c20548bd275e2529 (diff) | |
download | bcfg2-7af374b0d38e4507a9f2606fc682cb06fb959a9b.tar.gz bcfg2-7af374b0d38e4507a9f2606fc682cb06fb959a9b.tar.bz2 bcfg2-7af374b0d38e4507a9f2606fc682cb06fb959a9b.zip |
Updated rpmlisting.py to sort package listings.
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2109 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r-- | tools/rpmlisting.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/rpmlisting.py b/tools/rpmlisting.py index 543293edf..c6347e97b 100644 --- a/tools/rpmlisting.py +++ b/tools/rpmlisting.py @@ -177,12 +177,20 @@ def prune_archs(pkgs): return pruned_pkgs +# from http://aspn.activestate.com/ASPN/Python/Cookbook/Recipe/52306 +def sorted_values(adict): + """return a list of values from a dict, sorted by key.""" + items = adict.items() + items.sort() + return [value for key, value in items] + + def scan_rpm_dir(rpmdir, uri, group, priority=0, output=sys.stdout): """the meat of this library.""" output.write('<PackageList uri="%s" type="rpm" priority="%s">\n' % (uri, priority)) output.write(' <Group name="%s">\n' % group) pkgs = prune_archs(prune_pkgs(get_pkgs(rpmdir))) - for rpmblobs in pkgs.values(): + for rpmblobs in sorted_values(pkgs): if len(rpmblobs) == 1: # regular pkgmgr entry rpmblob = rpmblobs[0] |