FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 03-10-2012, 12:04 AM
Allan McRae
 
Default 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>
---

Why didn't I know about fnmatch before... so much easier than the
regex stuff I was doing before!

src/pacman/sync.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index e69ca58..1df2a6f 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -26,6 +26,7 @@
#include <errno.h>
#include <dirent.h>
#include <sys/stat.h>
+#include <fnmatch.h>

#include <alpm.h>
#include <alpm_list.h>
@@ -222,6 +223,23 @@ 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 withing 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);

--
1.7.9.3
 

Thread Tools




All times are GMT. The time now is 04:58 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org