Skip to content

Commit

Permalink
Fix some missed references to deprecated config names.
Browse files Browse the repository at this point in the history
  • Loading branch information
dgoodwin committed Mar 7, 2014
1 parent 4ec0213 commit a49649c
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 45 deletions.
2 changes: 1 addition & 1 deletion README.mkd
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ This will:
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
release instead (normally should just be used for changes to the spec file or
patches applied within it), you can change the default_tagger class in
patches applied within it), you can change the 'tagger' class in
rel-eng/tito.props to ReleaseTagger. This will affect all packages in this git
branch, if you'd prefer to do this on a per-package basis you can do so in a
package specific tito.props. (see section below)
Expand Down
11 changes: 3 additions & 8 deletions src/tito/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,6 @@ def __init__(self):
help="build a specific tag instead of the latest version " +
"(i.e. spacewalk-java-0.4.0-1)")

self.parser.add_option("--release", dest="release",
action="store_true", help="DEPRECATED: please use 'tito release' instead.")

self.parser.add_option("--builder", dest="builder",
help="Override the normal builder by specifying a full class "
"path or one of the pre-configured shortcuts.")
Expand Down Expand Up @@ -372,8 +369,6 @@ def main(self, argv):

build_tag = self.options.tag

if self.options.release:
error_out("'tito build --release' is now deprecated. Please see 'tito release'.")
self.load_config(package_name, build_dir, self.options.tag)

args = self._parse_builder_args()
Expand Down Expand Up @@ -709,10 +704,10 @@ def main(self, argv):

# write out tito.props
out_f = open(propsfile, 'w')
out_f.write("[globalconfig]\n")
out_f.write("default_builder = %s\n" % 'tito.builder.Builder')
out_f.write("[buildconfig]\n")
out_f.write("builder = %s\n" % 'tito.builder.Builder')
out_f.write(
"default_tagger = %s\n" % 'tito.tagger.VersionTagger')
"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()
Expand Down
31 changes: 16 additions & 15 deletions src/tito/tagger/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
find_spec_file, get_project_name, get_latest_tagged_version,
get_script_path, get_spec_version_and_release, replace_version,
tag_exists_locally, tag_exists_remotely, head_points_to_tag, undo_tag,
increase_version, reset_release, increase_zstream)
increase_version, reset_release, increase_zstream,
BUILDCONFIG_SECTION)
from tito.compat import *
from tito.exception import TitoException
from tito.config_object import ConfigObject
Expand Down Expand Up @@ -154,32 +155,32 @@ def _undo(self):
def _changelog_remove_cherrypick(self, line):
"""
remove text "(cherry picked from commit ..." from line unless
changelog_do_not_remove_cherrypick is specified in [globalconfig]
changelog_do_not_remove_cherrypick is specified in [BUILDCONFIG_SECTION]
"""
if not (self.config.has_option("globalconfig", "changelog_do_not_remove_cherrypick")
and self.config.get("globalconfig", "changelog_do_not_remove_cherrypick")
and self.config.get("globalconfig", "changelog_do_not_remove_cherrypick").strip() != '0'):
if not (self.config.has_option("BUILDCONFIG_SECTION", "changelog_do_not_remove_cherrypick")
and self.config.get("BUILDCONFIG_SECTION", "changelog_do_not_remove_cherrypick")
and self.config.get("BUILDCONFIG_SECTION", "changelog_do_not_remove_cherrypick").strip() != '0'):
m = re.match("(.+)(\(cherry picked from .*\))", line)
if m:
line = m.group(1)
return line

def _changelog_format(self):
"""
If you have set changelog_format in [globalconfig], it will return
If you have set changelog_format in [BUILDCONFIG_SECTION], it will return
that string. Otherwise, return one of two defaults:
- '%s (%ae)', if changelog_with_email is unset or evaluates to True
- '%s', if changelog_with_email is set and evaluates to False
"""
result = ''
if self.config.has_option("globalconfig", "changelog_format"):
result = self.config.get("globalconfig", "changelog_format")
if self.config.has_option("BUILDCONFIG_SECTION", "changelog_format"):
result = self.config.get("BUILDCONFIG_SECTION", "changelog_format")
else:
with_email = ''
if (self.config.has_option("globalconfig", "changelog_with_email")
and (self.config.get("globalconfig", "changelog_with_email")) not in ['0', '']) or \
not self.config.has_option("globalconfig", "changelog_with_email"):
if (self.config.has_option("BUILDCONFIG_SECTION", "changelog_with_email")
and (self.config.get("BUILDCONFIG_SECTION", "changelog_with_email")) not in ['0', '']) or \
not self.config.has_option("BUILDCONFIG_SECTION", "changelog_with_email"):
with_email = ' (%ae)'
result = "%%s%s" % with_email
return result
Expand Down Expand Up @@ -437,8 +438,8 @@ def _update_package_metadata(self, new_version):

suffix = ""
# If global config specifies a tag suffix, use it:
if self.config.has_option("globalconfig", "tag_suffix"):
suffix = self.config.get("globalconfig", "tag_suffix")
if self.config.has_option("BUILDCONFIG_SECTION", "tag_suffix"):
suffix = self.config.get("BUILDCONFIG_SECTION", "tag_suffix")

new_version_w_suffix = "%s%s" % (new_version, suffix)
# Write out our package metadata:
Expand Down Expand Up @@ -527,8 +528,8 @@ def _get_new_tag(self, new_version):
""" Returns the actual tag we'll be creating. """
suffix = ""
# If global config specifies a tag suffix, use it:
if self.config.has_option("globalconfig", "tag_suffix"):
suffix = self.config.get("globalconfig", "tag_suffix")
if self.config.has_option("BUILDCONFIG_SECTION", "tag_suffix"):
suffix = self.config.get("BUILDCONFIG_SECTION", "tag_suffix")
return "%s-%s%s" % (self.project_name, new_version, suffix)

def _update_version_file(self, new_version):
Expand Down
2 changes: 1 addition & 1 deletion tito.8.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ NOTE: Your spec file should list the source as `%{name}-%{version}.tar.gz`
By default, 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
release instead (normally should just be used for changes to the spec file or
patches applied within it), you can change the default_tagger class in
patches applied within it), you can change the tagger class in
rel-eng/tito.props to ReleaseTagger. This will affect all packages in this git
branch; if you'd prefer to do this on a per-package basis you can do so in a
package specific `tito.props`.
Expand Down
30 changes: 10 additions & 20 deletions tito.props.5.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@ SECTIONS
tito.props can contain several sections:


GLOBALCONFIG
BUILDCONFIG
------------
This section is mandatory. At least in tito.props as you need to specify
default builder and tagger for you project. You can use following variables:
This section and a couple of it's properties are required.
You can use following variables:

default_builder::
builder::
The fully qualified Builder class implementation to use.
You can either specify builders shipped with tito(5) (see BUILDERS section
below), or a custom builder located within the directory your `lib_dir` option
points to.
points to. This property is required.

default_tagger::
tagger::
The fully qualified Tagger class implementation to use.
You can either specify builders shipped with tito(5) (see TAGGERS section
below), or a custom builder located within the directory your `lib_dir` option
points to.
points to. This property is required.

lib_dir::
Optional property defining a directory to be added to the Python path when
Expand Down Expand Up @@ -117,16 +117,6 @@ REQUIREMENTS
tito::
If tito is older then specified version, it will refuse to continue.

BUILDCONFIG
-----------
builder::
This option is used in package specific tito.props only, and allows that
project to override the default_builder defined in rel-eng/tito.props.

tagger::
This option is used in package specific tito.props only, and allows that
project to override the default_tagger defined in rel-eng/tito.props.


TAGCONFIG
---------
Expand Down Expand Up @@ -224,9 +214,9 @@ from spec file) is rubygem-simple-navigation.

EXAMPLE
-------
[globalconfig]
default_builder = tito.builder.Builder
default_tagger = tito.tagger.VersionTagger
[buildconfig]
builder = tito.builder.Builder
tagger = tito.tagger.VersionTagger

[koji]
autobuild_tags = dist-5E-sw-1.2-candidate dist-f12-sw-1.2-candidate dist-f13-sw-1.2-candidate
Expand Down

0 comments on commit a49649c

Please sign in to comment.