diff options
author | kh1 <karsten.heimrich@nokia.com> | 2011-08-16 13:52:41 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@nokia.com> | 2011-08-16 14:24:11 +0200 |
commit | 1d62378085a2e193384e2022db834123129df131 (patch) | |
tree | 54f3b27499941cd95af794cec607aca1fbbb035c /installerbuilder | |
parent | 5a453faff78b820604bb623945e283e648a07721 (diff) |
Remove compressing resources and operations.
Causes way to much trouble during an update.
Change-Id: I46ea549e5a6395d59182524570925843983c6954
Reviewed-on: http://codereview.qt.nokia.com/3007
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com>
Diffstat (limited to 'installerbuilder')
-rw-r--r-- | installerbuilder/common/binaryformat.cpp | 17 | ||||
-rw-r--r-- | installerbuilder/common/binaryformat.h | 2 | ||||
-rw-r--r-- | installerbuilder/libinstaller/packagemanagercore_p.cpp | 29 | ||||
-rw-r--r-- | installerbuilder/libinstaller/packagemanagercore_p.h | 2 |
4 files changed, 15 insertions, 35 deletions
diff --git a/installerbuilder/common/binaryformat.cpp b/installerbuilder/common/binaryformat.cpp index a93202d85..01d028ca5 100644 --- a/installerbuilder/common/binaryformat.cpp +++ b/installerbuilder/common/binaryformat.cpp @@ -753,7 +753,7 @@ static QVector<QByteArray> sResourceVec; \internal Registers the resource found at \a segment within \a file into the Qt resource system. */ -static const uchar* addResourceFromBinary(QFile* file, const Range<qint64> &segment, bool compressed) +static const uchar* addResourceFromBinary(QFile* file, const Range<qint64> &segment) { if (segment.length() <= 0) return 0; @@ -762,8 +762,7 @@ static const uchar* addResourceFromBinary(QFile* file, const Range<qint64> &segm throw Error(QObject::tr("Could not seek to in-binary resource. (offset: %1, length: %2") .arg(QString::number(segment.start()), QString::number(segment.length()))); } - sResourceVec.append(compressed ? retrieveCompressedData(file, segment.length()) : retrieveData(file, - segment.length())); + sResourceVec.append(retrieveData(file, segment.length())); if (!QResource::registerResource((const uchar*)(sResourceVec.last().constData()), QLatin1String(":/metadata"))) { @@ -891,8 +890,7 @@ BinaryContent BinaryContent::readFromBinary(const QString &path) // check for supported binary data file, will throw if we can't find a marker try { const qint64 cookiePos = findMagicCookie(c.m_binaryFile.data(), QInstaller::MagicCookieDat); - readBinaryData(c, c.m_binaryFile, readBinaryLayout(c.m_binaryFile.data(), cookiePos), - true); + readBinaryData(c, c.m_binaryFile, readBinaryLayout(c.m_binaryFile.data(), cookiePos)); retry = false; } catch (const Error &error) { // this seems to be an unsupported dat file, try to read from original binary @@ -905,7 +903,7 @@ BinaryContent BinaryContent::readFromBinary(const QString &path) } if (retry) - readBinaryData(c, c.m_binary, layout, false); + readBinaryData(c, c.m_binary, layout); return c; } @@ -950,7 +948,7 @@ BinaryLayout BinaryContent::readBinaryLayout(QIODevice *const file, qint64 cooki /* static */ void BinaryContent::readBinaryData(BinaryContent &content, const QSharedPointer<QFile> &file, - const BinaryLayout &layout, bool compressed) + const BinaryLayout &layout) { content.m_magicmarker = layout.magicMarker; content.m_metadataResourceSegments = layout.metadataResourceSegments; @@ -969,8 +967,7 @@ void BinaryContent::readBinaryData(BinaryContent &content, const QSharedPointer< Q_ASSERT_X(op, __FUNCTION__, QString::fromLatin1("Invalid operation name: %1").arg(name) .toLatin1()); - const QString xml = (compressed ? QString::fromUtf8(qUncompress(retrieveByteArray(file.data()))) - : retrieveString(file.data())); + const QString xml = retrieveString(file.data()); if (!op->fromXml(xml)) qWarning() << "Failed to load XML for operation:" << name; verbose() << "Operation name: " << name << "\nOperation xml:\n" << xml.leftRef(1000) << std::endl; @@ -1027,7 +1024,7 @@ int BinaryContent::registerEmbeddedQResources() } foreach (const Range<qint64> &i, m_metadataResourceSegments) - m_resourceMappings.append(addResourceFromBinary(data, i, hasBinaryDataFile)); + m_resourceMappings.append(addResourceFromBinary(data, i)); m_binary.clear(); if (hasBinaryDataFile) diff --git a/installerbuilder/common/binaryformat.h b/installerbuilder/common/binaryformat.h index 1269eb18b..47e4159e7 100644 --- a/installerbuilder/common/binaryformat.h +++ b/installerbuilder/common/binaryformat.h @@ -199,7 +199,7 @@ public: private: static void readBinaryData(BinaryContent &content, const QSharedPointer<QFile> &file, - const BinaryLayout &layout, bool compressed); + const BinaryLayout &layout); private: QSharedPointer<QFile> m_binary; diff --git a/installerbuilder/libinstaller/packagemanagercore_p.cpp b/installerbuilder/libinstaller/packagemanagercore_p.cpp index 18e6c4f52..1d906f87d 100644 --- a/installerbuilder/libinstaller/packagemanagercore_p.cpp +++ b/installerbuilder/libinstaller/packagemanagercore_p.cpp @@ -775,28 +775,15 @@ void PackageManagerCorePrivate::writeUninstallerBinary(QFile *const input, qint6 } void PackageManagerCorePrivate::writeUninstallerBinaryData(QIODevice *output, QFile *const input, - const OperationList &performedOperations, const BinaryLayout &layout, bool compressOperations, - bool forceUncompressedResources) + const OperationList &performedOperations, const BinaryLayout &layout) { const qint64 dataBlockStart = output->pos(); QVector<Range<qint64> >resourceSegments; foreach (const Range<qint64> &segment, layout.metadataResourceSegments) { input->seek(segment.start()); - if (isInstaller()) { - const qint64 compressedSize = appendCompressedData(output, input, segment.length()); - resourceSegments.append(Range<qint64>::fromStartAndLength(output->pos() - compressedSize, - compressedSize)); - } else if (forceUncompressedResources) { - QBuffer resource; - resource.setData(retrieveCompressedData(input, segment.length())); - resource.open(QIODevice::ReadOnly); - resourceSegments.append(Range<qint64>::fromStartAndLength(output->pos(), resource.size())); - appendData(output, &resource, resource.size()); - } else { - resourceSegments.append(Range<qint64>::fromStartAndLength(output->pos(), segment.length())); - appendData(output, input, segment.length()); - } + resourceSegments.append(Range<qint64>::fromStartAndLength(output->pos(), segment.length())); + appendData(output, input, segment.length()); } const qint64 operationsStart = output->pos(); @@ -806,8 +793,7 @@ void PackageManagerCorePrivate::writeUninstallerBinaryData(QIODevice *output, QF operation->clearValue(QLatin1String("installer")); appendString(output, operation->name()); - compressOperations ? appendByteArray(output, qCompress(operation->toXml().toByteArray())) - : appendString(output, operation->toXml().toString()); + appendString(output, operation->toXml().toString()); // for the ui not to get blocked qApp->processEvents(); @@ -1015,7 +1001,6 @@ void PackageManagerCorePrivate::writeUninstaller(OperationList performedOperatio QFile input; BinaryLayout layout; - bool forceUncompressedResourcesOnError = false; const QString dataFile = targetDir() + QLatin1Char('/') + m_settings.uninstallerName() + QLatin1String(".dat"); try { @@ -1026,7 +1011,6 @@ void PackageManagerCorePrivate::writeUninstaller(OperationList performedOperatio input.setFileName(dataFile); openForRead(&input, input.fileName()); layout = BinaryContent::readBinaryLayout(&input, findMagicCookie(&input, MagicCookieDat)); - forceUncompressedResourcesOnError = true; } catch (const Error &/*error*/) { input.setFileName(isInstaller() ? installerBinaryPath() : uninstallerName()); openForRead(&input, input.fileName()); @@ -1040,7 +1024,7 @@ void PackageManagerCorePrivate::writeUninstaller(OperationList performedOperatio try { KDSaveFile file(dataFile + QLatin1String(".new")); openForWrite(&file, file.fileName()); - writeUninstallerBinaryData(&file, &input, performedOperations, layout, true, false); + writeUninstallerBinaryData(&file, &input, performedOperations, layout); appendInt64(&file, MagicCookieDat); file.setPermissions(file.permissions() | QFile::WriteUser | QFile::ReadGroup | QFile::ReadOther); @@ -1060,8 +1044,7 @@ void PackageManagerCorePrivate::writeUninstaller(OperationList performedOperatio QFile file(uninstallerName() + QLatin1String(".new")); openForAppend(&file, file.fileName()); file.seek(file.size()); - writeUninstallerBinaryData(&file, &input, performedOperations, layout, false, - forceUncompressedResourcesOnError); + writeUninstallerBinaryData(&file, &input, performedOperations, layout); appendInt64(&file, MagicCookie); } input.close(); diff --git a/installerbuilder/libinstaller/packagemanagercore_p.h b/installerbuilder/libinstaller/packagemanagercore_p.h index 439dcee4d..be73fbdfa 100644 --- a/installerbuilder/libinstaller/packagemanagercore_p.h +++ b/installerbuilder/libinstaller/packagemanagercore_p.h @@ -191,7 +191,7 @@ private: void writeUninstallerBinary(QFile *const input, qint64 size, bool writeBinaryLayout); void writeUninstallerBinaryData(QIODevice *output, QFile *const input, const OperationList &performed, - const BinaryLayout &layout, bool compressOperations, bool forceUncompressedResources); + const BinaryLayout &layout); void runUndoOperations(const OperationList &undoOperations, double undoOperationProgressSize, bool adminRightsGained, bool deleteOperation); |