From: Ed Bartosh Date: Thu, 12 Jun 2014 12:54:45 +0000 (+0300) Subject: list: Implement --ignore command line option X-Git-Tag: 0.3~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8f753c3be161fb07c77241748eedffab39220219;p=tools%2Frepa.git list: Implement --ignore command line option This option gives user possibility to ignore broken state of packages. For Tizen:Common and Tizen:IVI it's must have currently as _aggregate packages are broken in prerelease projects because of OBS bug. This causes wrong status reported for all submissions. Change-Id: Iaac19a922a4b5996aff8d7cd277f20ec6868794c Signed-off-by: Ed Bartosh --- diff --git a/repa.1 b/repa.1 index c4e2d58..dadeb4b 100644 --- a/repa.1 +++ b/repa.1 @@ -90,7 +90,7 @@ Turn on colorized output .\" .\" The "list" command description .\" -.SS \fBlist\fR [\-\-help] [\-\-processes ] [\-\-showurls] +.SS \fBlist\fR [\-\-help] [\-\-processes ] [\-\-showurls] [\-\-ignore ] .RS 2 List submissions in the following format: @@ -140,6 +140,12 @@ 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 +.B \-\-ignore +.RS 2 +Ignore packaging failures for specified regexp. is a slash-separated string //, for example arm.*/armv7./.*_aggregate. +Note, that this parameter can also be specified in \fIrepa\fR configuration file. +.RE .PP .\" @@ -380,6 +386,9 @@ color = off .RS 2 showurls = off .RE +.RS 2 +ignore = arm-.*/armv7./.*_aggregate$ +.RE .RS 2 @@ -387,7 +396,7 @@ Mandatory options: apiurl, apiuser, apipasswd and project .RE .RS 2 -Some options (project, processes, colorize, showurls) can be overridden by commandline options (--project, --processes, --colorize, --showurls) +Some options (project, processes, colorize, showurls, ignore) can be overridden by commandline options (--project, --processes, --colorize, --showurls, --ignore) .RE .SH BUGS diff --git a/repa/list.py b/repa/list.py index 28f602d..654672e 100755 --- a/repa/list.py +++ b/repa/list.py @@ -31,21 +31,26 @@ Get list of submissions. import sys import json +import re 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 -def get_status(meta, colorizer, build_results=None): +def get_status(meta, colorizer, build_results=None, ignore=''): """Get overall status by analyzing package and image build status.""" if build_results: codes = set() - for target in build_results.itervalues(): + pkgstatus = {} + for (repo, arch), target in build_results.iteritems(): codes.add(target.get('code')) codes.add(target.get('state')) for pkginfo in target['packages']: - codes.add(pkginfo[1]) + # ignore packages if they match ignore regexp + if not (ignore and re.match(ignore, "%s/%s/%s" % \ + (repo, arch, pkginfo[0]))): + codes.add(pkginfo[1]) statuses = [('broken', ('red', 'broken source')), ('unresolvable', ('red', 'unresolvable packages')), @@ -81,7 +86,7 @@ def show_urls(meta): def list_submissions(obs, target, processes, is_colorize=False, - showurls=False): + showurls=False, ignore=''): """List submissions and groups.""" colorizer = Colorizer(is_colorize) # submissions @@ -95,7 +100,8 @@ def list_submissions(obs, target, processes, is_colorize=False, continue projects = [project.split('/')[-1] for project in meta['projects']] print '%-37s %-37s %s' % (meta['git_tag'], \ - get_status(meta, colorizer, build_results), ','.join(projects)) + get_status(meta, colorizer, build_results, ignore), + ','.join(projects)) if showurls: show_urls(meta) @@ -127,13 +133,15 @@ class List(object): parser.add_argument('--showurls', action='store_true', help='show OBS and download urls', default=config.get('showurls', '').lower() == 'on') + parser.add_argument('--ignore', default=config.get('ignore', ''), + help='ignore package failures by regexp') @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.showurls) + argv.colorize, argv.showurls, argv.ignore) if __name__ == '__main__':