diff options
| -rwxr-xr-x | fedpkg-vcs | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -199,6 +199,13 @@ class Spec(object): def substitute(self, substitutions): assert not self._saved self._substitutions = substitutions + + def substitute_key(self, key, new_value, string): + pattern = r'(%s:\s+)\S.*' % key + repl = "%s" % r'\g<1>%s' % new_value + + subst = re.sub(pattern, repl, string) + return subst def add_patch(self, filename): patches = self.get_patches() @@ -267,9 +274,9 @@ class Spec(object): if replacement_matched: output.write(line) elif line.startswith('Release:') and self._new_release: - output.write('Release: %s\n' % self._new_release) + output.write(self.substitute_key('Release', self._new_release, line)) elif line.startswith('Source0:') and self._source_archivename: - output.write('Source0: %s\n' % self._source_archivename) + output.write(self.substitute_key('Source0', self._source_archivename, line)) elif line.startswith('%setup') and self._source_dirname: # This is dumb, need to automate this in RPM output.write('%%setup -q -n %s\n' % self._source_dirname) elif line.startswith('BuildRequires:') and not wrote_buildrequires: |
