summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2010-02-04 13:08:44 (GMT)
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2010-02-04 14:52:30 (GMT)
commit9cc4ae77a73bd28ff495f36f26dd87c78b76b976 (patch)
tree4419fec06b6722016f4fcf7912a1b65df8b7081e
parent91e236022acd79dfbc4aef9e30edb4d1aeb2685c (diff)
downloadQt-9cc4ae77a73bd28ff495f36f26dd87c78b76b976.zip
Qt-9cc4ae77a73bd28ff495f36f26dd87c78b76b976.tar.gz
Qt-9cc4ae77a73bd28ff495f36f26dd87c78b76b976.tar.bz2
Added support for smart installer package generation in Symbian
Smart installer packages bundle normal application sis with a bootstrap package that will download a smart installer when the package is installed. Smart installer in turn will download any dependencies of the application that are available on remote server, such as Open C, Qt, and QtWebkit packages, and install them Smart installer packages are generated when DEPLOYMENT.installer_header variable is defined in applicatoin .pro file. This commit is still missing properly signed bootstrap.sis package. Task-number: QTBUG-7908 Reviewed-by: Shane Kearns
-rwxr-xr-xbin/createpackage.pl64
-rw-r--r--demos/embedded/fluidlauncher/fluidlauncher.pro2
-rw-r--r--doc/src/deployment/deployment.qdoc34
-rw-r--r--doc/src/development/qmake-manual.qdoc12
-rw-r--r--doc/src/snippets/code/doc_src_deployment.qdoc13
-rw-r--r--doc/src/snippets/code/doc_src_qmake-manual.qdoc10
-rw-r--r--qmake/generators/symbian/symmake.cpp86
7 files changed, 160 insertions, 61 deletions
diff --git a/bin/createpackage.pl b/bin/createpackage.pl
index 197dffe..460df31 100755
--- a/bin/createpackage.pl
+++ b/bin/createpackage.pl
@@ -64,7 +64,7 @@ sub Usage() {
==============================================================================================
Convenience script for creating signed packages you can install on your phone.
-Usage: createpackage.pl [options] templatepkg target-platform [certificate key [passphrase]]
+Usage: createpackage.pl [options] templatepkg [target]-[platform] [certificate key [passphrase]]
Where supported optiobns are as follows:
[-i|install] = Install the package right away using PC suite
@@ -72,9 +72,10 @@ Where supported optiobns are as follows:
[-c|certfile=<file>] = The file containing certificate information for signing.
The file can have several certificates, each specified in
separate line. The certificate, key and passphrase in line
- must be ';' separated. Lines starting with '#' are treated
- as a comments. Also empty lines are ignored. The paths in
+ must be ';' separated. Lines starting with '#' are treated
+ as a comments. Also empty lines are ignored. The paths in
<file> can be absolute or relative to <file>.
+ [-u|unsigned] = Preserves the unsigned package
Where parameters are as follows:
templatepkg = Name of .pkg file template
target = Either debug or release
@@ -86,10 +87,10 @@ Where parameters are as follows:
Example:
createpackage.pl fluidlauncher_template.pkg release-armv5
-
+
Example with certfile:
createpackage.pl -c=mycerts.txt fluidlauncher_template.pkg release-armv5
-
+
Content of 'mycerts.txt' must be something like this:
# This is comment line, also the empty lines are ignored
rd.cer;rd-key.pem
@@ -109,8 +110,12 @@ ENDUSAGESTRING
my $install = "";
my $preprocessonly = "";
my $certfile = "";
+my $preserveUnsigned = "";
-unless (GetOptions('i|install' => \$install, 'p|preprocess' => \$preprocessonly, 'c|certfile=s' => \$certfile)){
+unless (GetOptions('i|install' => \$install,
+ 'p|preprocess' => \$preprocessonly,
+ 'c|certfile=s' => \$certfile,
+ 'u|unsigned' => \$preserveUnsigned,)){
Usage();
}
@@ -134,7 +139,12 @@ my $passphrase = $ARGV[4];
# Generate output pkg basename (i.e. file name without extension)
my $pkgoutputbasename = $templatepkg;
-$pkgoutputbasename =~ s/_template\.pkg/_$targetplatform/g;
+my $preservePkgOutput = "";
+$pkgoutputbasename =~ s/_template/_$targetplatform/g;
+if ($pkgoutputbasename eq $templatepkg) {
+ $preservePkgOutput = "1";
+}
+$pkgoutputbasename =~ s/\.pkg//g;
$pkgoutputbasename = lc($pkgoutputbasename);
# Store output file names to variables
@@ -150,12 +160,20 @@ $certpath =~ s-^(.*[^\\])$-$1\\-o; # ensure path ends with a backslash
$certpath =~ s-/-\\-go; # for those working with UNIX shells
$certpath =~ s-bin\\$-src\\s60installs\\-; # certificates are one step up in hierarcy
-# Check some pre-conditions and print error messages if needed
-unless (length($templatepkg) && length($platform) && length($target)) {
- print "\nError: Template PKG filename, platform or target is not defined!\n";
+# Check some pre-conditions and print error messages if needed.
+unless (length($templatepkg)) {
+ print "\nError: Template PKG filename is not defined!\n";
Usage();
}
+# If the pkg file is not actually a template, there is no need for plaform or target.
+if ($templatepkg =~ m/_template\.pkg/i) {
+ unless (length($platform) && length($target)) {
+ print "\nError: Platform or target is not defined!\n";
+ Usage();
+ }
+}
+
# Check template exist
stat($templatepkg);
unless( -e _ ) {
@@ -192,18 +210,18 @@ if (length($certfile)) {
next if /^(\s)*$/; # skip blank lines
chomp; # remove trailing newline characters
my @certinfo = split(';', $_); # split row to certinfo
-
+
# Trim spaces
for(@certinfo) {
s/^\s+//;
s/\s+$//;
- }
-
+ }
+
# Do some validation
- unless(scalar(@certinfo) >= 2 && scalar(@certinfo) <= 3 && length($certinfo[0]) && length($certinfo[1]) ) {
+ unless(scalar(@certinfo) >= 2 && scalar(@certinfo) <= 3 && length($certinfo[0]) && length($certinfo[1]) ) {
print "\nError: $certfile line '$_' does not contain valid information!\n";
- Usage();
- }
+ Usage();
+ }
push @certificates, [@certinfo]; # push data to two dimensional array
}
@@ -212,7 +230,9 @@ if (length($certfile)) {
# Remove any existing .sis packages
unlink $unsigned_sis_name;
unlink $signed_sis_name;
-unlink $pkgoutput;
+if (!$preservePkgOutput) {
+ unlink $pkgoutput;
+}
# Preprocess PKG
local $/;
@@ -254,10 +274,14 @@ if( -e _ ) {
system ("signsis $signed_sis_name $signed_sis_name $abscert $abskey $row->[2]");
print ("\tAdditionally signed the SIS with certificate: $row->[0]!\n");
}
-
+
# remove temporary pkg and unsigned sis
- unlink $pkgoutput;
- unlink $unsigned_sis_name;
+ if (!$preservePkgOutput) {
+ unlink $pkgoutput;
+ }
+ if (!$preserveUnsigned) {
+ unlink $unsigned_sis_name;
+ }
# Install the sis if requested
if ($install) {
diff --git a/demos/embedded/fluidlauncher/fluidlauncher.pro b/demos/embedded/fluidlauncher/fluidlauncher.pro
index 92d6e1e..f71388c 100644
--- a/demos/embedded/fluidlauncher/fluidlauncher.pro
+++ b/demos/embedded/fluidlauncher/fluidlauncher.pro
@@ -213,5 +213,7 @@ symbian {
DEPLOYMENT += config files executables viewerimages saxbookmarks reg_resource resource \
mifs desktopservices_music desktopservices_images fluidbackup
+ DEPLOYMENT.installer_header = 0xA000D7CD
+
TARGET.EPOCHEAPSIZE = 100000 20000000
}
diff --git a/doc/src/deployment/deployment.qdoc b/doc/src/deployment/deployment.qdoc
index 8ba106c..575a6dc 100644
--- a/doc/src/deployment/deployment.qdoc
+++ b/doc/src/deployment/deployment.qdoc
@@ -1573,18 +1573,13 @@
By default \c .pkg file generated by \c qmake adds support for all
S60 3rd edition FP1, S60 3rd edition FP2 and S60 5th edition devices.
- As a last step we will embed the \c qt_installer.sis file to the Wiggly
- deployment file:
+ As a last step we will instruct qmake to generate smart installer \c .pkg file by defining
+ the UID of the installation package. The UID needs to be different than the application UID,
+ and should be reserved via normal Symbian mechanisms. You can use a random UID starting with
+ \c 0xE for testing purposes:
\snippet doc/src/snippets/code/doc_src_deployment.qdoc 58
- When \c qt_installer.sis is embedded to the application deployment file, the
- end-user does not need to download and install all dependencies separately.
- The drawback of \c .sis embedding is that the application \c .sis file size becomes
- big. To address these problems Forum Nokia is planning to release a smart installer
- which will take care of downloading and installing the necessary dependencies
- over-the-air. The expected availability of smart installer is 1Q 2010.
-
Now we are ready to compile the application and create the application
deployment file. Run \c qmake to create Symbian specific makefiles, resources (\.rss)
and deployment packaging files (\c .pkg). And do build to create the
@@ -1593,13 +1588,26 @@
\snippet doc/src/snippets/code/doc_src_deployment.qdoc 59
If everything compiled and linked without any errors, we are now ready to create
- an application installation file:
+ an application package (\c wiggly.sis):
\snippet doc/src/snippets/code/doc_src_deployment.qdoc 60
- If all binaries and dependencies were found, we should now have a self-signed
- \c wiggly_release-gcce.sis ready to be installed on a device. For more information
- about creating a \c .sis file and installing it to device see also
+ Now you can create the smart installer package for the application:
+
+ \snippet doc/src/snippets/code/doc_src_deployment.qdoc 61
+
+ If all binaries and dependencies were found, you should now have a self signed
+ \c wiggly_installer.sis ready to be installed on a device. The smart installer
+ contained in the in the installer package will download the necessary dependencies
+ such as Qt libraries to the device.
+
+ \note If you want to have your application properly Symbian Signed for distribution,
+ you will have to properly sign both the application and the application installer packages.
+ Please see
+ \l{http://developer.symbian.org/wiki/index.php/Category:Symbian_Signed}
+ {Symbian Signed wiki} for more information about Symbian Signed.
+
+ For more information about creating a \c .sis file and installing it to device see also
\l {The Symbian platform - Introduction to Qt#Installing your own applications}{here}.
*/
diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc
index d7aa0db..49e1e71 100644
--- a/doc/src/development/qmake-manual.qdoc
+++ b/doc/src/development/qmake-manual.qdoc
@@ -1431,6 +1431,18 @@ is the application private directory on the drive it is installed to.
\snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 141
+ On the Symbian platform, you can use \c{DEPLOYMENT.installer_header}
+ variable to generate smart installer wrapper for your application.
+ If you specify just UID of the installer package as the value, then
+ installer package name and version will be autogenerated:
+
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 146
+
+ If autogenerated values are not suitable, you can also specify the sis
+ header yourself using this variable:
+
+ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 147
+
\target DEPLOYMENT_PLUGIN
\section1 DEPLOYMENT_PLUGIN
diff --git a/doc/src/snippets/code/doc_src_deployment.qdoc b/doc/src/snippets/code/doc_src_deployment.qdoc
index 7eb8808..9c00681 100644
--- a/doc/src/snippets/code/doc_src_deployment.qdoc
+++ b/doc/src/snippets/code/doc_src_deployment.qdoc
@@ -475,11 +475,7 @@ default_deployment.pkg_prerules += supported_platforms
//! [57]
//! [58]
-embedded_deployments = \
- "; Embed Qt dependencies" \
- "@\"$$[QT_INSTALL_PREFIX]/qt_installer.sis\",(0x2001E62D)"
-
-default_deployment.pkg_prerules += embedded_deployments
+DEPLOYMENT.installer_header = 0xE2345678
//! [58]
//! [59]
@@ -489,4 +485,9 @@ make release-gcce
//! [60]
make sis
-//! [60] \ No newline at end of file
+ren wiggly_release-gcce.sis wiggly.sis
+//! [60]
+
+//! [61]
+createpackage wiggly_installer.pkg
+//! [61] \ No newline at end of file
diff --git a/doc/src/snippets/code/doc_src_qmake-manual.qdoc b/doc/src/snippets/code/doc_src_qmake-manual.qdoc
index b1cbc72..a48b53f 100644
--- a/doc/src/snippets/code/doc_src_qmake-manual.qdoc
+++ b/doc/src/snippets/code/doc_src_qmake-manual.qdoc
@@ -963,9 +963,9 @@ RSS_RULES += myrssrules
//! [145]
//! [146]
-BLD_INF_RULES.prj_exports += \
- "$${LITERAL_HASH}include <platform_paths.hrh>" \
- "rom/my.iby APP_LAYER_PUBLIC_EXPORT_PATH(my.iby)" \
- "inc/myheader.h mycomp/myheader.h" \
- ":zip my_api.zip my_api"
+DEPLOYMENT.installer_header = 0x12345678
//! [146]
+
+//! [147]
+DEPLOYMENT.installer_header = "$${LITERAL_HASH}{\"My Application Installer\"},(0x12345678),1,0,0"
+//! [147]
diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp
index 8f712d8..8f0abf4 100644
--- a/qmake/generators/symbian/symmake.cpp
+++ b/qmake/generators/symbian/symmake.cpp
@@ -292,12 +292,23 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile, Deployme
}
generatedFiles << pkgFile.fileName();
+ QTextStream t(&pkgFile);
+
+ QString installerSisHeader = project->values("DEPLOYMENT.installer_header").join("\n");
+ QString wrapperStreamBuffer;
+ QTextStream tw(&wrapperStreamBuffer);
+
+ QString dateStr = QDateTime::currentDateTime().toString(Qt::ISODate);
// Header info
- QTextStream t(&pkgFile);
- t << QString("; %1 generated by qmake at %2").arg(pkgFilename).arg(QDateTime::currentDateTime().toString(Qt::ISODate)) << endl;
- t << "; This file is generated by qmake and should not be modified by the user" << endl;
- t << ";" << endl << endl;
+ QString wrapperPkgFilename = QString("%1_installer.%2")
+ .arg(fixedTarget)
+ .arg("pkg");
+ QString headerComment = "; %1 generated by qmake at %2\n"
+ "; This file is generated by qmake and should not be modified by the user\n"
+ ";\n\n";
+ t << headerComment.arg(pkgFilename).arg(dateStr);
+ tw << headerComment.arg(wrapperPkgFilename).arg(dateStr);
// Construct QStringList from pkg_prerules since we need search it before printed to file
QStringList rawPkgPreRules;
@@ -320,8 +331,9 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile, Deployme
if (!containsStartWithItem('&', rawPkgPreRules)) {
// language, (*** hardcoded to english atm, should be parsed from TRANSLATIONS)
- t << "; Language" << endl;
- t << "&EN" << endl << endl;
+ QString languageCode = "; Language\n&EN\n\n";
+ t << languageCode;
+ tw << languageCode;
} else {
// In case user defines langs, he must take care also about SIS header
if (!containsStartWithItem('#', rawPkgPreRules))
@@ -330,34 +342,51 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile, Deployme
// name of application, UID and version
QString applicationVersion = project->first("VERSION").isEmpty() ? "1,0,0" : project->first("VERSION").replace('.', ',');
+ QString sisHeader = "; SIS header: name, uid, version\n#{\"%1\"},(%2),%3\n\n";
+ QString visualTarget = escapeFilePath(fileFixify(project->first("TARGET")));
+ visualTarget = removePathSeparators(visualTarget);
+ QString wrapperTarget = visualTarget + " installer";
- if (!containsStartWithItem('#', rawPkgPreRules)) {
- QString visualTarget = escapeFilePath(fileFixify(project->first("TARGET")));
- visualTarget = removePathSeparators(visualTarget);
+ if (installerSisHeader.startsWith("0x", Qt::CaseInsensitive)) {
+ tw << sisHeader.arg(wrapperTarget).arg(installerSisHeader).arg(applicationVersion);
+ } else {
+ tw << installerSisHeader << endl;
+ }
- t << "; SIS header: name, uid, version" << endl;
- t << QString("#{\"%1\"},(%2),%3").arg(visualTarget).arg(uid3).arg(applicationVersion) << endl << endl;
+ if (!containsStartWithItem('#', rawPkgPreRules)) {
+ t << sisHeader.arg(visualTarget).arg(uid3).arg(applicationVersion);
}
// Localized vendor name
+ QString vendorName;
if (!containsStartWithItem('%', rawPkgPreRules)) {
- t << "; Localised Vendor name" << endl;
- t << "%{\"Vendor\"}" << endl << endl;
+ vendorName += "; Localised Vendor name\n%{\"Vendor\"}\n\n";
}
// Unique vendor name
if (!containsStartWithItem(':', rawPkgPreRules)) {
- t << "; Unique Vendor name" << endl;
- t << ":\"Vendor\"" << endl << endl;
+ vendorName += "; Unique Vendor name\n:\"Vendor\"\n\n";
}
+ t << vendorName;
+ tw << vendorName;
+
// PKG pre-rules - these are added before actual file installations i.e. SIS package body
if (rawPkgPreRules.size()) {
- t << "; Manual PKG pre-rules from PRO files" << endl;
+ QString comment = "\n; Manual PKG pre-rules from PRO files\n";
+ t << comment;
+ tw << comment;
+
foreach(QString item, rawPkgPreRules) {
+ // Only regular pkg file should have package dependencies or pkg header if that is
+ // defined using prerules.
+ if (!item.startsWith("(") && !item.startsWith("#")) {
+ tw << item << endl;
+ }
t << item << endl;
}
t << endl;
+ tw << endl;
}
// Begin Manufacturer block
@@ -380,7 +409,6 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile, Deployme
QString epocReleasePath = QString("%1epoc32/release/$(PLATFORM)/$(TARGET)")
.arg(epocRoot());
-
if (targetType == TypeExe) {
// deploy .exe file
t << "; Executable and default resource files" << endl;
@@ -469,6 +497,30 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile, Deployme
<< " - \"\", FILETEXT, TEXTEXIT" << endl
<< "ENDIF ; MANUFACTURER" << endl;
}
+
+ // Write wrapper pkg
+ if (!installerSisHeader.isEmpty()) {
+ QFile wrapperPkgFile(wrapperPkgFilename);
+ if (!wrapperPkgFile.open(QIODevice::WriteOnly | QIODevice::Text)) {
+ PRINT_FILE_CREATE_ERROR(wrapperPkgFilename);
+ return;
+ }
+
+ generatedFiles << wrapperPkgFile.fileName();
+ QTextStream twf(&wrapperPkgFile);
+
+ twf << wrapperStreamBuffer << endl;
+
+ // Wrapped files deployment
+ QString currentPath = qmake_getpwd();
+ QString sisName = QString("%1.sis").arg(fixedTarget);
+ twf << "\"" << currentPath << "/" << sisName << "\" - \"c:\\adm\\" << sisName << "\"" << endl;
+
+ QString bootStrapPath = QLibraryInfo::location(QLibraryInfo::PrefixPath);
+ bootStrapPath.append("/src/s60installs/bootstrap.sis");
+ QFileInfo fi(fileInfo(bootStrapPath));
+ twf << "@\"" << fi.absoluteFilePath() << "\",(0x2002CCCD)" << endl;
+ }
}
bool SymbianMakefileGenerator::containsStartWithItem(const QChar &c, const QStringList& src)