diff options
Diffstat (limited to 'src/libs/installer/packagemanagercore_p.cpp')
-rw-r--r-- | src/libs/installer/packagemanagercore_p.cpp | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp index 1e271a0d5..7f0d2f722 100644 --- a/src/libs/installer/packagemanagercore_p.cpp +++ b/src/libs/installer/packagemanagercore_p.cpp @@ -1011,12 +1011,14 @@ void PackageManagerCorePrivate::writeMaintenanceToolBinary(QFile *const input, q QInstaller::appendData(&out, input, size); if (writeBinaryLayout) { -#ifdef Q_OS_OSX + 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; @@ -1043,14 +1045,6 @@ void PackageManagerCorePrivate::writeMaintenanceToolBinary(QFile *const input, q dataOut.setAutoRemove(false); dataOut.setPermissions(dataOut.permissions() | QFile::WriteUser | QFile::ReadGroup | QFile::ReadOther); -#else - QInstaller::appendInt64(&out, 0); // operations start - QInstaller::appendInt64(&out, 0); // operations end - QInstaller::appendInt64(&out, 0); // resource count - QInstaller::appendInt64(&out, 4 * sizeof(qint64)); // data block size - QInstaller::appendInt64(&out, BinaryContent::MagicUninstallerMarker); - QInstaller::appendInt64(&out, BinaryContent::MagicCookie); -#endif } { @@ -1312,14 +1306,19 @@ void PackageManagerCorePrivate::writeMaintenanceTool(OperationList performedOper QInstaller::openForRead(&input); layout = BinaryContent::binaryLayout(&input, BinaryContent::MagicCookieDat); } catch (const Error &/*error*/) { + // We are only here when using installer + QString binaryName = installerBinaryPath(); + // On Mac data is always in a separate file so that the binary can be signed. + // On other platforms data is in separate file only after install so that the + // maintenancetool sign does not break. #ifdef Q_OS_OSX - // On Mac, data is always in a separate file so that the binary can be signed - QString binaryName = isInstaller() ? installerBinaryPath() : maintenanceToolName(); QDir dataPath(QFileInfo(binaryName).dir()); dataPath.cdUp(); dataPath.cd(QLatin1String("Resources")); input.setFileName(dataPath.filePath(QLatin1String("installer.dat"))); - +#else + input.setFileName(binaryName); +#endif QInstaller::openForRead(&input); layout = BinaryContent::binaryLayout(&input, BinaryContent::MagicCookie); @@ -1329,16 +1328,6 @@ void PackageManagerCorePrivate::writeMaintenanceTool(OperationList performedOper QInstaller::openForRead(&tmp); writeMaintenanceToolBinary(&tmp, tmp.size(), true); } -#else - input.setFileName(isInstaller() ? installerBinaryPath() : maintenanceToolName()); - QInstaller::openForRead(&input); - layout = BinaryContent::binaryLayout(&input, BinaryContent::MagicCookie); - if (!newBinaryWritten) { - newBinaryWritten = true; - writeMaintenanceToolBinary(&input, layout.endOfBinaryContent - - layout.binaryContentSize, true); - } -#endif } performedOperations = sortOperationsBasedOnComponentDependencies(performedOperations); @@ -1347,7 +1336,6 @@ void PackageManagerCorePrivate::writeMaintenanceTool(OperationList performedOper try { QTemporaryFile file; QInstaller::openForWrite(&file); - writeMaintenanceToolBinaryData(&file, &input, performedOperations, layout); QInstaller::appendInt64(&file, BinaryContent::MagicCookieDat); |