]> git.saurik.com Git - apt.git/blobdiff - test/integration/framework
apt-ftparchive: Support NotAutomatic and ButAutomaticUpgrades fields
[apt.git] / test / integration / framework
index 067cc6e8ad573eb9e8b59b7fca7cca3855818432..9a114ae69210118ce9613804d1469a34edaecfa9 100644 (file)
@@ -190,7 +190,7 @@ aptmark() { runapt apt-mark "$@"; }
 aptsortpkgs() { runapt apt-sortpkgs "$@"; }
 apt() { runapt apt "$@"; }
 apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; }
 aptsortpkgs() { runapt apt-sortpkgs "$@"; }
 apt() { runapt apt "$@"; }
 apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; }
-aptwebserver() { runapt "${APTWEBSERVERBINDIR}/aptwebserver" "$@"; }
+aptwebserver() { runapt "${APTTESTHELPERSBINDIR}/aptwebserver" "$@"; }
 aptitude() { runapt aptitude "$@"; }
 aptextracttemplates() { runapt apt-extracttemplates "$@"; }
 aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; }
 aptitude() { runapt aptitude "$@"; }
 aptextracttemplates() { runapt apt-extracttemplates "$@"; }
 aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; }
@@ -331,7 +331,7 @@ setupenvironment() {
        LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}/../apt-pkg"}"
         METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/../methods"}"
         APTHELPERBINDIR="${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"}"
        LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}/../apt-pkg"}"
         METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/../methods"}"
         APTHELPERBINDIR="${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"}"
-        APTWEBSERVERBINDIR="${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}/../test/interactive-helper"}"
+        APTTESTHELPERSBINDIR="${APT_INTEGRATION_TESTS_HELPERS_BIN_DIR:-"${BUILDDIRECTORY}/../test/interactive-helper"}"
         APTFTPARCHIVEBINDIR="${APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR:-"${BUILDDIRECTORY}/../ftparchive"}"
         APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${BUILDDIRECTORY}/solvers/apt"}"
        APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${BUILDDIRECTORY}/solvers/dump"}"
         APTFTPARCHIVEBINDIR="${APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR:-"${BUILDDIRECTORY}/../ftparchive"}"
         APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${BUILDDIRECTORY}/solvers/apt"}"
        APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${BUILDDIRECTORY}/solvers/dump"}"
@@ -525,18 +525,20 @@ configdpkg() {
                local STATUSFILE="status-${BASENAME#*-}"
                if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then
                        cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status
                local STATUSFILE="status-${BASENAME#*-}"
                if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then
                        cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status
+                       # Add an empty line to the end if there is none
+                       if tail -1 rootdir/var/lib/dpkg/status | grep -q .; then
+                               echo >> rootdir/var/lib/dpkg/status
+                       fi
                else
                        echo -n > rootdir/var/lib/dpkg/status
                fi
        fi
        rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg
                else
                        echo -n > rootdir/var/lib/dpkg/status
                fi
        fi
        rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg
-       # if multi-arch make sure dpkg can detect itself as capable of it
-       if getarchitectures | grep -E -q '[^ ]+ [^ ]+'; then
-               if [ "0" = "$(dpkg -l dpkg 2> /dev/null | grep '^i' | wc -l)" ]; then
-                       # dpkg doesn't really check the version as long as it is fully installed,
-                       # but just to be sure we choose one above the required version
-                       insertinstalledpackage 'dpkg' "all" '1.16.2+fake'
-               fi
+       # make sure dpkg can detect itself as capable of it
+       if [ "0" = "$(dpkg -l dpkg 2> /dev/null | grep '^i' | wc -l)" ]; then
+               # dpkg doesn't really check the version as long as it is fully installed,
+               # but just to be sure we choose one above the required version
+               insertinstalledpackage 'dpkg' "all" '1.16.2+fake'
        fi
        if dpkg --assert-multi-arch >/dev/null 2>&1 ; then
                local ARCHS="$(getarchitectures)"
        fi
        if dpkg --assert-multi-arch >/dev/null 2>&1 ; then
                local ARCHS="$(getarchitectures)"
@@ -1051,6 +1053,12 @@ getreleaseversionfromsuite() { true; }
 getlabelfromsuite() { true; }
 getoriginfromsuite() { true; }
 getarchitecturesfromreleasefile() { echo "all $(getarchitectures)"; }
 getlabelfromsuite() { true; }
 getoriginfromsuite() { true; }
 getarchitecturesfromreleasefile() { echo "all $(getarchitectures)"; }
+getnotautomaticfromsuite() {
+       case "$1" in
+       experimental|experimental2) echo "yes";;
+       esac
+}
+getbutautomaticupgradesfromsuite() { true; }
 
 aptftparchiverelease() {
        aptftparchive -qq release "$@" | sed -e '/0 Release$/ d' # remove the self reference
 
 aptftparchiverelease() {
        aptftparchive -qq release "$@" | sed -e '/0 Release$/ d' # remove the self reference
@@ -1069,6 +1077,8 @@ generatereleasefiles() {
                        local VERSION="$(getreleaseversionfromsuite $SUITE)"
                        local LABEL="$(getlabelfromsuite $SUITE)"
                        local ORIGIN="$(getoriginfromsuite $SUITE)"
                        local VERSION="$(getreleaseversionfromsuite $SUITE)"
                        local LABEL="$(getlabelfromsuite $SUITE)"
                        local ORIGIN="$(getoriginfromsuite $SUITE)"
+                       local NOTAUTOMATIC="$(getnotautomaticfromsuite $SUITE)"
+                       local BUTAUTOMATICUPGRADES="$(getbutautomaticupgradesfromsuite $SUITE)"
                        aptftparchiverelease "$dir" \
                                -o APT::FTPArchive::Release::Suite="${SUITE}" \
                                -o APT::FTPArchive::Release::Codename="${CODENAME}" \
                        aptftparchiverelease "$dir" \
                                -o APT::FTPArchive::Release::Suite="${SUITE}" \
                                -o APT::FTPArchive::Release::Codename="${CODENAME}" \
@@ -1076,11 +1086,9 @@ generatereleasefiles() {
                                -o APT::FTPArchive::Release::Label="${LABEL}" \
                                -o APT::FTPArchive::Release::Origin="${ORIGIN}" \
                                -o APT::FTPArchive::Release::Version="${VERSION}" \
                                -o APT::FTPArchive::Release::Label="${LABEL}" \
                                -o APT::FTPArchive::Release::Origin="${ORIGIN}" \
                                -o APT::FTPArchive::Release::Version="${VERSION}" \
+                               -o APT::FTPArchive::Release::NotAutomatic="${NOTAUTOMATIC}" \
+                               -o APT::FTPArchive::Release::ButAutomaticUpgrades="${BUTAUTOMATICUPGRADES}" \
                                > "$dir/Release"
                                > "$dir/Release"
-                       if [ "$SUITE" = "experimental" -o "$SUITE" = "experimental2" ]; then
-                               sed -i '/^Date: / a\
-NotAutomatic: yes' "$dir/Release"
-                       fi
                done
        else
                msgninfo "\tGenerate Release files for flat… "
                done
        else
                msgninfo "\tGenerate Release files for flat… "
@@ -1294,7 +1302,7 @@ changetowebserver() {
        else
                shift
        fi
        else
                shift
        fi
-       if test -x "${APTWEBSERVERBINDIR}/aptwebserver"; then
+       if test -x "${APTTESTHELPERSBINDIR}/aptwebserver"; then
                cd aptarchive
                local LOG="webserver.log"
                if ! aptwebserver --port 0 -o aptwebserver::fork=1 -o aptwebserver::portfile='aptwebserver.port' "$@" >$LOG 2>&1 ; then
                cd aptarchive
                local LOG="webserver.log"
                if ! aptwebserver --port 0 -o aptwebserver::fork=1 -o aptwebserver::portfile='aptwebserver.port' "$@" >$LOG 2>&1 ; then
@@ -1392,7 +1400,20 @@ downloadfile() {
 }
 
 checkdiff() {
 }
 
 checkdiff() {
-       local DIFFTEXT="$(command diff -u "$@" 2>&1 | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')"
+       local TMPFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.1.tmp"
+       local TMPFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.2.tmp"
+       touch "$TMPFILE1" "$TMPFILE2"
+       if [ "$1" != '-' ]; then
+               sed -e '/^profiling:/ d' < "$1" >"$TMPFILE1"
+       else
+               TMPFILE1='-'
+       fi
+       if [ "$2" != '-' ]; then
+               sed -e '/^profiling:/ d' < "$2" >"$TMPFILE2"
+       else
+               TMPFILE2='-'
+       fi
+       local DIFFTEXT="$(command diff -u "$TMPFILE1" "$TMPFILE2" 2>&1 | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')"
        if [ -n "$DIFFTEXT" ]; then
                echo >&2
                echo >&2 "$DIFFTEXT"
        if [ -n "$DIFFTEXT" ]; then
                echo >&2
                echo >&2 "$DIFFTEXT"