From 3d8537922cd14e2b7321e05a7ec3c6ffea46f729 Mon Sep 17 00:00:00 2001 From: ck <qt-info@nokia.com> Date: Wed, 14 Apr 2010 14:45:04 +0200 Subject: [PATCH] Maemo: Introduce functions for package name construction. --- .../qt-maemo/maemopackagecreationstep.cpp | 29 ++++++++++++++----- .../qt-maemo/maemopackagecreationstep.h | 4 +++ 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp index 9d3fc608768..23d64775d03 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp @@ -134,7 +134,7 @@ bool MaemoPackageCreationStep::createPackage() if (!QFileInfo(projectDir + QLatin1String("/debian")).exists()) { const QString command = QLatin1String("dh_make -s -n -p ") - % executableFileName() % QLatin1String("_0.1"); + % executableFileName() % versionString(); if (!runCommand(buildProc, command)) return false; QFile rulesFile(projectDir + QLatin1String("/debian/rules")); @@ -245,18 +245,33 @@ QString MaemoPackageCreationStep::targetRoot() const bool MaemoPackageCreationStep::packagingNeeded() const { -#if 0 - QFileInfo execInfo(executable()); - const QString packageFile = execInfo.absolutePath() % QLatin1Char('/') - % executableFileName() % QLatin1String("_0.1_armel.deb"); - QFileInfo packageInfo(packageFile); +#if 1 + // TODO: When the package contents get user-modifiable, we need + // to check whether files have been added and/or removed and whether + // the newest one is newer than the package. + // For the first check, we should have a switch that the widget sets + // to true when the user has changed the package contents and which + // we set to false after a successful package creation. + QFileInfo packageInfo(packageFilePath(executable())); return !packageInfo.exists() - || packageInfo.lastModified() <= execInfo.lastModified(); + || packageInfo.lastModified() <= QFileInfo(executable()).lastModified(); #else return false; #endif } +QString MaemoPackageCreationStep::packageFilePath(const QString &executableFilePath) +{ + return executableFilePath % QLatin1Char('/') + % QFileInfo(executableFilePath).fileName() % versionString() + % QLatin1String("_armel.deb"); +} + +QString MaemoPackageCreationStep::versionString() +{ + return QLatin1String("_0.1"); +} + const QLatin1String MaemoPackageCreationStep::CreatePackageId("Qt4ProjectManager.MaemoPackageCreationStep"); } // namespace Internal diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.h b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.h index b80ce7db881..c02020301f0 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.h @@ -59,6 +59,8 @@ class MaemoPackageCreationStep : public ProjectExplorer::BuildStep friend class MaemoPackageCreationFactory; public: MaemoPackageCreationStep(ProjectExplorer::BuildConfiguration *buildConfig); + + static QString packageFilePath(const QString &executableFilePath); private: MaemoPackageCreationStep(ProjectExplorer::BuildConfiguration *buildConfig, MaemoPackageCreationStep *other); @@ -78,6 +80,8 @@ private: QString targetRoot() const; bool packagingNeeded() const; + static QString versionString(); + static const QLatin1String CreatePackageId; }; -- GitLab