]> git.saurik.com Git - apt.git/blobdiff - test/integration/framework
initial version of apt-helper
[apt.git] / test / integration / framework
index be2cb95d110105d657a0d3ba37c987e82e276a40..911a4d7429292763fbd3fc6ed577932ff06f82c9 100644 (file)
@@ -111,6 +111,9 @@ 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 "$@";
 }
@@ -177,6 +180,7 @@ setupenvironment() {
         # allow overriding the default BUILDDIR location
        BUILDDIRECTORY=${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/bin"}
         METHODSDIR=${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}
+        APTHELPERBINDIR=${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"}
         APTWEBSERVERBINDIR=${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"}
        test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first"
         # -----
@@ -934,37 +938,10 @@ changetocdrom() {
 }
 
 downloadfile() {
-       PROTO="$(echo "$1" | cut -d':' -f 1)"
-       local DOWNLOG="${TMPWORKINGDIRECTORY}/download.log"
-       rm -f "$DOWNLOG"
-       touch "$DOWNLOG"
-       {
-               echo "601 Configuration
-Config-Item: Acquire::https::CaInfo=${TESTDIR}/apt.pem
-Config-Item: Debug::Acquire::${PROTO}=1
-
-600 Acquire URI
-URI: $1
-Filename: ${2}
-"
-               # simple worker keeping stdin open until we are done (201) or error (400)
-               # and requesting new URIs on try-agains/redirects in-between
-               { tail -n 999 -f "$DOWNLOG" & echo "TAILPID: $!"; } | while read f1 f2; do
-                       if [ "$f1" = 'TAILPID:' ]; then
-                               TAILPID="$f2"
-                       elif [ "$f1" = 'New-URI:' ]; then
-                               echo "600 Acquire URI
-URI: $f2
-Filename: ${2}
-"
-                       elif [ "$f1" = '201' ] || [ "$f1" = '400' ]; then
-                               # tail would only die on next read – which never happens
-                               test -z "$TAILPID" || kill -s HUP "$TAILPID"
-                               break
-                       fi
-               done
-       } | LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/methods/${PROTO} 2>&1 | tee "$DOWNLOG"
-       rm "$DOWNLOG"
+        PROTO="$(echo "$1" | cut -d':' -f 1)"
+        apthelper -o Acquire::https::CaInfo=${TESTDIR}/apt.pem \
+                  -o Debug::Acquire::${PROTO}=1 \
+                  download-file "$1" "$2" 2>&1
        # only if the file exists the download was successful
        if [ -e "$2" ]; then
                return 0