From 56e0a851185136dbdd6f1eaa75f44da774a61e51 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 23 Dec 2021 21:10:53 +0300 Subject: Add support for multiple dependencies in alternative --- .../dependency-alternatives/t8a/foo-1.0.0.tar.gz | Bin 0 -> 373 bytes .../t8a/libbar-1.0.0.tar.gz | Bin 0 -> 350 bytes .../t8a/libbaz-1.0.0.tar.gz | Bin 0 -> 360 bytes .../t8a/repositories.manifest | 1 + tests/pkg-build.testscript | 35 +++++++++++++++ tests/pkg-build/t8a | 1 + tests/pkg-configure.testscript | 49 +++++++++++++++++++-- tests/pkg-configure/t8a | 1 + 8 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 tests/common/dependency-alternatives/t8a/foo-1.0.0.tar.gz create mode 100644 tests/common/dependency-alternatives/t8a/libbar-1.0.0.tar.gz create mode 100644 tests/common/dependency-alternatives/t8a/libbaz-1.0.0.tar.gz create mode 100644 tests/common/dependency-alternatives/t8a/repositories.manifest create mode 120000 tests/pkg-build/t8a create mode 120000 tests/pkg-configure/t8a (limited to 'tests') diff --git a/tests/common/dependency-alternatives/t8a/foo-1.0.0.tar.gz b/tests/common/dependency-alternatives/t8a/foo-1.0.0.tar.gz new file mode 100644 index 0000000..bca3658 Binary files /dev/null and b/tests/common/dependency-alternatives/t8a/foo-1.0.0.tar.gz differ diff --git a/tests/common/dependency-alternatives/t8a/libbar-1.0.0.tar.gz b/tests/common/dependency-alternatives/t8a/libbar-1.0.0.tar.gz new file mode 100644 index 0000000..ce7f270 Binary files /dev/null and b/tests/common/dependency-alternatives/t8a/libbar-1.0.0.tar.gz differ diff --git a/tests/common/dependency-alternatives/t8a/libbaz-1.0.0.tar.gz b/tests/common/dependency-alternatives/t8a/libbaz-1.0.0.tar.gz new file mode 100644 index 0000000..1dd802e Binary files /dev/null and b/tests/common/dependency-alternatives/t8a/libbaz-1.0.0.tar.gz differ diff --git a/tests/common/dependency-alternatives/t8a/repositories.manifest b/tests/common/dependency-alternatives/t8a/repositories.manifest new file mode 100644 index 0000000..5b70556 --- /dev/null +++ b/tests/common/dependency-alternatives/t8a/repositories.manifest @@ -0,0 +1 @@ +: 1 diff --git a/tests/pkg-build.testscript b/tests/pkg-build.testscript index 058a08b..213290d 100644 --- a/tests/pkg-build.testscript +++ b/tests/pkg-build.testscript @@ -136,6 +136,12 @@ # | |-- libbox-1.1.0.tar.gz -> * foo ^1.0.0 # | `-- repositories.manifest # | +# |-- t8a +# | |-- foo-1.0.0.tar.gz -> {libbar libbaz} ^1.0.0 +# | |-- libbar-1.0.0.tar.gz +# | |-- libbaz-1.0.0.tar.gz +# | `-- repositories.manifest +# | # `-- git # |-- libbar.git -> style-basic.git (prerequisite repository) # |-- libbaz.git @@ -164,6 +170,7 @@ posix = ($cxx.target.class != 'windows') cp -r $src/t6 $out/t6 && $rep_create $out/t6 &$out/t6/packages.manifest cp -r $src/t7a $out/t7a && $rep_create $out/t7a &$out/t7a/packages.manifest cp -r $src/t7b $out/t7b && $rep_create $out/t7b &$out/t7b/packages.manifest + cp -r $src/t8a $out/t8a && $rep_create $out/t8a &$out/t8a/packages.manifest # Create git repositories. # @@ -2972,6 +2979,34 @@ test.options += --no-progress -$pkg_drop libbar libbaz libfoo } + + : alternative + : + { + +$clone_root_cfg && $rep_add $rep/t8a && $rep_fetch + + : multiple-dependencies + : + { + $clone_cfg; + + $* foo --yes 2>>~%EOE%; + fetched libbaz/1.0.0 + unpacked libbaz/1.0.0 + fetched libbar/1.0.0 + unpacked libbar/1.0.0 + fetched foo/1.0.0 + unpacked foo/1.0.0 + configured libbaz/1.0.0 + configured libbar/1.0.0 + configured foo/1.0.0 + %info: .+foo-1.0.0.+ is up to date% + updated foo/1.0.0 + EOE + + $pkg_drop foo + } + } } : dependent diff --git a/tests/pkg-build/t8a b/tests/pkg-build/t8a new file mode 120000 index 0000000..8fa2bda --- /dev/null +++ b/tests/pkg-build/t8a @@ -0,0 +1 @@ +../common/dependency-alternatives/t8a/ \ No newline at end of file diff --git a/tests/pkg-configure.testscript b/tests/pkg-configure.testscript index 5a7d8aa..eff0a2e 100644 --- a/tests/pkg-configure.testscript +++ b/tests/pkg-configure.testscript @@ -35,6 +35,9 @@ # | | |-- driver.cxx # | | `-- test.out # | `-- version +# | +# |-- t8a (see pkg-build for details) +# | # `-- stable # |-- libbar-1.0.0.tar.gz -> libfoo # |-- libbar-1.1.0.tar.gz -> libfoo >= 1.1.0 @@ -63,6 +66,8 @@ # cp -r $src/stable $out/stable $rep_create $out/stable &$out/stable/packages.manifest + + cp -r $src/t8a $out/t8a && $rep_create $out/t8a &$out/t8a/packages.manifest end test.arguments += config.cxx=$quote($recall($cxx.path) $cxx.config.mode, true) @@ -280,7 +285,7 @@ if ($posix && "$uid" != '0') $pkg_fetch libbar/1.0.0 && $pkg_unpack libbar; $* libbar 2>>EOE != 0; - error: no configured package satisfies dependency on libfoo + error: unable to satisfy dependency on libfoo EOE $pkg_status libbar/1.0.0 1>'libbar unpacked 1.0.0'; @@ -288,7 +293,7 @@ if ($posix && "$uid" != '0') $pkg_unpack libfoo; $* libbar 2>>EOE != 0; - error: no configured package satisfies dependency on libfoo + error: unable to satisfy dependency on libfoo EOE $* libfoo 2>'configured libfoo/1.0.0'; @@ -317,7 +322,7 @@ if ($posix && "$uid" != '0') $pkg_unpack libbar; $* libbar 2>>EOE != 0; - error: no configured package satisfies dependency on libfoo >= 1.1.0 + error: unable to satisfy dependency on libfoo >= 1.1.0 EOE $pkg_disfigure libfoo 2>'disfigured libfoo/1.0.0'; @@ -344,7 +349,7 @@ if ($posix && "$uid" != '0') $pkg_unpack libbar; $* libbar 2>>EOE != 0; - error: no configured package satisfies dependency on libfox | libfoo >= 1.2.0 + error: unable to satisfy dependency on libfox | libfoo >= 1.2.0 EOE $pkg_disfigure libfoo 2>'disfigured libfoo/1.1.0'; @@ -411,3 +416,39 @@ if ($posix && "$uid" != '0') test -d cfg/libhello != 0 } } + +: dependency-alternatives +: +{ + +$clone_root_cfg && $rep_add $rep/t8a && $rep_fetch --trust-yes + + : multiple-dependencies + : + { + $clone_cfg; + + $pkg_fetch foo/1.0.0 && $pkg_unpack foo; + + $pkg_fetch libbar/1.0.0 && $pkg_unpack libbar; + $* libbar 2>!; + + # Make sure that dependent configuration fails if some of the alternative + # dependencies is not configured. + # + $* foo 2>>EOE != 0; + error: unable to satisfy dependency on {libbar ^1.0.0 libbaz ^1.0.0} + EOE + + $pkg_fetch libbaz/1.0.0 && $pkg_unpack libbaz; + $* libbaz 2>!; + + $* foo 2>'configured foo/1.0.0'; + + $pkg_disfigure foo 2>!; + $pkg_purge foo 2>!; + $pkg_disfigure libbaz 2>!; + $pkg_purge libbaz 2>!; + $pkg_disfigure libbar 2>!; + $pkg_purge libbar 2>! + } +} diff --git a/tests/pkg-configure/t8a b/tests/pkg-configure/t8a new file mode 120000 index 0000000..8fa2bda --- /dev/null +++ b/tests/pkg-configure/t8a @@ -0,0 +1 @@ +../common/dependency-alternatives/t8a/ \ No newline at end of file -- cgit v1.1