Maemo: Don't use dpkg-buildpackage.

Reverts the core changes of 5b47f47dc9,
which was a horrible mistake and could not possibly have worked
with this branch.
This commit is contained in:
ck
2010-07-28 11:53:12 +02:00
parent ed0394d452
commit 01f90a9723

View File

@@ -195,10 +195,6 @@ bool MaemoPackageCreationStep::createPackage()
QByteArray rulesContents = rulesFile.readAll(); QByteArray rulesContents = rulesFile.readAll();
rulesContents.replace("DESTDIR", "INSTALL_ROOT"); rulesContents.replace("DESTDIR", "INSTALL_ROOT");
// Would be the right solution, but does not work (on Windows),
// because dpkg-genchanges doesn't know about it (and can't be told).
// rulesContents.replace("dh_builddeb", "dh_builddeb --destdir=.");
rulesFile.resize(0); rulesFile.resize(0);
rulesFile.write(rulesContents); rulesFile.write(rulesContents);
if (rulesFile.error() != QFile::NoError) { if (rulesFile.error() != QFile::NoError) {
@@ -220,30 +216,43 @@ bool MaemoPackageCreationStep::createPackage()
} }
} }
if (!runCommand(QLatin1String("dpkg-buildpackage -nc -uc -us"))) if (!runCommand(QLatin1String("dh_installdirs")))
return false; return false;
// Workaround for non-working dh_builddeb --destdir=. const QDir debianRoot = QDir(buildDir % QLatin1String("/debian/")
if (!QDir(buildDir).isRoot()) { % executableFileName().toLower());
const QString packageFileName = QFileInfo(packageFilePath()).fileName(); for (int i = 0; i < m_packageContents->rowCount(); ++i) {
const QString changesFileName = QFileInfo(packageFileName) const MaemoDeployable &d = m_packageContents->deployableAt(i);
.completeBaseName() + QLatin1String(".changes"); const QString targetFile = debianRoot.path() + '/' + d.remoteFilePath;
const QString packageSourceDir = buildDir + QLatin1String("/../"); const QString absTargetDir = QFileInfo(targetFile).dir().path();
const QString packageSourceFilePath const QString relTargetDir = debianRoot.relativeFilePath(absTargetDir);
= packageSourceDir + packageFileName; if (!debianRoot.exists(relTargetDir)
const QString changesSourceFilePath && !debianRoot.mkpath(relTargetDir)) {
= packageSourceDir + changesFileName; raiseError(tr("Packaging Error: Could not create directory '%1'.")
const QString changesTargetFilePath .arg(QDir::toNativeSeparators(absTargetDir)));
= buildDir + QLatin1Char('/') + changesFileName;
QFile::remove(packageFilePath());
QFile::remove(changesTargetFilePath);
if (!QFile::rename(packageSourceFilePath, packageFilePath())
|| !QFile::rename(changesSourceFilePath, changesTargetFilePath)) {
raiseError(tr("Packaging failed."),
tr("Could not move package files from %1 to %2.")
.arg(packageSourceDir, buildDir));
return false; return false;
} }
if (QFile::exists(targetFile) && !QFile::remove(targetFile)) {
raiseError(tr("Packaging Error: Could not replace file '%1'.")
.arg(QDir::toNativeSeparators(targetFile)));
return false;
}
if (!QFile::copy(d.localFilePath, targetFile)) {
raiseError(tr("Packaging Error: Could not copy '%1' to '%2'.")
.arg(QDir::toNativeSeparators(d.localFilePath))
.arg(QDir::toNativeSeparators(targetFile)));
return false;
}
}
const QStringList commands = QStringList() << QLatin1String("dh_link")
<< QLatin1String("dh_fixperms") << QLatin1String("dh_installdeb")
<< QLatin1String("dh_gencontrol") << QLatin1String("dh_md5sums")
<< QLatin1String("dh_builddeb --destdir=.");
foreach (const QString &command, commands) {
if (!runCommand(command))
return false;
} }
emit addOutput(tr("Package created."), textCharFormat); emit addOutput(tr("Package created."), textCharFormat);