aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--brep/package17
-rw-r--r--brep/package.cxx2
-rw-r--r--load/load.cxx15
-rw-r--r--tests/load/1/math/libexp-1~1.2+1.tar.gzbin291 -> 302 bytes
-rw-r--r--tests/load/1/math/libpq-0.tar.gzbin0 -> 807 bytes
-rw-r--r--tests/load/1/math/packages38
-rw-r--r--tests/load/driver.cxx31
7 files changed, 85 insertions, 18 deletions
diff --git a/brep/package b/brep/package
index 5cfbd45..a193c16 100644
--- a/brep/package
+++ b/brep/package
@@ -157,10 +157,13 @@ namespace brep
bool
empty () const noexcept
{
- bool e (canonical_upstream.empty ());
- assert (!e ||
- (epoch == 0 && canonical_release.empty () && revision == 0));
- return e;
+ // Note that an empty canonical_upstream doesn't denote an empty
+ // canonical_version. Remeber, that canonical_upstream doesn't include
+ // rightmost digit-only zero components? So non-empty version("0") has
+ // an empty canonical_upstream.
+ //
+ return epoch == 0 && canonical_upstream.empty () &&
+ canonical_release.empty () && revision == 0;
}
// Change collation to ensure the proper comparison of the "absent" release
@@ -201,6 +204,12 @@ namespace brep
}
};
+ // Wildcard version. Satisfies any dependency constraint and is represented
+ // as 0+0 (which is also the "stub version"; since a real version is always
+ // greater than the stub version, we reuse it to signify a special case).
+ //
+ extern const version wildcard_version;
+
// priority
//
using bpkg::priority;
diff --git a/brep/package.cxx b/brep/package.cxx
index 9cf0783..2f19e99 100644
--- a/brep/package.cxx
+++ b/brep/package.cxx
@@ -13,6 +13,8 @@ using namespace odb::core;
namespace brep
{
+ const version wildcard_version (0, "0", nullopt, 0);
+
// dependency
//
string dependency::
diff --git a/load/load.cxx b/load/load.cxx
index 2e06644..3b19ae3 100644
--- a/load/load.cxx
+++ b/load/load.cxx
@@ -695,23 +695,26 @@ resolve_dependencies (package& p, database& db)
if (d.constraint)
{
auto c (*d.constraint);
+ query qs (compare_version_eq (vm, wildcard_version, false));
if (c.min_version && c.max_version &&
*c.min_version == *c.max_version)
{
const version& v (*c.min_version);
- q = q && compare_version_eq (vm, v, v.revision != 0);
+ q = q && (compare_version_eq (vm, v, v.revision != 0) || qs);
}
else
{
+ query qr (true);
+
if (c.min_version)
{
const version& v (*c.min_version);
if (c.min_open)
- q = q && compare_version_gt (vm, v, v.revision != 0);
+ qr = compare_version_gt (vm, v, v.revision != 0);
else
- q = q && compare_version_ge (vm, v, v.revision != 0);
+ qr = compare_version_ge (vm, v, v.revision != 0);
}
if (c.max_version)
@@ -719,10 +722,12 @@ resolve_dependencies (package& p, database& db)
const version& v (*c.max_version);
if (c.max_open)
- q = q && compare_version_lt (vm, v, v.revision != 0);
+ qr = qr && compare_version_lt (vm, v, v.revision != 0);
else
- q = q && compare_version_le (vm, v, v.revision != 0);
+ qr = qr && compare_version_le (vm, v, v.revision != 0);
}
+
+ q = q && (qr || qs);
}
}
diff --git a/tests/load/1/math/libexp-1~1.2+1.tar.gz b/tests/load/1/math/libexp-1~1.2+1.tar.gz
index c74e2b9..937a084 100644
--- a/tests/load/1/math/libexp-1~1.2+1.tar.gz
+++ b/tests/load/1/math/libexp-1~1.2+1.tar.gz
Binary files differ
diff --git a/tests/load/1/math/libpq-0.tar.gz b/tests/load/1/math/libpq-0.tar.gz
new file mode 100644
index 0000000..a689660
--- /dev/null
+++ b/tests/load/1/math/libpq-0.tar.gz
Binary files differ
diff --git a/tests/load/1/math/packages b/tests/load/1/math/packages
index 7d09a03..9e1c30f 100644
--- a/tests/load/1/math/packages
+++ b/tests/load/1/math/packages
@@ -10,8 +10,9 @@ description: The exponent math function.
url: http://www.exp.com
email: users@exp.com
depends: libmisc
+depends: libpq >= 9.0.0
location: libexp-1~1.2+1.tar.gz
-sha256sum: 6c1869459964c8c780bd63d67e4c0727e583965e7280fd1f31be3f3639206191
+sha256sum: 49172533e10e1dd9b8f80bcd25d25397f143ba49a944cd8cb8fd273823b7c10e
:
name: libfoo
version: 1.0
@@ -60,6 +61,41 @@ requires: ? vc++ >= 12.0; Only if using VC++ on Windows.
location: libfoo-1.2.4+1.tar.gz
sha256sum: 6bf9de8c4647a32dee79ad5e787c10311495e3f6b5727bfd03b2d9dcd6a16eed
:
+name: libpq
+version: 0
+summary: PostgreSQL C API client library
+license: PostgreSQL License; Permissive free software license.
+tags: postgresql, database, client, library, c, api, interface
+description: \
+PostgreSQL is an object-relational SQL database management system with libpq
+being its C client library. Applications can use this library to pass queries
+to the PostgreSQL backend server and to receive the results of those queries
+using the C programming language. For more information see:
+
+https://www.postgresql.org/
+
+This package currently contains a build2 package manager (bpkg) stub meaning
+that it can only be "built" as already installed in the underlying system (for
+example, using a system package manager).
+
+Send questions, bug reports, or any other feedback about the library itself to
+the PostgreSQL mailing lists. Send build system and packaging-related feedback
+to the packaging@build2.org mailing list (see https://lists.build2.org for
+posting guidelines, etc).
+
+The packaging of PostgreSQL for build2 is tracked in a Git repository at:
+
+https://git.build2.org/cgit/packaging/postgresql/
+
+\
+url: https://www.postgresql.org/
+package-url: https://git.build2.org/cgit/packaging/postgresql/
+email: pgsql-general@postgresql.org; Mailing list.
+package-email: packaging@build2.org; Mailing list.
+requires: build2 >= 0.4.0
+location: libpq-0.tar.gz
+sha256sum: 75958d000b641c588cdf48e3574584e070104097702dccffdad77947e37f9bd0
+:
name: libstudxml
version: 1.0.0+1
summary: Modern C++ XML API
diff --git a/tests/load/driver.cxx b/tests/load/driver.cxx
index 5f55701..597625f 100644
--- a/tests/load/driver.cxx
+++ b/tests/load/driver.cxx
@@ -71,15 +71,15 @@ main (int argc, char* argv[])
for (; i < argc - 1; ++i)
{
string n (argv[i]);
- if (n == "--db-user")
+ if (n == "--db-user" || n == "-u")
user = argv[++i];
else if (n == "--db-password")
password = argv[++i];
- else if (n == "--db-name")
+ else if (n == "--db-name" || n == "-n")
name = argv[++i];
- else if (n == "--db-host")
+ else if (n == "--db-host" || n == "-h")
host = argv[++i];
- else if (n == "--db-port")
+ else if (n == "--db-port" || n == "-p")
port = stoul (argv[++i]);
}
@@ -128,7 +128,7 @@ main (int argc, char* argv[])
transaction t (db.begin ());
assert (db.query<repository> ().size () == 7);
- assert (db.query<package> ().size () == 16);
+ assert (db.query<package> ().size () == 17);
shared_ptr<repository> sr (
db.load<repository> ("dev.cppget.org/stable"));
@@ -621,16 +621,31 @@ main (int argc, char* argv[])
assert (epv->license_alternatives[0].size () == 1);
assert (epv->license_alternatives[0][0] == "MIT");
- assert (epv->dependencies.size () == 1);
+ assert (epv->dependencies.size () == 2);
assert (epv->dependencies[0].size () == 1);
assert (epv->dependencies[0][0] == dep ("libmisc", nullopt));
+ assert (epv->dependencies[1].size () == 1);
+ assert (epv->dependencies[1][0] ==
+ dep ("libpq",
+ optional<dependency_constraint> (
+ dependency_constraint (
+ version ("9.0.0"), false, nullopt, true))));
+
assert (epv->requirements.empty ());
assert (check_location (epv));
-
assert (epv->sha256sum && *epv->sha256sum ==
- "6c1869459964c8c780bd63d67e4c0727e583965e7280fd1f31be3f3639206191");
+ "49172533e10e1dd9b8f80bcd25d25397f143ba49a944cd8cb8fd273823b7c10e");
+
+ // Verify libpq package version.
+ //
+ // libpq-0
+ //
+ shared_ptr<package> qpv (
+ db.load<package> (package_id ("libpq", version ("0"))));
+
+ assert (qpv->summary == "PostgreSQL C API client library");
// Verify 'misc' repository.
//