aboutsummaryrefslogtreecommitdiff
path: root/mod/mod-builds.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-09-03 00:18:20 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-09-05 16:57:22 +0300
commit2d907a525ab169f1cb97b87550e3646fde003733 (patch)
treefd6c820702a6a064bd6265d661ff77120064ac7c /mod/mod-builds.cxx
parent32a92bfa9ca270f262b34b6cfc82825d84f9026c (diff)
Adapt to optional package revision
Diffstat (limited to 'mod/mod-builds.cxx')
-rw-r--r--mod/mod-builds.cxx31
1 files changed, 26 insertions, 5 deletions
diff --git a/mod/mod-builds.cxx b/mod/mod-builds.cxx
index dedabfe..71e7f7b 100644
--- a/mod/mod-builds.cxx
+++ b/mod/mod-builds.cxx
@@ -130,9 +130,15 @@ build_query (const brep::cstrings* configs,
// Package version.
//
if (!params.version ().empty () && params.version () != "*")
+ {
+ // May throw invalid_argument.
+ //
+ version v (params.version (), false /* fold_zero_revision */);
+
q = q && compare_version_eq (pid.version,
- version (params.version ()), // May throw.
- true);
+ canonical_version (v),
+ v.revision.has_value ());
+ }
// Build toolchain name/version.
//
@@ -144,12 +150,18 @@ build_query (const brep::cstrings* configs,
if (p == string::npos) // Invalid format.
throw invalid_argument ("");
+ // Note that the toolchain version is selected from the list and denotes
+ // the exact version revision, so an absent and zero revisions have the
+ // same semantics and the zero revision is folded.
+ //
string tn (tc, 0, p);
version tv (string (tc, p + 1)); // May throw invalid_argument.
q = q &&
qb::id.toolchain_name == tn &&
- compare_version_eq (qb::id.toolchain_version, tv, true);
+ compare_version_eq (qb::id.toolchain_version,
+ canonical_version (tv),
+ true /* revision */);
}
// Build configuration name.
@@ -244,9 +256,15 @@ package_query (const brep::params::builds& params,
// Package version.
//
if (!params.version ().empty () && params.version () != "*")
+ {
+ // May throw invalid_argument.
+ //
+ version v (params.version (), false /* fold_zero_revision */);
+
q = q && compare_version_eq (qp::id.version,
- version (params.version ()), // May throw.
- true);
+ canonical_version (v),
+ v.revision.has_value ());
+ }
}
catch (const invalid_argument&)
{
@@ -683,6 +701,9 @@ handle (request& rq, response& rs)
// May throw invalid_argument.
//
+ // Note that an absent and zero revisions have the same semantics,
+ // so the zero revision is folded (see above for details).
+ //
tc_version = version (string (tc, p + 1));
}
catch (const invalid_argument&)