]> git.saurik.com Git - apt.git/commitdiff
correct LD_LIBRARY_PATH and config loading for apt-helper
authorDavid Kalnischkies <david@kalnischkies.de>
Mon, 10 Mar 2014 21:31:00 +0000 (22:31 +0100)
committerDavid Kalnischkies <david@kalnischkies.de>
Thu, 13 Mar 2014 12:58:46 +0000 (13:58 +0100)
Mostly ensures that we use the build methods and not the system
provided methods in the tests (if we don't want it that way).

Git-Dch: Ignore

debian/tests/run-tests
test/integration/framework

index 41bafda9982520b41a366d76d07ace3739188182..e6bc5e0d10a5ce984cd57314964bc9146331a683 100644 (file)
@@ -13,4 +13,5 @@ APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR=$(pwd)/build/bin \
 APT_INTEGRATION_TESTS_METHODS_DIR=/usr/lib/apt/methods \
 APT_INTEGRATION_TESTS_LIBEXEC_DIR=/usr/lib/apt/ \
 APT_INTEGRATION_TESTS_BUILD_DIR=/usr/bin \
+APT_INTEGRATION_TESTS_LIBRARY_PATH=/dev/null/does/not/exist \
 ./test/integration/run-tests
index 6502dbad1807574bab6fc5bbb563ba53f5e2752b..1ab421c4c7af32e2ebd1934037328a349e542e7f 100644 (file)
@@ -93,15 +93,18 @@ msgdone() {
 
 runapt() {
        msgdebug "Executing: ${CCMD}$*${CDEBUG} "
-       local CMD="${BUILDDIRECTORY}/$1"
-       if [ "$1" = 'sh' ]; then CMD='sh'; fi
+       local CMD="$1"
        shift
+       case $CMD in
+       sh|aptitude|*/*) ;;
+       *) CMD="${BUILDDIRECTORY}/$CMD";;
+       esac
        if [ -f ./aptconfig.conf ]; then
-               MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} $CMD "$@"
+               MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${LIBRARYPATH} $CMD "$@"
        elif [ -f ../aptconfig.conf ]; then
-               MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} $CMD "$@"
+               MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${LIBRARYPATH} $CMD "$@"
        else
-               MALLOC_PERTURB_=21 MALLOC_CHECK_=2 LD_LIBRARY_PATH=${BUILDDIRECTORY} $CMD "$@"
+               MALLOC_PERTURB_=21 MALLOC_CHECK_=2 LD_LIBRARY_PATH=${LIBRARYPATH} $CMD "$@"
        fi
 }
 aptconfig() { runapt apt-config "$@"; }
@@ -112,33 +115,19 @@ aptftparchive() { runapt apt-ftparchive "$@"; }
 aptkey() { runapt apt-key "$@"; }
 aptmark() { runapt apt-mark "$@"; }
 apt() { runapt apt "$@"; }
-apthelper() { 
-  LD_LIBRARY_PATH=${APTHELPERBINDIR} ${APTHELPERBINDIR}/apt-helper "$@";
-}
-aptwebserver() {
-  LD_LIBRARY_PATH=${APTWEBSERVERBINDIR} ${APTWEBSERVERBINDIR}/aptwebserver "$@";
-}
+apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; }
+aptwebserver() { runapt "${APTWEBSERVERBINDIR}/aptwebserver" "$@"; }
+aptitude() { runapt aptitude "$@"; }
+
 dpkg() {
        command dpkg --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log "$@"
 }
 dpkgcheckbuilddeps() {
        command dpkg-checkbuilddeps --admindir=${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg "$@"
 }
-aptitude() {
-       if [ -f ./aptconfig.conf ]; then
-               APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY}  command aptitude "$@"
-       elif [ -f ../aptconfig.conf ]; then
-               APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} command aptitude "$@"
-       else
-               LD_LIBRARY_PATH=${BUILDDIRECTORY}  command aptitude "$@"
-       fi
-}
 gdb() {
        echo "gdb: run »$*«"
-       APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} command gdb ${BUILDDIRECTORY}/$1 --args "$@"
-}
-http() {
-       LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/methods/http
+       APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${LIBRARYPATH} command gdb ${BUILDDIRECTORY}/$1 --args "$@"
 }
 gpg() {
        # see apt-key for the whole trickery. Setup is done in setupenvironment
@@ -183,6 +172,7 @@ setupenvironment() {
 
         # allow overriding the default BUILDDIR location
        BUILDDIRECTORY=${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/bin"}
+       LIBRARYPATH=${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}"}
         METHODSDIR=${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}
         APTHELPERBINDIR=${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"}
         APTWEBSERVERBINDIR=${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"}
@@ -246,7 +236,7 @@ setupenvironment() {
        # cleanup the environment a bit
        export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
        export LC_ALL=C.UTF-8
-       unset LANGUAGE
+       unset LANGUAGE APT_CONFIG
        unset GREP_OPTIONS DEB_BUILD_PROFILES
 
        msgdone "info"