Fix create link packages for target project 98/165698/2
authorYonghee Han <onstudy@samsung.com>
Wed, 3 Jan 2018 08:33:41 +0000 (17:33 +0900)
committerYonghee Han <onstudy@samsung.com>
Wed, 10 Jan 2018 05:08:40 +0000 (14:08 +0900)
Fix keyerror in create obs project
Change-Id: I8883197691ac8a1d6dfe5b10c5a10def453d3ba2

job_ref_create_prj_obs.py

index 02a25cf..ae05ddb 100644 (file)
@@ -454,9 +454,10 @@ class ref_create_project_obs(object):
                         print 'Trying to delete %s/%s' % (target, package)
                         sys.stdout.flush()
                         build.delete_package(target, package)
-                    build.create_link_pac(target, link_pkg, \
-                                           target, package)
-                    print '  [_link] %s/%s -> %s/%s' % (target, link_pkg, target, package)
+                    if link_pkg in build.get_package_list(target):
+                        build.create_link_pac(target, link_pkg, \
+                                               target, package)
+                        print '  [_link] %s/%s -> %s/%s' % (target, link_pkg, target, package)
 
     def compare_with_manifest(self, todo_dict, manifest_packages):
         #TODO: If we have changed git path???
@@ -987,7 +988,7 @@ class ref_create_project_obs(object):
         if os.getenv('SR_SYNC_PROJECTS'):
             enabled_projects = ast.literal_eval(os.getenv('SR_SYNC_PROJECTS'))
             count = 0
-            for project in enabled_projects[profile]:
+            for project in enabled_projects.get(profile):
                 print project
                 if project.get('obs-sync') == 'Yes':
                     data={}
@@ -1177,7 +1178,8 @@ class ref_create_project_obs(object):
         print "  0) Get meta, config, package list from remote [ %s ]" % (profile)
         remote_meta = remote_build.get_meta(profile)
         config = remote_build.get_project_config(profile)
-        remote_package_list = [ p for p in remote_build.get_sourceinfo_list(profile) ]
+        sourceinfo = remote_build.get_sourceinfo_list(profile)
+        remote_package_list = [ p for p in sourceinfo if len(sourceinfo[p]) == 0 ]
         print '\nGet Package List from Remote Done at %s' % (str(datetime.now()))
         if 'patchinfo' in remote_package_list:
             remote_package_list.remove('patchinfo')