summaryrefslogtreecommitdiff
path: root/src/plugins/madde/maemopublisherfremantlefree.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/madde/maemopublisherfremantlefree.cpp')
-rw-r--r--src/plugins/madde/maemopublisherfremantlefree.cpp81
1 files changed, 7 insertions, 74 deletions
diff --git a/src/plugins/madde/maemopublisherfremantlefree.cpp b/src/plugins/madde/maemopublisherfremantlefree.cpp
index b4308e9281..604fd0e195 100644
--- a/src/plugins/madde/maemopublisherfremantlefree.cpp
+++ b/src/plugins/madde/maemopublisherfremantlefree.cpp
@@ -42,8 +42,6 @@
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtkitinformation.h>
-#include <remotelinux/deployablefilesperprofile.h>
-#include <remotelinux/deploymentinfo.h>
#include <utils/fileutils.h>
#include <utils/qtcassert.h>
#include <ssh/sshremoteprocessrunner.h>
@@ -59,6 +57,7 @@ using namespace Core;
using namespace Qt4ProjectManager;
using namespace RemoteLinux;
using namespace QSsh;
+using namespace Utils;
namespace Madde {
namespace Internal {
@@ -128,7 +127,7 @@ void MaemoPublisherFremantleFree::createPackage()
if (QFileInfo(tmpDirContainer()).exists()) {
emit progressReport(tr("Removing left-over temporary directory..."));
QString error;
- if (!Utils::FileUtils::removeRecursively(tmpDirContainer(), &error)) {
+ if (!FileUtils::removeRecursively(FileName::fromString(tmpDirContainer()), &error)) {
finishWithFailure(tr("Error removing temporary directory: %1").arg(error),
tr("Publishing failed: Could not create source package."));
return;
@@ -152,13 +151,6 @@ void MaemoPublisherFremantleFree::createPackage()
return;
}
- QString error;
- if (!updateDesktopFiles(&error)) {
- finishWithFailure(error,
- tr("Publishing failed: Could not create package."));
- return;
- }
-
emit progressReport(tr("Cleaning up temporary directory..."));
AbstractMaemoPackageCreationStep::preparePackagingProcess(m_process,
m_buildConfig, m_tmpProjectDir);
@@ -209,7 +201,7 @@ bool MaemoPublisherFremantleFree::copyRecursively(const QString &srcFilePath,
}
} else {
if (tgtFilePath == m_tmpProjectDir + QLatin1String("/debian/rules")) {
- Utils::FileReader reader;
+ FileReader reader;
if (!reader.fetch(srcFilePath)) {
emit progressReport(reader.errorString(), ErrorOutput);
return false;
@@ -219,7 +211,7 @@ bool MaemoPublisherFremantleFree::copyRecursively(const QString &srcFilePath,
rulesContents.replace("# Add here commands to configure the package.",
"qmake " + QFileInfo(m_project->document()->fileName()).fileName().toLocal8Bit());
MaemoDebianPackageCreationStep::ensureShlibdeps(rulesContents);
- Utils::FileSaver saver(tgtFilePath);
+ FileSaver saver(tgtFilePath);
saver.write(rulesContents);
if (!saver.finalize()) {
emit progressReport(saver.errorString(), ErrorOutput);
@@ -251,7 +243,7 @@ bool MaemoPublisherFremantleFree::fixNewlines()
const QStringList &fileNames = debianDir.entryList(QDir::Files);
foreach (const QString &fileName, fileNames) {
QString filePath = debianDir.filePath(fileName);
- Utils::FileReader reader;
+ FileReader reader;
if (!reader.fetch(filePath))
return false;
QByteArray contents = reader.data();
@@ -259,7 +251,7 @@ bool MaemoPublisherFremantleFree::fixNewlines()
if (!contents.contains(crlf))
continue;
contents.replace(crlf, "\n");
- Utils::FileSaver saver(filePath);
+ FileSaver saver(filePath);
saver.write(contents);
if (!saver.finalize())
return false;
@@ -373,7 +365,7 @@ void MaemoPublisherFremantleFree::runDpkgBuildPackage()
}
foreach (const QString &filePath, d.filesToExclude()) {
QString error;
- if (!Utils::FileUtils::removeRecursively(filePath, &error)) {
+ if (!FileUtils::removeRecursively(FileName::fromString(filePath), &error)) {
finishWithFailure(error,
tr("Publishing failed: Could not create package."));
}
@@ -541,65 +533,6 @@ void MaemoPublisherFremantleFree::finishWithFailure(const QString &progressMsg,
setState(Inactive);
}
-bool MaemoPublisherFremantleFree::updateDesktopFiles(QString *error) const
-{
- bool success = true;
- const Qt4MaemoDeployConfiguration *const deployConfig
- = qobject_cast<Qt4MaemoDeployConfiguration *>(m_buildConfig->target()->activeDeployConfiguration());
- QTC_ASSERT(deployConfig, return false);
- const DeploymentInfo *const deploymentInfo = deployConfig->deploymentInfo();
- for (int i = 0; i < deploymentInfo->modelCount(); ++i) {
- const DeployableFilesPerProFile * const model = deploymentInfo->modelAt(i);
- QString desktopFilePath = deployConfig->localDesktopFilePath(model);
- if (desktopFilePath.isEmpty())
- continue;
- desktopFilePath.replace(model->projectDir(), m_tmpProjectDir);
- const QString executableFilePath = model->remoteExecutableFilePath();
- if (executableFilePath.isEmpty()) {
- qDebug("%s: Skipping subproject %s with missing deployment information.",
- Q_FUNC_INFO, qPrintable(model->proFilePath()));
- continue;
- }
- Utils::FileReader reader;
- if (!reader.fetch(desktopFilePath, error)) {
- success = false;
- continue;
- }
- QByteArray desktopFileContents = reader.data();
- bool fileNeedsUpdate = addOrReplaceDesktopFileValue(desktopFileContents,
- "Exec", executableFilePath.toUtf8());
- if (fileNeedsUpdate) {
- Utils::FileSaver saver(desktopFilePath);
- saver.write(desktopFileContents);
- if (!saver.finalize(error))
- success = false;
- }
- }
- return success;
-}
-
-bool MaemoPublisherFremantleFree::addOrReplaceDesktopFileValue(QByteArray &fileContent,
- const QByteArray &key, const QByteArray &newValue) const
-{
- const int keyPos = fileContent.indexOf(key + '=');
- if (keyPos == -1) {
- if (!fileContent.endsWith('\n'))
- fileContent += '\n';
- fileContent += key + '=' + newValue + '\n';
- return true;
- }
- int nextNewlinePos = fileContent.indexOf('\n', keyPos);
- if (nextNewlinePos == -1)
- nextNewlinePos = fileContent.count();
- const int replacePos = keyPos + key.count() + 1;
- const int replaceCount = nextNewlinePos - replacePos;
- const QByteArray &oldValue = fileContent.mid(replacePos, replaceCount);
- if (oldValue == newValue)
- return false;
- fileContent.replace(replacePos, replaceCount, newValue);
- return true;
-}
-
QStringList MaemoPublisherFremantleFree::findProblems() const
{
QStringList problems;