diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-08 03:22:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-08 03:26:40 +0000 |
commit | 08f003891b84f52e49a5bdbc8a589fb052ac9a4e (patch) | |
tree | b7e426b4a4eb48e9e71188a2812a4c71625c35ac /debian/bin | |
parent | Merging upstream version 4.19.260. (diff) | |
download | linux-08f003891b84f52e49a5bdbc8a589fb052ac9a4e.tar.xz linux-08f003891b84f52e49a5bdbc8a589fb052ac9a4e.zip |
Merging debian version 4.19.260-1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/bin')
-rwxr-xr-x | debian/bin/genpatch-rt | 76 |
1 files changed, 42 insertions, 34 deletions
diff --git a/debian/bin/genpatch-rt b/debian/bin/genpatch-rt index e61b5f242..c0f1a611d 100755 --- a/debian/bin/genpatch-rt +++ b/debian/bin/genpatch-rt @@ -1,5 +1,6 @@ #!/usr/bin/python3 +import argparse import codecs import io import os @@ -7,11 +8,10 @@ import os.path import re import shutil import subprocess -import sys import tempfile -def main(source, version=None): +def main(source, version, verify_signature): patch_dir = 'debian/patches-rt' series_name = 'series' old_series = set() @@ -52,15 +52,16 @@ def main(source, version=None): env['GIT_DIR'] = os.path.join(source, '.git') env['DEBIAN_KERNEL_KEYRING'] = 'rt-signing-key.pgp' - # Validate tag signature - gpg_wrapper = os.path.join(os.getcwd(), - "debian/bin/git-tag-gpg-wrapper") - verify_proc = subprocess.Popen( - ['git', '-c', 'gpg.program=%s' % gpg_wrapper, - 'tag', '-v', 'v%s-rebase' % version], - env=env) - if verify_proc.wait(): - raise RuntimeError("GPG tag verification failed") + if verify_signature: + # Validate tag signature + gpg_wrapper = os.path.join(os.getcwd(), + "debian/bin/git-tag-gpg-wrapper") + verify_proc = subprocess.Popen( + ['git', '-c', 'gpg.program=%s' % gpg_wrapper, + 'tag', '-v', 'v%s-rebase' % version], + env=env) + if verify_proc.wait(): + raise RuntimeError("GPG tag verification failed") args = ['git', 'format-patch', 'v%s..v%s-rebase' % (up_ver, version)] @@ -91,21 +92,22 @@ def main(source, version=None): assert match, 'could not parse version string' up_ver = match.group(1) - # Expect an accompanying signature, and validate it - source_sig = re.sub(r'.[gx]z$', '.sign', source) - unxz_proc = subprocess.Popen(['xzcat', source], - stdout=subprocess.PIPE) - verify_output = subprocess.check_output( - ['gpgv', '--status-fd', '1', - '--keyring', 'debian/upstream/rt-signing-key.pgp', - '--ignore-time-conflict', source_sig, '-'], - stdin=unxz_proc.stdout) - if unxz_proc.wait() or \ - not re.search(r'^\[GNUPG:\]\s+VALIDSIG\s', - codecs.decode(verify_output), - re.MULTILINE): - os.write(2, verify_output) # bytes not str! - raise RuntimeError("GPG signature verification failed") + if verify_signature: + # Expect an accompanying signature, and validate it + source_sig = re.sub(r'.[gx]z$', '.sign', source) + unxz_proc = subprocess.Popen(['xzcat', source], + stdout=subprocess.PIPE) + verify_output = subprocess.check_output( + ['gpgv', '--status-fd', '1', + '--keyring', 'debian/upstream/rt-signing-key.pgp', + '--ignore-time-conflict', source_sig, '-'], + stdin=unxz_proc.stdout) + if unxz_proc.wait() or \ + not re.search(r'^\[GNUPG:\]\s+VALIDSIG\s', + codecs.decode(verify_output), + re.MULTILINE): + os.write(2, verify_output) # bytes not str! + raise RuntimeError("GPG signature verification failed") temp_dir = tempfile.mkdtemp(prefix='rt-genpatch', dir='debian') try: @@ -142,11 +144,17 @@ def main(source, version=None): if __name__ == '__main__': - if not (1 <= len(sys.argv) <= 3): - print('Usage: %s {TAR [RT-VERSION] | REPO RT-VERSION}' % sys.argv[0], - file=sys.stderr) - print('TAR is a tarball of patches.', file=sys.stderr) - print('REPO is a git repo containing the given RT-VERSION.', - file=sys.stderr) - sys.exit(2) - main(*sys.argv[1:]) + parser = argparse.ArgumentParser( + description='Generate or update the rt featureset patch series') + parser.add_argument( + 'source', metavar='SOURCE', type=str, + help='tarball of patches or git repo containing the given RT-VERSION') + parser.add_argument( + 'version', metavar='RT-VERSION', type=str, nargs='?', + help='rt kernel version (optional for tarballs)') + parser.add_argument( + '--verify-signature', action=argparse.BooleanOptionalAction, + default=True, + help='verify signature on tarball (detached in .sign file) or git tag') + args = parser.parse_args() + main(args.source, args.version, args.verify_signature) |