Просмотр исходного кода

add two tests for architecture specifications

David Kalnischkies лет назад: 14
Родитель
Сommit
01f520ce27

+ 9 - 4
test/integration/framework

@@ -304,23 +304,28 @@ echo '$NAME says \"Hello!\"'" > ${BUILDDIR}/${NAME}
 Section: $SECTION
 Section: $SECTION
 Priority: $PRIORITY
 Priority: $PRIORITY
 Maintainer: Joe Sixpack <joe@example.org>
 Maintainer: Joe Sixpack <joe@example.org>
-Standards-Version: 3.9.1
+Standards-Version: 3.9.3" > ${BUILDDIR}/debian/control
+	local BUILDDEPS="$(echo "$DEPENDENCIES" | grep '^Build-')"
+	test -z "$BUILDDEPS" || echo "$BUILDDEPS" >> ${BUILDDIR}/debian/control
+	echo "
+Package: $NAME" >> ${BUILDDIR}/debian/control
 
 
-Package: $NAME" > ${BUILDDIR}/debian/control
 	if [ "$ARCH" = 'all' ]; then
 	if [ "$ARCH" = 'all' ]; then
 		echo "Architecture: all" >> ${BUILDDIR}/debian/control
 		echo "Architecture: all" >> ${BUILDDIR}/debian/control
 	else
 	else
 		echo "Architecture: any" >> ${BUILDDIR}/debian/control
 		echo "Architecture: any" >> ${BUILDDIR}/debian/control
 	fi
 	fi
-	test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> ${BUILDDIR}/debian/control
+	local DEPS="$(echo "$DEPENDENCIES" | grep -v '^Build-')"
+	test -z "$DEPS" || echo "$DEPS" >> ${BUILDDIR}/debian/control
 	if [ -z "$DESCRIPTION" ]; then
 	if [ -z "$DESCRIPTION" ]; then
 		echo "Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
 		echo "Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
  If you find such a package installed on your system,
  If you find such a package installed on your system,
  YOU did something horribly wrong! They are autogenerated
  YOU did something horribly wrong! They are autogenerated
  und used only by testcases for APT and surf no other propose…" >> ${BUILDDIR}/debian/control
  und used only by testcases for APT and surf no other propose…" >> ${BUILDDIR}/debian/control
 	else
 	else
-		echo "Description: $DESCRIPTION" >> ${BUILDIR}/debian/control
+		echo "Description: $DESCRIPTION" >> ${BUILDDIR}/debian/control
 	fi
 	fi
+
 	echo '3.0 (native)' > ${BUILDDIR}/debian/source/format
 	echo '3.0 (native)' > ${BUILDDIR}/debian/source/format
 	local SRCS="$( (cd ${BUILDDIR}/..; dpkg-source -b ${NAME}-${VERSION} 2>&1) | grep '^dpkg-source: info: building' | grep -o '[a-z0-9._+~-]*$')"
 	local SRCS="$( (cd ${BUILDDIR}/..; dpkg-source -b ${NAME}-${VERSION} 2>&1) | grep '^dpkg-source: info: building' | grep -o '[a-z0-9._+~-]*$')"
 	for SRC in $SRCS; do
 	for SRC in $SRCS; do

+ 96 - 0
test/integration/test-architecture-specification-parsing

@@ -0,0 +1,96 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64'
+
+buildsimplenativepackage 'pkg-arch-foo' 'amd64' '1.0' 'stable' 'Build-Depends: foo [amd64 !amd64]
+Depends: foo [amd64 !amd64]'
+buildsimplenativepackage 'pkg-arch-no-foo' 'amd64' '1.0' 'stable' 'Build-Depends: foo [!amd64 amd64]
+Depends: foo [!amd64 amd64]'
+buildsimplenativepackage 'pkg-arch-foo-unrelated-no' 'amd64' '1.0' 'stable' 'Build-Depends: foo [!kfreebsd-any amd64]
+Depends: foo [!kfreebsd-any amd64]'
+buildsimplenativepackage 'pkg-arch-foo-unrelated-no2' 'amd64' '1.0' 'stable' 'Build-Depends: foo [amd64 !kfreebsd-any]
+Depends: foo [amd64 !kfreebsd-any]'
+
+buildsimplenativepackage 'foo' 'amd64' '1.0' 'stable'
+
+insertinstalledpackage 'build-essential' 'all' '11.5' 'Multi-Arch: foreign'
+
+setupaptarchive
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+  foo
+The following NEW packages will be installed:
+  foo pkg-arch-foo
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst foo (1.0 stable [amd64])
+Inst pkg-arch-foo (1.0 stable [amd64])
+Conf foo (1.0 stable [amd64])
+Conf pkg-arch-foo (1.0 stable [amd64])' aptget install pkg-arch-foo -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  pkg-arch-no-foo
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst pkg-arch-no-foo (1.0 stable [amd64])
+Conf pkg-arch-no-foo (1.0 stable [amd64])' aptget install pkg-arch-no-foo -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+  foo
+The following NEW packages will be installed:
+  foo pkg-arch-foo-unrelated-no
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst foo (1.0 stable [amd64])
+Inst pkg-arch-foo-unrelated-no (1.0 stable [amd64])
+Conf foo (1.0 stable [amd64])
+Conf pkg-arch-foo-unrelated-no (1.0 stable [amd64])' aptget install pkg-arch-foo-unrelated-no -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+  foo
+The following NEW packages will be installed:
+  foo pkg-arch-foo-unrelated-no2
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst foo (1.0 stable [amd64])
+Inst pkg-arch-foo-unrelated-no2 (1.0 stable [amd64])
+Conf foo (1.0 stable [amd64])
+Conf pkg-arch-foo-unrelated-no2 (1.0 stable [amd64])' aptget install pkg-arch-foo-unrelated-no2 -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  foo
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst foo (1.0 stable [amd64])
+Conf foo (1.0 stable [amd64])' aptget build-dep pkg-arch-foo -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget build-dep pkg-arch-no-foo -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  foo
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst foo (1.0 stable [amd64])
+Conf foo (1.0 stable [amd64])' aptget build-dep pkg-arch-foo-unrelated-no -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  foo
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst foo (1.0 stable [amd64])
+Conf foo (1.0 stable [amd64])' aptget build-dep pkg-arch-foo-unrelated-no2 -s
+
+

+ 87 - 0
test/integration/test-cachecontainer-architecture-specification

@@ -0,0 +1,87 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64' 'armel'
+
+#insertinstalledpackage 'xserver-xorg-core' 'amd64' '2:1.7.6-2ubuntu7.10'
+insertpackage 'unstable' 'libsame' 'armel,amd64' '1' 'Multi-Arch: same'
+
+setupaptarchive
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  libsame
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst libsame (1 unstable [amd64])
+Conf libsame (1 unstable [amd64])' aptget -s install libsame
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  libsame:armel
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst libsame:armel (1 unstable [armel])
+Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:armel
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  libsame
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst libsame (1 unstable [amd64])
+Conf libsame (1 unstable [amd64])' aptget -s install libsame:amd64
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  libsame libsame:armel
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst libsame (1 unstable [amd64])
+Inst libsame:armel (1 unstable [armel])
+Conf libsame (1 unstable [amd64])
+Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:armel libsame:amd64
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  libsame libsame:armel
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst libsame (1 unstable [amd64])
+Inst libsame:armel (1 unstable [armel])
+Conf libsame (1 unstable [amd64])
+Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:*
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  libsame
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst libsame (1 unstable [amd64])
+Conf libsame (1 unstable [amd64])' aptget -s install libsame:any
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  libsame libsame:armel
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst libsame (1 unstable [amd64])
+Inst libsame:armel (1 unstable [armel])
+Conf libsame (1 unstable [amd64])
+Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:a*
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  libsame
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst libsame (1 unstable [amd64])
+Conf libsame (1 unstable [amd64])' aptget -s install libsame:linux-any
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  libsame libsame:armel
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst libsame (1 unstable [amd64])
+Inst libsame:armel (1 unstable [armel])
+Conf libsame (1 unstable [amd64])
+Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:linux-*
+testequal 'Reading package lists...
+Building dependency tree...
+E: Unable to locate package libsame' aptget -s install libsame:windows-any

+ 5 - 5
test/libapt/parsedepends_test.cc

@@ -10,7 +10,7 @@ int main(int argc,char *argv[]) {
 	unsigned int Null = 0;
 	unsigned int Null = 0;
 	bool StripMultiArch = true;
 	bool StripMultiArch = true;
 	bool ParseArchFlags = false;
 	bool ParseArchFlags = false;
-	_config->Set("APT::Architecture","dsk");
+	_config->Set("APT::Architecture","amd64");
 
 
 	const char* Depends =
 	const char* Depends =
 		"debhelper:any (>= 5.0), "
 		"debhelper:any (>= 5.0), "
@@ -19,13 +19,13 @@ int main(int argc,char *argv[]) {
 		"libcurl4-gnutls-dev:native | libcurl3-gnutls-dev (>> 7.15.5), "
 		"libcurl4-gnutls-dev:native | libcurl3-gnutls-dev (>> 7.15.5), "
 		"debiandoc-sgml, "
 		"debiandoc-sgml, "
 		"apt (>= 0.7.25), "
 		"apt (>= 0.7.25), "
-		"not-for-me [ !dsk ], "
-		"only-for-me [ dsk ], "
+		"not-for-me [ !amd64 ], "
+		"only-for-me [ amd64 ], "
 		"any-for-me [ any ], "
 		"any-for-me [ any ], "
 		"not-for-darwin [ !darwin-any ], "
 		"not-for-darwin [ !darwin-any ], "
-		"cpu-for-me [ any-dsk ], "
+		"cpu-for-me [ any-amd64 ], "
 		"os-for-me [ linux-any ], "
 		"os-for-me [ linux-any ], "
-		"cpu-not-for-me [ any-amd64 ], "
+		"cpu-not-for-me [ any-armel ], "
 		"os-not-for-me [ kfreebsd-any ], "
 		"os-not-for-me [ kfreebsd-any ], "
 		"overlord-dev:any (= 7.15.3~) | overlord-dev:native (>> 7.15.5), "
 		"overlord-dev:any (= 7.15.3~) | overlord-dev:native (>> 7.15.5), "
 	;
 	;