forked from qt-creator/qt-creator
Maemo: Adapt Debian files.
- Set priority to "optional", as recommended for Maemo. - Fix rules file so it can be used for source packages.
This commit is contained in:
@@ -204,6 +204,13 @@ bool MaemoTemplatesManager::adaptRulesFile(const Project *project)
|
|||||||
rulesContents.replace("DESTDIR", "INSTALL_ROOT");
|
rulesContents.replace("DESTDIR", "INSTALL_ROOT");
|
||||||
rulesContents.replace("dh_shlibdeps", "# dh_shlibdeps");
|
rulesContents.replace("dh_shlibdeps", "# dh_shlibdeps");
|
||||||
rulesContents.replace("dh_strip", "# dh_strip");
|
rulesContents.replace("dh_strip", "# dh_strip");
|
||||||
|
rulesContents.replace("$(MAKE) clean", "# $(MAKE) clean");
|
||||||
|
const Qt4Project * const qt4Project
|
||||||
|
= static_cast<const Qt4Project *>(project);
|
||||||
|
const QString proFileName
|
||||||
|
= QFileInfo(qt4Project->rootProjectNode()->path()).fileName();
|
||||||
|
rulesContents.replace("# Add here commands to configure the package.",
|
||||||
|
"qmake " + proFileName.toLocal8Bit());
|
||||||
|
|
||||||
// Would be the right solution, but does not work (on Windows),
|
// Would be the right solution, but does not work (on Windows),
|
||||||
// because dpkg-genchanges doesn't know about it (and can't be told).
|
// because dpkg-genchanges doesn't know about it (and can't be told).
|
||||||
@@ -228,20 +235,12 @@ bool MaemoTemplatesManager::adaptControlFile(const Project *project)
|
|||||||
.arg(QDir::toNativeSeparators(controlFilePath(project))));
|
.arg(QDir::toNativeSeparators(controlFilePath(project))));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
QByteArray sectionLine = "Section: user/hidden";
|
|
||||||
QByteArray controlContents = controlFile.readAll();
|
QByteArray controlContents = controlFile.readAll();
|
||||||
const int sectionOffset = controlContents.indexOf("Section:");
|
|
||||||
if (sectionOffset == -1) {
|
adaptControlFileField(controlContents, "Section", "user/hidden");
|
||||||
controlContents.append(sectionLine).append('\n');
|
adaptControlFileField(controlContents, "Priority", "optional");
|
||||||
} else {
|
|
||||||
int sectionNewlineOffset = controlContents.indexOf('\n', sectionOffset);
|
|
||||||
if (sectionNewlineOffset == -1) {
|
|
||||||
sectionNewlineOffset = controlContents.length();
|
|
||||||
sectionLine += '\n';
|
|
||||||
}
|
|
||||||
controlContents.replace(sectionOffset,
|
|
||||||
sectionNewlineOffset - sectionOffset, sectionLine);
|
|
||||||
}
|
|
||||||
controlFile.resize(0);
|
controlFile.resize(0);
|
||||||
controlFile.write(controlContents);
|
controlFile.write(controlContents);
|
||||||
controlFile.close();
|
controlFile.close();
|
||||||
@@ -253,6 +252,23 @@ bool MaemoTemplatesManager::adaptControlFile(const Project *project)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MaemoTemplatesManager::adaptControlFileField(QByteArray &document,
|
||||||
|
const QByteArray &fieldName, const QByteArray &newFieldValue)
|
||||||
|
{
|
||||||
|
QByteArray adaptedLine = fieldName + ": " + newFieldValue;
|
||||||
|
const int lineOffset = document.indexOf(fieldName + ":");
|
||||||
|
if (lineOffset == -1) {
|
||||||
|
document.append(adaptedLine).append('\n');
|
||||||
|
} else {
|
||||||
|
int newlineOffset = document.indexOf('\n', lineOffset);
|
||||||
|
if (newlineOffset == -1) {
|
||||||
|
newlineOffset = document.length();
|
||||||
|
adaptedLine += '\n';
|
||||||
|
}
|
||||||
|
document.replace(lineOffset, newlineOffset - lineOffset, adaptedLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool MaemoTemplatesManager::updateDesktopFiles(const Qt4Target *target)
|
bool MaemoTemplatesManager::updateDesktopFiles(const Qt4Target *target)
|
||||||
{
|
{
|
||||||
const Qt4Target * const qt4Target = qobject_cast<const Qt4Target *>(target);
|
const Qt4Target * const qt4Target = qobject_cast<const Qt4Target *>(target);
|
||||||
|
|||||||
@@ -98,6 +98,8 @@ private:
|
|||||||
int &lineEndPos, int &valuePos);
|
int &lineEndPos, int &valuePos);
|
||||||
bool adaptRulesFile(const ProjectExplorer::Project *project);
|
bool adaptRulesFile(const ProjectExplorer::Project *project);
|
||||||
bool adaptControlFile(const ProjectExplorer::Project *project);
|
bool adaptControlFile(const ProjectExplorer::Project *project);
|
||||||
|
void adaptControlFileField(QByteArray &document, const QByteArray &fieldName,
|
||||||
|
const QByteArray &newFieldValue);
|
||||||
QSharedPointer<QFile> openFile(const QString &filePath,
|
QSharedPointer<QFile> openFile(const QString &filePath,
|
||||||
QIODevice::OpenMode mode, QString *error) const;
|
QIODevice::OpenMode mode, QString *error) const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user