From 54e3c33fb327efe0cbfd806c5468cbe390dafeaa Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 12 Jun 2015 12:32:06 +0200 Subject: Implement object model for packages --- brep/search.cxx | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'brep/search.cxx') diff --git a/brep/search.cxx b/brep/search.cxx index 3f50383..9fc37e2 100644 --- a/brep/search.cxx +++ b/brep/search.cxx @@ -8,9 +8,19 @@ #include #include +#include +#include +#include + +#include + #include +#include +#include + using namespace std; +using namespace odb::core; namespace brep { @@ -23,6 +33,12 @@ namespace brep cli::unknown_mode::fail, cli::unknown_mode::fail); + db_ = make_shared("", + "", + "brep", + options_->db_host (), + options_->db_port ()); + if (options_->results_on_page () > 30) fail << "too many search results on page: " << options_->results_on_page (); @@ -36,6 +52,60 @@ namespace brep { MODULE_DIAG; + std::shared_ptr cli (make_shared ()); + + cli->name = "cli"; + cli->summary = "CLI is ..."; + cli->description = "This is CLI"; + cli->tags = "compiler, C++"; + + licenses l; + l.comment = "License\"A'"; + l.push_back ("XXX"); + l.push_back ("AAA"); + l.push_back ("BBB"); + l.push_back ("CCC"); + + std::shared_ptr v (make_shared ()); + + v->version = "1.1"; + v->package = cli; + + v->license_alternatives.push_back (l); + + dependency_alternatives da; + da.push_back ({"icl", version_comparison{"1.3.3", comparison::gt}}); + da.push_back ({"ocl", version_comparison{"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 ra; + ra.push_back ("Xerces"); + + v->requirements.push_back (ra); + } + + cli->versions.push_back (v); + + transaction t (db_->begin ()); +// t.tracer (odb::stderr_full_tracer); + + { + db_->persist (cli); + db_->persist (v); + } + + t.commit (); + chrono::seconds ma (60); rs.cookie ("Oh", " Ah\n\n", &ma, "/"); rs.cookie ("Hm", ";Yes", &ma); -- cgit v1.1