From 00c9408cc61cece9147c98f3f715e435b4a462b5 Mon Sep 17 00:00:00 2001 From: Arthur Xiong Date: Fri, 7 May 2010 05:40:10 +0000 Subject: 1) skip comment and empty lines in priority file; 2) remove priority from node.def when priority value is 0 in priority file; 3) copy over comment and empty lines in the beginning of node.def --- scripts/update-priority.pl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/update-priority.pl b/scripts/update-priority.pl index 84b4933..feb1e7f 100644 --- a/scripts/update-priority.pl +++ b/scripts/update-priority.pl @@ -38,7 +38,7 @@ my $prefix = $ARGV[1]; open my $pf, '<', $priority_file or die "$priority_file can't be opened"; while (<$pf>) { chomp; - next if /^#.*/; + next if /^#.*/ or /^$/; die "Syntax Error \"$_\"" unless /^(\d+)\s+(\S+)(|\s+|\s+#.*)$/; $priority = $1; $path = $2; @@ -55,11 +55,12 @@ while (<$pf>) { open my $nf, '<', $node_def or die "$node_def can't be opened"; open my $nfn, '>', "$node_def.new" or die "$node_def.new can't be opened"; while (<$nf>) { - print $nfn $_ if /^(tag|multi):/; - print $nfn $priority_line; - print $nfn $_ unless /^priority:\s(\d+)/ or /^(tag|multi):/; - last if $. == 1; + last unless /^#.*/ or /^$/; + print $nfn $_; } + print $nfn $_ if /^(tag|multi):/; + print $nfn $priority_line if $priority != 0; + print $nfn $_ unless /^priority:\s(\d+)/ or /^(tag|multi):/; while (<$nf>) { print $nfn $_ unless /^priority:\s(\d+)/; } -- cgit v1.2.3