diff --git a/bcfg2/create-versions-index.py b/bcfg2/create-versions-index.py index 14f00f58..8ba42aa4 100755 --- a/bcfg2/create-versions-index.py +++ b/bcfg2/create-versions-index.py @@ -23,40 +23,11 @@ '''Outil pour générer la liste des paquets avec leurs version pour le plugin Rules de bcfg2.''' -__all__ = ["gen_rules"] +__all__ = [] import apt, commands from xml.dom.minidom import Document -def gen_rules(cache): - '''Création des règles''' - doc = Document() - root = doc.createElement("Rule") - root.setAttribute("priority", "20") - if "sid" in file("/etc/debian_version").read(): - distribution = doc.createElement("Group") - distribution.setAttribute("name", "debian-testing") - else: - distribution = doc.createElement("Group") - distribution.setAttribute("name", "debian-testing") - distribution.setAttribute("negate", "true") - group = doc.createElement("Group") - group.setAttribute("name", commands.getoutput("uname -m")) - root.appendChild(distribution) - distribution.appendChild(group) - - pkgs = [] - for pkg in cache: - if pkg.candidateVersion: - 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) - return root - if __name__ == "__main__": import sys, os, time @@ -65,4 +36,16 @@ if __name__ == "__main__": print >>sys.stderr, "Génération du document XML..." print ("" % (time.ctime(), os.path.basename(sys.argv[0]))) - sys.stdout.write(gen_rules(cache).toprettyxml()) + + print '' + if "sid" in file("/etc/debian_version").read(): + print '' + else: + print '' + print '' % commands.getoutput("uname -m") + for pkg in cache: + if pkg.candidateVersion: + print ('' % + (pkg.name, pkg.candidateVersion)) + print '' +