Sometimes we don't regenerate QEMU capabilities replies using QEMU
binary but we simply add a new entry manually. In that case you need
to manually fix all the replies ids. This helper will do that for you.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
tests/qemucapsfixreplies | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
create mode 100755 tests/qemucapsfixreplies
diff --git a/tests/qemucapsfixreplies b/tests/qemucapsfixreplies
new file mode 100755
index 0000000000..25b1e597a9
--- /dev/null
+++ b/tests/qemucapsfixreplies
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+if [ "$1" == "--help" ] || [ $# != 1 ] || [ ! -f $1 ]; then
+ echo "This script fixes replies ids in QEMU replies files."
+ echo ""
+ echo " Usage: $0 path/to/qemu.replies"
+ exit 0;
+fi
+
+awk -i inplace \
+ 'BEGIN {count=1; pattern="libvirt-[0-9]+"}
+ {
+ if (match($0, "libvirt-1[^0-9]")) {
+ count=1;
+ }
+ if (match($0, pattern)) {
+ str="libvirt-" count;
+ sub(pattern, str, $0);
+ count++;
+ }
+ print
+ }' $1
--
2.14.3