From c3bf525c9af00c9d7154d761ca391d3a9c709a1e Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Mon, 19 Aug 2013 19:01:25 +0300 Subject: [PATCH] Added target project to the group project name For other pieces of the workflow and for the sake of consistency it's better to have the same naming scheme for projects and groups. Change-Id: I86621486220c10b2c021e639508a09e8ab953401 Signed-off-by: Ed Bartosh Reviewed-on: https://otctools.jf.intel.com/review/5994 Tested-by: OTC Tools Tester --- repa/common.py | 11 +++-------- repa/group.py | 2 +- setup.py | 0 3 files changed, 4 insertions(+), 9 deletions(-) mode change 100644 => 100755 setup.py diff --git a/repa/common.py b/repa/common.py index 9384839..ff84a7f 100644 --- a/repa/common.py +++ b/repa/common.py @@ -21,13 +21,8 @@ class RepaException(Exception): def get_project_by_name(obs, name): """Lookup for a project in OBS by submission or group name.""" - if name.startswith("submitgroup"): - mask = '^%s%s$' - else: - mask = '^%s.*:%s$' - - projects = list(obs.get_projects(mask % (OBS_PREFIX, - name.replace('/', ':')))) + projects = list(obs.get_projects('^%s.*:%s$' % (OBS_PREFIX, + name.replace('/', ':')))) if not projects: raise RepaException('OBS project not found for %s' % name) if len(projects) > 1: @@ -36,7 +31,6 @@ def get_project_by_name(obs, name): return projects[0][0], json.loads(projects[0][1]) - def _resolve_submissions(obs, name): """Get list of submissions with meta. Resolves submitgroups.""" project, meta = get_project_by_name(obs, name) @@ -71,6 +65,7 @@ def accept_or_reject(obs, submission, state, comment=''): # and immediately set its state obs.set_sr_state(reqid, state=state, message=message, force=True) print 'set SR state to', state + # delete submit group if submission.startswith('submitgroup'): delete_project(obs, submission) diff --git a/repa/group.py b/repa/group.py index 95b71e8..83a017a 100755 --- a/repa/group.py +++ b/repa/group.py @@ -74,7 +74,7 @@ def create_group_project(obs, submissions, meta, comment): timestamp) gmeta = {'name': name, 'obs_target_prj': target_prj, 'submissions': submissions, 'comment': comment} - project = '%s%s' % (OBS_PREFIX, name.replace('/', ':')) + project = '%s%s:%s' % (OBS_PREFIX, str(target_prj), name.replace('/', ':')) saved = sys.stdout sys.stdout = StringIO() diff --git a/setup.py b/setup.py old mode 100644 new mode 100755 -- 2.7.4