aboutsummaryrefslogtreecommitdiff
path: root/tests/loader
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-01-18 07:35:12 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-01-23 17:47:47 +0200
commit1dc38cf49b6c7a8b661a9cc675ded94c8ab33c36 (patch)
tree5a216148adb9d842a5a15c032a671182faa9ba06 /tests/loader
parentfe6182a8c89675f92e72c881d707e21cdf56f376 (diff)
Implement brep-migrate utility
Diffstat (limited to 'tests/loader')
-rw-r--r--tests/loader/1/basics/packages8
-rw-r--r--tests/loader/1/basics/repositories4
-rw-r--r--tests/loader/1/math/packages71
-rw-r--r--tests/loader/1/math/repositories13
-rw-r--r--tests/loader/1/misc/packages47
-rw-r--r--tests/loader/1/misc/repositories13
-rw-r--r--tests/loader/1/stable/packages54
-rw-r--r--tests/loader/1/stable/repositories14
-rw-r--r--tests/loader/1/staging/packages25
-rw-r--r--tests/loader/1/staging/repositories4
-rw-r--r--tests/loader/1/testing/packages9
-rw-r--r--tests/loader/1/testing/repositories9
-rw-r--r--tests/loader/buildfile21
-rw-r--r--tests/loader/driver.cxx756
-rw-r--r--tests/loader/r.conf2
15 files changed, 0 insertions, 1050 deletions
diff --git a/tests/loader/1/basics/packages b/tests/loader/1/basics/packages
deleted file mode 100644
index 86c20c1..0000000
--- a/tests/loader/1/basics/packages
+++ /dev/null
@@ -1,8 +0,0 @@
-: 1
-name: libexpat
-version: 5.1
-summary: The Expat Library
-license: MIT
-url: http://www.example.com/expat/
-email: expat-users@example.com
-location: libexpat-5.1.tar.gz
diff --git a/tests/loader/1/basics/repositories b/tests/loader/1/basics/repositories
deleted file mode 100644
index 57a1c7a..0000000
--- a/tests/loader/1/basics/repositories
+++ /dev/null
@@ -1,4 +0,0 @@
-: 1
-# Local repository manifest (this repository).
-#
-url: http://basics.org
diff --git a/tests/loader/1/math/packages b/tests/loader/1/math/packages
deleted file mode 100644
index 7b81c5e..0000000
--- a/tests/loader/1/math/packages
+++ /dev/null
@@ -1,71 +0,0 @@
-: 1
-name: libstudxml
-version: 1.0.0+1
-summary: Modern C++ XML API
-license: MIT
-tags: c++, xml, parser, serializer, pull, streaming, modern
-description-file: README
-changes-file: NEWS
-url: http://www.codesynthesis.com/projects/libstudxml/
-email: studxml-users@codesynthesis.com; Public mailing list, posts by\
- non-members are allowed but moderated.
-package-email: boris@codesynthesis.com; Direct email to the author.
-depends: libexpat >= 2.0.0
-depends: libgenx
-location: libstudxml-1.0.0+1.tar.gz
-:
-name: libexp
-version: 1~1.2
-summary: The exponent
-description: The exponent math function.
-license: MIT
-tags: c++, exponent
-url: http://www.exp.com
-email: users@exp.com
-depends: libmisc
-location: libexp-1~1.2.tar.gz
-:
-name: libfoo
-version: 1.2.4+1
-summary: The Foo Math Library
-description:\
-A modern C++ library with easy to use linear algebra and lot of optimization
-tools.
-
-There are over 100 functions in total with an extensive test suite. The API is
-similar to MATLAB.
-
-Useful for conversion of research code into production environments.
-\
-license: LGPLv2, MIT; If using with GNU TLS.
-license: BSD; If using with OpenSSL.
-priority: high; Critical bug fixes, performance improvement.
-tags: c++, foo, math
-url: http://www.example.com/foo/; Project home page.
-email: foo-users@example.com; Public mailing list. Read FAQ before posting.
-package-url: http://www.example.com/foo/pack; Package details.
-package-email: pack@example.com; Current packager.
-depends: libmisc < 1.1 | libmisc > 2.3.0; Crashes with 1.1.0-2.3.0.
-depends: libexp >= 1.0
-depends: ? libstudxml | libexpat; The newer the better.
-requires: linux | windows | macosx; Symbian support is coming.
-requires: c++11
-requires: ? ; libc++ standard library if using Clang on Mac OS X.
-requires: ? vc++ >= 12.0; Only if using VC++ on Windows.
-location: libfoo-1.2.4+1.tar.gz
-changes:\
-1.2.4+1
- * applied patch for critical bug-219
- * regenerated documentation
-
-1.2.4
- * test suite extended significantly
-\
-:
-name: libfoo
-version: 1.0
-summary: The Foo Lib
-license: MIT
-url: http://www.example.com/foo/
-email: foo-users@example.com
-location: libfoo-1.0.tar.gz
diff --git a/tests/loader/1/math/repositories b/tests/loader/1/math/repositories
deleted file mode 100644
index 20aa30d..0000000
--- a/tests/loader/1/math/repositories
+++ /dev/null
@@ -1,13 +0,0 @@
-: 1
-# Foreign repository manifest.
-#
-location: ../misc
-:
-# Local repository manifest (this repository).
-#
-email: repoman@cppget.org
-summary: Math C++ package repository
-description: \
-This is the awesome C++ package repository full of remarkable algorithms and
-APIs.
-\
diff --git a/tests/loader/1/misc/packages b/tests/loader/1/misc/packages
deleted file mode 100644
index fec3780..0000000
--- a/tests/loader/1/misc/packages
+++ /dev/null
@@ -1,47 +0,0 @@
-: 1
-name: libbar
-version: 2.3.5
-priority: security; Very important to install.
-summary: The Bar library
-description: very very good library.
-license: GPLv2
-tags: c++, bar
-url: http://www.example.com/bar/
-email: bar-users@example.com
-depends: libfoo
-depends: libmath >= 2.0.0
-requires: linux | windows | macosx
-changes: some changes
-location: libbar-2.3.5.tar.gz
-:
-name: libfoo
-version: 1.0
-summary: Foo Library
-license: MIT
-url: http://www.example.com/foo/
-email: foo-users@example.com
-location: libfoo-1.0.tar.gz
-:
-name: libfoo
-version: 0.1
-summary: Foo
-license: MIT
-url: http://www.example.com/foo/
-email: foo-users@example.com
-location: libfoo-0.1.tar.gz
-:
-name: libfoo
-version: 1.2.4+1
-summary: Foo Library
-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
diff --git a/tests/loader/1/misc/repositories b/tests/loader/1/misc/repositories
deleted file mode 100644
index 1a41290..0000000
--- a/tests/loader/1/misc/repositories
+++ /dev/null
@@ -1,13 +0,0 @@
-: 1
-# Foreign repository manifest.
-#
-location: ../basics
-:
-# Adjacent repository manifest.
-#
-location: ../testing
-role: complement
-:
-# Local repository manifest (this repository).
-#
-url: http://misc.cppget.org/
diff --git a/tests/loader/1/stable/packages b/tests/loader/1/stable/packages
deleted file mode 100644
index afa168a..0000000
--- a/tests/loader/1/stable/packages
+++ /dev/null
@@ -1,54 +0,0 @@
-: 1
-name: libfoo
-version: 1.2.3+4
-summary: The Foo library
-license: MIT
-tags: c++, foo
-url: http://www.example.com/foo/
-email: foo-users@example.com
-depends: libmisc >= 2.0.0
-location: libfoo-1.2.3+4.tar.gz
-:
-name: libfoo
-version: 1.2.2
-summary: The Foo library
-license: MIT
-tags: c++, foo
-url: http://www.example.com/foo/
-email: foo-users@example.com
-depends: libbar <= 2.4.0
-depends: libexp == 1~1.2
-location: libfoo-1.2.2.tar.gz
-:
-name: libfoo
-version: 1.2.2-alpha.1
-summary: The Foo library
-license: MIT
-tags: c++, foo
-url: http://www.example.com/foo/
-email: foo-users@example.com
-depends: libmisc [0.1 2.0-) | libmisc [2.0 5.0]
-depends: libgenx (0.2 3.0)
-depends: libexpat < 5.2 | libexpat (1 5.1]
-location: libfoo-1.2.2-alpha.1.tar.gz
-:
-name: libfoo
-version: 1.2.4
-summary: The Foo Library
-description: Very good foo library.
-license: MIT; Permissive free software license.
-tags: c++, foo
-url: http://www.example.com/foo/
-email: foo-users@example.com
-depends: libmisc >= 2.0.0
-changes: some changes 1
-changes: some changes 2
-location: libfoo-1.2.4.tar.gz
-:
-name: libfoo
-version: 1.0
-summary: The Foo Library
-license: MIT
-url: http://www.example.com/foo/
-email: foo-users@example.com
-location: libfoo-1.0.tar.gz
diff --git a/tests/loader/1/stable/repositories b/tests/loader/1/stable/repositories
deleted file mode 100644
index b692ebe..0000000
--- a/tests/loader/1/stable/repositories
+++ /dev/null
@@ -1,14 +0,0 @@
-: 1
-# Foreign repository manifest.
-#
-location: ../misc
-:
-# Adjacent repository manifest.
-#
-location: ../math
-:
-# Local repository manifest (this repository).
-#
-email: repoman@cppget.org
-summary: General C++ package stable repository
-description: This is the awesome C++ package repository full of exciting stuff.
diff --git a/tests/loader/1/staging/packages b/tests/loader/1/staging/packages
deleted file mode 100644
index e7b22b0..0000000
--- a/tests/loader/1/staging/packages
+++ /dev/null
@@ -1,25 +0,0 @@
-: 1
-name: libexpat
-version: 5.1
-summary: The Expat Library
-license: MIT
-url: http://www.example.com/expat/
-email: expat-users@example.com
-location: libexpat-5.1.tar.gz
-:
-name: libgenx
-version: 1.0
-summary: The Genx Library
-license: MIT
-url: http://www.example.com/genx/
-email: genx-users@example.com
-location: libgenx-1.0.tar.gz
-:
-name: libmisc
-version: 1.0
-summary: The Misc Library
-license: MIT
-url: http://www.example.com/misc/
-email: misc-users@example.com
-depends: libexpat >= 5.0
-location: libmisc-1.0.tar.gz
diff --git a/tests/loader/1/staging/repositories b/tests/loader/1/staging/repositories
deleted file mode 100644
index d72a3f8..0000000
--- a/tests/loader/1/staging/repositories
+++ /dev/null
@@ -1,4 +0,0 @@
-: 1
-# Local repository manifest (this repository).
-#
-url: ../../..
diff --git a/tests/loader/1/testing/packages b/tests/loader/1/testing/packages
deleted file mode 100644
index bdebece..0000000
--- a/tests/loader/1/testing/packages
+++ /dev/null
@@ -1,9 +0,0 @@
-: 1
-name: libmisc
-version: 2.4.0
-summary: The Misc Library
-license: MIT
-url: http://www.example.com/misc/
-email: misc-users@example.com
-depends: libexpat >= 5.0
-location: libmisc-2.4.0.tar.gz
diff --git a/tests/loader/1/testing/repositories b/tests/loader/1/testing/repositories
deleted file mode 100644
index a218d5c..0000000
--- a/tests/loader/1/testing/repositories
+++ /dev/null
@@ -1,9 +0,0 @@
-: 1
-# Adjacent repository manifest.
-#
-location: ../staging
-role: complement
-:
-# Local repository manifest (this repository).
-#
-url: http://test.cppget.org/hello
diff --git a/tests/loader/buildfile b/tests/loader/buildfile
deleted file mode 100644
index d8ab9ac..0000000
--- a/tests/loader/buildfile
+++ /dev/null
@@ -1,21 +0,0 @@
-# file : tests/loader/buildfile
-# copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
-# license : MIT; see accompanying LICENSE file
-
-import libs += libbpkg%lib{bpkg}
-import libs += libbutl%lib{butl}
-import libs += libodb-pgsql%lib{odb-pgsql}
-import libs += libodb%lib{odb}
-
-include ../../brep/
-
-exe{driver}: cxx{driver} ../../brep/lib{brep} $libs
-
-# Disable for now until build2 test module supports running custom
-# commands, pre/post steps.
-#
-exe{driver}: test = false
-
-# precondition: PostgreSQL server running port 8432 with brep schema created.
-# test:
-# ./driver ../../loader/brep-loader --db-host localhost --db-port 8432 ./r.conf
diff --git a/tests/loader/driver.cxx b/tests/loader/driver.cxx
deleted file mode 100644
index 67093d9..0000000
--- a/tests/loader/driver.cxx
+++ /dev/null
@@ -1,756 +0,0 @@
-// file : tests/loader/driver.cxx -*- C++ -*-
-// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
-// license : MIT; see accompanying LICENSE file
-
-#include <iostream>
-#include <exception>
-#include <algorithm> // sort(), find()
-
-#include <odb/session.hxx>
-#include <odb/transaction.hxx>
-
-#include <odb/pgsql/database.hxx>
-
-#include <butl/process>
-#include <butl/filesystem>
-
-#include <brep/types>
-#include <brep/utility>
-
-#include <brep/package>
-#include <brep/package-odb>
-
-using namespace std;
-using namespace odb::core;
-using namespace butl;
-using namespace brep;
-
-// @@ Rather add this to optional in libbutl. See:
-//
-// http://en.cppreference.com/w/cpp/experimental/optional/operator_cmp
-
-template <typename T>
-static inline auto
-operator== (const optional<T>& a, const optional<T>& b) -> decltype (*a == *b)
-{
- return !a == !b && (!a || *a == *b);
-}
-
-// @@ Add it to libbrep rather?
-//
-static inline bool
-operator== (const dependency_constraint& a, const dependency_constraint& b)
-{
- return a.min_version == b.min_version && a.max_version == b.max_version &&
- a.min_open == b.min_open && a.max_open == b.max_open;
-}
-
-static inline bool
-operator== (const dependency& a, const dependency& b)
-{
- return a.name () == b.name () && a.constraint == b.constraint;
-}
-
-static bool
-check_location (shared_ptr<package>& p)
-{
- if (p->internal ())
- return p->location && *p->location ==
- path (p->id.name + "-" + p->version.string () + ".tar.gz");
- else
- return !p->location;
-}
-
-static bool
-check_external (const package& p)
-{
- return p.summary.empty () && p.tags.empty () && !p.description &&
- p.url.empty () && !p.package_url && p.email.empty () && !p.package_email &&
- !p.internal () && p.other_repositories.size () > 0 &&
- p.priority == priority () && p.changes.empty () &&
- p.license_alternatives.empty () && p.dependencies.empty () &&
- p.requirements.empty ();
-}
-
-int
-main (int argc, char* argv[])
-{
- if (argc != 7)
- {
- cerr << "usage: " << argv[0]
- << " <loader_path> --db-host <host> --db-port <port>"
- << " <loader_conf_file>" << endl;
-
- return 1;
- }
-
- try
- {
- path cp (argv[6]);
-
- // Make configuration file path absolute to use it's directory as base for
- // internal repositories relative local paths.
- //
- if (cp.relative ())
- cp.complete ();
-
- // Update packages file timestamp to enforce loader to update
- // persistent state.
- //
- path p (cp.directory () / path ("1/stable/packages"));
- char const* args[] = {"touch", p.string ().c_str (), nullptr};
- assert (process (args).wait ());
-
- timestamp srt (file_mtime (p));
-
- // Run the loader.
- //
- char const** ld_args (const_cast<char const**> (argv + 1));
- assert (process (ld_args).wait ());
-
- // Check persistent objects validity.
- //
- odb::pgsql::database db ("", "", "brep", argv[3], stoul (argv[5]));
-
- {
- session s;
- transaction t (db.begin ());
-
- assert (db.query<repository> ().size () == 5);
- assert (db.query<package> ().size () == 15);
-
- shared_ptr<repository> sr (db.load<repository> ("cppget.org/stable"));
- shared_ptr<repository> mr (db.load<repository> ("cppget.org/math"));
- shared_ptr<repository> cr (db.load<repository> ("cppget.org/misc"));
- shared_ptr<repository> tr (db.load<repository> ("cppget.org/testing"));
- shared_ptr<repository> gr (db.load<repository> ("cppget.org/staging"));
-
- // Verify 'stable' repository.
- //
- assert (sr->location.canonical_name () == "cppget.org/stable");
- assert (sr->location.string () ==
- "http://pkg.cppget.org/1/stable");
- assert (sr->display_name == "stable");
- assert (sr->priority == 1);
- assert (!sr->url);
- assert (sr->email && *sr->email == "repoman@cppget.org");
- assert (sr->summary &&
- *sr->summary == "General C++ package stable repository");
- assert (sr->description && *sr->description ==
- "This is the awesome C++ package repository full of exciting "
- "stuff.");
-
- dir_path srp (cp.directory () / dir_path ("1/stable"));
- assert (sr->local_path == srp.normalize ());
-
- assert (sr->packages_timestamp == srt);
- assert (sr->repositories_timestamp ==
- file_mtime (dir_path (sr->local_path) / path ("repositories")));
- assert (sr->internal);
-
- shared_ptr<package> fpv1 (
- db.load<package> (package_id ("libfoo", version ("1.0"))));
- assert (check_location (fpv1));
-
- shared_ptr<package> fpv2 (
- db.load<package> (package_id ("libfoo", version ("1.2.2"))));
- assert (check_location (fpv2));
-
- shared_ptr<package> fpv2a (
- db.load<package> (package_id ("libfoo", version ("1.2.2-alpha.1"))));
- assert (check_location (fpv2a));
-
- shared_ptr<package> fpv3 (
- db.load<package> (package_id ("libfoo", version ("1.2.3+4"))));
- assert (check_location (fpv3));
-
- shared_ptr<package> fpv4 (
- db.load<package> (package_id ("libfoo", version ("1.2.4"))));
- assert (check_location (fpv4));
-
- assert (sr->complements.empty ());
- assert (sr->prerequisites.size () == 2);
- assert (sr->prerequisites[0].load () == cr);
- assert (sr->prerequisites[1].load () == mr);
-
- // Verify libfoo package versions.
- //
- // libfoo-1.0
- //
- assert (fpv1->summary == "The Foo Library");
- assert (fpv1->tags.empty ());
- assert (!fpv1->description);
- assert (fpv1->url == "http://www.example.com/foo/");
- assert (!fpv1->package_url);
- assert (fpv1->email == "foo-users@example.com");
- assert (!fpv1->package_email);
-
- assert (fpv1->internal_repository.load () == sr);
- assert (fpv1->other_repositories.size () == 2);
- assert (fpv1->other_repositories[0].load () == mr);
- assert (fpv1->other_repositories[1].load () == cr);
-
- assert (fpv1->priority == priority::low);
- assert (fpv1->changes.empty ());
-
- assert (fpv1->license_alternatives.size () == 1);
- assert (fpv1->license_alternatives[0].size () == 1);
- assert (fpv1->license_alternatives[0][0] == "MIT");
-
- assert (fpv1->dependencies.empty ());
- assert (fpv1->requirements.empty ());
-
- // libfoo-1.2.2
- //
- assert (fpv2->summary == "The Foo library");
- assert (fpv2->tags == strings ({"c++", "foo"}));
- assert (!fpv2->description);
- assert (fpv2->url == "http://www.example.com/foo/");
- assert (!fpv2->package_url);
- assert (fpv2->email == "foo-users@example.com");
- assert (!fpv2->package_email);
-
- assert (fpv2->internal_repository.load () == sr);
- assert (fpv2->other_repositories.empty ());
- assert (fpv2->priority == priority::low);
- assert (fpv2->changes.empty ());
-
- assert (fpv2->license_alternatives.size () == 1);
- assert (fpv2->license_alternatives[0].size () == 1);
- assert (fpv2->license_alternatives[0][0] == "MIT");
-
- assert (fpv2->dependencies.size () == 2);
- assert (fpv2->dependencies[0].size () == 1);
- assert (fpv2->dependencies[1].size () == 1);
-
- auto dep (
- [&db](const char* n,
- const optional<dependency_constraint>& c) -> dependency
- {
- return {lazy_shared_ptr<package> (db, package_id (n, version ())), c};
- });
-
- assert (fpv2->dependencies[0][0] ==
- dep (
- "libbar",
- optional<dependency_constraint> (
- dependency_constraint (
- nullopt, true, version ("2.4.0"), false))));
-
- assert (fpv2->dependencies[1][0] ==
- dep (
- "libexp",
- optional<dependency_constraint> (
- dependency_constraint (
- version ("1~1.2"), false, version ("1~1.2"), false))));
-
- // libfoo-1.2.2-alpha.1
- //
- assert (fpv2a->summary == "The Foo library");
- assert (fpv2a->tags == strings ({"c++", "foo"}));
- assert (!fpv2a->description);
- assert (fpv2a->url == "http://www.example.com/foo/");
- assert (!fpv2a->package_url);
- assert (fpv2a->email == "foo-users@example.com");
- assert (!fpv2a->package_email);
-
- assert (fpv2a->internal_repository.load () == sr);
- assert (fpv2a->other_repositories.empty ());
- assert (fpv2a->priority == priority::low);
- assert (fpv2a->changes.empty ());
-
- assert (fpv2a->license_alternatives.size () == 1);
- assert (fpv2a->license_alternatives[0].size () == 1);
- assert (fpv2a->license_alternatives[0][0] == "MIT");
-
- assert (fpv2a->dependencies.size () == 3);
- assert (fpv2a->dependencies[0].size () == 2);
- assert (fpv2a->dependencies[1].size () == 1);
- assert (fpv2a->dependencies[2].size () == 2);
-
- assert (fpv2a->dependencies[0][0] ==
- dep (
- "libmisc",
- optional<dependency_constraint> (
- dependency_constraint (
- version ("0.1"), false, version ("2.0.0-"), true))));
-
- assert (fpv2a->dependencies[0][1] ==
- dep (
- "libmisc",
- optional<dependency_constraint> (
- dependency_constraint (
- version ("2.0"), false, version ("5.0"), false))));
-
- assert (fpv2a->dependencies[1][0] ==
- dep (
- "libgenx",
- optional<dependency_constraint> (
- dependency_constraint (
- version ("0.2"), true, version ("3.0"), true))));
-
- assert (fpv2a->dependencies[2][0] ==
- dep (
- "libexpat",
- optional<dependency_constraint> (
- dependency_constraint (
- nullopt, true, version ("5.2"), true))));
-
- assert (fpv2a->dependencies[2][1] ==
- dep (
- "libexpat",
- optional<dependency_constraint> (
- dependency_constraint (
- version ("1"), true, version ("5.1"), false))));
-
- assert (fpv2a->requirements.empty ());
-
- // libfoo-1.2.3-4
- //
- assert (fpv3->summary == "The Foo library");
- assert (fpv3->tags == strings ({"c++", "foo"}));
- assert (!fpv3->description);
- assert (fpv3->url == "http://www.example.com/foo/");
- assert (!fpv3->package_url);
- assert (fpv3->email == "foo-users@example.com");
- assert (!fpv3->package_email);
-
- assert (fpv3->internal_repository.load () == sr);
- assert (fpv3->other_repositories.empty ());
- assert (fpv3->priority == priority::low);
-
- assert (fpv3->changes.empty ());
-
- assert (fpv3->license_alternatives.size () == 1);
- assert (fpv3->license_alternatives[0].size () == 1);
- assert (fpv3->license_alternatives[0][0] == "MIT");
-
- assert (fpv3->dependencies.size () == 1);
- assert (fpv3->dependencies[0].size () == 1);
- assert (fpv3->dependencies[0][0] ==
- dep (
- "libmisc",
- optional<dependency_constraint> (
- dependency_constraint (
- version ("2.0.0"), false, nullopt, true))));
-
- // libfoo-1.2.4
- //
- assert (fpv4->summary == "The Foo Library");
- assert (fpv4->tags == strings ({"c++", "foo"}));
- assert (*fpv4->description == "Very good foo library.");
- assert (fpv4->url == "http://www.example.com/foo/");
- assert (!fpv4->package_url);
- assert (fpv4->email == "foo-users@example.com");
- assert (!fpv4->package_email);
-
- assert (fpv4->internal_repository.load () == sr);
- assert (fpv4->other_repositories.empty ());
- assert (fpv4->priority == priority::low);
- assert (fpv4->changes == "some changes 1\nsome changes 2");
-
- assert (fpv4->license_alternatives.size () == 1);
- assert (fpv4->license_alternatives[0].comment ==
- "Permissive free software license.");
- assert (fpv4->license_alternatives[0].size () == 1);
- assert (fpv4->license_alternatives[0][0] == "MIT");
-
- assert (fpv4->dependencies.size () == 1);
- assert (fpv4->dependencies[0].size () == 1);
- assert (fpv4->dependencies[0][0] ==
- dep (
- "libmisc",
- optional<dependency_constraint> (
- dependency_constraint (
- version ("2.0.0"), false, nullopt, true))));
-
- // Verify 'math' repository.
- //
- assert (mr->location.canonical_name () == "cppget.org/math");
- assert (mr->location.string () ==
- "http://pkg.cppget.org/1/math");
- assert (mr->display_name == "math");
- assert (mr->priority == 2);
- assert (!mr->url);
- assert (mr->email && *mr->email == "repoman@cppget.org");
- assert (mr->summary && *mr->summary == "Math C++ package repository");
- assert (mr->description && *mr->description ==
- "This is the awesome C++ package repository full of remarkable "
- "algorithms and\nAPIs.");
-
- dir_path mrp (cp.directory () / dir_path ("1/math"));
- assert (mr->local_path == mrp.normalize ());
-
- assert (mr->packages_timestamp ==
- file_mtime (dir_path (mr->local_path) / path ("packages")));
- assert (mr->repositories_timestamp ==
- file_mtime (dir_path (mr->local_path) / path ("repositories")));
- assert (mr->internal);
-
- shared_ptr<package> epv (
- db.load<package> (package_id ("libexp", version ("1~1.2"))));
- assert (check_location (epv));
-
- shared_ptr<package> fpv5 (
- db.load<package> (package_id ("libfoo", version ("1.2.4+1"))));
- assert (check_location (fpv5));
-
- shared_ptr<package> xpv (
- db.load<package> (package_id ("libstudxml", version ("1.0.0+1"))));
- assert (check_location (xpv));
-
- assert (mr->complements.empty ());
- assert (mr->prerequisites.size () == 1);
- assert (mr->prerequisites[0].load () == cr);
-
- // Verify libstudxml package version.
- //
- assert (xpv->summary == "Modern C++ XML API");
- assert (xpv->tags == strings ({"c++", "xml", "parser", "serializer",
- "pull", "streaming", "modern"}));
- assert (!xpv->description);
- assert (xpv->url == "http://www.codesynthesis.com/projects/libstudxml/");
- assert (!xpv->package_url);
- assert (xpv->email ==
- email ("studxml-users@codesynthesis.com",
- "Public mailing list, posts by non-members "
- "are allowed but moderated."));
- assert (xpv->package_email &&
- *xpv->package_email == email ("boris@codesynthesis.com",
- "Direct email to the author."));
-
- assert (xpv->internal_repository.load () == mr);
- assert (xpv->other_repositories.empty ());
- assert (xpv->priority == priority::low);
- assert (xpv->changes.empty ());
-
- assert (xpv->license_alternatives.size () == 1);
- assert (xpv->license_alternatives[0].size () == 1);
- assert (xpv->license_alternatives[0][0] == "MIT");
-
- assert (xpv->dependencies.size () == 2);
- assert (xpv->dependencies[0].size () == 1);
- assert (xpv->dependencies[0][0] ==
- dep (
- "libexpat",
- optional<dependency_constraint> (
- dependency_constraint (
- version ("2.0.0"), false, nullopt, true))));
-
- assert (xpv->dependencies[1].size () == 1);
- assert (xpv->dependencies[1][0] == dep ("libgenx", nullopt));
-
- assert (xpv->requirements.empty ());
-
- // Verify libfoo package versions.
- //
- // libfoo-1.2.4-1
- //
- assert (fpv5->summary == "The Foo Math Library");
- assert (fpv5->tags == strings ({"c++", "foo", "math"}));
- assert (*fpv5->description ==
- "A modern C++ library with easy to use linear algebra and lot of "
- "optimization\ntools.\n\nThere are over 100 functions in total "
- "with an extensive test suite. The API is\nsimilar to MATLAB."
- "\n\nUseful for conversion of research code into production "
- "environments.");
- assert (fpv5->url == "http://www.example.com/foo/");
- assert (fpv5->package_url &&
- *fpv5->package_url == "http://www.example.com/foo/pack");
- assert (fpv5->email == "foo-users@example.com");
- assert (fpv5->package_email &&
- *fpv5->package_email == "pack@example.com");
-
- assert (fpv5->internal_repository.load () == mr);
- assert (fpv5->other_repositories.size () == 1);
- assert (fpv5->other_repositories[0].load () == cr);
-
- assert (fpv5->priority == priority::high);
- assert (fpv5->priority.comment ==
- "Critical bug fixes, performance improvement.");
-
- const char ch[] = R"DLM(1.2.4+1
- * applied patch for critical bug-219
- * regenerated documentation
-
-1.2.4
- * test suite extended significantly)DLM";
-
- assert (fpv5->changes == ch);
-
- assert (fpv5->license_alternatives.size () == 2);
- assert (fpv5->license_alternatives[0].comment ==
- "If using with GNU TLS.");
- assert (fpv5->license_alternatives[0].size () == 2);
- assert (fpv5->license_alternatives[0][0] == "LGPLv2");
- assert (fpv5->license_alternatives[0][1] == "MIT");
- assert (fpv5->license_alternatives[1].comment ==
- "If using with OpenSSL.");
- assert (fpv5->license_alternatives[1].size () == 1);
- assert (fpv5->license_alternatives[1][0] == "BSD");
-
- assert (fpv5->dependencies.size () == 3);
- assert (fpv5->dependencies[0].size () == 2);
- assert (fpv5->dependencies[0].comment ==
- "Crashes with 1.1.0-2.3.0.");
-
- assert (fpv5->dependencies[0][0] ==
- dep (
- "libmisc",
- optional<dependency_constraint> (
- dependency_constraint (
- nullopt, true, version ("1.1"), true))));
-
- assert (fpv5->dependencies[0][1] ==
- dep (
- "libmisc",
- optional<dependency_constraint> (
- dependency_constraint (
- version ("2.3.0"), true, nullopt, true))));
-
- assert (fpv5->dependencies[1].size () == 1);
- assert (fpv5->dependencies[1].comment.empty ());
-
- assert (fpv5->dependencies[1][0] ==
- dep ("libexp",
- optional<dependency_constraint> (
- dependency_constraint (
- version ("1.0"), false, nullopt, true))));
-
- assert (fpv5->dependencies[2].size () == 2);
- assert (fpv5->dependencies[2].comment == "The newer the better.");
-
- assert (fpv5->dependencies[2][0] == dep ("libstudxml", nullopt));
- assert (fpv5->dependencies[2][1] == dep ("libexpat", nullopt));
-
- requirements& fpvr5 (fpv5->requirements);
- assert (fpvr5.size () == 4);
-
- assert (fpvr5[0] == strings ({"linux", "windows", "macosx"}));
- assert (!fpvr5[0].conditional);
- assert (fpvr5[0].comment == "Symbian support is coming.");
-
- assert (fpvr5[1] == strings ({"c++11"}));
- assert (!fpvr5[1].conditional);
- assert (fpvr5[1].comment.empty ());
-
- assert (fpvr5[2].empty ());
- assert (fpvr5[2].conditional);
- assert (fpvr5[2].comment ==
- "libc++ standard library if using Clang on Mac OS X.");
-
- assert (fpvr5[3] == strings ({"vc++ >= 12.0"}));
- assert (fpvr5[3].conditional);
- assert (fpvr5[3].comment == "Only if using VC++ on Windows.");
-
- // Verify libexp package version.
- //
- // libexp-1+1.2
- //
- assert (epv->summary == "The exponent");
- assert (epv->tags == strings ({"c++", "exponent"}));
- assert (epv->description && *epv->description ==
- "The exponent math function.");
- assert (epv->url == "http://www.exp.com");
- assert (!epv->package_url);
- assert (epv->email == email ("users@exp.com"));
- assert (!epv->package_email);
-
- assert (epv->internal_repository.load () == mr);
- assert (epv->other_repositories.empty ());
- assert (epv->priority == priority (priority::low));
- assert (epv->changes.empty ());
-
- assert (epv->license_alternatives.size () == 1);
- assert (epv->license_alternatives[0].size () == 1);
- assert (epv->license_alternatives[0][0] == "MIT");
-
- assert (epv->dependencies.size () == 1);
- assert (epv->dependencies[0].size () == 1);
- assert (epv->dependencies[0][0] == dep ("libmisc", nullopt));
-
- assert (epv->requirements.empty ());
-
- // Verify 'misc' repository.
- //
- assert (cr->location.canonical_name () == "cppget.org/misc");
- assert (cr->location.string () ==
- "http://pkg.cppget.org/1/misc");
- assert (cr->display_name.empty ());
- assert (cr->priority == 0);
- assert (cr->url && *cr->url == "http://misc.cppget.org/");
- assert (!cr->email);
- assert (!cr->summary);
- assert (!cr->description);
-
- dir_path crp (cp.directory () / dir_path ("1/misc"));
- assert (cr->local_path == crp.normalize ());
-
- assert (cr->packages_timestamp ==
- file_mtime (dir_path (cr->local_path) / path ("packages")));
- assert (cr->repositories_timestamp ==
- file_mtime (dir_path (cr->local_path) / path ("repositories")));
- assert (!cr->internal);
-
- shared_ptr<package> bpv (
- db.load<package> (package_id ("libbar", version ("2.3.5"))));
- assert (check_location (bpv));
-
- shared_ptr<package> fpv0 (
- 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));
-
- assert (cr->prerequisites.empty ());
- assert (cr->complements.size () == 1);
- assert (cr->complements[0].load () == tr);
-
- // Verify libbar package version.
- //
- // libbar-2.3.5
- //
- assert (check_external (*bpv));
- assert (bpv->other_repositories.size () == 1);
- assert (bpv->other_repositories[0].load () == cr);
-
- // Verify libfoo package versions.
- //
- // libfoo-0.1
- //
- assert (check_external (*fpv0));
- assert (fpv0->other_repositories.size () == 1);
- assert (fpv0->other_repositories[0].load () == cr);
-
- // libfoo-1.2.4-2
- //
- assert (check_external (*fpv6));
- assert (fpv6->other_repositories.size () == 1);
- assert (fpv6->other_repositories[0].load () == cr);
-
- // Verify 'testing' repository.
- //
- assert (tr->location.canonical_name () == "cppget.org/testing");
- assert (tr->location.string () ==
- "http://pkg.cppget.org/1/testing");
- assert (tr->display_name.empty ());
- assert (tr->priority == 0);
- assert (tr->url && *tr->url == "http://test.cppget.org/hello/");
- assert (!tr->email);
- assert (!tr->summary);
- assert (!tr->description);
-
- dir_path trp (cp.directory () / dir_path ("1/testing"));
- assert (tr->local_path == trp.normalize ());
-
- assert (tr->packages_timestamp ==
- file_mtime (dir_path (tr->local_path) / path ("packages")));
- assert (tr->repositories_timestamp ==
- file_mtime (dir_path (tr->local_path) / path ("repositories")));
- assert (!tr->internal);
-
- shared_ptr<package> mpv0 (
- db.load<package> (package_id ("libmisc", version ("2.4.0"))));
- assert (check_location (mpv0));
-
- assert (tr->prerequisites.empty ());
- assert (tr->complements.size () == 1);
- assert (tr->complements[0].load () == gr);
-
- // Verify libmisc package version.
- //
- // libmisc-2.4.0
- //
- assert (check_external (*mpv0));
- assert (mpv0->other_repositories.size () == 1);
- assert (mpv0->other_repositories[0].load () == tr);
-
- // Verify 'staging' repository.
- //
- assert (gr->location.canonical_name () == "cppget.org/staging");
- assert (gr->location.string () ==
- "http://pkg.cppget.org/1/staging");
- assert (gr->display_name.empty ());
- assert (gr->priority == 0);
- assert (gr->url && *gr->url == "http://cppget.org/");
- assert (!gr->email);
- assert (!gr->summary);
- assert (!gr->description);
-
- dir_path grp (cp.directory () / dir_path ("1/staging"));
- assert (gr->local_path == grp.normalize ());
-
- assert (gr->packages_timestamp ==
- file_mtime (dir_path (gr->local_path) / path ("packages")));
- assert (gr->repositories_timestamp ==
- file_mtime (dir_path (gr->local_path) / path ("repositories")));
- assert (!gr->internal);
-
- shared_ptr<package> tpv (
- db.load<package> (package_id ("libexpat", version ("5.1"))));
- assert (check_location (tpv));
-
- shared_ptr<package> gpv (
- db.load<package> (package_id ("libgenx", version ("1.0"))));
- assert (check_location (gpv));
-
- shared_ptr<package> mpv1 (
- db.load<package> (package_id ("libmisc", version ("1.0"))));
- assert (check_location (mpv1));
-
- assert (gr->prerequisites.empty ());
- assert (gr->complements.empty ());
-
- // Verify libexpat package version.
- //
- // libexpat-5.1
- //
- assert (check_external (*tpv));
- assert (tpv->other_repositories.size () == 1);
- assert (tpv->other_repositories[0].load () == gr);
-
- // Verify libgenx package version.
- //
- // libgenx-1.0
- //
- assert (check_external (*gpv));
- assert (gpv->other_repositories.size () == 1);
- assert (gpv->other_repositories[0].load () == gr);
-
- // Verify libmisc package version.
- //
- // libmisc-1.0
- //
- assert (check_external (*mpv1));
- assert (mpv1->other_repositories.size () == 1);
- assert (mpv1->other_repositories[0].load () == gr);
-
- // Change package summary, update the object persistent state, rerun
- // loader and ensure the model were not rebuilt.
- //
- bpv->summary = "test";
- db.update (bpv);
-
- t.commit ();
- }
-
- assert (process (ld_args).wait ());
- transaction t (db.begin ());
-
- shared_ptr<package> bpv (
- db.load<package> (package_id ("libbar", version ("2.3.5"))));
-
- assert (bpv->summary == "test");
-
- t.commit ();
- }
- // Fully qualified to avoid ambiguity with odb exception.
- //
- catch (const std::exception& e)
- {
- cerr << e.what () << endl;
- return 1;
- }
-}
diff --git a/tests/loader/r.conf b/tests/loader/r.conf
deleted file mode 100644
index 8da4b77..0000000
--- a/tests/loader/r.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-http://pkg.cppget.org/1/stable stable 1/stable
-http://pkg.cppget.org/1/math math 1/math