diff options
-rw-r--r-- | utils/agljobtemplate.py | 9 | ||||
-rwxr-xr-x | utils/job-prereq.py | 10 |
2 files changed, 14 insertions, 5 deletions
diff --git a/utils/agljobtemplate.py b/utils/agljobtemplate.py index e79db41..0dcafb5 100644 --- a/utils/agljobtemplate.py +++ b/utils/agljobtemplate.py @@ -50,6 +50,7 @@ class Agljobtemplate(object): DEFAULT_PATH = "templates" CALLBACK_DIR = "callback" MACHINES_DIR = "machines" + MACHINES_BRANCH_DIR = "machines-branch" TESTS_DIR = "tests" RFS_TYPE = ['nbd', 'ramdisk'] @@ -207,6 +208,12 @@ class Agljobtemplate(object): env = jinja2.Environment(loader=jinja2.FileSystemLoader(self._template_path)) env.filters['get_extension'] = get_extension - template = env.get_template(os.path.join(self.MACHINES_DIR, machine + ".jinja2")) + + machine_branch = machine + '-' + vcs_branch + '.jinja2' + + if machine_branch in os.listdir(os.path.join(self._template_path, self.MACHINES_DIR, self.MACHINES_BRANCH_DIR)): + template = env.get_template(os.path.join(self.MACHINES_DIR, self.MACHINES_BRANCH_DIR, machine_branch)) + else: + template = env.get_template(os.path.join(self.MACHINES_DIR, machine + ".jinja2")) return template.render(job) diff --git a/utils/job-prereq.py b/utils/job-prereq.py index 1beec81..5ea745b 100755 --- a/utils/job-prereq.py +++ b/utils/job-prereq.py @@ -41,6 +41,8 @@ def parse_cmdline(machines): nargs=3, help="The type of build. It defines the URL to upload to.", required=True) + parser.add_argument('--branch', dest='vcs_branch', action='store', default='master', + help='The build branch.') args = parser.parse_args() return args @@ -54,12 +56,12 @@ def main(): job = ajt.render_job(build_type=args.build_type[0], changeid=args.build_type[1], patchset=args.build_type[2], - machine=args.machine) + machine=args.machine, vcs_branch=args.vcs_branch) else: job = ajt.render_job(build_type=args.build_type[0], - vcs_branch=args.build_type[1], - version=args.build_type[2], - machine=args.machine) + vcs_branch=args.vcs_branch, + version=args.build_type[2], + machine=args.machine) job_yaml = yaml.load(job) if args.machine == "qemux86-64": |