Add --all option for release.

This commit is contained in:
Devan Goodwin 2011-10-17 12:18:23 -03:00
parent d2c7fdf042
commit f5fd187352
4 changed files with 39 additions and 16 deletions

View file

@ -79,14 +79,17 @@ The packages can be organized in any hierarchy you like and even be moved
around and re-tagged, we only need to have the spec file in the top level
directory for that package.
To create an initial package tag, modify your spec file's version/release as
desired and run, add a changelog entry, and run:
Tagging packages is normally done with:
tito tag --keep-version --no-auto-changelog
tito tag
For future tagging you'll probably want to use the auto-changelog, which will
auto-populate based on the first line of every git commit since your last
package tag, then give you a chance to edit it.
This will:
- bump the version or release in the spec file (use --keep-version to use whatever is defined in the spec file)
- auto-generate a changelog from first line of each commit since last tag (use --no-auto-changelog if you do not want this)
- open an editor allowing you a chance to edit that changelog
- insert the changelog into your spec
- commit these changes, and generate a git tag
By default if you omit --keep-version, tito will tag by bumping the rpm
version. (i.e. we bump the Z in X.Y.Z. If you'd prefer to bump the package

View file

@ -439,9 +439,13 @@ class ReleaseModule(BaseCliModule):
action="store_true", default=False,
help="Do not actually commit/push anything during release.")
self.parser.add_option("--all",
help="Run all release targets configured.")
self.parser.add_option("--all-starting-with", dest="all_starting_with",
help="Run all release targets starting with the given string.")
# self.parser.add_option("--list-tags", dest="list_tags",
# action="store_true",
# help="List tags for which we build this package",
@ -456,6 +460,25 @@ class ReleaseModule(BaseCliModule):
# help="Do scratch build (only for --koji-release)",
# )
def _validate_options(self):
if self.options.all and self.options.all_starting_with:
error_out("Cannot combine --all and --all-starting-with.")
if (self.options.all or self.options.all_starting_with) and \
len(self.args) > 1:
error_out("Cannot use explicit release targets with "
"--all or --all-starting-with.")
# First arg is sub-command 'release', the rest should be our release
# targets:
if len(self.args) < 2 and (self.options.all_starting_with is None) and \
(self.options.all is None):
print("ERROR: You must supply at least one release target.")
self._print_releasers(releaser_config)
sys.exit(1)
def _read_releaser_config(self):
"""
Read the releaser targets from rel-eng/releasers.conf.
@ -515,25 +538,19 @@ class ReleaseModule(BaseCliModule):
for target in releaser_config.sections():
if target.startswith(self.options.all_starting_with):
targets.append(target)
elif self.options.all:
for target in releaser_config.sections():
targets.append(target)
else:
targets = self.args[1:]
return targets
def main(self, argv):
BaseCliModule.main(self, argv)
releaser_config = self._read_releaser_config()
self._legacy_builder_hack(releaser_config)
# First arg is sub-command 'release', the rest should be our release
# targets:
# TODO: support multiple release targets someday
if len(self.args) < 2 and self.options.all_starting_with is None:
print("ERROR: You must supply at least one release target.")
self._print_releasers(releaser_config)
sys.exit(1)
targets = self._calc_release_targets(releaser_config)
print("Will release to the following targets: %s" % ", ".join(targets))

View file

@ -191,6 +191,9 @@ build a specific tag instead of the latest version
--dry-run::
Do not actually commit/push anything during release.
--all::
Run all release targets defined in rel-eng/releasers.conf.
--all-starting-with=ALL_STARTING_WITH::
Run all release targets starting with the given string. (i.e.
if you have defined release targets yum-f15 and yum-f14 in releasers.conf,

View file

@ -20,7 +20,7 @@ Project settings can be stored in files:
`GITROOT/rel-eng/tito.props`
`GITROOT/SOME/PACKAGE/build.py.props`
`GITROOT/SOME/PACKAGE/tito.props`
The global rel-eng/tito.props is generally where settings are defined. For some multi-project git repositories, individual packages can override these settings by placing a tito.props in the project directory. (i.e. same location as it's .spec file)