aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-04-01 23:01:02 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-04-06 15:09:41 +0300
commit65ba2b47c8d6c83e37fe772a7b54fd6b7480ce17 (patch)
treef24967df1c447e10c43206cf599007e98c24afb7
parentd1662abccb91be4844efc1508ff8b0427019a27c (diff)
Add support for test-exclude task manifest valuemigration-example
Note that the last two commits demonstrate an approach to use for migrating data on the ODB object member type change.
-rw-r--r--libbrep/build-extra.sql73
-rw-r--r--libbrep/build-package.hxx35
-rw-r--r--libbrep/build.hxx8
-rw-r--r--libbrep/build.xml2
-rw-r--r--libbrep/common.cxx28
-rw-r--r--libbrep/common.hxx36
-rw-r--r--libbrep/package.cxx15
-rw-r--r--libbrep/package.hxx42
-rw-r--r--libbrep/package.xml7
-rw-r--r--load/load.cxx48
-rw-r--r--migrate/migrate.cxx12
-rw-r--r--mod/mod-build-task.cxx42
-rw-r--r--mod/mod-package-version-details.cxx3
-rw-r--r--tests/load/1/math/libfoo-benchmarks-1.2.4.tar.gzbin262 -> 264 bytes
-rw-r--r--tests/load/1/math/libfoo-examples-1.2.4.tar.gzbin268 -> 263 bytes
-rw-r--r--tests/load/1/math/libfoo-tests-1.2.4.tar.gzbin259 -> 260 bytes
-rw-r--r--tests/load/1/math/packages.manifest12
-rw-r--r--tests/load/driver.cxx12
18 files changed, 303 insertions, 72 deletions
diff --git a/libbrep/build-extra.sql b/libbrep/build-extra.sql
index 7b9fec5..e8d0775 100644
--- a/libbrep/build-extra.sql
+++ b/libbrep/build-extra.sql
@@ -10,6 +10,12 @@ DROP FOREIGN TABLE IF EXISTS build_package_constraints;
DROP FOREIGN TABLE IF EXISTS build_package_builds;
+DROP FOREIGN TABLE IF EXISTS build_package_benchmarks;
+
+DROP FOREIGN TABLE IF EXISTS build_package_examples;
+
+DROP FOREIGN TABLE IF EXISTS build_package_tests;
+
DROP FOREIGN TABLE IF EXISTS build_package;
DROP FOREIGN TABLE IF EXISTS build_repository;
@@ -18,7 +24,6 @@ DROP FOREIGN TABLE IF EXISTS build_tenant;
-- The foreign table for build_tenant object.
--
---
CREATE FOREIGN TABLE build_tenant (
id TEXT NOT NULL,
archived BOOLEAN NOT NULL)
@@ -26,7 +31,6 @@ SERVER package_server OPTIONS (table_name 'tenant');
-- The foreign table for build_repository object.
--
---
CREATE FOREIGN TABLE build_repository (
tenant TEXT NOT NULL,
canonical_name TEXT NOT NULL,
@@ -37,7 +41,6 @@ SERVER package_server OPTIONS (table_name 'repository');
-- The foreign table for build_package object.
--
---
CREATE FOREIGN TABLE build_package (
tenant TEXT NOT NULL,
name CITEXT NOT NULL,
@@ -49,12 +52,71 @@ CREATE FOREIGN TABLE build_package (
version_release TEXT NULL,
internal_repository_tenant TEXT NULL,
internal_repository_canonical_name TEXT NULL,
- buildable_ BOOLEAN NOT NULL)
+ buildable TEXT NOT NULL)
SERVER package_server OPTIONS (table_name 'package');
--- The foreign table for the build_package object builds member (that is of a
+-- The foreign table for the build_package object tests member (that is of a
-- container type).
--
+CREATE FOREIGN TABLE build_package_tests (
+ tenant TEXT NOT NULL,
+ name CITEXT NOT NULL,
+ version_epoch INTEGER NOT NULL,
+ version_canonical_upstream TEXT NOT NULL,
+ version_canonical_release TEXT NOT NULL COLLATE "C",
+ version_revision INTEGER NOT NULL,
+ index BIGINT NOT NULL,
+ dep_name CITEXT NOT NULL,
+ dep_package_tenant TEXT NULL,
+ dep_package_name CITEXT NULL,
+ dep_package_version_epoch INTEGER NULL,
+ dep_package_version_canonical_upstream TEXT NULL,
+ dep_package_version_canonical_release TEXT NULL COLLATE "C",
+ dep_package_version_revision INTEGER NULL)
+SERVER package_server OPTIONS (table_name 'package_tests');
+
+-- The foreign table for the build_package object examples member (that is of a
+-- container type).
+--
+CREATE FOREIGN TABLE build_package_examples (
+ tenant TEXT NOT NULL,
+ name CITEXT NOT NULL,
+ version_epoch INTEGER NOT NULL,
+ version_canonical_upstream TEXT NOT NULL,
+ version_canonical_release TEXT NOT NULL COLLATE "C",
+ version_revision INTEGER NOT NULL,
+ index BIGINT NOT NULL,
+ dep_name CITEXT NOT NULL,
+ dep_package_tenant TEXT NULL,
+ dep_package_name CITEXT NULL,
+ dep_package_version_epoch INTEGER NULL,
+ dep_package_version_canonical_upstream TEXT NULL,
+ dep_package_version_canonical_release TEXT NULL COLLATE "C",
+ dep_package_version_revision INTEGER NULL)
+SERVER package_server OPTIONS (table_name 'package_examples');
+
+-- The foreign table for the build_package object benchmarks member (that is
+-- of a container type).
+--
+CREATE FOREIGN TABLE build_package_benchmarks (
+ tenant TEXT NOT NULL,
+ name CITEXT NOT NULL,
+ version_epoch INTEGER NOT NULL,
+ version_canonical_upstream TEXT NOT NULL,
+ version_canonical_release TEXT NOT NULL COLLATE "C",
+ version_revision INTEGER NOT NULL,
+ index BIGINT NOT NULL,
+ dep_name CITEXT NOT NULL,
+ dep_package_tenant TEXT NULL,
+ dep_package_name CITEXT NULL,
+ dep_package_version_epoch INTEGER NULL,
+ dep_package_version_canonical_upstream TEXT NULL,
+ dep_package_version_canonical_release TEXT NULL COLLATE "C",
+ dep_package_version_revision INTEGER NULL)
+SERVER package_server OPTIONS (table_name 'package_benchmarks');
+
+-- The foreign table for the build_package object builds member (that is of a
+-- container type).
--
CREATE FOREIGN TABLE build_package_builds (
tenant TEXT NOT NULL,
@@ -71,7 +133,6 @@ SERVER package_server OPTIONS (table_name 'package_builds');
-- The foreign table for the build_package object constraints member (that is
-- of a container type).
--
---
CREATE FOREIGN TABLE build_package_constraints (
tenant TEXT NOT NULL,
name CITEXT NOT NULL,
diff --git a/libbrep/build-package.hxx b/libbrep/build-package.hxx
index ffa9d0b..85d94e6 100644
--- a/libbrep/build-package.hxx
+++ b/libbrep/build-package.hxx
@@ -68,6 +68,19 @@ namespace brep
build_repository (): canonical_name (id.canonical_name) {}
};
+ // Forward declarations.
+ //
+ class build_package;
+
+ // Build package test dependency.
+ //
+ #pragma db value
+ struct build_dependency
+ {
+ package_name name;
+ lazy_shared_ptr<build_package> package;
+ };
+
// Foreign object that is mapped to a subset of the package object.
//
#pragma db object table("build_package") pointer(shared_ptr) readonly session
@@ -76,8 +89,16 @@ namespace brep
public:
package_id id;
upstream_version version;
+
+ // Mapped to the package object tests, examples, and benchmarks members
+ // using the PostgreSQL foreign table mechanism.
+ //
+ small_vector<build_dependency, 1> tests;
+ small_vector<build_dependency, 1> examples;
+ small_vector<build_dependency, 1> benchmarks;
+
lazy_shared_ptr<build_repository> internal_repository;
- bool buildable;
+ buildable_status buildable;
// Mapped to the package object builds member using the PostgreSQL foreign
// table mechanism.
@@ -89,15 +110,19 @@ namespace brep
//
build_constraints constraints;
+ bool
+ internal () const noexcept {return internal_repository != nullptr;}
+
// Database mapping.
//
#pragma db member(id) id column("")
#pragma db member(version) set(this.version.init (this.id.version, (?)))
+ #pragma db member(tests) id_column("") value_column("dep_")
+ #pragma db member(examples) id_column("") value_column("dep_")
+ #pragma db member(benchmarks) id_column("") value_column("dep_")
#pragma db member(builds) id_column("") value_column("")
#pragma db member(constraints) id_column("") value_column("")
- #pragma db member(buildable) column("buildable_")
-
private:
friend class odb::access;
build_package () = default;
@@ -111,7 +136,7 @@ namespace brep
#pragma db view \
object(build_package) \
object(build_repository inner: \
- build_package::buildable && \
+ build_package::buildable == "buildable" && \
brep::operator== (build_package::internal_repository, \
build_repository::id)) \
object(build_tenant: build_package::id.tenant == build_tenant::id)
@@ -130,7 +155,7 @@ namespace brep
#pragma db view \
object(build_package) \
object(build_repository inner: \
- build_package::buildable && \
+ build_package::buildable == "buildable" && \
brep::operator== (build_package::internal_repository, \
build_repository::id)) \
object(build_tenant: build_package::id.tenant == build_tenant::id)
diff --git a/libbrep/build.hxx b/libbrep/build.hxx
index a883fa0..8990880 100644
--- a/libbrep/build.hxx
+++ b/libbrep/build.hxx
@@ -25,7 +25,7 @@
//
#define LIBBREP_BUILD_SCHEMA_VERSION_BASE 9
-#pragma db model version(LIBBREP_BUILD_SCHEMA_VERSION_BASE, 11, closed)
+#pragma db model version(LIBBREP_BUILD_SCHEMA_VERSION_BASE, 12, closed)
// We have to keep these mappings at the global scope instead of inside
// the brep namespace because they need to be also effective in the
@@ -285,7 +285,7 @@ namespace brep
#pragma db view object(build) \
object(build_package inner: \
brep::operator== (build::id.package, build_package::id) && \
- build_package::buildable) \
+ build_package::buildable == "buildable") \
query(distinct)
struct toolchain
{
@@ -329,7 +329,7 @@ namespace brep
object(build) \
object(build_package inner: \
brep::operator== (build::id.package, build_package::id) && \
- build_package::buildable) \
+ build_package::buildable == "buildable") \
object(build_tenant: build_package::id.tenant == build_tenant::id)
struct package_build
{
@@ -340,7 +340,7 @@ namespace brep
object(build) \
object(build_package inner: \
brep::operator== (build::id.package, build_package::id) && \
- build_package::buildable) \
+ build_package::buildable == "buildable") \
object(build_tenant: build_package::id.tenant == build_tenant::id)
struct package_build_count
{
diff --git a/libbrep/build.xml b/libbrep/build.xml
index f4ba6cb..03d60e7 100644
--- a/libbrep/build.xml
+++ b/libbrep/build.xml
@@ -1,4 +1,6 @@
<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" schema-name="build" version="1">
+ <changeset version="12"/>
+
<changeset version="11"/>
<changeset version="10">
diff --git a/libbrep/common.cxx b/libbrep/common.cxx
index 2e9ff34..cddf44e 100644
--- a/libbrep/common.cxx
+++ b/libbrep/common.cxx
@@ -6,4 +6,32 @@
namespace brep
{
const version wildcard_version (0, "0", nullopt, nullopt, 0);
+
+ // buildable_status
+ //
+ string
+ to_string (buildable_status s)
+ {
+ switch (s)
+ {
+ case buildable_status::buildable: return "buildable";
+ case buildable_status::unbuildable: return "unbuildable";
+ case buildable_status::external: return "external";
+ case buildable_status::test: return "test";
+ case buildable_status::stub: return "stub";
+ }
+
+ return string (); // Should never reach.
+ }
+
+ buildable_status
+ to_buildable_status (const string& s)
+ {
+ if (s == "buildable") return buildable_status::buildable;
+ else if (s == "unbuildable") return buildable_status::unbuildable;
+ else if (s == "external") return buildable_status::external;
+ else if (s == "test") return buildable_status::test;
+ else if (s == "stub") return buildable_status::stub;
+ else throw invalid_argument ("invalid buildable status '" + s + "'");
+ }
}
diff --git a/libbrep/common.hxx b/libbrep/common.hxx
index b7fc2da..4aea110 100644
--- a/libbrep/common.hxx
+++ b/libbrep/common.hxx
@@ -323,6 +323,42 @@ namespace brep
#pragma db value(build_constraint) definition
+ // Whether a package is buildable by the build bot controller service and
+ // what is the "main" reason if it is not.
+ //
+ // While we could potentially calculate this status on the fly, that would
+ // complicate the database queries significantly.
+ //
+ enum class buildable_status: std::uint8_t
+ {
+ buildable, // Not a test nor stub, from internal buildable repository.
+ unbuildable, // Not a test nor stub, from internal unbuildable repository.
+ external, // Not a test nor stub, from external repository.
+ test, // Test, not a stub.
+ stub // Stub.
+ };
+
+ string
+ to_string (buildable_status);
+
+ buildable_status
+ to_buildable_status (const string&); // May throw invalid_argument.
+
+ inline ostream&
+ operator<< (ostream& os, buildable_status s) {return os << to_string (s);}
+
+ // Return true if the status is not buildable.
+ //
+ inline bool
+ operator! (buildable_status s)
+ {
+ return s != buildable_status::buildable;
+ }
+
+ #pragma db map type(buildable_status) as(string) \
+ to(to_string (?)) \
+ from(brep::to_buildable_status (?))
+
// Version comparison operators.
//
// They allow comparing objects that have epoch, canonical_upstream,
diff --git a/libbrep/package.cxx b/libbrep/package.cxx
index ec8e74a..2178392 100644
--- a/libbrep/package.cxx
+++ b/libbrep/package.cxx
@@ -110,12 +110,15 @@ namespace brep
examples (move (es)),
benchmarks (move (bms)),
builds (move (bs)),
- build_constraints (!stub () ? move (bc) : build_constraints_type ()),
+ build_constraints (move (bc)),
internal_repository (move (rp)),
location (move (lc)),
fragment (move (fr)),
sha256sum (move (sh)),
- buildable (!stub () && internal_repository->buildable)
+ buildable (
+ stub () ? buildable_status::stub :
+ !internal_repository->buildable ? buildable_status::unbuildable :
+ buildable_status::buildable)
{
assert (internal_repository->internal);
}
@@ -123,12 +126,18 @@ namespace brep
package::
package (package_name nm,
version_type vr,
+ build_class_exprs bs,
+ build_constraints_type bc,
shared_ptr<repository_type> rp)
: id (rp->tenant, move (nm), vr),
tenant (id.tenant),
name (id.name),
version (move (vr)),
- buildable (false)
+ builds (move (bs)),
+ build_constraints (move (bc)),
+ buildable (stub ()
+ ? buildable_status::stub
+ : buildable_status::external)
{
assert (!rp->internal);
other_repositories.emplace_back (move (rp));
diff --git a/libbrep/package.hxx b/libbrep/package.hxx
index f679c62..09bde77 100644
--- a/libbrep/package.hxx
+++ b/libbrep/package.hxx
@@ -20,7 +20,7 @@
//
#define LIBBREP_PACKAGE_SCHEMA_VERSION_BASE 17
-#pragma db model version(LIBBREP_PACKAGE_SCHEMA_VERSION_BASE, 18, closed)
+#pragma db model version(LIBBREP_PACKAGE_SCHEMA_VERSION_BASE, 19, closed)
namespace brep
{
@@ -362,8 +362,7 @@ namespace brep
using requirements_type = brep::requirements;
using build_constraints_type = brep::build_constraints;
- // Create internal package object. Note that for stubs the build
- // constraints are meaningless, and so not saved.
+ // Create internal package object.
//
package (package_name,
version_type,
@@ -400,12 +399,22 @@ namespace brep
// Create external package object.
//
- // External repository packages can appear on the WEB interface only in
- // dependency list in the form of a link to the corresponding WEB page.
- // The only package information required to compose such a link is the
- // package name, version, and repository location.
+ // External package can appear on the WEB interface only in dependency
+ // list in the form of a link to the corresponding WEB page. The only
+ // package information required to compose such a link is the package name,
+ // version, and repository location.
//
- package (package_name name, version_type, shared_ptr<repository_type>);
+ // External package can also be a separate test for some primary package
+ // (and belong to a complement but yet external repository), and so we may
+ // need its build class expressions and constraints to decide if to build
+ // it together with the primary package or not (see test-exclude task
+ // manifest value for details).
+ //
+ package (package_name name,
+ version_type,
+ build_class_exprs,
+ build_constraints_type,
+ shared_ptr<repository_type>);
bool
internal () const noexcept {return internal_repository != nullptr;}
@@ -451,9 +460,9 @@ namespace brep
optional<email_type> build_error_email;
dependencies_type dependencies;
requirements_type requirements;
- small_vector<dependency, 1> tests;
- small_vector<dependency, 1> examples;
- small_vector<dependency, 1> benchmarks;
+ small_vector<dependency, 1> tests; // Note: foreign-mapped in build.
+ small_vector<dependency, 1> examples; // Note: foreign-mapped in build.
+ small_vector<dependency, 1> benchmarks; // Note: foreign-mapped in build.
build_class_exprs builds; // Note: foreign-mapped in build.
build_constraints_type build_constraints; // Note: foreign-mapped in build.
@@ -478,16 +487,9 @@ namespace brep
vector<lazy_shared_ptr<repository_type>> other_repositories;
- // Whether the package is buildable by the build bot controller service.
- // Can only be true for non-stubs that belong to at least one buildable
- // (internal) repository.
- //
- // While we could potentially calculate this flag on the fly, that would
- // complicate the database queries significantly.
- //
// Note: foreign-mapped in build.
//
- bool buildable;
+ buildable_status buildable;
// Database mapping.
//
@@ -583,8 +585,6 @@ namespace brep
#pragma db member(other_repositories) \
id_column("") value_column("repository_") value_not_null
- #pragma db member(buildable) column("buildable_")
-
// search_index
//
#pragma db member(search_index) virtual(weighted_text) null \
diff --git a/libbrep/package.xml b/libbrep/package.xml
index 292cd05..0dcc472 100644
--- a/libbrep/package.xml
+++ b/libbrep/package.xml
@@ -1,4 +1,11 @@
<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" schema-name="package" version="1">
+ <changeset version="19">
+ <alter-table name="package">
+ <add-column name="buildable" type="TEXT" null="false"/>
+ <drop-column name="buildable_"/>
+ </alter-table>
+ </changeset>
+
<changeset version="18">
<alter-table name="package">
<add-column name="buildable_" type="BOOLEAN" null="false"/>
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");
}
diff --git a/migrate/migrate.cxx b/migrate/migrate.cxx
index 1577f1b..9b9a5bd 100644
--- a/migrate/migrate.cxx
+++ b/migrate/migrate.cxx
@@ -221,8 +221,7 @@ struct package_migration_entry: package_migration_entry_base<v>
// boolean to enumeration.
// Note that changing the data member type is not automatically handled by the
-// migration machinery. Thus, we split the schema change into two steps,
-// delaying the second step until the next commit:
+// migration machinery. Thus, we split the schema change into two steps:
//
// - Rename the buildable data member column preserving its boolean type and
// migrate the data copying it from the original column into the new
@@ -243,6 +242,15 @@ package_migrate_v18 ([] (database& db)
db.execute ("UPDATE package SET buildable_ = buildable");
});
+static const package_migration_entry<19>
+package_migrate_v19 ([] (database& db)
+{
+ // Convert the buildable flag values to the enumeration values.
+ //
+ db.execute ("UPDATE package SET buildable = "
+ "CASE WHEN buildable_ THEN 'buildable' ELSE 'unbuildable' END");
+});
+
// main() function
//
int
diff --git a/mod/mod-build-task.cxx b/mod/mod-build-task.cxx
index edddb89..3eaa0d3 100644
--- a/mod/mod-build-task.cxx
+++ b/mod/mod-build-task.cxx
@@ -220,14 +220,44 @@ handle (request& rq, response& rs)
lazy_shared_ptr<build_repository> r (p->internal_repository);
- strings fp;
+ strings fps;
if (r->certificate_fingerprint)
- fp.emplace_back (move (*r->certificate_fingerprint));
+ fps.emplace_back (move (*r->certificate_fingerprint));
+
+ // Exclude external test packages which exclude the task build
+ // configuration.
+ //
+ small_vector<package, 1> tes;
+ auto add_exclusions = [&tes, &cm, this]
+ (const small_vector<build_dependency, 1>& tests)
+ {
+ for (const build_dependency& t: tests)
+ {
+ // Don't exclude unresolved external tests.
+ //
+ // Note that this may result in the build task failure. However,
+ // silently excluding such tests could end up with missed software
+ // bugs which feels much worse.
+ //
+ if (t.package != nullptr)
+ {
+ shared_ptr<build_package> p (t.package.load ());
+
+ if (exclude (p->builds, p->constraints, *cm.config))
+ tes.push_back (package {move (p->id.name), move (p->version)});
+ }
+ }
+ };
+
+ add_exclusions (p->tests);
+ add_exclusions (p->examples);
+ add_exclusions (p->benchmarks);
task_manifest task (move (b->package_name),
move (b->package_version),
move (r->location),
- move (fp),
+ move (fps),
+ move (tes),
cm.machine->name,
cm.config->target,
cm.config->environment,
@@ -595,7 +625,7 @@ handle (request& rq, response& rs)
//
// We iterate over buildable packages.
//
- assert (p->internal_repository != nullptr);
+ assert (p->internal ());
p->internal_repository.load ();
@@ -677,8 +707,8 @@ handle (request& rq, response& rs)
shared_ptr<build_package> p (
build_db_->find<build_package> (b->id.package));
- if (p != nullptr &&
- p->internal_repository != nullptr &&
+ if (p != nullptr &&
+ p->internal () &&
!exclude (p->builds, p->constraints, *cm.config))
{
assert (b->status);
diff --git a/mod/mod-package-version-details.cxx b/mod/mod-package-version-details.cxx
index bfc08b0..22c1cf5 100644
--- a/mod/mod-package-version-details.cxx
+++ b/mod/mod-package-version-details.cxx
@@ -430,7 +430,8 @@ handle (request& rq, response& rs)
print_dependencies (pkg->examples, "Examples", "examples");
print_dependencies (pkg->benchmarks, "Benchmarks", "benchmarks");
- bool builds (build_db_ != nullptr && pkg->buildable);
+ bool builds (build_db_ != nullptr &&
+ pkg->buildable == buildable_status::buildable);
if (builds)
{
diff --git a/tests/load/1/math/libfoo-benchmarks-1.2.4.tar.gz b/tests/load/1/math/libfoo-benchmarks-1.2.4.tar.gz
index 606893a..391eb6f 100644
--- a/tests/load/1/math/libfoo-benchmarks-1.2.4.tar.gz
+++ b/tests/load/1/math/libfoo-benchmarks-1.2.4.tar.gz
Binary files differ
diff --git a/tests/load/1/math/libfoo-examples-1.2.4.tar.gz b/tests/load/1/math/libfoo-examples-1.2.4.tar.gz
index c1d5fbd..eac5190 100644
--- a/tests/load/1/math/libfoo-examples-1.2.4.tar.gz
+++ b/tests/load/1/math/libfoo-examples-1.2.4.tar.gz
Binary files differ
diff --git a/tests/load/1/math/libfoo-tests-1.2.4.tar.gz b/tests/load/1/math/libfoo-tests-1.2.4.tar.gz
index 8e5105f..223e24d 100644
--- a/tests/load/1/math/libfoo-tests-1.2.4.tar.gz
+++ b/tests/load/1/math/libfoo-tests-1.2.4.tar.gz
Binary files differ
diff --git a/tests/load/1/math/packages.manifest b/tests/load/1/math/packages.manifest
index de3b1c5..ea37e2a 100644
--- a/tests/load/1/math/packages.manifest
+++ b/tests/load/1/math/packages.manifest
@@ -89,25 +89,25 @@ name: libfoo-benchmarks
version: 1.2.4
summary: The Foo Math Library benchmarks
license: MIT
-builds: none; Is only build to benchmark libfoo.
+builds: 64; Fails building for 32 bits.
location: libfoo-benchmarks-1.2.4.tar.gz
-sha256sum: 2ec3985a540ca5bf74786d0792820cfa8a2790964a5aeaba443dfa91f2a54c04
+sha256sum: ba664343db5b9bd574450175834b0dd39d038dcff7387477b6eff0d5783a8ac4
:
name: libfoo-examples
version: 1.2.4
summary: The Foo Math Library examples
license: MIT
-builds: none; Is only built to demo libfoo usage.
+builds: 64; Fails building for 32 bits.
location: libfoo-examples-1.2.4.tar.gz
-sha256sum: 99658b9a5a5b834047b692b93ded9f9af3d255eb5ea3b27594f600b902039995
+sha256sum: 1343d1826c3ae5446ad965bc9aa7b1586e4238c7736c344e63a4a6bae3d57a88
:
name: libfoo-tests
version: 1.2.4
summary: The Foo Math Library tests
license: MIT
-builds: none; Is only built to test libfoo.
+builds: 64; Fails building for 32 bits.
location: libfoo-tests-1.2.4.tar.gz
-sha256sum: 16712c90df5ba2ffb920d29c9c25a29564f8ae01f167359c4651572789e6cd6c
+sha256sum: c5c0520b4e612fa2f8948c42824f3e199926c2395bf2c2f898e83f9eb19261a4
:
name: libpq
version: 0
diff --git a/tests/load/driver.cxx b/tests/load/driver.cxx
index 420c1e3..728ab0c 100644
--- a/tests/load/driver.cxx
+++ b/tests/load/driver.cxx
@@ -272,7 +272,7 @@ test_git_repos (const cstrings& loader_args,
version_constraint (
dep_ver ("1.0"), false, dep_ver ("1.0"), false)));
- assert (p->buildable);
+ assert (p->buildable == buildable_status::buildable);
t.commit ();
}
@@ -397,7 +397,7 @@ test_pkg_repos (const cstrings& loader_args,
assert (fpvxy->sha256sum && *fpvxy->sha256sum ==
"c994fd49f051ab7fb25f3a4e68ca878e484c5d3c2cb132b37d41224b0621b618");
- assert (fpvxy->buildable);
+ assert (fpvxy->buildable == buildable_status::buildable);
// libfoo-1.0
//
@@ -433,7 +433,7 @@ test_pkg_repos (const cstrings& loader_args,
assert (fpv1->sha256sum && *fpv1->sha256sum ==
"e89c6d746f8b1ea3ec58d294946d2f683d133438d2ac8c88549ba24c19627e76");
- assert (fpv1->buildable);
+ assert (fpv1->buildable == buildable_status::buildable);
// libfoo-1.2.2
//
@@ -708,7 +708,7 @@ test_pkg_repos (const cstrings& loader_args,
assert (xpv->sha256sum && *xpv->sha256sum ==
"1833906dd93ccc0cda832d6a1b3ef9ed7877bb9958b46d9b2666033d4a7919c9");
- assert (xpv->buildable);
+ assert (xpv->buildable == buildable_status::buildable);
// Verify libfoo package versions.
//
@@ -827,7 +827,7 @@ test_pkg_repos (const cstrings& loader_args,
assert (fpv5->sha256sum && *fpv5->sha256sum ==
"c02b6033107387e05f48aa62ee6498152c967deb0e91a62f1e618fe9fd1bc644");
- assert (fpv5->buildable);
+ assert (fpv5->buildable == buildable_status::buildable);
// Verify libexp package version.
//
@@ -870,7 +870,7 @@ test_pkg_repos (const cstrings& loader_args,
assert (epv->requirements.empty ());
- assert (epv->buildable);
+ assert (epv->buildable == buildable_status::buildable);
db.load (*epv, epv->build_section);