Add profile info into accept tag name
authorLin Yang <lin.a.yang@intel.com>
Tue, 10 Dec 2013 12:00:33 +0000 (20:00 +0800)
committerLin Yang <lin.a.yang@intel.com>
Tue, 10 Dec 2013 12:00:33 +0000 (20:00 +0800)
Change accept tag name format to accept/{OBS_PRJ_NAME}/{DATE.TIME} to insert
profile info.

Fixes: #1511

Change-Id: I1d1e5087e3966e4ec52b804c631037c7cfef8093
Signed-off-by: Lin Yang <lin.a.yang@intel.com>
job_request.py

index f893c9a..7707c03 100755 (executable)
@@ -168,17 +168,11 @@ def request_accepted(data, gerrit, gitprj):
         if 'no such patch set' not in str(err):
             return 1
 
-    tag = data['GIT_TAG'].lower()
-
-    try:
-        target_version = tag.split('/')[1]
-    except(AttributeError, IndexError):
-        target_version = 'unknown'
-
+    obs_target = data['OBS_REQ_PRJ'].lower().replace(':', '/')
     timestamp = datetime.datetime.utcnow().strftime("%Y%m%d.%H%M%S")
 
     # use os.path.join() to avoid '//', which is invalid as tag name
-    accepted_tag = os.path.join('accepted', target_version, timestamp)
+    accepted_tag = os.path.join('accepted', obs_target, timestamp)
 
     gitprj.create_tag(accepted_tag, message, data['commitid'])
 
@@ -192,7 +186,7 @@ def request_accepted(data, gerrit, gitprj):
 
     # push accepted commit to specific hierarchy refs/heads/accepted/*
     # e.g. Tizen:Mobile should push branch refs/heads/accepted/tizen/mobile
-    dst = 'refs/heads/accepted/%s' % data['OBS_REQ_PRJ'].lower().replace(':', '/')
+    dst = 'refs/heads/accepted/%s' % obs_target
     try:
         gitprj.push(remote, data['commitid'], dst, force=True)
     except GitRepositoryError, gre: