diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2008-03-24 13:27:58 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2008-03-24 13:27:58 +0000 |
commit | 12d1a93d23acb4ed14101c9f682e01f8a40bf90c (patch) | |
tree | 8370bc3025cd2073249803071c5ceac8bfc24657 /tools | |
parent | 90526627f8016dfc4964f56146e8c9524664184e (diff) | |
download | bcfg2-12d1a93d23acb4ed14101c9f682e01f8a40bf90c.tar.gz bcfg2-12d1a93d23acb4ed14101c9f682e01f8a40bf90c.tar.bz2 bcfg2-12d1a93d23acb4ed14101c9f682e01f8a40bf90c.zip |
Smarten up create-debian-pkglist-gp.py (from Sebastien Barthlemy (sorry, LANG=C))
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4450 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'tools')
-rw-r--r-- | tools/create-debian-pkglist-gp.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/tools/create-debian-pkglist-gp.py b/tools/create-debian-pkglist-gp.py index d94e562bb..42d2ea65c 100644 --- a/tools/create-debian-pkglist-gp.py +++ b/tools/create-debian-pkglist-gp.py @@ -5,7 +5,7 @@ __revision__ = '$Id: create-debian-pkglist.py 11778 2007-12-11 13:46:06Z guillau # Original code from Bcfg2 sources -import glob, gzip, lxml.etree, os, re, urllib, cStringIO, sys, ConfigParser, commands +import gzip, os, urllib, cStringIO, sys, ConfigParser, commands def debug(msg): '''print debug messages''' @@ -127,11 +127,11 @@ Source URLS: %s""" % (self.filename, self.groups, self.priority, self.architectu return pkgdata def _get_sorted_pkg_keys(self, pkgdata): - pkgs = [] - for k in pkgdata.keys(): - pkgs.append(k) - pkgs.sort() - return pkgs + pkgs = [] + for k in pkgdata.keys(): + pkgs.append(k) + pkgs.sort() + return pkgs def _write_common_entries(self, pkgdata): # Write entries for packages that have the same version @@ -202,18 +202,18 @@ Source URLS: %s""" % (self.filename, self.groups, self.priority, self.architectu self._rename_file() if __name__ == '__main__': - # Prefix is relative to script path - complete_script_path = os.path.join(os.getcwd(), sys.argv[0]) - prefix = complete_script_path[:-len('etc/create-debian-pkglist.py')] + main_conf_parser = ConfigParser.SafeConfigParser() + main_conf_parser.read(['/etc/bcfg2.conf']) + repo = main_conf_parser.get('server', 'repository') confparser = ConfigParser.SafeConfigParser() - confparser.read(prefix + "etc/debian-pkglist.conf") + confparser.read(repo + "etc/debian-pkglist.conf") # We read the whole configuration file before processing each entries # to avoid doing work if there is a problem in the file. sources_list = [] for section in confparser.sections(): - sources_list.append(Source(confparser, section, prefix)) + sources_list.append(Source(confparser, section, repo)) for source in sources_list: source.process() |