Skip to content

Commit

Permalink
use filter.h to remove files
Browse files Browse the repository at this point in the history
  • Loading branch information
Kangie committed Oct 26, 2024
1 parent 36c202b commit 396803f
Showing 1 changed file with 5 additions and 20 deletions.
25 changes: 5 additions & 20 deletions src/library/ebuild-backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,25 +362,6 @@ struct epkg** process_vdb_category(struct dirent *vdbdp, int *packages, struct e
return vdbpackages;
}

/*
* Exclude a known list of paths that shouldn't contain binaries
* (installed by a package manager, anyway).
*/
int exclude_path(const char *path) {
const char *excluded_paths[] = {
"/usr/share/",
"/usr/src/",
};
const int num_excluded_paths = sizeof(excluded_paths) / sizeof(excluded_paths[0]);
for (int i = 0; i < num_excluded_paths; i++) {
if (strncmp(path, excluded_paths[i], strlen(excluded_paths[i])) == 0) {
return 1;
}
}
return 0;
}


/*
* Portage stores data about installed packages in the VDB (/var/db/pkg/).
* We care about /var/db/pkg/category/package-version/CONTENTS
Expand Down Expand Up @@ -435,7 +416,11 @@ static int ebuild_load_list(const conf_t *conf) {
}
for (int k = 0; k < package->files; k++) {
ebuildfiles *file = &package->content[k];
if (exclude_path(file->path)) {
// Is this file in the filter list?
if (!filter_check(file->path)) {
#ifdef DEBUG
msg(LOG_DEBUG, "File %s is in the filter list; ignoring", file->path);
#endif
continue;
}
add_file_to_backend_by_md5(file->path, file->md5, hashtable_ptr, SRC_EBUILD, &ebuild_backend);
Expand Down

0 comments on commit 396803f

Please sign in to comment.