From: Ian Jackson Subject: [OSSTEST PATCH 2/6] cs-adjust-flight: Support negation of foo-specs Date: Tue, 31 Mar 2015 15:18:41 +0100 Message-ID: <1427811525-14259-3-git-send-email-ian.jackson@eu.citrix.com> References: <1427811525-14259-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Ycx4o-0005g6-5X for xen-devel@lists.xenproject.org; Tue, 31 Mar 2015 14:23:34 +0000 In-Reply-To: <1427811525-14259-1-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org Signed-off-by: Ian Jackson --- cs-adjust-flight | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cs-adjust-flight b/cs-adjust-flight index 9bd8757..9e011c6 100755 --- a/cs-adjust-flight +++ b/cs-adjust-flight @@ -93,10 +93,12 @@ sub for_things ($$$$$$$) { my $things_q = $things_q{$table} ||= $dbh_tests->prepare ("SELECT * FROM $table WHERE $basecond"); + my $not = ($spec =~ s/^\!//) ? 'NOT' : ''; my $re = spec_re($spec); - debug("FOR_THINGS $table.$keycol \`$spec' RE ", + debug("FOR_THINGS $table.$keycol $not \`$spec' RE ", (defined($re) ? "/$re/" : ""), "\n"); if (!defined $re) { + die "cannot negate " if $not; $thing_q->execute(@$basecondvals, $spec); my $row = $thing_q->fetchrow_hashref(); if ($row) { @@ -112,8 +114,8 @@ sub for_things ($$$$$$$) { $things_q->execute(@$basecondvals); while (my $row = $things_q->fetchrow_hashref()) { my $thing = $row->{$keycol}; - next unless $thing =~ m/$re/; - debug("FOR_THINGS $table.$keycol \`$spec' FOUND $row->{$keycol}\n"); + next unless $thing =~ m/$re/ xor $not; + debug("FOR_THINGS $table.$keycol $not \`$spec' FOUND $row->{$keycol}\n"); $fn->($thing, $row); } } -- 1.7.10.4