From d4aef182ebc55091c02659b7549487d928eaec28 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 27 Feb 2019 23:06:46 +0300 Subject: Build packages for different toolchains having same version but different names --- libbrep/build.cxx | 6 +- libbrep/build.hxx | 47 ++++--- libbrep/build.xml | 13 +- libbrep/package.hxx | 11 +- libbrep/package.xml | 357 +++++++++++++++++++++++----------------------------- 5 files changed, 200 insertions(+), 234 deletions(-) (limited to 'libbrep') diff --git a/libbrep/build.cxx b/libbrep/build.cxx index 8f075dc..45ef678 100644 --- a/libbrep/build.cxx +++ b/libbrep/build.cxx @@ -63,12 +63,14 @@ namespace brep optional afp, optional ach, string mnm, string msm, butl::target_triplet trg) - : id (package_id (move (tnt), move (pnm), pvr), move (cfg), tvr), + : id (package_id (move (tnt), move (pnm), pvr), + move (cfg), + move (tnm), tvr), tenant (id.package.tenant), package_name (id.package.name), package_version (move (pvr)), configuration (id.configuration), - toolchain_name (move (tnm)), + toolchain_name (id.toolchain_name), toolchain_version (move (tvr)), state (build_state::building), timestamp (timestamp_type::clock::now ()), diff --git a/libbrep/build.hxx b/libbrep/build.hxx index 7fa8b47..9fbf983 100644 --- a/libbrep/build.hxx +++ b/libbrep/build.hxx @@ -24,9 +24,9 @@ // Used by the data migration entries. // -#define LIBBREP_BUILD_SCHEMA_VERSION_BASE 4 +#define LIBBREP_BUILD_SCHEMA_VERSION_BASE 7 -#pragma db model version(LIBBREP_BUILD_SCHEMA_VERSION_BASE, 6, closed) +#pragma db model version(LIBBREP_BUILD_SCHEMA_VERSION_BASE, 7, 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 @@ -44,12 +44,14 @@ namespace brep { package_id package; string configuration; + string toolchain_name; canonical_version toolchain_version; build_id () = default; - build_id (package_id p, string c, const brep::version& v) + build_id (package_id p, string c, string n, const brep::version& v) : package (move (p)), configuration (move (c)), + toolchain_name (move (n)), toolchain_version { v.epoch, v.canonical_upstream, v.canonical_release, v.revision} {} }; @@ -63,35 +65,42 @@ namespace brep if (int r = x.configuration.compare (y.configuration)) return r < 0; + if (int r = x.toolchain_name.compare (y.toolchain_name)) + return r < 0; + return compare_version_lt (x.toolchain_version, y.toolchain_version, true); } - // These allow comparing objects that have package, configuration and - // toolchain_version data members to build_id values. The idea is that this - // works for both query members of build id types as well as for values of - // the build_id type. + // These allow comparing objects that have package, configuration, + // toolchain_name, and toolchain_version data members to build_id values. + // The idea is that this works for both query members of build id types as + // well as for values of the build_id type. // template inline auto operator== (const T& x, const build_id& y) - -> decltype (x.package == y.package && - x.configuration == y.configuration && + -> decltype (x.package == y.package && + x.configuration == y.configuration && + x.toolchain_name == y.toolchain_name && x.toolchain_version.epoch == y.toolchain_version.epoch) { - return x.package == y.package && - x.configuration == y.configuration && + return x.package == y.package && + x.configuration == y.configuration && + x.toolchain_name == y.toolchain_name && compare_version_eq (x.toolchain_version, y.toolchain_version, true); } template inline auto operator!= (const T& x, const build_id& y) - -> decltype (x.package == y.package && - x.configuration == y.configuration && + -> decltype (x.package == y.package && + x.configuration == y.configuration && + x.toolchain_name == y.toolchain_name && x.toolchain_version.epoch == y.toolchain_version.epoch) { - return x.package != y.package || - x.configuration != y.configuration || + return x.package != y.package || + x.configuration != y.configuration || + x.toolchain_name != y.toolchain_name || compare_version_ne (x.toolchain_version, y.toolchain_version, true); } @@ -189,7 +198,7 @@ namespace brep package_name_type& package_name; // Tracks id.package.name. upstream_version package_version; // Original of id.package.version. string& configuration; // Tracks id.configuration. - string toolchain_name; + string& toolchain_name; // Tracks id.toolchain_name. upstream_version toolchain_version; // Original of id.toolchain_version. build_state state; @@ -229,6 +238,7 @@ namespace brep #pragma db member(package_version) \ set(this.package_version.init (this.id.package.version, (?))) #pragma db member(configuration) transient + #pragma db member(toolchain_name) transient #pragma db member(toolchain_version) \ set(this.toolchain_version.init (this.id.toolchain_version, (?))) @@ -246,7 +256,8 @@ namespace brep build () : tenant (id.package.tenant), package_name (id.package.name), - configuration (id.configuration) + configuration (id.configuration), + toolchain_name (id.toolchain_name) { } }; @@ -264,7 +275,7 @@ namespace brep // Database mapping. Note that the version member must be loaded after // the virtual members since the version_ member must filled by that time. // - #pragma db member(name) column(build::toolchain_name) + #pragma db member(name) column(build::id.toolchain_name) #pragma db member(version) column(build::toolchain_version) \ set(this.version.init (this.version_, (?))) diff --git a/libbrep/build.xml b/libbrep/build.xml index 434eac2..2f8a8a9 100644 --- a/libbrep/build.xml +++ b/libbrep/build.xml @@ -1,9 +1,5 @@ - - - - - + @@ -12,13 +8,13 @@ + - @@ -38,6 +34,7 @@ + @@ -52,6 +49,7 @@ + @@ -68,6 +66,7 @@ + @@ -80,6 +79,7 @@ + @@ -94,6 +94,7 @@ + diff --git a/libbrep/package.hxx b/libbrep/package.hxx index 11e7fdf..2f293c1 100644 --- a/libbrep/package.hxx +++ b/libbrep/package.hxx @@ -19,7 +19,7 @@ // Used by the data migration entries. // -#define LIBBREP_PACKAGE_SCHEMA_VERSION_BASE 7 +#define LIBBREP_PACKAGE_SCHEMA_VERSION_BASE 11 #pragma db model version(LIBBREP_PACKAGE_SCHEMA_VERSION_BASE, 11, closed) @@ -298,15 +298,6 @@ namespace brep repository (): tenant (id.tenant), canonical_name (id.canonical_name) {} }; - // Used for data migration (see migrate/migrate.cxx for details). - // - #pragma db view object(repository) query(distinct) - struct repository_tenant - { - #pragma db column("tenant") - string id; - }; - // The 'to' expression calls the PostgreSQL to_tsvector(weighted_text) // function overload (package-extra.sql). Since we are only interested // in "write-only" members of this type, make the 'from' expression diff --git a/libbrep/package.xml b/libbrep/package.xml index e90a3a1..8ba96ec 100644 --- a/libbrep/package.xml +++ b/libbrep/package.xml @@ -1,208 +1,13 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
@@ -229,6 +34,12 @@ + + + + + +
@@ -236,6 +47,12 @@ + + + + + + @@ -251,6 +68,12 @@ + + + + + + @@ -266,6 +89,12 @@ + + + + + + @@ -281,6 +110,12 @@ + + + + + + @@ -319,6 +154,10 @@ + + + + @@ -333,6 +172,18 @@ + + + + + + + + + + + + @@ -354,6 +205,12 @@ + + + + + + @@ -392,6 +249,12 @@ + + + + + + @@ -426,6 +289,12 @@ + + + + + + @@ -465,6 +334,12 @@ + + + + + + @@ -523,6 +398,12 @@ + + + + + + @@ -547,6 +428,12 @@ + + + + + + @@ -575,6 +462,12 @@ + + + + + + @@ -613,6 +506,12 @@ + + + + + + @@ -638,6 +537,50 @@
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
@@ -650,6 +593,12 @@ + + + + + + @@ -688,6 +637,12 @@ + + + + + + @@ -715,6 +670,12 @@ + + + + + + -- cgit v1.1