diff options
author | Bogdano Arendartchuk <bogdano@mandriva.org> | 2007-04-24 18:16:41 +0000 |
---|---|---|
committer | Bogdano Arendartchuk <bogdano@mandriva.org> | 2007-04-24 18:16:41 +0000 |
commit | 5cf994844b3510ec0d79f6dbc0fc1109d9412673 (patch) | |
tree | c3d5fb3c0da3c050438a94c19f1aa6478c659707 | |
parent | 8c403d422268c1ef1ddfd481e5835c9c071478da (diff) | |
download | mgarepo-5cf994844b3510ec0d79f6dbc0fc1109d9412673.tar mgarepo-5cf994844b3510ec0d79f6dbc0fc1109d9412673.tar.gz mgarepo-5cf994844b3510ec0d79f6dbc0fc1109d9412673.tar.bz2 mgarepo-5cf994844b3510ec0d79f6dbc0fc1109d9412673.tar.xz mgarepo-5cf994844b3510ec0d79f6dbc0fc1109d9412673.zip |
Escape even the old changelogs that are inside misc/.topic/V1_6_X-ldapusers
These old changelogs contain bogus macros entries because the output of
rpm -qp --changelog (or the equivalent) doesn't print the changelogs
escaped.
-rw-r--r-- | RepSys/log.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/RepSys/log.py b/RepSys/log.py index c4e2769..24dca3c 100644 --- a/RepSys/log.py +++ b/RepSys/log.py @@ -103,6 +103,11 @@ class _Release(_Revision): self.revisions = [] _Revision.__init__(self, **kwargs) +unescaped_macro_pat = re.compile(r"([^%])%([^%])") + +def escape_macros(text): + escaped = unescaped_macro_pat.sub("\\1%%\\2", text) + return escaped def format_lines(lines): first = 1 @@ -110,7 +115,7 @@ def format_lines(lines): perexpr = re.compile(r"([^%])%([^%])") for line in lines: if line: - line = perexpr.sub("\\1%%\\2", line) + line = escape_macros(line) if first: first = 0 line = line.lstrip() @@ -425,7 +430,9 @@ def specfile_svn2rpm(pkgdirurl, specfile, rev=None, size=None, if os.path.isfile(logfile): file = open(logfile) newlines.append("\n") - newlines.append(file.read()) + log = file.read() + log = escape_macros(log) + newlines.append(log) file.close() finally: if os.path.isdir(tmpdir): |