forked from qt-creator/qt-creator
Maemo: Fix newlines in debian files when publishing.
The build server does not like CRLF.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user