import re
import os
import sys
-import shutil
+import shutil
import subprocess
from common.buildtrigger import trigger_info
pass
def create_build_progress_dep_graph(build, obs_project, content):
- sync_out_dir = os.path.join(os.getenv('WORKSPACE'), 'outdir')
+ 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_parent = os.path.join(os.getenv('IMG_SYNC_DEST_BASE'),
+ sync_dest = os.path.join(sync_dest_base,
".dep_graph",
obs_project)
- sync_dest = os.path.join(sync_dest_parent,
- content.get("build_project_id"))
print "sync_dest = %s" % sync_dest
#make directories if not existed.
os.makedirs(sync_out_dir)
- sync(sync_out_dir, os.path.join(os.getenv('IMG_SYNC_DEST_BASE'),
- ".dep_graph"))
-
- sync(sync_out_dir, os.path.join(os.getenv('IMG_SYNC_DEST_BASE'),
- ".dep_graph", obs_project))
-
- sync(sync_out_dir, os.path.join(os.getenv('IMG_SYNC_DEST_BASE'),
- ".dep_graph", obs_project,
- content.get("build_project_id")))
# copy vis and dep_graph dirs.
- vis_dir = os.path.join(os.getenv("WORKSPACE"), "jenkins-scripts/vis")
- vis_sync_dest = os.path.join(os.getenv('IMG_SYNC_DEST_BASE'),
- ".dep_graph/vis")
- sync(vis_dir, vis_sync_dest)
+ vis_sync_dest = os.path.join(sync_dest_base, ".dep_graph/vis")
+ if not os.path.exists(vis_sync_dest):
+ vis_dir = os.path.join(os.getenv("WORKSPACE"), "jenkins-scripts/vis")
+ sync(vis_dir, vis_sync_dest)
- dep_graph_dir = os.path.join(os.getenv("WORKSPACE"), "jenkins-scripts/dep_graph")
- dep_graph_sync_dest = os.path.join(os.getenv('IMG_SYNC_DEST_BASE'),
- ".dep_graph/dep_graph")
- sync(dep_graph_dir, dep_graph_sync_dest)
+ dep_graph_sync_dest = os.path.join(sync_dest_base, ".dep_graph/dep_graph")
+ if not os.path.exists(dep_graph_sync_dest):
+ dep_graph_dir = os.path.join(os.getenv("WORKSPACE"), "jenkins-scripts/dep_graph")
+ sync(dep_graph_dir, dep_graph_sync_dest)
vis_dir = "../../../../vis"
dep_graph_dir = "../../../../dep_graph"
os.getenv("OBS_API_USERNAME"),
os.getenv("OBS_API_PASSWD"),
obs_project,
- repo,
+ repo,
arch)
set_mysql_environment(os.getenv("BUILDMONITOR_IP"),
os.getenv("BUILDMONITOR_USER"),
os.getenv("BUILDMONITOR_NAME"),
"0")
- make_dep_graph(filename, graph_dest_dir,
+ make_dep_graph(filename, graph_dest_dir,
vis_dir, dep_graph_dir, template_filename,
packages_to_be_built)
# 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 latest link
- latest_parent = os.path.join(sync_out_dir, "link")
- os.makedirs(latest_parent)
- latest = os.path.join(latest_parent, "latest")
+ # make latest link
+ latest = os.path.join(sync_dest, "latest")
+ if os.path.exists(latest):
+ os.unlink(latest)
os.symlink(content.get("build_project_id"), latest)
- sync(latest_parent, sync_dest_parent)
def create_build_progress_dep_graph_post(build, obs_project, backenddb, content):
print "creating build_progress_dep_graph..."
build_id_arr=snapshot.build_id.split('.');
build_id_arr[-1] = str(int(build_id_arr[-1])+1);
new_build_id = '.'.join(build_id_arr)
- sync_dest = os.path.join(os.getenv('IMG_SYNC_DEST_BASE'),
+ sync_dest = os.path.join(repo_base,
snapshot.dir, new_build_id);
print "sync_dest = %s" % sync_dest
# first sync to make just directory.
sync(sync_out_dir, sync_dest)
- graph_root_dir = os.path.join(sync_out_dir, "builddata",
+ graph_root_dir = os.path.join(sync_out_dir, "builddata",
"depends", "build_progress_dep_graph")
print "graph_root_dir = %s" % graph_root_dir
os.getenv("OBS_API_USERNAME"),
os.getenv("OBS_API_PASSWD"),
obs_project,
- repo,
+ repo,
arch)
- make_dep_graph(filename, graph_dest_dir,
+ make_dep_graph(filename, graph_dest_dir,
vis_dir, dep_graph_dir, template_filename)
# sync to donwload server
except SnapshotError, err:
raise LocalError("Error getting prerelease info: %s" % str(err))
- sync_dest = os.path.join(os.getenv('IMG_SYNC_DEST_BASE'),
+ sync_dest = os.path.join(repo_base,
prerelease.path, prerelease.build_id);
- graph_root_dir = os.path.join(sync_out_dir, "builddata",
+ graph_root_dir = os.path.join(sync_out_dir, "builddata",
"depends", "build_progress_dep_graph")
print "graph_root_dir = %s" % graph_root_dir
print "packages_to_be_built = %s" % packages_to_be_built
os.getenv("OBS_API_USERNAME"),
os.getenv("OBS_API_PASSWD"),
obs_project,
- repo,
+ repo,
arch)
- make_dep_graph(filename, graph_dest_dir,
- vis_dir, dep_graph_dir, template_filename,
+ make_dep_graph(filename, graph_dest_dir,
+ vis_dir, dep_graph_dir, template_filename,
packages_to_be_built)
-
+
# sync to donwload server
sync(sync_out_dir, sync_dest)
def create_build_dep_graph(build, obs_project, backenddb, content):
sync_out_dir = os.path.join(os.getenv('WORKSPACE'),
- 'outdir')
+ 'dep_graph')
- sync_dest = os.path.join(os.getenv('IMG_SYNC_DEST_BASE'),
- content['repo_path'])
+ sync_dest = os.path.join(os.getenv('PATH_REPO_BASE'),
+ content['repo_path'],
+ "build_data",
+ "depends")
+ print "sync_dest = %s" % sync_dest
- os.makedirs(os.path.join(sync_out_dir,'builddata','depends'))
template_filename="jenkins-scripts/common/dep_graph.php.template"
- graph_root_dir=os.path.join(sync_out_dir,'builddata','depends','dep_graph')
+ graph_root_dir=os.path.join(sync_out_dir)
os.makedirs(graph_root_dir)
packages_to_be_built = []
print "packages_to_be_built: ", packages_to_be_built
print "built_packages: ", built_packages
- make_dep_graph(filename, graph_dest_dir,
+ make_dep_graph(filename, graph_dest_dir,
vis_dir, dep_graph_dir, template_filename,
packages_to_be_built, built_packages)
else:
- make_dep_graph(filename, graph_dest_dir,
+ make_dep_graph(filename, graph_dest_dir,
vis_dir, dep_graph_dir, template_filename)
- # sync to donwload server
+ # sync to download server
+ if os.path.exists(sync_dest):
+ shutil.rmtree(sync_dest)
+ os.makedirs(sync_dest)
sync(sync_out_dir, sync_dest)
def main():