aboutsummaryrefslogtreecommitdiff
path: root/brep/search.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'brep/search.cxx')
-rw-r--r--brep/search.cxx74
1 files changed, 38 insertions, 36 deletions
diff --git a/brep/search.cxx b/brep/search.cxx
index 16e9f23..fc86284 100644
--- a/brep/search.cxx
+++ b/brep/search.cxx
@@ -14,10 +14,12 @@
#include <odb/pgsql/database.hxx>
+#include <butl/path>
+
#include <web/module>
#include <brep/package>
-#include <brep/package-odb.hxx>
+#include <brep/package-odb>
using namespace std;
using namespace odb::core;
@@ -33,11 +35,11 @@ namespace brep
cli::unknown_mode::fail,
cli::unknown_mode::fail);
- db_ = make_shared<odb::pgsql::database>("",
- "",
- "brep",
- options_->db_host (),
- options_->db_port ());
+ db_ = make_shared<odb::pgsql::database> ("",
+ "",
+ "brep",
+ options_->db_host (),
+ options_->db_port ());
if (options_->results_on_page () > 30)
fail << "too many search results on page: "
@@ -52,13 +54,21 @@ namespace brep
{
MODULE_DIAG;
- std::shared_ptr<package> cli (make_shared<package> ());
-
- cli->name = "cli";
- cli->summary = "CLI is ...";
- cli->description = "This is CLI";
- cli->tags.push_back ("compiler");
- cli->tags.push_back ("C++");
+ shared_ptr<package> cli (
+ make_shared<package> ("cli",
+ "CLI is ...",
+ strings ({"compiler", "c++"}),
+ string ("This is CLI"),
+ url (),
+ url (),
+ email (),
+ email ()));
+
+ shared_ptr<repository> stable (
+ make_shared<repository> (
+ repository_location ("http://pkg.cpp.org/1/stable"),
+ "Stable",
+ dir_path ("/var/pkg/1/stable")));
licenses l;
l.comment = "License\"A'";
@@ -67,13 +77,6 @@ namespace brep
l.push_back ("BBB");
l.push_back ("CCC");
- std::shared_ptr<package_version> v (make_shared<package_version> ());
-
- v->version = version ("1.1");
- v->package = cli;
-
- v->license_alternatives.push_back (l);
-
dependency_alternatives da;
da.push_back (
{"icl", version_comparison{version ("1.3.3"), comparison::gt}});
@@ -81,30 +84,29 @@ namespace brep
da.push_back (
{"ocl", version_comparison{version ("1.5.5"), comparison::lt}});
- v->dependencies.push_back (da);
-
- {
- requirement_alternatives ra;
- ra.push_back ("TAO");
- ra.push_back ("ORBacus");
-
- v->requirements.push_back (ra);
- }
+ requirement_alternatives ra1;
+ ra1.push_back ("TAO");
+ ra1.push_back ("ORBacus");
- {
- requirement_alternatives ra;
- ra.push_back ("Xerces");
-
- v->requirements.push_back (ra);
- }
+ requirement_alternatives ra2;
+ ra2.push_back ("Xerces");
- cli->versions.push_back (v);
+ shared_ptr<package_version> v (
+ make_shared<package_version> (stable,
+ cli,
+ version ("1.1"),
+ priority (),
+ license_alternatives ({l}),
+ "some changes 1\nsome changes 2",
+ dependencies ({da}),
+ requirements ({ra1, ra2})));
transaction t (db_->begin ());
// t.tracer (odb::stderr_full_tracer);
{
db_->persist (cli);
+ db_->persist (stable);
db_->persist (v);
}