diff options
author | Allan McRae <allan@archlinux.org> | 2012-03-09 14:16:40 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-03-13 14:24:11 +0100 |
commit | 47d0df6c101455c989887551bd0f0149a0f00de7 (patch) | |
tree | 062be65de7651e53939e0ffcf210ea73dd8a4b5a | |
parent | ff58e5cb2d6aca0e1c8ed0e77770f3c5d2442c46 (diff) | |
download | pacman-47d0df6c101455c989887551bd0f0149a0f00de7.tar.gz pacman-47d0df6c101455c989887551bd0f0149a0f00de7.tar.xz |
Skip special files when cleaning package cache
Ignore *.sig, *.db*, and *.src.tar* when cleaning the package cache.
Fixes FS#25166.
Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r-- | src/pacman/sync.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/pacman/sync.c b/src/pacman/sync.c index a9a9e99c..951ee94c 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -28,6 +28,7 @@ #include <errno.h> #include <dirent.h> #include <sys/stat.h> +#include <fnmatch.h> #include <alpm.h> #include <alpm_list.h> @@ -224,6 +225,22 @@ static int sync_cleancache(int level) if(strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) { continue; } + + /* skip signature files - they are removed with their package file */ + if(fnmatch("*.sig", ent->d_name, 0) == 0) { + continue; + } + + /* skip package database within the cache directory */ + if(fnmatch("*.db*", ent->d_name, 0) == 0) { + continue; + } + + /* skip source packages within the cache directory */ + if(fnmatch("*.src.tar*", ent->d_name, 0) == 0) { + continue; + } + /* build the full filepath */ snprintf(path, PATH_MAX, "%s%s", cachedir, ent->d_name); |