Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
systemsmanagement:Uyuni:Utils
tito
0009-add-option-to-prevent-creating-a-default-c...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0009-add-option-to-prevent-creating-a-default-changelog.patch of Package tito
From fb5f29e04865fae7dbc36e07041b710b172753cd Mon Sep 17 00:00:00 2001 From: Michael Calmer <mc@suse.de> Date: Sat, 26 Aug 2017 15:51:26 +0200 Subject: [PATCH 9/9] add option to prevent creating a default changelog --- src/tito/cli.py | 6 +++++ src/tito/tagger/main.py | 3 +++ src/tito/tagger/susetagger.py | 52 ++++++++++++++----------------------------- 3 files changed, 26 insertions(+), 35 deletions(-) Index: tito-tito-0.6.11-1/src/tito/cli.py =================================================================== --- tito-tito-0.6.11-1.orig/src/tito/cli.py +++ tito-tito-0.6.11-1/src/tito/cli.py @@ -633,6 +633,9 @@ class TagModule(BaseCliModule): default=False, help=("Don't automatically create a changelog " "entry for this tag if none is found")) + self.parser.add_option("--no-default-changelog", action="store_true", + default=False, + help=("Don't create the changelog entries but write the header")) self.parser.add_option("--accept-auto-changelog", action="store_true", default=False, help=("Automatically accept the generated changelog.")) @@ -660,6 +663,9 @@ class TagModule(BaseCliModule): "block_tagging"): debug("block_tagging defined in tito.props") error_out("Tagging has been disabled in this git branch.") + if (self.config.has_option(BUILDCONFIG_SECTION, "no_default_changelog") + and self.config.get(BUILDCONFIG_SECTION, "no_default_changelog") == '1'): + self.options.no_default_changelog = True tagger_class = get_class_by_name(self.config.get( BUILDCONFIG_SECTION, DEFAULT_TAGGER)) Index: tito-tito-0.6.11-1/src/tito/tagger/main.py =================================================================== --- tito-tito-0.6.11-1.orig/src/tito/tagger/main.py +++ tito-tito-0.6.11-1/src/tito/tagger/main.py @@ -77,6 +77,7 @@ class VersionTagger(ConfigObject): self.git_user, git_email.replace("+", "\+").replace(".", "\."))) self._no_auto_changelog = False + self._no_default_changelog = False self._accept_auto_changelog = False self._new_changelog_msg = "new package built with tito" self._changelog = None @@ -94,6 +95,8 @@ class VersionTagger(ConfigObject): " 'tito tag' will accomplish the same thing.") if options.no_auto_changelog: self._no_auto_changelog = True + if options.no_default_changelog: + self._no_default_changelog = True if options.accept_auto_changelog: self._accept_auto_changelog = True if options.auto_changelog_msg: Index: tito-tito-0.6.11-1/src/tito/tagger/susetagger.py =================================================================== --- tito-tito-0.6.11-1.orig/src/tito/tagger/susetagger.py +++ tito-tito-0.6.11-1/src/tito/tagger/susetagger.py @@ -52,61 +52,43 @@ class SUSETagger(VersionTagger): debug("Skipping changelog generation.") return + newname = self.changes_file + ".new" in_f = open(self.changes_file, 'r') - out_f = open(self.changes_file + ".new", 'w') - + out_f = open(newname, 'w') old_version = get_latest_tagged_version(self.project_name) + output = self._new_changelog_msg # don't die if this is a new package with no history if old_version != None: last_tag = "%s-%s" % (self.project_name, old_version) - output = self._generate_default_changelog(last_tag) - else: - output = self._new_changelog_msg + if self._no_default_changelog: + output = "" + else: + output = self._generate_default_changelog(last_tag) - fd, name = tempfile.mkstemp() - os.write(fd, "# Create your changelog entry below:\n") header = "-------------------------------------------------------------------\n" header = header + "%s - %s\n\n" % (self.today, self.git_email) - os.write(fd, header) + out_f.write(header) for cmd_out in output.split("\n"): - os.write(fd, "- ") - os.write(fd, "\n ".join(textwrap.wrap(cmd_out, 77))) - os.write(fd, "\n") + out_f.write("- ") + out_f.write("\n ".join(textwrap.wrap(cmd_out, 77))) + out_f.write("\n") - os.write(fd, "\n") + out_f.write("\n") - if not self._accept_auto_changelog: - os.write(fd, "###################################################\n") - os.write(fd, "# These are the already existing changelog entries:\n") - os.write(fd, "###################################################\n") - for line in in_f.readlines(): - os.write(fd, "#" + line) - in_f.seek(0, 0) + for line in in_f.readlines(): + out_f.write(line) + out_f.flush() + if not self._accept_auto_changelog: # Give the user a chance to edit the generated changelog: editor = 'vi' if "EDITOR" in os.environ: editor = os.environ["EDITOR"] - subprocess.call([editor, name]) - - os.lseek(fd, 0, 0) - file = os.fdopen(fd) - - for line in file.readlines(): - if not line.startswith("#"): - out_f.write(line) - - output = file.read() - - file.close() - os.unlink(name) - - for line in in_f.readlines(): - out_f.write(line) + subprocess.call([editor, newname]) in_f.close() out_f.close()
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor