From 321fa79e78c17bdb1e3e27f6e8b9d019201584a1 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 30 Aug 2016 00:00:35 +0300 Subject: Support stubs in loader --- tests/load/1/math/libexp-1~1.2+1.tar.gz | Bin 291 -> 302 bytes tests/load/1/math/libpq-0.tar.gz | Bin 0 -> 807 bytes tests/load/1/math/packages | 38 +++++++++++++++++++++++++++++++- tests/load/driver.cxx | 31 +++++++++++++++++++------- 4 files changed, 60 insertions(+), 9 deletions(-) create mode 100644 tests/load/1/math/libpq-0.tar.gz (limited to 'tests') 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 Binary files a/tests/load/1/math/libexp-1~1.2+1.tar.gz and b/tests/load/1/math/libexp-1~1.2+1.tar.gz 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 Binary files /dev/null and b/tests/load/1/math/libpq-0.tar.gz 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 ().size () == 7); - assert (db.query ().size () == 16); + assert (db.query ().size () == 17); shared_ptr sr ( db.load ("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 ( + 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 qpv ( + db.load (package_id ("libpq", version ("0")))); + + assert (qpv->summary == "PostgreSQL C API client library"); // Verify 'misc' repository. // -- cgit v1.1