
Parce que sinon ça bouffe vraiment beaucoup de mémoire... darcs-hash:20080217235621-af139-2a4c8f0ee726f0bbd98be69a40ba059c36b8874b.gz
51 lines
1.8 KiB
Python
Executable file
51 lines
1.8 KiB
Python
Executable file
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
#
|
|
# create-versions-index.py
|
|
# ------------------------
|
|
#
|
|
# Copyright (C) 2008 Jeremie Dimino <jeremie@dimino.org>
|
|
#
|
|
# This file is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This file is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
|
|
|
|
'''Outil pour générer la liste des paquets avec leurs version pour le
|
|
plugin Rules de bcfg2.'''
|
|
|
|
__all__ = []
|
|
|
|
import apt, commands
|
|
from xml.dom.minidom import Document
|
|
|
|
if __name__ == "__main__":
|
|
import sys, os, time
|
|
|
|
print >>sys.stderr, "Chargement du cache..."
|
|
cache = apt.Cache()
|
|
print >>sys.stderr, "Génération du document XML..."
|
|
print ("<!-- Fichier autogénéré le %s avec %s -->" %
|
|
(time.ctime(), os.path.basename(sys.argv[0])))
|
|
|
|
print '<Rule priority="20">'
|
|
if "sid" in file("/etc/debian_version").read():
|
|
print '<Group name="debian-testing">'
|
|
else:
|
|
print '<Group name="debian-testing" negate="true">'
|
|
print '<Group name="%s">' % commands.getoutput("uname -m")
|
|
for pkg in cache:
|
|
if pkg.candidateVersion:
|
|
print ('<Package name="%s" version="%s"/>' %
|
|
(pkg.name, pkg.candidateVersion))
|
|
print '</Group></Group></Rule>'
|
|
|