aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2022-01-18 14:03:20 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2022-01-18 14:28:42 +0300
commit384ee407d3b83333c6c9c9902dcd952e191e4ba1 (patch)
treef02606084ea38805dace4d8a2f2a1e158e20aef3
parent62bd2494177be466dc6c1f418db328e99bae53ec (diff)
Add temporary support for requirements similar to '? cli'
-rw-r--r--libbpkg/manifest.cxx19
-rw-r--r--tests/manifest/testscript24
2 files changed, 42 insertions, 1 deletions
diff --git a/libbpkg/manifest.cxx b/libbpkg/manifest.cxx
index 6a5ce25..a71e1ab 100644
--- a/libbpkg/manifest.cxx
+++ b/libbpkg/manifest.cxx
@@ -1989,9 +1989,26 @@ namespace bpkg
if (requirements_ && first && tt == type::question)
{
r.emplace_back (dependency ());
- r.enable = lexer_->peek_char () == '(' ? parse_eval () : string ();
+
+ bool eval (lexer_->peek_char () == '(');
+ r.enable = eval ? parse_eval () : string ();
next (t, tt);
+
+ // @@ TMP Treat requirements similar to `? cli` as `cli ?` until
+ // toolchain 0.15.0 and libodb-mssql 2.5.0-b.22 are both released.
+ //
+ // NOTE: don't forget to drop the temporary test in
+ // tests/manifest/testscript when dropping this workaround.
+ //
+ if (!eval && tt == type::word)
+ try
+ {
+ r.back ().name = package_name (move (t.value));
+ next (t, tt);
+ }
+ catch (const invalid_argument&) {}
+
return r;
}
diff --git a/tests/manifest/testscript b/tests/manifest/testscript
index 9f8a476..dccc053 100644
--- a/tests/manifest/testscript
+++ b/tests/manifest/testscript
@@ -2850,6 +2850,29 @@
stdin:6:13: error: end of simple requirement expected
EOE
+ # @@ TMP Drop this test and uncomment the next one when toolchain 0.15.0
+ # is released (see dependency_alternatives_parser::parse_alternative()
+ # for details).
+ #
+ : old-fashioned
+ :
+ $* <<EOI >>EOO
+ : 1
+ name: foo
+ version: 2.0.0
+ summary: Modern C++ parser
+ license: LGPLv2
+ requires: ? vc15; VC 15 or later if targeting Windows.
+ EOI
+ : 1
+ name: foo
+ version: 2.0.0
+ summary: Modern C++ parser
+ license: LGPLv2
+ requires: vc15 ? ; VC 15 or later if targeting Windows.
+ EOO
+
+ #\
: reflect
:
$* <<EOI 2>>EOE != 0
@@ -2862,6 +2885,7 @@
EOI
stdin:6:13: error: end of simple requirement expected
EOE
+ #\
: with-id
: