aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbrep/build.cxx6
-rw-r--r--libbrep/build.hxx47
-rw-r--r--libbrep/build.xml13
-rw-r--r--libbrep/package.hxx11
-rw-r--r--libbrep/package.xml357
-rw-r--r--migrate/migrate.cxx13
-rw-r--r--mod/build.cxx7
-rw-r--r--mod/mod-build-force.cxx18
-rw-r--r--mod/mod-build-log.cxx16
-rw-r--r--mod/mod-build-result.cxx26
-rw-r--r--mod/mod-build-task.cxx16
-rw-r--r--mod/mod-builds.cxx7
-rw-r--r--mod/options.cli6
13 files changed, 272 insertions, 271 deletions
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<string> afp, optional<string> 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 <typename T>
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 <typename T>
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 @@
<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" schema-name="build" version="1">
- <changeset version="6"/>
-
- <changeset version="5"/>
-
- <model version="4">
+ <model version="7">
<table name="build" kind="object">
<column name="package_tenant" type="TEXT" null="false"/>
<column name="package_name" type="CITEXT" null="false"/>
@@ -12,13 +8,13 @@
<column name="package_version_canonical_release" type="TEXT" null="false" options="COLLATE &quot;C&quot;"/>
<column name="package_version_revision" type="INTEGER" null="false"/>
<column name="configuration" type="TEXT" null="false"/>
+ <column name="toolchain_name" type="TEXT" null="false"/>
<column name="toolchain_version_epoch" type="INTEGER" null="false"/>
<column name="toolchain_version_canonical_upstream" type="TEXT" null="false"/>
<column name="toolchain_version_canonical_release" type="TEXT" null="false" options="COLLATE &quot;C&quot;"/>
<column name="toolchain_version_revision" type="INTEGER" null="false"/>
<column name="package_version_upstream" type="TEXT" null="false"/>
<column name="package_version_release" type="TEXT" null="true"/>
- <column name="toolchain_name" type="TEXT" null="false"/>
<column name="toolchain_version_upstream" type="TEXT" null="false"/>
<column name="toolchain_version_release" type="TEXT" null="true"/>
<column name="state" type="TEXT" null="false"/>
@@ -38,6 +34,7 @@
<column name="package_version_canonical_release"/>
<column name="package_version_revision"/>
<column name="configuration"/>
+ <column name="toolchain_name"/>
<column name="toolchain_version_epoch"/>
<column name="toolchain_version_canonical_upstream"/>
<column name="toolchain_version_canonical_release"/>
@@ -52,6 +49,7 @@
<column name="package_version_canonical_release" type="TEXT" null="false" options="COLLATE &quot;C&quot;"/>
<column name="package_version_revision" type="INTEGER" null="false"/>
<column name="configuration" type="TEXT" null="false"/>
+ <column name="toolchain_name" type="TEXT" null="false"/>
<column name="toolchain_version_epoch" type="INTEGER" null="false"/>
<column name="toolchain_version_canonical_upstream" type="TEXT" null="false"/>
<column name="toolchain_version_canonical_release" type="TEXT" null="false" options="COLLATE &quot;C&quot;"/>
@@ -68,6 +66,7 @@
<column name="package_version_canonical_release"/>
<column name="package_version_revision"/>
<column name="configuration"/>
+ <column name="toolchain_name"/>
<column name="toolchain_version_epoch"/>
<column name="toolchain_version_canonical_upstream"/>
<column name="toolchain_version_canonical_release"/>
@@ -80,6 +79,7 @@
<column name="package_version_canonical_release"/>
<column name="package_version_revision"/>
<column name="configuration"/>
+ <column name="toolchain_name"/>
<column name="toolchain_version_epoch"/>
<column name="toolchain_version_canonical_upstream"/>
<column name="toolchain_version_canonical_release"/>
@@ -94,6 +94,7 @@
<column name="package_version_canonical_release"/>
<column name="package_version_revision"/>
<column name="configuration"/>
+ <column name="toolchain_name"/>
<column name="toolchain_version_epoch"/>
<column name="toolchain_version_canonical_upstream"/>
<column name="toolchain_version_canonical_release"/>
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 @@
<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" schema-name="package" version="1">
- <changeset version="11">
- <add-table name="package_builds" kind="container">
- <column name="tenant" type="TEXT" null="false"/>
- <column name="name" type="CITEXT" null="false"/>
- <column name="version_epoch" type="INTEGER" null="false"/>
- <column name="version_canonical_upstream" type="TEXT" null="false"/>
- <column name="version_canonical_release" type="TEXT" null="false" options="COLLATE &quot;C&quot;"/>
- <column name="version_revision" type="INTEGER" null="false"/>
- <column name="index" type="BIGINT" null="false"/>
- <column name="expression" type="TEXT" null="false"/>
- <column name="comment" type="TEXT" null="false"/>
- <foreign-key name="tenant_fk" deferrable="DEFERRED">
- <column name="tenant"/>
- <references table="tenant">
- <column name="id"/>
- </references>
- </foreign-key>
- <foreign-key name="object_id_fk" on-delete="CASCADE">
- <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 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>
- </foreign-key>
- <index name="package_builds_object_id_i">
- <column name="tenant"/>
- <column name="name"/>
- <column name="version_epoch"/>
- <column name="version_canonical_upstream"/>
- <column name="version_canonical_release"/>
- <column name="version_revision"/>
- </index>
- <index name="package_builds_index_i">
- <column name="index"/>
- </index>
- </add-table>
- </changeset>
-
- <changeset version="10">
- <alter-table name="package">
- <add-column name="build_warning_email" type="TEXT" null="true"/>
- <add-column name="build_warning_email_comment" type="TEXT" null="true"/>
- <add-column name="build_error_email" type="TEXT" null="true"/>
- <add-column name="build_error_email_comment" type="TEXT" null="true"/>
- </alter-table>
- </changeset>
-
- <changeset version="9">
- <add-table name="tenant" kind="object">
+ <model version="11">
+ <table name="tenant" kind="object">
<column name="id" type="TEXT" null="false"/>
<column name="creation_timestamp" type="BIGINT" null="false"/>
<column name="archived" type="BOOLEAN" null="false"/>
<primary-key>
<column name="id"/>
</primary-key>
- </add-table>
- <alter-table name="repository">
- <add-foreign-key name="tenant_fk" deferrable="DEFERRED">
- <column name="tenant"/>
- <references table="tenant">
- <column name="id"/>
- </references>
- </add-foreign-key>
- </alter-table>
- <alter-table name="repository_complements">
- <add-foreign-key name="repository_tenant_fk" deferrable="DEFERRED">
- <column name="repository_tenant"/>
- <references table="tenant">
- <column name="id"/>
- </references>
- </add-foreign-key>
- <add-foreign-key name="complement_tenant_fk" deferrable="DEFERRED">
- <column name="complement_tenant"/>
- <references table="tenant">
- <column name="id"/>
- </references>
- </add-foreign-key>
- </alter-table>
- <alter-table name="repository_prerequisites">
- <add-foreign-key name="repository_tenant_fk" deferrable="DEFERRED">
- <column name="repository_tenant"/>
- <references table="tenant">
- <column name="id"/>
- </references>
- </add-foreign-key>
- <add-foreign-key name="prerequisite_tenant_fk" deferrable="DEFERRED">
- <column name="prerequisite_tenant"/>
- <references table="tenant">
- <column name="id"/>
- </references>
- </add-foreign-key>
- </alter-table>
- <alter-table name="package">
- <add-foreign-key name="tenant_fk" deferrable="DEFERRED">
- <column name="tenant"/>
- <references table="tenant">
- <column name="id"/>
- </references>
- </add-foreign-key>
- <add-foreign-key name="internal_repository_tenant_fk" deferrable="DEFERRED">
- <column name="internal_repository_tenant"/>
- <references table="tenant">
- <column name="id"/>
- </references>
- </add-foreign-key>
- </alter-table>
- <alter-table name="package_license_alternatives">
- <add-foreign-key name="tenant_fk" deferrable="DEFERRED">
- <column name="tenant"/>
- <references table="tenant">
- <column name="id"/>
- </references>
- </add-foreign-key>
- </alter-table>
- <alter-table name="package_licenses">
- <add-foreign-key name="tenant_fk" deferrable="DEFERRED">
- <column name="tenant"/>
- <references table="tenant">
- <column name="id"/>
- </references>
- </add-foreign-key>
- </alter-table>
- <alter-table name="package_tags">
- <add-foreign-key name="tenant_fk" deferrable="DEFERRED">
- <column name="tenant"/>
- <references table="tenant">
- <column name="id"/>
- </references>
- </add-foreign-key>
- </alter-table>
- <alter-table name="package_dependencies">
- <add-foreign-key name="tenant_fk" deferrable="DEFERRED">
- <column name="tenant"/>
- <references table="tenant">
- <column name="id"/>
- </references>
- </add-foreign-key>
- </alter-table>
- <alter-table name="package_dependency_alternatives">
- <add-foreign-key name="tenant_fk" deferrable="DEFERRED">
- <column name="tenant"/>
- <references table="tenant">
- <column name="id"/>
- </references>
- </add-foreign-key>
- <add-foreign-key name="dep_package_tenant_fk" deferrable="DEFERRED">
- <column name="dep_package_tenant"/>
- <references table="tenant">
- <column name="id"/>
- </references>
- </add-foreign-key>
- </alter-table>
- <alter-table name="package_requirements">
- <add-foreign-key name="tenant_fk" deferrable="DEFERRED">
- <column name="tenant"/>
- <references table="tenant">
- <column name="id"/>
- </references>
- </add-foreign-key>
- </alter-table>
- <alter-table name="package_requirement_alternatives">
- <add-foreign-key name="tenant_fk" deferrable="DEFERRED">
- <column name="tenant"/>
- <references table="tenant">
- <column name="id"/>
- </references>
- </add-foreign-key>
- </alter-table>
- <alter-table name="package_build_constraints">
- <add-foreign-key name="tenant_fk" deferrable="DEFERRED">
- <column name="tenant"/>
- <references table="tenant">
- <column name="id"/>
- </references>
- </add-foreign-key>
- </alter-table>
- <alter-table name="package_other_repositories">
- <add-foreign-key name="tenant_fk" deferrable="DEFERRED">
- <column name="tenant"/>
- <references table="tenant">
- <column name="id"/>
- </references>
- </add-foreign-key>
- <add-foreign-key name="repository_tenant_fk" deferrable="DEFERRED">
- <column name="repository_tenant"/>
- <references table="tenant">
- <column name="id"/>
- </references>
- </add-foreign-key>
- </alter-table>
- </changeset>
-
- <changeset version="8"/>
-
- <model version="7">
+ </table>
<table name="repository" kind="object">
<column name="tenant" type="TEXT" null="false"/>
<column name="canonical_name" type="TEXT" null="false"/>
@@ -229,6 +34,12 @@
<column name="tenant"/>
<column name="canonical_name"/>
</primary-key>
+ <foreign-key name="tenant_fk" deferrable="DEFERRED">
+ <column name="tenant"/>
+ <references table="tenant">
+ <column name="id"/>
+ </references>
+ </foreign-key>
</table>
<table name="repository_complements" kind="container">
<column name="repository_tenant" type="TEXT" null="false"/>
@@ -236,6 +47,12 @@
<column name="index" type="BIGINT" null="false"/>
<column name="complement_tenant" type="TEXT" null="false"/>
<column name="complement_canonical_name" type="TEXT" null="false"/>
+ <foreign-key name="repository_tenant_fk" deferrable="DEFERRED">
+ <column name="repository_tenant"/>
+ <references table="tenant">
+ <column name="id"/>
+ </references>
+ </foreign-key>
<foreign-key name="repository_fk" on-delete="CASCADE">
<column name="repository_tenant"/>
<column name="repository_canonical_name"/>
@@ -251,6 +68,12 @@
<index name="repository_complements_index_i">
<column name="index"/>
</index>
+ <foreign-key name="complement_tenant_fk" deferrable="DEFERRED">
+ <column name="complement_tenant"/>
+ <references table="tenant">
+ <column name="id"/>
+ </references>
+ </foreign-key>
<foreign-key name="complement_fk" deferrable="DEFERRED">
<column name="complement_tenant"/>
<column name="complement_canonical_name"/>
@@ -266,6 +89,12 @@
<column name="index" type="BIGINT" null="false"/>
<column name="prerequisite_tenant" type="TEXT" null="false"/>
<column name="prerequisite_canonical_name" type="TEXT" null="false"/>
+ <foreign-key name="repository_tenant_fk" deferrable="DEFERRED">
+ <column name="repository_tenant"/>
+ <references table="tenant">
+ <column name="id"/>
+ </references>
+ </foreign-key>
<foreign-key name="repository_fk" on-delete="CASCADE">
<column name="repository_tenant"/>
<column name="repository_canonical_name"/>
@@ -281,6 +110,12 @@
<index name="repository_prerequisites_index_i">
<column name="index"/>
</index>
+ <foreign-key name="prerequisite_tenant_fk" deferrable="DEFERRED">
+ <column name="prerequisite_tenant"/>
+ <references table="tenant">
+ <column name="id"/>
+ </references>
+ </foreign-key>
<foreign-key name="prerequisite_fk" deferrable="DEFERRED">
<column name="prerequisite_tenant"/>
<column name="prerequisite_canonical_name"/>
@@ -319,6 +154,10 @@
<column name="package_email_comment" type="TEXT" null="true"/>
<column name="build_email" type="TEXT" null="true"/>
<column name="build_email_comment" type="TEXT" null="true"/>
+ <column name="build_warning_email" type="TEXT" null="true"/>
+ <column name="build_warning_email_comment" type="TEXT" null="true"/>
+ <column name="build_error_email" type="TEXT" null="true"/>
+ <column name="build_error_email_comment" type="TEXT" null="true"/>
<column name="internal_repository_tenant" type="TEXT" null="true"/>
<column name="internal_repository_canonical_name" type="TEXT" null="true"/>
<column name="location" type="TEXT" null="true"/>
@@ -333,6 +172,18 @@
<column name="version_canonical_release"/>
<column name="version_revision"/>
</primary-key>
+ <foreign-key name="tenant_fk" deferrable="DEFERRED">
+ <column name="tenant"/>
+ <references table="tenant">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <foreign-key name="internal_repository_tenant_fk" deferrable="DEFERRED">
+ <column name="internal_repository_tenant"/>
+ <references table="tenant">
+ <column name="id"/>
+ </references>
+ </foreign-key>
<foreign-key name="internal_repository_fk" deferrable="DEFERRED">
<column name="internal_repository_tenant"/>
<column name="internal_repository_canonical_name"/>
@@ -354,6 +205,12 @@
<column name="version_revision" type="INTEGER" null="false"/>
<column name="index" type="BIGINT" null="false"/>
<column name="comment" type="TEXT" null="false"/>
+ <foreign-key name="tenant_fk" deferrable="DEFERRED">
+ <column name="tenant"/>
+ <references table="tenant">
+ <column name="id"/>
+ </references>
+ </foreign-key>
<foreign-key name="object_id_fk" on-delete="CASCADE">
<column name="tenant"/>
<column name="name"/>
@@ -392,6 +249,12 @@
<column name="alternative_index" type="BIGINT" null="false"/>
<column name="index" type="BIGINT" null="false"/>
<column name="license" type="TEXT" null="false"/>
+ <foreign-key name="tenant_fk" deferrable="DEFERRED">
+ <column name="tenant"/>
+ <references table="tenant">
+ <column name="id"/>
+ </references>
+ </foreign-key>
<foreign-key name="object_id_fk" on-delete="CASCADE">
<column name="tenant"/>
<column name="name"/>
@@ -426,6 +289,12 @@
<column name="version_revision" type="INTEGER" null="false"/>
<column name="index" type="BIGINT" null="false"/>
<column name="tag" type="TEXT" null="false"/>
+ <foreign-key name="tenant_fk" deferrable="DEFERRED">
+ <column name="tenant"/>
+ <references table="tenant">
+ <column name="id"/>
+ </references>
+ </foreign-key>
<foreign-key name="object_id_fk" on-delete="CASCADE">
<column name="tenant"/>
<column name="name"/>
@@ -465,6 +334,12 @@
<column name="conditional" type="BOOLEAN" null="false"/>
<column name="buildtime" type="BOOLEAN" null="false"/>
<column name="comment" type="TEXT" null="false"/>
+ <foreign-key name="tenant_fk" deferrable="DEFERRED">
+ <column name="tenant"/>
+ <references table="tenant">
+ <column name="id"/>
+ </references>
+ </foreign-key>
<foreign-key name="object_id_fk" on-delete="CASCADE">
<column name="tenant"/>
<column name="name"/>
@@ -523,6 +398,12 @@
<column name="dep_package_version_canonical_upstream" type="TEXT" null="true"/>
<column name="dep_package_version_canonical_release" type="TEXT" null="true" options="COLLATE &quot;C&quot;"/>
<column name="dep_package_version_revision" type="INTEGER" null="true"/>
+ <foreign-key name="tenant_fk" deferrable="DEFERRED">
+ <column name="tenant"/>
+ <references table="tenant">
+ <column name="id"/>
+ </references>
+ </foreign-key>
<foreign-key name="object_id_fk" on-delete="CASCADE">
<column name="tenant"/>
<column name="name"/>
@@ -547,6 +428,12 @@
<column name="version_canonical_release"/>
<column name="version_revision"/>
</index>
+ <foreign-key name="dep_package_tenant_fk" deferrable="DEFERRED">
+ <column name="dep_package_tenant"/>
+ <references table="tenant">
+ <column name="id"/>
+ </references>
+ </foreign-key>
<foreign-key name="dep_package_fk" deferrable="DEFERRED">
<column name="dep_package_tenant"/>
<column name="dep_package_name"/>
@@ -575,6 +462,12 @@
<column name="conditional" type="BOOLEAN" null="false"/>
<column name="buildtime" type="BOOLEAN" null="false"/>
<column name="comment" type="TEXT" null="false"/>
+ <foreign-key name="tenant_fk" deferrable="DEFERRED">
+ <column name="tenant"/>
+ <references table="tenant">
+ <column name="id"/>
+ </references>
+ </foreign-key>
<foreign-key name="object_id_fk" on-delete="CASCADE">
<column name="tenant"/>
<column name="name"/>
@@ -613,6 +506,12 @@
<column name="requirement_index" type="BIGINT" null="false"/>
<column name="index" type="BIGINT" null="false"/>
<column name="id" type="TEXT" null="false"/>
+ <foreign-key name="tenant_fk" deferrable="DEFERRED">
+ <column name="tenant"/>
+ <references table="tenant">
+ <column name="id"/>
+ </references>
+ </foreign-key>
<foreign-key name="object_id_fk" on-delete="CASCADE">
<column name="tenant"/>
<column name="name"/>
@@ -638,6 +537,50 @@
<column name="version_revision"/>
</index>
</table>
+ <table name="package_builds" kind="container">
+ <column name="tenant" type="TEXT" null="false"/>
+ <column name="name" type="CITEXT" null="false"/>
+ <column name="version_epoch" type="INTEGER" null="false"/>
+ <column name="version_canonical_upstream" type="TEXT" null="false"/>
+ <column name="version_canonical_release" type="TEXT" null="false" options="COLLATE &quot;C&quot;"/>
+ <column name="version_revision" type="INTEGER" null="false"/>
+ <column name="index" type="BIGINT" null="false"/>
+ <column name="expression" type="TEXT" null="false"/>
+ <column name="comment" type="TEXT" null="false"/>
+ <foreign-key name="tenant_fk" deferrable="DEFERRED">
+ <column name="tenant"/>
+ <references table="tenant">
+ <column name="id"/>
+ </references>
+ </foreign-key>
+ <foreign-key name="object_id_fk" on-delete="CASCADE">
+ <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 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>
+ </foreign-key>
+ <index name="package_builds_object_id_i">
+ <column name="tenant"/>
+ <column name="name"/>
+ <column name="version_epoch"/>
+ <column name="version_canonical_upstream"/>
+ <column name="version_canonical_release"/>
+ <column name="version_revision"/>
+ </index>
+ <index name="package_builds_index_i">
+ <column name="index"/>
+ </index>
+ </table>
<table name="package_build_constraints" kind="container">
<column name="tenant" type="TEXT" null="false"/>
<column name="name" type="CITEXT" null="false"/>
@@ -650,6 +593,12 @@
<column name="config" type="TEXT" null="false"/>
<column name="target" type="TEXT" null="true"/>
<column name="comment" type="TEXT" null="false"/>
+ <foreign-key name="tenant_fk" deferrable="DEFERRED">
+ <column name="tenant"/>
+ <references table="tenant">
+ <column name="id"/>
+ </references>
+ </foreign-key>
<foreign-key name="object_id_fk" on-delete="CASCADE">
<column name="tenant"/>
<column name="name"/>
@@ -688,6 +637,12 @@
<column name="index" type="BIGINT" null="false"/>
<column name="repository_tenant" type="TEXT" null="false"/>
<column name="repository_canonical_name" type="TEXT" null="false"/>
+ <foreign-key name="tenant_fk" deferrable="DEFERRED">
+ <column name="tenant"/>
+ <references table="tenant">
+ <column name="id"/>
+ </references>
+ </foreign-key>
<foreign-key name="object_id_fk" on-delete="CASCADE">
<column name="tenant"/>
<column name="name"/>
@@ -715,6 +670,12 @@
<index name="package_other_repositories_index_i">
<column name="index"/>
</index>
+ <foreign-key name="repository_tenant_fk" deferrable="DEFERRED">
+ <column name="repository_tenant"/>
+ <references table="tenant">
+ <column name="id"/>
+ </references>
+ </foreign-key>
<foreign-key name="repository_fk" deferrable="DEFERRED">
<column name="repository_tenant"/>
<column name="repository_canonical_name"/>
diff --git a/migrate/migrate.cxx b/migrate/migrate.cxx
index a3c15e8..feec1ea 100644
--- a/migrate/migrate.cxx
+++ b/migrate/migrate.cxx
@@ -207,6 +207,7 @@ create (database& db, bool extra_only) const
// Register the data migration functions for the package database schema.
//
+#if 0
template <schema_version v>
using package_migration_entry_base =
data_migration_entry<v, LIBBREP_PACKAGE_SCHEMA_VERSION_BASE>;
@@ -218,17 +219,11 @@ struct package_migration_entry: package_migration_entry_base<v>
: package_migration_entry_base<v> (f, "package") {}
};
-// Don't forget to drop the repository_tenant view when stop supporting data
-// migration for this schema version.
-//
-static const package_migration_entry<9>
-package_migrate_v9 ([] (database& db)
+static const package_migration_entry<12>
+package_migrate_v12 ([] (database&)
{
- // Add tenant objects.
- //
- for (const auto& t: db.query<repository_tenant> ())
- db.persist (tenant (t.id));
});
+#endif
// main() function
//
diff --git a/mod/build.cxx b/mod/build.cxx
index fb23667..32f3691 100644
--- a/mod/build.cxx
+++ b/mod/build.cxx
@@ -24,7 +24,8 @@ namespace brep
string url (host + tenant_dir (root, b.tenant).representation () +
mime_url_encode (b.package_name.string (), false) + '/' +
b.package_version.string () + "/log/" +
- mime_url_encode (b.configuration, false) + '/' +
+ mime_url_encode (b.configuration, false /* query */) + '/' +
+ mime_url_encode (b.toolchain_name, false /* query */) + '/' +
b.toolchain_version.string ());
if (op != nullptr)
@@ -48,6 +49,8 @@ namespace brep
"?build-force&pn=" + mime_url_encode (b.package_name.string ()) +
"&pv=" + b.package_version.string () +
"&cf=" + mime_url_encode (b.configuration) +
- "&tc=" + b.toolchain_version.string () + "&reason=";
+ "&tn=" + mime_url_encode (b.toolchain_name) +
+ "&tv=" + b.toolchain_version.string () +
+ "&reason=";
}
}
diff --git a/mod/mod-build-force.cxx b/mod/mod-build-force.cxx
index f94cf75..2c6ac64 100644
--- a/mod/mod-build-force.cxx
+++ b/mod/mod-build-force.cxx
@@ -118,16 +118,22 @@ handle (request& rq, response& rs)
version package_version (parse_version (params.version (),
"package version"));
- version toolchain_version (parse_version (params.toolchain_version (),
- "toolchain version"));
+ string& config (params.configuration ());
- string& c (params.configuration ());
-
- if (c.empty ())
+ if (config.empty ())
throw invalid_argument ("no configuration name");
+ string& toolchain_name (params.toolchain_name ());
+
+ if (toolchain_name.empty ())
+ throw invalid_argument ("no toolchain name");
+
+ version toolchain_version (parse_version (params.toolchain_version (),
+ "toolchain version"));
+
id = build_id (package_id (move (tenant), move (p), package_version),
- move (c),
+ move (config),
+ move (toolchain_name),
toolchain_version);
}
catch (const invalid_argument& e)
diff --git a/mod/mod-build-log.cxx b/mod/mod-build-log.cxx
index 3dac599..c61ad92 100644
--- a/mod/mod-build-log.cxx
+++ b/mod/mod-build-log.cxx
@@ -66,13 +66,12 @@ handle (request& rq, response& rs)
throw invalid_request (501, "not implemented");
// Parse the HTTP request URL path (without the root directory) to obtain
- // the build package name/version, the configuration name and the optional
- // operation name. If the operation is not specified then print logs for all
- // the operations.
+ // the build id and optional operation name. If the operation is not
+ // specified then print logs for all the operations.
//
// Note that the URL path must be in the following form:
//
- // <pkg-name>/<pkg-version>/log/<cfg-name>/<toolchain-version>[/<operation>]
+ // <pkg-name>/<pkg-version>/log/<cfg-name>/<toolchain-name>/<toolchain-version>[/<operation>]
//
// Also note that the presence of the first 3 components is guaranteed by
// the repository_root module.
@@ -136,12 +135,21 @@ handle (request& rq, response& rs)
throw invalid_argument ("empty configuration name");
if (i == lpath.end ())
+ throw invalid_argument ("no toolchain name");
+
+ string toolchain_name (*i++);
+
+ if (toolchain_name.empty ())
+ throw invalid_argument ("empty toolchain name");
+
+ if (i == lpath.end ())
throw invalid_argument ("no toolchain version");
version toolchain_version (parse_version (*i++, "toolchain version"));
id = build_id (package_id (tenant, move (name), package_version),
move (config),
+ move (toolchain_name),
toolchain_version);
if (i != lpath.end ())
diff --git a/mod/mod-build-result.cxx b/mod/mod-build-result.cxx
index 1052b0a..18dc146 100644
--- a/mod/mod-build-result.cxx
+++ b/mod/mod-build-result.cxx
@@ -109,9 +109,9 @@ handle (request& rq, response&)
throw invalid_request (400, e.what ());
}
- // Parse the task response session to obtain the build configuration name and
- // the timestamp, and to make sure the session matches tenant and the result
- // manifest's package name, and version.
+ // Parse the task response session to obtain the build id and the timestamp,
+ // and to make sure the session matches tenant and the result manifest's
+ // package name, and version.
//
build_id id;
timestamp session_timestamp;
@@ -173,10 +173,24 @@ handle (request& rq, response&)
p = s.find ('/', b); // End of configuration name.
if (p == string::npos)
- throw invalid_argument ("no toolchain version");
+ throw invalid_argument ("no toolchain name");
string config (s, b, p - b);
+ if (config.empty ())
+ throw invalid_argument ("empty configuration name");
+
+ b = p + 1; // Start of toolchain name.
+ p = s.find ('/', b); // End of toolchain name.
+
+ if (p == string::npos)
+ throw invalid_argument ("no toolchain version");
+
+ string toolchain_name (s, b, p - b);
+
+ if (toolchain_name.empty ())
+ throw invalid_argument ("empty toolchain name");
+
b = p + 1; // Start of toolchain version.
p = s.find ('/', b); // End of toolchain version.
@@ -187,11 +201,9 @@ handle (request& rq, response&)
id = build_id (package_id (move (tenant), move (name), package_version),
move (config),
+ move (toolchain_name),
toolchain_version);
- if (id.configuration.empty ())
- throw invalid_argument ("empty configuration name");
-
try
{
size_t tsn;
diff --git a/mod/mod-build-task.cxx b/mod/mod-build-task.cxx
index 79ab23b..27f884e 100644
--- a/mod/mod-build-task.cxx
+++ b/mod/mod-build-task.cxx
@@ -204,6 +204,7 @@ handle (request& rq, response& rs)
b->package_name.string () + '/' +
b->package_version.string () + '/' +
b->configuration + '/' +
+ b->toolchain_name + '/' +
b->toolchain_version.string () + '/' +
to_string (ts));
@@ -401,9 +402,11 @@ handle (request& rq, response& rs)
bld_query::id.configuration.in_range (cfg_names.begin (),
cfg_names.end ()) &&
+ bld_query::id.toolchain_name == tqm.toolchain_name &&
+
compare_version_eq (bld_query::id.toolchain_version,
toolchain_version,
- true) &&
+ true /* revision */) &&
(bld_query::state == "built" ||
((bld_query::force == "forcing" &&
@@ -489,7 +492,12 @@ handle (request& rq, response& rs)
{
config_machine& cm (i->second);
machine_header_manifest& mh (*cm.machine);
- build_id bid (move (id), cm.config->name, toolchain_version);
+
+ build_id bid (move (id),
+ cm.config->name,
+ move (tqm.toolchain_name),
+ toolchain_version);
+
shared_ptr<build> b (build_db_->find<build> (bid));
optional<string> cl (challenge ());
@@ -503,7 +511,7 @@ handle (request& rq, response& rs)
move (bid.package.name),
move (bp.version),
move (bid.configuration),
- move (tqm.toolchain_name),
+ move (bid.toolchain_name),
move (toolchain_version),
move (agent_fp),
move (cl),
@@ -540,7 +548,6 @@ handle (request& rq, response& rs)
if (b->force == force_state::forcing)
b->force = force_state::forced;
- b->toolchain_name = move (tqm.toolchain_name);
b->agent_fingerprint = move (agent_fp);
b->agent_challenge = move (cl);
b->machine = mh.name;
@@ -649,7 +656,6 @@ handle (request& rq, response& rs)
//
b->agent_fingerprint = agent_fp;
b->agent_challenge = cl;
- b->toolchain_name = tqm.toolchain_name;
const machine_header_manifest& mh (*cm.machine);
b->machine = mh.name;
diff --git a/mod/mod-builds.cxx b/mod/mod-builds.cxx
index 187f9b8..d7bebd0 100644
--- a/mod/mod-builds.cxx
+++ b/mod/mod-builds.cxx
@@ -149,8 +149,9 @@ build_query (const brep::cstrings* configs,
string tn (tc, 0, p);
version tv (string (tc, p + 1)); // May throw invalid_argument.
- q = q && qb::toolchain_name == tn &&
- compare_version_eq (qb::id.toolchain_version, tv, true);
+ q = q &&
+ qb::id.toolchain_name == tn &&
+ compare_version_eq (qb::id.toolchain_version, tv, true);
}
// Build configuration name.
@@ -358,7 +359,7 @@ handle (request& rq, response& rs)
toolchains r;
for (auto& t: build_db_->query<toolchain> (
(tn ? query::build::id.package.tenant == *tn : query (true)) +
- "ORDER BY" + query::build::toolchain_name +
+ "ORDER BY" + query::build::id.toolchain_name +
order_by_version_desc (query::build::id.toolchain_version, false)))
r.emplace_back (move (t.name), move (t.version));
diff --git a/mod/options.cli b/mod/options.cli
index ae7a00f..01309dc 100644
--- a/mod/options.cli
+++ b/mod/options.cli
@@ -665,9 +665,13 @@ namespace brep
//
string configuration | cf;
+ // Toolchain name.
+ //
+ string toolchain_name | tn;
+
// Toolchain version. May not be url-encoded (see above).
//
- string toolchain_version | tc;
+ string toolchain_version | tv;
// Package rebuild reason. Must not be empty.
//