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>
This commit is contained in:
Dan McGee 2007-06-04 10:37:00 -04:00
parent a094deacf4
commit d9ff7bbcd2
8 changed files with 12 additions and 19 deletions

View file

@ -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])

View file

@ -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

View file

@ -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);
}

View file

@ -8,7 +8,6 @@ bin_PROGRAMS = pacman pacman.static
DEFS = -DLOCALEDIR=\"@localedir@\" \
-DCONFFILE=\"$(conffile)\" \
-DLOCKFILE=\"$(lockfile)\" \
@DEFS@
INCLUDES = -I$(top_srcdir)/lib/libalpm

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);

View file

@ -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);
}