diff options
author | Till Maas <opensource@till.name> | 2010-03-06 11:38:44 +0100 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2010-03-08 10:23:58 -0500 |
commit | 00e73d0480fd62a30636e4e7b20633c56c2ed5f3 (patch) | |
tree | 159a2b49003ec14c2d965c20eabde49abe594b9f | |
parent | fa5c6d43058151d8d17a9ce0914892ade00a87c8 (diff) | |
download | fedpkg-make-pull-00e73d0480fd62a30636e4e7b20633c56c2ed5f3.tar.gz fedpkg-make-pull-00e73d0480fd62a30636e4e7b20633c56c2ed5f3.tar.xz fedpkg-make-pull-00e73d0480fd62a30636e4e7b20633c56c2ed5f3.zip |
fedpkg-vcs: Keep alignment for Release/Source0 updates
-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: |