Set paths in pacman-optimize to use configure-time paths

By setting up a few more AC_SUBST macros in configure.ac, we can fill in
paths in the scripts on the fly instead of having them in multiple places.

Other small fixes:
* Fix an oops on my last commit where I had some lines stil commented.
* Fix makepkg bug where the generated package name using PKGEXT had two
  periods (..).

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2007-05-29 17:46:20 -04:00
parent 103c7243a2
commit f3836ff8e8
4 changed files with 39 additions and 35 deletions

View File

@ -41,37 +41,37 @@ AM_CONDITIONAL(LINKSTATIC, test "$enable_static" = "yes")
dnl Help line for root directory
AC_ARG_WITH(root-dir,
AC_HELP_STRING([--with-root-dir=path], [Set the location of pacman's root operating directory]),
[rootdir=$withval], [rootdir=/])
[ROOTDIR=$withval], [ROOTDIR=/])
dnl Help line for database path
AC_ARG_WITH(db-path,
AC_HELP_STRING([--with-db-path=path], [Set the location of pacman's database]),
[dbpath=$withval], [dbpath=var/lib/pacman/])
[DBPATH=$withval], [DBPATH=var/lib/pacman/])
dnl Help line for cache directory
AC_ARG_WITH(cache-dir,
AC_HELP_STRING([--with-cache-dir=path], [Set the location of pacman's cache directory]),
[cachedir=$withval], [cachedir=var/cache/pacman/pkg/])
[CACHEDIR=$withval], [CACHEDIR=var/cache/pacman/pkg/])
dnl Help line for lock file
AC_ARG_WITH(lock-file,
AC_HELP_STRING([--with-lock-file=path], [Set the location of pacman's lock file]),
[lockfile=$withval], [lockfile=var/run/pacman.lck])
[LOCKFILE=$withval], [LOCKFILE=var/run/pacman.lck])
dnl Help line for config file
AC_ARG_WITH(config-file,
AC_HELP_STRING([--with-config-file=path], [Set the location of pacman's config file]),
[configfile=$withval], [configfile=etc/pacman.conf])
[CONFIGFILE=$withval], [CONFIGFILE=etc/pacman.conf])
dnl Help line for package extension
AC_ARG_WITH(pkg-ext,
AC_HELP_STRING([--with-pkg-ext=ext], [Set the file extension used by packages]),
[pkgext=$withval], [pkgext=.pkg.tar.gz])
[PKGEXT=$withval], [PKGEXT=.pkg.tar.gz])
dnl Help line for database extension
AC_ARG_WITH(db-ext,
AC_HELP_STRING([--with-db-ext=ext], [Set the file extension used by the database]),
[dbext=$withval], [dbext=.db.tar.gz])
[DBEXT=$withval], [DBEXT=.db.tar.gz])
dnl Help line for doxygen
AC_ARG_ENABLE(doxygen,
@ -186,25 +186,32 @@ else
fi
dnl Set root directory
AC_DEFINE_UNQUOTED([PM_ROOT], "$rootdir", [Location of pacman's default root directory])
AC_DEFINE_UNQUOTED([PM_ROOT], "$ROOTDIR", [Location of pacman's default root directory])
AC_SUBST(ROOTDIR)
dnl Set database path
AC_DEFINE_UNQUOTED([PM_DBPATH], "$dbpath", [Location of pacman database])
AC_DEFINE_UNQUOTED([PM_DBPATH], "$DBPATH", [Location of pacman database])
AC_SUBST(DBPATH)
dnl Set cache directory
AC_DEFINE_UNQUOTED([PM_CACHEDIR], "$cachedir", [Location of pacman's package cache])
AC_DEFINE_UNQUOTED([PM_CACHEDIR], "$CACHEDIR", [Location of pacman's package cache])
AC_SUBST(CACHEDIR)
dnl Set lock file location
AC_DEFINE_UNQUOTED([PM_LOCK], "$lockfile", [Location of pacman lock file])
AC_DEFINE_UNQUOTED([PM_LOCK], "$LOCKFILE", [Location of pacman lock file])
AC_SUBST(LOCKFILE)
dnl Set configuration file location
AC_DEFINE_UNQUOTED([PM_CONF], "$configfile", [Location of pacman configuration file])
AC_DEFINE_UNQUOTED([PM_CONF], "$CONFIGFILE", [Location of pacman configuration file])
AC_SUBST(CONFIGFILE)
dnl Set package file extension
AC_DEFINE_UNQUOTED([PM_EXT_PKG], "$pkgext", [The file extension used by pacman packages])
AC_DEFINE_UNQUOTED([PM_EXT_PKG], "$PKGEXT", [The file extension used by pacman packages])
AC_SUBST(PKGEXT)
dnl Set database file extension
AC_DEFINE_UNQUOTED([PM_EXT_DB], "$dbext", [The file extension used by pacman databases])
AC_DEFINE_UNQUOTED([PM_EXT_DB], "$DBEXT", [The file extension used by pacman databases])
AC_SUBST(DBEXT)
dnl Set up localedir substitution, double eval to get full path
localedir="$(eval echo ${localedir})"
@ -258,13 +265,13 @@ pacman-$VERSION:
pacman version : ${PACKAGE_VERSION}
Directory and file information:
root directory : ${rootdir}
database path : ${rootdir}${dbpath}
cache directory : ${rootdir}${cachedir}
lock file location : ${rootdir}${lockfile}
conf file location : ${rootdir}${configfile}
package extension : ${pkgext}
database extension : ${dbext}
root directory : ${ROOTDIR}
database path : ${ROOTDIR}${DBPATH}
cache directory : ${ROOTDIR}${CACHEDIR}
lock file location : ${ROOTDIR}${LOCKFILE}
conf file location : ${ROOTDIR}${CONFIGFILE}
package extension : ${PKGEXT}
database extension : ${DBEXT}
Compilation options:
Doxygen support : ${usedoxygen}

View File

@ -92,9 +92,9 @@ DOC_DIRS=(usr/{,share/}{info,doc,gtk-doc} opt/gnome/{,share/}{info,doc,gtk-doc})
# WARNING: Do NOT modify these variables unless you know what you are
# doing.
#
BUILDSCRIPT="PKGBUILD"
PKGEXT=".pkg.tar.gz"
DB_COMPRESSION="gz"
BUILDSCRIPT='PKGBUILD'
PKGEXT='@PKGEXT@'
DB_COMPRESSION='gz'
DB_CHECKSUMS=(md5)
# vim: set ft=sh ts=2 sw=2 et:

View File

@ -578,7 +578,7 @@ create_package() {
# tar it up
msg2 "$(gettext "Compressing package...")"
local pkg_file="$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.${PKGEXT}"
local pkg_file="$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
comp_files="$comp_files .PKGINFO .FILELIST"
if ! tar -czf "$pkg_file" $comp_files *; then
@ -590,11 +590,11 @@ create_package() {
installpackage() {
if [ "$INSTALL" = "1" -a "$SUDO" = "1" ]; then
msg "$(gettext "Installing package with pacman -U...")"
sudo pacman $PACMAN_OPTS -U $PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.${PKGEXT}
sudo pacman $PACMAN_OPTS -U $PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}
exit $?
elif [ "$INSTALL" = "1" -a "$EUID" = "0" -a "$INFAKEROOT" != "1" ]; then
msg "$(gettext "Installing package with pacman -U...")"
pacman $PACMAN_OPTS -U $PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.${PKGEXT}
pacman $PACMAN_OPTS -U $PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}
exit $?
fi
}
@ -864,7 +864,7 @@ if [ "$install" -a ! -f "$install" ]; then
exit 1
fi
if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}.${PKGEXT}" \
if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \
-a "$FORCE" = "0" -a "$GENINTEG" = "0" ]; then
if [ "$INSTALL" = "1" ]; then
warning "$(gettext "a package has already been built, installing existing package.")"

View File

@ -21,11 +21,8 @@
#
myver='@PACKAGE_VERSION@'
#TODO replace with configure-time db location
dbroot="/var/lib/pacman"
#TODO replace with configure-time lockfile location
lockfile="/tmp/pacman.lck"
dbroot='@ROOTDIR@@DBPATH@'
lockfile='@ROOTDIR@@LOCKFILE@'
error() {
if [ "$USECOLOR" = "YES" -o "$USECOLOR" = "yes" ]; then
@ -36,8 +33,8 @@ error() {
}
# determine current USECOLOR setting
#[ -f "/etc/rc.conf" ] && source /etc/rc.conf
#[ -f "/etc/rc.d/functions" ] && source /etc/rc.d/functions
[ -f "/etc/rc.conf" ] && source /etc/rc.conf
[ -f "/etc/rc.d/functions" ] && source /etc/rc.d/functions
usage() {
echo "pacman-optimize (pacman) $myver"