X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=scripts%2Fjjblib.py;h=50c5643702b4dec092f8b268d73cd58154d30964;hb=f5fc4ea1ae6ce8192360841d7a7c87034416baf5;hp=46a6ddbb422e2b3e34d0e263b434fff72658559b;hpb=541fe21ac06b109f292dae97c2b22caba72d0909;p=releng%2Fbuilder.git diff --git a/scripts/jjblib.py b/scripts/jjblib.py index 46a6ddbb4..50c564370 100644 --- a/scripts/jjblib.py +++ b/scripts/jjblib.py @@ -1,4 +1,5 @@ import argparse +import collections import os import yaml @@ -17,8 +18,8 @@ def parse_jjb_args(): "job is built successfully.\n\n" "Example: aaa,controller,yangtools")) parser.add_argument("-t", "--templates", help="Job templates to use") - parser.add_argument("-b", "--branches", help="Git Branches to build") - parser.add_argument("-j", "--jdks", help="JDKs to build against (for verify jobs)") # noqa + parser.add_argument("-s", "--streams", + help="Release streams to fill with default options") parser.add_argument("-p", "--pom", help="Path to pom.xml to use in Maven " "build (Default: pom.xml") parser.add_argument("-g", "--mvn-goals", help="Maven Goals") @@ -27,28 +28,41 @@ def parse_jjb_args(): help="Comma-seperated list of patterns of artifacts " "to archive on build completion. " "See: http://ant.apache.org/manual/Types/fileset.html") # noqa - parser.add_argument("-z", "--no-cfg", action="store_true", - help=("Disable initializing the project.cfg file.")) return parser.parse_args() +STREAM_DEFAULTS = collections.OrderedDict([ + ("boron", {"branch": "master", "jdks": "openjdk8"}), + ("beryllium", {"branch": "stable/beryllium", "jdks": "openjdk8"}), + ("stable-lithium", {"branch": "stable/lithium", "jdks": "openjdk7"}), + ("stable-helium", {"branch": "stable/helium", "jdks": "openjdk7"}), +]) + + def create_template_config(project_dir, args): cfg_data = dict() if args.templates: cfg_data["JOB_TEMPLATES"] = args.templates - if args.branches: - cfg_data["BRANCHES"] = args.branches - if args.jdks: - cfg_data["JDKS"] = args.jdks + + if args.streams: + stream_list = list() + for stream in args.streams.split(","): + stream_list.append({stream: STREAM_DEFAULTS[stream]}) + cfg_data["STREAMS"] = stream_list + if args.pom: cfg_data["POM"] = args.pom + if args.mvn_goals: cfg_data["MAVEN_GOALS"] = args.mvn_goals + if args.mvn_opts: cfg_data["MAVEN_OPTS"] = args.mvn_opts + if args.dependencies: cfg_data["DEPENDENCIES"] = args.dependencies + if args.archive_artifacts: cfg_data["ARCHIVE"] = args.archive_artifacts @@ -62,3 +76,26 @@ def create_template_config(project_dir, args): with open(cfg_file, "w") as outstream: outstream.write(yaml.dump(cfg_data, default_flow_style=False)) + + +class Project: + """Represents a Gerrit Project + + Attributes: + path(str): The full Gerrit path to a project + meta_project(str): The top-level project name in Gerrit + project(str): The subproject name or project shortname + """ + + def __init__(self, project): + self.path = project + self.meta_project = None + self.project = project + + if project.find('/') >= 0: + s = project.rsplit('/', 1) + self.meta_project = s[0] + self.project = s[1] + + def __str__(self): + return self.project