Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Chantry <shiningxc@gmail.com>2009-07-08 14:00:25 +0200
committerDan McGee <dan@archlinux.org>2009-07-16 06:15:26 -0500
commit8ebc07744ac58ed1e42af3a52d998587fca85f8b (patch)
treefffcfc537913f7dc7a04d5185cd4a5dde4e1d5fb
parent2e043aae36bdb8a7591646db00a95dd21f1f368f (diff)
Offer to clean up non-package files in cache directory.
This implements FS#15142. Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--src/pacman/sync.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index e644b225..cb0b8b19 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -149,7 +149,7 @@ static int sync_cleancache(int level)
/* this should not happen : the config parsing doesn't set any other value */
return(1);
}
- printf(_("removing old packages from cache... "));
+ printf(_("removing old packages from cache...\n"));
dir = opendir(cachedir);
if(dir == NULL) {
@@ -172,10 +172,13 @@ static int sync_cleancache(int level)
/* build the full filepath */
snprintf(path, PATH_MAX, "%s%s", cachedir, ent->d_name);
- /* attempt to load the package, skip file on failures as we may have
+ /* attempt to load the package, prompt removal on failures as we may have
* files here that aren't valid packages. we also don't need a full
* load of the package, just the metadata. */
if(alpm_pkg_load(path, 0, &localpkg) != 0 || localpkg == NULL) {
+ if(yesno(_("File %s does not seem to be a valid package, remove it?"), path)) {
+ unlink(path);
+ }
continue;
}
switch(config->cleanmethod) {
@@ -212,14 +215,13 @@ static int sync_cleancache(int level)
unlink(path);
}
}
- printf(_("done.\n"));
} else {
/* full cleanup */
printf(_("Cache directory: %s\n"), cachedir);
- if(!noyes(_("Do you want to remove ALL packages from cache?"))) {
+ if(!noyes(_("Do you want to remove ALL files from cache?"))) {
return(0);
}
- printf(_("removing all packages from cache... "));
+ printf(_("removing all files from cache...\n"));
if(rmrf(cachedir)) {
pm_fprintf(stderr, PM_LOG_ERROR, _("could not remove cache directory\n"));
@@ -230,7 +232,6 @@ static int sync_cleancache(int level)
pm_fprintf(stderr, PM_LOG_ERROR, _("could not create new cache directory\n"));
return(1);
}
- printf(_("done.\n"));
}
return(0);
@@ -772,6 +773,7 @@ int pacman_sync(alpm_list_t *targets)
}
ret += sync_cleancache(config->op_s_clean);
+ printf("\n");
ret += sync_cleandb_all();
if(trans_release() == -1) {