Extract 3 segment version from long version string (#7168)
* Extract 3 segment version from long version string * Update changelog * Fix for older versions of python
This commit is contained in:
parent
37301d70a3
commit
fc29ec91a9
2 changed files with 12 additions and 9 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
|
import re
|
||||||
|
|
||||||
IGNORE_SEGMENTS = ['Github Actions:']
|
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')
|
parser.add_argument('-u', '--urgency', type=str, default='low', help='Urgency of the package')
|
||||||
args = parser.parse_args()
|
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
|
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:
|
version_str = re.match('^(\d+.\d+.\d+).*$', args.version).group(1)
|
||||||
out_file.write(f'{args.name} ({args.version}) {args.distribution}; urgency={args.urgency}\n')
|
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
|
in_section = False
|
||||||
ignore_segment = False
|
ignore_segment = False
|
||||||
|
line = in_file.readline()
|
||||||
while line := in_file.readline():
|
while line:
|
||||||
if line.startswith('v'):
|
if line.startswith('v'):
|
||||||
if line.startswith(f'v{args.version}'):
|
if line.startswith('v{}'.format(version_str)):
|
||||||
in_section = True
|
in_section = True
|
||||||
elif in_section:
|
elif in_section:
|
||||||
break
|
break
|
||||||
|
|
@ -29,10 +31,11 @@ if __name__ == '__main__':
|
||||||
elif line.strip() in IGNORE_SEGMENTS:
|
elif line.strip() in IGNORE_SEGMENTS:
|
||||||
ignore_segment = True
|
ignore_segment = True
|
||||||
elif line.strip().endswith(':'):
|
elif line.strip().endswith(':'):
|
||||||
out_file.write(f'\n * {line.strip()[:-1]}')
|
out_file.write('\n * {}'.format(line.strip()[:-1]))
|
||||||
else:
|
else:
|
||||||
if in_section and not ignore_segment:
|
if in_section and not ignore_segment:
|
||||||
while line.startswith(('#', '|', '-')):
|
while line.startswith(('#', '|', '-')):
|
||||||
line = ' '.join(line.split()[1:])
|
line = ' '.join(line.split()[1:])
|
||||||
out_file.write(f'\n - {line}')
|
out_file.write('\n - {}'.format(line))
|
||||||
out_file.write(f'\n\n -- Symless <engineering@symless.com> {build_time}')
|
line = in_file.readline()
|
||||||
|
out_file.write('\n\n -- Symless <engineering@symless.com> {}\n'.format(build_time))
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ Github Actions:
|
||||||
- #7156 Change binary storage server
|
- #7156 Change binary storage server
|
||||||
- #7161 Use brew bundle to install dependencies
|
- #7161 Use brew bundle to install dependencies
|
||||||
- #7162 Add new distributions to CI
|
- #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
|
- #7169 Remove temporary directory when building debs
|
||||||
===========
|
===========
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue