--- mga-gnome/trunk/mga-gnome 2012/02/22 20:47:36 3034 +++ mga-gnome/trunk/mga-gnome 2012/02/23 19:43:09 3037 @@ -120,11 +120,18 @@ @property def version(self): return subprocess.check_output(["rpm", "--specfile", self.path, "--queryformat", "%{VERSION}\n"]).splitlines()[0] + def update(self, version): """Update specfile (increase version)""" cur_version = self.version - if version_cmp(version, cur_version) != 1: + compare = version_cmp(version, cur_version) + + if compare == 0: + print >>sys.stderr, "ERROR: Already at version %s!" % (cur_version) + return False + + if compare != 1: print >>sys.stderr, "ERROR: Version %s is older than current version %s!" % (version, cur_version) return False @@ -132,17 +139,17 @@ data = f.read() if data.count("%mkrel") != 1: - print "WARNING: Multiple %mkrel found; don't know what to do!" + print >>sys.stderr, "ERROR: Multiple %mkrel found; don't know what to do!" return False data, nr = self.re_update_version.subn(r'\g
%s\g' % version, data, 1)
             if nr != 1:
-                print "WARNING: Could not increase version!"
+                print >>sys.stderr, "ERROR: Could not increase version!"
                 return False
 
             data, nr = self.re_update_release.subn(r'\g
%mkrel 1\g', data, 1)
             if nr != 1:
-                print "WARNING: Could not reset release!"
+                print >>sys.stderr, "ERROR: Could not reset release!"
                 return False
 
             # Overwrite file with new version number
@@ -415,7 +422,7 @@
 
     subprocess.call(['mgarepo', 'co', package], cwd=cwd)
     s = SpecFile(os.path.join(cwd, package, "SPECS", "%s.spec" % package))
-    print s.version
+    print "%s => %s" % (s.version, options.version)
     if not s.update(options.version):
         sys.exit(1)