diff options
author | Bogdano Arendartchuk <bogdano@mandriva.org> | 2007-01-24 15:26:48 +0000 |
---|---|---|
committer | Bogdano Arendartchuk <bogdano@mandriva.org> | 2007-01-24 15:26:48 +0000 |
commit | 25545a7a3702c0b624b802b795d631534977979b (patch) | |
tree | e8f86d2d645f9ba4e85ece0ad5b72afe6ebbce32 /RepSys/log.py | |
parent | 6378ccbba271beea89195ee838a8d9f4979833fe (diff) | |
download | mgarepo-25545a7a3702c0b624b802b795d631534977979b.tar mgarepo-25545a7a3702c0b624b802b795d631534977979b.tar.gz mgarepo-25545a7a3702c0b624b802b795d631534977979b.tar.bz2 mgarepo-25545a7a3702c0b624b802b795d631534977979b.tar.xz mgarepo-25545a7a3702c0b624b802b795d631534977979b.zip |
Added "repsys.macros" configuration file.
It will contain macros overriding the local system ones. The reason for it
is to make changelogs generated in kenobi (2007.0) having the cooker
release number (in the case 2007.1).
Diffstat (limited to 'RepSys/log.py')
-rw-r--r-- | RepSys/log.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/RepSys/log.py b/RepSys/log.py index 2651d19..6d7bde0 100644 --- a/RepSys/log.py +++ b/RepSys/log.py @@ -60,8 +60,12 @@ def getrelease(pkgdirurl, rev=None): found = glob.glob(os.path.join(tmpdir, "*.spec")) if found: specpath = found[0] + fmt = "--define \"%s %s\"" + macros = (fmt % macro for macro in parse_macros()) + options = " ".join(macros) command = (("rpm -q --qf '%%{VERSION}-%%{RELEASE}\n' " - "--specfile %s 2>/dev/null") % specpath) + "--specfile %s %s 2>/dev/null") % + (specpath, options)) status, output = execcmd(command) if status != 0: raise Error, "Error in command %s: %s" % (command, output) @@ -77,6 +81,25 @@ def getrelease(pkgdirurl, rev=None): shutil.rmtree(tmpdir) +def parse_macros(): + path = config.get("log", "macros-file", None) + if not path: + # if the user did not declated where is the file, ignore it + return + if not os.path.isfile(path): + # complain when declared and not found + sys.stderr.write("warning: could not open macros file: %s\n" % + path) + return + for line in open(path): + line = line.strip() + if line.startswith("#") or not line: + continue + name, value = line.split(None, 1) + # trying to have the same format from rpm macros files + name = name[1:] + yield (name, value) + class _Revision: lines = [] date = None |