diff options
Diffstat (limited to 'libbrep')
-rw-r--r-- | libbrep/build-extra.sql | 64 | ||||
-rw-r--r-- | libbrep/build-package.hxx | 16 | ||||
-rw-r--r-- | libbrep/build.hxx | 2 | ||||
-rw-r--r-- | libbrep/build.xml | 2 | ||||
-rw-r--r-- | libbrep/package.cxx | 6 | ||||
-rw-r--r-- | libbrep/package.hxx | 43 | ||||
-rw-r--r-- | libbrep/package.xml | 74 |
7 files changed, 126 insertions, 81 deletions
diff --git a/libbrep/build-extra.sql b/libbrep/build-extra.sql index b466382..a61f415 100644 --- a/libbrep/build-extra.sql +++ b/libbrep/build-extra.sql @@ -10,10 +10,6 @@ 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; @@ -22,6 +18,12 @@ DROP FOREIGN TABLE IF EXISTS build_repository; DROP FOREIGN TABLE IF EXISTS build_tenant; +-- @@ TMP Also drop tables that are removed in 12 schema version. Drop these +-- statements after 0.13.0 is released. +-- +DROP FOREIGN TABLE IF EXISTS build_package_benchmarks; +DROP FOREIGN TABLE IF EXISTS build_package_examples; + -- The foreign table for build_tenant object. -- CREATE FOREIGN TABLE build_tenant ( @@ -66,55 +68,15 @@ CREATE FOREIGN TABLE build_package_tests ( 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) + test_name CITEXT NOT NULL, + test_package_tenant TEXT NULL, + test_package_name CITEXT NULL, + test_package_version_epoch INTEGER NULL, + test_package_version_canonical_upstream TEXT NULL, + test_package_version_canonical_release TEXT NULL COLLATE "C", + test_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). -- diff --git a/libbrep/build-package.hxx b/libbrep/build-package.hxx index 228c5c0..09ec41d 100644 --- a/libbrep/build-package.hxx +++ b/libbrep/build-package.hxx @@ -72,10 +72,10 @@ namespace brep // class build_package; - // Build package test dependency. + // Build package external test dependency. // #pragma db value - struct build_dependency + struct build_test_dependency { package_name name; lazy_shared_ptr<build_package> package; @@ -90,12 +90,10 @@ namespace brep package_id id; upstream_version version; - // Mapped to the package object tests, examples, and benchmarks members - // using the PostgreSQL foreign table mechanism. + // Mapped to the package object tests member using the PostgreSQL foreign + // table mechanism. // - small_vector<build_dependency, 1> tests; - small_vector<build_dependency, 1> examples; - small_vector<build_dependency, 1> benchmarks; + small_vector<build_test_dependency, 1> tests; lazy_shared_ptr<build_repository> internal_repository; bool buildable; @@ -117,9 +115,7 @@ namespace brep // #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(tests) id_column("") value_column("test_") #pragma db member(builds) id_column("") value_column("") #pragma db member(constraints) id_column("") value_column("") diff --git a/libbrep/build.hxx b/libbrep/build.hxx index a883fa0..1041805 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 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/package.cxx b/libbrep/package.cxx index 5ec1b69..564fec7 100644 --- a/libbrep/package.cxx +++ b/libbrep/package.cxx @@ -72,9 +72,7 @@ namespace brep optional<email_type> bee, dependencies_type dp, requirements_type rq, - small_vector<dependency, 1> ts, - small_vector<dependency, 1> es, - small_vector<dependency, 1> bms, + small_vector<test_dependency, 1> ts, build_class_exprs bs, build_constraints_type bc, optional<path> lc, @@ -107,8 +105,6 @@ namespace brep dependencies (move (dp)), requirements (move (rq)), tests (move (ts)), - examples (move (es)), - benchmarks (move (bms)), builds (move (bs)), build_constraints (move (bc)), internal_repository (move (rp)), diff --git a/libbrep/package.hxx b/libbrep/package.hxx index 0ab8413..e249573 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, open) namespace brep { @@ -181,6 +181,30 @@ namespace brep #pragma db value(requirement_alternatives) definition + // tests + // + using bpkg::test_dependency_type; + using bpkg::to_test_dependency_type; + + #pragma db map type(test_dependency_type) as(string) \ + to(to_string (?)) \ + from(brep::to_test_dependency_type (?)) + + #pragma db value + struct test_dependency: dependency + { + test_dependency_type type; + + test_dependency () = default; + test_dependency (package_name n, + test_dependency_type t, + optional<version_constraint> c) + : dependency {std::move (n), std::move (c), nullptr /* package */}, + type (t) + { + } + }; + // certificate // #pragma db value @@ -386,9 +410,7 @@ namespace brep optional<email_type> build_error_email, dependencies_type, requirements_type, - small_vector<dependency, 1> tests, - small_vector<dependency, 1> examples, - small_vector<dependency, 1> benchmarks, + small_vector<test_dependency, 1> tests, build_class_exprs, build_constraints_type, optional<path> location, @@ -459,9 +481,7 @@ namespace brep optional<email_type> build_error_email; dependencies_type dependencies; requirements_type requirements; - 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. + small_vector<test_dependency, 1> tests; // Note: foreign-mapped in build. build_class_exprs builds; // Note: foreign-mapped in build. build_constraints_type build_constraints; // Note: foreign-mapped in build. @@ -563,14 +583,9 @@ namespace brep set(odb::nested_set (this.requirements, std::move (?))) \ id_column("") key_column("") value_column("id") - // tests, examples, benchmarks - // - // Seeing that these reuse the dependency types, we are also going to - // have identical database mapping. + // tests // - #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(tests) id_column("") value_column("test_") // builds // diff --git a/libbrep/package.xml b/libbrep/package.xml index 12ae36e..e650555 100644 --- a/libbrep/package.xml +++ b/libbrep/package.xml @@ -1,4 +1,78 @@ <changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" schema-name="package" version="1"> + <changeset version="19"> + <alter-table name="package_tests"> + <add-column name="test_name" type="CITEXT" null="false"/> + <add-column name="test_min_version_epoch" type="INTEGER" null="true"/> + <add-column name="test_min_version_canonical_upstream" type="TEXT" null="true"/> + <add-column name="test_min_version_canonical_release" type="TEXT" null="true"/> + <add-column name="test_min_version_revision" type="INTEGER" null="true"/> + <add-column name="test_min_version_upstream" type="TEXT" null="true"/> + <add-column name="test_min_version_release" type="TEXT" null="true"/> + <add-column name="test_max_version_epoch" type="INTEGER" null="true"/> + <add-column name="test_max_version_canonical_upstream" type="TEXT" null="true"/> + <add-column name="test_max_version_canonical_release" type="TEXT" null="true"/> + <add-column name="test_max_version_revision" type="INTEGER" null="true"/> + <add-column name="test_max_version_upstream" type="TEXT" null="true"/> + <add-column name="test_max_version_release" type="TEXT" null="true"/> + <add-column name="test_min_open" type="BOOLEAN" null="true"/> + <add-column name="test_max_open" type="BOOLEAN" null="true"/> + <add-column name="test_package_tenant" type="TEXT" null="true"/> + <add-column name="test_package_name" type="CITEXT" null="true"/> + <add-column name="test_package_version_epoch" type="INTEGER" null="true"/> + <add-column name="test_package_version_canonical_upstream" type="TEXT" null="true"/> + <add-column name="test_package_version_canonical_release" type="TEXT" null="true" options="COLLATE "C""/> + <add-column name="test_package_version_revision" type="INTEGER" null="true"/> + <add-column name="test_type" type="TEXT" null="false"/> + <add-foreign-key name="test_package_tenant_fk" deferrable="DEFERRED"> + <column name="test_package_tenant"/> + <references table="tenant"> + <column name="id"/> + </references> + </add-foreign-key> + <add-foreign-key name="test_package_fk" deferrable="DEFERRED"> + <column name="test_package_tenant"/> + <column name="test_package_name"/> + <column name="test_package_version_epoch"/> + <column name="test_package_version_canonical_upstream"/> + <column name="test_package_version_canonical_release"/> + <column name="test_package_version_revision"/> + <references table="package"> + <column name="tenant"/> + <column name="name"/> + <column name="version_epoch"/> + <column name="version_canonical_upstream"/> + <column name="version_canonical_release"/> + <column name="version_revision"/> + </references> + </add-foreign-key> + <drop-foreign-key name="dep_package_tenant_fk"/> + <drop-foreign-key name="dep_package_fk"/> + <drop-column name="dep_name"/> + <drop-column name="dep_min_version_epoch"/> + <drop-column name="dep_min_version_canonical_upstream"/> + <drop-column name="dep_min_version_canonical_release"/> + <drop-column name="dep_min_version_revision"/> + <drop-column name="dep_min_version_upstream"/> + <drop-column name="dep_min_version_release"/> + <drop-column name="dep_max_version_epoch"/> + <drop-column name="dep_max_version_canonical_upstream"/> + <drop-column name="dep_max_version_canonical_release"/> + <drop-column name="dep_max_version_revision"/> + <drop-column name="dep_max_version_upstream"/> + <drop-column name="dep_max_version_release"/> + <drop-column name="dep_min_open"/> + <drop-column name="dep_max_open"/> + <drop-column name="dep_package_tenant"/> + <drop-column name="dep_package_name"/> + <drop-column name="dep_package_version_epoch"/> + <drop-column name="dep_package_version_canonical_upstream"/> + <drop-column name="dep_package_version_canonical_release"/> + <drop-column name="dep_package_version_revision"/> + </alter-table> + <drop-table name="package_examples"/> + <drop-table name="package_benchmarks"/> + </changeset> + <changeset version="18"> <alter-table name="package"> <add-column name="unbuildable_reason" type="TEXT" null="true"/> |