From b90cbd6de11442500bbb6e0cdfe0bdcb286d67ec Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 12 Jan 2022 14:28:43 +0300 Subject: Add support for multiple dependency alternatives --- .../dependency-alternatives/t8a/bar-1.0.0.tar.gz | Bin 0 -> 360 bytes .../dependency-alternatives/t8a/baz-1.0.0.tar.gz | Bin 0 -> 357 bytes .../dependency-alternatives/t8a/fix-1.0.0.tar.gz | Bin 0 -> 438 bytes .../t8a/libbaz-1.1.0.tar.gz | Bin 0 -> 360 bytes tests/pkg-build.testscript | 230 ++++++++++++++++++++- 5 files changed, 227 insertions(+), 3 deletions(-) create mode 100644 tests/common/dependency-alternatives/t8a/bar-1.0.0.tar.gz create mode 100644 tests/common/dependency-alternatives/t8a/baz-1.0.0.tar.gz create mode 100644 tests/common/dependency-alternatives/t8a/fix-1.0.0.tar.gz create mode 100644 tests/common/dependency-alternatives/t8a/libbaz-1.1.0.tar.gz (limited to 'tests') diff --git a/tests/common/dependency-alternatives/t8a/bar-1.0.0.tar.gz b/tests/common/dependency-alternatives/t8a/bar-1.0.0.tar.gz new file mode 100644 index 0000000..8fd34e9 Binary files /dev/null and b/tests/common/dependency-alternatives/t8a/bar-1.0.0.tar.gz differ diff --git a/tests/common/dependency-alternatives/t8a/baz-1.0.0.tar.gz b/tests/common/dependency-alternatives/t8a/baz-1.0.0.tar.gz new file mode 100644 index 0000000..733d887 Binary files /dev/null and b/tests/common/dependency-alternatives/t8a/baz-1.0.0.tar.gz differ diff --git a/tests/common/dependency-alternatives/t8a/fix-1.0.0.tar.gz b/tests/common/dependency-alternatives/t8a/fix-1.0.0.tar.gz new file mode 100644 index 0000000..9383845 Binary files /dev/null and b/tests/common/dependency-alternatives/t8a/fix-1.0.0.tar.gz differ diff --git a/tests/common/dependency-alternatives/t8a/libbaz-1.1.0.tar.gz b/tests/common/dependency-alternatives/t8a/libbaz-1.1.0.tar.gz new file mode 100644 index 0000000..2427346 Binary files /dev/null and b/tests/common/dependency-alternatives/t8a/libbaz-1.1.0.tar.gz differ diff --git a/tests/pkg-build.testscript b/tests/pkg-build.testscript index a67eca3..cde8c28 100644 --- a/tests/pkg-build.testscript +++ b/tests/pkg-build.testscript @@ -139,8 +139,10 @@ # |-- t8a # | |-- foo-1.0.0.tar.gz -> {libbar libbaz} ^1.0.0 # | |-- fox-1.0.0.tar.gz -> libbar ^1.0.0 | libbaz ^1.0.0 +# | |-- fix-1.0.0.tar.gz -> libbaz ^1.0.0 | libbar ^1.0.0 # | |-- libbar-1.0.0.tar.gz # | |-- libbaz-1.0.0.tar.gz +# | |-- libbaz-1.1.0.tar.gz # | `-- repositories.manifest # | # `-- git @@ -2992,13 +2994,13 @@ test.options += --no-progress $clone_cfg; $* foo --yes 2>>~%EOE%; - fetched libbaz/1.0.0 - unpacked libbaz/1.0.0 + fetched libbaz/1.1.0 + unpacked libbaz/1.1.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 libbaz/1.1.0 configured libbar/1.0.0 configured foo/1.0.0 %info: .+foo-1.0.0.+ is up to date% @@ -3007,6 +3009,228 @@ test.options += --no-progress $pkg_drop foo } + + : multiple-alternatives + : + { + +$clone_cfg + + : ambiguity + : + { + $clone_cfg; + + $* fox 2>>EOE != 0 + error: unable to select dependency alternative for package fox/1.0.0 + info: explicitly specify dependency packages to manually select the alternative + info: alternative: libbar + info: alternative: libbaz + info: while satisfying fox/1.0.0 + EOE + } + + : reuse + : + { + +$clone_cfg + + : specified-dep-build + : + { + $clone_cfg; + + $* fox ?libbaz 2>>~%EOE%; + fetched libbaz/1.1.0 + unpacked libbaz/1.1.0 + fetched fox/1.0.0 + unpacked fox/1.0.0 + configured libbaz/1.1.0 + configured fox/1.0.0 + %info: .+libbaz-1.1.0.+ is up to date% + %info: .+fox-1.0.0.+ is up to date% + updated libbaz/1.1.0 + updated fox/1.0.0 + EOE + + $pkg_drop fox + } + + : hold-build + : + { + $clone_cfg; + + $* fox libbaz 2>>~%EOE%; + fetched libbaz/1.1.0 + unpacked libbaz/1.1.0 + fetched fox/1.0.0 + unpacked fox/1.0.0 + configured libbaz/1.1.0 + configured fox/1.0.0 + %info: .+libbaz-1.1.0.+ is up to date% + %info: .+fox-1.0.0.+ is up to date% + updated libbaz/1.1.0 + updated fox/1.0.0 + EOE + + $pkg_drop fox; + $pkg_drop libbaz + } + + : configured + : + { + $clone_cfg; + + $* libbaz 2>!; + + $* fox 2>>~%EOE%; + fetched fox/1.0.0 + unpacked fox/1.0.0 + configured fox/1.0.0 + %info: .+fox-1.0.0.+ is up to date% + updated fox/1.0.0 + EOE + + $pkg_drop fox; + $pkg_drop libbaz + } + + : fetched + : + { + $clone_cfg; + + $pkg_fetch libbaz/1.0.0; + + $* fox --yes 2>>~%EOE%; + unpacked libbaz/1.0.0 + fetched fox/1.0.0 + unpacked fox/1.0.0 + configured libbaz/1.0.0 + configured fox/1.0.0 + %info: .+fox-1.0.0.+ is up to date% + updated fox/1.0.0 + EOE + + $pkg_drop fox + } + } + + : postpone + : + { + +$clone_cfg + + : basic + : + { + $clone_cfg; + + $* fox foo --yes 2>>~%EOE%; + fetched libbaz/1.1.0 + unpacked libbaz/1.1.0 + fetched libbar/1.0.0 + unpacked libbar/1.0.0 + fetched fox/1.0.0 + unpacked fox/1.0.0 + fetched foo/1.0.0 + unpacked foo/1.0.0 + configured libbaz/1.1.0 + configured libbar/1.0.0 + configured fox/1.0.0 + configured foo/1.0.0 + %info: .+fox-1.0.0.+ is up to date% + %info: .+foo-1.0.0.+ is up to date% + updated fox/1.0.0 + updated foo/1.0.0 + EOE + + $pkg_drop fox; + $pkg_drop foo + } + + : pick-libbaz + : + { + $clone_cfg; + + $* baz fox bar --yes 2>>~%EOE%; + fetched libbaz/1.1.0 + unpacked libbaz/1.1.0 + fetched baz/1.0.0 + unpacked baz/1.0.0 + fetched libbar/1.0.0 + unpacked libbar/1.0.0 + fetched fox/1.0.0 + unpacked fox/1.0.0 + fetched bar/1.0.0 + unpacked bar/1.0.0 + configured libbaz/1.1.0 + configured baz/1.0.0 + configured libbar/1.0.0 + configured fox/1.0.0 + configured bar/1.0.0 + %info: .+baz-1.0.0.+ is up to date% + %info: .+fox-1.0.0.+ is up to date% + %info: .+bar-1.0.0.+ is up to date% + updated baz/1.0.0 + updated fox/1.0.0 + updated bar/1.0.0 + EOE + + cat cfg/fox-1.0.0/build/config.build >>~%EOO%; + %.* + config.fox.backend = libbar + %.* + EOO + + $pkg_drop fox; + $pkg_drop bar; + $pkg_drop baz + } + } + + : reconfigure-dependent + : + { + $clone_cfg; + + $* fox ?libbaz/1.0.0 2>>~%EOE%; + fetched libbaz/1.0.0 + unpacked libbaz/1.0.0 + fetched fox/1.0.0 + unpacked fox/1.0.0 + configured libbaz/1.0.0 + configured fox/1.0.0 + %info: .+libbaz-1.0.0.+ is up to date% + %info: .+fox-1.0.0.+ is up to date% + updated libbaz/1.0.0 + updated fox/1.0.0 + EOE + + $* ?libbaz --yes 2>>~%EOE%; + disfigured fox/1.0.0 + disfigured libbaz/1.0.0 + fetched libbaz/1.1.0 + unpacked libbaz/1.1.0 + configured libbaz/1.1.0 + configured fox/1.0.0 + %info: .+libbaz-1.1.0.+ is up to date% + %info: .+fox-1.0.0.+ is up to date% + updated libbaz/1.1.0 + updated fox/1.0.0 + EOE + + cat cfg/fox-1.0.0/build/config.build >>~%EOO%; + %.* + config.fox.backend = libbaz + %.* + EOO + + $pkg_drop fox + } + } } } -- cgit v1.1