1.Not perform gbs dashboard build for arch which is specified as 'disable' in meta... 02/171402/1
authorSoonKyu Park <sk7.park@samsung.com>
Fri, 2 Mar 2018 10:59:53 +0000 (19:59 +0900)
committerSoonKyu Park <sk7.park@samsung.com>
Fri, 2 Mar 2018 10:59:53 +0000 (19:59 +0900)
2.Remove old build results in gbsdbbuild live repo

Change-Id: I7522050f78fcb13bbc93799c88991d9cf762baca

common/gbsutils.py
job_gbsdbbuild_create_snapshot.py

index b1cf688..2b9f6f9 100644 (file)
@@ -138,9 +138,14 @@ class GBSBuild:
         repository = []
         arch_list= {}
         path_prj_list= {}
+        disable_repo_arch = []
         obs_meta_file = prjdir + '/' + obs_prj + '/_meta'
         lines = open(obs_meta_file).readlines()
         for line in lines:
+            if line.find('<disable arch=') != -1:
+                disable_repo=line.split('repository="')[1].split('"')[0]
+                disable_arch=line.split('arch="')[1].split('"')[0]
+                disable_repo_arch.append(disable_repo+"##"+disable_arch)
             if line.find('repository name=') != -1:
                 repo_tmp=line.split('"')[1]
                 repository.append(repo_tmp)
@@ -148,7 +153,8 @@ class GBSBuild:
                 path_prj_list[repo_tmp] = []
             if line.find('<arch>') != -1:
                 arch_tmp = line.split("<arch>")[1].split("</arch>")[0]
-                arch_list[repo_tmp].append(arch_tmp)
+                if repo_tmp+"##"+arch_tmp not in disable_repo_arch:
+                    arch_list[repo_tmp].append(arch_tmp)
             if line.find('path project=') != -1:
                 path_prj_arch = line.split('"')[1]+'##'+line.split('"')[3]
                 path_prj_list[repo_tmp].append(path_prj_arch)
@@ -460,7 +466,7 @@ class GBSBuild:
 
         profile_list=os.listdir(self.build_root+'/local/repos/')
         for profile in profile_list:
-            if profile.find(repo) != -1:
+            if profile.find(repo.replace('-','_')) != -1:
                 profile_path=profile
 
         index_file=self.build_root+'/local/repos/'+profile_path+'/'+arch+'/index.html'
index 06398e3..045b63b 100755 (executable)
@@ -319,6 +319,20 @@ def main():
     redis_port = int(os.getenv("REDIS_PORT"))
     backenddb = BackendDB(redis_host, redis_port)
 
+    #clear live root except current build_id results
+    build_id_liverepo = live_repo_base
+    for subdir in project.split(':'):
+        if subdir != project.split(':')[-1]:
+            build_id_liverepo=os.path.join(build_id_liverepo,subdir+':')
+        else:
+            build_id_liverepo=os.path.join(build_id_liverepo,subdir)
+    print "build_id_liverepo = %s" %build_id_liverepo
+    cmd = 'rm -rf `find '+build_id_liverepo+\
+          ' ! -name '+os.path.basename(build_id_liverepo)+\
+          ' | grep -v '+gbsbuild_dic['gbsbuild_tag'].split('/')[1]+'`'
+    print "clear live root command: %s" %cmd
+    subprocess.call(cmd, stdout=sys.stdout,stderr=sys.stderr, shell=True)
+
     if buildmonitor_enabled:
         gbs_update_data = {"tag" : gbsbuild_dic['gbsbuild_tag'],
                            "mode" : "snapshot_started"}