summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Bartosh <eduard.bartosh@intel.com>2014-03-18 20:45:05 +0200
committerEduard Bartosh <eduard.bartosh@intel.com>2014-03-19 15:21:46 +0200
commit06e8a7bf2659971d439178b7526c8654a223ef07 (patch)
treee6dcabbf5b8d3424a7acc0d7a58e2dd0c2f9b8f7
parentc01f8686efc7930b290b3c6170e1f921a72ea8b5 (diff)
downloadrepa-06e8a7bf2659971d439178b7526c8654a223ef07.tar.gz
repa-06e8a7bf2659971d439178b7526c8654a223ef07.tar.bz2
repa-06e8a7bf2659971d439178b7526c8654a223ef07.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.16
-rwxr-xr-xrepa/group.py22
2 files changed, 20 insertions, 8 deletions
diff --git a/repa.1 b/repa.1
index 89176ac..d7d522f 100644
--- a/repa.1
+++ b/repa.1
@@ -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__':