3 # @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
4 ##############################################################################
5 # Copyright (c) 2014 The Linux Foundation and others.
7 # All rights reserved. This program and the accompanying materials
8 # are made available under the terms of the Eclipse Public License v1.0
9 # which accompanies this distribution, and is available at
10 # http://www.eclipse.org/legal/epl-v10.html
13 # Thanh Ha (The Linux Foundation) - Initial implementation
14 ##############################################################################
19 def get_autoupdate_projects(jjb_dir, projects):
20 """Get list of projects that should be auto-updated."""
22 for project in projects:
23 template = os.path.join(jjb_dir, project, "%s.yaml" % project)
24 if os.path.isfile(template):
25 with open(template, 'r') as f:
26 first_line = f.readline()
27 if first_line.startswith("# REMOVE THIS LINE IF"):
28 project_list.append(project)
33 def update_templates(projects):
34 for project in projects:
35 cfg_file = "jjb/%s/%s.cfg" % (project, project)
36 os.system("python scripts/jjb-init-project.py %s -c %s" %
44 all_projects = [d for d in os.listdir(jjb_dir)
45 if os.path.isdir(os.path.join(jjb_dir, d))]
46 auto_update_projects = get_autoupdate_projects(jjb_dir, all_projects)
47 update_templates(auto_update_projects)