From e1a001714440d618e10f40b96425fa9c705c6024 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Wed, 15 Jan 2014 16:17:02 -0400 Subject: [PATCH] Rename to FetchBuilder. --- src/tito/builder/__init__.py | 2 +- src/tito/builder/{externalsrc.py => fetch.py} | 12 +++++------ .../{externalsrc_tests.py => fetch_tests.py} | 19 +++++++++--------- test/functional/multiproject_tests.py | 20 ------------------- 4 files changed, 17 insertions(+), 36 deletions(-) rename src/tito/builder/{externalsrc.py => fetch.py} (95%) rename test/functional/{externalsrc_tests.py => fetch_tests.py} (86%) diff --git a/src/tito/builder/__init__.py b/src/tito/builder/__init__.py index de72b2b..97d1a42 100644 --- a/src/tito/builder/__init__.py +++ b/src/tito/builder/__init__.py @@ -10,4 +10,4 @@ from tito.builder.main import \ MockBuilder, \ BrewDownloadBuilder -from tito.builder.externalsrc import ExternalSourceBuilder +from tito.builder.fetch import FetchBuilder diff --git a/src/tito/builder/externalsrc.py b/src/tito/builder/fetch.py similarity index 95% rename from src/tito/builder/externalsrc.py rename to src/tito/builder/fetch.py index 5dcbb09..978a49e 100644 --- a/src/tito/builder/externalsrc.py +++ b/src/tito/builder/fetch.py @@ -21,7 +21,7 @@ from tito.config_object import ConfigObject from tito.common import error_out, debug, get_spec_version_and_release, \ get_class_by_name -class ExternalSourceBuilder(ConfigObject, BuilderBase): +class FetchBuilder(ConfigObject, BuilderBase): """ A separate Builder class for projects whose source is not in git. Source is fetched via a configurable strategy, which also determines what version @@ -42,12 +42,12 @@ class ExternalSourceBuilder(ConfigObject, BuilderBase): user_config=user_config, args=args, **kwargs) if tag: - error_out("ExternalSourceBuilder does not support building " + error_out("FetchBuilder does not support building " "specific tags.") - if not config.has_option("externalsourcebuilder", - "source_strategy"): - error_out("ExternalSourceBuilder requires [externalsourcebuilder] source_strategy in tito.props.") + if not config.has_option("builder", + "fetch_strategy"): + error_out("FetchBuilder requires [builder] fetch_strategy in tito.props.") self.build_tag = '%s-%s' % (self.project_name, get_spec_version_and_release(self.start_dir, @@ -59,7 +59,7 @@ class ExternalSourceBuilder(ConfigObject, BuilderBase): print("Fetching sources...") source_strat_class = get_class_by_name(self.config.get( - 'externalsourcebuilder', 'source_strategy')) + 'builder', 'fetch_strategy')) source_strat = source_strat_class(self) source_strat.fetch() self.sources = source_strat.sources diff --git a/test/functional/externalsrc_tests.py b/test/functional/fetch_tests.py similarity index 86% rename from test/functional/externalsrc_tests.py rename to test/functional/fetch_tests.py index 25b0682..087c579 100644 --- a/test/functional/externalsrc_tests.py +++ b/test/functional/fetch_tests.py @@ -12,19 +12,20 @@ # granted to use or replicate Red Hat trademarks that are incorporated # in this software or its documentation. """ -Functional Tests for the ExternalSource builder. +Functional Tests for the FetchBuilder. """ -import os -import tempfile import ConfigParser +import os +import shutil +import tempfile from tito.common import run_command from fixture import TitoGitTestFixture, tito EXT_SRC_PKG = "extsrc" -class ExternalSourceBuilderTests(TitoGitTestFixture): +class FetchBuilderTests(TitoGitTestFixture): def setUp(self): TitoGitTestFixture.setUp(self) @@ -35,11 +36,11 @@ class ExternalSourceBuilderTests(TitoGitTestFixture): self.config = ConfigParser.RawConfigParser() self.config.add_section("buildconfig") self.config.set("buildconfig", "builder", - "tito.builder.ExternalSourceBuilder") + "tito.builder.FetchBuilder") - self.config.add_section('externalsourcebuilder') - self.config.set('externalsourcebuilder', 'source_strategy', - 'tito.builder.externalsrc.KeywordArgSourceStrategy') + self.config.add_section('builder') + self.config.set('builder', 'fetch_strategy', + 'tito.builder.fetch.KeywordArgSourceStrategy') self.create_project_from_spec(EXT_SRC_PKG, self.config, pkg_dir=self.pkg_dir, spec=spec) @@ -53,7 +54,7 @@ class ExternalSourceBuilderTests(TitoGitTestFixture): def tearDown(self): TitoGitTestFixture.tearDown(self) - #shutil.rmtree(self.output_dir) + shutil.rmtree(self.output_dir) def test_simple_build_no_tag(self): # We have not tagged here. Build --rpm should just work: diff --git a/test/functional/multiproject_tests.py b/test/functional/multiproject_tests.py index e4e2de1..7970dcb 100644 --- a/test/functional/multiproject_tests.py +++ b/test/functional/multiproject_tests.py @@ -83,26 +83,6 @@ class MultiProjectTests(TitoGitTestFixture): index.add(['pkg2/tito.props']) index.commit("Adding tito.props for pkg2.") - def test_multi_config(self): - c1 = "[s1]\na = 1\nb = 1\nc=1\n" - c2 = "[s1]\na = 2\nb = 2\nd=1\n[s2]\ne=5\n" - out_f = open(os.path.join(self.repo_dir, "1.props"), 'w') - out_f.write(c1) - out_f.close() - out_f = open(os.path.join(self.repo_dir, "2.props"), 'w') - out_f.write(c2) - out_f.close() - import ConfigParser - config = ConfigParser.ConfigParser() - config.read(os.path.join(self.repo_dir, "1.props")) - config.read(os.path.join(self.repo_dir, "2.props")) - self.assertEquals("2", config.get("s1", "a")) - self.assertEquals("2", config.get("s1", "b")) - self.assertEquals("1", config.get("s1", "c")) - self.assertEquals("1", config.get("s1", "d")) - self.assertEquals("5", config.get("s2", "e")) - - def test_template_version_tagger(self): """ Make sure the template is applied and results in the correct file