summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2007-06-04 16:37:00 +0200
committerDan McGee <dan@archlinux.org>2007-06-04 23:00:30 +0200
commitd9ff7bbcd2eef852f18ad65d79aa6b6f7c58535c (patch)
tree1f8fb2f1b794906300ca14ac68b592136a898de1
parenta094deacf4f6abbef10c6acf38190d4fa9d34f0e (diff)
downloadpacman-d9ff7bbcd2eef852f18ad65d79aa6b6f7c58535c.tar.gz
pacman-d9ff7bbcd2eef852f18ad65d79aa6b6f7c58535c.tar.xz
Remove hardcoded defines from libalpm
Remove any use of the former path variables defined by the Makefiles or config.h. These are now runtime configurable only with pacman.conf (or by using flags on the command line). Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--configure.ac2
-rw-r--r--lib/libalpm/Makefile.am6
-rw-r--r--lib/libalpm/handle.c10
-rw-r--r--src/pacman/Makefile.am1
-rw-r--r--src/pacman/add.c2
-rw-r--r--src/pacman/pacman.c6
-rw-r--r--src/pacman/remove.c2
-rw-r--r--src/pacman/sync.c2
8 files changed, 12 insertions, 19 deletions
diff --git a/configure.ac b/configure.ac
index 74d7911b..7312b7df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -210,8 +210,6 @@ AM_CONDITIONAL(INCLUDE_ABS, test "x$includeabs" = "xyes")
# Set root directory
AC_SUBST(ROOTDIR)
-AC_DEFINE_UNQUOTED([ROOTDIR], "$ROOTDIR", [Location of pacman's default root di
-rectory])
# Set package file extension
AC_SUBST(PKGEXT)
AC_DEFINE_UNQUOTED([PKGEXT], "$PKGEXT", [The file extension used by pacman packages])
diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am
index 285a9a83..e3d6a188 100644
--- a/lib/libalpm/Makefile.am
+++ b/lib/libalpm/Makefile.am
@@ -10,11 +10,7 @@ cachedir = ${localstatedir}/cache/pacman/pkg/
lib_LTLIBRARIES = libalpm.la
include_HEADERS = alpm_list.h alpm.h
-DEFS = -DLOCALEDIR=\"@localedir@\" \
- -DLOCKFILE=\"$(lockfile)\" \
- -DDBPATH=\"$(dbpath)\" \
- -DCACHEDIR=\"$(cachedir)\" \
- @DEFS@
+DEFS = -DLOCALEDIR=\"@localedir@\" @DEFS@
AM_CFLAGS = -fvisibility=hidden -pedantic -D_GNU_SOURCE
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 9aa7cce1..d2e3dd0d 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -78,12 +78,12 @@ pmhandle_t *_alpm_handle_new()
//#else
handle->access = PM_ACCESS_RW;
#endif
-
- handle->root = strdup(ROOTDIR);
- handle->dbpath = strdup(DBPATH);
- handle->cachedir = strdup(CACHEDIR);
- handle->lockfile = strdup(LOCKFILE);
handle->logmask = PM_LOG_ERROR | PM_LOG_WARNING;
+ handle->root = NULL;
+ handle->dbpath = NULL;
+ handle->cachedir = NULL;
+ handle->lockfile = NULL;
+ handle->logfile = NULL;
return(handle);
}
diff --git a/src/pacman/Makefile.am b/src/pacman/Makefile.am
index 5248abf3..3bccac22 100644
--- a/src/pacman/Makefile.am
+++ b/src/pacman/Makefile.am
@@ -8,7 +8,6 @@ bin_PROGRAMS = pacman pacman.static
DEFS = -DLOCALEDIR=\"@localedir@\" \
-DCONFFILE=\"$(conffile)\" \
- -DLOCKFILE=\"$(lockfile)\" \
@DEFS@
INCLUDES = -I$(top_srcdir)/lib/libalpm
diff --git a/src/pacman/add.c b/src/pacman/add.c
index ef84a398..526b236b 100644
--- a/src/pacman/add.c
+++ b/src/pacman/add.c
@@ -95,7 +95,7 @@ int pacman_add(alpm_list_t *targets)
if(pm_errno == PM_ERR_HANDLE_LOCK) {
/* TODO this and the 2 other places should probably be on stderr */
printf(_(" if you're sure a package manager is not already\n"
- " running, you can remove %s.\n"), LOCKFILE);
+ " running, you can remove %s.\n"), alpm_option_get_lockfile());
}
return(1);
}
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index f0ae3287..0b95ac15 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -520,7 +520,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(), ROOTDIR) != 0)) {
+ || (strcmp(alpm_option_get_root(), "/") != 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 */
@@ -551,10 +551,10 @@ int main(int argc, char *argv[])
if(config->verbose > 0) {
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());
+ 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/remove.c b/src/pacman/remove.c
index 9cdfb0d8..c76fc69a 100644
--- a/src/pacman/remove.c
+++ b/src/pacman/remove.c
@@ -86,7 +86,7 @@ int pacman_remove(alpm_list_t *targets)
alpm_strerror(pm_errno));
if(pm_errno == PM_ERR_HANDLE_LOCK) {
printf(_(" if you're sure a package manager is not already\n"
- " running, you can remove %s.\n"), LOCKFILE);
+ " running, you can remove %s.\n"), alpm_option_get_lockfile());
}
FREELIST(finaltargs);
return(1);
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 7d7de529..9f345c69 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -482,7 +482,7 @@ int pacman_sync(alpm_list_t *targets)
alpm_strerror(pm_errno));
if(pm_errno == PM_ERR_HANDLE_LOCK) {
printf(_(" if you're sure a package manager is not already\n"
- " running, you can remove %s.\n"), LOCKFILE);
+ " running, you can remove %s.\n"), alpm_option_get_lockfile());
}
return(1);
}