From 651c01a92dbbec65674fe3c73a6c82a936e73d91 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 26 May 2023 13:18:46 +0300 Subject: Add support for package-description, package-description-type, and changes-type package manifest values --- libbrep/package.cxx | 20 +++++++++++++++----- libbrep/package.hxx | 41 +++++++++++++++++++++++++++++------------ libbrep/package.xml | 7 +++++-- 3 files changed, 49 insertions(+), 19 deletions(-) (limited to 'libbrep') diff --git a/libbrep/package.cxx b/libbrep/package.cxx index 152d1d8..e5e7767 100644 --- a/libbrep/package.cxx +++ b/libbrep/package.cxx @@ -60,9 +60,9 @@ namespace brep license_alternatives_type la, small_vector tp, small_vector kw, - optional ds, - optional dt, - string ch, + optional ds, + optional pds, + optional ch, optional ur, optional du, optional su, @@ -94,7 +94,7 @@ namespace brep topics (move (tp)), keywords (move (kw)), description (move (ds)), - description_type (move (dt)), + package_description (move (pds)), changes (move (ch)), url (move (ur)), doc_url (move (du)), @@ -216,7 +216,17 @@ namespace brep for (const auto& k: keywords) k2 += ' ' + k; - return {move (k), move (k2), description ? *description : "", changes}; + string d (description ? description->text : ""); + + if (package_description) + { + if (description) + d += ' '; + + d += package_description->text; + } + + return {move (k), move (k2), move (d), changes ? changes->text : ""}; } // repository diff --git a/libbrep/package.hxx b/libbrep/package.hxx index bba38b7..4cbdded 100644 --- a/libbrep/package.hxx +++ b/libbrep/package.hxx @@ -18,9 +18,9 @@ // Used by the data migration entries. // -#define LIBBREP_PACKAGE_SCHEMA_VERSION_BASE 26 +#define LIBBREP_PACKAGE_SCHEMA_VERSION_BASE 27 -#pragma db model version(LIBBREP_PACKAGE_SCHEMA_VERSION_BASE, 26, closed) +#pragma db model version(LIBBREP_PACKAGE_SCHEMA_VERSION_BASE, 27, closed) namespace brep { @@ -49,9 +49,12 @@ namespace brep using bpkg::text_type; using bpkg::to_text_type; + // Note that here we assume that the saved string representation of a type + // is always recognized later. + // #pragma db map type(text_type) as(string) \ to(to_string (?)) \ - from(brep::to_text_type (?)) + from(*brep::to_text_type (?)) using optional_text_type = optional; @@ -396,6 +399,15 @@ namespace brep string d; }; + #pragma db value + struct typed_text + { + string text; + text_type type; + + #pragma db member(text) column("") + }; + // Tweak package_id mapping to include a constraint (this only affects the // database schema). // @@ -429,9 +441,9 @@ namespace brep license_alternatives_type, small_vector topics, small_vector keywords, - optional description, - optional description_type, - string changes, + optional description, + optional package_description, + optional changes, optional url, optional doc_url, optional src_url, @@ -501,9 +513,14 @@ namespace brep license_alternatives_type license_alternatives; small_vector topics; small_vector keywords; - optional description; // Absent if type is unknown. - optional description_type; // Present if description is present. - string changes; + + // Note that the descriptions and changes are absent if the respective + // type is unknown. + // + optional description; + optional package_description; + optional changes; + optional url; optional doc_url; optional src_url; @@ -723,9 +740,9 @@ namespace brep friend class odb::access; package (): tenant (id.tenant), name (id.name) {} - // Save keywords, summary, description, and changes to weighted_text - // a, b, c, d members, respectively. So a word found in keywords will - // have a higher weight than if it's found in the summary. + // Save keywords, summary, descriptions, and changes to weighted_text a, + // b, c, d members, respectively. So a word found in keywords will have a + // higher weight than if it's found in the summary. // weighted_text search_text () const; diff --git a/libbrep/package.xml b/libbrep/package.xml index 8f32284..98c9055 100644 --- a/libbrep/package.xml +++ b/libbrep/package.xml @@ -1,5 +1,5 @@ - + @@ -144,7 +144,10 @@ - + + + + -- cgit v1.1