}
configarchitecture() {
- local CONFFILE=rootdir/etc/apt/apt.conf.d/01multiarch.conf
- rm -f $CONFFILE
- echo "APT::Architecture \"$(getarchitecture $1)\";" > $CONFFILE
- shift
- while [ -n "$1" ]; do
- echo "APT::Architectures:: \"$(getarchitecture $1)\";" >> $CONFFILE
- shift
- done
+ {
+ echo "APT::Architecture \"$(getarchitecture $1)\";"
+ while [ -n "$1" ]; do
+ echo "APT::Architectures:: \"$(getarchitecture $1)\";"
+ shift
+ done
+ } >rootdir/etc/apt/apt.conf.d/01multiarch.conf
configdpkg
}
echo -n > rootdir/var/lib/dpkg/status
fi
fi
+ rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg
if $(which dpkg) --assert-multi-arch >/dev/null 2>&1; then
local ARCHS="$(getarchitectures)"
if echo "$ARCHS" | grep -E -q '[^ ]+ [^ ]+'; then
DPKGARCH="$(dpkg --print-architecture)"
for ARCH in ${ARCHS}; do
if [ "${ARCH}" != "${DPKGARCH}" ]; then
- if ! dpkg --add-architecture ${ARCH}; then
+ if ! dpkg --add-architecture ${ARCH} >/dev/null 2>&1; then
# old-style used e.g. in Ubuntu-P – and as it seems travis
- echo "DPKG::options:: \"--foreign-architecture\";" >> aptconfig.conf
- echo "DPKG::options:: \"${ARCH}\";" >> aptconfig.conf
+ echo "DPKG::options:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
+ echo "DPKG::options:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg
fi
fi
done
local VERSION="$3"
local RELEASE="${4:-unstable}"
local DEPENDENCIES="$5"
- local DESCRIPTION="$6"
+ local DESCRIPTION="${6:-"Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
+ If you find such a package installed on your system,
+ something went horribly wrong! They are autogenerated
+ und used only by testcases and surf no other propose…"}"
+
local SECTION="${7:-others}"
local DISTSECTION
if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
echo "Architecture: any" >> debian/control
fi
test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> debian/control
- if [ -z "$DESCRIPTION" ]; then
- echo "Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
- If you find such a package installed on your system,
- YOU did something horribly wrong! They are autogenerated
- und used only by testcases for APT and surf no other propose…" >> debian/control
- else
- echo "Description: $DESCRIPTION" >> debian/control
- fi
+ echo "Description: $DESCRIPTION" >> debian/control
+
test -e debian/compat || echo "7" > debian/compat
test -e debian/source/format || echo "3.0 (native)" > debian/source/format
test -e debian/rules || cp /usr/share/doc/debhelper/examples/rules.tiny debian/rules
local VERSION="$3"
local RELEASE="${4:-unstable}"
local DEPENDENCIES="$5"
- local DESCRIPTION="$6"
+ local DESCRIPTION="${6:-"Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
+ If you find such a package installed on your system,
+ something went horribly wrong! They are autogenerated
+ und used only by testcases and surf no other propose…"}"
+
local SECTION="${7:-others}"
local PRIORITY="${8:-optional}"
local DISTSECTION
fi
local DEPS="$(echo "$DEPENDENCIES" | grep -v '^Build-')"
test -z "$DEPS" || echo "$DEPS" >> ${BUILDDIR}/debian/control
- if [ -z "$DESCRIPTION" ]; then
- echo "Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
- If you find such a package installed on your system,
- YOU did something horribly wrong! They are autogenerated
- und used only by testcases for APT and surf no other propose…" >> ${BUILDDIR}/debian/control
- else
- echo "Description: $DESCRIPTION" >> ${BUILDDIR}/debian/control
- fi
+ echo "Description: $DESCRIPTION" >> ${BUILDDIR}/debian/control
echo '3.0 (native)' > ${BUILDDIR}/debian/source/format
(cd ${BUILDDIR}/..; dpkg-source -b ${NAME}-${VERSION} 2>&1) | sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' \
local VERSION="$4"
local DEPENDENCIES="$5"
local PRIORITY="${6:-optional}"
- local DESCRIPTION="${7}"
+ local DESCRIPTION="${7:-"Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
+ If you find such a package installed on your system,
+ something went horribly wrong! They are autogenerated
+ und used only by testcases and surf no other propose…"}"
local ARCHS=""
for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do
if [ "$arch" = 'all' -o "$arch" = 'none' ]; then
echo "Version: $VERSION
Filename: pool/main/${NAME}/${NAME}_${VERSION}_${arch}.deb" >> $FILE
test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
- echo -n 'Description: ' >> $FILE
- if [ -z "$DESCRIPTION" ]; then
- echo "an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
- If you find such a package installed on your system,
- YOU did something horribly wrong! They are autogenerated
- und used only by testcases for APT and surf no other propose…" >> $FILE
- else
- echo "$DESCRIPTION" >> $FILE
- fi
+ echo "Description: $DESCRIPTION" >> $FILE
echo >> $FILE
done
done
local DEPENDENCIES="$4"
local PRIORITY="${5:-optional}"
local STATUS="${6:-install ok installed}"
+ local DESCRIPTION="${7:-"Description: an autogenerated dummy ${NAME}=${VERSION}/installed
+ If you find such a package installed on your system,
+ something went horribly wrong! They are autogenerated
+ und used only by testcases and surf no other propose…"}"
+
local FILE='rootdir/var/lib/dpkg/status'
local INFO='rootdir/var/lib/dpkg/info'
for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do
Version: $VERSION" >> $FILE
test "$arch" = 'none' || echo "Architecture: $arch" >> $FILE
test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE
- echo "Description: an autogenerated dummy ${NAME}=${VERSION}/installed
- If you find such a package installed on your system,
- YOU did something horribly wrong! They are autogenerated
- und used only by testcases for APT and surf no other propose…
-" >> $FILE
+ echo "Description: $DESCRIPTION" >> $FILE
+ echo >> $FILE
if [ "$(dpkg-query -W --showformat='${Multi-Arch}')" = 'same' ]; then
echo -n > ${INFO}/${NAME}:${arch}.list
else
echo "$2" > $COMPAREFILE2
shift 2
msgtest "Test for equality OR of" "$*"
- $* >$COMPAREAGAINST 2>&1
+ $* >$COMPAREAGAINST 2>&1 || true
(checkdiff $COMPAREFILE1 $COMPAREAGAINST 1> /dev/null ||
checkdiff $COMPAREFILE2 $COMPAREAGAINST 1> /dev/null) && msgpass ||
( echo "\n${CINFO}Diff against OR 1${CNORMAL}" "$(checkdiff $COMPAREFILE1 $COMPAREAGAINST)" \
--- /dev/null
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'i386' 'amd64'
+
+# we need a valid locale here, otherwise the language configuration
+# will be overridden by LC_ALL=C
+LOCALE="$(echo "$LANG" | cut -d'_' -f 1)"
+MD5Sum='Description-md5: d41ee493aa9fcc6cbc9ce4eb7069959c'
+
+PACKAGESTANZA='Package: apt
+Priority: important
+Section: admin
+Installed-Size: 5984
+Maintainer: APT Development Team <deity@lists.debian.org>
+Architecture: i386
+Version: 0.8.7
+Filename: pool/main/a/apt/apt_0.8.7_i386.deb
+Size: 2140230
+MD5sum: 74769bfbcef9ebc4fa74f7a5271b9c08'
+
+PACKAGESTANZA2='Package: apt
+Priority: important
+Section: admin
+Installed-Size: 5984
+Maintainer: APT Development Team <deity@lists.debian.org>
+Architecture: amd64
+Version: 0.8.7
+Filename: pool/main/a/apt/apt_0.8.7_amd64.deb
+Size: 2210342
+MD5sum: 4a869bfbdef9ebc9fa74f7a5271e8d1a'
+
+echo "$PACKAGESTANZA
+Description: Advanced front-end for dpkg
+$MD5Sum
+
+$PACKAGESTANZA2
+Description: Advanced front-end for dpkg
+$MD5Sum" > aptarchive/Packages
+
+echo "Package: apt
+Description-${LOCALE}: Mächtige Oberfläche für dpkg
+ Das Paket bietet dem Nutzer technisch führende Methoden für den Zugriff
+ auf den dpkg-Paketmanager. Es beinhaltet das apt-get-Werkzeug und die
+ APT-Dselect-Methode. Beides sind einfache und sicherere Wege,
+ um Pakete zu installieren und Upgrades durchzuführen.
+$MD5Sum" | bzip2 > aptarchive/${LOCALE}.bz2
+
+# the $LOCALE translation file will not be included as it is a flat archive it came from and therefore
+# its name can not be guessed correctly… (in non-flat archives the files are called Translation-*)
+echo 'APT::Cache::Generate "false";' > rootdir/etc/apt/apt.conf.d/00nogenerate
+
+NOLONGSTANZA="$PACKAGESTANZA
+Description: Advanced front-end for dpkg
+$MD5Sum
+"
+
+ENGLISHSTANZA="$PACKAGESTANZA
+Description: Advanced front-end for dpkg
+$MD5Sum
+"
+
+LOCALESTANZA="$PACKAGESTANZA
+Description-${LOCALE}: Mächtige Oberfläche für dpkg
+ Das Paket bietet dem Nutzer technisch führende Methoden für den Zugriff
+ auf den dpkg-Paketmanager. Es beinhaltet das apt-get-Werkzeug und die
+ APT-Dselect-Methode. Beides sind einfache und sicherere Wege,
+ um Pakete zu installieren und Upgrades durchzuführen.
+$MD5Sum
+"
+LOCALESTANZA2="$PACKAGESTANZA2
+Description-${LOCALE}: Mächtige Oberfläche für dpkg
+ Das Paket bietet dem Nutzer technisch führende Methoden für den Zugriff
+ auf den dpkg-Paketmanager. Es beinhaltet das apt-get-Werkzeug und die
+ APT-Dselect-Methode. Beides sind einfache und sicherere Wege,
+ um Pakete zu installieren und Upgrades durchzuführen.
+$MD5Sum
+"
+
+testrun() {
+ echo "Acquire::Languages { \"${LOCALE}\"; \"en\"; };" > rootdir/etc/apt/apt.conf.d/00languages
+ export LC_ALL=""
+ rm -rf rootdir/var/lib/apt/lists
+ setupaptarchive
+ testequal "$LOCALESTANZA" aptcache show apt -o Test=File-${LOCALE}
+ testequal "$LOCALESTANZA" aptcache show apt:i386 -o Test=File-${LOCALE}
+ testequal "$LOCALESTANZA2" aptcache show apt:amd64 -o Test=File-${LOCALE}
+ testequal "$NOLONGSTANZA" aptcache show apt -o Acquire::Languages="ww" -o Test=File-${LOCALE}
+ testequal "$LOCALESTANZA" aptcache show apt -o Acquire::Languages::="ww" -o Test=File-${LOCALE}
+ LC_ALL=C testequal "$ENGLISHSTANZA" aptcache show apt -o Test=File-${LOCALE}
+ export LC_ALL=""
+ echo "Acquire::Languages { \"ww\"; \"${LOCALE}\"; \"en\"; };" > rootdir/etc/apt/apt.conf.d/00languages
+ testequal "$LOCALESTANZA" aptcache show apt -o Test=File-ww-${LOCALE}
+ echo "Acquire::Languages { \"ww\"; \"en\"; };" > rootdir/etc/apt/apt.conf.d/00languages
+ testequal "$ENGLISHSTANZA" aptcache show apt -o Test=File-ww
+}
+
+testrun
+
+echo "$PACKAGESTANZA
+Description: Advanced front-end for dpkg
+$MD5Sum
+
+$PACKAGESTANZA2
+Description: Advanced front-end for dpkg
+$MD5Sum" > aptarchive/Packages
+
+echo "Package: apt
+Description-en: Advanced front-end for dpkg
+ This is Debian's next generation front-end for the dpkg package manager.
+ It provides the apt-get utility and APT dselect method that provides a
+ simpler, safer way to install and upgrade packages.
+$MD5Sum" | bzip2 > aptarchive/en.bz2
+
+ENGLISHSTANZA="$PACKAGESTANZA
+Description-en: Advanced front-end for dpkg
+ This is Debian's next generation front-end for the dpkg package manager.
+ It provides the apt-get utility and APT dselect method that provides a
+ simpler, safer way to install and upgrade packages.
+$MD5Sum
+"
+ENGLISHSTANZA2="$PACKAGESTANZA2
+Description-en: Advanced front-end for dpkg
+ This is Debian's next generation front-end for the dpkg package manager.
+ It provides the apt-get utility and APT dselect method that provides a
+ simpler, safer way to install and upgrade packages.
+$MD5Sum
+"
+
+testrun
+++ /dev/null
-#!/bin/sh
-set -e
-
-TESTDIR=$(readlink -f $(dirname $0))
-. $TESTDIR/framework
-setupenvironment
-configarchitecture 'i386' 'amd64'
-
-# we need a valid locale here, otherwise the language configuration
-# will be overridden by LC_ALL=C
-LOCALE="$(echo "$LANG" | cut -d'_' -f 1)"
-MD5Sum='Description-md5: d41ee493aa9fcc6cbc9ce4eb7069959c'
-
-PACKAGESTANZA='Package: apt
-Priority: important
-Section: admin
-Installed-Size: 5984
-Maintainer: APT Development Team <deity@lists.debian.org>
-Architecture: i386
-Version: 0.8.7
-Filename: pool/main/a/apt/apt_0.8.7_i386.deb
-Size: 2140230
-MD5sum: 74769bfbcef9ebc4fa74f7a5271b9c08'
-
-PACKAGESTANZA2='Package: apt
-Priority: important
-Section: admin
-Installed-Size: 5984
-Maintainer: APT Development Team <deity@lists.debian.org>
-Architecture: amd64
-Version: 0.8.7
-Filename: pool/main/a/apt/apt_0.8.7_amd64.deb
-Size: 2210342
-MD5sum: 4a869bfbdef9ebc9fa74f7a5271e8d1a'
-
-echo "$PACKAGESTANZA
-Description: Advanced front-end for dpkg
-$MD5Sum
-
-$PACKAGESTANZA2
-Description: Advanced front-end for dpkg
-$MD5Sum" > aptarchive/Packages
-
-echo "Package: apt
-Description-${LOCALE}: Mächtige Oberfläche für dpkg
- Das Paket bietet dem Nutzer technisch führende Methoden für den Zugriff
- auf den dpkg-Paketmanager. Es beinhaltet das apt-get-Werkzeug und die
- APT-Dselect-Methode. Beides sind einfache und sicherere Wege,
- um Pakete zu installieren und Upgrades durchzuführen.
-$MD5Sum" | bzip2 > aptarchive/${LOCALE}.bz2
-
-# the $LOCALE translation file will not be included as it is a flat archive it came from and therefore
-# its name can not be guessed correctly… (in non-flat archives the files are called Translation-*)
-echo 'APT::Cache::Generate "false";' > rootdir/etc/apt/apt.conf.d/00nogenerate
-
-NOLONGSTANZA="$PACKAGESTANZA
-Description: Advanced front-end for dpkg
-$MD5Sum
-"
-
-ENGLISHSTANZA="$PACKAGESTANZA
-Description: Advanced front-end for dpkg
-$MD5Sum
-"
-
-LOCALESTANZA="$PACKAGESTANZA
-Description-${LOCALE}: Mächtige Oberfläche für dpkg
- Das Paket bietet dem Nutzer technisch führende Methoden für den Zugriff
- auf den dpkg-Paketmanager. Es beinhaltet das apt-get-Werkzeug und die
- APT-Dselect-Methode. Beides sind einfache und sicherere Wege,
- um Pakete zu installieren und Upgrades durchzuführen.
-$MD5Sum
-"
-LOCALESTANZA2="$PACKAGESTANZA2
-Description-${LOCALE}: Mächtige Oberfläche für dpkg
- Das Paket bietet dem Nutzer technisch führende Methoden für den Zugriff
- auf den dpkg-Paketmanager. Es beinhaltet das apt-get-Werkzeug und die
- APT-Dselect-Methode. Beides sind einfache und sicherere Wege,
- um Pakete zu installieren und Upgrades durchzuführen.
-$MD5Sum
-"
-
-testrun() {
- echo "Acquire::Languages { \"${LOCALE}\"; \"en\"; };" > rootdir/etc/apt/apt.conf.d/00languages
- export LC_ALL=""
- rm -rf rootdir/var/lib/apt/lists
- setupaptarchive
- testequal "$LOCALESTANZA" aptcache show apt -o Test=File-${LOCALE}
- testequal "$LOCALESTANZA" aptcache show apt:i386 -o Test=File-${LOCALE}
- testequal "$LOCALESTANZA2" aptcache show apt:amd64 -o Test=File-${LOCALE}
- testequal "$NOLONGSTANZA" aptcache show apt -o Acquire::Languages="ww" -o Test=File-${LOCALE}
- testequal "$LOCALESTANZA" aptcache show apt -o Acquire::Languages::="ww" -o Test=File-${LOCALE}
- LC_ALL=C testequal "$ENGLISHSTANZA" aptcache show apt -o Test=File-${LOCALE}
- export LC_ALL=""
- echo "Acquire::Languages { \"ww\"; \"${LOCALE}\"; \"en\"; };" > rootdir/etc/apt/apt.conf.d/00languages
- testequal "$LOCALESTANZA" aptcache show apt -o Test=File-ww-${LOCALE}
- echo "Acquire::Languages { \"ww\"; \"en\"; };" > rootdir/etc/apt/apt.conf.d/00languages
- testequal "$ENGLISHSTANZA" aptcache show apt -o Test=File-ww
-}
-
-testrun
-
-echo "$PACKAGESTANZA
-Description: Advanced front-end for dpkg
-$MD5Sum
-
-$PACKAGESTANZA2
-Description: Advanced front-end for dpkg
-$MD5Sum" > aptarchive/Packages
-
-echo "Package: apt
-Description-en: Advanced front-end for dpkg
- This is Debian's next generation front-end for the dpkg package manager.
- It provides the apt-get utility and APT dselect method that provides a
- simpler, safer way to install and upgrade packages.
-$MD5Sum" | bzip2 > aptarchive/en.bz2
-
-ENGLISHSTANZA="$PACKAGESTANZA
-Description-en: Advanced front-end for dpkg
- This is Debian's next generation front-end for the dpkg package manager.
- It provides the apt-get utility and APT dselect method that provides a
- simpler, safer way to install and upgrade packages.
-$MD5Sum
-"
-ENGLISHSTANZA2="$PACKAGESTANZA2
-Description-en: Advanced front-end for dpkg
- This is Debian's next generation front-end for the dpkg package manager.
- It provides the apt-get utility and APT dselect method that provides a
- simpler, safer way to install and upgrade packages.
-$MD5Sum
-"
-
-testrun
insertpackage 'unstable' 'cool' 'amd64' '1.0'
-setupaptarchive 2> /dev/null
+setupaptarchive --no-update
echo 'NotAutomatic: yes' >> aptarchive/dists/unstable/Release
testsuccess aptget update
testsuccess aptget install pkgall pkgnative pkgforeign -y
-testdpkginstalled pkgall pkgnative pkgforeign
+# if we work with an old dpkg, pkgforeign will be listed differently,
+# so test with aptcache for install status instead
+testdpkginstalled pkgall pkgnative
+testsuccess aptcache show pkgforeign/installed
testequal 'Reading package lists...
Building dependency tree...
insertinstalledpackage 'pkgf' 'none' '1' 'Conflicts: pkgb'
insertinstalledpackage 'pkgg' 'amd64' '1' 'Conflicts: pkgb'
insertinstalledpackage 'pkgb' 'amd64' '2'
-testequal "Reading package lists...
+testequalor2 "Reading package lists...
Building dependency tree...
Reading state information...
You might want to run 'apt-get -f install' to correct these.
Conflicts: pkgb but 2 is installed
pkgg : Conflicts: pkgb but 2 is installed
Conflicts: pkgb:none but 1 is installed
+E: Unmet dependencies. Try using -f." "Reading package lists...
+Building dependency tree...
+Reading state information...
+You might want to run 'apt-get -f install' to correct these.
+The following packages have unmet dependencies:
+ pkgb : Conflicts: pkgb:none but 1 is installed
+ pkgb:none : Conflicts: pkgb but 2 is installed
+ pkgf:none : Conflicts: pkgb but 2 is installed
+ Conflicts: pkgb:none but 1 is installed
+ pkgg : Conflicts: pkgb but 2 is installed
+ Conflicts: pkgb:none but 1 is installed
E: Unmet dependencies. Try using -f." aptget check
# check that dependencies are generated for none-packages