diff options
Diffstat (limited to 'repa/list.py')
-rwxr-xr-x | repa/list.py | 20 |
1 files changed, 14 insertions, 6 deletions
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__': |