From f01eb45f5b61d9396a5d433c8cf1411286af6eba Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 11 Feb 2022 14:23:07 +0300 Subject: Add support for reflect clause in tests package manifest value --- bpkg/package.hxx | 2 +- bpkg/package.xml | 6 ++ bpkg/rep-fetch.cxx | 6 +- tests/common/satisfy/t10/libfoo-bar-1.0.0.tar.gz | Bin 0 -> 376 bytes tests/common/satisfy/t10/libfoo-baz-1.0.0.tar.gz | Bin 0 -> 376 bytes tests/common/satisfy/t10/libfoo-tests-1.0.0.tar.gz | Bin 0 -> 413 bytes tests/common/satisfy/t10/repositories.manifest | 1 + tests/pkg-build.testscript | 85 +++++++++++++++++++++ tests/pkg-build/t10 | 1 + 9 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 tests/common/satisfy/t10/libfoo-bar-1.0.0.tar.gz create mode 100644 tests/common/satisfy/t10/libfoo-baz-1.0.0.tar.gz create mode 100644 tests/common/satisfy/t10/libfoo-tests-1.0.0.tar.gz create mode 120000 tests/common/satisfy/t10/repositories.manifest create mode 120000 tests/pkg-build/t10 diff --git a/bpkg/package.hxx b/bpkg/package.hxx index 93fcc9c..489f909 100644 --- a/bpkg/package.hxx +++ b/bpkg/package.hxx @@ -27,7 +27,7 @@ // #define DB_SCHEMA_VERSION_BASE 7 -#pragma db model version(DB_SCHEMA_VERSION_BASE, 15, closed) +#pragma db model version(DB_SCHEMA_VERSION_BASE, 16, closed) namespace bpkg { diff --git a/bpkg/package.xml b/bpkg/package.xml index 15e8846..7126cf3 100644 --- a/bpkg/package.xml +++ b/bpkg/package.xml @@ -1,4 +1,10 @@ + + + + + + diff --git a/bpkg/rep-fetch.cxx b/bpkg/rep-fetch.cxx index 69ddfd1..e232d24 100644 --- a/bpkg/rep-fetch.cxx +++ b/bpkg/rep-fetch.cxx @@ -1604,7 +1604,11 @@ namespace bpkg << package_string (p->id.name, p->version); } - dependency_alternative da; + dependency_alternative da (nullopt /* enable */, + td.reflect, + nullopt /* prefer */, + nullopt /* accept */, + nullopt /* require */); da.push_back ( dependency {p->id.name, version_constraint (p->version)}); diff --git a/tests/common/satisfy/t10/libfoo-bar-1.0.0.tar.gz b/tests/common/satisfy/t10/libfoo-bar-1.0.0.tar.gz new file mode 100644 index 0000000..30ae081 Binary files /dev/null and b/tests/common/satisfy/t10/libfoo-bar-1.0.0.tar.gz differ diff --git a/tests/common/satisfy/t10/libfoo-baz-1.0.0.tar.gz b/tests/common/satisfy/t10/libfoo-baz-1.0.0.tar.gz new file mode 100644 index 0000000..1263394 Binary files /dev/null and b/tests/common/satisfy/t10/libfoo-baz-1.0.0.tar.gz differ diff --git a/tests/common/satisfy/t10/libfoo-tests-1.0.0.tar.gz b/tests/common/satisfy/t10/libfoo-tests-1.0.0.tar.gz new file mode 100644 index 0000000..594a9b8 Binary files /dev/null and b/tests/common/satisfy/t10/libfoo-tests-1.0.0.tar.gz differ diff --git a/tests/common/satisfy/t10/repositories.manifest b/tests/common/satisfy/t10/repositories.manifest new file mode 120000 index 0000000..0d4767a --- /dev/null +++ b/tests/common/satisfy/t10/repositories.manifest @@ -0,0 +1 @@ +../repositories.manifest \ No newline at end of file diff --git a/tests/pkg-build.testscript b/tests/pkg-build.testscript index 13b2539..287074c 100644 --- a/tests/pkg-build.testscript +++ b/tests/pkg-build.testscript @@ -152,6 +152,12 @@ # | |-- foo-1.0.0.tar.gz -> libbaz, libbox # | `-- repositories.manifest # | +# |-- t10 +# | |-- libfoo-bar-1.0.0.tar.gz -> libfoo-tests +# | |-- libfoo-baz-1.0.0.tar.gz -> libfoo-tests +# | |-- libfoo-tests-1.0.0.tar.gz +# | `-- repositories.manifest +# | # `-- git # |-- libbar.git -> style-basic.git (prerequisite repository) # |-- libbaz.git @@ -182,6 +188,7 @@ posix = ($cxx.target.class != 'windows') 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 cp -r $src/t9 $out/t9 && $rep_create $out/t9 &$out/t9/packages.manifest + cp -r $src/t10 $out/t10 && $rep_create $out/t10 &$out/t10/packages.manifest # Create git repositories. # @@ -3581,6 +3588,84 @@ test.options += --no-progress } } +: test-dependency +: +{ + +$clone_cfg + +$rep_add $rep/t10 && $rep_fetch + + : simultaneously + : + { + $clone_cfg; + + $* libfoo-bar libfoo-tests 2>>~%EOE%; + fetched libfoo-bar/1.0.0 + unpacked libfoo-bar/1.0.0 + fetched libfoo-tests/1.0.0 + unpacked libfoo-tests/1.0.0 + configured libfoo-bar/1.0.0 + configured libfoo-tests/1.0.0 + %info: .+libfoo-bar-1.0.0.+ is up to date% + %info: .+libfoo-tests-1.0.0.+ is up to date% + updated libfoo-bar/1.0.0 + updated libfoo-tests/1.0.0 + EOE + + cat cfg/libfoo-tests-1.0.0/build/config.build >>~%EOO%; + %.* + config.libfoo_tests.test = libfoo-bar + %.* + EOO + + $pkg_drop libfoo-bar libfoo-tests + } + + : sequentially + : + { + $clone_cfg; + + $* libfoo-baz 2>>~%EOE%; + fetched libfoo-baz/1.0.0 + unpacked libfoo-baz/1.0.0 + configured libfoo-baz/1.0.0 + %info: .+libfoo-baz-1.0.0.+ is up to date% + updated libfoo-baz/1.0.0 + EOE + + $* libfoo-tests 2>>~%EOE%; + fetched libfoo-tests/1.0.0 + unpacked libfoo-tests/1.0.0 + configured libfoo-tests/1.0.0 + %info: .+libfoo-tests-1.0.0.+ is up to date% + updated libfoo-tests/1.0.0 + EOE + + cat cfg/libfoo-tests-1.0.0/build/config.build >>~%EOO%; + %.* + config.libfoo_tests.test = libfoo-baz + %.* + EOO + + $pkg_drop libfoo-baz libfoo-tests + } + + : tests-only + : + { + $clone_cfg; + + $* libfoo-tests 2>>~%EOE% != 0 + error: unable to select dependency alternative for package libfoo-tests/1.0.0 + info: explicitly specify dependency packages to manually select the alternative + info: alternative: libfoo-bar + info: alternative: libfoo-baz + info: while satisfying libfoo-tests/1.0.0 + EOE + } +} + : dependent : { diff --git a/tests/pkg-build/t10 b/tests/pkg-build/t10 new file mode 120000 index 0000000..0208f77 --- /dev/null +++ b/tests/pkg-build/t10 @@ -0,0 +1 @@ +../common/satisfy/t10 \ No newline at end of file -- cgit v1.1