cross-plat-dev-utils/fix_tool_exports.pl
changeset 41 1600211976c3
parent 40 68f68128601f
equal deleted inserted replaced
40:68f68128601f 41:1600211976c3
    12 
    12 
    13 use strict;
    13 use strict;
    14 use perl_run;
    14 use perl_run;
    15 use places;
    15 use places;
    16 use check_os;
    16 use check_os;
       
    17 use File::Spec;
    17 my $keepgoing = 0;
    18 my $keepgoing = 0;
    18 my @exported = ();
    19 my @exported = ();
    19 my @failed = ();
    20 my @failed = ();
    20 my @skipped = ();
       
    21 # These are the targets that need exports performed.
    21 # These are the targets that need exports performed.
    22 my @needed_exports = ("sbsv1/abld","sbsv1/buildsystem");
    22 my @needed_exports = (File::Spec->catfile("sbsv1","abld"),
       
    23     File::Spec->catfile("sbsv1","buildsystem"),
       
    24     File::Spec->catfile("imgtools","romtools"));
       
    25     
       
    26 if (os_is_windows()) {
       
    27     foreach (@needed_exports) {
       
    28         s/\\/\//g;
       
    29     }
       
    30 }
    23 
    31 
    24 sub export($)
    32 sub export($)
    25 {
    33 {
    26 	my $targ = shift;
    34 	my $targ = shift;
    27 	return, if (is_exported($targ));
    35 	return, if (is_exported($targ));
    81 foreach my $dep (@deps) {
    89 foreach my $dep (@deps) {
    82 	chomp $dep;
    90 	chomp $dep;
    83 }
    91 }
    84 foreach my $line (@targ_lines) {
    92 foreach my $line (@targ_lines) {
    85 	chomp $line;
    93 	chomp $line;
    86 	next, unless ($line =~ /^sbsv1/); 
    94 	my $re_line = $line;
    87 	next, unless (grep(/$line/,@needed_exports));
    95 	if (os_is_windows()) {
    88 	next, if ($line =~ /^>>>/);
    96 	   $re_line =~ s/\\/\//g;
    89 	if ($line =~ /(\*\*\*.*\*\*\*)/) {
    97     } 
    90 		my $reason = $1;
    98     next, if ($line =~ /(\*\*\*.*\*\*\*)/);
    91 		my @words = split(/ /,$line);
    99  	next, if ($line =~ /^>>>/);   
    92 		print ">>> Skipping target $words[0]: \"$reason\"\n";
   100 	next, unless (grep(/^$re_line$/,(@needed_exports)));	
    93 		push (@skipped,[$words[0],$reason]);
   101 	export($line);
    94 	} else {
       
    95 		foreach my $dep (@deps) {
       
    96 			my ($targ,$prereq) = split(/ /,$dep);
       
    97 			if (os_is_windows()) {
       
    98                 $targ =~ s/\./\\/g;
       
    99                 $prereq =~ s/\./\\/g;                
       
   100             } else {
       
   101                 $targ =~ s/\./\//g;
       
   102                 $prereq =~ s/\./\//g;                            
       
   103             }
       
   104 			next, unless ($targ eq $line);
       
   105 			export($prereq);
       
   106 		}
       
   107 		export($line);
       
   108 	}
       
   109 }
   102 }
   110 if (@exported) {
   103 if (@exported) {
   111 	if (@failed == 0) {
   104 	if (@failed == 0) {
   112 		print ">>> Exported all eligible targets:-\n";
   105 		print ">>> Exported all eligible targets:-\n";
   113 	} else {
   106 	} else {
   121 	print ">>> Failed to export eligible targets:-\n";
   114 	print ">>> Failed to export eligible targets:-\n";
   122 	foreach my $targ (@failed) {
   115 	foreach my $targ (@failed) {
   123 		print "+++ $targ\n";
   116 		print "+++ $targ\n";
   124 	}
   117 	}
   125 } 
   118 } 
   126 if (@skipped) {
       
   127 	print ">>> Skipped targets:-\n";
       
   128 	foreach my $skipped (@skipped) {
       
   129 		print "+++ " . $skipped->[0] . ' ' . $skipped->[1] . "\n";
       
   130 	}
       
   131 }
       
   132 exit 0;
   119 exit 0;
   133 
   120