From e23d60db291d814560feeb61777c6d6ce416424f Mon Sep 17 00:00:00 2001 From: Jeremie Dimino Date: Mon, 18 Feb 2008 00:56:21 +0100 Subject: [PATCH] On print directement la liste MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Parce que sinon ça bouffe vraiment beaucoup de mémoire... darcs-hash:20080217235621-af139-2a4c8f0ee726f0bbd98be69a40ba059c36b8874b.gz --- bcfg2/create-versions-index.py | 45 +++++++++++----------------------- 1 file changed, 14 insertions(+), 31 deletions(-) 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 '' +