• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2
3from jinja2 import Environment, FileSystemLoader
4import argparse
5import os
6import datetime
7
8parser = argparse.ArgumentParser()
9parser.add_argument("--template")
10parser.add_argument("--pipeline-info")
11parser.add_argument("--base-artifacts-url")
12parser.add_argument("--mesa-url")
13parser.add_argument("--device-type")
14parser.add_argument("--dtb", nargs='?', default="")
15parser.add_argument("--kernel-image-name")
16parser.add_argument("--kernel-image-type", nargs='?', default="")
17parser.add_argument("--gpu-version")
18parser.add_argument("--boot-method")
19parser.add_argument("--lava-tags", nargs='?', default="")
20parser.add_argument("--env-vars", nargs='?', default="")
21parser.add_argument("--deqp-version")
22parser.add_argument("--ci-node-index")
23parser.add_argument("--ci-node-total")
24parser.add_argument("--job-type")
25args = parser.parse_args()
26
27env = Environment(loader = FileSystemLoader(os.path.dirname(args.template)), trim_blocks=True, lstrip_blocks=True)
28template = env.get_template(os.path.basename(args.template))
29
30env_vars = "%s CI_NODE_INDEX=%s CI_NODE_TOTAL=%s" % (args.env_vars, args.ci_node_index, args.ci_node_total)
31
32values = {}
33values['pipeline_info'] = args.pipeline_info
34values['base_artifacts_url'] = args.base_artifacts_url
35values['mesa_url'] = args.mesa_url
36values['device_type'] = args.device_type
37values['dtb'] = args.dtb
38values['kernel_image_name'] = args.kernel_image_name
39values['kernel_image_type'] = args.kernel_image_type
40values['gpu_version'] = args.gpu_version
41values['boot_method'] = args.boot_method
42values['tags'] = args.lava_tags
43values['env_vars'] = env_vars
44values['deqp_version'] = args.deqp_version
45
46f = open(os.path.splitext(os.path.basename(args.template))[0], "w")
47f.write(template.render(values))
48f.close()
49
50