bin/patch_capabilities.pl
changeset 7 f7bc934e204c
parent 0 1918ee327afb
child 30 5dc02b23752f
equal deleted inserted replaced
3:41300fa6a67c 7:f7bc934e204c
     1 #!/usr/bin/perl
     1 #!/usr/bin/perl
     2 #############################################################################
     2 #############################################################################
     3 ##
     3 ##
     4 ## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     4 ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     5 ## All rights reserved.
     5 ## All rights reserved.
     6 ## Contact: Nokia Corporation (qt-info@nokia.com)
     6 ## Contact: Nokia Corporation (qt-info@nokia.com)
     7 ##
     7 ##
     8 ## This file is part of the S60 port of the Qt Toolkit.
     8 ## This file is part of the S60 port of the Qt Toolkit.
     9 ##
     9 ##
   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 dependencies to known problem packages (i.e. packages that are likely to be patched, also)
       
   135             # to reduce unnecessary error messages.
       
   136             if ($line =~ m/^\(0x2002af5f\).*\{.*\}$/)
       
   137             {
       
   138                 $newLine = "\n"
       
   139             }
       
   140             if ($line =~ m/^\(0x2001E61C\).*\{.*\}$/)
       
   141             {
       
   142                 $newLine = "\n"
       
   143             }
       
   144 
       
   145             # Remove manufacturer ifdef
       
   146             if ($line =~ m/^.*\(MANUFACTURER\)\=\(.*\).*$/)
       
   147             {
       
   148                 $newLine = "\n";
       
   149             }
       
   150 
       
   151             if ($line =~ m/^ELSEIF.*MANUFACTURER$/)
       
   152             {
       
   153                 $manufacturerElseBlock = 1;
       
   154             }
       
   155 
       
   156             if ($manufacturerElseBlock eq 1)
       
   157             {
       
   158                 $newLine = "\n";
       
   159             }
       
   160 
       
   161             if ($line =~ m/^ENDIF.*MANUFACTURER$/)
       
   162             {
       
   163                 $manufacturerElseBlock = 0;
       
   164             }
       
   165 
   120             print NEW_PKG $newLine;
   166             print NEW_PKG $newLine;
   121 
   167 
   122             chomp ($line);
   168             chomp ($line);
   123 
   169 
   124             # If the line specifies a file, parse the source and destination locations.
   170             # If the line specifies a file, parse the source and destination locations.