mirror of
https://github.com/rpm-software-management/tito.git
synced 2025-02-23 20:22:46 +00:00
Fix changelog generation when introducing tag suffixes.
This commit is contained in:
parent
ca86a74fa5
commit
46d09a1239
3 changed files with 12 additions and 3 deletions
|
@ -235,6 +235,9 @@ class VersionTagger(ConfigObject):
|
||||||
if not found_changelog and line.startswith("%changelog"):
|
if not found_changelog and line.startswith("%changelog"):
|
||||||
found_changelog = True
|
found_changelog = True
|
||||||
|
|
||||||
|
# WARNING: This is the last tag, minus the assumed "PKGNAME-" prefix. This complicates
|
||||||
|
# the appearance that we can control the package name in the tag with a custom tag_format,
|
||||||
|
# at present we cannot. (as it would break old/existing package metadata files)
|
||||||
old_version = get_latest_tagged_version(self.project_name)
|
old_version = get_latest_tagged_version(self.project_name)
|
||||||
debug("Got old_version: %s" % old_version)
|
debug("Got old_version: %s" % old_version)
|
||||||
|
|
||||||
|
@ -258,7 +261,7 @@ class VersionTagger(ConfigObject):
|
||||||
write(fd, "\n")
|
write(fd, "\n")
|
||||||
else:
|
else:
|
||||||
if old_version is not None:
|
if old_version is not None:
|
||||||
last_tag = self._get_new_tag(old_version)
|
last_tag = "%s-%s" % (self.project_name, old_version)
|
||||||
debug("last_tag = %s" % last_tag)
|
debug("last_tag = %s" % last_tag)
|
||||||
output = self._generate_default_changelog(last_tag)
|
output = self._generate_default_changelog(last_tag)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -64,7 +64,6 @@ class VersionTaggerTest(unittest.TestCase):
|
||||||
# Init RPM package
|
# Init RPM package
|
||||||
self.create_rpm_package()
|
self.create_rpm_package()
|
||||||
|
|
||||||
|
|
||||||
def write_file(self, path, contents):
|
def write_file(self, path, contents):
|
||||||
out_f = open(path, 'w')
|
out_f = open(path, 'w')
|
||||||
out_f.write(contents)
|
out_f.write(contents)
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from tito.builder import Builder, UpstreamBuilder
|
from tito.builder import Builder, UpstreamBuilder
|
||||||
from tito.common import tag_exists_locally, check_tag_exists
|
from tito.common import tag_exists_locally, check_tag_exists, run_command
|
||||||
from tito.release import Releaser
|
from tito.release import Releaser
|
||||||
from tito.compat import getoutput
|
from tito.compat import getoutput
|
||||||
from functional.fixture import TitoGitTestFixture, tito
|
from functional.fixture import TitoGitTestFixture, tito
|
||||||
|
@ -58,6 +58,13 @@ class SingleProjectTests(TitoGitTestFixture):
|
||||||
tito("tag --accept-auto-changelog --debug")
|
tito("tag --accept-auto-changelog --debug")
|
||||||
check_tag_exists("%s-0.0.2-1" % PKG_NAME, offline=True)
|
check_tag_exists("%s-0.0.2-1" % PKG_NAME, offline=True)
|
||||||
|
|
||||||
|
def test_tag_with_suffix(self):
|
||||||
|
# Append a tag suffix to our global tito.props:
|
||||||
|
run_command('echo "tag_suffix = .fc1_17" >> .tito/tito.props')
|
||||||
|
# Create a 0.0.2 now with the addition of a tag suffix:
|
||||||
|
tito("tag --accept-auto-changelog --debug")
|
||||||
|
check_tag_exists("%s-0.0.2-1.fc1_17" % PKG_NAME, offline=True)
|
||||||
|
|
||||||
def test_tag_with_version(self):
|
def test_tag_with_version(self):
|
||||||
tito("tag --accept-auto-changelog --debug --use-version 9.0.0")
|
tito("tag --accept-auto-changelog --debug --use-version 9.0.0")
|
||||||
check_tag_exists("%s-9.0.0-1" % PKG_NAME, offline=True)
|
check_tag_exists("%s-9.0.0-1" % PKG_NAME, offline=True)
|
||||||
|
|
Loading…
Add table
Reference in a new issue