File indexing completed on 2024-04-06 12:28:23
0001
0002
0003 $RUNDIR = '/data2/matevz/CMSSW_12_2_0_pre2/src';
0004
0005 $pwd = `pwd`; chomp $pwd; die "Has to be run in $RUNDIR" unless $pwd eq $RUNDIR;
0006
0007
0008
0009
0010
0011 @headers = grep { chomp; $_ !~ ; } `find RecoTracker -name \*.h`;
0012
0013 @sheaders = map { my $a = $_; $a = $1 if $a =~ ; $a; } @headers;
0014
0015 $NH = scalar(@headers);
0016
0017 %hmap = ();
0018 for (my $i=0; $i<$NH; ++$i) { $hmap{$sheaders[$i]} = $headers[$i];}
0019
0020
0021
0022
0023 @files = grep { chomp; $_ !~ ; } `find RecoTracker -name \*.h -or -name \*.cc`;
0024
0025 print "HEADERS:\n";
0026 for (my $i=0; $i<$NH; ++$i) { print " ", $headers[$i], " --> ", $sheaders[$i], "\n"; }
0027 print "\n\n";
0028 print "FILES:\n", join("\n", @files);
0029 print "\n\n";
0030
0031
0032
0033
0034 for my $file (@files)
0035 {
0036 open F, $file;
0037 @lines = <F>;
0038 close F;
0039
0040
0041
0042 my $insrc = $file =~ ;
0043 $insrc = $1 if $insrc;
0044
0045 print "Processing file $file, N_lines = ", scalar(@lines), ", in_src = ", $insrc, "\n";
0046
0047 my $changed = 0;
0048
0049 for my $l (@lines)
0050 {
0051 if ($l =~ )
0052 {
0053 my $sh = $1; $sh = $1 if $sh =~ ;
0054
0055 my $have = exists $hmap{$sh};
0056
0057 my $line_to_print = $l;
0058 chomp $line_to_print;
0059 print "Found includeline $line_to_print -- $sh --> $hmap{$sh}\n";
0060
0061 if ($have)
0062 {
0063
0064 my $full_inc = $hmap{$sh};
0065 if ($insrc && ($full_inc =~ ))
0066 {
0067 $full_inc =~ s!^${insrc}/(.*)!$1!;
0068 print " QQQQQQQ File and include in the same src/ --> shortening to ${full_inc}\n";
0069 }
0070
0071 $l = "#include \"${full_inc}\"\n";
0072 $changed = 1;
0073
0074 print " new line is $l";
0075 }
0076 }
0077 }
0078
0079 if ($changed)
0080 {
0081 open F, ">$file";
0082 print F @lines;
0083 close F;
0084 }
0085 }