]> xenbits.xensource.com Git - people/royger/osstest.git/commitdiff
mg-hosts: Use ^ for flag negation, not !
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 3 May 2018 14:40:31 +0000 (15:40 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 3 May 2018 14:51:00 +0000 (15:51 +0100)
We still honour (and document) !

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
README.dev
mg-hosts

index 5787bd8d6950cd4b431aa289c9cba8a37344590c..ddfac309e6dfeb6fb439ddee2297e4b5f5ecbd1c 100644 (file)
@@ -145,7 +145,7 @@ Bless
 Once machines are ready for production use remove the commission
 blessing and add the production ones, e.g.
 
- $ ./mg-hosts setflags mudcake{0,1} -- \!blessed-commission blessed-{real,play,adhoc}
+ $ ./mg-hosts setflags mudcake{0,1} -- ^blessed-commission blessed-{real,play,adhoc}
 
 
 Shutting down the whole system
index 9ac1990e427746730d718cc76fd8b739cbaadf73..5361eb639a7a41704ad88810c2dc0355eb595651 100755 (executable)
--- a/mg-hosts
+++ b/mg-hosts
@@ -70,9 +70,9 @@
 #  ./mg-hosts showflags
 #               Print a table showing the flags of all hosts.
 #
-#  ./mg-hosts setflags HOSTGLOB... -|-- !FLAG|-FLAG|FLAG...
-#               Updates some flags of the specified hosts.  !FLAG and
-#               -FLAG both clear the flag; FLAG sets it.
+#  ./mg-hosts setflags HOSTGLOB... -|-- ^FLAG|FLAG...
+#               Updates some flags of the specified hosts.  ^FLAG
+#               (or -FLAG or !FLAG) clears the flag; FLAG sets it.
 #
 #  ./mg-hosts setflagexpr HOSTGLOB... - FLAG EXPR [-|-- FLAG EXPR...]
 #               Sets or clears some flags of the specified hosts,
@@ -84,8 +84,9 @@
 #               decreasing order of precedence):
 #                   FLAG         true iff FLAG is set for the host
 #                   (EXPR)       override precedence
-#                   !EXPR        boolean negation } alternative
-#                   ~EXPR        boolean negation }  equivalent syntax
+#                   ^EXPR        boolean negation } alternative
+#                   ~EXPR        boolean negation }  equivalent
+#                   !EXPR        boolean negation }  syntax
 #                   EXPR&EXPR    boolean "and"
 #                   EXPR|EXPR    boolean inclusive-or
 #               Spaces and tabs are disregarded (outside FLAG names).
@@ -428,8 +429,8 @@ sub cmd_setflags () {
        die unless @$section;
        foreach my $flagorig (@$section) {
            my $flag = $flagorig;
-           # each flag may start with - or ! to remove
-            my $remove= $flag =~ s/^[-!]//;
+           # each flag may start with ^ (or - or !) to remove
+            my $remove= $flag =~ s/^[-!^]//;
            setflagval($dst,$flag,!$remove);
         }
     });
@@ -443,14 +444,14 @@ END
        my ($dst,$section) = @_;
        die unless @$section == 2;
        my ($dstflag, $expr) = @$section;
-       die "$expr $& ?" if $expr =~ m/[^-0-9a-z_&|()!~ \t]/;
+       die "$expr $& ?" if $expr =~ m/[^-0-9a-z_&|()!~ \t^]/;
 
        my %inputs;
        $expr =~ s{[-0-9a-z_]+}{
                 $inputs{$&} = undef;
                 " \$inputs{'$&'} ";
             }ge;
-       $expr =~ s/\~/!/g;
+       $expr =~ s/[~^]/!/g;
        $expr =~ s/[&|]/$&$&/g;
 
        foreach my $flagorig (sort keys %inputs) {