diff options
author | Ed Bartosh <eduard.bartosh@intel.com> | 2014-03-18 20:45:05 +0200 |
---|---|---|
committer | Ed Bartosh <eduard.bartosh@intel.com> | 2014-03-19 20:16:35 +0200 |
commit | 05b7484770e6502aacc639309825b288d0583fb5 (patch) | |
tree | e2723f39370aaabec090e11bf6d42a29a2603377 | |
parent | cce26e04aedbf14d69e6e8a633206070f11df667 (diff) | |
download | repa-05b7484770e6502aacc639309825b288d0583fb5.tar.gz repa-05b7484770e6502aacc639309825b288d0583fb5.tar.bz2 repa-05b7484770e6502aacc639309825b288d0583fb5.zip |
Added --force option for repa group
By default repa now checks if binary packages exist in submission and
doesn't allow grouping submissions without binary packages.
--force option allows to bypass this check, i.e. allows to group failed
submissions. This can be useful for grouping failed submissions to
reject them as a group.
Fixes: #1707
Change-Id: Ieb66718839e19b63de5039757a2bbc63d02016c6
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
-rw-r--r-- | repa.1 | 6 | ||||
-rwxr-xr-x | repa/group.py | 22 |
2 files changed, 20 insertions, 8 deletions
@@ -220,6 +220,12 @@ Target project name. Mandatory option. Add comment to created submit group. It will be shown by list command. .RE +.PP +\-f, \-\-force +.RS 2 +Force group creation for submissions without binary packages. Useful when grouping failed submissions for rejection. +.RE + .\" .\" The "rmgroup" command description .\" diff --git a/repa/group.py b/repa/group.py index fd8669b..aede33c 100755 --- a/repa/group.py +++ b/repa/group.py @@ -64,16 +64,20 @@ def check_build_results(bresults): # target project: for pkg, status in res['packages'] ... -def check_common_pkgs(obs, submissions): - """Check if submissions have common packages""" +def check_binary_pkgs(obs, submissions, force=False): + """ + Check if submissions have common binary packages. + Check if binary packages exist. + """ binaries = {} for submission, data in submissions.iteritems(): pkgs = list(obs.get_binary_packages(data['project'])) # check if submission has binary packages for repo, bins in pkgs: - #if not bins: - # raise RepaException('No binary packages found in %s %s/%s' % \ - # (submission, repo[0], repo[1])) + # Check if binary packages exist + if not force and not bins: + raise RepaException('No binary packages found in %s %s/%s' % \ + (submission, repo[0], repo[1])) # check if submissions have common packages for subm, info in binaries.iteritems(): if repo == info['repo']: @@ -118,7 +122,7 @@ def aggregate(obs, bresults, gproject): return aggregated -def group_submissions(obs, submissions, target, comment): +def group_submissions(obs, submissions, target, comment, force=False): """Group multiple submissions into one group.""" # find correspondent prerelease projects info = {} @@ -133,7 +137,7 @@ def group_submissions(obs, submissions, target, comment): for subm, data in info.iteritems()] check_build_results(bresults) - check_common_pkgs(obs, info) + check_binary_pkgs(obs, info, force) # create group project name, gproject = create_group_project(obs, info.keys(), @@ -161,13 +165,15 @@ class Group(object): parser.add_argument('-p', '--project', help='target project', required=True) parser.add_argument('-c', '--comment', help='comment', default='') + parser.add_argument('-f', '--force', help='force group creation', + default=False) @staticmethod def run(argv): """Command line entry point. Called from [sub_]main.""" obs = OBS(argv.apiurl, argv.apiuser, argv.apipasswd) return group_submissions(obs, argv.submission, argv.project, - argv.comment) + argv.comment, argv.force) if __name__ == '__main__': |