From 9f695c1d19e55e0581c184831bafcf6360defd52 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 3 Mar 2018 19:09:53 +0300 Subject: Rename bpkg repository type to pkg --- libbpkg/manifest.cxx | 84 ++++++++++++++++++++++++++-------------------------- libbpkg/manifest.hxx | 53 ++++++++++++++++----------------- 2 files changed, 68 insertions(+), 69 deletions(-) (limited to 'libbpkg') diff --git a/libbpkg/manifest.cxx b/libbpkg/manifest.cxx index 8683037..a030be2 100644 --- a/libbpkg/manifest.cxx +++ b/libbpkg/manifest.cxx @@ -713,10 +713,10 @@ namespace bpkg s.next ("", ""); // End of manifest. } - // bpkg_package_manifest + // pkg_package_manifest // static package_manifest - bpkg_package_manifest (parser& p, name_value nv, bool il, bool iu) + pkg_package_manifest (parser& p, name_value nv, bool il, bool iu) { auto bad_name ([&p, &nv](const string& d) { throw parsing (p.name (), nv.name_line, nv.name_column, d);}); @@ -1307,9 +1307,9 @@ namespace bpkg } package_manifest - bpkg_package_manifest (parser& p, bool iu) + pkg_package_manifest (parser& p, bool iu) { - package_manifest r (bpkg_package_manifest (p, p.next (), false, iu)); + package_manifest r (pkg_package_manifest (p, p.next (), false, iu)); // Make sure this is the end. // @@ -1322,9 +1322,9 @@ namespace bpkg } package_manifest - bpkg_package_manifest (parser& p, name_value nv, bool iu) + pkg_package_manifest (parser& p, name_value nv, bool iu) { - return bpkg_package_manifest (p, nv, true, iu); + return pkg_package_manifest (p, nv, true, iu); } // git_package_manifest @@ -1422,10 +1422,10 @@ namespace bpkg s.next ("", ""); // End of manifest. } - // bpkg_package_manifests + // pkg_package_manifests // - bpkg_package_manifests:: - bpkg_package_manifests (parser& p, bool iu) + pkg_package_manifests:: + pkg_package_manifests (parser& p, bool iu) { name_value nv (p.next ()); @@ -1472,10 +1472,10 @@ namespace bpkg // Parse package manifests. // for (nv = p.next (); !nv.empty (); nv = p.next ()) - push_back (bpkg_package_manifest (p, nv, iu)); + push_back (pkg_package_manifest (p, nv, iu)); } - void bpkg_package_manifests:: + void pkg_package_manifests:: serialize (serializer& s) const { // Serialize the package list manifest. @@ -1509,7 +1509,7 @@ namespace bpkg if (!p.sha256sum) bad_value ("no valid sha256sum"); - bpkg_package_manifest (s, p); + pkg_package_manifest (s, p); } s.next ("", ""); // End of stream. @@ -1761,8 +1761,8 @@ namespace bpkg { switch (t) { - case repository_type::bpkg: return "bpkg"; - case repository_type::git: return "git"; + case repository_type::pkg: return "pkg"; + case repository_type::git: return "git"; } assert (false); // Can't be here. @@ -1772,8 +1772,8 @@ namespace bpkg repository_type to_repository_type (const string& t) { - if (t == "bpkg") return repository_type::bpkg; - else if (t == "git") return repository_type::git; + if (t == "pkg") return repository_type::pkg; + else if (t == "git") return repository_type::git; else throw invalid_argument ("invalid repository type '" + t + "'"); } @@ -1791,7 +1791,7 @@ namespace bpkg { return url.path->extension () == "git" ? repository_type::git - : repository_type::bpkg; + : repository_type::pkg; } case repository_protocol::file: { @@ -1799,12 +1799,12 @@ namespace bpkg dir_exists (path_cast (*url.path) / dir_path (".git"), false) ? repository_type::git - : repository_type::bpkg; + : repository_type::pkg; } } assert (false); // Can't be here. - return repository_type::bpkg; + return repository_type::pkg; } // repository_location @@ -1818,7 +1818,7 @@ namespace bpkg switch (type) { - case repository_type::bpkg: + case repository_type::pkg: { bool bpkg (false); if (host.compare (0, 4, "www.") == 0 || @@ -1858,7 +1858,7 @@ namespace bpkg return e != nullptr && strcmp (e, "git") == 0 ? p.base () : p; } - // Should be bpkg repository location path. + // Should be pkg repository location path. // assert (!p.empty () && *p.begin () != ".."); @@ -1934,10 +1934,10 @@ namespace bpkg // switch (t) { - case repository_type::bpkg: + case repository_type::pkg: { if (url_.scheme == repository_protocol::git) - throw invalid_argument ("unsupported scheme for bpkg repository"); + throw invalid_argument ("unsupported scheme for pkg repository"); break; } @@ -1962,7 +1962,7 @@ namespace bpkg // switch (t) { - case repository_type::bpkg: + case repository_type::pkg: case repository_type::git: { if (!up.to_directory ()) @@ -2015,7 +2015,7 @@ namespace bpkg url_ = move (u); - // Set canonical name to the base location canonical name 'bpkg:' + // Set canonical name to the base location canonical name 'pkg:' // part. The '[#]' part of the canonical name is // calculated below. // @@ -2042,12 +2042,12 @@ namespace bpkg throw invalid_argument ("invalid path"); } - // For bpkg repository we need to check path for emptiness before + // For pkg repository we need to check path for emptiness before // proceeding further as a valid non empty location can not have an empty // URL object path member (which can be the case for the remote location, // but not for the relative or absolute). // - if (type_ == repository_type::bpkg && up.empty ()) + if (type_ == repository_type::pkg && up.empty ()) throw invalid_argument ("empty path"); // Need to check that URL path do not go past the root directory of a WEB @@ -2066,12 +2066,12 @@ namespace bpkg return; } - // Canonical name / part for the bpkg repository, and the + // Canonical name / part for the pkg repository, and the // full path with the .git extension stripped for the git repository. // path sp; - if (type_ == repository_type::bpkg) + if (type_ == repository_type::pkg) { sp = strip_path (up, remote () @@ -2187,7 +2187,7 @@ namespace bpkg if (l.local ()) throw invalid_argument (invalid_location); - if (l.type () != repository_type::bpkg || !url || (*url)[0] != '.') + if (l.type () != repository_type::pkg || !url || (*url)[0] != '.') return url; const path rp (*url); @@ -2223,7 +2223,7 @@ namespace bpkg if (strip_d) u.authority->host.value = strip_domain (u.authority->host, - repository_type::bpkg); + repository_type::pkg); // Web interface URL path part. // @@ -2374,7 +2374,7 @@ namespace bpkg } else if (n == "certificate") { - if (base_type != repository_type::bpkg) + if (base_type != repository_type::pkg) bad_name ("certificate not allowed"); if (r.certificate) @@ -2514,12 +2514,12 @@ namespace bpkg s.next ("", ""); // End of manifest. } - // bpkg_repository_manifest + // pkg_repository_manifest // repository_manifest - bpkg_repository_manifest (parser& p, bool iu) + pkg_repository_manifest (parser& p, bool iu) { - repository_manifest r (bpkg_repository_manifest (p, p.next (), iu)); + repository_manifest r (pkg_repository_manifest (p, p.next (), iu)); // Make sure this is the end. // @@ -2532,9 +2532,9 @@ namespace bpkg } repository_manifest - bpkg_repository_manifest (parser& p, name_value nv, bool iu) + pkg_repository_manifest (parser& p, name_value nv, bool iu) { - return parse_repository_manifest (p, nv, repository_type::bpkg, iu); + return parse_repository_manifest (p, nv, repository_type::pkg, iu); } // git_repository_manifest @@ -2560,15 +2560,15 @@ namespace bpkg return parse_repository_manifest (p, nv, repository_type::git, iu); } - // bpkg_repository_manifests + // pkg_repository_manifests // - bpkg_repository_manifests:: - bpkg_repository_manifests (parser& p, bool iu) + pkg_repository_manifests:: + pkg_repository_manifests (parser& p, bool iu) { name_value nv (p.next ()); while (!nv.empty ()) { - push_back (bpkg_repository_manifest (p, nv, iu)); + push_back (pkg_repository_manifest (p, nv, iu)); nv = p.next (); // Make sure there is location in all except the last entry. @@ -2583,7 +2583,7 @@ namespace bpkg "base repository manifest expected"); } - void bpkg_repository_manifests:: + void pkg_repository_manifests:: serialize (serializer& s) const { if (empty () || !back ().location.empty ()) diff --git a/libbpkg/manifest.hxx b/libbpkg/manifest.hxx index 548312d..ada6cd3 100644 --- a/libbpkg/manifest.hxx +++ b/libbpkg/manifest.hxx @@ -392,7 +392,7 @@ namespace bpkg // Create individual package manifest. // LIBBPKG_EXPORT package_manifest - bpkg_package_manifest (butl::manifest_parser&, bool ignore_unknown = false); + pkg_package_manifest (butl::manifest_parser&, bool ignore_unknown = false); LIBBPKG_EXPORT package_manifest git_package_manifest (butl::manifest_parser&, bool ignore_unknown = false); @@ -400,9 +400,9 @@ namespace bpkg // Create an element of the package list manifest. // LIBBPKG_EXPORT package_manifest - bpkg_package_manifest (butl::manifest_parser&, - butl::manifest_name_value start, - bool ignore_unknown = false); + pkg_package_manifest (butl::manifest_parser&, + butl::manifest_name_value start, + bool ignore_unknown = false); LIBBPKG_EXPORT package_manifest git_package_manifest (butl::manifest_parser&, @@ -412,8 +412,8 @@ namespace bpkg // Serialize. // inline void - bpkg_package_manifest (butl::manifest_serializer& s, - const package_manifest& m) + pkg_package_manifest (butl::manifest_serializer& s, + const package_manifest& m) { m.serialize (s); } @@ -424,7 +424,7 @@ namespace bpkg LIBBPKG_EXPORT void git_package_manifest (butl::manifest_serializer&, const package_manifest&); - class LIBBPKG_EXPORT bpkg_package_manifests: + class LIBBPKG_EXPORT pkg_package_manifests: public std::vector { public: @@ -437,9 +437,9 @@ namespace bpkg std::string sha256sum; public: - bpkg_package_manifests () = default; - bpkg_package_manifests (butl::manifest_parser&, - bool ignore_unknown = false); + pkg_package_manifests () = default; + pkg_package_manifests (butl::manifest_parser&, + bool ignore_unknown = false); void serialize (butl::manifest_serializer&) const; @@ -524,7 +524,7 @@ namespace bpkg // Repository type. // - enum class repository_type {bpkg, git}; + enum class repository_type {pkg, git}; LIBBPKG_EXPORT std::string to_string (repository_type); @@ -543,11 +543,10 @@ namespace bpkg // 1. If scheme is git then git. // // 2. If scheme is http(s), then check if path has the .git extension, - // then git, otherwise bpkg. + // then git, otherwise pkg. // // 3. If local (which will normally be without the .git extension), check - // if directory contains the .git/ subdirectory then git, otherwise - // bpkg. + // if directory contains the .git/ subdirectory then git, otherwise pkg. // // Can throw system_error in the later case. // @@ -587,7 +586,7 @@ namespace bpkg explicit repository_location (repository_url, repository_type); - // Create a potentially relative bpkg repository location. If base is not + // Create a potentially relative pkg repository location. If base is not // empty, use it to complete the relative location to the remote/absolute // one. Throw std::invalid_argument if base is not empty but the location // is empty, base itself is relative, or the resulting completed location @@ -720,8 +719,8 @@ namespace bpkg { switch (type ()) { - case repository_type::bpkg: return true; - case repository_type::git: return false; + case repository_type::pkg: return true; + case repository_type::git: return false; } assert (false); // Can't be here. @@ -814,7 +813,7 @@ namespace bpkg // Return the effective web interface URL based on the specified remote // repository location. If url is not present, doesn't start with '.', or - // the repository type differs from bpkg, then return it unchanged. + // the repository type differs from pkg, then return it unchanged. // Otherwise, process the relative format as described in the manifest // specification. Throw std::invalid_argument if the relative url format is // invalid or if the repository location is empty or local. @@ -832,8 +831,8 @@ namespace bpkg // Create individual repository manifest. // LIBBPKG_EXPORT repository_manifest - bpkg_repository_manifest (butl::manifest_parser&, - bool ignore_unknown = false); + pkg_repository_manifest (butl::manifest_parser&, + bool ignore_unknown = false); LIBBPKG_EXPORT repository_manifest git_repository_manifest (butl::manifest_parser&, @@ -842,16 +841,16 @@ namespace bpkg // Create an element of the repository list manifest. // LIBBPKG_EXPORT repository_manifest - bpkg_repository_manifest (butl::manifest_parser&, - butl::manifest_name_value start, - bool ignore_unknown = false); + pkg_repository_manifest (butl::manifest_parser&, + butl::manifest_name_value start, + bool ignore_unknown = false); LIBBPKG_EXPORT repository_manifest git_repository_manifest (butl::manifest_parser&, butl::manifest_name_value start, bool ignore_unknown = false); - class LIBBPKG_EXPORT bpkg_repository_manifests: + class LIBBPKG_EXPORT pkg_repository_manifests: public std::vector { public: @@ -859,9 +858,9 @@ namespace bpkg using base_type::base_type; - bpkg_repository_manifests () = default; - bpkg_repository_manifests (butl::manifest_parser&, - bool ignore_unknown = false); + pkg_repository_manifests () = default; + pkg_repository_manifests (butl::manifest_parser&, + bool ignore_unknown = false); void serialize (butl::manifest_serializer&) const; -- cgit v1.1