mirror of
https://github.com/rpm-software-management/tito.git
synced 2025-02-23 12:12:47 +00:00
parent
37a8a23dbb
commit
4fb18d45c4
3 changed files with 38 additions and 17 deletions
2
pylintrc
Normal file
2
pylintrc
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Good variable names which should always be accepted, separated by a comma
|
||||
good-names=i,j,k,ex,fp
|
|
@ -101,6 +101,8 @@ class BuilderBase(object):
|
|||
if args and 'test' in args:
|
||||
self.test = True
|
||||
|
||||
self.without_init = self._get_optional_arg(kwargs, "without_init", False)
|
||||
|
||||
# Location where we do all tito work and store resulting rpms:
|
||||
self.rpmbuild_basedir = build_dir
|
||||
# Location where we do actual rpmbuilds
|
||||
|
@ -417,6 +419,7 @@ class Builder(ConfigObject, BuilderBase):
|
|||
self.relative_project_dir = get_relative_project_dir(
|
||||
project_name=self.project_name, commit=self.git_commit_id)
|
||||
if self.relative_project_dir is None and self.test:
|
||||
if not self.without_init:
|
||||
warn_out(".tito/packages/%s doesn't exist "
|
||||
"in git, using current directory" % self.project_name)
|
||||
self.relative_project_dir = get_relative_project_dir_cwd(
|
||||
|
@ -472,6 +475,7 @@ class Builder(ConfigObject, BuilderBase):
|
|||
if not self.test:
|
||||
error_out(["Unable to lookup latest package info.",
|
||||
"Perhaps you need to tag first?"])
|
||||
if not self.without_init:
|
||||
warn_out("unable to lookup latest package "
|
||||
"tag, building untagged test project")
|
||||
build_version = get_spec_version_and_release(self.start_dir,
|
||||
|
|
|
@ -90,8 +90,9 @@ class ConfigLoader(object):
|
|||
rel_eng_dir = os.path.join(find_git_root(), tito_config_dir())
|
||||
filename = os.path.join(rel_eng_dir, TITO_PROPS)
|
||||
if not os.path.exists(filename):
|
||||
error_out("Unable to locate branch configuration: %s"
|
||||
"\nPlease run 'tito init'" % filename)
|
||||
error_out("Unable to locate branch configuration: %s\n"
|
||||
"Please run 'tito init' or use '--without-init' parameter"
|
||||
% 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
|
||||
|
@ -267,7 +268,24 @@ class BaseCliModule(object):
|
|||
if e.errno != errno.EEXIST:
|
||||
raise
|
||||
|
||||
@property
|
||||
def initial_config(self):
|
||||
"""
|
||||
Configuration that is dumped into `.tito/tito.props`
|
||||
"""
|
||||
config = RawConfigParser()
|
||||
config.setdefault(BUILDCONFIG_SECTION, {
|
||||
"builder": "tito.builder.Builder",
|
||||
"tagger": "tito.tagger.VersionTagger",
|
||||
"changelog_do_not_remove_cherrypick": 0,
|
||||
"changelog_format": "%s (%ae)",
|
||||
})
|
||||
return config
|
||||
|
||||
def load_config(self, package_name, build_dir, tag):
|
||||
if self.options.without_init:
|
||||
self.config = self.initial_config
|
||||
else:
|
||||
self.config = ConfigLoader(package_name, build_dir, tag).load()
|
||||
|
||||
if self.config.has_option(BUILDCONFIG_SECTION,
|
||||
|
@ -330,6 +348,8 @@ class BuildModule(BaseCliModule):
|
|||
|
||||
self.parser.add_option("--test", dest="test", action="store_true",
|
||||
help="use current branch HEAD instead of latest package tag")
|
||||
self.parser.add_option("--without-init", action="store_true",
|
||||
help="Ignore missing .tito directory")
|
||||
self.parser.add_option("--no-cleanup", dest="no_cleanup",
|
||||
action="store_true",
|
||||
help="do not clean up temporary tito build directories/files, and disable rpmbuild %clean")
|
||||
|
@ -376,6 +396,7 @@ class BuildModule(BaseCliModule):
|
|||
kwargs = {
|
||||
'dist': self.options.dist,
|
||||
'test': self.options.test,
|
||||
'without_init': self.options.without_init,
|
||||
'offline': self.options.offline,
|
||||
'auto_install': self.options.auto_install,
|
||||
'rpmbuild_options': self.options.rpmbuild_options,
|
||||
|
@ -715,15 +736,9 @@ class InitModule(BaseCliModule):
|
|||
|
||||
propsfile = os.path.join(rel_eng_dir, TITO_PROPS)
|
||||
if not os.path.exists(propsfile):
|
||||
# write out tito.props
|
||||
out_f = open(propsfile, 'w')
|
||||
out_f.write("[buildconfig]\n")
|
||||
out_f.write("builder = %s\n" % 'tito.builder.Builder')
|
||||
out_f.write(
|
||||
"tagger = %s\n" % 'tito.tagger.VersionTagger')
|
||||
out_f.write("changelog_do_not_remove_cherrypick = 0\n")
|
||||
out_f.write("changelog_format = %s (%ae)\n")
|
||||
out_f.close()
|
||||
with open(propsfile, 'w') as fp:
|
||||
self.initial_config.write(fp)
|
||||
|
||||
print(" - wrote %s" % TITO_PROPS)
|
||||
|
||||
getoutput('git add %s' % propsfile)
|
||||
|
|
Loading…
Add table
Reference in a new issue