diff options
author | Ed Bartosh <eduard.bartosh@intel.com> | 2014-12-12 17:47:36 +0200 |
---|---|---|
committer | Ed Bartosh <eduard.bartosh@intel.com> | 2014-12-14 18:08:41 +0200 |
commit | 49ad114d307741ab817e9b66cb802f9b0a0d2fdd (patch) | |
tree | e2ee37ff8f80270f5f4c3c643592f81cdd7fe70d | |
parent | 4a3e00f574c3a977e1e18b6a311c4c66ce3bda56 (diff) | |
download | repa-49ad114d307741ab817e9b66cb802f9b0a0d2fdd.tar.gz repa-49ad114d307741ab817e9b66cb802f9b0a0d2fdd.tar.bz2 repa-49ad114d307741ab817e9b66cb802f9b0a0d2fdd.zip |
Implement --base option for repa list
This option shows status of submission in base project if
submission is pending there.
Fixes: #2268
Change-Id: Idee9fafa6f8c92c524300240729778d46441d092
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
-rw-r--r-- | repa.1 | 14 | ||||
-rw-r--r-- | repa/common.py | 7 | ||||
-rwxr-xr-x | repa/list.py | 38 |
3 files changed, 47 insertions, 12 deletions
@@ -90,7 +90,7 @@ Turn on colorized output .\" .\" The "list" command description .\" -.SS \fBlist\fR [\-\-help] [\-\-processes <processes>] [\-\-showurls] [\-\-ignore <regexp>] +.SS \fBlist\fR [\-\-help] [\-\-processes <processes>] [\-\-showurls] [\-\-ignore <regexp>] [\-\-base <project>] .RS 2 List submissions in the following format: @@ -148,6 +148,13 @@ Note, that this parameter can also be specified in \fIrepa\fR configuration file .RE .PP +.B \-\-base <project> +.RS 2 +Show status of the submission in the base project. +Note, that this parameter can also be specified in \fIrepa\fR configuration file. +.RE + +.PP .\" .\" The "info" command description .\" @@ -387,6 +394,9 @@ processes = 20 project = Tizen:IVI .RE .RS 2 +base = Tizen:Common +.RE +.RS 2 color = off .RE .RS 2 @@ -405,7 +415,7 @@ Mandatory options: apiurl, apiuser, apipasswd and project .RE .RS 2 -Some options (project, processes, colorize, showurls, ignore, noaggregate) can be overridden by commandline options (--project, --processes, --colorize, --showurls, --ignore, --noaggregate) +Some options (project, processes, colorize, showurls, ignore, noaggregate, base) can be overridden by commandline options (--project, --processes, --colorize, --showurls, --ignore, --noaggregate, --base) .RE .SH BUGS diff --git a/repa/common.py b/repa/common.py index c98b1ed..9d661d7 100644 --- a/repa/common.py +++ b/repa/common.py @@ -45,12 +45,11 @@ def get_prerelease_projects(obs, target_prj, tag=None): """Get list of prerelease projects for specified target project.""" return obs.get_project_list('^%s%s:' % (OBS_PROJECT_PREFIX, target_prj)) -def prerelease_exists(obs, name, target): - """Check if prerelease project exists.""" +def get_prerelease(name, target): + """Get name of prerelease project.""" if name.startswith('submitgroup/'): name += '-group' - project = '%s%s:%s' % (OBS_PROJECT_PREFIX, target, name.replace('/', ':')) - return obs.exists(project) + return '%s%s:%s' % (OBS_PROJECT_PREFIX, target, name.replace('/', ':')) def get_project_by_name(obs, name, target): """Lookup for a project in OBS by submission or group name.""" diff --git a/repa/list.py b/repa/list.py index 654672e..98d0223 100755 --- a/repa/list.py +++ b/repa/list.py @@ -34,7 +34,7 @@ import json import re from repa.common import (OBS_PROJECT_PREFIX, Colorizer, - get_download_url, get_obs_url) + get_download_url, get_obs_url, get_prerelease) from repa.obs import OBS from repa.main import sub_main @@ -84,8 +84,16 @@ def show_urls(meta): print ' obs url: ', obs_url print +def tag_accepted(obs, project, package, tag): + """Check if tag is in comments of accepted SRs.""" + for sreq in obs.get_srs(project, 'accepted', str(package)): + descr = sreq[-1] + if descr and 'Tag:' in descr: + if tag == descr.split('Tag: ')[-1].split()[0]: + return True + return False -def list_submissions(obs, target, processes, is_colorize=False, +def list_submissions(obs, target, processes, base, is_colorize=False, showurls=False, ignore=''): """List submissions and groups.""" colorizer = Colorizer(is_colorize) @@ -99,9 +107,25 @@ def list_submissions(obs, target, processes, is_colorize=False, groups.append(meta) continue projects = [project.split('/')[-1] for project in meta['projects']] - print '%-37s %-37s %s' % (meta['git_tag'], \ - get_status(meta, colorizer, build_results, ignore), - ','.join(projects)) + if base: + tag = str(meta['git_tag']) + base_status = colorizer.white('') + prerelease = get_prerelease(tag, base) + if obs.exists(prerelease): + base_meta = json.loads(obs.get_descr(prerelease)) + base_build_results = obs.get_build_results(prerelease) + base_status = get_status(base_meta, colorizer, + base_build_results, ignore) + else: + if tag_accepted(obs, base, projects[0], tag): + base_status = colorizer.green('accepted') + print '%-37s %-37s %-37s %s' % (meta['git_tag'], \ + get_status(meta, colorizer, build_results, ignore), + base_status, ','.join(projects)) + else: + print '%-37s %-37s %s' % (meta['git_tag'], \ + get_status(meta, colorizer, build_results, ignore), + ','.join(projects)) if showurls: show_urls(meta) @@ -135,12 +159,14 @@ class List(object): default=config.get('showurls', '').lower() == 'on') parser.add_argument('--ignore', default=config.get('ignore', ''), help='ignore package failures by regexp') + parser.add_argument('--base', default=config.get('base', ''), + help='Show submission status in base project') @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, + return list_submissions(obs, argv.project, argv.processes, argv.base, argv.colorize, argv.showurls, argv.ignore) |