From 12d1a93d23acb4ed14101c9f682e01f8a40bf90c Mon Sep 17 00:00:00 2001 From: Narayan Desai Date: Mon, 24 Mar 2008 13:27:58 +0000 Subject: 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 --- tools/create-debian-pkglist-gp.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'tools/create-debian-pkglist-gp.py') 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() -- cgit v1.2.3-1-g7c22