diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-10-31 21:38:19 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-11-02 20:08:21 +0200 |
commit | 4993f11bf464c9aee0e3fd5965f4a8258cbe8b30 (patch) | |
tree | 0abdc530e0a95dc6c6b4e40068be7d8554bca686 | |
parent | 5b336ac46f60606cdcf77889d624ce15cdd62530 (diff) |
Bug fix in latest_packages() PostgreSQL function
-rw-r--r-- | brep/package-extra.sql | 3 | ||||
-rw-r--r-- | tests/loader/driver.cxx | 29 | ||||
-rw-r--r-- | tests/loader/external/1/misc/packages | 8 |
3 files changed, 37 insertions, 3 deletions
diff --git a/brep/package-extra.sql b/brep/package-extra.sql index d30a48e..6859173 100644 --- a/brep/package-extra.sql +++ b/brep/package-extra.sql @@ -14,7 +14,8 @@ latest_packages() RETURNS SETOF package AS $$ SELECT p1.* FROM package p1 LEFT JOIN package p2 ON ( - p1.name = p2.name AND + p1.internal_repository IS NOT NULL AND p1.name = p2.name AND + p2.internal_repository IS NOT NULL AND (p1.version_epoch < p2.version_epoch OR p1.version_epoch = p2.version_epoch AND (p1.version_canonical_upstream < p2.version_canonical_upstream OR diff --git a/tests/loader/driver.cxx b/tests/loader/driver.cxx index 40d9b13..6d9b950 100644 --- a/tests/loader/driver.cxx +++ b/tests/loader/driver.cxx @@ -90,7 +90,7 @@ main (int argc, char* argv[]) transaction t (db.begin ()); assert (db.query<repository> ().size () == 3); - assert (db.query<package> ().size () == 9); + assert (db.query<package> ().size () == 10); shared_ptr<repository> sr (db.load<repository> ("cppget.org/stable")); shared_ptr<repository> mr (db.load<repository> ("cppget.org/math")); @@ -451,6 +451,10 @@ main (int argc, char* argv[]) db.load<package> (package_id ("libfoo", version ("0.1")))); assert (check_location (fpv0)); + shared_ptr<package> fpv6 ( + db.load<package> (package_id ("libfoo", version ("1.2.4-2")))); + assert (check_location (fpv6)); + // Verify libbar package version. // // libbar-2.3.5 @@ -486,7 +490,7 @@ main (int argc, char* argv[]) assert (fpv0->email.empty ()); assert (!fpv0->package_email); - assert (fpv0->internal_repository.load () == nullptr); + assert (fpv0->internal_repository == nullptr); assert (fpv0->external_repositories.size () == 1); assert (fpv0->external_repositories[0].load () == cr); assert (fpv0->priority == priority::low); @@ -497,6 +501,27 @@ main (int argc, char* argv[]) assert (fpv0->dependencies.empty ()); assert (fpv0->requirements.empty ()); + // libfoo-1.2.4-2 + // + assert (fpv6->summary.empty ()); + assert (fpv6->tags.empty ()); + assert (!fpv6->description); + assert (fpv6->url.empty ()); + assert (!fpv6->package_url); + assert (fpv6->email.empty ()); + assert (!fpv6->package_email); + + assert (fpv6->internal_repository == nullptr); + assert (fpv6->external_repositories.size () == 1); + assert (fpv6->external_repositories[0].load () == cr); + assert (fpv6->priority == priority::low); + assert (fpv6->changes.empty ()); + + assert (fpv6->license_alternatives.empty ()); + + assert (fpv6->dependencies.empty ()); + assert (fpv6->requirements.empty ()); + // Change package summary, update the object persistent state, rerun // loader and ensure the model were not rebuilt. // diff --git a/tests/loader/external/1/misc/packages b/tests/loader/external/1/misc/packages index 77e10de..e47208d 100644 --- a/tests/loader/external/1/misc/packages +++ b/tests/loader/external/1/misc/packages @@ -37,3 +37,11 @@ license: MIT url: http://www.example.com/foo/ email: foo-users@example.com location: libfoo-1.2.4-1.tar.gz +: +name: libfoo +version: 1.2.4-2 +summary: Foo Library +license: MIT +url: http://www.example.com/foo/ +email: foo-users@example.com +location: libfoo-1.2.4-2.tar.gz |