diff options
author | Michael Schroeder <mls@suse.de> | 2011-05-25 14:03:41 +0200 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2011-05-25 14:03:41 +0200 |
commit | 55f5371d10bc44570b2d50bb737aba8a3ae1e93f (patch) | |
tree | c6e6b72e1d43164a776052f8302511b1a83da4ba /ext | |
parent | 1414c61996bba1f0b181a4e2bfbce892d0022d8b (diff) | |
download | libsolv-55f5371d10bc44570b2d50bb737aba8a3ae1e93f.tar.gz libsolv-55f5371d10bc44570b2d50bb737aba8a3ae1e93f.tar.bz2 libsolv-55f5371d10bc44570b2d50bb737aba8a3ae1e93f.zip |
- make findfileconflicts ignore ghost files, like rpm does
Diffstat (limited to 'ext')
-rw-r--r-- | ext/pool_fileconflicts.c | 4 | ||||
-rw-r--r-- | ext/repo_rpmdb.c | 24 | ||||
-rw-r--r-- | ext/repo_rpmdb.h | 1 |
3 files changed, 26 insertions, 3 deletions
diff --git a/ext/pool_fileconflicts.c b/ext/pool_fileconflicts.c index c36e967..a1a1a57 100644 --- a/ext/pool_fileconflicts.c +++ b/ext/pool_fileconflicts.c @@ -332,7 +332,7 @@ pool_findfileconflicts(Pool *pool, Queue *pkgs, int cutoff, Queue *conflicts, vo cbdata.create = 0; handle = (*handle_cb)(pool, p, handle_cbdata); if (handle) - rpm_iterate_filelist(handle, 0, findfileconflicts_cb, &cbdata); + rpm_iterate_filelist(handle, RPM_ITERATE_FILELIST_NOGHOSTS, findfileconflicts_cb, &cbdata); } POOL_DEBUG(SAT_DEBUG_STATS, "filemap size: %d used %d\n", cbdata.cflmapn + 1, cbdata.cflmapused); @@ -370,7 +370,7 @@ pool_findfileconflicts(Pool *pool, Queue *pkgs, int cutoff, Queue *conflicts, vo int pidx = cbdata.lookat.elements[i + 1]; int iterflags; - iterflags = RPM_ITERATE_FILELIST_WITHMD5; + iterflags = RPM_ITERATE_FILELIST_WITHMD5 | RPM_ITERATE_FILELIST_NOGHOSTS; if (pool->obsoleteusescolors) iterflags |= RPM_ITERATE_FILELIST_WITHCOL; p = pkgs->elements[pidx]; diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c index c679bc1..0755fac 100644 --- a/ext/repo_rpmdb.c +++ b/ext/repo_rpmdb.c @@ -71,6 +71,7 @@ #define TAG_FILEMODES 1030 #define TAG_FILEMD5S 1035 #define TAG_FILELINKTOS 1036 +#define TAG_FILEFLAGS 1037 #define TAG_SOURCERPM 1044 #define TAG_PROVIDENAME 1047 #define TAG_REQUIREFLAGS 1048 @@ -115,6 +116,8 @@ #define DEP_STRONG (1 << 27) #define DEP_PRE ((1 << 6) | (1 << 9) | (1 << 10) | (1 << 11) | (1 << 12)) +#define FILEFLAG_GHOST (1 << 6) + #ifdef RPM5 # define RPM_INDEX_SIZE 4 @@ -1980,6 +1983,7 @@ rpm_iterate_filelist(void *rpmhandle, int flags, void (*cb)(void *, const char * char **lt = 0; unsigned int *di, diidx; unsigned int *co = 0; + unsigned int *ff = 0; unsigned int lastdir; int lastdirl; unsigned int *fm; @@ -2049,10 +2053,27 @@ rpm_iterate_filelist(void *rpmhandle, int flags, void (*cb)(void *, const char * return; } } + if ((flags & RPM_ITERATE_FILELIST_NOGHOSTS) != 0) + { + ff = headint32array(rpmhead, TAG_FILEFLAGS, &cnt2); + if (!ff || cnt != cnt2) + { + sat_free(ff); + sat_free(co); + sat_free(md); + sat_free(fm); + sat_free(di); + sat_free(bn); + sat_free(dn); + return; + } + } lastdir = dcnt; lastdirl = 0; for (i = 0; i < cnt; i++) { + if (ff && (ff[i] & FILEFLAG_GHOST) != 0) + continue; diidx = di[i]; if (diidx >= dcnt) continue; @@ -2092,7 +2113,7 @@ rpm_iterate_filelist(void *rpmhandle, int flags, void (*cb)(void *, const char * } if (!md5p) { - sprintf(md5, "%08x%08x", (fm[i] >> 12) & 65535, 0); + sprintf(md5, "%08x%08x%08x%08x", (fm[i] >> 12) & 65535, 0, 0, 0); md5p = md5; } } @@ -2106,6 +2127,7 @@ rpm_iterate_filelist(void *rpmhandle, int flags, void (*cb)(void *, const char * sat_free(bn); sat_free(dn); sat_free(co); + sat_free(ff); } char * diff --git a/ext/repo_rpmdb.h b/ext/repo_rpmdb.h index ba21c0f..c5903b8 100644 --- a/ext/repo_rpmdb.h +++ b/ext/repo_rpmdb.h @@ -27,6 +27,7 @@ void repo_add_pubkeys(Repo *repo, const char **keys, int nkeys, int flags); #define RPM_ITERATE_FILELIST_ONLYDIRS (1 << 0) #define RPM_ITERATE_FILELIST_WITHMD5 (1 << 1) #define RPM_ITERATE_FILELIST_WITHCOL (1 << 2) +#define RPM_ITERATE_FILELIST_NOGHOSTS (1 << 3) void *rpm_byrpmdbid(Id rpmdbid, const char *rootdir, void **statep); void *rpm_byfp(FILE *fp, const char *name, void **statep); |