bin/patch_capabilities.pl
branchRCL_3
changeset 5 d3bac044e0f0
parent 4 3b1da2848fc7
child 8 3f74d0d4af4c
equal deleted inserted replaced
4:3b1da2848fc7 5:d3bac044e0f0
   106         my $tempPkgFileName = $pkgFileName."_@@TEMP@@";
   106         my $tempPkgFileName = $pkgFileName."_@@TEMP@@";
   107         unlink($tempPkgFileName);
   107         unlink($tempPkgFileName);
   108         open (NEW_PKG, ">>".$tempPkgFileName);
   108         open (NEW_PKG, ">>".$tempPkgFileName);
   109         open (PKG, "<".$pkgFileName);
   109         open (PKG, "<".$pkgFileName);
   110 
   110 
       
   111         my $manufacturerElseBlock = 0;
       
   112 
   111         # Parse each line.
   113         # Parse each line.
   112         while (<PKG>)
   114         while (<PKG>)
   113         {
   115         {
       
   116             # Patch pkg UID
   114             my $line = $_;
   117             my $line = $_;
   115             my $newLine = $line;
   118             my $newLine = $line;
   116             if ( $line =~ m/^\#.*\(0x[0-9|a-f|A-F]*\).*$/)
   119             if ($line =~ m/^\#.*\(0x[0-9|a-f|A-F]*\).*$/)
   117             {
   120             {
   118                 $newLine =~ s/\(0x./\(0xE/;
   121                 $newLine =~ s/\(0x./\(0xE/;
   119             }
   122             }
       
   123 
       
   124             # Patch embedded sis name and UID
       
   125             if ($line =~ m/^@.*\.sis.*\(0x[0-9|a-f|A-F]*\).*$/)
       
   126             {
       
   127                 $newLine =~ s/\(0x./\(0xE/;
       
   128                 if ($line !~ m/^.*_selfsigned.sis.*$/)
       
   129                 {
       
   130                     $newLine =~ s/\.sis/_selfsigned\.sis/i;
       
   131                 }
       
   132             }
       
   133 
       
   134             # Remove all dependencies to other packages to reduce unnecessary error messages
       
   135             # from depended packages that are also patched and therefore have different UID.
       
   136             if ($line =~ m/^\(0x[0-9|a-f|A-F]*\).*\{.*\}$/)
       
   137             {
       
   138                 $newLine = "\n"
       
   139             }
       
   140 
       
   141             # Remove manufacturer ifdef
       
   142             if ($line =~ m/^.*\(MANUFACTURER\)\=\(.*\).*$/)
       
   143             {
       
   144                 $newLine = "\n";
       
   145             }
       
   146 
       
   147             if ($line =~ m/^ELSEIF.*MANUFACTURER$/)
       
   148             {
       
   149                 $manufacturerElseBlock = 1;
       
   150             }
       
   151 
       
   152             if ($manufacturerElseBlock eq 1)
       
   153             {
       
   154                 $newLine = "\n";
       
   155             }
       
   156 
       
   157             if ($line =~ m/^ENDIF.*MANUFACTURER$/)
       
   158             {
       
   159                 $manufacturerElseBlock = 0;
       
   160             }
       
   161 
   120             print NEW_PKG $newLine;
   162             print NEW_PKG $newLine;
   121 
   163 
   122             chomp ($line);
   164             chomp ($line);
   123 
   165 
   124             # If the line specifies a file, parse the source and destination locations.
   166             # If the line specifies a file, parse the source and destination locations.