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