backends/host_iommu_device: Introduce HostIOMMUDeviceCaps
[qemu/armbru.git] / scripts / qemu-stamp.py
blob7beeeb07eddfd110b1f68e080ac28013ac221cb4
1 #! /usr/bin/env python3
3 # Usage: scripts/qemu-stamp.py STRING1 STRING2... -- FILE1 FILE2...
4 import hashlib
5 import os
6 import sys
8 sha = hashlib.sha1()
9 is_file = False
10 for arg in sys.argv[1:]:
11 if arg == '--':
12 is_file = True
13 continue
14 if is_file:
15 with open(arg, 'rb') as f:
16 for chunk in iter(lambda: f.read(65536), b''):
17 sha.update(chunk)
18 else:
19 sha.update(os.fsencode(arg))
20 sha.update(b'\n')
22 # The hash can start with a digit, which the compiler doesn't
23 # like as an symbol. So prefix it with an underscore
24 print("_" + sha.hexdigest())