mirror of
https://github.com/rpm-software-management/tito.git
synced 2025-02-23 20:22:46 +00:00
Refactor to just one config object.
Instead of passing package specific and global config around separately, parse them as one config object where package specific can override global should the same sections and properties exist. If you maintain custom builders/releasers, they will need to have their constructors updated.
This commit is contained in:
parent
a73c90cbf5
commit
35c51ba7a3
12 changed files with 154 additions and 134 deletions
|
@ -17,9 +17,9 @@ from tito.release import *
|
||||||
class DummyReleaser(Releaser):
|
class DummyReleaser(Releaser):
|
||||||
|
|
||||||
def __init__(self, name=None, version=None, tag=None, build_dir=None,
|
def __init__(self, name=None, version=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None):
|
config=None, user_config=None):
|
||||||
Releaser.__init__(self, name, version, tag, build_dir, pkg_config,
|
Releaser.__init__(self, name, version, tag, build_dir,
|
||||||
global_config, user_config)
|
config, user_config)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def release(self, dry_run=False):
|
def release(self, dry_run=False):
|
||||||
|
|
|
@ -34,18 +34,18 @@ class ExternalSourceBuilder(ConfigObject, BuilderBase):
|
||||||
REQUIRED_ARGS = []
|
REQUIRED_ARGS = []
|
||||||
|
|
||||||
def __init__(self, name=None, tag=None, build_dir=None,
|
def __init__(self, name=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
config=None, user_config=None,
|
||||||
args=None, **kwargs):
|
args=None, **kwargs):
|
||||||
|
|
||||||
BuilderBase.__init__(self, name=name, build_dir=build_dir,
|
BuilderBase.__init__(self, name=name, build_dir=build_dir,
|
||||||
pkg_config=pkg_config, global_config=global_config,
|
config=config,
|
||||||
user_config=user_config, args=args, **kwargs)
|
user_config=user_config, args=args, **kwargs)
|
||||||
|
|
||||||
if tag:
|
if tag:
|
||||||
error_out("ExternalSourceBuilder does not support building "
|
error_out("ExternalSourceBuilder does not support building "
|
||||||
"specific tags.")
|
"specific tags.")
|
||||||
|
|
||||||
if not pkg_config.has_option("externalsourcebuilder",
|
if not config.has_option("externalsourcebuilder",
|
||||||
"source_strategy"):
|
"source_strategy"):
|
||||||
error_out("ExternalSourceBuilder requires [externalsourcebuilder] source_strategy in tito.props.")
|
error_out("ExternalSourceBuilder requires [externalsourcebuilder] source_strategy in tito.props.")
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ class ExternalSourceBuilder(ConfigObject, BuilderBase):
|
||||||
self._create_build_dirs()
|
self._create_build_dirs()
|
||||||
|
|
||||||
print("Fetching sources...")
|
print("Fetching sources...")
|
||||||
source_strat_class = get_class_by_name(self.pkg_config.get(
|
source_strat_class = get_class_by_name(self.config.get(
|
||||||
'externalsourcebuilder', 'source_strategy'))
|
'externalsourcebuilder', 'source_strategy'))
|
||||||
source_strat = source_strat_class(self)
|
source_strat = source_strat_class(self)
|
||||||
source_strat.fetch()
|
source_strat.fetch()
|
||||||
|
|
|
@ -44,7 +44,7 @@ class BuilderBase(object):
|
||||||
"""
|
"""
|
||||||
# TODO: merge config into an object and kill the ConfigObject parent class
|
# TODO: merge config into an object and kill the ConfigObject parent class
|
||||||
def __init__(self, name=None, build_dir=None,
|
def __init__(self, name=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
config=None, user_config=None,
|
||||||
args=None, **kwargs):
|
args=None, **kwargs):
|
||||||
|
|
||||||
# Project directory where we started this build:
|
# Project directory where we started this build:
|
||||||
|
@ -54,7 +54,7 @@ class BuilderBase(object):
|
||||||
self.user_config = user_config
|
self.user_config = user_config
|
||||||
self.args = args
|
self.args = args
|
||||||
self.kwargs = kwargs
|
self.kwargs = kwargs
|
||||||
self.pkg_config = pkg_config
|
self.config = config
|
||||||
|
|
||||||
# Optional keyword arguments:
|
# Optional keyword arguments:
|
||||||
self.dist = self._get_optional_arg(kwargs, 'dist', None)
|
self.dist = self._get_optional_arg(kwargs, 'dist', None)
|
||||||
|
@ -266,7 +266,7 @@ class Builder(ConfigObject, BuilderBase):
|
||||||
|
|
||||||
# TODO: drop version
|
# TODO: drop version
|
||||||
def __init__(self, name=None, tag=None, build_dir=None,
|
def __init__(self, name=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
config=None, user_config=None,
|
||||||
args=None, **kwargs):
|
args=None, **kwargs):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -278,9 +278,7 @@ class Builder(ConfigObject, BuilderBase):
|
||||||
|
|
||||||
build_dir - Temporary build directory where we can safely work.
|
build_dir - Temporary build directory where we can safely work.
|
||||||
|
|
||||||
pkg_config - Package specific configuration.
|
config - Merged configuration. (global plus package specific)
|
||||||
|
|
||||||
global_config - Global configuration from rel-eng/tito.props.
|
|
||||||
|
|
||||||
user_config - User configuration from ~/.titorc.
|
user_config - User configuration from ~/.titorc.
|
||||||
|
|
||||||
|
@ -289,8 +287,9 @@ class Builder(ConfigObject, BuilderBase):
|
||||||
entry. Only for things which vary on invocations of the builder,
|
entry. Only for things which vary on invocations of the builder,
|
||||||
avoid using these if possible.
|
avoid using these if possible.
|
||||||
"""
|
"""
|
||||||
ConfigObject.__init__(self, pkg_config=pkg_config, global_config=global_config)
|
ConfigObject.__init__(self, config=config)
|
||||||
BuilderBase.__init__(self, name=name, build_dir=build_dir, pkg_config=pkg_config, global_config=global_config, user_config=user_config, args=args, **kwargs)
|
BuilderBase.__init__(self, name=name, build_dir=build_dir, config=config,
|
||||||
|
user_config=user_config, args=args, **kwargs)
|
||||||
self.build_tag = tag
|
self.build_tag = tag
|
||||||
|
|
||||||
self.build_version = self._get_build_version()
|
self.build_version = self._get_build_version()
|
||||||
|
@ -514,12 +513,12 @@ class NoTgzBuilder(Builder):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, name=None, tag=None, build_dir=None,
|
def __init__(self, name=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
config=None, user_config=None,
|
||||||
args=None, **kwargs):
|
args=None, **kwargs):
|
||||||
|
|
||||||
Builder.__init__(self, name=name, tag=tag,
|
Builder.__init__(self, name=name, tag=tag,
|
||||||
build_dir=build_dir, pkg_config=pkg_config,
|
build_dir=build_dir, config=config,
|
||||||
global_config=global_config, user_config=user_config,
|
user_config=user_config,
|
||||||
args=args, **kwargs)
|
args=args, **kwargs)
|
||||||
|
|
||||||
# When syncing files with CVS, copy everything from git:
|
# When syncing files with CVS, copy everything from git:
|
||||||
|
@ -580,12 +579,12 @@ class GemBuilder(NoTgzBuilder):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, name=None, tag=None, build_dir=None,
|
def __init__(self, name=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
config=None, user_config=None,
|
||||||
args=None, **kwargs):
|
args=None, **kwargs):
|
||||||
|
|
||||||
NoTgzBuilder.__init__(self, name=name, tag=tag,
|
NoTgzBuilder.__init__(self, name=name, tag=tag,
|
||||||
build_dir=build_dir, pkg_config=pkg_config,
|
build_dir=build_dir, config=config,
|
||||||
global_config=global_config, user_config=user_config,
|
user_config=user_config,
|
||||||
args=args, **kwargs)
|
args=args, **kwargs)
|
||||||
|
|
||||||
def _setup_sources(self):
|
def _setup_sources(self):
|
||||||
|
@ -637,12 +636,12 @@ class CvsBuilder(NoTgzBuilder):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, name=None, tag=None, build_dir=None,
|
def __init__(self, name=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
config=None, user_config=None,
|
||||||
args=None, **kwargs):
|
args=None, **kwargs):
|
||||||
|
|
||||||
NoTgzBuilder.__init__(self, name=name, tag=tag,
|
NoTgzBuilder.__init__(self, name=name, tag=tag,
|
||||||
build_dir=build_dir, pkg_config=pkg_config,
|
build_dir=build_dir, config=config,
|
||||||
global_config=global_config, user_config=user_config,
|
user_config=user_config,
|
||||||
args=args, **kwargs)
|
args=args, **kwargs)
|
||||||
|
|
||||||
# TODO: Hack to override here, patches are in a weird place with this
|
# TODO: Hack to override here, patches are in a weird place with this
|
||||||
|
@ -745,20 +744,20 @@ class UpstreamBuilder(NoTgzBuilder):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, name=None, tag=None, build_dir=None,
|
def __init__(self, name=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
config=None, user_config=None,
|
||||||
args=None, **kwargs):
|
args=None, **kwargs):
|
||||||
|
|
||||||
NoTgzBuilder.__init__(self, name=name, tag=tag,
|
NoTgzBuilder.__init__(self, name=name, tag=tag,
|
||||||
build_dir=build_dir, pkg_config=pkg_config,
|
build_dir=build_dir, config=config,
|
||||||
global_config=global_config, user_config=user_config,
|
user_config=user_config,
|
||||||
args=args, **kwargs)
|
args=args, **kwargs)
|
||||||
|
|
||||||
if not pkg_config or not pkg_config.has_option("buildconfig",
|
if not config or not config.has_option("buildconfig",
|
||||||
"upstream_name"):
|
"upstream_name"):
|
||||||
# No upstream_name defined, assume we're keeping the project name:
|
# No upstream_name defined, assume we're keeping the project name:
|
||||||
self.upstream_name = self.project_name
|
self.upstream_name = self.project_name
|
||||||
else:
|
else:
|
||||||
self.upstream_name = pkg_config.get("buildconfig", "upstream_name")
|
self.upstream_name = config.get("buildconfig", "upstream_name")
|
||||||
# Need to assign these after we've exported a copy of the spec file:
|
# Need to assign these after we've exported a copy of the spec file:
|
||||||
self.upstream_version = None
|
self.upstream_version = None
|
||||||
self.upstream_tag = None
|
self.upstream_tag = None
|
||||||
|
@ -955,17 +954,17 @@ class MockBuilder(Builder):
|
||||||
REQUIRED_ARGS = ['mock']
|
REQUIRED_ARGS = ['mock']
|
||||||
|
|
||||||
def __init__(self, name=None, tag=None, build_dir=None,
|
def __init__(self, name=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
config=None, user_config=None,
|
||||||
args=None, **kwargs):
|
args=None, **kwargs):
|
||||||
|
|
||||||
# Mock builders need to use the packages normally configured builder
|
# Mock builders need to use the packages normally configured builder
|
||||||
# to get at a proper SRPM:
|
# to get at a proper SRPM:
|
||||||
self.normal_builder = create_builder(name, tag, version, pkg_config,
|
self.normal_builder = create_builder(name, tag, version, config,
|
||||||
build_dir, global_config, user_config, args, **kwargs)
|
build_dir, user_config, args, **kwargs)
|
||||||
|
|
||||||
Builder.__init__(self, name=name, tag=tag,
|
Builder.__init__(self, name=name, tag=tag,
|
||||||
build_dir=build_dir, pkg_config=pkg_config,
|
build_dir=build_dir, config=config,
|
||||||
global_config=global_config, user_config=user_config,
|
user_config=user_config,
|
||||||
args=args, **kwargs)
|
args=args, **kwargs)
|
||||||
|
|
||||||
self.mock_tag = args['mock']
|
self.mock_tag = args['mock']
|
||||||
|
@ -1058,12 +1057,12 @@ class BrewDownloadBuilder(Builder):
|
||||||
REQUIRED_ARGS = ['disttag']
|
REQUIRED_ARGS = ['disttag']
|
||||||
|
|
||||||
def __init__(self, name=None, tag=None, build_dir=None,
|
def __init__(self, name=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
config=None, user_config=None,
|
||||||
args=None, **kwargs):
|
args=None, **kwargs):
|
||||||
|
|
||||||
Builder.__init__(self, name=name, tag=tag,
|
Builder.__init__(self, name=name, tag=tag,
|
||||||
build_dir=build_dir, pkg_config=pkg_config,
|
build_dir=build_dir, config=config,
|
||||||
global_config=global_config, user_config=user_config,
|
user_config=user_config,
|
||||||
args=args, **kwargs)
|
args=args, **kwargs)
|
||||||
|
|
||||||
self.brew_tag = 'meow' # args['brewtag']
|
self.brew_tag = 'meow' # args['brewtag']
|
||||||
|
@ -1117,11 +1116,11 @@ class ExternalSourceBuilder(ConfigObject, BuilderBase):
|
||||||
REQUIRED_ARGS = []
|
REQUIRED_ARGS = []
|
||||||
|
|
||||||
def __init__(self, name=None, tag=None, build_dir=None,
|
def __init__(self, name=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
config=None, user_config=None,
|
||||||
args=None, **kwargs):
|
args=None, **kwargs):
|
||||||
|
|
||||||
BuilderBase.__init__(self, name=name, build_dir=build_dir,
|
BuilderBase.__init__(self, name=name, build_dir=build_dir,
|
||||||
pkg_config=pkg_config, global_config=global_config,
|
config=config,
|
||||||
user_config=user_config, args=args, **kwargs)
|
user_config=user_config, args=args, **kwargs)
|
||||||
|
|
||||||
if tag:
|
if tag:
|
||||||
|
|
|
@ -107,9 +107,8 @@ class BaseCliModule(object):
|
||||||
|
|
||||||
def __init__(self, usage):
|
def __init__(self, usage):
|
||||||
self.parser = OptionParser(usage)
|
self.parser = OptionParser(usage)
|
||||||
self.global_config = None
|
self.config = None
|
||||||
self.options = None
|
self.options = None
|
||||||
self.pkg_config = None
|
|
||||||
self.user_config = read_user_config()
|
self.user_config = read_user_config()
|
||||||
|
|
||||||
self._add_common_options()
|
self._add_common_options()
|
||||||
|
@ -148,18 +147,19 @@ class BaseCliModule(object):
|
||||||
print(self.parser.error("Must supply an argument. "
|
print(self.parser.error("Must supply an argument. "
|
||||||
"Try -h for help."))
|
"Try -h for help."))
|
||||||
|
|
||||||
self.global_config = self._read_global_config()
|
self.config = self._read_config()
|
||||||
if self.global_config.has_option(GLOBALCONFIG_SECTION,
|
if self.config.has_option(GLOBALCONFIG_SECTION,
|
||||||
"offline"):
|
"offline"):
|
||||||
self.options.offline = True
|
self.options.offline = True
|
||||||
|
|
||||||
|
# TODO: Not ideal:
|
||||||
if self.options.debug:
|
if self.options.debug:
|
||||||
os.environ['DEBUG'] = "true"
|
os.environ['DEBUG'] = "true"
|
||||||
|
|
||||||
# Check if global config defines a custom lib dir:
|
# Check if global config defines a custom lib dir:
|
||||||
if self.global_config.has_option(GLOBALCONFIG_SECTION,
|
if self.config.has_option(GLOBALCONFIG_SECTION,
|
||||||
"lib_dir"):
|
"lib_dir"):
|
||||||
lib_dir = self.global_config.get(GLOBALCONFIG_SECTION,
|
lib_dir = self.config.get(GLOBALCONFIG_SECTION,
|
||||||
"lib_dir")
|
"lib_dir")
|
||||||
if lib_dir[0] != '/':
|
if lib_dir[0] != '/':
|
||||||
# Looks like a relative path, assume from the git root:
|
# Looks like a relative path, assume from the git root:
|
||||||
|
@ -172,19 +172,29 @@ class BaseCliModule(object):
|
||||||
print("WARNING: lib_dir specified but does not exist: %s" %
|
print("WARNING: lib_dir specified but does not exist: %s" %
|
||||||
lib_dir)
|
lib_dir)
|
||||||
|
|
||||||
def _read_global_config(self):
|
def _read_config(self):
|
||||||
"""
|
"""
|
||||||
Read global build.py configuration from the rel-eng dir of the git
|
Read global build.py configuration from the rel-eng dir of the git
|
||||||
repository we're being run from.
|
repository we're being run from.
|
||||||
|
|
||||||
|
NOTE: We always load the latest config file, not tito.props as it
|
||||||
|
was for the tag being operated on.
|
||||||
"""
|
"""
|
||||||
|
# List of filepaths to config files we'll be loading:
|
||||||
rel_eng_dir = os.path.join(find_git_root(), "rel-eng")
|
rel_eng_dir = os.path.join(find_git_root(), "rel-eng")
|
||||||
filename = os.path.join(rel_eng_dir, GLOBAL_BUILD_PROPS_FILENAME)
|
filename = os.path.join(rel_eng_dir, GLOBAL_BUILD_PROPS_FILENAME)
|
||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
# HACK: Try the old filename location, pre-tito rename:
|
# HACK: Try the old filename location, pre-tito rename:
|
||||||
oldfilename = os.path.join(rel_eng_dir, "global.build.py.props")
|
oldfilename = os.path.join(rel_eng_dir, "global.build.py.props")
|
||||||
if not os.path.exists(oldfilename):
|
if os.path.exists(oldfilename):
|
||||||
|
filename = oldfilename
|
||||||
|
else:
|
||||||
error_out("Unable to locate branch configuration: %s"
|
error_out("Unable to locate branch configuration: %s"
|
||||||
"\nPlease run 'tito init'" % filename)
|
"\nPlease run 'tito init'" % filename)
|
||||||
|
|
||||||
|
# Load the global config. Later, when we know what tag/package we're
|
||||||
|
# building, we may also load that and potentially override some global
|
||||||
|
# settings.
|
||||||
config = ConfigParser.ConfigParser()
|
config = ConfigParser.ConfigParser()
|
||||||
config.read(filename)
|
config.read(filename)
|
||||||
|
|
||||||
|
@ -216,8 +226,12 @@ class BaseCliModule(object):
|
||||||
the presence of a Makefile with NO_TAR_GZ, and include a hack to
|
the presence of a Makefile with NO_TAR_GZ, and include a hack to
|
||||||
assume build properties in this scenario.
|
assume build properties in this scenario.
|
||||||
|
|
||||||
|
If we can find project specific config, we return the path to that
|
||||||
|
config file, and a boolean indicating if that file needs to be cleaned
|
||||||
|
up after reading.
|
||||||
|
|
||||||
If no project specific config can be found, settings come from the
|
If no project specific config can be found, settings come from the
|
||||||
global tito.props in rel-eng/.
|
global tito.props in rel-eng/, and we return None as the filepath.
|
||||||
"""
|
"""
|
||||||
debug("Determined package name to be: %s" % project_name)
|
debug("Determined package name to be: %s" % project_name)
|
||||||
debug("build_dir = %s" % build_dir)
|
debug("build_dir = %s" % build_dir)
|
||||||
|
@ -283,20 +297,17 @@ class BaseCliModule(object):
|
||||||
wrote_temp_file = True
|
wrote_temp_file = True
|
||||||
|
|
||||||
# TODO: can we parse config from a string and stop writing temp files?
|
# TODO: can we parse config from a string and stop writing temp files?
|
||||||
config = ConfigParser.ConfigParser()
|
|
||||||
if properties_file != None:
|
if properties_file != None:
|
||||||
debug("Using build properties: %s" % properties_file)
|
debug("Using package specific properties: %s" % properties_file)
|
||||||
config.read(properties_file)
|
self.config.read(properties_file)
|
||||||
else:
|
else:
|
||||||
debug("Unable to locate custom build properties for this package.")
|
debug("Unable to locate custom build properties for this package.")
|
||||||
debug(" Using global.tito.props")
|
|
||||||
|
|
||||||
# TODO: Not thrilled with this:
|
# TODO: Not thrilled with this:
|
||||||
if wrote_temp_file and not no_cleanup:
|
if wrote_temp_file and not no_cleanup:
|
||||||
# Delete the temp properties file we created.
|
# Delete the temp properties file we created.
|
||||||
run_command("rm %s" % properties_file)
|
run_command("rm %s" % properties_file)
|
||||||
|
|
||||||
return config
|
|
||||||
|
|
||||||
def _validate_options(self):
|
def _validate_options(self):
|
||||||
"""
|
"""
|
||||||
|
@ -379,7 +390,7 @@ class BuildModule(BaseCliModule):
|
||||||
if self.options.release:
|
if self.options.release:
|
||||||
error_out("'tito build --release' is now deprecated. Please see 'tito release'.")
|
error_out("'tito build --release' is now deprecated. Please see 'tito release'.")
|
||||||
|
|
||||||
self.pkg_config = self._read_project_config(package_name, build_dir,
|
self._read_project_config(package_name, build_dir,
|
||||||
self.options.tag, self.options.no_cleanup)
|
self.options.tag, self.options.no_cleanup)
|
||||||
|
|
||||||
args = self._parse_builder_args()
|
args = self._parse_builder_args()
|
||||||
|
@ -394,8 +405,8 @@ class BuildModule(BaseCliModule):
|
||||||
}
|
}
|
||||||
|
|
||||||
builder = create_builder(package_name, build_tag,
|
builder = create_builder(package_name, build_tag,
|
||||||
self.pkg_config,
|
self.config,
|
||||||
build_dir, self.global_config, self.user_config, args,
|
build_dir, self.user_config, args,
|
||||||
builder_class=self.options.builder, **kwargs)
|
builder_class=self.options.builder, **kwargs)
|
||||||
return builder.run(self.options)
|
return builder.run(self.options)
|
||||||
|
|
||||||
|
@ -513,7 +524,7 @@ class ReleaseModule(BaseCliModule):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Handle cvs:
|
# Handle cvs:
|
||||||
if self.global_config.has_section('cvs') and not \
|
if self.config.has_section('cvs') and not \
|
||||||
releaser_config.has_section("cvs"):
|
releaser_config.has_section("cvs"):
|
||||||
print("WARNING: legacy 'cvs' section in tito.props, please "
|
print("WARNING: legacy 'cvs' section in tito.props, please "
|
||||||
"consider creating a target in releasers.conf.")
|
"consider creating a target in releasers.conf.")
|
||||||
|
@ -521,12 +532,12 @@ class ReleaseModule(BaseCliModule):
|
||||||
releaser_config.add_section('cvs')
|
releaser_config.add_section('cvs')
|
||||||
releaser_config.set('cvs', 'releaser', 'tito.release.CvsReleaser')
|
releaser_config.set('cvs', 'releaser', 'tito.release.CvsReleaser')
|
||||||
for opt in ["cvsroot", "branches"]:
|
for opt in ["cvsroot", "branches"]:
|
||||||
if self.global_config.has_option("cvs", opt):
|
if self.config.has_option("cvs", opt):
|
||||||
releaser_config.set('cvs', opt, self.global_config.get(
|
releaser_config.set('cvs', opt, self.config.get(
|
||||||
"cvs", opt))
|
"cvs", opt))
|
||||||
|
|
||||||
# Handle koji:
|
# Handle koji:
|
||||||
if self.global_config.has_section("koji") and not \
|
if self.config.has_section("koji") and not \
|
||||||
releaser_config.has_section("koji"):
|
releaser_config.has_section("koji"):
|
||||||
print("WARNING: legacy 'koji' section in tito.props, please "
|
print("WARNING: legacy 'koji' section in tito.props, please "
|
||||||
"consider creating a target in releasers.conf.")
|
"consider creating a target in releasers.conf.")
|
||||||
|
@ -534,7 +545,7 @@ class ReleaseModule(BaseCliModule):
|
||||||
releaser_config.add_section('koji')
|
releaser_config.add_section('koji')
|
||||||
releaser_config.set('koji', 'releaser', 'tito.release.KojiReleaser')
|
releaser_config.set('koji', 'releaser', 'tito.release.KojiReleaser')
|
||||||
releaser_config.set('koji', 'autobuild_tags',
|
releaser_config.set('koji', 'autobuild_tags',
|
||||||
self.global_config.get('koji', 'autobuild_tags'))
|
self.config.get('koji', 'autobuild_tags'))
|
||||||
|
|
||||||
# TODO: find a way to get koji builds going through the new release
|
# TODO: find a way to get koji builds going through the new release
|
||||||
# target config file, tricky as each koji tag gets it's own
|
# target config file, tricky as each koji tag gets it's own
|
||||||
|
@ -542,8 +553,8 @@ class ReleaseModule(BaseCliModule):
|
||||||
# target.
|
# target.
|
||||||
|
|
||||||
#for opt in ["autobuild_tags", "disttag", "whitelist", "blacklist"]:
|
#for opt in ["autobuild_tags", "disttag", "whitelist", "blacklist"]:
|
||||||
# if self.global_config.has_option("koji", opt):
|
# if self.config.has_option("koji", opt):
|
||||||
# releaser_config.set('koji', opt, self.global_config.get(
|
# releaser_config.set('koji', opt, self.config.get(
|
||||||
# "koji", opt))
|
# "koji", opt))
|
||||||
|
|
||||||
def _print_releasers(self, releaser_config):
|
def _print_releasers(self, releaser_config):
|
||||||
|
@ -589,7 +600,7 @@ class ReleaseModule(BaseCliModule):
|
||||||
|
|
||||||
build_tag = self.options.tag
|
build_tag = self.options.tag
|
||||||
|
|
||||||
self.pkg_config = self._read_project_config(package_name, build_dir,
|
self._read_project_config(package_name, build_dir,
|
||||||
self.options.tag, self.options.no_cleanup)
|
self.options.tag, self.options.no_cleanup)
|
||||||
|
|
||||||
orig_cwd = os.getcwd()
|
orig_cwd = os.getcwd()
|
||||||
|
@ -606,8 +617,7 @@ class ReleaseModule(BaseCliModule):
|
||||||
name=package_name,
|
name=package_name,
|
||||||
tag=build_tag,
|
tag=build_tag,
|
||||||
build_dir=build_dir,
|
build_dir=build_dir,
|
||||||
pkg_config=self.pkg_config,
|
config=self.config,
|
||||||
global_config=self.global_config,
|
|
||||||
user_config=self.user_config,
|
user_config=self.user_config,
|
||||||
target=target,
|
target=target,
|
||||||
releaser_config=releaser_config,
|
releaser_config=releaser_config,
|
||||||
|
@ -661,7 +671,7 @@ class TagModule(BaseCliModule):
|
||||||
def main(self, argv):
|
def main(self, argv):
|
||||||
BaseCliModule.main(self, argv)
|
BaseCliModule.main(self, argv)
|
||||||
|
|
||||||
if self.global_config.has_option(GLOBALCONFIG_SECTION,
|
if self.config.has_option(GLOBALCONFIG_SECTION,
|
||||||
"block_tagging"):
|
"block_tagging"):
|
||||||
debug("block_tagging defined in tito.props")
|
debug("block_tagging defined in tito.props")
|
||||||
error_out("Tagging has been disabled in this git branch.")
|
error_out("Tagging has been disabled in this git branch.")
|
||||||
|
@ -669,23 +679,22 @@ class TagModule(BaseCliModule):
|
||||||
build_dir = os.path.normpath(os.path.abspath(self.options.output_dir))
|
build_dir = os.path.normpath(os.path.abspath(self.options.output_dir))
|
||||||
package_name = get_project_name(tag=None)
|
package_name = get_project_name(tag=None)
|
||||||
|
|
||||||
self.pkg_config = self._read_project_config(package_name, build_dir,
|
self._read_project_config(package_name, build_dir,
|
||||||
None, None)
|
None, None)
|
||||||
|
|
||||||
tagger_class = None
|
tagger_class = None
|
||||||
if self.options.use_version:
|
if self.options.use_version:
|
||||||
tagger_class = get_class_by_name("tito.tagger.ForceVersionTagger")
|
tagger_class = get_class_by_name("tito.tagger.ForceVersionTagger")
|
||||||
elif self.pkg_config.has_option("buildconfig", "tagger"):
|
elif self.config.has_option("buildconfig", "tagger"):
|
||||||
tagger_class = get_class_by_name(self.pkg_config.get("buildconfig",
|
tagger_class = get_class_by_name(self.config.get("buildconfig",
|
||||||
"tagger"))
|
"tagger"))
|
||||||
else:
|
else:
|
||||||
tagger_class = get_class_by_name(self.global_config.get(
|
tagger_class = get_class_by_name(self.config.get(
|
||||||
GLOBALCONFIG_SECTION, DEFAULT_TAGGER))
|
GLOBALCONFIG_SECTION, DEFAULT_TAGGER))
|
||||||
debug("Using tagger class: %s" % tagger_class)
|
debug("Using tagger class: %s" % tagger_class)
|
||||||
|
|
||||||
tagger = tagger_class(global_config=self.global_config,
|
tagger = tagger_class(config=self.config,
|
||||||
user_config=self.user_config,
|
user_config=self.user_config,
|
||||||
pkg_config=self.pkg_config,
|
|
||||||
keep_version=self.options.keep_version,
|
keep_version=self.options.keep_version,
|
||||||
offline=self.options.offline)
|
offline=self.options.offline)
|
||||||
|
|
||||||
|
@ -788,15 +797,15 @@ class ReportModule(BaseCliModule):
|
||||||
BaseCliModule.main(self, argv)
|
BaseCliModule.main(self, argv)
|
||||||
|
|
||||||
if self.options.untagged_report:
|
if self.options.untagged_report:
|
||||||
self._run_untagged_report(self.global_config)
|
self._run_untagged_report(self.config)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if self.options.untagged_commits:
|
if self.options.untagged_commits:
|
||||||
self._run_untagged_commits(self.global_config)
|
self._run_untagged_commits(self.config)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def _run_untagged_commits(self, global_config):
|
def _run_untagged_commits(self, config):
|
||||||
"""
|
"""
|
||||||
Display a report of all packages with differences between HEAD and
|
Display a report of all packages with differences between HEAD and
|
||||||
their most recent tag, as well as a patch for that diff. Used to
|
their most recent tag, as well as a patch for that diff. Used to
|
||||||
|
@ -820,9 +829,9 @@ class ReportModule(BaseCliModule):
|
||||||
relative_dir = ""
|
relative_dir = ""
|
||||||
|
|
||||||
project_dir = os.path.join(git_root, relative_dir)
|
project_dir = os.path.join(git_root, relative_dir)
|
||||||
self._print_log(global_config, md_file, version, project_dir)
|
self._print_log(config, md_file, version, project_dir)
|
||||||
|
|
||||||
def _run_untagged_report(self, global_config):
|
def _run_untagged_report(self, config):
|
||||||
"""
|
"""
|
||||||
Display a report of all packages with differences between HEAD and
|
Display a report of all packages with differences between HEAD and
|
||||||
their most recent tag, as well as a patch for that diff. Used to
|
their most recent tag, as well as a patch for that diff. Used to
|
||||||
|
@ -846,10 +855,10 @@ class ReportModule(BaseCliModule):
|
||||||
relative_dir = ""
|
relative_dir = ""
|
||||||
|
|
||||||
project_dir = os.path.join(git_root, relative_dir)
|
project_dir = os.path.join(git_root, relative_dir)
|
||||||
self._print_diff(global_config, md_file, version, project_dir,
|
self._print_diff(config, md_file, version, project_dir,
|
||||||
relative_dir)
|
relative_dir)
|
||||||
|
|
||||||
def _print_log(self, global_config, package_name, version, project_dir):
|
def _print_log(self, config, package_name, version, project_dir):
|
||||||
"""
|
"""
|
||||||
Print the log between the most recent package tag and HEAD, if
|
Print the log between the most recent package tag and HEAD, if
|
||||||
necessary.
|
necessary.
|
||||||
|
@ -867,7 +876,7 @@ class ReportModule(BaseCliModule):
|
||||||
except:
|
except:
|
||||||
print("%s no longer exists" % project_dir)
|
print("%s no longer exists" % project_dir)
|
||||||
|
|
||||||
def _print_diff(self, global_config, package_name, version,
|
def _print_diff(self, config, package_name, version,
|
||||||
full_project_dir, relative_project_dir):
|
full_project_dir, relative_project_dir):
|
||||||
"""
|
"""
|
||||||
Print a diff between the most recent package tag and HEAD, if
|
Print a diff between the most recent package tag and HEAD, if
|
||||||
|
|
|
@ -114,7 +114,7 @@ def error_out(error_msgs):
|
||||||
|
|
||||||
|
|
||||||
def create_builder(package_name, build_tag,
|
def create_builder(package_name, build_tag,
|
||||||
pkg_config, build_dir, global_config, user_config, args,
|
config, build_dir, user_config, args,
|
||||||
builder_class=None, **kwargs):
|
builder_class=None, **kwargs):
|
||||||
"""
|
"""
|
||||||
Create (but don't run) the builder class. Builder object may be
|
Create (but don't run) the builder class. Builder object may be
|
||||||
|
@ -127,12 +127,12 @@ def create_builder(package_name, build_tag,
|
||||||
|
|
||||||
if builder_class is None:
|
if builder_class is None:
|
||||||
debug("---- Builder class is None")
|
debug("---- Builder class is None")
|
||||||
if pkg_config.has_option("buildconfig", "builder"):
|
if config.has_option("buildconfig", "builder"):
|
||||||
builder_class = get_class_by_name(pkg_config.get("buildconfig",
|
builder_class = get_class_by_name(config.get("buildconfig",
|
||||||
"builder"))
|
"builder"))
|
||||||
else:
|
else:
|
||||||
debug("---- Global config")
|
debug("---- Global config")
|
||||||
builder_class = get_class_by_name(global_config.get(
|
builder_class = get_class_by_name(config.get(
|
||||||
GLOBALCONFIG_SECTION, DEFAULT_BUILDER))
|
GLOBALCONFIG_SECTION, DEFAULT_BUILDER))
|
||||||
else:
|
else:
|
||||||
# We were given an explicit builder class as a str, get the actual
|
# We were given an explicit builder class as a str, get the actual
|
||||||
|
@ -145,8 +145,7 @@ def create_builder(package_name, build_tag,
|
||||||
name=package_name,
|
name=package_name,
|
||||||
tag=build_tag,
|
tag=build_tag,
|
||||||
build_dir=build_dir,
|
build_dir=build_dir,
|
||||||
pkg_config=pkg_config,
|
config=config,
|
||||||
global_config=global_config,
|
|
||||||
user_config=user_config,
|
user_config=user_config,
|
||||||
args=args,
|
args=args,
|
||||||
**kwargs)
|
**kwargs)
|
||||||
|
|
|
@ -22,21 +22,19 @@ class ConfigObject(object):
|
||||||
Perent class for Builder and Tagger with shared code
|
Perent class for Builder and Tagger with shared code
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, pkg_config=None, global_config=None):
|
def __init__(self, config=None):
|
||||||
"""
|
"""
|
||||||
pkg_config - Package specific configuration.
|
config - Merged configuration. (global plus package specific)
|
||||||
|
"""
|
||||||
|
self.config = config
|
||||||
|
|
||||||
global_config - Global configuration from rel-eng/tito.props.
|
|
||||||
"""
|
|
||||||
self.config = global_config
|
|
||||||
|
|
||||||
# Override global configurations using local configurations
|
# Override global configurations using local configurations
|
||||||
for section in pkg_config.sections():
|
for section in config.sections():
|
||||||
for options in pkg_config.options(section):
|
for options in config.options(section):
|
||||||
if not self.config.has_section(section):
|
if not self.config.has_section(section):
|
||||||
self.config.add_section(section)
|
self.config.add_section(section)
|
||||||
self.config.set(section, options,
|
self.config.set(section, options,
|
||||||
pkg_config.get(section, options))
|
config.get(section, options))
|
||||||
|
|
||||||
self.git_root = find_git_root()
|
self.git_root = find_git_root()
|
||||||
self.rel_eng_dir = os.path.join(self.git_root, "rel-eng")
|
self.rel_eng_dir = os.path.join(self.git_root, "rel-eng")
|
||||||
|
|
|
@ -26,10 +26,10 @@ class CoprReleaser(KojiReleaser):
|
||||||
NAME = "Copr"
|
NAME = "Copr"
|
||||||
|
|
||||||
def __init__(self, name=None, version=None, tag=None, build_dir=None,
|
def __init__(self, name=None, version=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
config=None, user_config=None,
|
||||||
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
||||||
KojiReleaser.__init__(self, name, version, tag, build_dir, pkg_config,
|
KojiReleaser.__init__(self, name, version, tag, build_dir, config,
|
||||||
global_config, user_config, target, releaser_config, no_cleanup, test, auto_accept)
|
user_config, target, releaser_config, no_cleanup, test, auto_accept)
|
||||||
|
|
||||||
self.copr_project_name = \
|
self.copr_project_name = \
|
||||||
self.releaser_config.get(self.target, "project_name")
|
self.releaser_config.get(self.target, "project_name")
|
||||||
|
|
|
@ -13,9 +13,9 @@ class DistributionBuilder(UpstreamBuilder):
|
||||||
Patch1: foo-1.2.13-2-to-foo-1.2.13-3-sat.patch
|
Patch1: foo-1.2.13-2-to-foo-1.2.13-3-sat.patch
|
||||||
"""
|
"""
|
||||||
def __init__(self, name=None, tag=None, build_dir=None,
|
def __init__(self, name=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None, args=None, **kwargs):
|
config=None, user_config=None, args=None, **kwargs):
|
||||||
UpstreamBuilder.__init__(self, name, tag, build_dir, pkg_config,
|
UpstreamBuilder.__init__(self, name, tag, build_dir, config,
|
||||||
global_config, user_config, args, **kwargs)
|
user_config, args, **kwargs)
|
||||||
self.patch_files = []
|
self.patch_files = []
|
||||||
|
|
||||||
def patch_upstream(self):
|
def patch_upstream(self):
|
||||||
|
|
|
@ -28,10 +28,10 @@ class ObsReleaser(Releaser):
|
||||||
cli_tool = "osc"
|
cli_tool = "osc"
|
||||||
|
|
||||||
def __init__(self, name=None, tag=None, build_dir=None,
|
def __init__(self, name=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
config=None, user_config=None,
|
||||||
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
||||||
Releaser.__init__(self, name, tag, build_dir, pkg_config,
|
Releaser.__init__(self, name, tag, build_dir,
|
||||||
global_config, user_config, target, releaser_config, no_cleanup, test, auto_accept)
|
user_config, target, releaser_config, no_cleanup, test, auto_accept)
|
||||||
|
|
||||||
self.obs_project_name = \
|
self.obs_project_name = \
|
||||||
self.releaser_config.get(self.target, "project_name")
|
self.releaser_config.get(self.target, "project_name")
|
||||||
|
|
|
@ -62,10 +62,10 @@ class Releaser(ConfigObject):
|
||||||
OPTIONAL_CONFIG = []
|
OPTIONAL_CONFIG = []
|
||||||
|
|
||||||
def __init__(self, name=None, tag=None, build_dir=None,
|
def __init__(self, name=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
config=None, user_config=None,
|
||||||
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
||||||
|
|
||||||
ConfigObject.__init__(self, pkg_config=pkg_config, global_config=global_config)
|
ConfigObject.__init__(self, config=config)
|
||||||
self.builder_args = self._parse_builder_args(releaser_config, target)
|
self.builder_args = self._parse_builder_args(releaser_config, target)
|
||||||
if test:
|
if test:
|
||||||
self.builder_args['test'] = True # builder must know to build from HEAD
|
self.builder_args['test'] = True # builder must know to build from HEAD
|
||||||
|
@ -73,8 +73,8 @@ class Releaser(ConfigObject):
|
||||||
# While we create a builder here, we don't actually call run on it
|
# While we create a builder here, we don't actually call run on it
|
||||||
# unless the releaser needs to:
|
# unless the releaser needs to:
|
||||||
self.builder = create_builder(name, tag,
|
self.builder = create_builder(name, tag,
|
||||||
pkg_config,
|
config,
|
||||||
build_dir, global_config, user_config, self.builder_args)
|
build_dir, user_config, self.builder_args)
|
||||||
self.project_name = self.builder.project_name
|
self.project_name = self.builder.project_name
|
||||||
|
|
||||||
# TODO: if it looks like we need custom CVSROOT's for different users,
|
# TODO: if it looks like we need custom CVSROOT's for different users,
|
||||||
|
@ -287,11 +287,11 @@ class RsyncReleaser(Releaser):
|
||||||
rsync_args = "-rlvz"
|
rsync_args = "-rlvz"
|
||||||
|
|
||||||
def __init__(self, name=None, tag=None, build_dir=None,
|
def __init__(self, name=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
config=None, user_config=None,
|
||||||
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False,
|
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False,
|
||||||
prefix="temp_dir="):
|
prefix="temp_dir="):
|
||||||
Releaser.__init__(self, name, tag, build_dir, pkg_config,
|
Releaser.__init__(self, name, tag, build_dir, config,
|
||||||
global_config, user_config, target, releaser_config, no_cleanup, test, auto_accept)
|
user_config, target, releaser_config, no_cleanup, test, auto_accept)
|
||||||
|
|
||||||
self.build_dir = build_dir
|
self.build_dir = build_dir
|
||||||
self.prefix = prefix
|
self.prefix = prefix
|
||||||
|
@ -299,8 +299,8 @@ class RsyncReleaser(Releaser):
|
||||||
# Use the builder from the release target, rather than the default
|
# Use the builder from the release target, rather than the default
|
||||||
# one defined for this git repo or sub-package:
|
# one defined for this git repo or sub-package:
|
||||||
self.builder = create_builder(name, tag,
|
self.builder = create_builder(name, tag,
|
||||||
pkg_config,
|
config,
|
||||||
build_dir, global_config, user_config, self.builder_args,
|
build_dir, user_config, self.builder_args,
|
||||||
builder_class=self.releaser_config.get(self.target, 'builder'))
|
builder_class=self.releaser_config.get(self.target, 'builder'))
|
||||||
if self.releaser_config.has_option(self.target, "scl"):
|
if self.releaser_config.has_option(self.target, "scl"):
|
||||||
self.builder.scl = self.releaser_config.get(self.target, "scl")
|
self.builder.scl = self.releaser_config.get(self.target, "scl")
|
||||||
|
@ -405,10 +405,10 @@ class YumRepoReleaser(RsyncReleaser):
|
||||||
createrepo_command = "createrepo ."
|
createrepo_command = "createrepo ."
|
||||||
|
|
||||||
def __init__(self, name=None, tag=None, build_dir=None,
|
def __init__(self, name=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
config=None, user_config=None,
|
||||||
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
||||||
RsyncReleaser.__init__(self, name, tag, build_dir, pkg_config,
|
RsyncReleaser.__init__(self, name, tag, build_dir, config,
|
||||||
global_config, user_config, target, releaser_config, no_cleanup, test, auto_accept,
|
user_config, target, releaser_config, no_cleanup, test, auto_accept,
|
||||||
prefix="yumrepo-")
|
prefix="yumrepo-")
|
||||||
|
|
||||||
def _read_rpm_header(self, ts, new_rpm_path):
|
def _read_rpm_header(self, ts, new_rpm_path):
|
||||||
|
@ -473,10 +473,10 @@ class FedoraGitReleaser(Releaser):
|
||||||
cli_tool = "fedpkg"
|
cli_tool = "fedpkg"
|
||||||
|
|
||||||
def __init__(self, name=None, tag=None, build_dir=None,
|
def __init__(self, name=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
config=None, user_config=None,
|
||||||
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
||||||
Releaser.__init__(self, name, tag, build_dir, pkg_config,
|
Releaser.__init__(self, name, tag, build_dir, config,
|
||||||
global_config, user_config, target, releaser_config, no_cleanup, test, auto_accept)
|
user_config, target, releaser_config, no_cleanup, test, auto_accept)
|
||||||
|
|
||||||
self.git_branches = \
|
self.git_branches = \
|
||||||
self.releaser_config.get(self.target, "branches").split(" ")
|
self.releaser_config.get(self.target, "branches").split(" ")
|
||||||
|
@ -750,10 +750,10 @@ class CvsReleaser(Releaser):
|
||||||
REQUIRED_CONFIG = ['cvsroot', 'branches']
|
REQUIRED_CONFIG = ['cvsroot', 'branches']
|
||||||
|
|
||||||
def __init__(self, name=None, tag=None, build_dir=None,
|
def __init__(self, name=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
config=None, user_config=None,
|
||||||
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
||||||
Releaser.__init__(self, name, tag, build_dir, pkg_config,
|
Releaser.__init__(self, name, tag, build_dir, config,
|
||||||
global_config, user_config, target, releaser_config, no_cleanup, test, auto_accept)
|
user_config, target, releaser_config, no_cleanup, test, auto_accept)
|
||||||
|
|
||||||
self.package_workdir = os.path.join(self.working_dir,
|
self.package_workdir = os.path.join(self.working_dir,
|
||||||
self.project_name)
|
self.project_name)
|
||||||
|
@ -995,10 +995,10 @@ class KojiReleaser(Releaser):
|
||||||
NAME = "Koji"
|
NAME = "Koji"
|
||||||
|
|
||||||
def __init__(self, name=None, tag=None, build_dir=None,
|
def __init__(self, name=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
config=None, user_config=None,
|
||||||
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
||||||
Releaser.__init__(self, name, tag, build_dir, pkg_config,
|
Releaser.__init__(self, name, tag, build_dir, config,
|
||||||
global_config, user_config, target, releaser_config, no_cleanup, test, auto_accept)
|
user_config, target, releaser_config, no_cleanup, test, auto_accept)
|
||||||
|
|
||||||
self.only_tags = []
|
self.only_tags = []
|
||||||
if 'ONLY_TAGS' in os.environ:
|
if 'ONLY_TAGS' in os.environ:
|
||||||
|
|
|
@ -46,13 +46,8 @@ class VersionTagger(ConfigObject):
|
||||||
and the actual RPM "release" will always be set to 1.
|
and the actual RPM "release" will always be set to 1.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, global_config=None, keep_version=False, offline=False, user_config=None, pkg_config=None):
|
def __init__(self, config=None, keep_version=False, offline=False, user_config=None):
|
||||||
"""
|
ConfigObject.__init__(self, config=config)
|
||||||
pkg_config - Package specific configuration.
|
|
||||||
|
|
||||||
global_config - Global configuration from rel-eng/tito.props.
|
|
||||||
"""
|
|
||||||
ConfigObject.__init__(self, pkg_config=pkg_config, global_config=global_config)
|
|
||||||
self.user_config = user_config
|
self.user_config = user_config
|
||||||
|
|
||||||
self.full_project_dir = os.getcwd()
|
self.full_project_dir = os.getcwd()
|
||||||
|
|
|
@ -83,6 +83,26 @@ class MultiProjectTests(TitoGitTestFixture):
|
||||||
index.add(['pkg2/tito.props'])
|
index.add(['pkg2/tito.props'])
|
||||||
index.commit("Adding tito.props for pkg2.")
|
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):
|
def test_template_version_tagger(self):
|
||||||
"""
|
"""
|
||||||
Make sure the template is applied and results in the correct file
|
Make sure the template is applied and results in the correct file
|
||||||
|
|
Loading…
Add table
Reference in a new issue