/[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 6521 by ovitters, Tue Oct 16 14:57:16 2012 UTC revision 6522 by ovitters, Tue Nov 27 09:59:27 2012 UTC
# Line 678  def join_streams(show_version=False, onl Line 678  def join_streams(show_version=False, onl
678    
679              yield (package, module, package_version, spec_version, downstream.files[package])              yield (package, module, package_version, spec_version, downstream.files[package])
680    
681    def cmd_group_owner(options, parser):
682        groups = set(options.group)
683    
684        output = [pkg.split("\t") for pkg in subprocess.check_output(["urpmf", "-F|", "--qf", "%group\t%name\t%sourcerpm\t%version\t%release",  "."]).splitlines()]
685        if not output: return
686    
687        # Filter by groups
688        output = [pkg for pkg in output if pkg[0] in groups]
689        if not output: return
690    
691        packages = {}
692        for group, name, sourcerpm, version, release in output:
693            if group not in packages:
694                packages[group] = {}
695    
696            source = sourcerpm if sourcerpm else name
697            end = ".src.rpm"
698            if source.endswith(end): source = source[:len(source) - len(end)]
699            end = "-%s-%s" %(version, release)
700            if source.endswith(end): source = source[:len(source) - len(end)]
701    
702            if source not in packages[group]: packages[group][source] = set()
703    
704            packages[group][source].add(name)
705    
706    
707        maints = dict([line.rpartition(" ")[::2] for line in subprocess.check_output(["mgarepo", "maintdb", "get"]).splitlines()])
708    
709        def get_output(source, maints, packages):
710            for source in packages.keys():
711                 maint = maints.get(source, "?")
712    
713                 yield "\t".join((maint, source, ",".join(packages[source])))
714    
715        first = True
716        for group in packages.keys():
717            if first:
718                first = False
719            else:
720                print ""
721                print ""
722            print group
723            print ""
724    
725            for line in sorted(get_output(source, maints, packages[group])):
726                print line
727    
728  def cmd_ls(options, parser):  def cmd_ls(options, parser):
729      streams = join_streams(show_version=options.show_version, only_diff_version=options.diff)      streams = join_streams(show_version=options.show_version, only_diff_version=options.diff)
730      if options.sort:      if options.sort:
# Line 932  def main(): Line 979  def main():
979          func=cmd_ls, upstream=False, show_version=False, diff=False          func=cmd_ls, upstream=False, show_version=False, diff=False
980      )      )
981    
982        subparser = subparsers.add_parser('group-owner', help='list packages by group')
983        subparser.add_argument('group', metavar="GROUP", nargs='+')
984    
985        subparser.set_defaults(
986                func=cmd_group_owner
987        )
988    
989      subparser = subparsers.add_parser('check-latest', help='check for latest version of packages')      subparser = subparsers.add_parser('check-latest', help='check for latest version of packages')
990      subparser.set_defaults(      subparser.set_defaults(
991          func=cmd_check_latest          func=cmd_check_latest

Legend:
Removed from v.6521  
changed lines
  Added in v.6522

  ViewVC Help
Powered by ViewVC 1.1.30