/[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 3498 by ovitters, Thu Mar 15 13:08:18 2012 UTC revision 3501 by ovitters, Thu Mar 15 14:02:03 2012 UTC
# Line 520  def write_file(path, data): Line 520  def write_file(path, data):
520          os.rename(fdst.name, path)          os.rename(fdst.name, path)
521    
522  def cmd_co(options, parser):  def cmd_co(options, parser):
523      upstream = get_upstream_names()      root = os.path.expanduser(PKGROOT)
     downstream, downstream_files = get_downstream_names()  
524    
525      cwd = os.path.expanduser(PKGROOT)      for package, module, package_version, spec_version in sorted(join_streams()):
526            print "%s => %s" % (module, package)
527            subprocess.call(['mgarepo', 'co', package], cwd=root)
528    
529      matches = upstream & set(downstream.keys())  def join_streams(show_version=False, only_diff_version=False):
530      for module in matches:      root = os.path.expanduser(PKGROOT)
         print module, "\t".join(downstream[module].keys())  
         for package in downstream[module].keys():  
             subprocess.call(['mgarepo', 'co', package], cwd=cwd)  
531    
 def join_streams():  
532      upstream = get_upstream_names()      upstream = get_upstream_names()
533      downstream, downstream_files = get_downstream_names()      downstream, downstream_files = get_downstream_names()
534    
535      matches = upstream & set(downstream.keys())      matches = upstream & set(downstream.keys())
536      for module in matches:      for module in matches:
537          for package in downstream[module].keys():          for package in downstream[module].keys():
538              yield (package, module)              package_version = downstream[module][package]
539                spec_version = None
540                if show_version or only_diff_version:
541                    cwd = os.path.join(root, package)
542                    try:
543                        spec_version = SpecFile(os.path.join(cwd, "SPECS", "%s.spec" % package)).version
544                    except subprocess.CalledProcessError:
545                        spec_version = 'N/A'
546    
547                if only_diff_version and package_version == spec_version:
548                    continue
549    
550                yield (package, module, package_version, spec_version)
551    
552  def cmd_ls(options, parser):  def cmd_ls(options, parser):
553      for package, module in sorted(join_streams()):      for package, module, package_version, spec_version in sorted(join_streams(show_version=options.show_version, only_diff_version=options.diff)):
554          print "\t".join((package, module)) if options.upstream else package          print package,"\t",
555            if options.upstream: print module, "\t",
556            if options.show_version: print spec_version, "\t", package_version, "\t",
557            print
558    
559  def cmd_patches(options, parser):  def cmd_patches(options, parser):
560      upstream = get_upstream_names()      upstream = get_upstream_names()
# Line 706  def main(): Line 718  def main():
718      subparser = subparsers.add_parser('packages', help='list all GNOME packages')      subparser = subparsers.add_parser('packages', help='list all GNOME packages')
719      subparser.add_argument("-m", "--m", action="store_true", dest="upstream",      subparser.add_argument("-m", "--m", action="store_true", dest="upstream",
720                                         help="Show upstream module")                                         help="Show upstream module")
721        subparser.add_argument(      "--version", action="store_true", dest="show_version",
722                                           help="Show version numbers")
723        subparser.add_argument(      "--diff", action="store_true", dest="diff",
724                                           help="Only show packages with different version")
725      subparser.set_defaults(      subparser.set_defaults(
726          func=cmd_ls, upstream=False          func=cmd_ls, upstream=False, show_version=False, diff=False
727      )      )
728    
729      subparser = subparsers.add_parser('patches', help='list all GNOME patches')      subparser = subparsers.add_parser('patches', help='list all GNOME patches')

Legend:
Removed from v.3498  
changed lines
  Added in v.3501

  ViewVC Help
Powered by ViewVC 1.1.28