aboutsummaryrefslogtreecommitdiff
path: root/libbrep
diff options
context:
space:
mode:
Diffstat (limited to 'libbrep')
-rw-r--r--libbrep/build-extra.sql3
-rw-r--r--libbrep/common.hxx30
-rw-r--r--libbrep/package.cxx12
-rw-r--r--libbrep/package.hxx17
-rw-r--r--libbrep/package.xml28
5 files changed, 57 insertions, 33 deletions
diff --git a/libbrep/build-extra.sql b/libbrep/build-extra.sql
index 96e355c..e0aa92a 100644
--- a/libbrep/build-extra.sql
+++ b/libbrep/build-extra.sql
@@ -14,7 +14,8 @@ DROP FOREIGN TABLE IF EXISTS build_repository;
--
CREATE FOREIGN TABLE build_repository (
name TEXT NOT NULL,
- location TEXT NOT NULL,
+ location_url TEXT NOT NULL,
+ location_type TEXT NOT NULL,
certificate_fingerprint TEXT NULL)
SERVER package_server OPTIONS (table_name 'repository');
diff --git a/libbrep/common.hxx b/libbrep/common.hxx
index 5b172ec..0163ca0 100644
--- a/libbrep/common.hxx
+++ b/libbrep/common.hxx
@@ -218,21 +218,39 @@ namespace brep
// repository_type
//
using bpkg::repository_type;
+ using bpkg::to_repository_type;
+
+ #pragma db map type(repository_type) as(string) \
+ to(to_string (?)) \
+ from(brep::to_repository_type (?))
// repository_url
//
using bpkg::repository_url;
+ #pragma db map type(repository_url) as(string) \
+ to((?).string ()) \
+ from((?).empty () ? brep::repository_url () : brep::repository_url (?))
+
// repository_location
//
using bpkg::repository_location;
- #pragma db map type(repository_location) as(string) \
- to((?).url ().string ()) \
- from(brep::repository_location ((?).empty () \
- ? bpkg::repository_url () \
- : brep::repository_url (?), \
- brep::repository_type::pkg))
+ #pragma db value
+ struct _repository_location
+ {
+ repository_url url;
+ repository_type type;
+ };
+
+ // Note that the type() call fails for an empty repository location.
+ //
+ #pragma db map type(repository_location) as(_repository_location) \
+ to(brep::_repository_location {(?).url (), \
+ (?).empty () \
+ ? brep::repository_type::pkg \
+ : (?).type ()}) \
+ from(brep::repository_location (std::move ((?).url), (?).type))
// Version comparison operators.
//
diff --git a/libbrep/package.cxx b/libbrep/package.cxx
index 5b729c8..6d4550d 100644
--- a/libbrep/package.cxx
+++ b/libbrep/package.cxx
@@ -15,16 +15,10 @@ namespace brep
{
// dependency
//
- package_name dependency::
- name () const
- {
- return package.object_id ().name;
- }
-
ostream&
operator<< (ostream& o, const dependency& d)
{
- o << d.name ();
+ o << d.name;
if (d.constraint)
o << ' ' << *d.constraint;
@@ -35,7 +29,7 @@ namespace brep
bool
operator== (const dependency& x, const dependency& y)
{
- return x.name () == y.name () && x.constraint == y.constraint;
+ return x.name == y.name && x.constraint == y.constraint;
}
bool
@@ -67,6 +61,7 @@ namespace brep
requirements_type rq,
build_constraints_type bc,
optional<path> lc,
+ optional<string> fr,
optional<string> sh,
shared_ptr<repository_type> rp)
: id (move (nm), vr),
@@ -93,6 +88,7 @@ namespace brep
: build_constraints_type ()),
internal_repository (move (rp)),
location (move (lc)),
+ fragment (move (fr)),
sha256sum (move (sh))
{
assert (internal_repository->internal);
diff --git a/libbrep/package.hxx b/libbrep/package.hxx
index e7a8338..3d281b0 100644
--- a/libbrep/package.hxx
+++ b/libbrep/package.hxx
@@ -120,17 +120,16 @@ namespace brep
{
using package_type = brep::package;
- lazy_shared_ptr<package_type> package;
+ package_name name;
optional<dependency_constraint> constraint;
- // Prerequisite package name.
+ // Resolved dependency package. NULL if the repository load was shallow
+ // and so the package dependencies are not resolved.
//
- package_name
- name () const;
+ lazy_shared_ptr<package_type> package;
// Database mapping.
//
- #pragma db member(package) column("") not_null
#pragma db member(constraint) column("")
};
@@ -212,7 +211,7 @@ namespace brep
//
uint16_t priority;
- optional<string> url;
+ optional<string> interface_url;
// Present only for internal repositories.
//
@@ -318,6 +317,7 @@ namespace brep
requirements_type,
build_constraints_type,
optional<path> location,
+ optional<string> fragment,
optional<string> sha256sum,
shared_ptr<repository_type>);
@@ -370,6 +370,11 @@ namespace brep
//
optional<path> location;
+ // Present only for packages that come from the supporting fragmentation
+ // internal repository (normally version control-based).
+ //
+ optional<string> fragment;
+
// Present only for internal packages.
//
optional<string> sha256sum;
diff --git a/libbrep/package.xml b/libbrep/package.xml
index 47ff071..55baae9 100644
--- a/libbrep/package.xml
+++ b/libbrep/package.xml
@@ -2,15 +2,17 @@
<model version="7">
<table name="repository" kind="object">
<column name="name" type="TEXT" null="false"/>
- <column name="location" type="TEXT" null="false"/>
+ <column name="location_url" type="TEXT" null="false"/>
+ <column name="location_type" type="TEXT" null="false"/>
<column name="display_name" type="TEXT" null="false"/>
<column name="priority" type="INTEGER" null="false"/>
- <column name="url" type="TEXT" null="true"/>
+ <column name="interface_url" type="TEXT" null="true"/>
<column name="email" type="TEXT" null="true"/>
<column name="email_comment" type="TEXT" null="true"/>
<column name="summary" type="TEXT" null="true"/>
<column name="description" type="TEXT" null="true"/>
- <column name="cache_location" type="TEXT" null="false"/>
+ <column name="cache_location_url" type="TEXT" null="false"/>
+ <column name="cache_location_type" type="TEXT" null="false"/>
<column name="certificate_fingerprint" type="TEXT" null="true"/>
<column name="certificate_name" type="TEXT" null="true"/>
<column name="certificate_organization" type="TEXT" null="true"/>
@@ -99,6 +101,7 @@
<column name="build_email_comment" type="TEXT" null="true"/>
<column name="internal_repository" type="TEXT" null="true"/>
<column name="location" type="TEXT" null="true"/>
+ <column name="fragment" type="TEXT" null="true"/>
<column name="sha256sum" type="TEXT" null="true"/>
<column name="search_index" type="tsvector" null="true"/>
<primary-key>
@@ -259,10 +262,6 @@
<column name="dependency_index" type="BIGINT" null="false"/>
<column name="index" type="BIGINT" null="false"/>
<column name="dep_name" type="CITEXT" null="false"/>
- <column name="dep_version_epoch" type="INTEGER" null="false"/>
- <column name="dep_version_canonical_upstream" type="TEXT" null="false"/>
- <column name="dep_version_canonical_release" type="TEXT" null="false" options="COLLATE &quot;C&quot;"/>
- <column name="dep_version_revision" type="INTEGER" null="false"/>
<column name="dep_min_version_epoch" type="INTEGER" null="true"/>
<column name="dep_min_version_canonical_upstream" type="TEXT" null="true"/>
<column name="dep_min_version_canonical_release" type="TEXT" null="true"/>
@@ -277,6 +276,11 @@
<column name="dep_max_version_release" type="TEXT" null="true"/>
<column name="dep_min_open" type="BOOLEAN" null="true"/>
<column name="dep_max_open" type="BOOLEAN" null="true"/>
+ <column name="dep_package_name" type="CITEXT" null="true"/>
+ <column name="dep_package_version_epoch" type="INTEGER" null="true"/>
+ <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="object_id_fk" on-delete="CASCADE">
<column name="name"/>
<column name="version_epoch"/>
@@ -299,11 +303,11 @@
<column name="version_revision"/>
</index>
<foreign-key name="dep_package_fk" deferrable="DEFERRED">
- <column name="dep_name"/>
- <column name="dep_version_epoch"/>
- <column name="dep_version_canonical_upstream"/>
- <column name="dep_version_canonical_release"/>
- <column name="dep_version_revision"/>
+ <column name="dep_package_name"/>
+ <column name="dep_package_version_epoch"/>
+ <column name="dep_package_version_canonical_upstream"/>
+ <column name="dep_package_version_canonical_release"/>
+ <column name="dep_package_version_revision"/>
<references table="package">
<column name="name"/>
<column name="version_epoch"/>