summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Bartosh <eduard.bartosh@intel.com>2013-08-16 16:06:24 +0300
committerEd Bartosh <eduard.bartosh@intel.com>2013-08-17 12:10:28 +0300
commitf03bb8cbf4eceb6e795b96e8a42ec099d63c8bd0 (patch)
treecbae20e962fcf01a47a51c68b02a23c425cd779d
parentcc1099c156107dc4f647d416964df1207a9f5989 (diff)
downloadrepa-f03bb8cbf4eceb6e795b96e8a42ec099d63c8bd0.tar.gz
repa-f03bb8cbf4eceb6e795b96e8a42ec099d63c8bd0.tar.bz2
repa-f03bb8cbf4eceb6e795b96e8a42ec099d63c8bd0.zip
Reimplemented repa list to match grouping implementation
As grouping is done by creating submitgroup projects repa list now gets list of related groups differently. Previously it was getting it from special 'groups' project. Now it analyses all *:submitgroup:* projects and picks up only groups, related to the listed submissions. Change-Id: I181a4525706ac066fc95941d7ba80a7154105b82 Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
-rwxr-xr-xrepa/list.py40
1 files changed, 15 insertions, 25 deletions
diff --git a/repa/list.py b/repa/list.py
index 7f1f514..2af2ec2 100755
--- a/repa/list.py
+++ b/repa/list.py
@@ -31,42 +31,32 @@ def get_status(obs, project):
return 'packages: ' + status
-def get_groups(obs):
- """Get information about submission groups from home:prerelease:groups."""
- project = OBS_PREFIX + 'groups'
- if not obs.exists(project):
- return {}
- return json.loads(obs.get_description(project))
-
-
def list_submissions(obs, regexp):
"""List submissions and groups."""
# submissions
- related_groups = []
+ submissions = set()
header = True
for project, desc in obs.get_projects('^%s.*%s' % (OBS_PREFIX, regexp)):
+ if ':submitgroup:' in project:
+ continue
meta = json.loads(desc)
+ submissions.add(meta['git_tag'])
if header:
print ':::: Submissions:'
header = False
print meta['git_tag'], meta['obs_target_prj'], \
get_status(obs, project)
- related_groups.extend(meta.get('groups') or [])
-
- # groups
- all_groups = get_groups(obs)
- if not all_groups: # no groups found
- return
- groups = []
- for group in related_groups:
- ginfo = all_groups.get(group)
- if ginfo:
- groups.append(group, ginfo['status'])
- #else: warning: group mentioned in submission, but doesn't exist
- if groups:
- print ':::: Groups:'
- for group in groups:
- print group[0], group[1]
+
+ # Groups, related to selected submissions
+ header = True
+ for project, desc in obs.get_projects('^%ssubmitgroup' % OBS_PREFIX):
+ meta = json.loads(desc)
+ lsub = set(meta['submissions'])
+ if lsub.intersection(submissions):
+ if header:
+ print ':::: Groups:'
+ header = False
+ print meta['name'], ','.join(subm.split('/')[-1] for subm in lsub)
class List(object):