summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2014-03-31 15:13:28 +0200
committerMichael Schroeder <mls@suse.de>2014-03-31 15:13:28 +0200
commit6dfec0d0a5a873b7745903de7c530be8faaeee6f (patch)
tree2722f9e47feec15bb1bb6af68c1be988518f6d7e /ext
parent214203ca6cc97d91e3638b96bee00ee32977111e (diff)
downloadlibsolv-6dfec0d0a5a873b7745903de7c530be8faaeee6f.tar.gz
libsolv-6dfec0d0a5a873b7745903de7c530be8faaeee6f.tar.bz2
libsolv-6dfec0d0a5a873b7745903de7c530be8faaeee6f.zip
suppport RPM_ADD_FILTERED_FILELIST
Probably only useful for distris that enforce filelist dependency policies, e.g. SUSE.
Diffstat (limited to 'ext')
-rw-r--r--ext/repo_rpmdb.c35
-rw-r--r--ext/repo_rpmdb.h1
2 files changed, 32 insertions, 4 deletions
diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c
index d37d8b7..f6c8f0d 100644
--- a/ext/repo_rpmdb.c
+++ b/ext/repo_rpmdb.c
@@ -717,8 +717,23 @@ adddudata(Repodata *data, Id handle, RpmHead *rpmhead, char **dn, unsigned int *
solv_free(fkb);
}
+static int
+is_filtered(const char *dir)
+{
+ if (!dir)
+ return 1;
+ /* the dirs always have a trailing / in rpm */
+ if (strstr(dir, "bin/"))
+ return 0;
+ if (!strncmp(dir, "/etc/", 5))
+ return 0;
+ if (!strcmp(dir, "/usr/lib/"))
+ return 2;
+ return 1;
+}
+
static void
-addfilelist(Repodata *data, Id handle, RpmHead *rpmhead)
+addfilelist(Repodata *data, Id handle, RpmHead *rpmhead, int flags)
{
char **bn;
char **dn;
@@ -727,6 +742,7 @@ addfilelist(Repodata *data, Id handle, RpmHead *rpmhead)
int i;
Id lastdid = 0;
unsigned int lastdii = -1;
+ int lastfiltered = 0;
if (!data)
return;
@@ -765,14 +781,25 @@ addfilelist(Repodata *data, Id handle, RpmHead *rpmhead)
{
if (di[i] >= dnc)
continue; /* corrupt entry */
- did = repodata_str2dir(data, dn[di[i]], 1);
+ lastdii = di[i];
+ if ((flags & RPM_ADD_FILTERED_FILELIST) != 0)
+ {
+ lastfiltered = is_filtered(dn[di[i]]);
+ if (lastfiltered == 1)
+ continue;
+ }
+ did = repodata_str2dir(data, dn[lastdii], 1);
if (!did)
did = repodata_str2dir(data, "/", 1);
lastdid = did;
- lastdii = di[i];
}
if (b && *b == '/') /* work around rpm bug */
b++;
+ if (lastfiltered)
+ {
+ if (lastfiltered != 2 || strcmp(b, "sendmail"))
+ continue;
+ }
repodata_add_dirstr(data, handle, SOLVABLE_FILELIST, did, b);
}
solv_free(bn);
@@ -994,7 +1021,7 @@ rpm2solv(Pool *pool, Repo *repo, Repodata *data, Solvable *s, RpmHead *rpmhead,
}
}
if ((flags & RPM_ADD_NO_FILELIST) == 0)
- addfilelist(data, handle, rpmhead);
+ addfilelist(data, handle, rpmhead, flags);
if ((flags & RPM_ADD_WITH_CHANGELOG) != 0)
addchangelog(data, handle, rpmhead);
}
diff --git a/ext/repo_rpmdb.h b/ext/repo_rpmdb.h
index a63d6f2..9e3bd0d 100644
--- a/ext/repo_rpmdb.h
+++ b/ext/repo_rpmdb.h
@@ -24,6 +24,7 @@ extern Id repo_add_rpm(Repo *repo, const char *rpm, int flags);
#define RPM_ADD_WITH_HDRID (1 << 15)
#define RPM_ADD_WITH_LEADSIGID (1 << 16)
#define RPM_ADD_WITH_CHANGELOG (1 << 17)
+#define RPM_ADD_FILTERED_FILELIST (1 << 18)
#define RPMDB_EMPTY_REFREPO (1 << 30) /* internal */