From 2a0dc5aae973e71a6a4024fd656e418a60fa2fcf Mon Sep 17 00:00:00 2001 From: John Johansen Date: Fri, 18 Apr 2008 20:57:51 +0000 Subject: [PATCH] keep change_hat rules --- utils/SubDomain.pm | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/utils/SubDomain.pm b/utils/SubDomain.pm index 5cfae245b..25733a62d 100755 --- a/utils/SubDomain.pm +++ b/utils/SubDomain.pm @@ -4354,7 +4354,17 @@ sub parse_profile_data { # keep track of netdomain entries... push @{$profile_data->{$profile}{$hat}{netdomain}}, $_; - } elsif (m/^\s*\^(\"?.+?)\s+(flags=\(.+\)\s+)*\{\s*(#.*)?$/) { + } elsif (m/^\s*\^(\"??.+?\"??)\s*,\s*(#.*)?$/) { + # change_hat declaration - needed to change_hat to an external + # hat + $hat = $1; + $hat = $1 if $hat =~ /^"(.+)"$/; + + #store we have a declaration if the hat hasn't been seen + $profile_data->{$profile}{$hat}{'declared'} = 1 + unless exists($profile_data->{$profile}{$hat}{declared}); + + } elsif (m/^\s*\^(\"??.+?\"??)\s+(flags=\(.+\)\s+)*\{\s*(#.*)?$/) { # start of a deprecated syntax hat definition # read in and mark as changed so that will be written out in the new # format @@ -4369,17 +4379,16 @@ sub parse_profile_data { # we hit the start of a hat inside the current profile $hat = $1; - my $flags = $2; + my $flags = $3; - # deal with whitespace in hat names. + # strip quotes. $hat = $1 if $hat =~ /^"(.+)"$/; # keep track of profile flags - if ($flags && $flags =~ /^flags=\((.+)\)\s*$/) { - $flags = $1; - $profile_data->{$profile}{$hat}{flags} = $flags; - } + $profile_data->{$profile}{$hat}{flags} = $flags; + # we have seen more than a declaration so clear it + $profile_data->{$profile}{$hat}{'declared'} = 0; $profile_data->{$profile}{$hat}{path} = { }; $profile_data->{$profile}{$hat}{netdomain} = { }; @@ -4390,7 +4399,6 @@ sub parse_profile_data { # mark as changed so the profile will always be written out $changed{$profile} = 1; - } elsif (/^\s*\#/) { # we only currently handle initial comments if (not $profile) {