From a493be252f25b57767023930d4ed927b37816e71 Mon Sep 17 00:00:00 2001 From: Bogdano Arendartchuk Date: Mon, 29 Jan 2007 18:14:56 +0000 Subject: Removed bogus macros files and added [macros ..] sections to repsys.conf. These sections are referenced by the "rpm-macros" option in [submit ..] sections and contain the RPM macros to be used with the target of the package being generated. These macros are defined using --define option of rpm. --- RepSys/cgiutil.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'RepSys/cgiutil.py') diff --git a/RepSys/cgiutil.py b/RepSys/cgiutil.py index 6dda91e..35c5efb 100644 --- a/RepSys/cgiutil.py +++ b/RepSys/cgiutil.py @@ -1,6 +1,7 @@ #!/usr/bin/python from RepSys import Error, config from RepSys.svn import SVN +from RepSys.ConfigParser import NoSectionError import time import re @@ -10,11 +11,23 @@ class SubmitTarget: def __init__(self): self.name = "" self.target = "" + self.macros = [] self.allowed = [] self.scripts = [] TARGETS = [] +def parse_macrosref(refs, config): + macros = [] + for name in refs: + secname = "macros %s" % name + try: + macros.extend(config.walk(secname, raw=True)) + except NoSectionError: + raise Error, "missing macros section " \ + "%r in configuration" % secname + return macros + def get_targets(): global TARGETS if not TARGETS: @@ -27,12 +40,11 @@ def get_targets(): target = SubmitTarget() target.name = m.group(1) for option, value in config.walk(section): - if option == "target": - target.target = value.split() - elif option == "allowed": - target.allowed = value.split() - elif option == "scripts": - target.scripts = value.split() + if option in ("target", "allowed", "scripts"): + setattr(target, option, value.split()) + elif option == "rpm-macros": + refs = value.split() + target.macros = parse_macrosref(refs, config) else: raise Error, "unknown [%s] option %s" % (section, option) TARGETS.append(target) -- cgit v1.2.1