aboutsummaryrefslogtreecommitdiff
path: root/bpkg
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-12-22 22:42:13 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-01-15 13:22:50 +0300
commitcbd3cd125b574deaf1ad3c7001c5b6c9c40198ed (patch)
tree924cbe981a3e556dd1511a7397584ef03b53703d /bpkg
parentd51aa769a5441ccb5279e2fc4f50b127db0dea84 (diff)
Add support for $ in package manifest dependency constraint
Diffstat (limited to 'bpkg')
-rw-r--r--bpkg/package.hxx2
-rw-r--r--bpkg/pkg-build.cxx32
-rw-r--r--bpkg/pkg-checkout.cxx2
-rw-r--r--bpkg/pkg-configure.cxx4
-rw-r--r--bpkg/pkg-configure.hxx3
-rw-r--r--bpkg/pkg-fetch.cxx4
-rw-r--r--bpkg/pkg-unpack.cxx2
-rw-r--r--bpkg/pkg-verify.cli2
-rw-r--r--bpkg/pkg-verify.cxx13
-rw-r--r--bpkg/pkg-verify.hxx10
-rw-r--r--bpkg/rep-create.cxx2
-rw-r--r--bpkg/satisfaction.cxx4
-rw-r--r--bpkg/satisfaction.hxx3
13 files changed, 54 insertions, 29 deletions
diff --git a/bpkg/package.hxx b/bpkg/package.hxx
index e508bc0..8172a19 100644
--- a/bpkg/package.hxx
+++ b/bpkg/package.hxx
@@ -477,6 +477,8 @@ namespace bpkg
mutable optional<version_type> system_version_;
public:
+ // Note: dependency constraints must be complete.
+ //
available_package (package_manifest&& m)
: id (move (m.name), m.version),
version (move (m.version)),
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx
index 7002b0f..e24e9f0 100644
--- a/bpkg/pkg-build.cxx
+++ b/bpkg/pkg-build.cxx
@@ -65,6 +65,8 @@ namespace bpkg
//
if (c)
{
+ assert (c->complete ());
+
// If the revision is not explicitly specified, then compare ignoring the
// revision. The idea is that when the user runs 'bpkg build libfoo/1'
// and there is 1+1 available, it should just work. The user shouldn't
@@ -189,9 +191,9 @@ namespace bpkg
sp->state == package_state::fetched
? pkg_verify (options,
a->absolute () ? *a : c / *a,
- false /* expand_values */,
- true /* ignore_unknown */)
- : pkg_verify (sp->effective_src_root (c), true));
+ true /* ignore_unknown */,
+ false /* expand_values */)
+ : pkg_verify (sp->effective_src_root (c), true /* ignore_unknown */));
// Copy the possibly fixed up version from the selected package.
//
@@ -1558,7 +1560,8 @@ namespace bpkg
// Note that we don't pass allow_stub flag so the system wildcard version
// will (naturally) not be patched.
//
- optional<standard_version> v (parse_standard_version (sv.string ()));
+ string vs (sv.string ());
+ optional<standard_version> v (parse_standard_version (vs));
if (!v)
{
@@ -1571,7 +1574,7 @@ namespace bpkg
try
{
- return dependency_constraint ("~" + sv.string ());
+ return dependency_constraint ("~" + vs);
}
// Note that the only possible reason for invalid_argument exception to
// be thrown is that minor version reached the 999 limit (see
@@ -2923,11 +2926,13 @@ namespace bpkg
info << "'" << package << "' does not appear to be a valid "
<< "package archive: ";
- package_manifest m (pkg_verify (o,
- a,
- false /* expand_values */,
- true /* ignore_unknown */,
- diag));
+ package_manifest m (
+ pkg_verify (o,
+ a,
+ true /* ignore_unknown */,
+ false /* expand_values */,
+ true /* complete_depends */,
+ diag));
// This is a package archive.
//
@@ -2988,7 +2993,8 @@ namespace bpkg
info << "'" << package << "' does not appear to be a valid "
<< "package directory: ";
- package_manifest m (pkg_verify (d, true, diag));
+ package_manifest m (
+ pkg_verify (d, true /* ignore_unknown */, diag));
// This is a package directory.
//
@@ -4535,7 +4541,9 @@ namespace bpkg
//
assert (sp->state == package_state::unpacked);
- package_manifest m (pkg_verify (sp->effective_src_root (c), true));
+ package_manifest m (
+ pkg_verify (sp->effective_src_root (c), true /* ignore_unknown */));
+
pkg_configure (c, o, t, sp, m.dependencies, p.config_vars, simulate);
}
diff --git a/bpkg/pkg-checkout.cxx b/bpkg/pkg-checkout.cxx
index a7421b5..67aa165 100644
--- a/bpkg/pkg-checkout.cxx
+++ b/bpkg/pkg-checkout.cxx
@@ -145,7 +145,7 @@ namespace bpkg
// Verify the package prerequisites are all configured since the dist
// meta-operation generally requires all imports to be resolvable.
//
- package_manifest m (pkg_verify (sd, true));
+ package_manifest m (pkg_verify (sd, true /* ignore_unknown */));
pkg_configure_prerequisites (o, t, m.dependencies, m.name);
auto_rmdir rmd;
diff --git a/bpkg/pkg-configure.cxx b/bpkg/pkg-configure.cxx
index d63b010..75c371e 100644
--- a/bpkg/pkg-configure.cxx
+++ b/bpkg/pkg-configure.cxx
@@ -316,7 +316,9 @@ namespace bpkg
l4 ([&]{trace << *p;});
- package_manifest m (pkg_verify (p->effective_src_root (c), true));
+ package_manifest m (
+ pkg_verify (p->effective_src_root (c), true /* ignore_unknown */));
+
pkg_configure (c, o, t, p, m.dependencies, vars, false /* simulate */);
}
diff --git a/bpkg/pkg-configure.hxx b/bpkg/pkg-configure.hxx
index 2aeb8bb..c540c72 100644
--- a/bpkg/pkg-configure.hxx
+++ b/bpkg/pkg-configure.hxx
@@ -21,6 +21,9 @@ namespace bpkg
int
pkg_configure (const pkg_configure_options&, cli::scanner& args);
+ // Note: all of the following functions expect the package dependency
+ // constraints to be complete.
+
// Configure the package, update its state, and commit the transaction.
//
void
diff --git a/bpkg/pkg-fetch.cxx b/bpkg/pkg-fetch.cxx
index 261bc86..9212678 100644
--- a/bpkg/pkg-fetch.cxx
+++ b/bpkg/pkg-fetch.cxx
@@ -164,8 +164,8 @@ namespace bpkg
//
package_manifest m (pkg_verify (co,
a,
- false /* expand_values */,
- true /* ignore_unknown */));
+ true /* ignore_unknown */,
+ false /* expand_values */));
l4 ([&]{trace << m.name << " " << m.version;});
diff --git a/bpkg/pkg-unpack.cxx b/bpkg/pkg-unpack.cxx
index 85cd93f..65ad42d 100644
--- a/bpkg/pkg-unpack.cxx
+++ b/bpkg/pkg-unpack.cxx
@@ -171,7 +171,7 @@ namespace bpkg
// Verify the directory is a package and get its manifest.
//
- package_manifest m (pkg_verify (d, true));
+ package_manifest m (pkg_verify (d, true /* ignore_unknown */));
l4 ([&]{trace << d << ": " << m.name << " " << m.version;});
// Check/diagnose an already existing package.
diff --git a/bpkg/pkg-verify.cli b/bpkg/pkg-verify.cli
index a22c224..d31e461 100644
--- a/bpkg/pkg-verify.cli
+++ b/bpkg/pkg-verify.cli
@@ -56,7 +56,7 @@ namespace bpkg
human-readable form, dump the package manifest to \cb{stdout}. If the
\cb{--deep} option is specified, then in the resulting manifest the
\cb{*-file} values are replaced with the contents of the referenced
- files."
+ files and the package dependency constraints are completed."
}
};
}
diff --git a/bpkg/pkg-verify.cxx b/bpkg/pkg-verify.cxx
index d14f606..3dc2a53 100644
--- a/bpkg/pkg-verify.cxx
+++ b/bpkg/pkg-verify.cxx
@@ -22,8 +22,9 @@ namespace bpkg
package_manifest
pkg_verify (const common_options& co,
const path& af,
- bool ev,
bool iu,
+ bool ev,
+ bool cd,
bool diag)
try
{
@@ -47,7 +48,7 @@ namespace bpkg
{
ifdstream is (move (pr.second.in_ofd), fdstream_mode::skip);
manifest_parser mp (is, mf.string ());
- package_manifest m (mp, iu);
+ package_manifest m (mp, iu, cd);
is.close ();
if (wait ())
@@ -216,8 +217,12 @@ namespace bpkg
//
try
{
- package_manifest m (
- pkg_verify (o, a, o.deep (), o.ignore_unknown (), !o.silent ()));
+ package_manifest m (pkg_verify (o,
+ a,
+ o.ignore_unknown (),
+ o.deep () /* expand_values */,
+ o.deep () /* complete_depends */,
+ !o.silent ()));
if (o.manifest ())
{
diff --git a/bpkg/pkg-verify.hxx b/bpkg/pkg-verify.hxx
index a772a8f..73d3c17 100644
--- a/bpkg/pkg-verify.hxx
+++ b/bpkg/pkg-verify.hxx
@@ -19,15 +19,17 @@ namespace bpkg
// Verify archive is a valid package and return its manifest. If requested,
// expand the file-referencing manifest values (description, changes, etc),
- // setting them to the contents of files they refer to. Throw failed if
- // invalid or if something goes wrong. If diag is false, then don't issue
- // diagnostics about the reason why the package is invalid.
+ // setting them to the contents of files they refer to as well as complete
+ // the dependency constraints. Throw failed if invalid or if something goes
+ // wrong. If diag is false, then don't issue diagnostics about the reason
+ // why the package is invalid.
//
package_manifest
pkg_verify (const common_options&,
const path& archive,
- bool expand_values,
bool ignore_unknown,
+ bool expand_values,
+ bool complete_depends = true,
bool diag = true);
// Similar to the above but verifies that a source directory is a valid
diff --git a/bpkg/rep-create.cxx b/bpkg/rep-create.cxx
index 16f6496..55ba0f8 100644
--- a/bpkg/rep-create.cxx
+++ b/bpkg/rep-create.cxx
@@ -100,7 +100,7 @@ namespace bpkg
path a (d / p);
package_manifest m (
- pkg_verify (o, a, true /* expand_values */, o.ignore_unknown ()));
+ pkg_verify (o, a, o.ignore_unknown (), true /* expand_values */));
// Calculate its checksum.
//
diff --git a/bpkg/satisfaction.cxx b/bpkg/satisfaction.cxx
index e620d3b..801fe5f 100644
--- a/bpkg/satisfaction.cxx
+++ b/bpkg/satisfaction.cxx
@@ -17,7 +17,7 @@ namespace bpkg
bool
satisfies (const version& v, const dependency_constraint& c)
{
- assert (!c.empty ());
+ assert (!c.empty () && c.complete ());
if (v == wildcard_version)
return true;
@@ -45,7 +45,7 @@ namespace bpkg
bool
satisfies (const dependency_constraint& l, const dependency_constraint& r)
{
- assert (!l.empty () && !r.empty ());
+ assert (!l.empty () && l.complete () && !r.empty () && r.complete ());
// Note: the revision ignoring logic is still unclear/unimplemented. It
// seems it will be specific to each case below.
diff --git a/bpkg/satisfaction.hxx b/bpkg/satisfaction.hxx
index c79d1fb..c49eb33 100644
--- a/bpkg/satisfaction.hxx
+++ b/bpkg/satisfaction.hxx
@@ -13,6 +13,9 @@
namespace bpkg
{
+ // Note: all of the following functions expect the package dependency
+ // constraints to be complete.
+
// Return true if version satisfies the constraint.
//
bool