[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH 2/6] cs-adjust-flight: Support negation of foo-specs



Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 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/" : "<undef>"), "\n");
     if (!defined $re) {
+       die "cannot negate <foo-name>" 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


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.