Commit 728e30fc authored by Luca Giambonini's avatar Luca Giambonini

Handle if a file has been replaced by an other package

Added special case:
during the validation process each new file added by a pkg (B) is checked and verified that none of the files are present in the target system. If it were the case then there are 2 possible answers:
1) the file has been added manually by the user (and the user should resolve the issue himself)
2) the file belong to an other pkg (A)

Let consider the case 2) where (B) is about to be updated and will replace some files from (A). Without this patch during the validation transaction (B) would fail, because an existin file with that name exists already in the system. The code verify that the file in subject would be removed in the next transaction, when (A) is being updated.
fileSystemRemovals at the end of the loop, contains all the files removed.

fix #8
parent d3cda941
......@@ -323,10 +323,18 @@ void ValidatorWorker::processNextPhase()
continue;
}
// Problem, FS conflict.
errors << Error(Error::FilesystemConflictError,
tr("[Target %1] %2 already exists in the filesystem")
.arg(op->targetName(), rootDir.absoluteFilePath(target)));
// check if this file is being removed in an other op
// other pkg in the queue can provide this file
QStringList fileSystemRemovals;
foreach (Operation *subop, allOps) {
fileSystemRemovals << subop->fileSystemRemovals();
}
if (fileSystemRemovals.contains(target) == false){
// Problem, FS conflict.
errors << Error(Error::FilesystemConflictError,
tr("[Target %1] %2 already exists in the filesystem")
.arg(op->targetName(), rootDir.absoluteFilePath(target)));
}
}
}
foreach (const QString &target, op->conflictingTargets()) {
......
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