Commit 8dc93f55 authored by Lukas Appelhans's avatar Lukas Appelhans
Browse files

Replace all qDebug() with akabeiDebug()

parent d99dfdff
......@@ -344,7 +344,7 @@ Backend::Backend(QObject* parent)
// We need at least 2 threads in QThreadPool to make everything work correctly.
if (QThreadPool::globalInstance()->maxThreadCount() < 2) {
qDebug() << "Set max thread count to 2";
akabeiDebug() << "Set max thread count to 2";
QThreadPool::globalInstance()->setMaxThreadCount(2);
}
}
......@@ -369,7 +369,7 @@ void Backend::initialize()
lockinfo.l_len = 0;
if (fcntl(d->localDatabaseFileHandler->handle(), F_SETLK, &lockinfo) == -1) {
qDebug() << "No lock for us!";
akabeiDebug() << "No lock for us!";
d->setStatus(StatusWaitingForLock);
connect(&d->lockWatcher, SIGNAL(finished()), SLOT(__k__lockGranted()));
QFuture<void> lockF = QtConcurrent::run(d, &BackendPrivate::getLock);
......@@ -624,7 +624,7 @@ Package* Backend::loadPackageFromFile(const QString& path)
}
} catch (ArchiveException& e) {
qDebug() << "Error during access in archive: " << e.what();
akabeiDebug() << "Error during access in archive: " << e.what();
delete retpackage;
return 0;
}
......@@ -709,7 +709,7 @@ Delta* Backend::loadDeltaFromFile(const QString& path)
}
}
} catch (ArchiveException const& e) {
qDebug() << "Error during access to archive: " << e.what();
akabeiDebug() << "Error during access to archive: " << e.what();
delete retdelta;
return 0;
}
......
......@@ -17,7 +17,7 @@
#include <QHash>
#include <QDir>
#include <QDateTime>
#include <QDebug>
#include <akabeidebug.h>
#include <akabeibackend.h>
......
......@@ -16,6 +16,7 @@
#include <akabeihelpers_p.h>
#include <akabeidelta_p.h>
#include <akabeihook_p.h>
#include <akabeidebug.h>
namespace Akabei {
//TODO: Only open local database readwrite
......@@ -27,7 +28,7 @@ try : q_ptr(db)
, mutex(new QMutex())
{
} catch (SQLiteException const& e) {
qDebug() << e.what();
akabeiDebug() << e.what();
valid = false;
}
......@@ -43,7 +44,7 @@ void DatabasePrivate::init()
populateGroupCache(); /* populate group cache on startup */
valid = true;
} catch (SQLiteException const& e) {
qDebug() << e.what();
akabeiDebug() << e.what();
valid = false;
}
}
......@@ -395,7 +396,7 @@ Akabei::Package::List Database::queryPackages(QString const& sql)
retlist << d->packageFromRow(packages, i);
}
} catch (SQLiteException const& e) {
qDebug() << "Error while querying database for packages: " << e.what();
akabeiDebug() << "Error while querying database for packages: " << e.what();
}
return retlist;
......@@ -427,7 +428,7 @@ QList< Group* > Database::queryGroups(QString const& sql)
retlist << d->groupFromRow(table, i);
}
} catch (SQLiteException const& e) {
qDebug() << "Error while querying database for groups: " << e.what();
akabeiDebug() << "Error while querying database for groups: " << e.what();
}
return retlist;
......@@ -446,7 +447,7 @@ QList<Delta*> Database::queryDeltas(QString const& sql)
retlist << d->deltaFromRow(table, i);
}
} catch (SQLiteException const& e) {
qDebug() << "Error while querying database for deltas: " << e.what();
akabeiDebug() << "Error while querying database for deltas: " << e.what();
}
return retlist;
}
......@@ -464,7 +465,7 @@ QList<Hook*> Database::queryHooks(QString const& sql)
retlist << d->hookFromRow(table, i);
}
} catch (SQLiteException const& e) {
qDebug() << "Error while querying database for hooks: " << e.what();
akabeiDebug() << "Error while querying database for hooks: " << e.what();
}
return retlist;
}
......
......@@ -17,7 +17,6 @@
#include <QDir>
#include <QTemporaryFile>
#include <QDebug>
namespace Akabei
{
......
......@@ -27,7 +27,7 @@
#include <QDir>
#include <QUrl>
#include <QDebug>
#include <akabeidebug.h>
#include <stdlib.h>
......@@ -435,7 +435,7 @@ int QueryPerformer::insertPackage(SQLiteConnection &dbConnection, Package* p)
dbConnection.query("INSERT INTO licensed ('package', 'license') VALUES (" + QString::number(id) + ", '" + license + "');");
}
} catch (SQLiteException& e) {
qDebug() << "Error while inserting package in database: " << e.what();
akabeiDebug() << "Error while inserting package in database: " << e.what();
return SQLITE_ABORT;
}
......@@ -466,7 +466,7 @@ int QueryPerformer::insertGroup(SQLiteConnection &dbConnection, Group* g)
try {
dbConnection.query(sqlQuery);
} catch (SQLiteException& e) {
qDebug() << "Error inserting group: " << e.what();
akabeiDebug() << "Error inserting group: " << e.what();
return SQLITE_ABORT;
}
......@@ -498,7 +498,7 @@ int QueryPerformer::removePackage(SQLiteConnection &dbConnection, Package* p)
dbConnection.query("DELETE FROM licensed WHERE package=" + QString::number(p->databaseId()));
} catch (SQLiteException& e) {
qDebug() << "Error removing package: " << e.what();
akabeiDebug() << "Error removing package: " << e.what();
return SQLITE_ABORT;
}
......@@ -603,7 +603,7 @@ int QueryPerformer::updatePackage(SQLiteConnection &dbConnection, Package* from,
dbConnection.query("INSERT INTO licensed ('package', 'license') VALUES (" + QString::number(p->databaseId()) + ", \"" + license + "\")");
}
} catch (SQLiteException& e) {
qDebug() << "Error updating package: " << e.what();
akabeiDebug() << "Error updating package: " << e.what();
return SQLITE_ABORT;
}
......@@ -628,7 +628,7 @@ int QueryPerformer::insertDelta(SQLiteConnection& dbConnection, Akabei::Delta co
dbConnection.query(QString("INSERT INTO deltas (`package`, `filename`, `versionfrom`, `versionto`, `md5sum`) "
"VALUES (:Package, :Filename, :VersionFrom, :VersionTo, :MD5SUM);"));
} catch (SQLiteException& ex) {
qDebug() << "Inserting delta failed with error:" << ex.what();
akabeiDebug() << "Inserting delta failed with error:" << ex.what();
return SQLITE_ABORT;
}
......
......@@ -13,7 +13,6 @@
#include <QTemporaryFile>
#include <QTextStream>
#include <QDebug>
Akabei::Hook::Hook(const QString& name, const QString &content, QList<Akabei::Package*> pkgs)
: d_ptr(new HookPrivate(name, content, pkgs))
......@@ -49,7 +48,7 @@ QString Akabei::Hook::path()
Q_D(Hook);
if (d->file)
return d->file->fileName();
d->file = new QTemporaryFile();
d->file->open();
QTextStream out(d->file);
......
......@@ -14,7 +14,6 @@
#include <akabeibackend.h>
#include <QEventLoop>
#include <QDebug>
namespace Akabei {
......
......@@ -17,7 +17,6 @@
#include <akabeibackend_p.h>
#include <QThreadPool>
#include <QDebug>
namespace Akabei
{
......
......@@ -22,7 +22,7 @@
#include <QFile>
#include <QDir>
#include <QDebug>
#include <akabeidebug.h>
namespace Akabei {
......@@ -30,10 +30,10 @@ void PackagePrivate::attemptLoadFromCache()
{
AkabeiCache cache;
qDebug() << "I look for" << filename << "in cache";
akabeiDebug() << "I look for" << filename << "in cache";
if (cache.isPackageInCache(filename)) {
// It does!
qDebug() << "found!";
akabeiDebug() << "found!";
pathToArchive = cache.getPathInCache(filename);
_p_validated = false;
_p_md5checked = false;
......@@ -267,7 +267,7 @@ Package::List Package::computeDependencies()
//TODO: Version checks!
// TODO: Maybe do something asynchronous?
if (d->dependencies.isEmpty()) { //FIXME: Don't cache it here, but only use it once
/*qDebug() << "Query deps";
/*akabeiDebug() << "Query deps";
QStringList notInstalledDependencies = d->deps;
foreach (const QString &dep, notInstalledDependencies) {
Package::List query = Backend::instance()->localDatabase()->queryPackages("SELECT * FROM packages WHERE Name= \"" + dep + "\" ");
......@@ -278,7 +278,7 @@ Package::List Package::computeDependencies()
foreach (const QString &dep, notInstalledDependencies) {
foreach (Database * database, Backend::instance()->databases()) {
Package::List query = database->queryPackages("SELECT * FROM packages WHERE Name= \"" + dep + "\" ");
qDebug() << query;
akabeiDebug() << query;
if (!query.isEmpty()) {
dependencies << query;
break;
......@@ -342,10 +342,10 @@ Package::List Package::computeRequiredBy()
if (dep.contains(name())) {
if (dep == name()) { //If the dep is == package-name then everything is clear already
requiredBy << package;
// qDebug() << "Of course" << dep;
// akabeiDebug() << "Of course" << dep;
} else { //But dependencies() can be sth like binutils<=3.4
QPair<QString, QString> split = Helpers::versionedTarget(dep);
// qDebug() << "Maybe" << dep;
// akabeiDebug() << "Maybe" << dep;
if (split.first == name() && version().respectsConstraint(split.second)) //Check if the version is okay
requiredBy << package;
}
......@@ -353,12 +353,12 @@ Package::List Package::computeRequiredBy()
foreach (const QString &prov, provides()) {
if (prov == dep) { //If the dep is == package-name then everything is clear already
qDebug() << "Some of our providers" << prov;
akabeiDebug() << "Some of our providers" << prov;
requiredBy << package;
qDebug() << "Of course" << dep;
akabeiDebug() << "Of course" << dep;
}/* else { //But dependencies() can be sth like binutils<=3.4
QPair<QString, QString> split = Helpers::versionedTarget(prov);
qDebug() << "Maybe" << prov;
akabeiDebug() << "Maybe" << prov;
if (split.first == dep && version().respectsConstraint(split.second)) //Check if the version is okay
requiredBy << package;
}*/ //FIXME: For now we don't check versions
......@@ -431,7 +431,7 @@ QStringList Package::retrieveFiles()
d->backup = backups;
}
} catch (SQLiteException& e) {
qDebug() << "Error while querying database: " << e.what();
akabeiDebug() << "Error while querying database: " << e.what();
}
}
}
......@@ -483,7 +483,7 @@ QStringList Package::hooks()
}
catch (SQLiteException& e)
{
qDebug() << "Error while querying database: " << e.what();
akabeiDebug() << "Error while querying database: " << e.what();
}
}
}*/
......@@ -581,7 +581,7 @@ QString Package::retrieveScriptlet()
d->scriptlet = table.getDataAt(0, "scriptlet").toString();
}
} catch (SQLiteException& e) {
qDebug() << "Error while querying database: " << e.what();
akabeiDebug() << "Error while querying database: " << e.what();
return QString();
}
}
......
......@@ -12,7 +12,7 @@
#include <libarchive++/archivehandler.h>
#include <QByteArray>
#include <QDebug>
#include <akabeidebug.h>
#include <QFile>
#include <QDir>
......@@ -213,7 +213,7 @@ void ArchiveHandler::handleEntries(Akabei::EntryHandlerFunctor& handler)
while (archive_read_next_header(archive, &e) == ARCHIVE_OK) {
ArchiveEntry const entry(e);
if (!handler(entry)) {
qDebug() << "Entry \"" << entry.getFileName() << "\" skipped because of an error during handling";
akabeiDebug() << "Entry \"" << entry.getFileName() << "\" skipped because of an error during handling";
}
}
......@@ -556,7 +556,7 @@ bool ReinstallUpgradeFunctor::operator()(const ArchiveEntry& currentEntry)
if (onDiskMd5Sum != originalMD5Sum && newMd5sum != onDiskMd5Sum && newMd5sum != onDiskMd5Sum && !onDiskMd5Sum.isEmpty()) {
path = path + ".akabei";
m_caller->addMessage(QObject::tr("Installing new config to %1. Please merge manually!").arg(path));
qDebug() << "Copying file to" << path;
akabeiDebug() << "Copying file to" << path;
QFile::copy(newDiskPath, path);
return true;
} else {
......
......@@ -15,7 +15,6 @@
#include <QFile>
#include <QFileInfo>
#include <QDir>
#include <QDebug>
OperationUtils::OperationUtils()
: m_noupgrade(Akabei::Config::instance()->noUpgrade())
......@@ -45,7 +44,7 @@ bool OperationUtils::validatePackage(Akabei::Package *package)
m_errorMessage = "Archive is not valid.";
return false;
}
return true;
}
......@@ -61,14 +60,14 @@ bool OperationUtils::isFileToExtract(QString& entry)
return false;
}
}
return true;
}
/*
* Changes the extraction filename accordingly to the NoUpgrade list,
* with the appropriate messages stored for later inspection.
*
*
* NOTE: this is called even when reinstalling, but no file will be ever renamed in that case.
*/
QString OperationUtils::getExtractionPath(QString& entry)
......@@ -76,17 +75,17 @@ QString OperationUtils::getExtractionPath(QString& entry)
m_messages.clear();
QString newPath = entry;
QDir entryDir(entry);
if (m_noupgrade.contains(entry) && !entryDir.exists()) {
QFile entryFile(entry);
if (entryFile.exists()) {
QString m = "The package file " + entry + " was renamed in " + entry + ".akabeinew";
m_messages.append(m);
newPath = entry + ".akabeinew";
}
}
return newPath;
}
......
......@@ -16,7 +16,7 @@
#include <akabeiconfig.h>
#include <QMap>
#include <QSet>
#include <QDebug>
#include <akabeidebug.h>
namespace Akabei {
class PlainHookOperation::Private
......@@ -76,7 +76,7 @@ PlainHookOperation::~PlainHookOperation()
void PlainHookOperation::add(Hook* hook)
{
qDebug() << "Add hook" << hook->name();
akabeiDebug() << "Add hook" << hook->name();
d->hooks.insert(hook);
}
......@@ -88,7 +88,7 @@ void PlainHookOperation::add(const QList<Hook*> &hooks)
void PlainHookOperation::run()
{
qDebug() << "Run hookoperation with" << d->hooks.count() << "hooks";
akabeiDebug() << "Run hookoperation with" << d->hooks.count() << "hooks";
d->it = d->hooks.begin();
d->process();
}
......@@ -96,7 +96,7 @@ void PlainHookOperation::run()
void PlainHookOperation::Private::process()
{
if (it == hooks.end()) {
qDebug() << "At end...";
akabeiDebug() << "At end...";
q->setFinished(true);
return;
}
......@@ -106,7 +106,7 @@ void PlainHookOperation::Private::process()
q->connect(process, SIGNAL(errorsOccured(Akabei::Error::List)), SLOT(slotErrors(Akabei::Error::List)), Qt::DirectConnection);
q->connect(process, SIGNAL(scriptFinished(bool)), SLOT(slotFinished(bool)), Qt::DirectConnection);
q->connect(process, SIGNAL(addMessage(QString)), SLOT(slotMessage(QString)), Qt::DirectConnection);
qDebug() << "Run" << QString("sh %1").arg((*it)->path());
akabeiDebug() << "Run" << QString("sh %1").arg((*it)->path());
process->run(QString("sh %1").arg((*it)->path()));
}
......@@ -118,7 +118,7 @@ void PlainHookOperation::Private::slotErrors(Akabei::Error::List errors)
void PlainHookOperation::Private::slotFinished(bool fin)
{
if (fin) {
qDebug() << "Process next";
akabeiDebug() << "Process next";
it++;
process();
}
......
......@@ -24,7 +24,7 @@
#include <QFile>
#include <QDir>
#include <QDebug>
#include <akabeidebug.h>
#include <QDateTime>
#include <QStringList>
......@@ -87,7 +87,7 @@ void PlainInstallOperation::run()
chdir(currentDir.absolutePath().toUtf8().data());
}
} catch (ArchiveException& e) {
qDebug() << e.what();
akabeiDebug() << e.what();
setErrors(Error::List() << Error(Akabei::Error::UnknownError, QObject::tr("Could not open package file."), this));
setFinished(false);
return;
......@@ -220,7 +220,7 @@ void PlainInstallOperation::validate()
// Same for hooks.
if (d->package->hasHooks()) {
qDebug() << "We have hooks" << d->package->hooks();
akabeiDebug() << "We have hooks" << d->package->hooks();
PlainHookOperation::instance()->add(d->package->retrieveHooks());
}
}
......
......@@ -27,7 +27,7 @@
#include <QDateTime>
#include <QStringList>
#include <QDir>
#include <QDebug>
#include <akabeidebug.h>
#include <QTemporaryFile>
#include <sqlite3.h>
......@@ -109,7 +109,7 @@ void PlainReInstallOperation::run()
handle.handleEntries(extractor);
} catch (ArchiveException& e) {
qDebug() << e.what();
akabeiDebug() << e.what();
setErrors(Error::List() << Error(Akabei::Error::UnknownError, QObject::tr("Error during access to archive."), this));
setFinished(false);
return;
......@@ -214,7 +214,7 @@ void PlainReInstallOperation::validate()
// Same for hooks
if (d->package->hasHooks()) {
qDebug() << "We have hooks" << d->package->hooks();
akabeiDebug() << "We have hooks" << d->package->hooks();
PlainHookOperation::instance()->add(d->package->retrieveHooks());
}
}
......
......@@ -19,7 +19,7 @@
#include <akabeihelpers.h>
#include <QFile>
#include <QDebug>
#include <akabeidebug.h>
#include <QStringList>
#include <QFileInfo>
#include <QDir>
......@@ -65,21 +65,21 @@ void PlainRemoveOperation::run()
foreach (const QString &file, d->package->retrieveFiles()) {
/* It's a directory: does nothing */
if ((file.endsWith('/') && !QFileInfo(file).isSymLink()) || (!processingOptions().testFlag(Akabei::RemoveConfigs) && backup.contains(file))) {
qDebug() << "You know what?" << file << "is a directory!";
akabeiDebug() << "You know what?" << file << "is a directory!";
++idx;
continue;
}
QFile f(file);
if (!f.remove() && !(processingOptions().testFlag(Akabei::Force))) {
qDebug() << "Couldn't remove" << file;
akabeiDebug() << "Couldn't remove" << file;
QString translated = QObject::tr("Removing file %1 failed: %2").arg(file, f.errorString());
setErrors(Error::List() << Error(Error::UnknownError, translated, this));
setFinished(false);
}
setProgress((++idx * 100) / filesSize);
qDebug() << "Removed" << file;
akabeiDebug() << "Removed" << file;
}
}
......
......@@ -29,7 +29,7 @@ ChrootedProcess::ChrootedProcess(Operation *op, const QString& chroot, QObject*
, m_file(0)
, m_operation(op)
{
qDebug() << "Constructed";
akabeiDebug() << "Constructed";
//setReadChannelMode(QProcess::MergedChannels);
connect(this, SIGNAL(readyRead()), this, SLOT(slotReadyRead()));
connect(this, SIGNAL(finished(int)), this, SLOT(slotFinished(int)));
......@@ -56,7 +56,7 @@ void ChrootedProcess::setupChildProcess()
void ChrootedProcess::slotFinished(int exitCode)
{
qDebug() << "Finished" << exitCode;
akabeiDebug() << "Finished" << exitCode;
// Clean stuff
if (m_file) {
m_file->close();
......@@ -77,7 +77,7 @@ void ChrootedProcess::slotReadyRead()
{
QByteArray data;
data = readLine();
qDebug() << "Important is" << data;
akabeiDebug() << "Important is" << data;
while (!data.isEmpty()) {
emit addMessage(data);
}
......@@ -118,7 +118,7 @@ PlainScriptletOperation::~PlainScriptletOperation()
void PlainScriptletOperation::run()
{
qDebug() << "Run scriplet";
akabeiDebug() << "Run scriplet";
QString root = Config::instance()->root();
QDir tempRoot = Config::instance()->rootDir().absoluteFilePath("tmp");
......@@ -143,7 +143,7 @@ void PlainScriptletOperation::run()
void PlainScriptletOperation::validate()
{
qDebug() << "Validating scriptlet " << this;
akabeiDebug() << "Validating scriptlet " << this;
// Just check if the package actually has a scriptlet
setValidationFinished(d->package->hasScriptlet());
}
......@@ -155,7 +155,7 @@ void PlainScriptletOperation::slotErrors(Akabei::Error::List errs)
void PlainScriptletOperation::slotFinished(bool fin)
{
qDebug() << "Set finished:" << fin;
akabeiDebug() << "Set finished:" << fin;
setFinished(fin);
}
......
......@@ -25,7 +25,6 @@
#include <QDateTime>
#include <QStringList>
#include <QDir>
#include <QDebug>
#include <QTemporaryFile>
#include <sqlite3.h>
......@@ -89,7 +88,7 @@ void PlainUpgradeOperation::run()
if (Akabei::Config::instance()->noUpgrade().contains(relativePath)) {
continue;
}
QFile f(file);
if (!f.remove() && !(processingOptions().testFlag(Akabei::Force))) {
QString translated = QObject::tr("Removing file %1 failed: %2").arg(file, f.errorString());
......@@ -106,7 +105,7 @@ void PlainUpgradeOperation::run()
try {
/* libarchive requires this for extracting hard links */
chdir(Config::instance()->root().toUtf8().data());
/* Sets up the functor to do all the necessary job on the archive entries */
ReinstallUpgradeFunctor extractor(backup, this, handle);
handle.handleEntries(extractor);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment