From 0d3525d80fbeee78ae49384f2d722de20127a040 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 3 Mar 2018 18:50:18 +0300 Subject: Rename bpkg repository type to pkg --- bpkg/auth.cxx | 6 +- bpkg/fetch-bpkg.cxx | 270 -------------------------------------------- bpkg/fetch-pkg.cxx | 270 ++++++++++++++++++++++++++++++++++++++++++++ bpkg/fetch.hxx | 40 +++---- bpkg/manifest-utility.cxx | 8 +- bpkg/package.hxx | 2 +- bpkg/pkg-fetch.cxx | 4 +- bpkg/pkg-verify.cxx | 4 +- bpkg/rep-add.cli | 57 +++++----- bpkg/rep-create.cxx | 6 +- bpkg/rep-fetch.cxx | 28 ++--- bpkg/rep-info.cli | 2 +- bpkg/repository-signing.cli | 4 +- 13 files changed, 350 insertions(+), 351 deletions(-) delete mode 100644 bpkg/fetch-bpkg.cxx create mode 100644 bpkg/fetch-pkg.cxx (limited to 'bpkg') diff --git a/bpkg/auth.cxx b/bpkg/auth.cxx index df31a60..bdcf528 100644 --- a/bpkg/auth.cxx +++ b/bpkg/auth.cxx @@ -69,7 +69,7 @@ namespace bpkg if (rl.remote ()) return repository_location ( repository_url (p.posix_string ()), - repository_type::bpkg, + repository_type::pkg, rl).canonical_name (); else return (path_cast (rl.path ()) / p).normalize ().string (); @@ -711,9 +711,9 @@ namespace bpkg pair c (split (cert.name)); - // Strip 'bpkg:' prefix. + // Strip 'pkg:' prefix. // - pair r (split (rl.canonical_name ().substr (5))); + pair r (split (rl.canonical_name ().substr (4))); // Match the repository canonical name leading part. // diff --git a/bpkg/fetch-bpkg.cxx b/bpkg/fetch-bpkg.cxx deleted file mode 100644 index 606843f..0000000 --- a/bpkg/fetch-bpkg.cxx +++ /dev/null @@ -1,270 +0,0 @@ -// file : bpkg/fetch-bpkg.cxx -*- C++ -*- -// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd -// license : MIT; see accompanying LICENSE file - -#include - -#include - -#include // cpfile () -#include - -#include -#include - -using namespace std; -using namespace butl; - -namespace bpkg -{ - template - static pair - fetch_manifest (const common_options& o, - const repository_url& u, - bool ignore_unknown) - { - string url (u.string ()); - process pr (start_fetch (o, url)); - - try - { - // Unfortunately we cannot read from the original source twice as we do - // below for files. There doesn't seem to be anything better than reading - // the entire file into memory and then streaming it twice, once to - // calculate the checksum and the second time to actually parse. We need - // to read the original stream in the binary mode for the checksum - // calculation, then use the binary data to create the text stream for - // the manifest parsing. - // - ifdstream is (move (pr.in_ofd), fdstream_mode::binary); - stringstream bs (ios::in | ios::out | ios::binary); - - // Note that the eof check is important: if the stream is at eof, write - // will fail. - // - if (is.peek () != ifdstream::traits_type::eof ()) - bs << is.rdbuf (); - - is.close (); - - string s (bs.str ()); - string sha256sum (sha256 (s.c_str (), s.size ())); - - istringstream ts (s); // Text mode. - - manifest_parser mp (ts, url); - M m (mp, ignore_unknown); - - if (pr.wait ()) - return make_pair (move (m), move (sha256sum)); - - // Child existed with an error, fall through. - } - // Ignore these exceptions if the child process exited with - // an error status since that's the source of the failure. - // - catch (const manifest_parsing& e) - { - if (pr.wait ()) - fail (e.name, e.line, e.column) << e.description; - } - catch (const io_error&) - { - if (pr.wait ()) - fail << "unable to read fetched " << url; - } - - // We should only get here if the child exited with an error status. - // - assert (!pr.wait ()); - - // While it is reasonable to assuming the child process issued - // diagnostics, some may not mention the URL. - // - fail << "unable to fetch " << url << - info << "re-run with -v for more information" << endf; - } - - static path - fetch_file (const common_options& o, - const repository_url& u, - const dir_path& d) - { - path r (d / u.path->leaf ()); - - if (exists (r)) - fail << "file " << r << " already exists"; - - auto_rmfile arm (r); - process pr (start_fetch (o, u.string (), r)); - - if (!pr.wait ()) - { - // While it is reasonable to assuming the child process issued - // diagnostics, some may not mention the URL. - // - fail << "unable to fetch " << u << - info << "re-run with -v for more information"; - } - - arm.cancel (); - return r; - } - - static path - fetch_file (const path& f, const dir_path& d) - { - path r (d / f.leaf ()); - - try - { - cpfile (f, r); - } - catch (const system_error& e) - { - fail << "unable to copy " << f << " to " << r << ": " << e; - } - - return r; - } - - // If o is nullptr, then don't calculate the checksum. - // - template - static pair - fetch_manifest (const common_options* o, - const path& f, - bool ignore_unknown) - { - if (!exists (f)) - fail << "file " << f << " does not exist"; - - try - { - // We can not use the same file stream for both calculating the checksum - // and reading the manifest. The file should be opened in the binary - // mode for the first operation and in the text mode for the second one. - // - string sha256sum; - if (o != nullptr) - sha256sum = sha256 (*o, f); // Read file in the binary mode. - - ifdstream ifs (f); // Open file in the text mode. - - manifest_parser mp (ifs, f.string ()); - return make_pair (M (mp, ignore_unknown), move (sha256sum)); - } - catch (const manifest_parsing& e) - { - fail (e.name, e.line, e.column) << e.description << endf; - } - catch (const io_error& e) - { - fail << "unable to read from " << f << ": " << e << endf; - } - } - - static const path repositories ("repositories"); - - bpkg_repository_manifests - bpkg_fetch_repositories (const dir_path& d, bool iu) - { - return fetch_manifest ( - nullptr, d / repositories, iu).first; - } - - pair - bpkg_fetch_repositories (const common_options& o, - const repository_location& rl, - bool iu) - { - assert (rl.remote () || rl.absolute ()); - - repository_url u (rl.url ()); - - path& f (*u.path); - f /= repositories; - - return rl.remote () - ? fetch_manifest (o, u, iu) - : fetch_manifest (&o, f, iu); - } - - static const path packages ("packages"); - - bpkg_package_manifests - bpkg_fetch_packages (const dir_path& d, bool iu) - { - return fetch_manifest ( - nullptr, d / packages, iu).first; - } - - pair - bpkg_fetch_packages (const common_options& o, - const repository_location& rl, - bool iu) - { - assert (rl.remote () || rl.absolute ()); - - repository_url u (rl.url ()); - - path& f (*u.path); - f /= packages; - - return rl.remote () - ? fetch_manifest (o, u, iu) - : fetch_manifest (&o, f, iu); - } - - static const path signature ("signature"); - - signature_manifest - bpkg_fetch_signature (const common_options& o, - const repository_location& rl, - bool iu) - { - assert (rl.remote () || rl.absolute ()); - - repository_url u (rl.url ()); - - path& f (*u.path); - f /= signature; - - return rl.remote () - ? fetch_manifest (o, u, iu).first - : fetch_manifest (nullptr, f, iu).first; - } - - path - bpkg_fetch_archive (const common_options& o, - const repository_location& rl, - const path& a, - const dir_path& d) - { - assert (!a.empty () && a.relative ()); - assert (rl.remote () || rl.absolute ()); - - repository_url u (rl.url ()); - - path& f (*u.path); - f /= a; - - auto bad_loc = [&u] () {fail << "invalid archive location " << u;}; - - try - { - f.normalize (); - - if (*f.begin () == "..") // Can be the case for the remote location. - bad_loc (); - } - catch (const invalid_path&) - { - bad_loc (); - } - - return rl.remote () - ? fetch_file (o, u, d) - : fetch_file (f, d); - } -} diff --git a/bpkg/fetch-pkg.cxx b/bpkg/fetch-pkg.cxx new file mode 100644 index 0000000..09422e7 --- /dev/null +++ b/bpkg/fetch-pkg.cxx @@ -0,0 +1,270 @@ +// file : bpkg/fetch-pkg.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#include + +#include + +#include // cpfile () +#include + +#include +#include + +using namespace std; +using namespace butl; + +namespace bpkg +{ + template + static pair + fetch_manifest (const common_options& o, + const repository_url& u, + bool ignore_unknown) + { + string url (u.string ()); + process pr (start_fetch (o, url)); + + try + { + // Unfortunately we cannot read from the original source twice as we do + // below for files. There doesn't seem to be anything better than reading + // the entire file into memory and then streaming it twice, once to + // calculate the checksum and the second time to actually parse. We need + // to read the original stream in the binary mode for the checksum + // calculation, then use the binary data to create the text stream for + // the manifest parsing. + // + ifdstream is (move (pr.in_ofd), fdstream_mode::binary); + stringstream bs (ios::in | ios::out | ios::binary); + + // Note that the eof check is important: if the stream is at eof, write + // will fail. + // + if (is.peek () != ifdstream::traits_type::eof ()) + bs << is.rdbuf (); + + is.close (); + + string s (bs.str ()); + string sha256sum (sha256 (s.c_str (), s.size ())); + + istringstream ts (s); // Text mode. + + manifest_parser mp (ts, url); + M m (mp, ignore_unknown); + + if (pr.wait ()) + return make_pair (move (m), move (sha256sum)); + + // Child existed with an error, fall through. + } + // Ignore these exceptions if the child process exited with + // an error status since that's the source of the failure. + // + catch (const manifest_parsing& e) + { + if (pr.wait ()) + fail (e.name, e.line, e.column) << e.description; + } + catch (const io_error&) + { + if (pr.wait ()) + fail << "unable to read fetched " << url; + } + + // We should only get here if the child exited with an error status. + // + assert (!pr.wait ()); + + // While it is reasonable to assuming the child process issued + // diagnostics, some may not mention the URL. + // + fail << "unable to fetch " << url << + info << "re-run with -v for more information" << endf; + } + + static path + fetch_file (const common_options& o, + const repository_url& u, + const dir_path& d) + { + path r (d / u.path->leaf ()); + + if (exists (r)) + fail << "file " << r << " already exists"; + + auto_rmfile arm (r); + process pr (start_fetch (o, u.string (), r)); + + if (!pr.wait ()) + { + // While it is reasonable to assuming the child process issued + // diagnostics, some may not mention the URL. + // + fail << "unable to fetch " << u << + info << "re-run with -v for more information"; + } + + arm.cancel (); + return r; + } + + static path + fetch_file (const path& f, const dir_path& d) + { + path r (d / f.leaf ()); + + try + { + cpfile (f, r); + } + catch (const system_error& e) + { + fail << "unable to copy " << f << " to " << r << ": " << e; + } + + return r; + } + + // If o is nullptr, then don't calculate the checksum. + // + template + static pair + fetch_manifest (const common_options* o, + const path& f, + bool ignore_unknown) + { + if (!exists (f)) + fail << "file " << f << " does not exist"; + + try + { + // We can not use the same file stream for both calculating the checksum + // and reading the manifest. The file should be opened in the binary + // mode for the first operation and in the text mode for the second one. + // + string sha256sum; + if (o != nullptr) + sha256sum = sha256 (*o, f); // Read file in the binary mode. + + ifdstream ifs (f); // Open file in the text mode. + + manifest_parser mp (ifs, f.string ()); + return make_pair (M (mp, ignore_unknown), move (sha256sum)); + } + catch (const manifest_parsing& e) + { + fail (e.name, e.line, e.column) << e.description << endf; + } + catch (const io_error& e) + { + fail << "unable to read from " << f << ": " << e << endf; + } + } + + static const path repositories ("repositories"); + + pkg_repository_manifests + pkg_fetch_repositories (const dir_path& d, bool iu) + { + return fetch_manifest ( + nullptr, d / repositories, iu).first; + } + + pair + pkg_fetch_repositories (const common_options& o, + const repository_location& rl, + bool iu) + { + assert (rl.remote () || rl.absolute ()); + + repository_url u (rl.url ()); + + path& f (*u.path); + f /= repositories; + + return rl.remote () + ? fetch_manifest (o, u, iu) + : fetch_manifest (&o, f, iu); + } + + static const path packages ("packages"); + + pkg_package_manifests + pkg_fetch_packages (const dir_path& d, bool iu) + { + return fetch_manifest ( + nullptr, d / packages, iu).first; + } + + pair + pkg_fetch_packages (const common_options& o, + const repository_location& rl, + bool iu) + { + assert (rl.remote () || rl.absolute ()); + + repository_url u (rl.url ()); + + path& f (*u.path); + f /= packages; + + return rl.remote () + ? fetch_manifest (o, u, iu) + : fetch_manifest (&o, f, iu); + } + + static const path signature ("signature"); + + signature_manifest + pkg_fetch_signature (const common_options& o, + const repository_location& rl, + bool iu) + { + assert (rl.remote () || rl.absolute ()); + + repository_url u (rl.url ()); + + path& f (*u.path); + f /= signature; + + return rl.remote () + ? fetch_manifest (o, u, iu).first + : fetch_manifest (nullptr, f, iu).first; + } + + path + pkg_fetch_archive (const common_options& o, + const repository_location& rl, + const path& a, + const dir_path& d) + { + assert (!a.empty () && a.relative ()); + assert (rl.remote () || rl.absolute ()); + + repository_url u (rl.url ()); + + path& f (*u.path); + f /= a; + + auto bad_loc = [&u] () {fail << "invalid archive location " << u;}; + + try + { + f.normalize (); + + if (*f.begin () == "..") // Can be the case for the remote location. + bad_loc (); + } + catch (const invalid_path&) + { + bad_loc (); + } + + return rl.remote () + ? fetch_file (o, u, d) + : fetch_file (f, d); + } +} diff --git a/bpkg/fetch.hxx b/bpkg/fetch.hxx index 659e019..fc6b763 100644 --- a/bpkg/fetch.hxx +++ b/bpkg/fetch.hxx @@ -16,35 +16,35 @@ namespace bpkg { - // Repository type bpkg (fetch-bpkg.cxx). + // Repository type pkg (fetch-pkg.cxx). // - bpkg_repository_manifests - bpkg_fetch_repositories (const dir_path&, bool ignore_unknown); + pkg_repository_manifests + pkg_fetch_repositories (const dir_path&, bool ignore_unknown); - pair - bpkg_fetch_repositories (const common_options&, - const repository_location&, - bool ignore_unknown); + pair + pkg_fetch_repositories (const common_options&, + const repository_location&, + bool ignore_unknown); - bpkg_package_manifests - bpkg_fetch_packages (const dir_path&, bool ignore_unknown); + pkg_package_manifests + pkg_fetch_packages (const dir_path&, bool ignore_unknown); - pair - bpkg_fetch_packages (const common_options&, - const repository_location&, - bool ignore_unknown); + pair + pkg_fetch_packages (const common_options&, + const repository_location&, + bool ignore_unknown); signature_manifest - bpkg_fetch_signature (const common_options&, - const repository_location&, - bool ignore_unknown); + pkg_fetch_signature (const common_options&, + const repository_location&, + bool ignore_unknown); path - bpkg_fetch_archive (const common_options&, - const repository_location&, - const path& archive, - const dir_path& destdir); + pkg_fetch_archive (const common_options&, + const repository_location&, + const path& archive, + const dir_path& destdir); // Repository type git (fetch-git.cxx). // diff --git a/bpkg/manifest-utility.cxx b/bpkg/manifest-utility.cxx index 77baafb..6162c21 100644 --- a/bpkg/manifest-utility.cxx +++ b/bpkg/manifest-utility.cxx @@ -87,7 +87,7 @@ namespace bpkg // Guess the repository type to construct the repository location: // // 1. If type is specified as an option use that (but validate - // incompatible scheme/type e.g., git/bpkg). + // incompatible scheme/type e.g., git/pkg). // // 2. See guess_type() function description in libbpkg/manifest.hxx for // the algorithm details. @@ -106,10 +106,10 @@ namespace bpkg dr << fail << "invalid " << t << " repository location '" << u << "': " << e; - // If the bpkg repository type was guessed, then suggest the user to + // If the pkg repository type was guessed, then suggest the user to // specify the type explicitly. // - if (!ot && t == repository_type::bpkg) + if (!ot && t == repository_type::pkg) dr << info << "consider using --type to specify repository type"; dr << endf; @@ -133,7 +133,7 @@ namespace bpkg { switch (l.type ()) { - case repository_type::bpkg: return dir_path (); // No state. + case repository_type::pkg: return dir_path (); // No state. case repository_type::git: { return dir_path (sha256 (l.canonical_name ()).abbreviated_string (16)); diff --git a/bpkg/package.hxx b/bpkg/package.hxx index 68c2cd8..3567b10 100644 --- a/bpkg/package.hxx +++ b/bpkg/package.hxx @@ -222,7 +222,7 @@ namespace bpkg // #pragma db map type(repository_location) as(_repository_location) \ to({(?).url (), \ - (?).empty () ? bpkg::repository_type::bpkg : (?).type ()}) \ + (?).empty () ? bpkg::repository_type::pkg : (?).type ()}) \ from(bpkg::repository_location (std::move ((?).url), (?).type)) // repository diff --git a/bpkg/pkg-fetch.cxx b/bpkg/pkg-fetch.cxx index fbe5b5c..1dd9f2e 100644 --- a/bpkg/pkg-fetch.cxx +++ b/bpkg/pkg-fetch.cxx @@ -224,9 +224,7 @@ namespace bpkg text << "fetching " << pl->location.leaf () << " " << "from " << pl->repository->name; - path a ( - bpkg_fetch_archive (co, pl->repository->location, pl->location, c)); - + path a (pkg_fetch_archive (co, pl->repository->location, pl->location, c)); auto_rmfile arm (a); // We can't be fetching an archive for a transient object. diff --git a/bpkg/pkg-verify.cxx b/bpkg/pkg-verify.cxx index 2f01f94..ee3cfe4 100644 --- a/bpkg/pkg-verify.cxx +++ b/bpkg/pkg-verify.cxx @@ -39,7 +39,7 @@ namespace bpkg { ifdstream is (move (pr.second.in_ofd), fdstream_mode::skip); manifest_parser mp (is, mf.string ()); - package_manifest m (bpkg_package_manifest (mp, iu)); + package_manifest m (pkg_package_manifest (mp, iu)); is.close (); if (wait ()) @@ -129,7 +129,7 @@ namespace bpkg { ifdstream ifs (mf); manifest_parser mp (ifs, mf.string ()); - package_manifest m (bpkg_package_manifest (mp, iu)); + package_manifest m (pkg_package_manifest (mp, iu)); // We used to verify package directory is - but it is // not clear why we should enforce it in this case (i.e., the user diff --git a/bpkg/rep-add.cli b/bpkg/rep-add.cli index 827e745..b630f0a 100644 --- a/bpkg/rep-add.cli +++ b/bpkg/rep-add.cli @@ -30,31 +30,32 @@ namespace bpkg the newly added repository. For that, use the \l{bpkg-rep-fetch(1)} command, normally, after adding all the repositories you wish to use. - Currently two types of repositories are supported: \i{bpkg} and \i{git}. + Currently two types of repositories are supported: \cb{pkg} and \cb{git}. Normally the repository type can be automatically guessed by examining its URL (for example, the presence of the \cb{.git} extension) or, in case of a local repository, its content (for example, the presence of the - \cb{.git/} subdirectory). Without any identifying information the bpkg - type is assumed unless explicitly specified with the \cb{--type} option. + \cb{.git/} subdirectory). Without any identifying information the + \cb{pkg} type is assumed unless explicitly specified with the \cb{--type} + option. - A bpkg repository is \i{archive}-based. That is, it contains a collection - of various packages/versions as archive files. For more information on - the structure of bpkg repositories refer to the \l{bpkg \cb{bpkg} - manual}. + A \cb{pkg} repository is \i{archive}-based. That is, it contains a + collection of various packages/versions as archive files. For more + information on the structure of \cb{pkg} repositories refer to the + \l{bpkg \cb{bpkg} manual}. - A git repository is \i{version control}-based. That is, it normally + A \cb{git} repository is \i{version control}-based. That is, it normally contains multiple versions of the same package (but can also contain several packages in the same repository). - Theoretically, a git repository may contain as many package versions as - there are commits. Practically, however, we are normally only interested - in a small subset of them while fetching and processing the necessary - information for all of them could be prohibitively expensive. As a - result, a git repository URL must include the fragment component that - restricts the set of versions to consider as available. While in the - future it will be possible to specify multiple available versions, - currently the fragment must identify a single version using one of the - following forms: + Theoretically, a \cb{git} repository may contain as many package versions + as there are commits. Practically, however, we are normally only + interested in a small subset of them while fetching and processing the + necessary information for all of them could be prohibitively expensive. + As a result, a \cb{git} repository URL must include the fragment + component that restricts the set of versions to consider as available. + While in the future it will be possible to specify multiple available + versions, currently the fragment must identify a single version using one + of the following forms: \ # @@ -72,7 +73,7 @@ namespace bpkg branch/tag otherwise. In an unlikely case this produces an incorrect result, the last form with omitted can be used. - Below are some examples of git repository URLs: + Below are some examples of \cb{git} repository URLs: \ https://example.com/foo.git#v1.2.3 @@ -82,16 +83,16 @@ namespace bpkg https://example.com/foo.git#deadbeefdeadbeefdeadbeefdeadbeefdeadbeef@ \ - A git repository is expected to contain either the \cb{manifest} or + A \cb{git} repository is expected to contain either the \cb{manifest} or \cb{packages} file in the root directory of the repository. If it only contains \cb{manifest}, then it is assumed to be a single-package repository with the \cb{manifest} file being its package manifest. Otherwise the \cb{packages} file should list the available packages as described in \l{bpkg#manifest-package-list-git Package List Manifest for - \c{git} Repositories}. + \cb{git} Repositories}. - A git repository may also contain the \cb{repositories} file in the root - directory of the repository. This file can be used to describe the + A \cb{git} repository may also contain the \cb{repositories} file in the + root directory of the repository. This file can be used to describe the repository itself as well as specify its prerequisite and complement repositories. See \l{bpkg#manifest-repository-list Repository List Manifest} for details on the format and semantics of this file. @@ -102,11 +103,11 @@ namespace bpkg it is not always possible for some protocols and/or server configurations, as discussed next. - A git repository accessible via \cb{http(s)://} can use either \i{dumb} - or \i{smart} protocol (refer to the \cb{git} documentation for details). - The dumb protocol provides only limited support for fetch minimization - and if this protocol is used, then \cb{bpkg} has no choice but to - download a substantial amount of history. + A \cb{git} repository accessible via \cb{http(s)://} can use either + \i{dumb} or \i{smart} protocol (refer to the \cb{git} documentation for + details). The dumb protocol provides only limited support for fetch + minimization and if this protocol is used, then \cb{bpkg} has no choice + but to download a substantial amount of history. The smart protocol allows fetching of minimal history for tags and branches. Whether this is also possible for (all) commit ids depends on @@ -137,7 +138,7 @@ namespace bpkg repository_type --type { "", - "Specify the repository type with valid values being \cb{bpkg} and + "Specify the repository type with valid values being \cb{pkg} and \cb{git}." } }; diff --git a/bpkg/rep-create.cxx b/bpkg/rep-create.cxx index e9619ca..3940c48 100644 --- a/bpkg/rep-create.cxx +++ b/bpkg/rep-create.cxx @@ -184,8 +184,8 @@ namespace bpkg // Load the 'repositories' file to make sure it is there and // is valid. // - bpkg_repository_manifests rms ( - bpkg_fetch_repositories (d, o.ignore_unknown ())); + pkg_repository_manifests rms ( + pkg_fetch_repositories (d, o.ignore_unknown ())); l4 ([&]{trace << rms.size () - 1 << " prerequisite repository(s)";}); @@ -196,7 +196,7 @@ namespace bpkg package_map pm; collect (o, pm, d, d); - bpkg_package_manifests manifests; + pkg_package_manifests manifests; manifests.sha256sum = sha256 (o, path (d / repositories)); for (auto& p: pm) diff --git a/bpkg/rep-fetch.cxx b/bpkg/rep-fetch.cxx index 9cd6164..795a170 100644 --- a/bpkg/rep-fetch.cxx +++ b/bpkg/rep-fetch.cxx @@ -42,18 +42,18 @@ namespace bpkg static bool filesystem_state_changed; static rep_fetch_data - rep_fetch_bpkg (const common_options& co, - const dir_path* conf, - const repository_location& rl, - bool ignore_unknown) + rep_fetch_pkg (const common_options& co, + const dir_path* conf, + const repository_location& rl, + bool ignore_unknown) { // First fetch the repositories list and authenticate the base's // certificate. // - pair rmc ( - bpkg_fetch_repositories (co, rl, ignore_unknown)); + pair rmc ( + pkg_fetch_repositories (co, rl, ignore_unknown)); - bpkg_repository_manifests& rms (rmc.first); + pkg_repository_manifests& rms (rmc.first); bool a (co.auth () != auth::none && (co.auth () == auth::all || rl.remote ())); @@ -70,10 +70,10 @@ namespace bpkg // Now fetch the packages list and make sure it matches the repositories // we just fetched. // - pair pmc ( - bpkg_fetch_packages (co, rl, ignore_unknown)); + pair pmc ( + pkg_fetch_packages (co, rl, ignore_unknown)); - bpkg_package_manifests& pms (pmc.first); + pkg_package_manifests& pms (pmc.first); if (rmc.second != pms.sha256sum) fail << "repositories manifest file checksum mismatch for " @@ -83,7 +83,7 @@ namespace bpkg if (a) { signature_manifest sm ( - bpkg_fetch_signature (co, rl, true /* ignore_unknown */)); + pkg_fetch_signature (co, rl, true /* ignore_unknown */)); if (sm.sha256sum != pmc.second) fail << "packages manifest file checksum mismatch for " @@ -270,7 +270,7 @@ namespace bpkg { ifdstream ifs (f); manifest_parser mp (ifs, f.string ()); - package_manifest m (bpkg_package_manifest (mp, ignore_unknown)); + package_manifest m (pkg_package_manifest (mp, ignore_unknown)); // Save the package manifest, preserving its location. // @@ -410,8 +410,8 @@ namespace bpkg { switch (rl.type ()) { - case repository_type::bpkg: return rep_fetch_bpkg (co, conf, rl, iu); - case repository_type::git: return rep_fetch_git (co, conf, rl, iu); + case repository_type::pkg: return rep_fetch_pkg (co, conf, rl, iu); + case repository_type::git: return rep_fetch_git (co, conf, rl, iu); } assert (false); // Can't be here. diff --git a/bpkg/rep-info.cli b/bpkg/rep-info.cli index 5c11f4f..029b27b 100644 --- a/bpkg/rep-info.cli +++ b/bpkg/rep-info.cli @@ -96,7 +96,7 @@ namespace bpkg repository_type --type { "", - "Specify the repository type with valid values being \cb{bpkg} and + "Specify the repository type with valid values being \cb{pkg} and \cb{git}. Refer to \l{bpkg-rep-add(1)} for details." } diff --git a/bpkg/repository-signing.cli b/bpkg/repository-signing.cli index f6ee7fa..96c37bc 100644 --- a/bpkg/repository-signing.cli +++ b/bpkg/repository-signing.cli @@ -36,7 +36,7 @@ matches the certificate's subject (see below). In the future a certificate authority (CA)-based model may be added. The rest of this guide shows how to create a key/certificate pair for -\cb{bpkg} repository signing and use it to sign a repository. At the end it +\cb{pkg} repository signing and use it to sign a repository. At the end it also briefly explains how to store the private key on a PIV/PKCS#11 device using Yubikey 4 as an example. @@ -92,7 +92,7 @@ it. Also use a working email address in case users need to contact you about issues with your certificate. Note that the \cb{name:} prefix in the \cb{CN} value is not a typo. -The \cb{name} field is a canonical repository name prefix with the \cb{bpkg:} +The \cb{name} field is a canonical repository name prefix with the \cb{pkg:} type part stripped. Any repository with a canonical name that starts with this prefix can be authenticated by this certificate (see the repository manifest documentation for more information on canonical names). For example, name -- cgit v1.1