diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2022-04-20 17:33:54 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2022-05-07 07:46:58 +0200 |
commit | b0b4323e3219810d14f36c159e67a8332a86f9fd (patch) | |
tree | 54c41a5e9a932469ccead443b8ce9d5108495289 /scripts/qemu-stamp.py | |
parent | 622d64fffe4f287af4f0d5e438d4aa42da377811 (diff) | |
download | qemu-b0b4323e3219810d14f36c159e67a8332a86f9fd.zip qemu-b0b4323e3219810d14f36c159e67a8332a86f9fd.tar.gz qemu-b0b4323e3219810d14f36c159e67a8332a86f9fd.tar.bz2 |
meson, configure: move --with-pkgversion, CONFIG_STAMP to meson
The hash is now generated with a Python script.
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'scripts/qemu-stamp.py')
-rw-r--r-- | scripts/qemu-stamp.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/qemu-stamp.py b/scripts/qemu-stamp.py new file mode 100644 index 0000000..7beeeb0 --- /dev/null +++ b/scripts/qemu-stamp.py @@ -0,0 +1,24 @@ +#! /usr/bin/env python3 + +# Usage: scripts/qemu-stamp.py STRING1 STRING2... -- FILE1 FILE2... +import hashlib +import os +import sys + +sha = hashlib.sha1() +is_file = False +for arg in sys.argv[1:]: + if arg == '--': + is_file = True + continue + if is_file: + with open(arg, 'rb') as f: + for chunk in iter(lambda: f.read(65536), b''): + sha.update(chunk) + else: + sha.update(os.fsencode(arg)) + sha.update(b'\n') + +# The hash can start with a digit, which the compiler doesn't +# like as an symbol. So prefix it with an underscore +print("_" + sha.hexdigest()) |