diff --git a/CI/deb_changelog.py b/CI/deb_changelog.py index aaef5b4771..a18d642924 100644 --- a/CI/deb_changelog.py +++ b/CI/deb_changelog.py @@ -1,5 +1,6 @@ from argparse import ArgumentParser from datetime import datetime, timezone +import re IGNORE_SEGMENTS = ['Github Actions:'] @@ -11,14 +12,15 @@ if __name__ == '__main__': parser.add_argument('-u', '--urgency', type=str, default='low', help='Urgency of the package') args = parser.parse_args() build_time = datetime.now(timezone.utc).strftime('%a, %d %b %Y %H:%M:%S %z') # day-of-week, dd month yyyy hh:mm:ss +zzzz - with open('ChangeLog', 'r') as in_file, open('debian/changelog', 'w+') as out_file: - out_file.write(f'{args.name} ({args.version}) {args.distribution}; urgency={args.urgency}\n') + version_str = re.match('^(\d+.\d+.\d+).*$', args.version).group(1) + with open('ChangeLog', 'r', encoding='utf8') as in_file, open('debian/changelog', 'w+', encoding='utf8') as out_file: + out_file.write('{} ({}) {}; urgency={}\n'.format(args.name, args.version, args.distribution, args.urgency)) in_section = False ignore_segment = False - - while line := in_file.readline(): + line = in_file.readline() + while line: if line.startswith('v'): - if line.startswith(f'v{args.version}'): + if line.startswith('v{}'.format(version_str)): in_section = True elif in_section: break @@ -29,10 +31,11 @@ if __name__ == '__main__': elif line.strip() in IGNORE_SEGMENTS: ignore_segment = True elif line.strip().endswith(':'): - out_file.write(f'\n * {line.strip()[:-1]}') + out_file.write('\n * {}'.format(line.strip()[:-1])) else: if in_section and not ignore_segment: while line.startswith(('#', '|', '-')): line = ' '.join(line.split()[1:]) - out_file.write(f'\n - {line}') - out_file.write(f'\n\n -- Symless {build_time}') + out_file.write('\n - {}'.format(line)) + line = in_file.readline() + out_file.write('\n\n -- Symless {}\n'.format(build_time)) diff --git a/ChangeLog b/ChangeLog index afc928db00..7a602af6a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,7 +16,7 @@ Github Actions: - #7156 Change binary storage server - #7161 Use brew bundle to install dependencies - #7162 Add new distributions to CI -- #7167 Use changelog when creating deb files +- #7167 | #7168 Use changelog when creating deb files - #7169 Remove temporary directory when building debs ===========