Commit 94bfcda5 authored by AlmAck's avatar AlmAck

fixed replace operation validation (for normal operation and for polkit)

parent 08b0187b
......@@ -59,9 +59,9 @@ PlainReplaceOperation::PlainReplaceOperation(Package *package, const QList<Packa
setDescription(QObject::tr("Replacing packages with %1...").arg(package->name())); //TODO: Give better description
//Basically we replace our own package as well :)
// QList<Package*> installed = Backend::instance()->localDatabase()->queryPackages(Queries::selectPackages("name", "=", d->package->name()));
// if (!installed.isEmpty())
// d->replaces.append(installed.first());
QList<Package*> installed = Backend::instance()->localDatabase()->queryPackages(Queries::selectPackages("name", "=", d->package->name()));
if (!installed.isEmpty())
d->replaces.append(installed.first());
}
PlainReplaceOperation::~PlainReplaceOperation()
......@@ -210,24 +210,21 @@ void PlainReplaceOperation::validate()
// Add conflicts.
setConflictingTargets(d->package->conflictsWith());
if (!(processingOptions().testFlag(Akabei::SkipDependencies))) {
// Add additional targets.
QStringList targets = QStringList() << d->package->name();// << Helpers::unversionedTargets(d->package->provides());
if (!(processingOptions().testFlag(Akabei::SkipDependencies))) {
// Add additional targets.
QStringList targets = QStringList() << d->package->name() << Helpers::unversionedTargets(d->package->provides());
targets.removeDuplicates();
setTargetAdditions(targets);
QStringList targetsRemoved;
foreach (Package * r, d->replaces)
targetsRemoved << r->name();
// we have to remove all the provides packages, are now replaced by the new one
targetsRemoved << Helpers::unversionedTargets(d->package->provides());
targetsRemoved.removeDuplicates();
QStringList targetsRemoved;
foreach (Package * r, d->replaces)
targetsRemoved << r->name();
setTargetRemovals(targetsRemoved);
}
if (!(processingOptions().testFlag(Akabei::DatabaseOnly))) {
// Now let’s set the conflicting targets & stuff.
// Since this is an installation, we’re adding stuff to the filesystem.
// Since this is an replacement, we’re adding stuff to the filesystem.
{
QSet<QString> oldFiles;
foreach (Package * r, d->replaces)
......
......@@ -64,9 +64,9 @@ PolkitReplaceOperation::PolkitReplaceOperation(Package *package, const QList<Pac
setDescription(QObject::tr("Replacing packages with %1...").arg(package->name())); //TODO: Give better description
//Basically we replace our own package as well :)
// QList<Package*> installed = Backend::instance()->localDatabase()->queryPackages(Queries::selectPackages("name", "=", d->package->name()));
// if (!installed.isEmpty())
// d->replaces.append(installed.first());
QList<Package*> installed = Backend::instance()->localDatabase()->queryPackages(Queries::selectPackages("name", "=", d->package->name()));
if (!installed.isEmpty())
d->replaces.append(installed.first());
}
PolkitReplaceOperation::~PolkitReplaceOperation()
......@@ -230,18 +230,15 @@ void PolkitReplaceOperation::validate()
// Add conflicts.
setConflictingTargets(d->package->conflictsWith());
if (!(processingOptions().testFlag(Akabei::SkipDependencies))) {
// Add additional targets.
QStringList targets = QStringList() << d->package->name();// << Helpers::unversionedTargets(d->package->provides());
if (!(processingOptions().testFlag(Akabei::SkipDependencies))) {
// Add additional targets.
QStringList targets = QStringList() << d->package->name() << Helpers::unversionedTargets(d->package->provides());
targets.removeDuplicates();
setTargetAdditions(targets);
QStringList targetsRemoved;
foreach (Package * r, d->replaces)
targetsRemoved << r->name();
// we have to remove all the provides packages, are now replaced by the new one
targetsRemoved << Helpers::unversionedTargets(d->package->provides());
targetsRemoved.removeDuplicates();
QStringList targetsRemoved;
foreach (Package * r, d->replaces)
targetsRemoved << r->name();
setTargetRemovals(targetsRemoved);
}
......
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