From dffb688815c076fc9cf6456567fbcbae66c0892c Mon Sep 17 00:00:00 2001 From: Philip Marc Schwartz Date: Tue, 30 Aug 2016 08:49:37 -0400 Subject: [PATCH] Add filtering of projects to skip non-buildable This will allow the filtering out of projects to build from the superrepo as installation via deb is not desirable for all. Change-Id: Ifc441c1ca1ccf8237cf64629adf3e166ce054e44 Signed-off-by: Philip Marc Schwartz --- giftwrap/build_spec.py | 8 +++++++- giftwrap/settings.py | 3 ++- giftwrap/shell.py | 4 +++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/giftwrap/build_spec.py b/giftwrap/build_spec.py index c9d6105..2248fc0 100644 --- a/giftwrap/build_spec.py +++ b/giftwrap/build_spec.py @@ -25,7 +25,7 @@ from giftwrap.settings import Settings class BuildSpec(object): def __init__(self, manifest, version, build_type=None, parallel=True, - limit_projects=None): + limit_projects=None, project_filter=None): self._manifest = yaml.load(manifest) self.version = version self.build_type = build_type @@ -38,6 +38,7 @@ class BuildSpec(object): parallel = False manifest_settings['parallel_build'] = parallel self.settings = Settings.factory(manifest_settings) + self.project_filter = project_filter self.projects = self._render_projects(limit_projects) def _render_projects(self, limit_projects): @@ -97,4 +98,9 @@ class BuildSpec(object): projects.append(OpenstackProject.factory(self.settings, project, project_version)) + if self.project_filter: + for project in projects: + if project.name in self.project_filter: + projects.remove(project) + return projects diff --git a/giftwrap/settings.py b/giftwrap/settings.py index 0e18d7c..6df9787 100644 --- a/giftwrap/settings.py +++ b/giftwrap/settings.py @@ -31,7 +31,7 @@ class Settings(object): package_name_format=None, version=None, base_path=None, install_path=None, gerrit_dependencies=True, force_overwrite=False, output_dir=None, include_config=True, - parallel_build=True, constraints=None): + parallel_build=True, constraints=None, project_filter=None): if not version: raise Exception("'version' is a required settings") if constraints is None: @@ -49,6 +49,7 @@ class Settings(object): self.include_config = include_config self.parallel_build = parallel_build self.constraints = constraints + self.project_filter = project_filter @property def package_name_format(self): diff --git a/giftwrap/shell.py b/giftwrap/shell.py index c329302..f653e72 100644 --- a/giftwrap/shell.py +++ b/giftwrap/shell.py @@ -48,7 +48,7 @@ def build(args): manifest = fh.read() buildspec = BuildSpec(manifest, args.version, args.type, args.parallel, - args.projects) + args.projects, args.project_filter) builder = BuilderFactory.create_builder(args.type, buildspec) def _signal_handler(*args): @@ -91,6 +91,8 @@ def main(): return arg.split(',') build_subcmd.add_argument('-p', '--projects', type=csvarg, dest='projects') + build_subcmd.add_argument('-f', '--filter', type=csvarg, + dest='project_filter') build_subcmd.set_defaults(func=build) args = parser.parse_args()