/[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 3115 by ovitters, Tue Feb 28 10:23:35 2012 UTC revision 3651 by ovitters, Wed Mar 21 19:36:29 2012 UTC
# Line 1  Line 1 
1  #!/usr/bin/python  #!/usr/bin/python -u
2    
3  # A lot of the code comes from ftpadmin, see  # A lot of the code comes from ftpadmin, see
4  #   http://git.gnome.org/browse/sysadmin-bin/tree/ftpadmin  #   http://git.gnome.org/browse/sysadmin-bin/tree/ftpadmin
# Line 36  import urlparse Line 36  import urlparse
36  # for checking hashes  # for checking hashes
37  import hashlib  import hashlib
38    
39    # for parsing ftp-release-list emails
40    import email
41    from email.mime.text import MIMEText
42    
43    # to be able to sleep for a while
44    import time
45    
46    # version freeze
47    import datetime
48    
49  MEDIA="Core Release Source"  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=180
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 81  def judge_version_increase(version_old, Line 94  def judge_version_increase(version_old,
94          compare = version_cmp(version_new, version_old)          compare = version_cmp(version_new, version_old)
95    
96          if compare == 0:          if compare == 0:
97                # 1.0.0 -> 1.0.1
98              return (-2, "Already at version %s!" % (version_old))              return (-2, "Already at version %s!" % (version_old))
99    
100          if compare != 1:          if compare != 1:
101                # 1.0.1 -> 1.0.0
102              return (-3, "Version %s is older than current version %s!" % (version_new, version_old))              return (-3, "Version %s is older than current version %s!" % (version_new, version_old))
103    
104          # Version is newer, but we don't want to see if it follows the GNOME versioning scheme          # Version is newer, but we don't want to see if it follows the GNOME versioning scheme
# Line 104  def judge_version_increase(version_old, Line 119  def judge_version_increase(version_old,
119          # Major+minor the same? Then go ahead and upgrade!          # Major+minor the same? Then go ahead and upgrade!
120          if majmins[0] == majmins[1]:          if majmins[0] == majmins[1]:
121              # Majmin of both versions are the same, looks good!              # Majmin of both versions are the same, looks good!
122                # 1.1.x -> 1.1.x or 1.0.x -> 1.0.x
123              return (10, None)              return (10, None)
124    
125          # More detailed analysis needed, so figure out the numbers          # More detailed analysis needed, so figure out the numbers
# Line 111  def judge_version_increase(version_old, Line 127  def judge_version_increase(version_old,
127    
128          # Check/ensure major version number is the same          # Check/ensure major version number is the same
129          if majmin_nrs[0][0] != majmin_nrs[1][0]:          if majmin_nrs[0][0] != majmin_nrs[1][0]:
130                # 1.0.x -> 2.0.x
131              return (1, "Major version number increase")              return (1, "Major version number increase")
132    
133          # Minor indicates stable/unstable          # Minor indicates stable/unstable
# Line 119  def judge_version_increase(version_old, Line 136  def judge_version_increase(version_old,
136          # Upgrading to unstable is weird          # Upgrading to unstable is weird
137          if not devstate[1]:          if not devstate[1]:
138              if devstate[0]:              if devstate[0]:
139                    # 1.2.x -> 1.3.x
140                  return (1, "Stable to unstable increase")                  return (1, "Stable to unstable increase")
141    
142                # 1.3.x -> 1.5.x
143              return (4, "Unstable to unstable version increase")              return (4, "Unstable to unstable version increase")
144    
145          # Unstable => stable is always ok          # Unstable => stable is always ok
146          if not devstate[0]:          if not devstate[0]:
147                # 1.1.x -> 1.2.x
148              return (5, "Unstable to stable")              return (5, "Unstable to stable")
149    
150          # Can only be increase of minors from one stable to the next          # Can only be increase of minors from one stable to the next
151            # 1.0.x -> 1.2.x
152          return (6, "Stable version increase")          return (6, "Stable version increase")
153    
154  def line_input (file):  def line_input (file):
# Line 238  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 250  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, '..')]) != '':          svn_diff_output = subprocess.check_output(["svn", "diff", os.path.join(self.path, '..')])
278            if svn_diff_output != '':
279                print svn_diff_output
280              print >>sys.stderr, "ERROR: Package has uncommitted changes!"              print >>sys.stderr, "ERROR: Package has uncommitted changes!"
281              return False              if not force:
282                    return False
283    
284                # Forcing package submission: revert changes
285                try:
286                    print >>sys.stderr, "WARNING: Force used; reverting svn changes"
287                    subprocess.check_call(["svn", "revert", "-R", os.path.join(self.path, '..')])
288                except subprocess.CalledProcessError:
289                    return False
290    
291          with open(self.path, "rw") as f:          with open(self.path, "rw") as f:
292              data = f.read()              data = f.read()
# Line 283  class SpecFile(object): Line 314  class SpecFile(object):
314              print "ERROR: Increased version to %s, but RPM doesn't agree!?!" % version              print "ERROR: Increased version to %s, but RPM doesn't agree!?!" % version
315              return False              return False
316    
317    
318            # Try to download the new tarball various times and wait between attempts
319            tries = 0
320            while tries < SLEEP_TIMES:
321                tries += 1
322                if tries > 1: time.sleep(SLEEP_REPEAT)
323                try:
324                    # Download new tarball
325                    subprocess.check_call(['mgarepo', 'sync', '-d'], cwd=self.cwd)
326                    # success, so exit loop
327                    break
328                except subprocess.CalledProcessError, e:
329                    # mgarepo sync returns 1 if the tarball cannot be downloaded
330                    if e.returncode != 1:
331                        return False
332            else:
333                return False
334    
335    
336          try:          try:
             # Download new tarball  
             subprocess.check_call(['mgarepo', 'sync', '-d'], cwd=self.cwd)  
337              # Check patches still apply              # Check patches still apply
338              subprocess.check_call(['bm', '-p', '--nodeps'], cwd=self.cwd)              subprocess.check_call(['bm', '-p', '--nodeps'], cwd=self.cwd)
339          except subprocess.CalledProcessError:          except subprocess.CalledProcessError:
340                logfile = os.path.join(os.path.dirname(self.path), 'log.%s' % os.path.splitext(os.path.basename(self.path))[0])
341                if os.path.exists(logfile):
342                    subprocess.call(['tail', '-n', '15', logfile])
343              return False              return False
344    
345          return True          return True
# Line 433  class Patch(object): Line 484  class Patch(object):
484    
485          return self._svn_author          return self._svn_author
486    
 def get_upstream_names():  
     urlopen = urllib2.build_opener()  
487    
488      good_dir = re.compile('^[-A-Za-z0-9_+.]+/$')  class Upstream(object):
489    
490        limit = None
491    
492      # Get the files      def __init__(self):
493      usock = urlopen.open(URL)          urlopen = urllib2.build_opener()
     parser = urllister()  
     parser.feed(usock.read())  
     usock.close()  
     parser.close()  
     files = parser.urls  
494    
495      tarballs = set([filename.replace('/', '') for filename in files if good_dir.search(filename)])          good_dir = re.compile('^[-A-Za-z0-9_+.]+/$')
496    
497      return tarballs          # Get the files
498            usock = urlopen.open(URL)
499            parser = urllister()
500            parser.feed(usock.read())
501            usock.close()
502            parser.close()
503            files = parser.urls
504    
505  def get_downstream_names():          tarballs = set([filename.replace('/', '') for filename in files if good_dir.search(filename)])
506            if self.limit is not None:
507                tarballs.intersection_update(self.limit)
508    
509            self.names = tarballs
510    
511    class Downstream(object):
512      re_file = re.compile(r'^(?P<module>.*?)[_-](?:(?P<oldversion>([0-9]+[\.])*[0-9]+)-)?(?P<version>([0-9]+[\.\-])*[0-9]+)\.(?P<format>(?:tar\.|diff\.)?[a-z][a-z0-9]*)$')      re_file = re.compile(r'^(?P<module>.*?)[_-](?:(?P<oldversion>([0-9]+[\.])*[0-9]+)-)?(?P<version>([0-9]+[\.\-])*[0-9]+)\.(?P<format>(?:tar\.|diff\.)?[a-z][a-z0-9]*)$')
513    
514      contents = subprocess.check_output(['urpmf', '--files', '.', "--media", MEDIA], close_fds=True).strip("\n").splitlines()      def __init__(self):
515            contents = subprocess.check_output(['urpmf', '--qf', '%name|%version|%files', '.', "--media", MEDIA], close_fds=True).strip("\n").splitlines()
516    
517            FILES = {}
518            TARBALLS = {}
519    
520      FILES = {}          for line in  contents:
521      TARBALLS = {}              try:
522                    srpm, version, filename = line.split("|")
523                except ValueError:
524                    print >>sys.stderr, line
525                    continue
526    
527                if '.tar' in filename:
528                    r = self.re_file.match(filename)
529                    if r:
530                        fileinfo = r.groupdict()
531                        module = fileinfo['module']
532    
533                        if module not in TARBALLS:
534                            TARBALLS[module] = {}
535                        TARBALLS[module][srpm] = version
536    
537                if srpm not in FILES:
538                    FILES[srpm] = set()
539                FILES[srpm].add(filename)
540    
541            self.tarballs = TARBALLS
542            self.files = FILES
543    
544    def get_downstream_from_upstream(upstream, version):
545        # Determine the package name
546        downstream = Downstream()
547    
548      for line in  contents:      if upstream not in downstream.tarballs:
549            raise ValueError("No packages for upstream name: %s" % upstream)
550    
551        if len(downstream.tarballs[upstream]) == 1:
552            return downstream.tarballs[upstream].keys()
553    
554        # Directories packages are located in
555        root = os.path.expanduser(PKGROOT)
556    
557        packages = {}
558        for package in downstream.tarballs[upstream].keys():
559            cwd = os.path.join(root, package)
560    
561            # Checkout package to ensure the checkout reflects the latest changes
562          try:          try:
563              srpm, filename = line.split(":")              subprocess.check_call(['mgarepo', 'co', package], cwd=root)
564          except ValueError:          except subprocess.CalledProcessError:
565              print >>sys.stderr, line              raise ValueError("Multiple packages found and cannot checkout %s" % package)
             continue  
566    
567          if '.tar' in filename:          # Determine version from spec file
568              r = re_file.match(filename)          try:
569              if r:              packages[package] = SpecFile(os.path.join(cwd, "SPECS", "%s.spec" % package)).version
570                  fileinfo = r.groupdict()          except subprocess.CalledProcessError:
571                  module = fileinfo['module']              raise ValueError("Multiple packages found and cannot determine version of %s" % package)
   
                 if module not in TARBALLS:  
                     TARBALLS[module] = set()  
                 TARBALLS[module].add(srpm)  
   
         if srpm not in FILES:  
             FILES[srpm] = set()  
         FILES[srpm].add(filename)  
572    
573      return TARBALLS, FILES      # Return all packages reflecting the current version
574        matches = [package for package in packages if packages[package] == version]
575        if len(matches):
576            return matches
577    
578        # Return all packages reflecting the version before the current version
579        latest_version = get_latest_version(packages.values(), max_version=version)
580        matches = [package for package in packages if packages[package] == latest_version]
581        if len(matches):
582            return matches
583    
584        # Give up
585        raise ValueError("Multiple packages found and cannot determine package for version %s" % version)
586    
587  def write_file(path, data):  def write_file(path, data):
588      with tempfile.NamedTemporaryFile(dir=os.path.dirname(path), delete=False) as fdst:      with tempfile.NamedTemporaryFile(dir=os.path.dirname(path), delete=False) as fdst:
# Line 489  def write_file(path, data): Line 591  def write_file(path, data):
591          os.rename(fdst.name, path)          os.rename(fdst.name, path)
592    
593  def cmd_co(options, parser):  def cmd_co(options, parser):
594      upstream = get_upstream_names()      root = os.path.expanduser(PKGROOT)
     downstream, downstream_files = get_downstream_names()  
595    
596      cwd = os.path.expanduser(PKGROOT)      for package, module, package_version, spec_version, downstream_files in sorted(join_streams()):
597            print "%s => %s" % (module, package)
598            subprocess.call(['mgarepo', 'co', package], cwd=root)
599    
600      matches = upstream & set(downstream.keys())  def join_streams(show_version=False, only_diff_version=False):
601      for module in matches:      root = os.path.expanduser(PKGROOT)
         print module, "\t".join(downstream[module])  
         for package in downstream[module]:  
             subprocess.call(['mgarepo', 'co', package], cwd=cwd)  
   
 def join_streams():  
     upstream = get_upstream_names()  
     downstream, downstream_files = get_downstream_names()  
602    
603      matches = upstream & set(downstream.keys())      upstream = Upstream().names
604        downstream = Downstream()
605    
606        matches = upstream & set(downstream.tarballs.keys())
607      for module in matches:      for module in matches:
608          for package in downstream[module]:          for package in downstream.tarballs[module].keys():
609              yield (package, module)              package_version = downstream.tarballs[module][package]
610                spec_version = None
611                if show_version or only_diff_version:
612                    cwd = os.path.join(root, package)
613                    try:
614                        spec_version = SpecFile(os.path.join(cwd, "SPECS", "%s.spec" % package)).version
615                    except subprocess.CalledProcessError:
616                        spec_version = 'N/A'
617    
618  def cmd_ls(options, parser):              if only_diff_version and package_version == spec_version:
619      for package, module in sorted(join_streams()):                  continue
         print "\t".join((package, module)) if options.upstream else package  
620    
621  def cmd_patches(options, parser):              yield (package, module, package_version, spec_version, downstream.files[package])
     upstream = get_upstream_names()  
     downstream, downstream_files = get_downstream_names()  
622    
623      path = os.path.expanduser(PKGROOT)  def cmd_ls(options, parser):
624        for package, module, package_version, spec_version, downstream_files in sorted(join_streams(show_version=options.show_version, only_diff_version=options.diff)):
625            sys.stdout.write(package)
626            if options.upstream: sys.stdout.write("\t%s" % module)
627            if options.show_version: sys.stdout.write("\t%s\t%s" % (spec_version, package_version))
628            print
629    
630      import pprint  def cmd_patches(options, parser):
631        root = os.path.expanduser(PKGROOT)
632    
633      matches = upstream & set(downstream.keys())      for package, module, package_version, spec_version, downstream_files in sorted(join_streams()):
634      for module in sorted(matches):          for filename in downstream_files:
635          for srpm in downstream[module]:              if '.patch' in filename or '.diff' in filename:
636              for filename in downstream_files[srpm]:  
637                  if '.patch' in filename or '.diff' in filename:                  p = Patch(os.path.join(root, package, "SOURCES", filename), show_path=options.path)
638                    valid = ""
639                      p = Patch(os.path.join(path, srpm, "SOURCES", filename), show_path=options.path)                  forwarded = ""
640                      valid = ""                  if p.dep3['headers']:
641                      forwarded = ""                      forwarded = p.dep3['headers'].get('Forwarded', "no")
642                      if p.dep3['headers']:                      if p.dep3['valid']:
643                          forwarded = p.dep3['headers'].get('Forwarded', "no")                          valid="VALID"
644                          if p.dep3['valid']:                  print "\t".join((module, package, str(p), forwarded, valid))
                             valid="VALID"  
                     print "\t".join((module, srpm, str(p), forwarded, valid))  
645    
646  def cmd_dep3(options, parser):  def cmd_dep3(options, parser):
647      p = Patch(options.patch)      p = Patch(options.patch)
# Line 543  def cmd_dep3(options, parser): Line 650  def cmd_dep3(options, parser):
650  def cmd_package_new_version(options, parser):  def cmd_package_new_version(options, parser):
651      # Determine the package name      # Determine the package name
652      if options.upstream:      if options.upstream:
653          downstream, downstream_files = get_downstream_names()          try:
654                package = get_downstream_from_upstream(options.package, options.version)[0]
655          if options.package not in downstream:          except ValueError, e:
656              print >>sys.stderr, "ERROR: No packages for upstream name: %s" % options.package              print >>sys.stderr, "ERROR: %s" % e
             sys.exit(1)  
   
         if len(downstream[options.package]) != 1:  
             # XXX - Make it more intelligent  
             print >>sys.stderr, "ERROR: Multiple packages found for %s: %s" % (options.package, ", ".join(downstream[options.package]))  
657              sys.exit(1)              sys.exit(1)
   
         package = list(downstream[options.package])[0]  
658      else:      else:
659          package = options.package          package = options.package
660    
# Line 571  def cmd_package_new_version(options, par Line 671  def cmd_package_new_version(options, par
671      # SpecFile class handles the actual version+release change      # SpecFile class handles the actual version+release change
672      s = SpecFile(os.path.join(cwd, "SPECS", "%s.spec" % package))      s = SpecFile(os.path.join(cwd, "SPECS", "%s.spec" % package))
673      print "%s => %s" % (s.version, options.version)      print "%s => %s" % (s.version, options.version)
674      if not s.update(options.version):      if not s.update(options.version, force=options.force):
675          sys.exit(1)          sys.exit(1)
676    
677      # Check hash, if given      # Check hash, if given
# Line 582  def cmd_package_new_version(options, par Line 682  def cmd_package_new_version(options, par
682              sys.stderr(1)              sys.stderr(1)
683    
684          for filename in sources:          for filename in sources:
685              if not is_valid_hash(os.path.join(cwd, "SOURCES", filename), options.algo, options.hexdigest):              path = os.path.join(cwd, "SOURCES", filename)
686                if not is_valid_hash(path, options.algo, options.hexdigest):
687                  print >>sys.stderr, "ERROR: Hash file failed check for %s!" % path                  print >>sys.stderr, "ERROR: Hash file failed check for %s!" % path
688                  print >>sys.stderr, "ERROR: Reverting changes!"                  print >>sys.stderr, "ERROR: Reverting changes!"
689                  subprocess.call(['svn', 'revert', '-R', cwd], cwd=cwd)                  subprocess.call(['svn', 'revert', '-R', cwd], cwd=cwd)
# Line 594  def cmd_package_new_version(options, par Line 695  def cmd_package_new_version(options, par
695              # checkin changes              # checkin changes
696              subprocess.check_call(['mgarepo', 'ci', '-m', 'new version %s' % options.version], cwd=cwd)              subprocess.check_call(['mgarepo', 'ci', '-m', 'new version %s' % options.version], cwd=cwd)
697              # and submit              # and submit
698              subprocess.check_call(['mgarepo', 'submit'], cwd=cwd)              # XXX HACK NOT TO AUTO SUBMIT ATM
699                if options.hexdigest is None:
700                    subprocess.check_call(['mgarepo', 'submit'], cwd=cwd)
701          except subprocess.CalledProcessError:          except subprocess.CalledProcessError:
702              sys.exit(1)              sys.exit(1)
703    
704    def cmd_parse_ftp_release_list(options, parser):
705        def _send_reply_mail(contents, orig_msg, to, packages=[], error=False):
706            """Send an reply email"""
707            contents.seek(0)
708            msg = MIMEText(contents.read(), _charset='utf-8')
709    
710            if error:
711                # XXX - ugly
712                contents.seek(0)
713                lastline = contents.read().rstrip().splitlines()[-1]
714                # Remove things like "ERROR: " and so on from the last line
715                lastline = re.sub(r'^(?:[^ :]+:\s+)+', '', lastline)
716                # Remove things like "   - " (youri output from mgarepo submit)
717                lastline = re.sub(r'^\s+-\s+', '', lastline)
718                subjecterror = " (ERROR: %s)" % lastline if lastline else " (ERROR)"
719            else:
720                subjecterror = ""
721    
722            if packages:
723                subject = "%s %s%s" % (", ".join(packages), orig_msg['X-Module-Version'], subjecterror)
724            else:
725                subject = "Re: %s%s" % (orig_msg['Subject'], subjecterror)
726    
727            msg['Subject'] = subject
728            msg['To'] = to
729            msg["In-Reply-To"] = orig_msg["Message-ID"]
730            msg["References"] = orig_msg["Message-ID"]
731    
732            # Call sendmail program directly so it doesn't matter if the service is running
733            cmd = ['/usr/sbin/sendmail', '-oi', '--']
734            cmd.extend([to])
735            p = subprocess.Popen(cmd, stdin=subprocess.PIPE)
736            p.stdin.write(msg.as_string())
737            p.stdin.flush()
738            p.stdin.close()
739            p.wait()
740    
741    
742        msg = email.email.message_from_file(sys.stdin)
743    
744        if options.mail:
745            stdout = tempfile.TemporaryFile()
746            stderr = stdout
747        else:
748            stdout = sys.stdout
749            stderr = sys.stderr
750    
751        try:
752            module = msg['X-Module-Name']
753            version = msg['X-Module-Version']
754            hexdigest = msg['X-Module-SHA256-tar.xz']
755        except KeyError, e:
756            print >>stderr, "ERROR: %s" % e
757            if options.mail: _send_reply_mail(stdout, msg, options.mail, error=True)
758            sys.exit(1)
759    
760        try:
761            packages = get_downstream_from_upstream(module, version)
762        except ValueError, e:
763            print >>stderr, "ERROR: %s" % e
764            if options.mail: _send_reply_mail(stdout, msg, options.mail, error=True)
765            sys.exit(1)
766    
767        if options.wait:
768            # maildrop aborts and will try to deliver after 5min
769            # fork to avoid this
770            if os.fork() != 0: sys.exit(0)
771            # wait SLEEP_INITIAL after the message was sent
772            secs = SLEEP_INITIAL
773            t = email.utils.parsedate_tz(msg['Date'])
774            if t is not None:
775                msg_time = email.utils.mktime_tz(t)
776                secs = SLEEP_INITIAL - (time.time() - msg_time)
777    
778            if secs > 0: time.sleep(secs)
779    
780        error = False
781        for package in packages:
782            cmd = ['mga-gnome', 'increase', '--submit', '--hash', hexdigest]
783            if options.force:
784                cmd.append('--force')
785            cmd.extend((package, version))
786            if subprocess.call(cmd, stdout=stdout, stderr=stderr):
787                error = True
788    
789        if options.mail: _send_reply_mail(stdout, msg, options.mail, packages=packages, error=error)
790    
791  def main():  def main():
792      description = """Mageia GNOME commands."""      description = """Mageia GNOME commands."""
793      epilog="""Report bugs to Olav Vitters"""      epilog="""Report bugs to Olav Vitters"""
794      parser = argparse.ArgumentParser(description=description,epilog=epilog)      parser = argparse.ArgumentParser(description=description,epilog=epilog)
795        parser.add_argument("-l", "--limit", type=argparse.FileType('r', 0),
796                            dest="limit_upstream", metavar="FILE",
797                            help="File containing upstream names")
798    
799      # SUBPARSERS      # SUBPARSERS
800      subparsers = parser.add_subparsers(title='subcommands')      subparsers = parser.add_subparsers(title='subcommands')
# Line 615  def main(): Line 807  def main():
807      subparser = subparsers.add_parser('packages', help='list all GNOME packages')      subparser = subparsers.add_parser('packages', help='list all GNOME packages')
808      subparser.add_argument("-m", "--m", action="store_true", dest="upstream",      subparser.add_argument("-m", "--m", action="store_true", dest="upstream",
809                                         help="Show upstream module")                                         help="Show upstream module")
810        subparser.add_argument(      "--version", action="store_true", dest="show_version",
811                                           help="Show version numbers")
812        subparser.add_argument(      "--diff", action="store_true", dest="diff",
813                                           help="Only show packages with different version")
814      subparser.set_defaults(      subparser.set_defaults(
815          func=cmd_ls, upstream=False          func=cmd_ls, upstream=False, show_version=False, diff=False
816      )      )
817    
818      subparser = subparsers.add_parser('patches', help='list all GNOME patches')      subparser = subparsers.add_parser('patches', help='list all GNOME patches')
# Line 635  def main(): Line 831  def main():
831      subparser = subparsers.add_parser('increase', help='Increase version number')      subparser = subparsers.add_parser('increase', help='Increase version number')
832      subparser.add_argument("package", help="Package name")      subparser.add_argument("package", help="Package name")
833      subparser.add_argument("version", help="Version number")      subparser.add_argument("version", help="Version number")
834        subparser.add_argument("-f", "--force", action="store_true", dest="force",
835                                           help="Override warnings, just do it")
836      subparser.add_argument("-u", "--upstream", action="store_true", dest="upstream",      subparser.add_argument("-u", "--upstream", action="store_true", dest="upstream",
837                                         help="Package name reflects the upstream name")                                         help="Package name reflects the upstream name")
838      subparser.add_argument("-s", "--submit", action="store_true", dest="submit",      subparser.add_argument("-s", "--submit", action="store_true", dest="submit",
# Line 644  def main(): Line 842  def main():
842      subparser.add_argument("--hash", dest="hexdigest",      subparser.add_argument("--hash", dest="hexdigest",
843                                         help="Hexdigest of the hash")                                         help="Hexdigest of the hash")
844      subparser.set_defaults(      subparser.set_defaults(
845          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",
846            force=False
847        )
848    
849        subparser = subparsers.add_parser('gnome-release-email', help='Submit packages based on GNOME ftp-release-list email')
850        subparser.add_argument("-m", "--mail", help="Email address to send the progress to")
851        subparser.add_argument("-w", "--wait", action="store_true",
852                                     help="Wait before trying to retrieve the new version")
853        subparser.add_argument("-f", "--force", action="store_true",
854                                     help="Force submission")
855        subparser.set_defaults(
856            func=cmd_parse_ftp_release_list, force=False, wait=False
857      )      )
858    
859      if len(sys.argv) == 1:      if len(sys.argv) == 1:
# Line 652  def main(): Line 861  def main():
861          sys.exit(2)          sys.exit(2)
862    
863      options = parser.parse_args()      options = parser.parse_args()
864        if options.limit_upstream:
865            Upstream.limit = set(options.limit_upstream.read().strip("\n").splitlines())
866    
867      try:      try:
868          options.func(options, parser)          options.func(options, parser)
# Line 667  def main(): Line 878  def main():
878          sys.exit(0)          sys.exit(0)
879    
880  if __name__ == "__main__":  if __name__ == "__main__":
881        os.environ['PYTHONUNBUFFERED'] = '1'
882      main()      main()

Legend:
Removed from v.3115  
changed lines
  Added in v.3651

  ViewVC Help
Powered by ViewVC 1.1.30