]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
fixes
authorAlan T. DeKok <aland@freeradius.org>
Thu, 21 Oct 2021 15:02:43 +0000 (11:02 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 21 Oct 2021 15:55:06 +0000 (11:55 -0400)
scripts/build/min-includes.pl

index f4ecaac7d3f9673adb7b294f66a03886bbd400ed..52a2eb0354c9113f3d3c3569653b693f46af27be 100755 (executable)
@@ -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