bin/patch_capabilities.pl
branchRCL_3
changeset 5 d3bac044e0f0
parent 4 3b1da2848fc7
child 7 3f74d0d4af4c
--- a/bin/patch_capabilities.pl	Fri Feb 19 23:40:16 2010 +0200
+++ b/bin/patch_capabilities.pl	Fri Mar 12 15:46:37 2010 +0200
@@ -108,15 +108,57 @@
         open (NEW_PKG, ">>".$tempPkgFileName);
         open (PKG, "<".$pkgFileName);
 
+        my $manufacturerElseBlock = 0;
+
         # Parse each line.
         while (<PKG>)
         {
+            # Patch pkg UID
             my $line = $_;
             my $newLine = $line;
-            if ( $line =~ m/^\#.*\(0x[0-9|a-f|A-F]*\).*$/)
+            if ($line =~ m/^\#.*\(0x[0-9|a-f|A-F]*\).*$/)
             {
                 $newLine =~ s/\(0x./\(0xE/;
             }
+
+            # Patch embedded sis name and UID
+            if ($line =~ m/^@.*\.sis.*\(0x[0-9|a-f|A-F]*\).*$/)
+            {
+                $newLine =~ s/\(0x./\(0xE/;
+                if ($line !~ m/^.*_selfsigned.sis.*$/)
+                {
+                    $newLine =~ s/\.sis/_selfsigned\.sis/i;
+                }
+            }
+
+            # Remove all dependencies to other packages to reduce unnecessary error messages
+            # from depended packages that are also patched and therefore have different UID.
+            if ($line =~ m/^\(0x[0-9|a-f|A-F]*\).*\{.*\}$/)
+            {
+                $newLine = "\n"
+            }
+
+            # Remove manufacturer ifdef
+            if ($line =~ m/^.*\(MANUFACTURER\)\=\(.*\).*$/)
+            {
+                $newLine = "\n";
+            }
+
+            if ($line =~ m/^ELSEIF.*MANUFACTURER$/)
+            {
+                $manufacturerElseBlock = 1;
+            }
+
+            if ($manufacturerElseBlock eq 1)
+            {
+                $newLine = "\n";
+            }
+
+            if ($line =~ m/^ENDIF.*MANUFACTURER$/)
+            {
+                $manufacturerElseBlock = 0;
+            }
+
             print NEW_PKG $newLine;
 
             chomp ($line);