rcc | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 rcc
my tool for naively resolving qemu capabilities conflicts after a
rebase, that used to contain my latest syntax-check addition
---
rcc | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
create mode 100755 rcc
diff --git a/rcc b/rcc
new file mode 100755
index 0000000..e0fdf41
--- /dev/null
+++ b/rcc
@@ -0,0 +1,62 @@
+#!/usr/bin/env perl
+# Automatically resolve QEMU capability conflicts
+#
+# Joins both parts of the conflicting hunk in
+# qemu_capabilities.[ch] and qemucapabilitiesdata XML
+#
+# Also rewraps the groups in qemu_capabilities.c if needed
+# and stages all the affected files.
+#
+# Author: Ján Tomko <jtomko@redhat.com>
+
+use warnings;
+use v5.10;
+
+use Git;
+
+sub union_merge {
+ my $filename = shift;
+
+ open FILE, '<', $filename or die "cannot open $file: $!";
+ my @original = <FILE>;
+ close FILE;
+
+ my @fixed;
+ foreach (@original) {
+ if (/^<<<<</) {
+ next;
+ } elsif (/^=====/) {
+ next;
+ } elsif (/^>>>>>/) {
+ next;
+ }
+
+ push @fixed, $_;
+ }
+
+ open FILE, '>', $filename or die "cannot open $file: $!";
+ foreach my $line (@fixed) {
+ print FILE $line;
+ }
+ close FILE;
+}
+
+my $repo = Git->repository(Directory => '.');
+my ($status_fh, $ctx) = $repo->command_output_pipe('status', '--porcelain');
+
+while (<$status_fh>) {
+ my ($flag, $filename) = split;
+ if ($flag eq 'UU') {
+ if ($filename =~ '^src/qemu/qemu_capabilities.[ch]$' or
+ $filename =~ '^tests/qemucapabilitiesdata/caps.*xml') {
+ say "Trying to fix $filename";
+ &union_merge($filename);
+ $repo->command('add', $filename);
+ }
+ }
+}
+$repo->command_close_pipe($status_fh, $ctx);
+system('tests/group-qemu-caps.pl');
+$repo->command('add', 'src/qemu/qemu_capabilities.c');
+$repo->command('add', 'src/qemu/qemu_capabilities.h');
+$repo->command('rebase', '--continue');
--
2.13.6
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Thu, Apr 12, 2018 at 09:45:32 +0200, Ján Tomko wrote: > my tool for naively resolving qemu capabilities conflicts after a > rebase, that used to contain my latest syntax-check addition > --- > rcc | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 62 insertions(+) > create mode 100755 rcc [...] > +while (<$status_fh>) { > + my ($flag, $filename) = split; > + if ($flag eq 'UU') { > + if ($filename =~ '^src/qemu/qemu_capabilities.[ch]$' or > + $filename =~ '^tests/qemucapabilitiesdata/caps.*xml') { > + say "Trying to fix $filename"; > + &union_merge($filename); > + $repo->command('add', $filename); > + } > + } > +} > +$repo->command_close_pipe($status_fh, $ctx); > +system('tests/group-qemu-caps.pl'); did you forget to attach this file? :) > +$repo->command('add', 'src/qemu/qemu_capabilities.c'); > +$repo->command('add', 'src/qemu/qemu_capabilities.h'); > +$repo->command('rebase', '--continue'); For some reason this does not work for me. With the default editor it locks up in 'hint: Waiting for your editor to close the file...'. If I set the editor to true it at least fails in a state where I can continue manually. Very cool tool though. > -- > 2.13.6 > > -- > libvir-list mailing list > libvir-list@redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
On Wed, Apr 18, 2018 at 05:52:26PM +0200, Peter Krempa wrote: >On Thu, Apr 12, 2018 at 09:45:32 +0200, Ján Tomko wrote: >> my tool for naively resolving qemu capabilities conflicts after a >> rebase, that used to contain my latest syntax-check addition >> --- >> rcc | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 62 insertions(+) >> create mode 100755 rcc > >[...] > >> +while (<$status_fh>) { >> + my ($flag, $filename) = split; >> + if ($flag eq 'UU') { >> + if ($filename =~ '^src/qemu/qemu_capabilities.[ch]$' or >> + $filename =~ '^tests/qemucapabilitiesdata/caps.*xml') { >> + say "Trying to fix $filename"; >> + &union_merge($filename); >> + $repo->command('add', $filename); >> + } >> + } >> +} >> +$repo->command_close_pipe($status_fh, $ctx); >> +system('tests/group-qemu-caps.pl'); > >did you forget to attach this file? :) > https://www.redhat.com/archives/libvir-list/2018-April/msg00941.html 9e72a4444dd722b28a888165be3b9da0dddab907.1523518807.git.jtomko@redhat.com [libvirt] [PATCH] syntax-check: check QEMU caps grouping Jano -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2025 Red Hat, Inc.