diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-10-10 15:37:13 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-10-10 15:37:13 +0200 |
commit | bc965df24ffae81e9a05f63b31d46fa01a8d52d9 (patch) | |
tree | 3c9195ed9954326a7f788fa5237a2252ab0270fa | |
parent | 1a87500a2e7e6d4c0cb783cc6f003fc703315d16 (diff) |
Rename package_version class to package
-rw-r--r-- | brep/package | 124 | ||||
-rw-r--r-- | brep/package-search.cxx | 26 | ||||
-rw-r--r-- | brep/package-version-details.cxx | 60 | ||||
-rw-r--r-- | brep/package-version-search.cxx | 50 | ||||
-rw-r--r-- | brep/package.cxx | 50 | ||||
-rw-r--r-- | loader/loader.cxx | 37 | ||||
-rw-r--r-- | tests/loader/driver.cxx | 125 |
7 files changed, 217 insertions, 255 deletions
diff --git a/brep/package b/brep/package index 98e0ca4..800f716 100644 --- a/brep/package +++ b/brep/package @@ -72,7 +72,7 @@ namespace brep // Forward declarations. // class repository; - class package_version; + class package; using strings = std::vector<std::string>; @@ -106,9 +106,9 @@ namespace brep using repository_location = bpkg::repository_location; #pragma db value - struct package_version_id + struct package_id { - std::string package; + std::string name; #pragma db value struct version_type @@ -180,8 +180,8 @@ namespace brep // tricky. Can stick to just a package name until get some clarity on // "foreign" package resolution. // - // 4. As we get rid of the package class the dependency resolution come to - // finding the best matching package version object. The question is + // 4. As we left just the the package class the dependency resolution come to + // finding the best version matching package object. The question is // if to resolve dependencies on the loading phase or in the WEB interface // when required. The arguments in favour of doing that during loading // phase are: @@ -207,11 +207,6 @@ namespace brep using requirements = std::vector<requirement_alternatives>; - // Intended for instantiating key classes for maps used for simulation of - // 2-dimensional value type containers. Parameter type T not being used in - // template implementation is required to instantiate unrelated key - // classes to achieve proper table column naming with ODB pragmas. - // #pragma db object pointer(std::shared_ptr) session class repository { @@ -272,12 +267,8 @@ namespace brep repository () = default; }; - // @@ While it's very tempting to rename package_version to package wouldn't - // it be confusing having package denoting both specific package version - // and package as a collection of versions. - // #pragma db object pointer(std::shared_ptr) session - class package_version + class package { public: using repository_type = brep::repository; @@ -289,26 +280,26 @@ namespace brep using dependencies_type = brep::dependencies; using requirements_type = brep::requirements; - // Create internal package version object. + // Create internal package object. // - package_version (std::string name, - version_type, - priority_type, - std::string summary, - license_alternatives_type, - strings tags, - optional<std::string> description, - std::string changes, - url_type, - optional<url_type> package_url, - email_type, - optional<email_type> package_email, - dependencies_type, - requirements_type, - optional<path> location, - std::shared_ptr<repository_type>); - - // Create external package version object. + package (std::string name, + version_type, + priority_type, + std::string summary, + license_alternatives_type, + strings tags, + optional<std::string> description, + std::string changes, + url_type, + optional<url_type> package_url, + email_type, + optional<email_type> package_email, + dependencies_type, + requirements_type, + optional<path> location, + std::shared_ptr<repository_type>); + + // Create external package object. // // External repository packages can appear on the WEB interface only on // the package version details page in dependency list in the form of a @@ -316,9 +307,9 @@ namespace brep // required to compose such a link is the package name, version, and // repository location. // - package_version (std::string name, - version_type, - std::shared_ptr<repository_type>); + package (std::string name, + version_type, + std::shared_ptr<repository_type>); // Manifest data. // @@ -338,8 +329,8 @@ namespace brep requirements_type requirements; odb::lazy_shared_ptr<repository_type> internal_repository; - // Path to the package file. Set only for package versions present in - // internal repository. + // Path to the package file. Set only for packages present in internal + // repository. // optional<path> location; @@ -354,7 +345,7 @@ namespace brep struct _id_type { #pragma db column("") - package_version_id data; + package_id data; #pragma db column("version_upstream") std::string upstream; @@ -434,43 +425,40 @@ namespace brep private: friend class odb::access; - package_version () = default; + package () = default; }; - // Find the latest version of an internal package. + // Find an internal package of the latest version. // - #pragma db view object(package_version) \ - object(package_version = v: \ - package_version::id.data.package == v::id.data.package && \ - package_version::id.data.version < v::id.data.version) \ - query((package_version::internal_repository.is_not_null () && \ - v::id.data.package.is_null ()) + "AND" + (?)) - struct latest_internal_package_version + #pragma db view object(package) \ + object(package = p: \ + package::id.data.name == p::id.data.name && \ + package::id.data.version < p::id.data.version) \ + query((package::internal_repository.is_not_null () && \ + p::id.data.name.is_null ()) + "AND" + (?)) + struct latest_internal_package { - using package_version_type = brep::package_version; - std::shared_ptr<package_version_type> package_version; - - operator const std::shared_ptr<package_version_type>& () const - {return package_version;} + using package_type = brep::package; + std::shared_ptr<package_type> package; - explicit operator package_version_type& () const - {return *package_version;} + operator const std::shared_ptr<package_type>& () const {return package;} + explicit operator package_type& () const {return *package;} }; - #pragma db view object(package_version) \ - query(package_version::internal_repository.is_not_null () && (?)) - struct internal_package_count + // Count number of internal packages distinct names. + // + #pragma db view object(package) \ + query(package::internal_repository.is_not_null () && (?)) + struct internal_package_name_count { - #pragma db column("count(DISTINCT" + \ - package_version::id.data.package+ ")") - + #pragma db column("count(DISTINCT" + package::id.data.name+ ")") std::size_t result; operator std::size_t () const {return result;} }; - #pragma db view object(package_version) - struct package_version_count + #pragma db view object(package) + struct package_count { #pragma db column("count(*)") std::size_t result; @@ -480,7 +468,7 @@ namespace brep // Version comparison operators. // - // They allow comparing objects that have epoch, canonical_upstream, + // They allow comparing objects that have epoch, canonical_upstream // and revision data members. // template <typename T1, typename T2> @@ -553,11 +541,9 @@ namespace brep } inline bool - operator< (const package_version_id& x, const package_version_id& y) + operator< (const package_id& x, const package_id& y) { - int r (x.package.compare (y.package)); - - if (r != 0) + if (int r = x.name.compare (y.name)) return r < 0; return x.version < y.version; diff --git a/brep/package-search.cxx b/brep/package-search.cxx index cc15e02..27709c8 100644 --- a/brep/package-search.cxx +++ b/brep/package-search.cxx @@ -82,37 +82,35 @@ namespace brep << ~HEAD << BODY; - string q ( - pr.query ().empty () ? "" : "q=" + mime_url_encode (pr.query ())); - + string q (pr.query ().empty () ? "" : "q=" + mime_url_encode (pr.query ())); size_t rop (options_->results_on_page ()); transaction t (db_->begin ()); // @@ Query will include search criteria if specified. // - size_t pc (db_->query_value<internal_package_count> ()); + size_t pc (db_->query_value<internal_package_name_count> ()); s << DIV(ID="packages") << "Packages (" << pc << ")" << ~DIV; // @@ Query will also include search criteria if specified. // - using query = query<latest_internal_package_version>; + using query = query<latest_internal_package>; auto r ( - db_->query<latest_internal_package_version> (query (true) + - "ORDER BY" + query::package_version::id.data.package + + db_->query<latest_internal_package> (query (true) + + "ORDER BY" + query::package::id.data.name + "OFFSET" + to_string (pr.page () * rop) + "LIMIT" + to_string (rop))); for (const auto& ip: r) { - const package_version& v (ip); + const package& p (ip); s << DIV(CLASS="package") << DIV(CLASS="name") << A - << HREF << "/go/" << mime_url_encode (v.name); + << HREF << "/go/" << mime_url_encode (p.name); // Propagate search criteria to the package version search url. // @@ -120,14 +118,14 @@ namespace brep s << "?" << q; s << ~HREF - << v.name + << p.name << ~A << ~DIV - << DIV(CLASS="summary") << v.summary << ~DIV - << DIV_TAGS (v.tags) - << DIV_LICENSES (v.license_alternatives) + << DIV(CLASS="summary") << p.summary << ~DIV + << DIV_TAGS (p.tags) + << DIV_LICENSES (p.license_alternatives) << DIV(CLASS="dependencies") - << "Dependencies: " << v.dependencies.size () + << "Dependencies: " << p.dependencies.size () << ~DIV << ~DIV; } diff --git a/brep/package-version-details.cxx b/brep/package-version-details.cxx index 0ad86d7..543f3b6 100644 --- a/brep/package-version-details.cxx +++ b/brep/package-version-details.cxx @@ -63,7 +63,7 @@ namespace brep } assert (i != rq.path ().rend ()); - const string& p (*i); + const string& n (*i); params::package_version_details pr; @@ -80,7 +80,7 @@ namespace brep const char* ident ("\n "); const string& vs (v.string ()); - const string name (p + " " + vs); + const string name (n + " " + vs); const string title ("Package Version " + name); serializer s (rs.content (), title); @@ -108,24 +108,24 @@ namespace brep << ~HEAD << BODY << DIV(ID="name") - << A << HREF << "/go/" << mime_url_encode (p) << ~HREF << p << ~A + << A << HREF << "/go/" << mime_url_encode (n) << ~HREF << n << ~A << " " << vs << ~DIV; bool not_found (false); - shared_ptr<package_version> pv; + shared_ptr<package> p; transaction t (db_->begin ()); try { - package_version_id id {p, v.epoch, v.canonical_upstream, v.revision}; - pv = db_->load<package_version> (id); + package_id id {n, v.epoch, v.canonical_upstream, v.revision}; + p = db_->load<package> (id); - // If the requested package version turned up to be an "external" one - // just respond that no "internal" package version is present. + // If the requested package turned up to be an "external" one just + // respond that no "internal" package is present. // - not_found = pv->internal_repository == nullptr; + not_found = p->internal_repository == nullptr; } catch (const object_not_persistent& ) { @@ -135,27 +135,27 @@ namespace brep if (not_found) throw invalid_request (404, "Package '" + name + "' not found"); - assert (pv->location); - const string u (pv->internal_repository.load ()->location.string () + - "/" + pv->location->string ()); + assert (p->location); + const string u (p->internal_repository.load ()->location.string () + + "/" + p->location->string ()); s << DIV(CLASS="url") << A << HREF << u << ~HREF << u << ~A << ~DIV - << DIV(ID="summary") << pv->summary << ~DIV - << DIV_URL (pv->url) - << DIV_EMAIL (pv->email); + << DIV(ID="summary") << p->summary << ~DIV + << DIV_URL (p->url) + << DIV_EMAIL (p->email); - if (pv->description) - s << DIV(ID="description") << *pv->description << ~DIV; + if (p->description) + s << DIV(ID="description") << *p->description << ~DIV; - const priority& pt (pv->priority); + const priority& pt (p->priority); - s << DIV_TAGS (pv->tags) + s << DIV_TAGS (p->tags) << DIV_PRIORITY (pt); if (!pt.comment.empty ()) s << DIV(CLASS="comment") << pt.comment << ~DIV; - const auto& ls (pv->license_alternatives); + const auto& ls (p->license_alternatives); s << DIV(ID="licenses") << "Licenses:" @@ -182,7 +182,7 @@ namespace brep s << ~UL << ~DIV; - const auto& ds (pv->dependencies); + const auto& ds (p->dependencies); if (!ds.empty ()) { @@ -219,7 +219,7 @@ namespace brep << ~DIV; } - const auto& rm (pv->requirements); + const auto& rm (p->requirements); if (!rm.empty ()) { @@ -260,23 +260,23 @@ namespace brep << ~DIV; } - if (pv->package_url || pv->package_email) + if (p->package_url || p->package_email) { s << DIV(ID="package") << "Package:" << UL; - if (pv->package_url) - s << LI << DIV_URL (*pv->package_url) << ~LI; + if (p->package_url) + s << LI << DIV_URL (*p->package_url) << ~LI; - if (pv->package_email) - s << LI << DIV_EMAIL (*pv->package_email) << ~LI; + if (p->package_email) + s << LI << DIV_EMAIL (*p->package_email) << ~LI; s << ~UL << ~DIV; } - const auto& er (pv->external_repositories); + const auto& er (p->external_repositories); if (!er.empty ()) { @@ -293,7 +293,7 @@ namespace brep if (l.port () != 0) u += ":" + to_string (l.port ()); - u += "/go/" + mime_url_encode (p) + "/" + vs; + u += "/go/" + mime_url_encode (n) + "/" + vs; s << LI << DIV(CLASS="url") << A << HREF << u << ~HREF << u << ~A << ~DIV << ~LI; @@ -305,7 +305,7 @@ namespace brep t.commit (); - const string& ch (pv->changes); + const string& ch (p->changes); if (!ch.empty ()) s << DIV(ID="changes") << "Changes:" << PRE << ch << ~PRE << ~DIV; diff --git a/brep/package-version-search.cxx b/brep/package-version-search.cxx index 7b7ed63..8433b75 100644 --- a/brep/package-version-search.cxx +++ b/brep/package-version-search.cxx @@ -92,37 +92,37 @@ namespace brep transaction t (db_->begin ()); - shared_ptr<package_version> pv; + shared_ptr<package> p; { - using query = query<latest_internal_package_version>; + using query = query<latest_internal_package>; - latest_internal_package_version v; - if (!db_->query_one<latest_internal_package_version> ( - query::package_version::id.data.package == name, v)) + latest_internal_package ip; + if (!db_->query_one<latest_internal_package> ( + query::package::id.data.name == name, ip)) { throw invalid_request (404, "Package '" + name + "' not found"); } - pv = v; + p = ip; } - s << DIV(ID="summary") << pv->summary << ~DIV - << DIV_URL (pv->url) - << DIV_EMAIL (pv->email); + s << DIV(ID="summary") << p->summary << ~DIV + << DIV_URL (p->url) + << DIV_EMAIL (p->email); - if (pv->description) - s << DIV(ID="description") << *pv->description << ~DIV; + if (p->description) + s << DIV(ID="description") << *p->description << ~DIV; - s << DIV_TAGS (pv->tags); + s << DIV_TAGS (p->tags); size_t pvc; { - using query = query<package_version_count>; + using query = query<package_count>; // @@ Query will also include search criteria if specified. // - pvc = db_->query_value<package_version_count> ( - query::id.data.package == name && + pvc = db_->query_value<package_count> ( + query::id.data.name == name && query::internal_repository.is_not_null ()); } @@ -132,21 +132,21 @@ namespace brep // from this page totally. // /* - if (pv->package_url) - s << DIV_URL (*pv->package_url); + if (p->package_url) + s << DIV_URL (*p->package_url); - if (pv->package_email) - s << DIV_EMAIL (*pv->package_email); + if (p->package_email) + s << DIV_EMAIL (*p->package_email); */ - // @@ Use appropriate view when clarify which package version info to be - // displayed and search index structure get implemented. Query will also - // include search criteria if specified. + // @@ Use appropriate view when clarify which package info to be displayed + // and search index structure get implemented. Query will also include + // search criteria if specified. // - using query = query<package_version>; + using query = query<package>; auto r ( - db_->query<package_version> ( - (query::id.data.package == name && + db_->query<package> ( + (query::id.data.name == name && query::internal_repository.is_not_null ()) + order_by_version_desc (query::id.data.version) + "OFFSET" + to_string (pr.page () * rop) + diff --git a/brep/package.cxx b/brep/package.cxx index 3cf4063..be14034 100644 --- a/brep/package.cxx +++ b/brep/package.cxx @@ -16,25 +16,25 @@ using namespace odb::core; namespace brep { - // package_version + // package // - package_version:: - package_version (string nm, - version_type vr, - priority_type pr, - string sm, - license_alternatives_type la, - strings tg, - optional<string> ds, - string ch, - url_type ur, - optional<url_type> pu, - email_type em, - optional<email_type> pe, - dependencies_type dp, - requirements_type rq, - optional<path> lc, - shared_ptr<repository_type> rp) + package:: + package (string nm, + version_type vr, + priority_type pr, + string sm, + license_alternatives_type la, + strings tg, + optional<string> ds, + string ch, + url_type ur, + optional<url_type> pu, + email_type em, + optional<email_type> pe, + dependencies_type dp, + requirements_type rq, + optional<path> lc, + shared_ptr<repository_type> rp) : name (move (nm)), version (move (vr)), priority (move (pr)), @@ -55,10 +55,10 @@ namespace brep assert (internal_repository->internal); } - package_version:: - package_version (string nm, - version_type vr, - shared_ptr<repository_type> rp) + package:: + package (string nm, + version_type vr, + shared_ptr<repository_type> rp) : name (move (nm)), version (move (vr)) { @@ -66,7 +66,7 @@ namespace brep external_repositories.emplace_back (move (rp)); } - package_version::_id_type package_version:: + package::_id_type package:: _id () const { return _id_type { @@ -79,11 +79,11 @@ namespace brep version.upstream}; } - void package_version:: + void package:: _id (_id_type&& v, database&) { const auto& dv (v.data.version); - name = move (v.data.package); + name = move (v.data.name); version = version_type (dv.epoch, move (v.upstream), dv.revision); assert (version.canonical_upstream == dv.canonical_upstream); } diff --git a/loader/loader.cxx b/loader/loader.cxx index 9ddd7c2..5a71305 100644 --- a/loader/loader.cxx +++ b/loader/loader.cxx @@ -275,9 +275,9 @@ load_packages (const shared_ptr<repository>& rp, database& db) for (auto& pm: pkm) { - shared_ptr<package_version> pv ( - db.find<package_version> ( - package_version_id + shared_ptr<package> p ( + db.find<package> ( + package_id { pm.name, { @@ -287,11 +287,11 @@ load_packages (const shared_ptr<repository>& rp, database& db) } })); - if (pv == nullptr) + if (p == nullptr) { if (rp->internal) { - // Create internal package version object. + // Create internal package object. // optional<string> dsc; if (pm.description) @@ -322,7 +322,7 @@ load_packages (const shared_ptr<repository>& rp, database& db) } } - pv = make_shared<package_version>( + p = make_shared<package> ( move (pm.name), move (pm.version), pm.priority ? move (*pm.priority) : priority (), @@ -341,20 +341,17 @@ load_packages (const shared_ptr<repository>& rp, database& db) rp); } else - // Create external package version object. + // Create external package object. // - pv = make_shared<package_version>( - move (pm.name), - move (pm.version), - rp); + p = make_shared<package> (move (pm.name), move (pm.version), rp); - db.persist (pv); + db.persist (p); } else { - // @@ Need to ensure that the same package versions coming from - // different repositories are equal. Probably will invent hashsum at - // some point for this purpose. + // @@ Need to ensure that the same packages coming from different + // repositories are equal. Probably will invent hashsum at some point + // for this purpose. // if (rp->internal) @@ -363,14 +360,14 @@ load_packages (const shared_ptr<repository>& rp, database& db) // // As soon as internal repositories get loaded first, the internal - // package version can duplicate an internal package version only. + // package can duplicate an internal package only. // - assert (pv->internal_repository != nullptr); + assert (p->internal_repository != nullptr); } else { - pv->external_repositories.push_back (rp); - db.update (pv); + p->external_repositories.push_back (rp); + db.update (p); } } } @@ -565,7 +562,7 @@ main (int argc, char* argv[]) { // Rebuild repositories persistent state from scratch. // - db.erase_query<package_version> (); + db.erase_query<package> (); db.erase_query<repository> (); // On the first pass over the internal repositories we load their diff --git a/tests/loader/driver.cxx b/tests/loader/driver.cxx index 44738e2..ef0654f 100644 --- a/tests/loader/driver.cxx +++ b/tests/loader/driver.cxx @@ -36,13 +36,13 @@ operator== (const dependency& a, const dependency& b) } static bool -check_location (shared_ptr<package_version>& pv) +check_location (shared_ptr<package>& p) { - if (pv->internal_repository == nullptr) - return !pv->location; + if (p->internal_repository == nullptr) + return !p->location; else - return pv->location && *pv->location == - path (pv->name + "-" + pv->version.string () + ".tar.gz"); + return p->location && *p->location == + path (p->name + "-" + p->version.string () + ".tar.gz"); } int @@ -90,7 +90,7 @@ main (int argc, char* argv[]) transaction t (db.begin ()); assert (db.query<repository> ().size () == 3); - assert (db.query<package_version> ().size () == 9); + assert (db.query<package> ().size () == 9); shared_ptr<repository> sr (db.load<repository> ("cppget.org/stable")); shared_ptr<repository> mr (db.load<repository> ("cppget.org/math")); @@ -112,43 +112,38 @@ main (int argc, char* argv[]) assert (sr->internal); version fv1 ("1.0"); - shared_ptr<package_version> fpv1 ( - db.load<package_version> ( - package_version_id { - "libfoo", - {fv1.epoch, fv1.canonical_upstream, fv1.revision}})); + shared_ptr<package> fpv1 ( + db.load<package> ( + package_id { + "libfoo", {fv1.epoch, fv1.canonical_upstream, fv1.revision}})); assert (check_location (fpv1)); version fv2 ("1.2.2"); - shared_ptr<package_version> fpv2 ( - db.load<package_version> ( - package_version_id { - "libfoo", - {fv2.epoch, fv2.canonical_upstream, fv2.revision}})); + shared_ptr<package> fpv2 ( + db.load<package> ( + package_id { + "libfoo", {fv2.epoch, fv2.canonical_upstream, fv2.revision}})); assert (check_location (fpv2)); version fv3 ("1.2.3-4"); - shared_ptr<package_version> fpv3 ( - db.load<package_version> ( - package_version_id { - "libfoo", - {fv3.epoch, fv3.canonical_upstream, fv3.revision}})); + shared_ptr<package> fpv3 ( + db.load<package> ( + package_id { + "libfoo", {fv3.epoch, fv3.canonical_upstream, fv3.revision}})); assert (check_location (fpv3)); version fv4 ("1.2.4"); - shared_ptr<package_version> fpv4 ( - db.load<package_version> ( - package_version_id { - "libfoo", - {fv4.epoch, fv4.canonical_upstream, fv4.revision}})); + shared_ptr<package> fpv4 ( + db.load<package> ( + package_id { + "libfoo", {fv4.epoch, fv4.canonical_upstream, fv4.revision}})); assert (check_location (fpv4)); version xv ("1.0.0-1"); - shared_ptr<package_version> xpv ( - db.load<package_version> ( - package_version_id { - "libstudxml", - {xv.epoch, xv.canonical_upstream, xv.revision}})); + shared_ptr<package> xpv ( + db.load<package> ( + package_id { + "libstudxml", {xv.epoch, xv.canonical_upstream, xv.revision}})); assert (check_location (xpv)); // Verify libstudxml package version. @@ -188,9 +183,7 @@ main (int argc, char* argv[]) comparison::ge, version ("2.0.0")})})); assert (xpv->dependencies[1].size () == 1); - assert (xpv->dependencies[1][0] == - (dependency { - "libgenx", brep::optional<dependency_constraint> ()})); + assert (xpv->dependencies[1][0] == (dependency {"libgenx", nullopt})); assert (xpv->requirements.empty ()); @@ -252,8 +245,7 @@ main (int argc, char* argv[]) (dependency { "libexp", brep::optional<dependency_constraint> ( - dependency_constraint{ - comparison::eq, version ("1+1.2")})})); + dependency_constraint{comparison::eq, version ("1+1.2")})})); assert (fpv2->requirements.empty ()); @@ -283,8 +275,7 @@ main (int argc, char* argv[]) (dependency { "libmisc", brep::optional<dependency_constraint> ( - dependency_constraint{ - comparison::ge, version ("2.0.0")})})); + dependency_constraint{comparison::ge, version ("2.0.0")})})); assert (fpv4->name == "libfoo"); assert (fpv4->version == version ("1.2.4")); @@ -313,8 +304,7 @@ main (int argc, char* argv[]) (dependency { "libmisc", brep::optional<dependency_constraint> ( - dependency_constraint{ - comparison::ge, version ("2.0.0")})})); + dependency_constraint{comparison::ge, version ("2.0.0")})})); // Verify 'math' repository. // @@ -333,19 +323,17 @@ main (int argc, char* argv[]) assert (mr->internal); version ev ("1+1.2"); - shared_ptr<package_version> epv ( - db.load<package_version> ( - package_version_id { - "libexp", - {ev.epoch, ev.canonical_upstream, ev.revision}})); + shared_ptr<package> epv ( + db.load<package> ( + package_id { + "libexp", {ev.epoch, ev.canonical_upstream, ev.revision}})); assert (check_location (epv)); version fv5 ("1.2.4-1"); - shared_ptr<package_version> fpv5 ( - db.load<package_version> ( - package_version_id { - "libfoo", - {fv5.epoch, fv5.canonical_upstream, fv5.revision}})); + shared_ptr<package> fpv5 ( + db.load<package> ( + package_id { + "libfoo", {fv5.epoch, fv5.canonical_upstream, fv5.revision}})); assert (check_location (fpv5)); // Verify libfoo package versions. @@ -407,8 +395,7 @@ main (int argc, char* argv[]) (dependency { "libmisc", brep::optional<dependency_constraint> ( - dependency_constraint{ - comparison::gt, version ("2.3.0")})})); + dependency_constraint{comparison::gt, version ("2.3.0")})})); assert (fpv5->dependencies[1].size () == 1); assert (fpv5->dependencies[1].comment == "Newer - better."); @@ -459,9 +446,7 @@ main (int argc, char* argv[]) assert (epv->dependencies.size () == 1); assert (epv->dependencies[0].size () == 1); - assert (epv->dependencies[0][0] == - (dependency { - "libmisc", brep::optional<dependency_constraint> ()})); + assert (epv->dependencies[0][0] == (dependency {"libmisc", nullopt})); assert (epv->requirements.empty ()); @@ -481,19 +466,17 @@ main (int argc, char* argv[]) assert (!cr->internal); version bv ("2.3.5"); - shared_ptr<package_version> bpv ( - db.load<package_version> ( - package_version_id { - "libbar", - {bv.epoch, bv.canonical_upstream, bv.revision}})); + shared_ptr<package> bpv ( + db.load<package> ( + package_id { + "libbar", {bv.epoch, bv.canonical_upstream, bv.revision}})); assert (check_location (bpv)); version fv0 ("0.1"); - shared_ptr<package_version> fpv0 ( - db.load<package_version> ( - package_version_id { - "libfoo", - {fv0.epoch, fv0.canonical_upstream, fv0.revision}})); + shared_ptr<package> fpv0 ( + db.load<package> ( + package_id { + "libfoo", {fv0.epoch, fv0.canonical_upstream, fv0.revision}})); assert (check_location (fpv0)); // Verify libbar package version. @@ -542,8 +525,8 @@ main (int argc, char* argv[]) assert (fpv0->dependencies.empty ()); assert (fpv0->requirements.empty ()); - // Change package version summary, update the object persistent - // state, rerun loader and ensure the model were not rebuilt. + // Change package summary, update the object persistent state, rerun + // loader and ensure the model were not rebuilt. // bpv->summary = "test"; db.update (bpv); @@ -555,11 +538,9 @@ main (int argc, char* argv[]) transaction t (db.begin ()); version bv ("2.3.5"); - shared_ptr<package_version> bpv ( - db.load<package_version> ( - package_version_id { - "libbar", - {bv.epoch, bv.canonical_upstream, bv.revision}})); + shared_ptr<package> bpv ( + db.load<package> ( + package_id {"libbar", {bv.epoch, bv.canonical_upstream, bv.revision}})); assert (bpv->summary == "test"); |