installationservices/swi/test/tpathsubst/preparepkg.pl
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 #
       
     2 # Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 # All rights reserved.
       
     4 # This component and the accompanying materials are made available
       
     5 # under the terms of the License "Eclipse Public License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 #
       
     9 # Initial Contributors:
       
    10 # Nokia Corporation - initial contribution.
       
    11 #
       
    12 # Contributors:
       
    13 #
       
    14 # Description: 
       
    15 #
       
    16 
       
    17 
       
    18 use strict;
       
    19  
       
    20 
       
    21 sub mod_time($)
       
    22 # returns a file's last modified time in seconds since the epoch
       
    23 	{
       
    24 	return (stat $_[0])[9];
       
    25 	}
       
    26 
       
    27 # -----------------------------------------------------------------------
       
    28 
       
    29 
       
    30 my $platform = $ARGV[0];
       
    31 
       
    32 my $pkgdir = "testpkg";
       
    33 my $builddir = "build";
       
    34 my $sign_cert = "$ENV{'SECURITYSOURCEDIR'}\\installationservices\\switestfw\\testcertificates\\swi\\test\\tsisfile\\data\\signedsis\\Root5CA\\ca.pem";
       
    35 my $sign_key = "$ENV{'SECURITYSOURCEDIR'}\\installationservices\\switestfw\\testcertificates\\swi\\test\\\\tsisfile\\data\\signedsis\\Root5CA\\ca.key.pem";
       
    36 
       
    37 print "Build path subst test packages for $platform.\n";
       
    38 
       
    39 
       
    40 system("mkdir $builddir\\");
       
    41 my $target_dir = "\\epoc32\\winscw\\c\\tswi\\tpathsubst\\data";
       
    42 system("mkdir $target_dir\\");
       
    43 
       
    44 
       
    45 # if building for hardware, create iby file
       
    46 my $hardware = $platform !~ /wins/i;
       
    47 my $iby_name = '\epoc32\rom\include\tpathsubst.iby';
       
    48 if ($hardware)
       
    49 	{
       
    50 	unlink $iby_name;
       
    51 	open(IBY, ">> $iby_name");	
       
    52 	}
       
    53 
       
    54 
       
    55 # get list of package files
       
    56 opendir DIR, $pkgdir;
       
    57 my @pkgfiles = grep (/\.pkg/, readdir(DIR));
       
    58 closedir DIR;
       
    59 
       
    60 
       
    61 # create and sign each sis file
       
    62 my $target;	# needs to be seen by continue
       
    63 foreach my $entry (@pkgfiles)
       
    64 	{
       
    65 	$entry =~ s/\.pkg//;	# remove .pkg suffix
       
    66 	my $pkg_file = "$pkgdir\\$entry.pkg";
       
    67 
       
    68 	# don't rebuild this SIS file if the package file has not changed
       
    69 	$target = "$target_dir\\$entry.sis";
       
    70 #	if (-e $target && mod_time($target) >= mod_time($pkg_file)) {
       
    71 #		print "$target is up to date.\n";
       
    72 #		next;
       
    73 #	}
       
    74 
       
    75 	my $make_cmd = "makesis $pkg_file $builddir\\$entry-tmp.sis";
       
    76 	print "$make_cmd\n";
       
    77 	system($make_cmd);
       
    78 
       
    79 	my $sign_cmd = "signsis $builddir\\$entry-tmp.sis $builddir\\$entry.sis $sign_cert $sign_key";
       
    80 	print "$sign_cmd\n";
       
    81 	system($sign_cmd);
       
    82 
       
    83 	my $copy_cmd = "copy /y $builddir\\$entry.sis $target";
       
    84 	print "$copy_cmd\n";
       
    85 	system($copy_cmd);
       
    86 	}
       
    87 
       
    88 continue
       
    89 	{
       
    90 	if ($hardware)
       
    91 		{
       
    92 		my $rom_target = "\\tswi\\tpathsubst\\data\\$entry.sis";
       
    93 		my $iby_line = "data=$target\t$rom_target";
       
    94 		print "appending \"$rom_target\" to $iby_name";
       
    95 		print IBY "$iby_line\n";
       
    96 		}
       
    97 	}
       
    98 
       
    99 if ($hardware)
       
   100 	{
       
   101 	print IBY 'data=\epoc32\winscw\c\tswi\tpathsubst\data\armv5\sp_eclipse.sis "tswi\tpathsubst\data\sp_eclipse.sis"', "\n";
       
   102 	print IBY 'data=\epoc32\winscw\c\tswi\tpathsubst\data\armv5\eclipse_failure.sis "tswi\tpathsubst\data\eclipse_failure.sis"', "\n";
       
   103 	print IBY 'data=\epoc32\winscw\c\tswi\tpathsubst\scripts\tpathsubst.script "tswi\tpathsubst\scripts\tpathsubst.script"', "\n";
       
   104 	print IBY 'data=\epoc32\winscw\c\tswi\tpathsubst\scripts\tpathsubst.ini "tswi\tpathsubst\scripts\tpathsubst.ini"', "\n";
       
   105 	print IBY 'data=\epoc32\winscw\c\tswi\tpathsubst\scripts\tpathsubst_install.xml "tswi\tpathsubst\scripts\tpathsubst_install.xml"', "\n";
       
   106 	print IBY 'data=\epoc32\winscw\c\tswi\tpathsubst\scripts\tpathsubst_uninstall.xml "tswi\tpathsubst\scripts\tpathsubst_uninstall.xml"', "\n";
       
   107 	print IBY 'data=\epoc32\winscw\c\tswi\tpathsubst\scripts\tsubsteddrive_install.xml "tswi\tpathsubst\scripts\tsubsteddrive_install.xml"', "\n";
       
   108 	print IBY 'file=\epoc32\release\armv5\urel\setsubst.exe "\sys\bin\setsubst.exe"', "\n";
       
   109 	print IBY 'file=\epoc32\release\armv5\urel\setsubst.exe "\sys\bin\tps_ecl.exe"', "\n";
       
   110 	}
       
   111 
       
   112 close IBY;
       
   113 
       
   114 
       
   115 # -----------------------------------------------------------------------
       
   116