Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:cbbayburt:Uyuni:Utils
tito
0014-changelog-split-merge.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0014-changelog-split-merge.patch of Package tito
From: Can Bulut Bayburt <cbbayburt@suse.com> Date: Fri, 2 Jun 2023 14:36:31 +0200 Subject: [PATCH] Implement changelog split/merge --- src/tito/tagger/susetagger.py | 45 +++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/src/tito/tagger/susetagger.py b/src/tito/tagger/susetagger.py index 78735c8..96e4dd5 100644 --- a/src/tito/tagger/susetagger.py +++ b/src/tito/tagger/susetagger.py @@ -10,6 +10,7 @@ Code for tagging packages in SUSE Style. """ import os +from glob import glob import re import sys try: @@ -48,7 +49,45 @@ def __init__(self, config=None, keep_version=False, offline=False, user_config=N if self.remote == "": print("ERROR: Your current branch does not track a remote branch!") sys.exit(1) - + + + def _compile_changelog(self): + """ + Compile feature changelogs (.changes.*) into a single file (.changes) + """ + # Collect feature changelogs + # Standard filename format: <package>.changes.<author>.<feature> + chfiles = glob(self.changes_file + '.*') + + if not chfiles: + # No compilation needed + return + + tmpname = self.changes_file + ".tmp" + out_f = open(tmpname, 'w') + + for file in chfiles: + with open(file, 'r') as in_f: + for line in in_f.readlines(): + if not line.endswith('\n'): + line = line + '\n' + out_f.write(line) + + # Append the entries from the previous versions + with open(self.changes_file, 'r') as in_f: + line = in_f.readline() + if re.match(r'^-{8,}$', line): + out_f.write('\n') + out_f.write(line) + for line in in_f.readlines(): + out_f.write(line) + + out_f.flush() + shutil.move(self.changes_file + ".tmp", self.changes_file) + + # Delete feature changelogs + run_command('git rm %s' % ' '.join(chfiles)) + def _make_changelog(self): """ @@ -58,6 +97,9 @@ def _make_changelog(self): debug("Skipping changelog generation.") return + # Compile feature changelogs into the master changelog file + self._compile_changelog() + newname = self.changes_file + ".new" in_f = open(self.changes_file, 'r') out_f = open(newname, 'w') @@ -176,4 +218,3 @@ def _update_package_metadata(self, new_version): print(" Undo: tito tag -u") print(" Push: git push {0} HEAD && git push {0} {1}".format(self.remote, new_tag)) print("or Push: git push {0} HEAD && git push {0} --tags".format(self.remote)) - -- 2.41.0
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