aboutsummaryrefslogtreecommitdiff
path: root/load
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-03-14 13:17:42 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-03-14 14:34:44 +0300
commitb29ad24f6d7b50075281eb6153cb08a5e763229c (patch)
tree940707dddf5d5e25ddc46a85dee83250b97ac308 /load
parenta03a2b613f5d36de5617c50e76cced95fda188ac (diff)
Add --ignore-unresolved-tests option for brep-load
Diffstat (limited to 'load')
-rw-r--r--load/load.cli8
-rw-r--r--load/load.cxx51
2 files changed, 45 insertions, 14 deletions
diff --git a/load/load.cli b/load/load.cli
index 1b7c4c5..b9aa769 100644
--- a/load/load.cli
+++ b/load/load.cli
@@ -57,6 +57,14 @@ class options
don't detect package dependency cycles."
};
+ bool --ignore-unresolved-tests
+ {
+ "Ignore tests, examples, and benchmarks package manifest entries which
+ cannot be resolved from the main package's complement repositories,
+ recursively. Note that in contrast to --shallow option, such entries will
+ be removed from the main package manifests outright."
+ }
+
std::string --tenant
{
"<id>",
diff --git a/load/load.cxx b/load/load.cxx
index 56e4e19..b8b4e1f 100644
--- a/load/load.cxx
+++ b/load/load.cxx
@@ -1068,16 +1068,23 @@ find (const lazy_shared_ptr<repository>& r,
return false;
}
-// Resolve package run-time dependencies and external tests. Make sure that
-// the best matching dependency belongs to the package repositories, their
+// Resolve package regular dependencies and external tests. 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). Set the buildable flag to false for the
-// resolved external tests packages. 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.
+// (only for regular dependencies). Set the buildable flag to false for the
+// resolved external tests packages. Fail if unable to resolve a regular
+// dependency, unless ignore_unresolved is true in which case leave this
+// dependency NULL. Fail if unable to resolve an external test, unless
+// ignore_unresolved or ignore_unresolved_tests is true in which case leave
+// this dependency NULL, if ignore_unresolved_tests is false, and remove the
+// respective tests manifest entry otherwise. Should be called once per
+// internal package.
//
static void
-resolve_dependencies (package& p, database& db, bool ignore_unresolved)
+resolve_dependencies (package& p,
+ database& db,
+ bool ignore_unresolved,
+ bool ignore_unresolved_tests)
{
using brep::dependency;
using brep::dependency_alternative;
@@ -1179,10 +1186,10 @@ resolve_dependencies (package& p, database& db, bool ignore_unresolved)
return false;
};
- auto bail = [&p] (const dependency& d, const char* what)
+ auto bail = [&p] (const dependency& d, const string& what)
{
- cerr << "error: can't resolve " << what << " " << d << " for the package "
- << p.name << " " << p.version << endl
+ cerr << "error: can't resolve " << what << ' ' << d << " for the package "
+ << p.name << ' ' << p.version << endl
<< " info: repository " << p.internal_repository.load ()->location
<< " appears to be broken" << endl;
@@ -1206,10 +1213,23 @@ resolve_dependencies (package& p, database& db, bool ignore_unresolved)
}
}
- for (brep::test_dependency& td: p.tests)
+ for (auto i (p.tests.begin ()); i != p.tests.end (); )
{
- if (!resolve (td, true /* test */) && !ignore_unresolved)
- bail (td, td.name.string ().c_str ());
+ brep::test_dependency& td (*i);
+
+ if (!resolve (td, true /* test */))
+ {
+ if (!ignore_unresolved && !ignore_unresolved_tests)
+ bail (td, to_string (td.type));
+
+ if (ignore_unresolved_tests)
+ {
+ i = p.tests.erase (i);
+ continue;
+ }
+ }
+
+ ++i;
}
db.update (p); // Update the package state.
@@ -1710,7 +1730,10 @@ try
db.query<package> (
query::id.tenant == tnt &&
query::internal_repository.canonical_name.is_not_null ()))
- resolve_dependencies (p, db, ops.shallow ());
+ resolve_dependencies (p,
+ db,
+ ops.shallow (),
+ ops.ignore_unresolved_tests ());
if (!ops.shallow ())
{