.\"
.\" The "list" command description
.\"
-.SS \fBlist\fR [\-\-help] [\-\-processes <processes>]
+.SS \fBlist\fR [\-\-help] [\-\-processes <processes>] [\-\-showurls]
.RS 2
List submissions in the following format:
.RS 2
Use PROCESSES to specify the amount of python processes to run in parallel. Usage of this option can significantly speed up repa list.
Note, that this parameter can also be specified in \fIrepa\fR configuration file.
+.RE
+.PP
+.B \-\-showurls
+.RS 2
+Show OBS and download urls in the output. It's switched off by default.
+Note, that this parameter can also be specified in \fIrepa\fR configuration file.
.RE
+
.PP
.\"
.\" The "info" command description
.RS 2
color = off
.RE
+.RS 2
+showurls = off
+.RE
+
.RS 2
Mandatory options: apiurl, apiuser, apipasswd and project
.RE
.RS 2
-Some options (project, processes, colorize) can be overridden by commandline options (--project, --processes, --colorize)
+Some options (project, processes, colorize, showurls) can be overridden by commandline options (--project, --processes, --colorize, --showurls)
.RE
.SH BUGS
"""
import sys
+import os
import time
import json
from functools import wraps, partial
else:
return text
+def get_download_url(meta):
+ """Get download url from meta."""
+ if 'download_url' in meta:
+ return meta['download_url']
+ # Guess url from image url if download_url is not in the meta
+ if 'images' not in meta:
+ return
+ for img in meta['images']:
+ if 'url' in img:
+ return img['url'].split('images')[0]
+
+
+def get_obs_url(meta, buildurl='https://build.tizen.org'):
+ """Get obs project url from meta."""
+ if 'obs_url' in meta:
+ return meta['obs_url']
+ # Make it from git tag and obs_target_prj if obs_url is not in the meta
+ if 'obs_target_prj' not in meta:
+ return
+ if 'name' not in meta and 'git_tag' not in meta:
+ return
+ name = meta.get('git_tag') or meta.get('name')
+ return os.path.join(buildurl, 'project/show?project=home:prerelease:%s:%s'
+ % (meta['obs_target_prj'], name.replace('/', ':')))
+
from collections import defaultdict
-from repa.common import get_project_by_name
+from repa.common import get_project_by_name, get_download_url, get_obs_url
from repa.obs import OBS
from repa.main import sub_main
return status
-def get_download_url(meta):
- """Get download url from meta."""
- if 'download_url' in meta:
- return meta['download_url']
- # Guess url from image url if download_url is not in the meta
- if 'images' not in meta:
- return
- for img in meta['images']:
- if 'url' in img:
- return img['url'].split('images')[0]
-
-
-def get_obs_url(meta, buildurl='https://build.tizen.org'):
- """Get obs project url from meta."""
- if 'obs_url' in meta:
- return meta['obs_url']
- # Make it from git tag and obs_target_prj if obs_url is not in the meta
- if 'obs_target_prj' not in meta:
- return
- if 'name' not in meta and 'git_tag' not in meta:
- return
- name = meta.get('git_tag') or meta.get('name')
- return os.path.join(buildurl, 'project/show?project=home:prerelease:%s:%s'
- % (meta['obs_target_prj'], name.replace('/', ':')))
-
-
def info(obs, name, target):
"""Print detailed info about submission or submitgroup."""
is_group = name.startswith('submitgroup/')
import sys
import json
-from repa.common import OBS_PROJECT_PREFIX, Colorizer
+from repa.common import (OBS_PROJECT_PREFIX, Colorizer,
+ get_download_url, get_obs_url)
from repa.obs import OBS
from repa.main import sub_main
return colorizer.green('ready')
-def list_submissions(obs, target, processes, is_colorize=False):
+def show_urls(meta):
+ """Print OBS and download urls."""
+ download_url = get_download_url(meta)
+ if download_url:
+ print ' download url: ', download_url
+ obs_url = get_obs_url(meta)
+ if obs_url:
+ print ' obs url: ', obs_url
+ print
+
+
+def list_submissions(obs, target, processes, is_colorize=False,
+ showurls=False):
"""List submissions and groups."""
colorizer = Colorizer(is_colorize)
# submissions
projects = [project.split('/')[-1] for project in meta['projects']]
print '%-37s %-37s %s' % (meta['git_tag'], \
get_status(meta, colorizer, build_results), ','.join(projects))
+ if showurls:
+ show_urls(meta)
# groups
if groups:
print
for meta in groups:
print '%-37s %-37s' % (meta['name'], get_status(meta, colorizer))
+ if showurls:
+ show_urls(meta)
class List(object):
parser.add_argument('--processes', type=int,
help='amount of parallel processes to use',
default=config.get('processes'))
+ parser.add_argument('--showurls', action='store_true',
+ help='show OBS and download urls',
+ default=config.get('showurls', '').lower() == 'on')
@staticmethod
def run(argv):
"""Command line entry point. Called from [sub_]main"""
obs = OBS(argv.apiurl, argv.apiuser, argv.apipasswd)
return list_submissions(obs, argv.project, argv.processes,
- argv.colorize)
+ argv.colorize, argv.showurls)
if __name__ == '__main__':