diff --git a/bcfg2/create-versions-index.py b/bcfg2/create-versions-index.py index 9554e150..bee30f58 100755 --- a/bcfg2/create-versions-index.py +++ b/bcfg2/create-versions-index.py @@ -36,15 +36,17 @@ def gen_rules(cache): group = doc.createElement("Group") group.setAttribute("name", commands.getoutput("uname -m")) + pkgs = [] for pkg in cache: if pkg.candidateVersion: - pkginfo = doc.createElement("Package") - pkginfo.setAttribute("name", pkg.name) - pkginfo.setAttribute("version", pkg.candidateVersion) - group.appendChild(pkginfo) - + pkgs.append((pkg.name, pkg.candidateVersion)) + pkgs.sort() + for (name, version) in pkgs: + pkginfo = doc.createElement("Package") + pkginfo.setAttribute("name", name) + pkginfo.setAttribute("version", version) + group.appendChild(pkginfo) root.appendChild(group) - return root if __name__ == "__main__":