Add changelogs to deb's (#7167)

* Add changelogs to deb's

* Update changelog

* Fix code smell
This commit is contained in:
Kyle Bloom 2022-05-12 09:27:59 +01:00 committed by GitHub
parent 322e583917
commit 5711a5346f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 45 additions and 4 deletions

View file

@ -62,7 +62,7 @@ jobs:
SYNERGY_VERSION_STAGE: ${{ steps.version.outputs.SYNERGY_VERSION_STAGE }}
run: |
sed -i "s/ synergy/ ${PACKAGE_NAME}/g" ./debian/control
dch --create --package "${PACKAGE_NAME}" --controlmaint --distribution unstable --newversion $SYNERGY_DEB_VERSION "Initial release"
python3 CI/deb_changelog.py "${PACKAGE_NAME}" "$(SYNERGY_DEB_VERSION)"
debuild --preserve-envvar SYNERGY_* --preserve-envvar GIT_COMMIT -us -uc
mkdir -p package
cd ..

View file

@ -95,7 +95,7 @@ steps:
displayName: "Setup variables"
- script: |
dch --create --package "synergy" --controlmaint --distribution unstable --newversion $SYNERGY_DEB_VERSION "Initial release"
python3 CI/deb_changelog.py synergy "$(SYNERGY_DEB_VERSION)"
export GPG_TTY=$(tty)
debuild --preserve-envvar SYNERGY_* --preserve-envvar GIT_COMMIT -us -uc
mkdir standard_package
@ -115,7 +115,7 @@ steps:
- script: |
export SYNERGY_ENTERPRISE=1
dch --create --package "synergy-enterprise_" --controlmaint --distribution unstable --newversion $(SYNERGY_DEB_VERSION) "Initial release"
python3 CI/deb_changelog.py synergy-enterprise "$(SYNERGY_DEB_VERSION)"
export GPG_TTY=$(tty)
debuild --preserve-envvar SYNERGY_* --preserve-envvar GIT_COMMIT -us -uc
mkdir enterprise_package
@ -135,7 +135,7 @@ steps:
- script: |
export SYNERGY_BUSINESS=1
dch --create --package "synergy-business_" --controlmaint --distribution unstable --newversion $(SYNERGY_DEB_VERSION) "Initial release"
python3 CI/deb_changelog.py synergy-business "$(SYNERGY_DEB_VERSION)"
export GPG_TTY=$(tty)
debuild --preserve-envvar SYNERGY_* --preserve-envvar GIT_COMMIT -us -uc
mkdir business_package

38
CI/deb_changelog.py Normal file
View file

@ -0,0 +1,38 @@
from argparse import ArgumentParser
from datetime import datetime, timezone
IGNORE_SEGMENTS = ['Github Actions:']
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument('name', type=str, help='Name of the package')
parser.add_argument('version', type=str, help='Version of the package')
parser.add_argument('-d', '--distribution', type=str, default='unstable', help='Distribution the package is built for')
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')
in_section = False
ignore_segment = False
while line := in_file.readline():
if line.startswith('v'):
if line.startswith(f'v{args.version}'):
in_section = True
elif in_section:
break
elif not in_section:
continue
elif line.strip().replace('=', '') == '':
ignore_segment = False
elif line.strip() in IGNORE_SEGMENTS:
ignore_segment = True
elif line.strip().endswith(':'):
out_file.write(f'\n * {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 <engineering@symless.com> {build_time}')

View file

@ -16,6 +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
===========
v1.14.3-snapshot

2
debian/source/lintian-overrides vendored Normal file
View file

@ -0,0 +1,2 @@
file-without-copyright-information
binary-without-manpage