| |
@@ -178,6 +178,7 @@
|
| |
'tag': 'tag-build',
|
| |
'untag-pkg': 'untag-build',
|
| |
'untag': 'untag-build',
|
| |
+ 'watch-tasks': 'watch-task',
|
| |
}
|
| |
cmd = args[0]
|
| |
cmd = aliases.get(cmd, cmd)
|
| |
@@ -185,7 +186,7 @@
|
| |
cmd = "moshimoshi"
|
| |
cmd = cmd.replace('-', '_')
|
| |
if globals().has_key('anon_handle_' + cmd):
|
| |
- if not options.force_auth:
|
| |
+ if not options.force_auth and '--mine' not in args:
|
| |
options.noauth = True
|
| |
cmd = 'anon_handle_' + cmd
|
| |
elif globals().has_key('handle_' + cmd):
|
| |
@@ -5814,27 +5815,14 @@
|
| |
for task_id in tasks:
|
| |
session.setTaskPriority(task_id, options.priority, options.recurse)
|
| |
|
| |
- def handle_list_tasks(options, session, args):
|
| |
- "Print the list of tasks"
|
| |
- usage = _("usage: %prog list-tasks [options]")
|
| |
- usage += _("\n(Specify the --help global option for a list of other help options)")
|
| |
- parser = OptionParser(usage=usage)
|
| |
- parser.add_option("--mine", action="store_true", help=_("Just print your tasks"))
|
| |
- parser.add_option("--user", help=_("Only tasks for this user"))
|
| |
- parser.add_option("--arch", help=_("Only tasks for this architecture"))
|
| |
- parser.add_option("--method", help=_("Only tasks of this method"))
|
| |
- parser.add_option("--channel", help=_("Only tasks in this channel"))
|
| |
- parser.add_option("--host", help=_("Only tasks for this host"))
|
| |
- parser.add_option("--quiet", action="store_true", help=_("Do not display the column headers"), default=options.quiet)
|
| |
- (options, args) = parser.parse_args(args)
|
| |
- if len(args) != 0:
|
| |
- parser.error(_("This command takes no arguments"))
|
| |
- assert False
|
| |
- activate_session(session)
|
| |
+ def _list_tasks(options, session):
|
| |
+ "Retrieve a list of tasks"
|
| |
+
|
| |
callopts = {
|
| |
'state' : [koji.TASK_STATES[s] for s in ('FREE', 'OPEN', 'ASSIGNED')],
|
| |
'decode' : True,
|
| |
}
|
| |
+
|
| |
if options.mine:
|
| |
user = session.getLoggedInUser()
|
| |
if not user:
|
| |
@@ -5864,14 +5852,12 @@
|
| |
print "No such host: %s" % options.host
|
| |
sys.exit(1)
|
| |
callopts['host_id'] = host['id']
|
| |
- #tasklist = session.taskReport(owner=id)
|
| |
+
|
| |
qopts = {'order' : 'priority,create_time'}
|
| |
tasklist = session.listTasks(callopts, qopts)
|
| |
- tasks = dict([(x['id'], x) for x in tasklist])
|
| |
+ tasks = {x['id']:x for x in tasklist}
|
| |
+
|
| |
#thread the tasks
|
| |
- if not tasklist:
|
| |
- print "(no tasks)"
|
| |
- return
|
| |
for t in tasklist:
|
| |
if t['parent'] is not None:
|
| |
parent = tasks.get(t['parent'])
|
| |
@@ -5879,6 +5865,32 @@
|
| |
parent.setdefault('children',[])
|
| |
parent['children'].append(t)
|
| |
t['sub'] = True
|
| |
+
|
| |
+ return tasklist
|
| |
+
|
| |
+
|
| |
+ def handle_list_tasks(options, session, args):
|
| |
+ "Print the list of tasks"
|
| |
+ usage = _("usage: %prog list-tasks [options]")
|
| |
+ usage += _("\n(Specify the --help global option for a list of other help options)")
|
| |
+ parser = OptionParser(usage=usage)
|
| |
+ parser.add_option("--mine", action="store_true", help=_("Just print your tasks"))
|
| |
+ parser.add_option("--user", help=_("Only tasks for this user"))
|
| |
+ parser.add_option("--arch", help=_("Only tasks for this architecture"))
|
| |
+ parser.add_option("--method", help=_("Only tasks of this method"))
|
| |
+ parser.add_option("--channel", help=_("Only tasks in this channel"))
|
| |
+ parser.add_option("--host", help=_("Only tasks for this host"))
|
| |
+ parser.add_option("--quiet", action="store_true", help=_("Do not display the column headers"), default=options.quiet)
|
| |
+ (options, args) = parser.parse_args(args)
|
| |
+ if len(args) != 0:
|
| |
+ parser.error(_("This command takes no arguments"))
|
| |
+ assert False
|
| |
+
|
| |
+ activate_session(session)
|
| |
+ tasklist = _list_tasks(options, session)
|
| |
+ if not tasklist:
|
| |
+ print "(no tasks)"
|
| |
+ return
|
| |
if not options.quiet:
|
| |
print_task_headers()
|
| |
for t in tasklist:
|
| |
@@ -5987,16 +5999,37 @@
|
| |
parser = OptionParser(usage=usage)
|
| |
parser.add_option("--quiet", action="store_true",
|
| |
help=_("Do not print the task information"), default=options.quiet)
|
| |
+ parser.add_option("--mine", action="store_true", help=_("Just watch your tasks"))
|
| |
+ parser.add_option("--user", help=_("Only tasks for this user"))
|
| |
+ parser.add_option("--arch", help=_("Only tasks for this architecture"))
|
| |
+ parser.add_option("--method", help=_("Only tasks of this method"))
|
| |
+ parser.add_option("--channel", help=_("Only tasks in this channel"))
|
| |
+ parser.add_option("--host", help=_("Only tasks for this host"))
|
| |
(options, args) = parser.parse_args(args)
|
| |
+ selection = (options.mine or
|
| |
+ options.user or
|
| |
+ options.arch or
|
| |
+ options.method or
|
| |
+ options.channel or
|
| |
+ options.host)
|
| |
+ if args and selection:
|
| |
+ parser.error(_("Selection options cannot be combined with a task list"))
|
| |
+
|
| |
activate_session(session)
|
| |
- tasks = []
|
| |
- for task in args:
|
| |
- try:
|
| |
- tasks.append(int(task))
|
| |
- except ValueError:
|
| |
- parser.error(_("task id must be an integer"))
|
| |
- if not tasks:
|
| |
- parser.error(_("at least one task id must be specified"))
|
| |
+ if selection:
|
| |
+ tasks = [task['id'] for task in _list_tasks(options, session)]
|
| |
+ if not tasks:
|
| |
+ print "(no tasks)"
|
| |
+ return
|
| |
+ else:
|
| |
+ tasks = []
|
| |
+ for task in args:
|
| |
+ try:
|
| |
+ tasks.append(int(task))
|
| |
+ except ValueError:
|
| |
+ parser.error(_("task id must be an integer"))
|
| |
+ if not tasks:
|
| |
+ parser.error(_("at least one task id must be specified"))
|
| |
|
| |
return watch_tasks(session, tasks, quiet=options.quiet)
|
| |
|
| |