From 2a379506c2153e954cf8d80fa529d36bbcad813a Mon Sep 17 00:00:00 2001 From: Khouloud Touil Date: Mon, 18 Feb 2019 10:45:58 +0100 Subject: Separate --branch/--changeid --version/--patchset This patch separates the --branch/--changeid and --version/--patchset arguments to use each one of them differently. As well it renames url_branch to changeid and url_version patchset. It modifies also the error check to follow the other changes and be sure that the needed arguments are well inserted. Change-Id: If64ae3620b1519fc391e79d954247938cffcb491 Signed-off-by: Khouloud Touil --- utils/agljobtemplate.py | 4 ++-- utils/create-jobs.py | 26 +++++++++++++++++--------- 2 files changed, 19 insertions(+), 11 deletions(-) (limited to 'utils') diff --git a/utils/agljobtemplate.py b/utils/agljobtemplate.py index 09944ff..33aea31 100644 --- a/utils/agljobtemplate.py +++ b/utils/agljobtemplate.py @@ -85,7 +85,7 @@ class Agljobtemplate(object): def rfs_types(self): return self.RFS_TYPE - def render_job(self, machine, url=None, url_branch=None, url_version=None, + def render_job(self, machine, url=None, changeid=None, patchset=None, version=None, job_name="AGL-short-smoke", priority="medium", tests=[], rfs_type=None, lava_callback=None, kci_callback=None, rfs_image=None, kernel_image=None, dtb_image=None, modules_image=None, @@ -119,7 +119,7 @@ class Agljobtemplate(object): url_fragment = '' if (build_type != 'default'): - url_fragment += url_branch + '/' + url_version + '/' + url_fragment += changeid + '/' + patchset + '/' if (machine == 'm3ulcb') or (machine == 'porter'): url_fragment += machine + '-nogfx' diff --git a/utils/create-jobs.py b/utils/create-jobs.py index 2a16ff3..cac7a9c 100755 --- a/utils/create-jobs.py +++ b/utils/create-jobs.py @@ -21,10 +21,14 @@ def parse_cmdline(machines, tests, rfs_types): parser.add_argument('--build-type', dest='build_type', action='store', help="The type of build, can be one of: {'ci', 'daily', 'weekly', 'release'}.", default="default") - parser.add_argument('--branch', '--changeid', dest='url_branch', action='store', - help='The build branch (or changeid).') - parser.add_argument('--version', '--patchset', dest='url_version', action='store', - help='The build version (or patchset).') + parser.add_argument('--branch', dest='vcs_branch', action='store', + help='The build branch.') + parser.add_argument('--changeid', dest='changeid', action='store', + help='The build changeid.') + parser.add_argument('--version', dest='version', action='store', + help='') + parser.add_argument('--patchset', dest='patchset', action='store', + help='The build patchset.') parser.add_argument('--boot', action='store', dest='rfs_type', choices=rfs_types, help='select boot type') parser.add_argument('--callback-from', action='store', dest='callback_from', @@ -57,9 +61,13 @@ def parse_cmdline(machines, tests, rfs_types): if args.callback_to and not args.callback_from: parser.error("When using '--callback-to', '--callback-from' is mandatory.") - if (args.build_type is not "default") and (args.url is None): - if (not args.url_branch) or (not args.url_version): - parser.error("when using '--build-type' either '--url' or '--branch' and '--version' arguments needs to be set.") + if (args.build_type == "ci"): + if (not args.changeid) or (not args.patchset): + parser.error("when using '--build-type' '--changeid' and '--patchset' arguments needs to be set.") + + if (args.build_type == "release"): + if (not args.vcs_branch) or (not args.version): + parser.error("when using '--build-type' '--branch' and '--versiom' arguments needs to be set.") return args @@ -70,11 +78,11 @@ def main(): ajt = agljobtemplate.Agljobtemplate(templates_dir) args = parse_cmdline(ajt.machines, ajt.tests, ajt.rfs_types) - job = ajt.render_job(url=args.url, url_branch=args.url_branch, url_version=args.url_version, + job = ajt.render_job(url=args.url, changeid=args.changeid, patchset=args.patchset, machine=args.machine, tests=args.tests, priority=args.priority, rfs_type=args.rfs_type, job_name=args.job_name, lava_callback=args.callback_from, kci_callback=args.callback_to, - rfs_image=args.rootfs_img, + rfs_image=args.rootfs_img, version=args.version, kernel_image=args.kernel_img, dtb_image=args.dtb_img, modules_image=args.modules_img, -- cgit 1.2.3-korg