aboutsummaryrefslogtreecommitdiff
path: root/libbrep
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-03-29 21:13:23 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-04-01 17:45:55 +0300
commit6cb77d97d659441036fac18af6479eeac4127dcb (patch)
tree47e43d9919a0b90b45e76da1f46e0b736e1a3633 /libbrep
parent2b5bea3871d0ccc1b7da32929f195dc161bcc1ec (diff)
Stash build toolchain in tenant object
Diffstat (limited to 'libbrep')
-rw-r--r--libbrep/build-extra.sql9
-rw-r--r--libbrep/build-package.hxx1
-rw-r--r--libbrep/build.hxx2
-rw-r--r--libbrep/build.xml2
-rw-r--r--libbrep/common.hxx9
-rw-r--r--libbrep/package.hxx23
-rw-r--r--libbrep/package.xml12
7 files changed, 55 insertions, 3 deletions
diff --git a/libbrep/build-extra.sql b/libbrep/build-extra.sql
index 374cf73..a931f31 100644
--- a/libbrep/build-extra.sql
+++ b/libbrep/build-extra.sql
@@ -44,7 +44,14 @@ CREATE FOREIGN TABLE build_tenant (
service_id TEXT NULL,
service_type TEXT NULL,
service_data TEXT NULL,
- queued_timestamp BIGINT NULL)
+ queued_timestamp BIGINT NULL,
+ toolchain_name TEXT OPTIONS (column_name 'build_toolchain_name') NULL,
+ toolchain_version_epoch INTEGER OPTIONS (column_name 'build_toolchain_version_epoch') NULL,
+ toolchain_version_canonical_upstream TEXT OPTIONS (column_name 'build_toolchain_version_canonical_upstream') NULL,
+ toolchain_version_canonical_release TEXT OPTIONS (column_name 'build_toolchain_version_canonical_release') NULL,
+ toolchain_version_revision INTEGER OPTIONS (column_name 'build_toolchain_version_revision') NULL,
+ toolchain_version_upstream TEXT OPTIONS (column_name 'build_toolchain_version_upstream') NULL,
+ toolchain_version_release TEXT OPTIONS (column_name 'build_toolchain_version_release') NULL)
SERVER package_server OPTIONS (table_name 'tenant');
-- The foreign table for build_repository object.
diff --git a/libbrep/build-package.hxx b/libbrep/build-package.hxx
index 8377158..08fb781 100644
--- a/libbrep/build-package.hxx
+++ b/libbrep/build-package.hxx
@@ -37,6 +37,7 @@ namespace brep
bool archived;
optional<tenant_service> service;
optional<timestamp> queued_timestamp;
+ optional<build_toolchain> toolchain;
// Database mapping.
//
diff --git a/libbrep/build.hxx b/libbrep/build.hxx
index be7cdf5..4c470cd 100644
--- a/libbrep/build.hxx
+++ b/libbrep/build.hxx
@@ -28,7 +28,7 @@
//
#define LIBBREP_BUILD_SCHEMA_VERSION_BASE 20
-#pragma db model version(LIBBREP_BUILD_SCHEMA_VERSION_BASE, 25, closed)
+#pragma db model version(LIBBREP_BUILD_SCHEMA_VERSION_BASE, 26, 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 bbot namespace
diff --git a/libbrep/build.xml b/libbrep/build.xml
index 0dc37ee..815c915 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="26"/>
+
<changeset version="25">
<add-table name="build_auxiliary_machines" kind="container">
<column name="package_tenant" type="TEXT" null="false"/>
diff --git a/libbrep/common.hxx b/libbrep/common.hxx
index 6220149..ea18fd4 100644
--- a/libbrep/common.hxx
+++ b/libbrep/common.hxx
@@ -354,6 +354,15 @@ namespace brep
#pragma db value(build_auxiliary) definition
+ // build_toolchain
+ //
+ #pragma db value
+ struct build_toolchain
+ {
+ string name;
+ brep::version version;
+ };
+
// email
//
using bpkg::email;
diff --git a/libbrep/package.hxx b/libbrep/package.hxx
index 96e51a3..b8c3c33 100644
--- a/libbrep/package.hxx
+++ b/libbrep/package.hxx
@@ -20,7 +20,7 @@
//
#define LIBBREP_PACKAGE_SCHEMA_VERSION_BASE 27
-#pragma db model version(LIBBREP_PACKAGE_SCHEMA_VERSION_BASE, 31, closed)
+#pragma db model version(LIBBREP_PACKAGE_SCHEMA_VERSION_BASE, 32, closed)
namespace brep
{
@@ -286,6 +286,27 @@ namespace brep
//
optional<timestamp> queued_timestamp; // Note: foreign-mapped in build.
+ // Note that after the package tenant is created but before the first
+ // build object is created, there is no easy way to produce a list of
+ // unbuilt package configurations. That would require to know the build
+ // toolchain(s), which are normally extracted from the build objects.
+ // Thus, the empty unbuilt package configurations list is ambiguous and
+ // can either mean that no more package configurations can be built or
+ // that we have not enough information to produce the list. To
+ // disambiguate the empty list in the interface, in the latter case we
+ // want to display the question mark instead of 0 as an unbuilt package
+ // configurations count. To achieve this we will stash the build toolchain
+ // in the tenant when a package from this tenant is considered for a build
+ // for the first time but no configuration is picked for the build (the
+ // target configurations are excluded, an auxiliary machine is not
+ // available, etc). We will also use the stashed toolchain as a fallback
+ // until we are able to retrieve the toolchain(s) from the tenant builds
+ // to produce the unbuilt package configurations list.
+ //
+ // Note: foreign-mapped in build.
+ //
+ optional<brep::build_toolchain> build_toolchain;
+
// Database mapping.
//
#pragma db member(id) id
diff --git a/libbrep/package.xml b/libbrep/package.xml
index 966861b..b66a66d 100644
--- a/libbrep/package.xml
+++ b/libbrep/package.xml
@@ -1,4 +1,16 @@
<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" schema-name="package" version="1">
+ <changeset version="32">
+ <alter-table name="tenant">
+ <add-column name="build_toolchain_name" type="TEXT" null="true"/>
+ <add-column name="build_toolchain_version_epoch" type="INTEGER" null="true"/>
+ <add-column name="build_toolchain_version_canonical_upstream" type="TEXT" null="true"/>
+ <add-column name="build_toolchain_version_canonical_release" type="TEXT" null="true"/>
+ <add-column name="build_toolchain_version_revision" type="INTEGER" null="true"/>
+ <add-column name="build_toolchain_version_upstream" type="TEXT" null="true"/>
+ <add-column name="build_toolchain_version_release" type="TEXT" null="true"/>
+ </alter-table>
+ </changeset>
+
<changeset version="31">
<add-table name="package_build_auxiliaries" kind="container">
<column name="tenant" type="TEXT" null="false"/>