aboutsummaryrefslogtreecommitdiff
path: root/load
diff options
context:
space:
mode:
Diffstat (limited to 'load')
-rw-r--r--load/load.cxx48
1 files changed, 36 insertions, 12 deletions
diff --git a/load/load.cxx b/load/load.cxx
index 260f557..a0ffca8 100644
--- a/load/load.cxx
+++ b/load/load.cxx
@@ -566,7 +566,11 @@ load_packages (const shared_ptr<repository>& rp,
else
// Create external package object.
//
- p = make_shared<package> (move (pm.name), move (pm.version), rp);
+ p = make_shared<package> (move (pm.name),
+ move (pm.version),
+ move (pm.builds),
+ move (pm.build_constraints),
+ rp);
db.persist (p);
}
@@ -600,9 +604,12 @@ load_packages (const shared_ptr<repository>& rp,
// A non-stub package is buildable if belongs to at least one
// buildable repository (see libbrep/package.hxx for details).
+ // Note that if this is an external test package it will be marked as
+ // unbuildable by that reason later (see resolve_dependencies() for
+ // details).
//
- if (!p->stub () && !p->buildable)
- p->buildable = rp->buildable;
+ if (rp->buildable && !p->buildable && !p->stub ())
+ p->buildable = buildable_status::buildable;
}
p->other_repositories.push_back (rp);
@@ -852,9 +859,11 @@ find (const lazy_shared_ptr<repository>& r,
// Resolve package run-time dependencies, tests, examples, and benchmarks.
// Make sure that the best matching dependency belongs to the package
// repositories, their complements, recursively, or their immediate
-// prerequisite repositories (only for run-time dependencies). Fail if unable
-// to resolve a dependency, unless ignore_unresolved is true in which case
-// leave this dependency NULL. Should be called once per internal package.
+// prerequisite repositories (only for run-time dependencies). Set the test
+// buildable status for the resolved tests, examples, and benchmarks packages,
+// unless they are already unbuildable (for any reason). Fail if unable to
+// resolve a dependency, unless ignore_unresolved is true in which case leave
+// this dependency NULL. Should be called once per internal package.
//
static void
resolve_dependencies (package& p, database& db, bool ignore_unresolved)
@@ -872,7 +881,7 @@ resolve_dependencies (package& p, database& db, bool ignore_unresolved)
p.benchmarks.empty ())
return;
- auto resolve = [&p, &db] (dependency& d, bool prereq)
+ auto resolve = [&p, &db] (dependency& d, bool test)
{
// Dependency should not be resolved yet.
//
@@ -934,9 +943,24 @@ resolve_dependencies (package& p, database& db, bool ignore_unresolved)
for (const auto& pp: db.query<package> (q + order_by_version_desc (vm)))
{
- if (find (p.internal_repository, pp, prereq))
+ if (find (p.internal_repository, pp, !test))
{
d.package.reset (db, pp.id);
+
+ // If the resolved dependency is an external test, then mark it as
+ // such, unless it is a stub.
+ //
+ if (test)
+ {
+ shared_ptr<package> dp (d.package.load ());
+
+ if (!dp->stub ())
+ {
+ dp->buildable = buildable_status::test;
+ db.update (dp);
+ }
+ }
+
return true;
}
}
@@ -963,26 +987,26 @@ resolve_dependencies (package& p, database& db, bool ignore_unresolved)
// specifying in the manifest file an alternative which can't be
// resolved, unless unresolved dependencies are allowed.
//
- if (!resolve (d, true /* prereq */) && !ignore_unresolved)
+ if (!resolve (d, false /* test */) && !ignore_unresolved)
bail (d, "dependency");
}
}
for (dependency& d: p.tests)
{
- if (!resolve (d, false /* prereq */) && !ignore_unresolved)
+ if (!resolve (d, true /* test */) && !ignore_unresolved)
bail (d, "tests");
}
for (dependency& d: p.examples)
{
- if (!resolve (d, false /* prereq */) && !ignore_unresolved)
+ if (!resolve (d, true /* test */) && !ignore_unresolved)
bail (d, "examples");
}
for (dependency& d: p.benchmarks)
{
- if (!resolve (d, false /* prereq */) && !ignore_unresolved)
+ if (!resolve (d, true /* test */) && !ignore_unresolved)
bail (d, "benchmarks");
}