diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2023-02-17 21:06:00 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2023-02-20 16:17:32 +0300 |
commit | eaebfcff492cf7f707b44a3d28620e786116faf1 (patch) | |
tree | f76076ca5c06be6cf932c9e330a282546ec1008c | |
parent | 4887f43d983898e48feaffc467327bc7fc4e1180 (diff) |
Store in database and document type and language package manifest values
-rw-r--r-- | bpkg/package.hxx | 24 | ||||
-rw-r--r-- | bpkg/package.xml | 44 | ||||
-rw-r--r-- | doc/manual.cli | 42 |
3 files changed, 109 insertions, 1 deletions
diff --git a/bpkg/package.hxx b/bpkg/package.hxx index e811e62..e5e70ad 100644 --- a/bpkg/package.hxx +++ b/bpkg/package.hxx @@ -11,6 +11,7 @@ #include <type_traits> // static_assert #include <odb/core.hxx> +#include <odb/section.hxx> #include <odb/nested-container.hxx> #include <libbutl/timestamp.hxx> @@ -27,7 +28,7 @@ // #define DB_SCHEMA_VERSION_BASE 12 -#pragma db model version(DB_SCHEMA_VERSION_BASE, 22, closed) +#pragma db model version(DB_SCHEMA_VERSION_BASE, 23, closed) namespace bpkg { @@ -513,6 +514,10 @@ namespace bpkg operator size_t () const {return result;} }; + // language + // + #pragma db value(language) definition + // package_location // #pragma db value @@ -685,6 +690,11 @@ namespace bpkg upstream_version_type version; optional<string> upstream_version; + optional<string> type; + + small_vector<language, 1> languages; + odb::section languages_section; + optional<package_name> project; // List of repository fragments to which this package version belongs @@ -743,6 +753,8 @@ namespace bpkg : id (move (m.name), m.version), version (move (m.version)), upstream_version (move (m.upstream_version)), + type (move (m.type)), + languages (move (m.languages)), project (move (m.project)), dependencies (convert (move (m.dependencies))), tests (move (m.tests)), @@ -794,6 +806,16 @@ namespace bpkg // #pragma db member(id) id column("") #pragma db member(version) set(this.version.init (this.id.version, (?))) + + // languages + // + #pragma db member(languages) id_column("") value_column("language_") \ + section(languages_section) + + #pragma db member(languages_section) load(lazy) update(always) + + // locations + // #pragma db member(locations) id_column("") value_column("") \ unordered value_not_null diff --git a/bpkg/package.xml b/bpkg/package.xml index a8558fd..fd332bc 100644 --- a/bpkg/package.xml +++ b/bpkg/package.xml @@ -1,4 +1,48 @@ <changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1"> + <changeset version="23"> + <alter-table name="main.available_package"> + <add-column name="type" type="TEXT" null="true"/> + </alter-table> + <add-table name="main.available_package_languages" kind="container"> + <column name="name" type="TEXT" null="true" options="COLLATE NOCASE"/> + <column name="version_epoch" type="INTEGER" null="true"/> + <column name="version_canonical_upstream" type="TEXT" null="true"/> + <column name="version_canonical_release" type="TEXT" null="true" options="COLLATE BINARY"/> + <column name="version_revision" type="INTEGER" null="true"/> + <column name="version_iteration" type="INTEGER" null="true"/> + <column name="index" type="INTEGER" null="true"/> + <column name="language_name" type="TEXT" null="true"/> + <column name="language_impl" type="INTEGER" null="true"/> + <foreign-key name="object_id_fk" on-delete="CASCADE"> + <column name="name"/> + <column name="version_epoch"/> + <column name="version_canonical_upstream"/> + <column name="version_canonical_release"/> + <column name="version_revision"/> + <column name="version_iteration"/> + <references table="main.available_package"> + <column name="name"/> + <column name="version_epoch"/> + <column name="version_canonical_upstream"/> + <column name="version_canonical_release"/> + <column name="version_revision"/> + <column name="version_iteration"/> + </references> + </foreign-key> + <index name="available_package_languages_object_id_i"> + <column name="name"/> + <column name="version_epoch"/> + <column name="version_canonical_upstream"/> + <column name="version_canonical_release"/> + <column name="version_revision"/> + <column name="version_iteration"/> + </index> + <index name="available_package_languages_index_i"> + <column name="index"/> + </index> + </add-table> + </changeset> + <changeset version="22"> <alter-table name="main.available_package"> <add-column name="upstream_version" type="TEXT" null="true"/> diff --git a/doc/manual.cli b/doc/manual.cli index 1f540d2..d417e92 100644 --- a/doc/manual.cli +++ b/doc/manual.cli @@ -1041,6 +1041,8 @@ a full package manifest they can be interleaved with non-header values. name: <name> version: <version> [upstream-version]: <string> +[type]: <type> +[language]: <lang> [project]: <name> [priority]: <priority> [; <comment>] summary: <text> @@ -1129,6 +1131,46 @@ and use the \c{upstream-version} value to preserve the original version for information. +\h2#manifest-package-type-language|\c{type, language}| + +\ +[type]: <type> +[language]: <lang> + +<type> = <name> +<lang> = <name>[=impl] +\ + +The package type and programming language(s). + +The currently recognized package types are \c{exe}, \c{lib}, and \c{other}. If +the type is not specified, then if the package name starts with \c{lib}, then +it is assumed to be \c{lib} and \c{exe} otherwise (see \l{#package-name +Package Name} for details). Other package types may be added in the future and +code that does not recognize a certain package type should treat it as +\c{other}. + +The package language must be in the lower case, for example, \c{c}, \c{c++}, +\c{rust}, \c{bash}. If the language is not specified, then if the package name +has an extension (as in, for example, \c{libbutl.bash}; see \l{#package-name +Package Name} for details) the extension is assumed to name the package +language. Otherwise, \c{cc} (unspecified \c{c}-common language) is assumed. If +a package uses multiple languages, then multiple \c{language} values must be +specified. The languages which are only used in a library's implementation (as +opposed to also in its interface) should be marked as such. For example, for a +C library with C++ implementation: + +\ +type: lib +language: c +language: c++=impl +\ + +\N|If the use of a language, such as C++, also always implies the use of +another language, such as C, then such an implied language need not be +explicitly specified.| + + \h2#manifest-package-project|\c{project}| \ |