From a3967216f29b3ec8303c7aa71959dd30ae18ecc3 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 3 Dec 2010 11:06:29 +0200 Subject: Unify epocroot usage in createpackage and patch_capabilities scripts Some tools calls required epoc32/tools to be in path and some didn't. Now all tools calls will use tools from under %EPOCROOT%epoc32/tools if EPOCROOT env variable is defined. Reviewed-by: Janne Koskinen --- bin/createpackage.pl | 15 +++++++-------- bin/patch_capabilities.pl | 16 ++++++++++++---- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/bin/createpackage.pl b/bin/createpackage.pl index 6b83585..87ed29e 100755 --- a/bin/createpackage.pl +++ b/bin/createpackage.pl @@ -144,11 +144,13 @@ unless (GetOptions('i|install' => \$install, } my $epocroot = $ENV{EPOCROOT}; +my $epocToolsDir = ""; if ($epocroot ne "") { $epocroot =~ s,\\,/,g; if ($epocroot =~ m,[^/]$,) { $epocroot = $epocroot."/"; } + $epocToolsDir = "${epocroot}epoc32/tools/"; } my $certfilepath = abs_path(dirname($certfile)); @@ -341,7 +343,7 @@ if($stub) { mkpath($systeminstall); my $stub_sis_name = $systeminstall."/".$stub_sis_name; # Create stub SIS. - system ("${epocroot}epoc32/tools/makesis -s $pkgoutput $stub_sis_name"); + system ("${epocToolsDir}makesis -s $pkgoutput $stub_sis_name"); } else { if ($certtext eq "Self Signed" && !@certificates @@ -358,11 +360,8 @@ if($stub) { # Create SIS. # The 'and' is because system uses 0 to indicate success. - if($epocroot) { - system ("${epocroot}epoc32/tools/makesis $pkgoutput $unsigned_sis_name") and die ("ERROR: makesis failed"); - } else { - system ("makesis $pkgoutput $unsigned_sis_name") and die ("ERROR: makesis failed"); - } + system ("${epocToolsDir}makesis $pkgoutput $unsigned_sis_name") and die ("ERROR: makesis failed"); + print("\n"); my $targetInsert = ""; @@ -389,7 +388,7 @@ if($stub) { my $relcert = File::Spec->abs2rel($certificate); my $relkey = File::Spec->abs2rel($key); # The 'and' is because system uses 0 to indicate success. - system ("signsis $unsigned_sis_name $signed_sis_name $relcert $relkey $passphrase") and die ("ERROR: signsis failed"); + system ("${epocToolsDir}signsis $unsigned_sis_name $signed_sis_name $relcert $relkey $passphrase") and die ("ERROR: signsis failed"); # Check if creating signed SIS Succeeded stat($signed_sis_name); @@ -402,7 +401,7 @@ if($stub) { my $relcert = File::Spec->abs2rel(File::Spec->rel2abs( $row->[0], $certfilepath)); my $relkey = File::Spec->abs2rel(File::Spec->rel2abs( $row->[1], $certfilepath)); - system ("signsis $signed_sis_name $signed_sis_name $relcert $relkey $row->[2]"); + system ("${epocToolsDir}signsis $signed_sis_name $signed_sis_name $relcert $relkey $row->[2]"); print ("\tAdditionally signed the SIS with certificate: $row->[0]!\n"); } diff --git a/bin/patch_capabilities.pl b/bin/patch_capabilities.pl index df71339..c3fb89f 100755 --- a/bin/patch_capabilities.pl +++ b/bin/patch_capabilities.pl @@ -78,6 +78,16 @@ sub trim($) { return $string; } +my $epocroot = $ENV{EPOCROOT}; +my $epocToolsDir = ""; +if ($epocroot ne "") { + $epocroot =~ s,\\,/,g; + if ($epocroot =~ m,[^/]$,) { + $epocroot = $epocroot."/"; + } + $epocToolsDir = "${epocroot}epoc32/tools/"; +} + my $nullDevice = "/dev/null"; $nullDevice = "NUL" if ($^O =~ /MSWin/); @@ -237,7 +247,7 @@ if (@ARGV) } print ("\n"); - my $baseCommandToExecute = "elftran -vid 0x0 -capability \"%s\" "; + my $baseCommandToExecute = "${epocToolsDir}elftran -vid 0x0 -capability \"%s\" "; # Actually set the capabilities of the listed binaries. foreach my $binaryPath(@binaries) @@ -256,7 +266,7 @@ if (@ARGV) # Test which capabilities are present and then restrict them to the allowed set. # This avoid raising the capabilities of apps that already have none. my $dllCaps; - open($dllCaps, "elftran -dump s $binaryPath |") or die ("ERROR: Could not execute elftran"); + open($dllCaps, "${epocToolsDir}elftran -dump s $binaryPath |") or die ("ERROR: Could not execute elftran"); my $capsFound = 0; my $originalVid; my @capabilitiesToSet; @@ -329,8 +339,6 @@ if (@ARGV) system ("$commandToExecute > $nullDevice"); $somethingPatched = true; } - ## Create another command line to check that the set capabilities are correct. - #$commandToExecute = "elftran -dump s ".$binaryPath; } if ($checkFailed) { -- cgit v0.12