mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-03 11:51:11 +00:00
b1acfaaf89
Since e6be524508
we include the executed command along
with the reply in *.replies files, which breaks the
renumbering logic implemented in qemucapsfixreplies.
Adapt the script so that it works with the new format.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
27 lines
618 B
Bash
Executable File
27 lines
618 B
Bash
Executable File
#!/bin/sh
|
|
|
|
if [ "$#" -ne 1 ] || [ "$1" = "--help" ] || [ ! -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 {last=0; pattern="libvirt-[0-9]+"}
|
|
{
|
|
if (match($0, "libvirt-1[^0-9]")) {
|
|
count=1;
|
|
}
|
|
if (match($0, pattern)) {
|
|
str="libvirt-" count;
|
|
sub(pattern, str, $0);
|
|
if (last != count) {
|
|
last=count;
|
|
} else {
|
|
count++;
|
|
}
|
|
}
|
|
print
|
|
}' "$1"
|