aboutsummaryrefslogtreecommitdiffstats
path: root/RepSys/cgiutil.py
diff options
context:
space:
mode:
authorBogdano Arendartchuk <bogdano@mandriva.org>2007-01-29 18:14:56 +0000
committerBogdano Arendartchuk <bogdano@mandriva.org>2007-01-29 18:14:56 +0000
commita493be252f25b57767023930d4ed927b37816e71 (patch)
treee25eb71eba2146cac6dd8dc4bbb4b7c043d65076 /RepSys/cgiutil.py
parentd4d9914ec004a9ad1b767bc177d45af6694080be (diff)
downloadmgarepo-a493be252f25b57767023930d4ed927b37816e71.tar
mgarepo-a493be252f25b57767023930d4ed927b37816e71.tar.gz
mgarepo-a493be252f25b57767023930d4ed927b37816e71.tar.bz2
mgarepo-a493be252f25b57767023930d4ed927b37816e71.tar.xz
mgarepo-a493be252f25b57767023930d4ed927b37816e71.zip
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.
Diffstat (limited to 'RepSys/cgiutil.py')
-rw-r--r--RepSys/cgiutil.py24
1 files changed, 18 insertions, 6 deletions
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)