From: Alan T. DeKok Date: Thu, 21 Oct 2021 15:02:43 +0000 (-0400) Subject: fixes X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=52c35b5f41ffe0a6fab7beac554e5059d8e0ba3f;p=thirdparty%2Ffreeradius-server.git fixes --- diff --git a/scripts/build/min-includes.pl b/scripts/build/min-includes.pl index f4ecaac7d3f..52a2eb0354c 100755 --- a/scripts/build/min-includes.pl +++ b/scripts/build/min-includes.pl @@ -39,15 +39,18 @@ use Data::Dumper; # @todo - use Getopt::Long, and allow -I for includes, # which lets us search include directories. # -our ($opt_d, $opt_e, $opt_i, $opt_r, $opt_x); +our ($opt_d, $opt_e, $opt_i, $opt_r, $opt_x, $opt_X); use Getopt::Std; -getopts('deirx'); -my $debug = $opt_x; +getopts('deirxX'); +my $debug = 0; my $edit = $opt_e; my $dry_run = $opt_d; my $edit_includes = $opt_i; my $reorder = $opt_r; +$debug = 1 if defined $opt_x; +$debug = 2 if defined $opt_X; + if ($edit_includes && $reorder) { die "Can't edit and reorder at the same time"; } @@ -89,6 +92,8 @@ sub process { $depth{$file} = 1; + print "... $file\n" if $debug > 1; + open(my $FILE, "<", $file) or die "Failed to open $file: $!\n"; my $line = 0; @@ -264,10 +269,11 @@ sub process_reorder { # Read and process the input C files. # foreach my $file (@ARGV) { + $file =~ s,//,/,g; + $requested{$file}++; process($file); } - # # Processing the C files resulted in a set of include files to # process. We need to read those in turn, in order to create a full @@ -292,6 +298,12 @@ foreach my $file (keys %transitive) { $depth{$file} = $mydepth; } +if ($debug > 1) { + foreach my $file (sort {$depth{$a} <=> $depth{$b}} keys %depth) { + print $depth{$file}, "\t", $file, "\n"; + } +} + # # We now process transitive references. i.e. file FOO includes BAR, # but BAR also includes BAZ, BAD, etc. We hoist all of that