BUGFIX : trigger to importrpm 74/136074/3
authorYonghee Han <onstudy@samsung.com>
Wed, 28 Jun 2017 04:10:21 +0000 (13:10 +0900)
committerYonghee Han <onstudy@samsung.com>
Wed, 28 Jun 2017 08:53:33 +0000 (17:53 +0900)
Add a environment variable
  IMPORT_RPM , REPO_PATH, BUILDID

To use : ref-copy-project-obs job
  SRC_PROJECT : Tizen:3.0:Mobile:ref:20170626.1
  DEST_PROJECT : Tizen:3.0:Mobile:smr:20170626.1

remove a project field of data fields.

Change-Id: I25217ebc3339f06038326e28d280ae5a5778b43b

job_ref_create_prj_obs.py
job_ref_import_rpm_obs.py

index 64ac67a..f43ea96 100644 (file)
@@ -666,7 +666,7 @@ class ref_create_project_obs(object):
         src = profile = fields['SRC_PROJECT']
         target = fields['DEST_PROJECT']
         replace_gerrit_url = fields['REPLACE_GERRIT_URL']
-        immport_rpm = fields['IMPORT_RPM']
+        importrpm = fields['IMPORT_RPM']
 
         build_src = build
         print "src = %s , target = %s" %(src, target)
@@ -734,16 +734,20 @@ class ref_create_project_obs(object):
         print "\n********"
         print "  7) Sync Done..."
 
-        self.update_build_flag_project(build, target, flag=True)
-        print "\n********"
-        print "  8) Update build flag=default..."
-
-        if importrpm is not None and importrpm == True:
+        if importrpm is not None and importrpm == "True":
             # importrpm trigger next
-            fields['profile'] = profile
-            fields['target'] = target
-            trigger_next("REF_IMPORT_RPM_OBS", fields)
+            data={}
+            data['profile'] = profile
+            data['target'] = target
+            data['repo_path'] = os.path.join(fields['REPO_PATH'],
+                                             fields['BUILDID'])
+            data['build_id'] = fields['BUILDID']
+            trigger_next("REF_IMPORT_RPM_OBS", data)
             print "  9) trigger_next import rpm .."
+        else:
+            self.update_build_flag_project(build, target, flag=True)
+            print "\n********"
+            print "  8) Update build flag=default..."
 
         if errpackages:
             return 1
@@ -786,6 +790,8 @@ class ref_create_project_obs(object):
                                   'DEST_PROJECT': os.getenv('DEST_PROJECT'),
                                   'REPLACE_GERRIT_URL': os.getenv('REPLACE_GERRIT_URL'),
                                   'IMPORT_RPM': os.getenv('IMPORT_RPM'),
+                                  'REPO_PATH': os.getenv('REPO_PATH'),
+                                  'BUILDID': os.getenv('BUILDID'),
                                  }
                     else:
                         fields = trigger_info(os.getenv('TRIGGER_INFO'))
index 42d7de1..f38b155 100644 (file)
@@ -198,14 +198,14 @@ class ref_import_rpm_obs(object):
         fields = trigger_info(os.getenv("TRIGGER_INFO"))
 
         # Check if we've got required fieldsdk-rootstraps in TRIGGER_INFO
-        for field in ('profile', 'target', 'project', 'build_id', 'repo_path'):
+        for field in ('profile', 'target', 'build_id', 'repo_path'):
             if field not in fields:
                 print 'Error: TRIGGER_INFO doesn\'t contain %s' % field
                 return -1
 
         self.profile = self.setup_profile(fields['profile'], fields['target'])
         if not self.profile:
-            print 'Skip Sync OBS project %s' % fields['project']
+            print 'Skip Sync OBS project %s' % fields['target']
             return 0
 
         buildid = fields['build_id'].split('_')[1]