summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-06-04 14:50:16 -0400
committerDan McGee <dan@archlinux.org>2007-06-09 13:03:25 -0400
commit35a794c2ed4da7da44d3a04794fc90615e7c52e7 (patch)
tree75fd2667a69867795f6a32cc9bb1dc7d505e2004 /src
parentb6f3fe6957d0206485eac98fb2120578b75d0058 (diff)
downloadpacman-35a794c2ed4da7da44d3a04794fc90615e7c52e7.tar.xz
Allow multiple CacheDirs to be specified
This should hopefully allow multiple cache dirs to be specified in pacman.conf and/or on the command line, and allow pacman to test each one for the package file. The first one found to be writeable is used as the download cache. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/pacman.c14
-rw-r--r--src/pacman/sync.c4
2 files changed, 13 insertions, 5 deletions
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 2f0ed790..4aaf1422 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -339,12 +339,13 @@ static int parseargs(int argc, char *argv[])
case 1005: config->flags |= PM_TRANS_FLAG_NOSCRIPTLET; break;
case 1006: config->noask = 1; config->ask = atoi(optarg); break;
case 1007:
+ /* TODO redo this logic- check path somewhere else, delete other cachedirs, etc */
if(stat(optarg, &st) == -1 || !S_ISDIR(st.st_mode)) {
fprintf(stderr, _("error: '%s' is not a valid cache directory\n"),
optarg);
return(1);
}
- alpm_option_set_cachedir(optarg);
+ alpm_option_add_cachedir(optarg);
break;
case 1008:
alpm_option_set_lockfile(optarg);
@@ -616,7 +617,7 @@ static int _parseconfig(const char *file, const char *givensection,
alpm_option_set_dbpath(ptr);
pm_printf(PM_LOG_DEBUG, _("config: dbpath: %s\n"), ptr);
} else if(strcmp(key, "CacheDir") == 0 || strcmp(upperkey, "CACHEDIR") == 0) {
- alpm_option_set_cachedir(ptr);
+ alpm_option_add_cachedir(ptr);
pm_printf(PM_LOG_DEBUG, _("config: cachedir: %s\n"), ptr);
} else if(strcmp(key, "RootDir") == 0 || strcmp(upperkey, "ROOTDIR") == 0) {
alpm_option_set_root(ptr);
@@ -762,10 +763,15 @@ if(0) {
#endif
if(config->verbose > 0) {
+ alpm_list_t *i;
printf("Root : %s\n", alpm_option_get_root());
printf("Conf File : %s\n", config->configfile);
- printf("DBPath : %s\n", alpm_option_get_dbpath());
- printf("CacheDir : %s\n", alpm_option_get_cachedir());
+ printf("DB Path : %s\n", alpm_option_get_dbpath());
+ printf("Cache Dirs: ");
+ for(i = alpm_option_get_cachedirs(); i; i = alpm_list_next(i)) {
+ printf("%s ", (char*)alpm_list_getdata(i));
+ }
+ printf("\n");
printf("Lock File : %s\n", alpm_option_get_lockfile());
printf("Log File : %s\n", alpm_option_get_logfile());
list_display("Targets :", pm_targets);
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index fa99797c..8d810f83 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -89,7 +89,9 @@ static int split_pkgname(char *target, char *name, char *version)
static int sync_cleancache(int level)
{
- const char *cachedir = alpm_option_get_cachedir();
+ /* TODO for now, just mess with the first cache directory */
+ alpm_list_t* cachedirs = alpm_option_get_cachedirs();
+ const char *cachedir = alpm_list_getdata(cachedirs);
if(level == 1) {
/* incomplete cleanup: we keep latest packages and partial downloads */