aboutsummaryrefslogtreecommitdiff
path: root/libbrep
diff options
context:
space:
mode:
Diffstat (limited to 'libbrep')
-rw-r--r--libbrep/build-extra.sql2
-rw-r--r--libbrep/build-package.hxx2
-rw-r--r--libbrep/build.cxx2
-rw-r--r--libbrep/build.hxx10
-rw-r--r--libbrep/build.xml6
-rw-r--r--libbrep/package-extra.sql39
-rw-r--r--libbrep/package.cxx4
-rw-r--r--libbrep/package.hxx17
-rw-r--r--libbrep/package.xml7
9 files changed, 69 insertions, 20 deletions
diff --git a/libbrep/build-extra.sql b/libbrep/build-extra.sql
index ddc5961..a0cea97 100644
--- a/libbrep/build-extra.sql
+++ b/libbrep/build-extra.sql
@@ -22,6 +22,8 @@ DROP FOREIGN TABLE IF EXISTS build_tenant;
--
CREATE FOREIGN TABLE build_tenant (
id TEXT NOT NULL,
+ private BOOLEAN NOT NULL,
+ interactive TEXT NULL,
archived BOOLEAN NOT NULL)
SERVER package_server OPTIONS (table_name 'tenant');
diff --git a/libbrep/build-package.hxx b/libbrep/build-package.hxx
index 09ec41d..0cfd609 100644
--- a/libbrep/build-package.hxx
+++ b/libbrep/build-package.hxx
@@ -30,6 +30,8 @@ namespace brep
public:
string id;
+ bool private_;
+ optional<string> interactive;
bool archived;
// Database mapping.
diff --git a/libbrep/build.cxx b/libbrep/build.cxx
index db5bda2..5f8cd71 100644
--- a/libbrep/build.cxx
+++ b/libbrep/build.cxx
@@ -59,6 +59,7 @@ namespace brep
version pvr,
string cfg,
string tnm, version tvr,
+ optional<string> inr,
optional<string> afp, optional<string> ach,
string mnm, string msm,
butl::target_triplet trg)
@@ -72,6 +73,7 @@ namespace brep
toolchain_name (id.toolchain_name),
toolchain_version (move (tvr)),
state (build_state::building),
+ interactive (move (inr)),
timestamp (timestamp_type::clock::now ()),
force (force_state::unforced),
agent_fingerprint (move (afp)), agent_challenge (move (ach)),
diff --git a/libbrep/build.hxx b/libbrep/build.hxx
index 380b17b..49105d1 100644
--- a/libbrep/build.hxx
+++ b/libbrep/build.hxx
@@ -25,7 +25,7 @@
//
#define LIBBREP_BUILD_SCHEMA_VERSION_BASE 12
-#pragma db model version(LIBBREP_BUILD_SCHEMA_VERSION_BASE, 12, closed)
+#pragma db model version(LIBBREP_BUILD_SCHEMA_VERSION_BASE, 13, 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
@@ -178,13 +178,14 @@ namespace brep
using package_name_type = brep::package_name;
// Create the build object with the building state, non-existent status,
- // the timestamp set to now and the force state set to unforced.
+ // the timestamp set to now, and the force state set to unforced.
//
build (string tenant,
package_name_type,
version,
string configuration,
string toolchain_name, version toolchain_version,
+ optional<string> interactive,
optional<string> agent_fingerprint,
optional<string> agent_challenge,
string machine, string machine_summary,
@@ -201,6 +202,11 @@ namespace brep
build_state state;
+ // If present, the login information for the interactive build. May be
+ // present only in the building state.
+ //
+ optional<string> interactive;
+
// Time of the last state change (the creation time initially).
//
timestamp_type timestamp;
diff --git a/libbrep/build.xml b/libbrep/build.xml
index 3af7640..31bb4de 100644
--- a/libbrep/build.xml
+++ b/libbrep/build.xml
@@ -1,4 +1,10 @@
<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" schema-name="build" version="1">
+ <changeset version="13">
+ <alter-table name="build">
+ <add-column name="interactive" type="TEXT" null="true"/>
+ </alter-table>
+ </changeset>
+
<model version="12">
<table name="build" kind="object">
<column name="package_tenant" type="TEXT" null="false"/>
diff --git a/libbrep/package-extra.sql b/libbrep/package-extra.sql
index fe936ff..5c04147 100644
--- a/libbrep/package-extra.sql
+++ b/libbrep/package-extra.sql
@@ -38,16 +38,17 @@ DROP TYPE IF EXISTS weighted_text CASCADE;
CREATE TYPE weighted_text AS (a TEXT, b TEXT, c TEXT, d TEXT);
-- Return the latest versions of matching a tenant internal packages as a set
--- of package rows. If tenant is NULL, then match all tenants.
+-- of package rows. If tenant is NULL, then match all public tenants.
--
CREATE FUNCTION
latest_packages(IN tenant TEXT)
RETURNS SETOF package AS $$
SELECT p1.*
- FROM package p1 LEFT JOIN package p2 ON (
+ FROM package p1
+ LEFT JOIN package p2 ON (
p1.internal_repository_canonical_name IS NOT NULL AND
- p1.tenant = p2.tenant AND
- p1.name = p2.name AND
+ p1.tenant = p2.tenant AND
+ p1.name = p2.name AND
p2.internal_repository_canonical_name IS NOT NULL AND
(p1.version_epoch < p2.version_epoch OR
p1.version_epoch = p2.version_epoch AND
@@ -56,8 +57,12 @@ RETURNS SETOF package AS $$
(p1.version_canonical_release < p2.version_canonical_release OR
p1.version_canonical_release = p2.version_canonical_release AND
p1.version_revision < p2.version_revision))))
+ JOIN tenant t ON (p1.tenant = t.id)
WHERE
- (latest_packages.tenant IS NULL OR p1.tenant = latest_packages.tenant) AND
+ CASE
+ WHEN latest_packages.tenant IS NULL THEN NOT t.private
+ ELSE p1.tenant = latest_packages.tenant
+ END AND
p1.internal_repository_canonical_name IS NOT NULL AND
p2.name IS NULL;
$$ LANGUAGE SQL STABLE;
@@ -83,7 +88,8 @@ $$ LANGUAGE SQL STABLE;
-- Search for the latest version of an internal packages matching the
-- specified search query and tenant. Return a set of rows containing the
-- package id and search rank. If query is NULL, then match all packages and
--- return 0 rank for all rows. If tenant is NULL, then match all tenants.
+-- return 0 rank for all rows. If tenant is NULL, then match all public
+-- tenants.
--
CREATE FUNCTION
search_latest_packages(IN query tsquery,
@@ -107,9 +113,9 @@ RETURNS SETOF record AS $$
$$ LANGUAGE SQL STABLE;
-- Search for packages matching the search query and tenant and having the
--- specified name. Return a set of rows containing the package id and search
+-- specified name. Return a set of rows containing the package id and search
-- rank. If query is NULL, then match all packages and return 0 rank for all
--- rows. If tenant is NULL, then match all tenants.
+-- rows. If tenant is NULL, then match all public tenants.
--
CREATE FUNCTION
search_packages(IN query tsquery,
@@ -121,19 +127,22 @@ search_packages(IN query tsquery,
OUT version_revision INTEGER,
OUT rank real)
RETURNS SETOF record AS $$
- SELECT tenant, name, version_epoch, version_canonical_upstream,
- version_canonical_release, version_revision,
+ SELECT p.tenant, p.name, p.version_epoch, p.version_canonical_upstream,
+ p.version_canonical_release, p.version_revision,
CASE
WHEN query IS NULL THEN 0
-- Weight mapping: D C B A
ELSE ts_rank_cd('{0.05, 0.2, 0.9, 1.0}', search_index, query)
END AS rank
- FROM package
+ FROM package p JOIN tenant t ON (p.tenant = t.id)
WHERE
- (search_packages.tenant IS NULL OR tenant = search_packages.tenant) AND
- name = search_packages.name AND
- internal_repository_canonical_name IS NOT NULL AND
- (query IS NULL OR search_index @@ query);
+ CASE
+ WHEN search_packages.tenant IS NULL THEN NOT t.private
+ ELSE p.tenant = search_packages.tenant
+ END AND
+ name = search_packages.name AND
+ internal_repository_canonical_name IS NOT NULL AND
+ (query IS NULL OR search_index @@ query);
$$ LANGUAGE SQL STABLE;
-- Parse weighted_text to tsvector.
diff --git a/libbrep/package.cxx b/libbrep/package.cxx
index 564fec7..65fa1ba 100644
--- a/libbrep/package.cxx
+++ b/libbrep/package.cxx
@@ -40,8 +40,10 @@ namespace brep
// tenant
//
tenant::
- tenant (string i)
+ tenant (string i, bool p, optional<string> r)
: id (move (i)),
+ private_ (p),
+ interactive (move (r)),
creation_timestamp (timestamp::clock::now ())
{
}
diff --git a/libbrep/package.hxx b/libbrep/package.hxx
index 33444a9..1619185 100644
--- a/libbrep/package.hxx
+++ b/libbrep/package.hxx
@@ -20,7 +20,7 @@
//
#define LIBBREP_PACKAGE_SCHEMA_VERSION_BASE 19
-#pragma db model version(LIBBREP_PACKAGE_SCHEMA_VERSION_BASE, 19, closed)
+#pragma db model version(LIBBREP_PACKAGE_SCHEMA_VERSION_BASE, 20, closed)
namespace brep
{
@@ -226,16 +226,29 @@ namespace brep
// flag set to false.
//
explicit
- tenant (string id);
+ tenant (string id, bool private_, optional<string> interactive);
string id;
+ // If true, display the packages in the web interface only in the tenant
+ // view mode.
+ //
+ bool private_; // Note: foreign-mapped in build.
+
+ // Interactive package build breakpoint.
+ //
+ // If present, then packages from this tenant will only be built
+ // interactively and only non-interactively otherwise.
+ //
+ optional<string> interactive; // Note: foreign-mapped in build.
+
timestamp creation_timestamp;
bool archived = false; // Note: foreign-mapped in build.
// Database mapping.
//
#pragma db member(id) id
+ #pragma db member(private_) default(false) // @@ TMP
private:
friend class odb::access;
diff --git a/libbrep/package.xml b/libbrep/package.xml
index 454cdbc..01597c2 100644
--- a/libbrep/package.xml
+++ b/libbrep/package.xml
@@ -1,4 +1,11 @@
<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="pgsql" schema-name="package" version="1">
+ <changeset version="20">
+ <alter-table name="tenant">
+ <add-column name="private" type="BOOLEAN" null="false" default="FALSE"/>
+ <add-column name="interactive" type="TEXT" null="true"/>
+ </alter-table>
+ </changeset>
+
<model version="19">
<table name="tenant" kind="object">
<column name="id" type="TEXT" null="false"/>