Commit b002eee6 authored by Christian Kandeler's avatar Christian Kandeler
Browse files

Maemo: Fix newlines in debian files when publishing.

The build server does not like CRLF.
parent 23a94c52
......@@ -138,6 +138,11 @@ void MaemoPublisherFremantleFree::createPackage()
tr("Publishing failed: Could not create source package."));
return;
}
if (!fixNewlines()) {
finishWithFailure(tr("Error: Could not fix newlines"),
tr("Publishing failed: Could not create source package."));
return;
}
QString error;
if (!updateDesktopFiles(&error)) {
......@@ -223,6 +228,25 @@ bool MaemoPublisherFremantleFree::copyRecursively(const QString &srcFilePath,
return true;
}
bool MaemoPublisherFremantleFree::fixNewlines()
{
QDir debianDir(m_tmpProjectDir + QLatin1String("/debian"));
const QStringList &fileNames = debianDir.entryList(QDir::Files);
foreach (const QString &fileName, fileNames) {
QFile file(debianDir.filePath(fileName));
if (!file.open(QIODevice::ReadWrite))
return false;
QByteArray contents = file.readAll();
const QByteArray crlf("\r\n");
if (!contents.contains(crlf))
continue;
contents.replace(crlf, "\n");
file.resize(0);
file.write(contents);
}
return true;
}
void MaemoPublisherFremantleFree::handleProcessError(QProcess::ProcessError error)
{
if (error == QProcess::FailedToStart)
......
......@@ -90,6 +90,7 @@ private:
void uploadPackage();
bool copyRecursively(const QString &srcFilePath,
const QString &tgtFilePath);
bool fixNewlines();
void handleProcessFinished(bool failedToStart);
void runDpkgBuildPackage();
QString tmpDirContainer() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment