From: Michael Tremer Date: Fri, 18 Jun 2021 16:30:31 +0000 (+0000) Subject: repo: Destroy all files in repository directory X-Git-Tag: 0.9.28~1233 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6fc23bdb157a2fb1a04e5b2d0f951543101ee681;p=pakfire.git repo: Destroy all files in repository directory Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/include/pakfire/pakfire.h b/src/libpakfire/include/pakfire/pakfire.h index 1f1daf26a..dfbcb9dc7 100644 --- a/src/libpakfire/include/pakfire/pakfire.h +++ b/src/libpakfire/include/pakfire/pakfire.h @@ -69,8 +69,6 @@ PakfireRepo pakfire_get_repo(Pakfire pakfire, const char* name); PakfirePackageList pakfire_whatprovides(Pakfire pakfire, const char* provides, int flags); PakfirePackageList pakfire_search(Pakfire pakfire, const char* what, int flags); -int pakfire_cache_destroy(Pakfire pakfire, const char* path); - // Logging int pakfire_log_get_priority(Pakfire pakfire); diff --git a/src/libpakfire/pakfire.c b/src/libpakfire/pakfire.c index c6e4db7a1..e6c4bcb50 100644 --- a/src/libpakfire/pakfire.c +++ b/src/libpakfire/pakfire.c @@ -1427,15 +1427,6 @@ int __pakfire_make_cache_path(Pakfire pakfire, char* path, size_t length, return 0; } -PAKFIRE_EXPORT int pakfire_cache_destroy(Pakfire pakfire, const char* path) { - char cache_path[PATH_MAX]; - - pakfire_make_cache_path(pakfire, cache_path, "%s", path); - - // Completely delete the tree of files - return pakfire_rmtree(cache_path, 0); -} - PAKFIRE_EXPORT int pakfire_log_get_priority(Pakfire pakfire) { return pakfire->log_priority; } diff --git a/src/libpakfire/repo.c b/src/libpakfire/repo.c index f9176cbb4..70faf088c 100644 --- a/src/libpakfire/repo.c +++ b/src/libpakfire/repo.c @@ -802,12 +802,13 @@ PAKFIRE_EXPORT PakfirePackage pakfire_repo_add_archive(PakfireRepo repo, Pakfire PAKFIRE_EXPORT int pakfire_repo_clean(PakfireRepo repo) { char cache_path[PATH_MAX]; + // Destroy all files in the cache directory int r = pakfire_make_cache_path(repo->pakfire, cache_path, "%s", pakfire_repo_get_name(repo)); if (r < 0) return r; - return pakfire_cache_destroy(repo->pakfire, cache_path); + return pakfire_rmtree(cache_path, 0); } static int pakfire_repo_scan_file(PakfireRepo repo, const char* path) {