Added target project to the group project name
authorEd Bartosh <eduard.bartosh@intel.com>
Mon, 19 Aug 2013 16:01:25 +0000 (19:01 +0300)
committerEduard Bartosh <eduard.bartosh@intel.com>
Mon, 19 Aug 2013 16:18:27 +0000 (09:18 -0700)
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 <eduard.bartosh@intel.com>
Reviewed-on: https://otctools.jf.intel.com/review/5994
Tested-by: OTC Tools Tester <ed.bartosh@linux.intel.com>
repa/common.py
repa/group.py
setup.py [changed mode: 0644->0755]

index 9384839..ff84a7f 100644 (file)
@@ -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)
index 95b71e8..83a017a 100755 (executable)
@@ -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()
old mode 100644 (file)
new mode 100755 (executable)