/[soft]/mga-gnome/trunk/mga-gnome
ViewVC logotype

Diff of /mga-gnome/trunk/mga-gnome

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3554 by ovitters, Thu Mar 15 14:09:12 2012 UTC revision 3555 by ovitters, Sun Mar 18 11:08:07 2012 UTC
# Line 50  MEDIA="Core Release Source" Line 50  MEDIA="Core Release Source"
50  URL="http://download.gnome.org/sources/"  URL="http://download.gnome.org/sources/"
51  PKGROOT='~/pkgs'  PKGROOT='~/pkgs'
52  SLEEP_INITIAL=300  SLEEP_INITIAL=300
53    SLEEP_REPEAT=30
54    SLEEP_TIMES=20
55    
56  re_majmin = re.compile(r'^([0-9]+\.[0-9]+).*')  re_majmin = re.compile(r'^([0-9]+\.[0-9]+).*')
57  re_version = re.compile(r'([-.]|\d+|[^-.\d]+)')  re_version = re.compile(r'([-.]|\d+|[^-.\d]+)')
# Line 257  class SpecFile(object): Line 259  class SpecFile(object):
259                          else spec.sources()                          else spec.sources()
260          return dict((os.path.basename(name), name) for name, no, flags in srclist)          return dict((os.path.basename(name), name) for name, no, flags in srclist)
261    
262      def update(self, version):      def update(self, version, force=False):
263          """Update specfile (increase version)"""          """Update specfile (increase version)"""
264          cur_version = self.version          cur_version = self.version
265    
# Line 269  class SpecFile(object): Line 271  class SpecFile(object):
271    
272          if judgement < 5:          if judgement < 5:
273              print "WARNING: %s!" % (msg)              print "WARNING: %s!" % (msg)
274              return False              if not force: return False
275    
276          # XXX - os.path.join is hackish          # XXX - os.path.join is hackish
277          if subprocess.check_output(["svn", "diff", os.path.join(self.path, '..')]) != '':          if subprocess.check_output(["svn", "diff", os.path.join(self.path, '..')]) != '':
# Line 302  class SpecFile(object): Line 304  class SpecFile(object):
304              print "ERROR: Increased version to %s, but RPM doesn't agree!?!" % version              print "ERROR: Increased version to %s, but RPM doesn't agree!?!" % version
305              return False              return False
306    
307    
308            # Try to download the new tarball various times and wait between attempts
309            tries = 0
310            while tries < SLEEP_TIMES:
311                tries += 1
312                try:
313                    # Download new tarball
314                    subprocess.check_call(['mgarepo', 'sync', '-d'], cwd=self.cwd)
315                    break
316                except subprocess.CalledProcessError, e:
317                    # mgarepo sync returns 1 if the tarball cannot be downloaded
318                    if e.returncode != 1:
319                        return False
320    
321                    if tries == SLEEP_TIMES:
322                        return False
323    
324                    time.sleep(SLEEP_REPEAT)
325    
326          try:          try:
             # Download new tarball  
             subprocess.check_call(['mgarepo', 'sync', '-d'], cwd=self.cwd)  
327              # Check patches still apply              # Check patches still apply
328              subprocess.check_call(['bm', '-p', '--nodeps'], cwd=self.cwd)              subprocess.check_call(['bm', '-p', '--nodeps'], cwd=self.cwd)
329          except subprocess.CalledProcessError:          except subprocess.CalledProcessError:
# Line 600  def cmd_package_new_version(options, par Line 619  def cmd_package_new_version(options, par
619      # SpecFile class handles the actual version+release change      # SpecFile class handles the actual version+release change
620      s = SpecFile(os.path.join(cwd, "SPECS", "%s.spec" % package))      s = SpecFile(os.path.join(cwd, "SPECS", "%s.spec" % package))
621      print "%s => %s" % (s.version, options.version)      print "%s => %s" % (s.version, options.version)
622      if not s.update(options.version):      if not s.update(options.version, force=options.force):
623          sys.exit(1)          sys.exit(1)
624    
625      # Check hash, if given      # Check hash, if given
# Line 734  def main(): Line 753  def main():
753      subparser = subparsers.add_parser('increase', help='Increase version number')      subparser = subparsers.add_parser('increase', help='Increase version number')
754      subparser.add_argument("package", help="Package name")      subparser.add_argument("package", help="Package name")
755      subparser.add_argument("version", help="Version number")      subparser.add_argument("version", help="Version number")
756        subparser.add_argument("-f", "--force", action="store_true", dest="force",
757                                           help="Override warnings, just do it")
758      subparser.add_argument("-u", "--upstream", action="store_true", dest="upstream",      subparser.add_argument("-u", "--upstream", action="store_true", dest="upstream",
759                                         help="Package name reflects the upstream name")                                         help="Package name reflects the upstream name")
760      subparser.add_argument("-s", "--submit", action="store_true", dest="submit",      subparser.add_argument("-s", "--submit", action="store_true", dest="submit",
# Line 743  def main(): Line 764  def main():
764      subparser.add_argument("--hash", dest="hexdigest",      subparser.add_argument("--hash", dest="hexdigest",
765                                         help="Hexdigest of the hash")                                         help="Hexdigest of the hash")
766      subparser.set_defaults(      subparser.set_defaults(
767          func=cmd_package_new_version, submit=False, upstream=False, hexdigest=None, algo="sha256"          func=cmd_package_new_version, submit=False, upstream=False, hexdigest=None, algo="sha256",
768            force=False
769      )      )
770    
771      subparser = subparsers.add_parser('gnome-release-email', help='Submit packages based on GNOME ftp-release-list email')      subparser = subparsers.add_parser('gnome-release-email', help='Submit packages based on GNOME ftp-release-list email')

Legend:
Removed from v.3554  
changed lines
  Added in v.3555

  ViewVC Help
Powered by ViewVC 1.1.30