Rename --without-init to --ignore-missing-config

The behavior changed. We now build non-initialized projects without
any additional parameter. The `--without-init` could be confusing
because it could be understood as ignoring `.tito` directory even if
it is there. Which is not true, if `.tito` directory exists, the
parameter does nothing. It is only used to silence warnings.
This commit is contained in:
Jakub Kadlcik 2024-01-09 15:46:25 +01:00 committed by Jakub Kadlčík
parent 68d8b219db
commit 18b1badd60
2 changed files with 8 additions and 7 deletions

View file

@ -101,7 +101,8 @@ class BuilderBase(object):
if args and 'test' in args: if args and 'test' in args:
self.test = True self.test = True
self.without_init = self._get_optional_arg(kwargs, "without_init", False) self.ignore_missing_config = \
self._get_optional_arg(kwargs, "ignore_missing_config", False)
# Location where we do all tito work and store resulting rpms: # Location where we do all tito work and store resulting rpms:
self.rpmbuild_basedir = build_dir self.rpmbuild_basedir = build_dir
@ -419,7 +420,7 @@ class Builder(ConfigObject, BuilderBase):
self.relative_project_dir = get_relative_project_dir( self.relative_project_dir = get_relative_project_dir(
project_name=self.project_name, commit=self.git_commit_id) project_name=self.project_name, commit=self.git_commit_id)
if self.relative_project_dir is None and self.test: if self.relative_project_dir is None and self.test:
if not self.without_init: if not self.ignore_missing_config:
warn_out(".tito/packages/%s doesn't exist " warn_out(".tito/packages/%s doesn't exist "
"in git, using current directory" % self.project_name) "in git, using current directory" % self.project_name)
self.relative_project_dir = get_relative_project_dir_cwd( self.relative_project_dir = get_relative_project_dir_cwd(
@ -475,7 +476,7 @@ class Builder(ConfigObject, BuilderBase):
if not self.test: if not self.test:
error_out(["Unable to lookup latest package info.", error_out(["Unable to lookup latest package info.",
"Perhaps you need to tag first?"]) "Perhaps you need to tag first?"])
if not self.without_init: if not self.ignore_missing_config:
warn_out("Unable to lookup latest package " warn_out("Unable to lookup latest package "
"tag, building untagged test project") "tag, building untagged test project")
build_version = get_spec_version_and_release(self.start_dir, build_version = get_spec_version_and_release(self.start_dir,

View file

@ -293,10 +293,10 @@ class BaseCliModule(object):
error_out("Unable to locate branch configuration: %s\n" error_out("Unable to locate branch configuration: %s\n"
"Please run 'tito init'" % loader.tito_props_path) "Please run 'tito init'" % loader.tito_props_path)
if not self.options.without_init: if not self.options.ignore_missing_config:
warn_out("Tito project wasn't initialized, " warn_out("Tito project wasn't initialized, "
"using the default configuration") "using the default configuration")
warn_out("Consider `tito init' or the `--without-init' " warn_out("Consider `tito init' or the `--ignore-missing-config' "
"parameter to silent the warnings") "parameter to silent the warnings")
self.config = self.initial_config self.config = self.initial_config
@ -366,7 +366,7 @@ class BuildModule(BaseCliModule):
self.parser.add_option("--test", dest="test", action="store_true", self.parser.add_option("--test", dest="test", action="store_true",
help="use current branch HEAD instead of latest package tag") help="use current branch HEAD instead of latest package tag")
self.parser.add_option("--without-init", action="store_true", self.parser.add_option("--ignore-missing-config", action="store_true",
help=("Acknowledge working in non-initialized project " help=("Acknowledge working in non-initialized project "
"and silencing all related warnings")) "and silencing all related warnings"))
self.parser.add_option("--no-cleanup", dest="no_cleanup", self.parser.add_option("--no-cleanup", dest="no_cleanup",
@ -415,7 +415,7 @@ class BuildModule(BaseCliModule):
kwargs = { kwargs = {
'dist': self.options.dist, 'dist': self.options.dist,
'test': self.options.test, 'test': self.options.test,
'without_init': self.options.without_init, 'ignore_missing_config': self.options.ignore_missing_config,
'offline': self.options.offline, 'offline': self.options.offline,
'auto_install': self.options.auto_install, 'auto_install': self.options.auto_install,
'rpmbuild_options': self.options.rpmbuild_options, 'rpmbuild_options': self.options.rpmbuild_options,