aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bpkg/buildfile3
-rw-r--r--bpkg/database.cxx20
-rw-r--r--bpkg/package.hxx6
-rw-r--r--bpkg/package.xml12
-rw-r--r--bpkg/pkg-build.cxx4
-rw-r--r--bpkg/pkg-configure.cxx2
-rw-r--r--bpkg/pkg-verify.cxx12
7 files changed, 49 insertions, 10 deletions
diff --git a/bpkg/buildfile b/bpkg/buildfile
index dbd16ab..582b8dc 100644
--- a/bpkg/buildfile
+++ b/bpkg/buildfile
@@ -13,7 +13,8 @@ import libs += libbutl%lib{butl}
import libs += libodb%lib{odb}
import libs += libodb-sqlite%lib{odb-sqlite}
-# @@ TMP Only required for the database migration to schema version 13.
+# @@ TMP Only required for the database migrations to schema versions 13 and
+# 14.
#
import libs += libsqlite3%lib{sqlite3}
diff --git a/bpkg/database.cxx b/bpkg/database.cxx
index 08f8122..b0a673e 100644
--- a/bpkg/database.cxx
+++ b/bpkg/database.cxx
@@ -265,6 +265,21 @@ namespace bpkg
"FROM \"main\".\"available_package_dependency_alternatives\"");
});
+ // @@ Since there is no proper support for dropping table columns not in
+ // SQLite prior to 3.35.5 nor in ODB, we will drop the
+ // available_package_dependencies.conditional column manually. We,
+ // however, cannot do it here since ODB will try to set the dropped
+ // column values to NULL at the end of migration. Thus, we will do it
+ // ad hoc after the below schema_catalog::migrate() call.
+ //
+ // NOTE: remove the mentioned ad hoc migration when removing this
+ // function.
+ //
+ static const migration_entry<14>
+ migrate_v14 ([] (odb::database&)
+ {
+ });
+
static inline path
cfg_path (const dir_path& d, bool create)
{
@@ -609,6 +624,11 @@ namespace bpkg
for (const char** c (cs); *c != nullptr; ++c)
drop ("available_package_dependency_alternatives", *c);
}
+
+ // @@ TMP See migrate_v14() for details.
+ //
+ if (sv < 14)
+ drop ("available_package_dependencies", "conditional");
}
for (auto& c: query<configuration> (odb::query<configuration>::id != 0))
diff --git a/bpkg/package.hxx b/bpkg/package.hxx
index ec86ea2..ec6aa67 100644
--- a/bpkg/package.hxx
+++ b/bpkg/package.hxx
@@ -27,7 +27,7 @@
//
#define DB_SCHEMA_VERSION_BASE 7
-#pragma db model version(DB_SCHEMA_VERSION_BASE, 13, closed)
+#pragma db model version(DB_SCHEMA_VERSION_BASE, 14, closed)
namespace bpkg
{
@@ -559,9 +559,7 @@ namespace bpkg
// Create the special test dependencies object (built incrementally).
//
dependency_alternatives_ex (test_dependency_type t, bool buildtime)
- : dependency_alternatives (false /* conditional */,
- buildtime,
- "" /* comment */),
+ : dependency_alternatives (buildtime, "" /* comment */),
type (t) {}
};
diff --git a/bpkg/package.xml b/bpkg/package.xml
index 9f17ab0..c2001f5 100644
--- a/bpkg/package.xml
+++ b/bpkg/package.xml
@@ -1,4 +1,16 @@
<changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1">
+ <changeset version="14">
+ <alter-table name="main.available_package_dependencies">
+ <drop-column name="conditional"/>
+ </alter-table>
+ <alter-table name="main.available_package_dependency_alternatives">
+ <add-column name="reflect" type="TEXT" null="true"/>
+ <add-column name="prefer" type="TEXT" null="true"/>
+ <add-column name="accept" type="TEXT" null="true"/>
+ <add-column name="require" type="TEXT" null="true"/>
+ </alter-table>
+ </changeset>
+
<changeset version="13">
<alter-table name="main.available_package_dependency_alternatives">
<add-column name="enable" type="TEXT" null="true"/>
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx
index f78a96d..da29cc9 100644
--- a/bpkg/pkg-build.cxx
+++ b/bpkg/pkg-build.cxx
@@ -1139,7 +1139,7 @@ namespace bpkg
for (const dependency_alternatives_ex& das: ap->dependencies)
{
- if (das.conditional) // @@ TODO
+ if (das.conditional ()) // @@ TODO
fail << "conditional dependencies are not yet supported";
if (das.size () != 1) // @@ TODO
@@ -2479,7 +2479,7 @@ namespace bpkg
for (const dependency_alternatives_ex& das:
reverse_iterate (ap->dependencies))
{
- assert (!das.conditional && das.size () == 1); // @@ TODO
+ assert (!das.conditional () && das.size () == 1); // @@ TODO
const dependency_alternative& da (das.front ());
diff --git a/bpkg/pkg-configure.cxx b/bpkg/pkg-configure.cxx
index 96f3607..1aa3615 100644
--- a/bpkg/pkg-configure.cxx
+++ b/bpkg/pkg-configure.cxx
@@ -30,7 +30,7 @@ namespace bpkg
for (const dependency_alternatives_ex& das: deps)
{
- assert (!das.conditional); //@@ TODO
+ assert (!das.conditional ()); //@@ TODO
bool satisfied (false);
for (const dependency_alternative& da: das)
diff --git a/bpkg/pkg-verify.cxx b/bpkg/pkg-verify.cxx
index 757a2c5..a65eeef 100644
--- a/bpkg/pkg-verify.cxx
+++ b/bpkg/pkg-verify.cxx
@@ -54,7 +54,15 @@ namespace bpkg
if (nv.name == "depends")
try
{
- dependency_alternatives das (nv.value);
+ // Note that we don't have the dependent package name here (unless we
+ // bother to retrieve it from the manifest in advance). This may cause
+ // parsing of a dependency alternative to fail while verifying the
+ // reflect clause (see dependency_alternative for details). That is,
+ // however, OK since we don't expect any clauses for the build2 and
+ // bpkg constraints and we just ignore failures for other depends
+ // values (see above).
+ //
+ dependency_alternatives das (nv.value, package_name ());
if (das.buildtime)
{
@@ -117,7 +125,7 @@ namespace bpkg
}
}
}
- catch (const invalid_argument&) {} // Ignore
+ catch (const manifest_parsing&) {} // Ignore
r.push_back (move (nv));
}