Maemo: Introduce functions for package name construction.

This commit is contained in:
ck
2010-04-14 14:45:04 +02:00
parent 2d7b3bf4a0
commit 3d8537922c
2 changed files with 26 additions and 7 deletions

View File

@@ -134,7 +134,7 @@ bool MaemoPackageCreationStep::createPackage()
if (!QFileInfo(projectDir + QLatin1String("/debian")).exists()) { if (!QFileInfo(projectDir + QLatin1String("/debian")).exists()) {
const QString command = QLatin1String("dh_make -s -n -p ") const QString command = QLatin1String("dh_make -s -n -p ")
% executableFileName() % QLatin1String("_0.1"); % executableFileName() % versionString();
if (!runCommand(buildProc, command)) if (!runCommand(buildProc, command))
return false; return false;
QFile rulesFile(projectDir + QLatin1String("/debian/rules")); QFile rulesFile(projectDir + QLatin1String("/debian/rules"));
@@ -245,18 +245,33 @@ QString MaemoPackageCreationStep::targetRoot() const
bool MaemoPackageCreationStep::packagingNeeded() const bool MaemoPackageCreationStep::packagingNeeded() const
{ {
#if 0 #if 1
QFileInfo execInfo(executable()); // TODO: When the package contents get user-modifiable, we need
const QString packageFile = execInfo.absolutePath() % QLatin1Char('/') // to check whether files have been added and/or removed and whether
% executableFileName() % QLatin1String("_0.1_armel.deb"); // the newest one is newer than the package.
QFileInfo packageInfo(packageFile); // 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() return !packageInfo.exists()
|| packageInfo.lastModified() <= execInfo.lastModified(); || packageInfo.lastModified() <= QFileInfo(executable()).lastModified();
#else #else
return false; return false;
#endif #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"); const QLatin1String MaemoPackageCreationStep::CreatePackageId("Qt4ProjectManager.MaemoPackageCreationStep");
} // namespace Internal } // namespace Internal

View File

@@ -59,6 +59,8 @@ class MaemoPackageCreationStep : public ProjectExplorer::BuildStep
friend class MaemoPackageCreationFactory; friend class MaemoPackageCreationFactory;
public: public:
MaemoPackageCreationStep(ProjectExplorer::BuildConfiguration *buildConfig); MaemoPackageCreationStep(ProjectExplorer::BuildConfiguration *buildConfig);
static QString packageFilePath(const QString &executableFilePath);
private: private:
MaemoPackageCreationStep(ProjectExplorer::BuildConfiguration *buildConfig, MaemoPackageCreationStep(ProjectExplorer::BuildConfiguration *buildConfig,
MaemoPackageCreationStep *other); MaemoPackageCreationStep *other);
@@ -78,6 +80,8 @@ private:
QString targetRoot() const; QString targetRoot() const;
bool packagingNeeded() const; bool packagingNeeded() const;
static QString versionString();
static const QLatin1String CreatePackageId; static const QLatin1String CreatePackageId;
}; };