diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-07-06 20:28:22 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-07-10 21:38:45 +0300 |
commit | 4b9be1cb87c4759ca08aa89acd9e9fd7ba5b18be (patch) | |
tree | 6a591f70c02cee552d6b97abc5d8b3958acb168d /libbrep/build-package.hxx | |
parent | 6a2e318a38ec57c61a6c1b9a11cdf96dffe5a63e (diff) |
Add support for build include/exclude manifest values
Diffstat (limited to 'libbrep/build-package.hxx')
-rw-r--r-- | libbrep/build-package.hxx | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/libbrep/build-package.hxx b/libbrep/build-package.hxx index 8bc703a..324303d 100644 --- a/libbrep/build-package.hxx +++ b/libbrep/build-package.hxx @@ -23,7 +23,7 @@ namespace brep // The mapping is established in build-extra.sql. We also explicitly mark // non-primary key foreign-mapped members in the source object. // - // Foreign object that is mapped to the subset of repository object. + // Foreign object that is mapped to a subset of repository object. // #pragma db object table("build_repository") pointer(shared_ptr) readonly class build_repository @@ -46,7 +46,18 @@ namespace brep build_repository () = default; }; - // Foreign object that is mapped to the subset of package object. + // "Foreign" value type that is mapped to a subset of the build_constraint + // value type (see libbpkg/manifest.hxx for details). + // + #pragma db value + struct build_constraint_subset + { + bool exclusion; + string config; + optional<string> target; + }; + + // Foreign object that is mapped to a subset of package object. // #pragma db object table("build_package") pointer(shared_ptr) readonly class build_package @@ -56,10 +67,16 @@ namespace brep upstream_version version; lazy_shared_ptr<build_repository> internal_repository; + // Mapped to a subset of the package object build_constraints member + // using the PostgreSQL foreign table mechanism. + // + vector<build_constraint_subset> constraints; + // Database mapping. // #pragma db member(id) id column("") #pragma db member(version) set(this.version.init (this.id.version, (?))) + #pragma db member(constraints) id_column("") value_column("") private: friend class odb::access; @@ -102,6 +119,27 @@ namespace brep // #pragma db member(result) column("count(" + build_package::id.name + ")") }; + + // Packages that have the build constraints. Note that only buildable + // (internal and non-stub) packages can have such constraints, so there is + // no need for additional checks. + // + #pragma db view \ + table("build_package_constraints" = "c") \ + object(build_package = package inner: \ + "c.exclusion AND " \ + "c.name = " + package::id.name + "AND" + \ + "c.version_epoch = " + package::id.version.epoch + "AND" + \ + "c.version_canonical_upstream = " + \ + package::id.version.canonical_upstream + "AND" + \ + "c.version_canonical_release = " + \ + package::id.version.canonical_release + "AND" + \ + "c.version_revision = " + package::id.version.revision) \ + query(distinct) + struct build_constrained_package + { + shared_ptr<build_package> package; + }; } #endif // LIBBREP_BUILD_PACKAGE_HXX |