From nobody Tue Apr 23 09:32:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1523781317940924.1039026131793; Sun, 15 Apr 2018 01:35:17 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A68CE30C0A00; Sun, 15 Apr 2018 08:35:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6960B81867; Sun, 15 Apr 2018 08:35:16 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1F4A75BBFD; Sun, 15 Apr 2018 08:35:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3C7jmGN007878 for ; Thu, 12 Apr 2018 03:45:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 70A53AFD79; Thu, 12 Apr 2018 07:45:48 +0000 (UTC) Received: from dnr.brq.redhat.com (unknown [10.43.2.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15C08AFD71 for ; Thu, 12 Apr 2018 07:45:45 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Thu, 12 Apr 2018 09:45:32 +0200 Message-Id: <56028cea5fbb386a9463eb32f6998b884b568379.1523518993.git.jtomko@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [not libvirt PATCH] rcc - resolve capabilities conflicts X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Sun, 15 Apr 2018 08:35:17 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 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=C3=A1n Tomko + +use warnings; +use v5.10; + +use Git; + +sub union_merge { + my $filename =3D shift; + + open FILE, '<', $filename or die "cannot open $file: $!"; + my @original =3D ; + close FILE; + + my @fixed; + foreach (@original) { + if (/^<<<<>>>>/) { + next; + } + + push @fixed, $_; + } + + open FILE, '>', $filename or die "cannot open $file: $!"; + foreach my $line (@fixed) { + print FILE $line; + } + close FILE; +} + +my $repo =3D Git->repository(Directory =3D> '.'); +my ($status_fh, $ctx) =3D $repo->command_output_pipe('status', '--porcelai= n'); + +while (<$status_fh>) { + my ($flag, $filename) =3D split; + if ($flag eq 'UU') { + if ($filename =3D~ '^src/qemu/qemu_capabilities.[ch]$' or + $filename =3D~ '^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'); --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list