|
Panu Matilainen |
5a40a0 |
commit 566a15c9c08aa593d05e2f55f1c171a48bc1b1bc
|
|
Panu Matilainen |
5a40a0 |
Author: Panu Matilainen <pmatilai@redhat.com>
|
|
Panu Matilainen |
5a40a0 |
Date: Wed Mar 9 09:39:32 2011 +0200
|
|
Panu Matilainen |
5a40a0 |
|
|
Panu Matilainen |
5a40a0 |
Take file state into account for file dependencies
|
|
Panu Matilainen |
5a40a0 |
- Files which are not installed, have been replaced or are of wrong
|
|
Panu Matilainen |
5a40a0 |
color can not actually satisfy a dependency despite what the package's
|
|
Panu Matilainen |
5a40a0 |
file list says.
|
|
Panu Matilainen |
5a40a0 |
- This prevents breaking the system despite seemingly correct dependencies
|
|
Panu Matilainen |
5a40a0 |
in some situations, such as on multilib systems where a colored
|
|
Panu Matilainen |
5a40a0 |
files can appear to be shared between primary and secondary architecture
|
|
Panu Matilainen |
5a40a0 |
packages, but only the file from primary arch package is physically
|
|
Panu Matilainen |
5a40a0 |
present, and removing the primary arch package would remove the
|
|
Panu Matilainen |
5a40a0 |
file and silently break any dependencies on such files in practise.
|
|
Panu Matilainen |
5a40a0 |
Similarly replaced files become owned by the replacing package in
|
|
Panu Matilainen |
5a40a0 |
practise, so the original package whose files were replaced can no
|
|
Panu Matilainen |
5a40a0 |
longer satisfy dependency on those files.
|
|
Panu Matilainen |
5a40a0 |
|
|
Panu Matilainen |
5a40a0 |
diff --git a/lib/depends.c b/lib/depends.c
|
|
Panu Matilainen |
5a40a0 |
index 4daa512..69aecbb 100644
|
|
Panu Matilainen |
5a40a0 |
--- a/lib/depends.c
|
|
Panu Matilainen |
5a40a0 |
+++ b/lib/depends.c
|
|
Panu Matilainen |
5a40a0 |
@@ -345,12 +345,25 @@ static int rpmdbProvides(rpmts ts, depCache dcache, rpmds dep)
|
|
Panu Matilainen |
5a40a0 |
return rc;
|
|
Panu Matilainen |
5a40a0 |
}
|
|
Panu Matilainen |
5a40a0 |
|
|
Panu Matilainen |
5a40a0 |
- /* See if a filename dependency is a real file in some package */
|
|
Panu Matilainen |
5a40a0 |
+ /*
|
|
Panu Matilainen |
5a40a0 |
+ * See if a filename dependency is a real file in some package,
|
|
Panu Matilainen |
5a40a0 |
+ * taking file state into account: replaced, wrong colored and
|
|
Panu Matilainen |
5a40a0 |
+ * not installed files can not satisfy a dependency.
|
|
Panu Matilainen |
5a40a0 |
+ */
|
|
Panu Matilainen |
5a40a0 |
if (Name[0] == '/') {
|
|
Panu Matilainen |
5a40a0 |
mi = rpmtsPrunedIterator(ts, RPMDBI_BASENAMES, Name);
|
|
Panu Matilainen |
5a40a0 |
while ((h = rpmdbNextIterator(mi)) != NULL) {
|
|
Panu Matilainen |
5a40a0 |
- rpmdsNotify(dep, "(db files)", rc);
|
|
Panu Matilainen |
5a40a0 |
- break;
|
|
Panu Matilainen |
5a40a0 |
+ int fs = RPMFILE_STATE_MISSING;
|
|
Panu Matilainen |
5a40a0 |
+ struct rpmtd_s states;
|
|
Panu Matilainen |
5a40a0 |
+ if (headerGet(h, RPMTAG_FILESTATES, &states, HEADERGET_MINMEM)) {
|
|
Panu Matilainen |
5a40a0 |
+ rpmtdSetIndex(&states, rpmdbGetIteratorFileNum(mi));
|
|
Panu Matilainen |
5a40a0 |
+ fs = rpmtdGetNumber(&states);
|
|
Panu Matilainen |
5a40a0 |
+ rpmtdFreeData(&states);
|
|
Panu Matilainen |
5a40a0 |
+ }
|
|
Panu Matilainen |
5a40a0 |
+ if (fs == RPMFILE_STATE_NORMAL || fs == RPMFILE_STATE_NETSHARED) {
|
|
Panu Matilainen |
5a40a0 |
+ rpmdsNotify(dep, "(db files)", rc);
|
|
Panu Matilainen |
5a40a0 |
+ break;
|
|
Panu Matilainen |
5a40a0 |
+ }
|
|
Panu Matilainen |
5a40a0 |
}
|
|
Panu Matilainen |
5a40a0 |
rpmdbFreeIterator(mi);
|
|
Panu Matilainen |
5a40a0 |
}
|