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;
int i;
Id lastdid = 0;
unsigned int lastdii = -1;
+ int lastfiltered = 0;
if (!data)
return;
{
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);
}
}
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);
}
#ifdef SUSE
int add_auto = 0;
#endif
+ int filtered_filelist = 0;
- while ((c = getopt(argc, argv, "0XkKb:m:")) >= 0)
+ while ((c = getopt(argc, argv, "0XkKb:m:F")) >= 0)
{
switch(c)
{
case '0':
manifest0 = 1;
break;
+ case 'F':
+ filtered_filelist = 1;
+ break;
#ifdef ENABLE_PUBKEY
case 'k':
pubkeys = 1;
continue;
}
#endif
- if (repo_add_rpm(repo, rpms[i], REPO_REUSE_REPODATA|REPO_NO_INTERNALIZE) == 0)
+ if (repo_add_rpm(repo, rpms[i], REPO_REUSE_REPODATA|REPO_NO_INTERNALIZE|(filtered_filelist ? RPM_ADD_FILTERED_FILELIST : 0)) == 0)
{
fprintf(stderr, "rpms2solv: %s\n", pool_errstr(pool));
res = 1;