scripts: do autoconf path replacement right

This should finally get the path replacement in our scripts right. This
is the way the autoconf package itself does it and should not need much
further tweaking.

Threw in a few trailing whitespace corrections from the scripts as well.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2007-05-30 11:04:49 -04:00
parent dd926c7a1c
commit b6387b954f
11 changed files with 131 additions and 94 deletions

View file

@ -236,15 +236,6 @@ AC_SUBST(PKGEXT)
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) AC_SUBST(DBEXT)
# Set up localedir substitution, double eval to get full path
localedir="$(eval echo ${localedir})"
LOCALEDIR="$(eval echo ${localedir})"
AC_SUBST(LOCALEDIR)
sysconfdir="$(eval echo ${sysconfdir})"
SYSCONFDIR="$(eval echo ${sysconfdir})"
AC_SUBST(SYSCONFDIR)
# Configuration files # Configuration files
AC_CONFIG_FILES([ AC_CONFIG_FILES([
lib/libalpm/Makefile lib/libalpm/Makefile
@ -253,15 +244,6 @@ src/pacman/Makefile
src/pacman/po/Makefile.in src/pacman/po/Makefile.in
src/util/Makefile src/util/Makefile
scripts/Makefile scripts/Makefile
scripts/abs
scripts/gensync
scripts/makepkg
scripts/makeworld
scripts/pacman-optimize
scripts/rankmirrors
scripts/repo-add
scripts/repo-remove
scripts/updatesync
doc/Makefile doc/Makefile
etc/Makefile etc/Makefile
etc/makepkg.conf etc/makepkg.conf
@ -279,6 +261,7 @@ echo "
$PACKAGE_STRING: $PACKAGE_STRING:
prefix : ${prefix} prefix : ${prefix}
sysconfdir : $(eval echo ${sysconfdir})
source code location : ${srcdir} source code location : ${srcdir}
compiler : ${CC} compiler : ${CC}
compiler flags : ${CFLAGS} compiler flags : ${CFLAGS}

View file

@ -12,4 +12,49 @@ bin_SCRIPTS = \
repo-remove \ repo-remove \
updatesync updatesync
abs gensync makepkg makeworld pacman-optimize rankmirrors repo-add repo-remove re-pacman updatesync: EXTRA_DIST = \
abs.in \
gensync.in \
makepkg.in \
makeworld.in \
pacman-optimize.in \
rankmirrors.in \
repo-add.in \
repo-remove.in \
updatesync.in
# Files that should be removed, but which Automake does not know.
MOSTLYCLEANFILES = $(bin_SCRIPTS) *.tmp
#### Taken from the autoconf scripts Makefile.am ####
edit = sed \
-e 's|@localedir[@]|$(localedir)|g' \
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
-e 's|@prefix[@]|$(prefix)|g' \
-e 's|@PACKAGE_VERSION[@]|$(PACKAGE_VERSION)|g' \
-e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \
-e 's|@ROOTDIR[@]|$(ROOTDIR)|g' \
-e 's|@DBPATH[@]|$(DBPATH)|g' \
-e 's|@LOCKFILE[@]|$(LOCKFILE)|g' \
-e 's|@configure_input[@]|Generated from $@.in; do not edit by hand.|g'
## All the scripts depend on Makefile so that they are rebuilt when the
## prefix etc. changes. Use chmod -w to prevent people from editing the
## wrong file by accident.
$(bin_SCRIPTS): Makefile
rm -f $@ $@.tmp
$(edit) `test -f ./$@.in || echo $(srcdir)/`$@.in >$@.tmp
chmod +x $@.tmp
chmod a-w $@.tmp
mv $@.tmp $@
abs: $(srcdir)/abs.in
gensync: $(srcdir)/gensync.in
makepkg: $(srcdir)/makepkg.in
makeworld: $(srcdir)/makeworld.in
pacman-optimize: $(srcdir)/pacman-optimize.in
rankmirrors: $(srcdir)/rankmirrors.in
repo-add: $(srcdir)/repo-add.in
repo-remove: $(srcdir)/repo-remove.in
re-pacman: $(srcdir)/re-pacman.in
updatesync: $(srcdir)/updatesync.in

View file

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
# #
# abs # abs - download a PKGBUILD tree from a CVS repository
# @configure_input@
# #
# Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org> # Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
# #
@ -21,7 +22,7 @@
# #
myver='@PACKAGE_VERSION@' myver='@PACKAGE_VERSION@'
CONFDIR="@SYSCONFDIR@/abs" CONFDIR="@sysconfdir@/abs"
CONNMODE="m" CONNMODE="m"
[ -f "$CONFDIR/abs.conf" ] && source "$CONFDIR/abs.conf" [ -f "$CONFDIR/abs.conf" ] && source "$CONFDIR/abs.conf"

View file

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
# #
# gensync # gensync
# @configure_input@
# #
# Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org> # Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
# #
@ -37,9 +38,9 @@ usage() {
echo echo
echo "note: The <destfile> name is important. It must be of the form" echo "note: The <destfile> name is important. It must be of the form"
echo " {treename}.db.tar.gz where {treename} is the name of the custom" echo " {treename}.db.tar.gz where {treename} is the name of the custom"
echo " package repository you configured in @SYSCONFDIR@/pacman.conf. The" echo " package repository you configured in @sysconfdir@/pacman.conf. The"
echo " generated database must reside in the same directory as your" echo " generated database must reside in the same directory as your"
echo " custom packages (also configured in @SYSCONFDIR@/pacman.conf)" echo " custom packages (also configured in @sysconfdir@/pacman.conf)"
echo echo
echo "example: gensync /var/abs/local /home/mypkgs/custom.db.tar.gz" echo "example: gensync /var/abs/local /home/mypkgs/custom.db.tar.gz"
echo echo
@ -94,10 +95,10 @@ if [ $# -lt 2 ]; then
fi fi
# source system and user makepkg.conf # source system and user makepkg.conf
if [ -r @SYSCONFDIR@/makepkg.conf ]; then if [ -r @sysconfdir@/makepkg.conf ]; then
source @SYSCONFDIR@/makepkg.conf source @sysconfdir@/makepkg.conf
else else
echo "ERROR: @SYSCONFDIR@/makepkg.conf not found. Can not continue." >&2 echo "ERROR: @sysconfdir@/makepkg.conf not found. Can not continue." >&2
exit 1 # $E_CONFIG_ERROR # TODO: error codes exit 1 # $E_CONFIG_ERROR # TODO: error codes
fi fi

View file

@ -1,8 +1,9 @@
#!/bin/bash #!/bin/bash
# #
# makepkg - make packages compatable for use with pacman # makepkg - make packages compatable for use with pacman
# @configure_input@
# #
# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org> # Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
# Copyright (c) 2005 by Aurelien Foret <orelien@chez.com> # Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
# Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org> # Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
# Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu> # Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
@ -30,7 +31,7 @@ source gettext.sh
TEXTDOMAIN=makepkg TEXTDOMAIN=makepkg
export TEXTDOMAIN export TEXTDOMAIN
TEXTDOMAINDIR='@LOCALEDIR@' TEXTDOMAINDIR='@localedir@'
export TEXTDOMAINDIR export TEXTDOMAINDIR
myver='@PACKAGE_VERSION@' myver='@PACKAGE_VERSION@'
@ -38,8 +39,8 @@ startdir=$(pwd)
# Only use ABSROOT if we haven't been passed a SRCROOT on the command line. # Only use ABSROOT if we haven't been passed a SRCROOT on the command line.
if [ -z "$SRCROOT" ]; then if [ -z "$SRCROOT" ]; then
if [ -r @SYSCONFDIR@/abs/abs.conf ]; then if [ -r @sysconfdir@/abs/abs.conf ]; then
source @SYSCONFDIR@/abs/abs.conf source @sysconfdir@/abs/abs.conf
fi fi
if [ -r ~/.abs.conf ]; then if [ -r ~/.abs.conf ]; then
source ~/.abs.conf source ~/.abs.conf
@ -649,8 +650,8 @@ _PKGDEST=${PKGDEST}
_SRCDEST=${SRCDEST} _SRCDEST=${SRCDEST}
# Source makepkg.conf; fail if it is not found # Source makepkg.conf; fail if it is not found
if [ -r @SYSCONFDIR@/makepkg.conf ]; then if [ -r @sysconfdir@/makepkg.conf ]; then
source @SYSCONFDIR@/makepkg.conf source @sysconfdir@/makepkg.conf
else else
error "$(gettext "/etc/makepkg.conf not found. cannot continue")" error "$(gettext "/etc/makepkg.conf not found. cannot continue")"
exit 1 # $E_CONFIG_ERROR # TODO: error codes exit 1 # $E_CONFIG_ERROR # TODO: error codes

View file

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
# #
# makeworld # makeworld
# @configure_input@
# #
# Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org> # Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
# #

View file

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
# #
# pacman-optimize # pacman-optimize
# @configure_input@
# #
# Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org> # Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org>
# #

View file

@ -1,6 +1,7 @@
#! /usr/bin/python #! /usr/bin/python
# #
# rankmirrors : read a list of mirrors from a file and rank them by speed # rankmirrors - read a list of mirrors from a file and rank them by speed
# @configure_input@
# #
# Original Idea copyright (c) 2006 R.G. <chesercat> # Original Idea copyright (c) 2006 R.G. <chesercat>
# Modified 2006 by Dan McGee <dan@archlinux.org> # Modified 2006 by Dan McGee <dan@archlinux.org>

View file

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
# #
# repo-add : add a package to a given repo database file # repo-add - add a package to a given repo database file
# @configure_input@
# #
# Copyright (c) 2006 Aaron Griffin <aaron@archlinux.org> # Copyright (c) 2006 Aaron Griffin <aaron@archlinux.org>
# #
@ -237,8 +238,8 @@ if [ $# -lt 2 ]; then
fi fi
# source system and user makepkg.conf # source system and user makepkg.conf
if [ -r @SYSCONFDIR@/makepkg.conf ]; then if [ -r @sysconfdir@/makepkg.conf ]; then
source @SYSCONFDIR@/makepkg.conf source @sysconfdir@/makepkg.conf
else else
echo "ERROR: /etc/makepkg.conf not found. Can not continue." >&2 echo "ERROR: /etc/makepkg.conf not found. Can not continue." >&2
exit 1 # $E_CONFIG_ERROR # TODO: error codes exit 1 # $E_CONFIG_ERROR # TODO: error codes

View file

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
# #
# repo-remove : remove a package entry from a given repo database file # repo-remove - remove a package entry from a given repo database file
# @configure_input@
# #
# Copyright (c) 2007 Dan McGee <dan@archlinux.org> # Copyright (c) 2007 Dan McGee <dan@archlinux.org>
# #
@ -93,8 +94,8 @@ if [ $# -lt 2 ]; then
fi fi
# source system and user makepkg.conf # source system and user makepkg.conf
if [ -r @SYSCONFDIR@/makepkg.conf ]; then if [ -r @sysconfdir@/makepkg.conf ]; then
source @SYSCONFDIR@/makepkg.conf source @sysconfdir@/makepkg.conf
else else
echo "ERROR: /etc/makepkg.conf not found. Can not continue." >&2 echo "ERROR: /etc/makepkg.conf not found. Can not continue." >&2
exit 1 # $E_CONFIG_ERROR # TODO: error codes exit 1 # $E_CONFIG_ERROR # TODO: error codes

View file

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
# #
# updatesync # updatesync
# @configure_input@
# #
# Copyright (c) 2004 by Jason Chu <jason@archlinux.org> # Copyright (c) 2004 by Jason Chu <jason@archlinux.org>
# Derived from gensync (c) 2002-2006 Judd Vinet <jvinet@zeroflux.org> # Derived from gensync (c) 2002-2006 Judd Vinet <jvinet@zeroflux.org>
@ -96,8 +97,8 @@ if [ $# -lt 3 ]; then
fi fi
# source system and user makepkg.conf # source system and user makepkg.conf
if [ -r @SYSCONFDIR@/makepkg.conf ]; then if [ -r @sysconfdir@/makepkg.conf ]; then
source @SYSCONFDIR@/makepkg.conf source @sysconfdir@/makepkg.conf
else else
echo "ERROR: /etc/makepkg.conf not found. Can not continue." >&2 echo "ERROR: /etc/makepkg.conf not found. Can not continue." >&2
exit 1 # $E_CONFIG_ERROR # TODO: error codes exit 1 # $E_CONFIG_ERROR # TODO: error codes