From 7bd2ff685188d0d9b6ab6c6f43f6d28811936881 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 31 May 2007 02:51:28 -0400 Subject: Move DB and cache dirs away from there dependence on ROOTDIR This change allows us to use all autoconf specified paths, most notably $(localstatedir). It is quite a change and touches a lot of files, as all references to the DB and cache were done with the ROOTDIR as a prefix. * add --lock command-line option to pacman to specify the location of the lockfile (this can now be specified at configure time by setting the $localstatedir path). * Rip quite a few settings out of configure.ac as they are now picked by setting the paths during configure or make. * Fix bug with /tmp fallback for sync downloads not working correctly (related to root location, now the system tmp dir is used). * Simplified the parameters to some libalpm functions, and added get/set for the new lockfile option. * Renamed several of the DEFS to names without the PM_ prefix. Signed-off-by: Dan McGee --- src/pacman/pacman.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/pacman/pacman.c') diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 58e85b22..e3656830 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -159,6 +159,7 @@ static void usage(int op, char *myname) printf(_(" -r, --root set an alternate installation root\n")); printf(_(" -b, --dbpath set an alternate database location\n")); printf(_(" --cachedir set an alternate package cache location\n")); + printf(_(" --lock set an alternate lockfile location\n")); } } @@ -302,6 +303,7 @@ static int parseargs(int argc, char *argv[]) {"noscriptlet", no_argument, 0, 1005}, {"ask", required_argument, 0, 1006}, {"cachedir", required_argument, 0, 1007}, + {"lock", required_argument, 0, 1008}, {0, 0, 0, 0} }; struct stat st; @@ -360,6 +362,9 @@ static int parseargs(int argc, char *argv[]) } alpm_option_set_cachedir(optarg); break; + case 1008: + alpm_option_set_lockfile(optarg); + break; case 'A': config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_ADD); break; case 'F': config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_UPGRADE); @@ -519,7 +524,7 @@ int main(int argc, char *argv[]) (config->op_s_search || config->group || config->op_q_list || config->op_q_info || config->flags & PM_TRANS_FLAG_PRINTURIS)) || (config->op == PM_OP_DEPTEST && config->op_d_resolve) - || (strcmp(alpm_option_get_root(), PM_ROOT) != 0)) { + || (strcmp(alpm_option_get_root(), ROOTDIR) != 0)) { /* special case: PM_OP_SYNC can be used w/ config->op_s_search by any user */ /* special case: ignore root user check if -r is specified, fall back on * normal FS checking */ @@ -535,7 +540,7 @@ int main(int argc, char *argv[]) alpm_option_set_logcb(cb_log); if(config->configfile == NULL) { - config->configfile = strdup(PM_ROOT PM_CONF); + config->configfile = strdup(CONFFILE); } if(alpm_parse_config(config->configfile, NULL, "") != 0) { @@ -548,10 +553,13 @@ int main(int argc, char *argv[]) alpm_option_set_dlcb(cb_dl_progress); if(config->verbose > 0) { - printf("Root : %s\n", alpm_option_get_root()); - printf("DBPath : %s\n", alpm_option_get_dbpath()); - printf("CacheDir : %s\n", alpm_option_get_cachedir()); - list_display(_("Targets :"), pm_targets); + printf("Root : %s\n", alpm_option_get_root()); + printf("Conf File : %s\n", config->configfile); + printf("Lock File : %s\n", alpm_option_get_lockfile()); + printf("Root : %s\n", alpm_option_get_root()); + printf("DBPath : %s\n", alpm_option_get_dbpath()); + printf("CacheDir : %s\n", alpm_option_get_cachedir()); + list_display("Targets :", pm_targets); } /* Opening local database */ -- cgit v1.2.3