Ignore:
Timestamp:
Mar 8, 2010, 12:52:58 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.2 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/bin/createpackage.pl

    r561 r651  
    22#############################################################################
    33##
    4 ## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     4## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
    55## All rights reserved.
    66## Contact: Nokia Corporation (qt-info@nokia.com)
     
    6565Convenience script for creating signed packages you can install on your phone.
    6666
    67 Usage: createpackage.pl [options] templatepkg target-platform [certificate key [passphrase]]
     67Usage: createpackage.pl [options] templatepkg [target]-[platform] [certificate key [passphrase]]
    6868
    6969Where supported optiobns are as follows:
     
    7373                               The file can have several certificates, each specified in
    7474                               separate line. The certificate, key and passphrase in line
    75                                must be ';' separated. Lines starting with '#' are treated 
    76                                as a comments. Also empty lines are ignored. The paths in 
     75                               must be ';' separated. Lines starting with '#' are treated
     76                               as a comments. Also empty lines are ignored. The paths in
    7777                               <file> can be absolute or relative to <file>.
     78     [-u|unsigned]           = Preserves the unsigned package
    7879Where parameters are as follows:
    7980     templatepkg             = Name of .pkg file template
     
    8788Example:
    8889     createpackage.pl fluidlauncher_template.pkg release-armv5
    89      
     90
    9091Example with certfile:
    9192     createpackage.pl -c=mycerts.txt fluidlauncher_template.pkg release-armv5
    92      
     93
    9394     Content of 'mycerts.txt' must be something like this:
    9495        # This is comment line, also the empty lines are ignored
    9596        rd.cer;rd-key.pem
    9697        .\\cert\\mycert.cer;.\\cert\\mykey.key;yourpassword
    97         X:\\QtS60\\selfsigned.cer;X:\\QtS60\\selfsigned.key
     98        X:\\QtS60\\s60installs\\selfsigned.cer;X:\\QtS60\\s60installs\\selfsigned.key
    9899
    99100If no certificate and key files are provided, either a RnD certificate or
    100 a self-signed certificate from Qt installation root directory is used.
     101a self-signed certificate from QtDir\\src\\s60installs directory is used.
    101102==============================================================================================
    102103
     
    110111my $preprocessonly = "";
    111112my $certfile = "";
    112 
    113 unless (GetOptions('i|install' => \$install, 'p|preprocess' => \$preprocessonly, 'c|certfile=s' => \$certfile)){
     113my $preserveUnsigned = "";
     114
     115unless (GetOptions('i|install' => \$install,
     116                   'p|preprocess' => \$preprocessonly,
     117                   'c|certfile=s' => \$certfile,
     118                   'u|unsigned' => \$preserveUnsigned,)){
    114119    Usage();
    115120}
     
    135140# Generate output pkg basename (i.e. file name without extension)
    136141my $pkgoutputbasename = $templatepkg;
    137 $pkgoutputbasename =~ s/_template\.pkg/_$targetplatform/g;
     142my $preservePkgOutput = "";
     143$pkgoutputbasename =~ s/_template/_$targetplatform/g;
     144if ($pkgoutputbasename eq $templatepkg) {
     145    $preservePkgOutput = "1";
     146}
     147$pkgoutputbasename =~ s/\.pkg//g;
    138148$pkgoutputbasename = lc($pkgoutputbasename);
    139149
    140150# Store output file names to variables
    141151my $pkgoutput = lc($pkgoutputbasename.".pkg");
    142 my $unsigned_sis_name = $pkgoutputbasename."_unsigned.sis";
    143 my $signed_sis_name = $pkgoutputbasename.".sis";
     152my $sisoutputbasename = lc($pkgoutputbasename);
     153$sisoutputbasename =~ s/_$targetplatform//g;
     154my $unsigned_sis_name = $sisoutputbasename."_unsigned.sis";
     155my $signed_sis_name = $sisoutputbasename.".sis";
    144156
    145157# Store some utility variables
     
    151163$certpath =~ s-bin\\$-src\\s60installs\\-;  # certificates are one step up in hierarcy
    152164
    153 # Check some pre-conditions and print error messages if needed
    154 unless (length($templatepkg) && length($platform) && length($target)) {
    155     print "\nError: Template PKG filename, platform or target is not defined!\n";
     165# Check some pre-conditions and print error messages if needed.
     166unless (length($templatepkg)) {
     167    print "\nError: Template PKG filename is not defined!\n";
    156168    Usage();
     169}
     170
     171# If the pkg file is not actually a template, there is no need for plaform or target.
     172if ($templatepkg =~ m/_template\.pkg/i) {
     173    unless (length($platform) && length($target)) {
     174        print "\nError: Platform or target is not defined!\n";
     175        Usage();
     176    }
    157177}
    158178
     
    193213        chomp;                              # remove trailing newline characters
    194214        my @certinfo = split(';', $_);      # split row to certinfo
    195        
     215
    196216        # Trim spaces
    197217        for(@certinfo) {
    198218            s/^\s+//;
    199219            s/\s+$//;
    200         }       
    201        
     220        }
     221
    202222        # Do some validation
    203         unless(scalar(@certinfo) >= 2 && scalar(@certinfo) <= 3 && length($certinfo[0]) && length($certinfo[1]) ) {   
     223        unless(scalar(@certinfo) >= 2 && scalar(@certinfo) <= 3 && length($certinfo[0]) && length($certinfo[1]) ) {
    204224            print "\nError: $certfile line '$_' does not contain valid information!\n";
    205             Usage();           
    206         }   
     225            Usage();
     226        }
    207227
    208228        push @certificates, [@certinfo];    # push data to two dimensional array
     
    213233unlink $unsigned_sis_name;
    214234unlink $signed_sis_name;
    215 unlink $pkgoutput;
     235if (!$preservePkgOutput) {
     236    unlink $pkgoutput;
     237}
    216238
    217239# Preprocess PKG
     
    244266stat($signed_sis_name);
    245267if( -e _ ) {
    246     print ("\nSuccessfully created $signed_sis_name using certificate: $certtext!\n");
     268    my $targetInsert = "";
     269    if ($targetplatform ne "-") {
     270        $targetInsert = "for $targetplatform ";
     271    }
     272    print ("\nSuccessfully created $signed_sis_name ${targetInsert}using certificate: $certtext!\n");
    247273
    248274    # Sign with additional certificates & keys
     
    255281        print ("\tAdditionally signed the SIS with certificate: $row->[0]!\n");
    256282    }
    257    
     283
    258284    # remove temporary pkg and unsigned sis
    259     unlink $pkgoutput;
    260     unlink $unsigned_sis_name;
     285    if (!$preservePkgOutput) {
     286        unlink $pkgoutput;
     287    }
     288    if (!$preserveUnsigned) {
     289        unlink $unsigned_sis_name;
     290    }
    261291
    262292    # Install the sis if requested
Note: See TracChangeset for help on using the changeset viewer.