summaryrefslogtreecommitdiffstats
path: root/src/sdk
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@digia.com>2013-02-06 16:16:27 +0100
committerTim Jenssen <tim.jenssen@digia.com>2013-02-07 10:51:39 +0100
commitafaf3fcbd99cac0e981f0a14e4a93fa86d7353fb (patch)
treed5afe187dc0f36785c14711a7e8c8323288e2ba9 /src/sdk
parent833fac9516fd961d3cd4ac1b18cb4fd14107cc63 (diff)
Add --binarydatafile argument to installerbase.
Task-number: QTIFW-214 Simplifies testing an already existing installer or maintenancetool using a newer installerbase or IFW build. Change-Id: I11df629614eb1c2c15ecc28af37d8e40b5173a79 Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com> Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
Diffstat (limited to 'src/sdk')
-rw-r--r--src/sdk/installerbase.cpp33
-rw-r--r--src/sdk/installerbase_p.cpp3
2 files changed, 28 insertions, 8 deletions
diff --git a/src/sdk/installerbase.cpp b/src/sdk/installerbase.cpp
index 648379908..79ae8b18b 100644
--- a/src/sdk/installerbase.cpp
+++ b/src/sdk/installerbase.cpp
@@ -291,16 +291,33 @@ int main(int argc, char *argv[])
// the uninstaller for the recorded list of during the installation performed operations
QInstaller::init();
+ QString binaryFile = QCoreApplication::applicationFilePath();
+ const int index = args.indexOf(QLatin1String("--binarydatafile"));
+ if (index >= 0) {
+ binaryFile = args.value(index + 1);
+ if (binaryFile.isEmpty()) {
+ std::cerr << QFileInfo(app.applicationFilePath()).fileName() << " --binarydatafile [missing "
+ "argument]" << std::endl;
+ return PackageManagerCore::Failure;
+ }
+
+ // Consume the arguments to avoid "Unknown option" output. Also there's no need to check for a
+ // valid binary, will throw in readAndRegisterFromBinary(...) if the magic cookie can't be found.
+ args.removeAt(index + 1);
+ args.removeAll(QLatin1String("--binarydatafile"));
+ }
+
#ifdef Q_OS_MAC
- // load the external binary resource
- QDir resourcePath(QFileInfo(QCoreApplication::applicationFilePath()).dir());
- resourcePath.cdUp();
- resourcePath.cd(QLatin1String("Resources"));
- BinaryContent content = BinaryContent::readAndRegisterFromBinary(resourcePath.filePath(QLatin1String("installer.dat")));
-#else
- // load and map the embedded binary resource, registers operations
- BinaryContent content = BinaryContent::readAndRegisterFromApplicationFile();
+ // Load the external binary resource if we got one passed, otherwise assume we are a bundle. In that
+ // case we need to figure out the path into the bundles resources folder to get the binary data.
+ if (index < 0) {
+ QDir resourcePath(QFileInfo(binaryFile).dir());
+ resourcePath.cdUp();
+ resourcePath.cd(QLatin1String("Resources"));
+ binaryFile = resourcePath.filePath(QLatin1String("installer.dat"));
+ }
#endif
+ BinaryContent content = BinaryContent::readAndRegisterFromBinary(binaryFile);
// instantiate the installer we are actually going to use
QInstaller::PackageManagerCore core(content.magicMarker(), content.performedOperations());
diff --git a/src/sdk/installerbase_p.cpp b/src/sdk/installerbase_p.cpp
index 6469f7633..dc4d82d10 100644
--- a/src/sdk/installerbase_p.cpp
+++ b/src/sdk/installerbase_p.cpp
@@ -340,6 +340,9 @@ void InstallerBase::showUsage()
std::cout << std::setw(55) << std::setiosflags(std::ios::left) << " --show-virtual-components"
<< std::setw(40) << "Show virtual components in package manager and updater" << std::endl;
std::cout << std::setw(55) << std::setiosflags(std::ios::left)
+ << " --binarydatafile [path/to/binary/data/file]" << std::setw(40) << "Use the binary data of "
+ "another installer or maintenance tool." << std::endl;
+ std::cout << std::setw(55) << std::setiosflags(std::ios::left)
<< " --update-installerbase [path/to/new/installerbase]" << std::setw(40)
<< "Patch a full installer with a new installer base" << std::endl;
std::cout << std::setw(55) << std::setiosflags(std::ios::left) << " --dump-binary-data [OPTION...] -o "