diff options
| author | Gábor Németh <homar@riseup.net> | 2023-03-06 16:19:14 +0100 |
|---|---|---|
| committer | Gábor Németh <homar@riseup.net> | 2023-11-22 11:05:28 +0100 |
| commit | bd7c126e3fb1b94e76e0e632c657cea854586844 (patch) | |
| tree | e7e5140d1857d155a187f6392cf458c0237f6858 /apt-pkg/acquire.h | |
| parent | 6ba6b29e37a7e7b867a88f1d74e7dcfd7f83c30e (diff) | |
Add 'dist-clean' command to remove packages and list files
We assume all files in the 'listsdir' are candidates. Keep only files
ending with Release, Release.gpg, and InRelease.
Closes: #959093
Diffstat (limited to 'apt-pkg/acquire.h')
| -rw-r--r-- | apt-pkg/acquire.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h index 17b68768e..46115a27f 100644 --- a/apt-pkg/acquire.h +++ b/apt-pkg/acquire.h @@ -70,6 +70,7 @@ #include <apt-pkg/weakptr.h> #include <chrono> +#include <functional> #include <string> #include <vector> @@ -330,6 +331,14 @@ class APT_PUBLIC pkgAcquire * \return \b true if the directory exists and is readable. */ bool Clean(std::string Dir); + + /** Deletes each package list and index file in the given directory. + * + * \param Dir The directory to be cleaned. + * + * \return \b true if the directory exists and is readable. + */ + bool CleanLists(std::string Dir); /** \return the total size in bytes of all the items included in * this download. @@ -372,6 +381,20 @@ class APT_PUBLIC pkgAcquire private: APT_HIDDEN void Initialize(); + + /** Delete each entry in the given directory whose name does \em not match + * a criterion. + * + * \param Dir The directory to be cleaned. + * + * \param KeepP A predicate telling to keep the named file; if it is + * non-empty and returns true, the file is kept. + * + * \param Caller Log name of the caller. + * + * \return \b true if the directory exists and is readable. + */ + APT_HIDDEN static bool CleanDir(std::string Dir, std::function<bool(char const*)> const &KeepP, char const * const Caller); }; /** \brief Represents a single download source from which an item |
