mirror of
https://github.com/rpm-software-management/tito.git
synced 2025-02-23 12:12:47 +00:00
Rename to FetchBuilder.
This commit is contained in:
parent
8c90a4a6ae
commit
e1a0017144
4 changed files with 17 additions and 36 deletions
|
@ -10,4 +10,4 @@ from tito.builder.main import \
|
|||
MockBuilder, \
|
||||
BrewDownloadBuilder
|
||||
|
||||
from tito.builder.externalsrc import ExternalSourceBuilder
|
||||
from tito.builder.fetch import FetchBuilder
|
||||
|
|
|
@ -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
|
|
@ -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:
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue