Commit 141d1824 authored by Luca Giambonini's avatar Luca Giambonini

replaceOperation:

add only the replacement pkg
remove the replaced pkg with its "provided" pkgs
parent b0eb6e88
......@@ -52,16 +52,16 @@ PlainReplaceOperation::PlainReplaceOperation(Package *package, const QList<Packa
: Operation(package->name())
, d(new Private(package, replaces))
{
setPhase(Phase3); // Replacement happens in phase 3.
setPriority(50); // Replacement has a low priority.
setCanBeConcurrent(false); // And it can not be concurrent.
setPhase(Phase3); // Replacement happens in phase 3.
setPriority(50); // Replacement has a low priority.
setCanBeConcurrent(false); // And it can not be concurrent.
setTargetVersion(package->version().toByteArray());
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()
......@@ -212,13 +212,16 @@ void PlainReplaceOperation::validate()
if (!(processingOptions().testFlag(Akabei::SkipDependencies))) {
// Add additional targets.
QStringList targets = QStringList() << d->package->name() << Helpers::unversionedTargets(d->package->provides());
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();
setTargetRemovals(targetsRemoved);
}
......
......@@ -57,16 +57,16 @@ PolkitReplaceOperation::PolkitReplaceOperation(Package *package, const QList<Pac
: Operation(package->name())
, d(new Private(package, replaces, this))
{
setPhase(Phase3); // Replacement happens in phase 3.
setPriority(50); // Replacement has a low priority.
setCanBeConcurrent(false); // And it can not be concurrent.
setPhase(Phase3); // Replacement happens in phase 3.
setPriority(50); // Replacement has a low priority.
setCanBeConcurrent(false); // And it can not be concurrent.
setTargetVersion(package->version().toByteArray());
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()
......@@ -232,13 +232,16 @@ void PolkitReplaceOperation::validate()
if (!(processingOptions().testFlag(Akabei::SkipDependencies))) {
// Add additional targets.
QStringList targets = QStringList() << d->package->name() << Helpers::unversionedTargets(d->package->provides());
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();
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