Commit 63e495fa authored by Luca Giambonini's avatar Luca Giambonini

Merge branch 'replace'

parents 29472d27 218cdc64
......@@ -134,6 +134,6 @@ private:
const char *message;
};
Q_DECLARE_METATYPE(QList<Row>);
Q_DECLARE_METATYPE(QList<Row>)
#endif // ABSTRACTSQLITECONNECTION_H
......@@ -41,6 +41,8 @@ operations/akabeiplainscriptletoperation.cpp
operations/akabeiplainupgradeoperation.cpp
operations/akabeipolkitupgradeoperation.cpp
operations/akabeipolkitinstalloperation.cpp
operations/akabeiplainreplaceoperation.cpp
operations/akabeipolkitreplaceoperation.cpp
operations/akabeioperationutils.cpp
)
......@@ -84,6 +86,8 @@ operations/akabeipolkitremoveoperation.h
operations/akabeiplainscriptletoperation.h
operations/akabeiplainupgradeoperation.h
operations/akabeipolkitupgradeoperation.h
operations/akabeiplainreplaceoperation.h
operations/akabeipolkitreplaceoperation.h
operations/akabeiplainhookoperation.h
operations/akabeioperationutils.h
)
......
......@@ -36,7 +36,7 @@ enum Permission {
WritePermission = 0x02,
ReadWritePermission = 0x03
};
Q_DECLARE_FLAGS(Permissions, Permission);
Q_DECLARE_FLAGS(Permissions, Permission)
QByteArray md5sum(const QByteArray &data);
QByteArray md5sumOfFile(const QString &path);
QByteArray processMd5(unsigned char output[]);
......
......@@ -32,7 +32,7 @@ public:
virtual ~OperationPrivate() {
qDeleteAll(postOps);
qDeleteAll(preOps);
};
}
QString targetName;
QByteArray targetVersion;
......
......@@ -100,6 +100,11 @@ QString packageDependencies(const QString& dependency, const QString& comparison
return QString("SELECT * FROM packages JOIN depends ON packages.id=depends.package WHERE depends.dependency %0 \"%1\";").arg(comparison, dependency);
}
QString globalReplaces()
{
return QString("SELECT * FROM replaces JOIN packages ON replaces.package = packages.id");
}
QString begin()
{
return QString("BEGIN;");
......
......@@ -143,6 +143,11 @@ QString AKABEICORESHARED_EXPORT requiredByPackages(const QString &);
*/
QString AKABEICORESHARED_EXPORT packageDependencies(const QString &, const QString &);
/**
* Query all packages with at least one replacement.
*/
QString AKABEICORESHARED_EXPORT globalReplaces();
/**
* Query that begins a transaction.
*/
......
......@@ -335,6 +335,13 @@ void ValidatorWorker::processNextPhase()
}
}
foreach (const QString &target, op->conflictingTargets()) {
// if is a pkg to remove or replace skip the checks
bool skip = false;
foreach (const QString targetRemove, targetRemovals){
if(targetRemove.contains(target)) skip = true;
}
if (skip) continue;
if (targetNames.contains(target)) {
// Corner case: the conflict might be a provides/conflicts problem. Let's check.
if (targetNames[target] == op) {
......
......@@ -38,9 +38,9 @@ class AKABEICORESHARED_EXPORT PlainHookOperation : public Operation
friend class ChrootedProcess;
Q_PRIVATE_SLOT(d, void slotErrors(Akabei::Error::List));
Q_PRIVATE_SLOT(d, void slotFinished(bool));
Q_PRIVATE_SLOT(d, void slotMessage(QString));
Q_PRIVATE_SLOT(d, void slotErrors(Akabei::Error::List))
Q_PRIVATE_SLOT(d, void slotFinished(bool))
Q_PRIVATE_SLOT(d, void slotMessage(QString))
};
}
......
......@@ -182,8 +182,9 @@ void PlainRemoveOperation::validate()
}
if (!found) {
// setErrors(Error::List() << Error());
setErrors(Error::List() << Error(Error::UnknownError, QObject::tr("The package is not installed."), this));
setValidationFinished(false);
return;
}
if (!(processingOptions().testFlag(Akabei::SkipDependencies))) {
setTargetRemovals(QStringList() << d->package->name() << d->package->provides());
......
This diff is collapsed.
/* This file is part of the Chakra project
Copyright (C) 2015 Lukas Appelhans <l.appelhans@gmx.de>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#ifndef AKABEIPLAINREPLACEOPERATION_H
#define AKABEIPLAINREPLACEOPERATION_H
#include <akabeicore_global.h>
#include <akabeioperation.h>
#include <akabeipackage.h>
namespace Akabei {
class Package;
//TODO: We need error handling (existing files etc) and also custom InstallReasons
class AKABEICORESHARED_EXPORT PlainReplaceOperation : public Operation
{
Q_DISABLE_COPY(PlainReplaceOperation)
public:
explicit PlainReplaceOperation(Package *package, const QList<Package*> &replaces);
virtual ~PlainReplaceOperation();
protected:
void validate();
void run();
private:
class Private;
Private * const d;
};
}
#endif // AKABEIPLAININSTALLOPERATION_H
......@@ -132,7 +132,7 @@ void PlainScriptletOperation::run()
void PlainScriptletOperation::validate()
{
akabeiDebug() << "Validating scriptlet ";
akabeiDebug() << "Validating scriptlet for: " << d->package->name();
// Just check if the package actually has a scriptlet
setValidationFinished(d->package->hasScriptlet());
}
......
......@@ -20,6 +20,10 @@ namespace Akabei {
class Package;
/**
* @class PolkitInstakkOperation
* @brief Operation to install a package from the system using polkit.
*/
class AKABEICORESHARED_EXPORT PolkitInstallOperation : public Operation
{
Q_OBJECT
......
......@@ -12,12 +12,18 @@
#ifndef AKABEIPOLKITREINSTALLOPERATION_H
#define AKABEIPOLKITREINSTALLOPERATION_H
#include <akabeioperation.h>
#include <akabeicore_global.h>
#include <QStringList>
#include <akabeioperation.h>
#include <akabeipackage.h>
namespace Akabei {
class Package;
/**
* @class PolkitReInstallOperation
* @brief Operation to reinstall a package from the system using polkit.
*/
class AKABEICORESHARED_EXPORT PolkitReInstallOperation : public Operation
{
Q_OBJECT
......
......@@ -14,9 +14,10 @@
#include <akabeicore_global.h>
#include <akabeioperation.h>
#include <akabeipackage.h>
namespace Akabei {
namespace Akabei
{
class Package;
/**
......
This diff is collapsed.
/* This file is part of the Chakra project
Copyright (C) 2010 Dario Freddi <drf@chakra-project.org>
Copyright (C) 2013 Lukas Appelhans <boom1992@chakra-project.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#ifndef AKABEIPOLKITREPLACEOPERATION_H
#define AKABEIPOLKITREPLACEOPERATION_H
#include <akabeicore_global.h>
#include <akabeioperation.h>
#include <akabeipackage.h>
namespace Akabei {
class Package;
/**
* @class PolkitReplaceOperation
* @brief Operation to replace a package from the system using polkit.
*/
class AKABEICORESHARED_EXPORT PolkitReplaceOperation : public Operation
{
Q_OBJECT
Q_DISABLE_COPY(PolkitReplaceOperation)
public:
explicit PolkitReplaceOperation(Package *package, const QList<Package*> &replaces);
virtual ~PolkitReplaceOperation();
protected:
void run();
void validate();
private:
class Private;
Private * const d;
Q_PRIVATE_SLOT(d, void __k__polkitFinished(QString, bool))
Q_PRIVATE_SLOT(d, void __k__progressUpdated(QString, int))
Q_PRIVATE_SLOT(d, void __k__newMessage(QString, QString))
Q_PRIVATE_SLOT(d, void __k__error(QString, int, QString))
Q_PRIVATE_SLOT(d, void __k__removeFileProgress(int))
Q_PRIVATE_SLOT(d, void __k__removeFileFinished())
Q_PRIVATE_SLOT(d, void __k__removeFileErrors(QStringList))
};
}
#endif // AKABEIPOLKITREPLACEOPERATION_H
......@@ -13,12 +13,17 @@
#ifndef AKABEIPOLKITUPGRADEOPERATION_H
#define AKABEIPOLKITUPGRADEOPERATION_H
#include <akabeioperation.h>
#include <akabeicore_global.h>
#include <akabeioperation.h>
#include <akabeipackage.h>
namespace Akabei {
class Package;
/**
* @class PolkitUpgradeOperation
* @brief Operation to upgrade a package from the system using polkit.
*/
class AKABEICORESHARED_EXPORT PolkitUpgradeOperation : public Operation
{
Q_OBJECT
......
......@@ -27,7 +27,7 @@
namespace {
static std::ofstream logStream;
static QString filename;
};
}
LogHelper::LogHelper(QObject* parent)
: QObject(parent)
......
......@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-08-31 20:35+0200\n"
"POT-Creation-Date: 2016-01-19 23:07+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -37,6 +37,11 @@ msgstr ""
msgid "Package not found in local database!"
msgstr ""
#: Akabei::PolkitReplaceOperation#1
msgctxt "Akabei::PolkitReplaceOperation#1"
msgid "There has been an error with your polkit configuration!"
msgstr ""
#: Akabei::PolkitUpgradeOperation#1
msgctxt "Akabei::PolkitUpgradeOperation#1"
msgid "There has been an error with your polkit configuration!"
......@@ -199,23 +204,31 @@ msgid "Could not remove scriptlet!"
msgstr ""
#: QObject#37
msgid "Running script for %1..."
msgid "The package is not installed."
msgstr ""
#: QObject#38
msgid "Upgrading %1..."
msgid "Replacing packages with %1..."
msgstr ""
#: QObject#39
msgid "Could not update scriptlet in database!"
msgid "Running script for %1..."
msgstr ""
#: QObject#40
msgid "Could not remove scriptlet from database!"
msgid "Upgrading %1..."
msgstr ""
#: QObject#41
msgctxt "QObject#41"
msgid "Could not update scriptlet in database!"
msgstr ""
#: QObject#42
msgid "Could not remove scriptlet from database!"
msgstr ""
#: QObject#43
msgctxt "QObject#43"
msgid "There has been an error with your polkit configuration!"
msgstr ""
......
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