BUGFIX: previous repo/arch should not be removed.
authorJunghyun Kim <jh0822.kim@samsung.com>
Tue, 24 Jan 2017 10:52:57 +0000 (19:52 +0900)
committerSoonKyu Park <sk7.park@samsung.com>
Sat, 4 Feb 2017 06:16:25 +0000 (15:16 +0900)
PROBLEM:
- Due to rmtree(sync_dest), previous depepenency graphs are removed.

SOLUTION:
- sync_dest is set to only that repo/arch.
- only target repo/arch directory is removed now.

Change-Id: I67050a53c7e4cb4d8c46889e1d784b7fd0b72417
Signed-off-by: Junghyun Kim <jh0822.kim@samsung.com>
job_make_dep_graph.py

index 719e02d..8513a09 100644 (file)
@@ -36,21 +36,8 @@ class LocalError(Exception):
     pass
 
 def create_build_progress_dep_graph(build, obs_project, content):
-    bp_id = content.get("build_project_id")
-    sync_out_dir = os.path.join(os.getenv('WORKSPACE'), bp_id)
     sync_dest_base = os.getenv('PATH_REPO_BASE')
 
-    sync_dest = os.path.join(sync_dest_base,
-                             ".dep_graph",
-                             obs_project)
-
-    print "sync_dest = %s" % sync_dest
-
-    graph_root_dir = os.path.join(sync_out_dir)
-    print "graph_root_dir = %s" % graph_root_dir
-
-    #make directories if not existed.
-    os.makedirs(sync_out_dir)
 
     # copy vis and dep_graph dirs.
     vis_sync_dest = os.path.join(sync_dest_base, ".dep_graph/vis")
@@ -70,16 +57,18 @@ def create_build_progress_dep_graph(build, obs_project, content):
     repo = content.get("repo")
     arch = content.get("arch")
 
+    graph_root_dir = os.path.join(os.getenv('WORKSPACE'), arch)
+    #make directories if not existed.
+    os.makedirs(graph_root_dir)
+    print "graph_root_dir = %s" % graph_root_dir
+
     packages_to_be_built = [];
     if re.match("^home:prerelease:", obs_project) or re.match("^home:trbs:", obs_project):
       info=build.get_info(obs_project)
       packages_to_be_built = info['packages']
 
     xml = build.get_dependson(obs_project, repo, arch, None, None)
-    graph_dest_dir = os.path.join(graph_root_dir, repo, arch)
-    if not os.path.exists(graph_dest_dir):
-        os.makedirs(graph_dest_dir)
-    filename = os.path.join(graph_root_dir, repo, arch, "builddepinfo.xml")
+    filename = os.path.join(graph_root_dir, "builddepinfo.xml")
     with open(filename, 'w') as xml_file:
         xml_file.write(xml)
 
@@ -95,15 +84,23 @@ def create_build_progress_dep_graph(build, obs_project, content):
         os.getenv("BUILDMONITOR_NAME"),
         "0")
 
-    make_dep_graph(filename, graph_dest_dir,
+    make_dep_graph(filename, graph_root_dir,
                    vis_dir, dep_graph_dir, template_filename,
                    packages_to_be_built)
 
+    sync_dest = os.path.join(sync_dest_base,
+                             ".dep_graph",
+                             obs_project,
+                             content.get("build_project_id"),
+                             repo)
+
+    print "sync_dest = %s" % sync_dest
+
     # sync to donwload server
     if os.path.exists(sync_dest):
         shutil.rmtree(sync_dest)
     os.makedirs(sync_dest)
-    sync(sync_out_dir, sync_dest)
+    sync(graph_root_dir, sync_dest)
 
     # make latest link
     latest = os.path.join(sync_dest, "latest")
@@ -285,7 +282,7 @@ def create_build_dep_graph(build, obs_project, backenddb, content):
 
     sync_dest = os.path.join(os.getenv('PATH_REPO_BASE'),
                              content['repo_path'],
-                             "build_data",
+                             "builddata",
                              "depends")
     print "sync_dest = %s" % sync_dest