From 76fd6e8f2953347ea0bf7a57b643968784bc9acc Mon Sep 17 00:00:00 2001 From: Katja Marttila Date: Thu, 5 May 2016 15:18:34 +0300 Subject: Allow signing maintenancetool in Windows Signing was not possible for maintenancetool since metadata was added to binary. Separated metadata to installer.dat like in OS X. Task-number: QTIFW-667 Change-Id: I74ef307c51a2f43059475dd943d6f0910925fa86 Reviewed-by: Iikka Eklund --- src/libs/installer/packagemanagercore_p.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/libs') diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp index 642d7f5ae..76294ec69 100644 --- a/src/libs/installer/packagemanagercore_p.cpp +++ b/src/libs/installer/packagemanagercore_p.cpp @@ -995,12 +995,14 @@ void PackageManagerCorePrivate::writeMaintenanceToolBinary(QFile *const input, q QInstaller::appendData(&out, input, size); if (writeBinaryLayout) { -#ifdef Q_OS_OSX +#if defined Q_OS_OSX || defined Q_OS_WIN QDir resourcePath(QFileInfo(maintenanceToolRenamedName).dir()); +#ifdef Q_OS_OSX if (!resourcePath.path().endsWith(QLatin1String("Contents/MacOS"))) throw Error(tr("Maintenance tool is not a bundle")); resourcePath.cdUp(); resourcePath.cd(QLatin1String("Resources")); +#endif // It's a bit odd to have only the magic in the data file, but this simplifies // other code a lot (since installers don't have any appended data either) QTemporaryFile dataOut; @@ -1027,7 +1029,7 @@ void PackageManagerCorePrivate::writeMaintenanceToolBinary(QFile *const input, q dataOut.setAutoRemove(false); dataOut.setPermissions(dataOut.permissions() | QFile::WriteUser | QFile::ReadGroup | QFile::ReadOther); -#else +#elif defined(Q_OS_LINUX) QInstaller::appendInt64(&out, 0); // operations start QInstaller::appendInt64(&out, 0); // operations end QInstaller::appendInt64(&out, 0); // resource count @@ -1296,12 +1298,15 @@ void PackageManagerCorePrivate::writeMaintenanceTool(OperationList performedOper QInstaller::openForRead(&input); layout = BinaryContent::binaryLayout(&input, BinaryContent::MagicCookieDat); } catch (const Error &/*error*/) { -#ifdef Q_OS_OSX - // On Mac, data is always in a separate file so that the binary can be signed +#if defined Q_OS_OSX || defined Q_OS_WIN + // On Mac and Windows data is always in a separate file + // so that the binary can be signed QString binaryName = isInstaller() ? installerBinaryPath() : maintenanceToolName(); QDir dataPath(QFileInfo(binaryName).dir()); +#ifdef Q_OS_OSX dataPath.cdUp(); dataPath.cd(QLatin1String("Resources")); +#endif input.setFileName(dataPath.filePath(QLatin1String("installer.dat"))); QInstaller::openForRead(&input); -- cgit v1.2.3