summaryrefslogtreecommitdiffstats
path: root/mgagnome
diff options
context:
space:
mode:
authorOlav Vitters <olav@vitters.nl>2013-09-17 21:15:51 +0200
committerOlav Vitters <olav@vitters.nl>2013-09-17 21:15:51 +0200
commit50905997c1001d44cd69f2d96a69c96858325b0c (patch)
tree84ac0edb7235ca70b1dd28060ebc89f878a33d8b /mgagnome
parent8306ced1a8df6fb53c356d639b52ecc59bc0bfe6 (diff)
downloadmgagnome-50905997c1001d44cd69f2d96a69c96858325b0c.tar
mgagnome-50905997c1001d44cd69f2d96a69c96858325b0c.tar.gz
mgagnome-50905997c1001d44cd69f2d96a69c96858325b0c.tar.bz2
mgagnome-50905997c1001d44cd69f2d96a69c96858325b0c.tar.xz
mgagnome-50905997c1001d44cd69f2d96a69c96858325b0c.zip
automatically drop merged patches when increasing version number
Diffstat (limited to 'mgagnome')
-rwxr-xr-xmgagnome27
1 files changed, 10 insertions, 17 deletions
diff --git a/mgagnome b/mgagnome
index d2797cb..1c1d465 100755
--- a/mgagnome
+++ b/mgagnome
@@ -294,7 +294,11 @@ class SpecFile(object):
self.path = path
self.cwd = os.path.dirname(path)
self.module = module
- self.changes = []
+ self._changes = []
+
+ @property
+ def changes(self):
+ return self._changes[0] if len(self.changes[0]) == 1 else "\n".join(("- %s" % change for change in self._changes))
@property
def version(self):
@@ -321,11 +325,10 @@ class SpecFile(object):
def _revert_changes(self):
"""Revert uncommited changes made to spec file"""
- self.changes = []
+ self._changes = []
subprocess.check_call(["svn", "revert", "-R", os.path.join(self.path, '..')])
def remove_patch(self, nr):
- print >>sys.stderr, "DEBUG: removing patch %s" % nr
nrs = [str(nr)]
if nr == 0: nrs.append('')
with open(self.path, "rw") as f:
@@ -339,7 +342,7 @@ class SpecFile(object):
# Overwrite file with new version number
write_file(self.path, data)
- self.changes.append('dropped merged patch %s' % nr)
+ self._changes.append('dropped merged patch %s' % nr)
return True
@@ -471,7 +474,7 @@ class SpecFile(object):
# Overwrite file with new version number
write_file(self.path, data)
- self.changes.append('new version %s' % version)
+ self._changes.append('new version %s' % version)
# Verify that RPM also agrees that version number has changed
if self.version != version:
@@ -499,17 +502,7 @@ class SpecFile(object):
self._revert_changes()
return False
-
- try:
- # Check patches still apply
- subprocess.check_call(['bm', '-p', '--nodeps'], cwd=self.cwd)
- except subprocess.CalledProcessError:
- logfile = os.path.join(os.path.dirname(self.path), 'log.%s' % os.path.splitext(os.path.basename(self.path))[0])
- if os.path.exists(logfile):
- subprocess.call(['tail', '-n', '15', logfile])
- return False
-
- return True
+ return self.check_and_update_patches()
class Patch(object):
"""Do things with patches"""
@@ -1027,7 +1020,7 @@ def cmd_package_new_version(options, parser):
try:
# If we made it this far, checkin the changes
- subprocess.check_call(['mgarepo', 'ci', '-m', 'new version %s' % options.version], cwd=cwd)
+ subprocess.check_call(['mgarepo', 'ci', '-m', s.changes], cwd=cwd)
# Submit is optional
if options.submit: