From 22e35bf80cea95dc1edce22e729199f61a6fedcd Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 5 Mar 2018 16:49:24 +0300 Subject: Add .manifest extension to repositories, packages and signature files --- bpkg/fetch-pkg.cxx | 17 ++++++----------- bpkg/manifest-utility.cxx | 4 ++++ bpkg/manifest-utility.hxx | 4 ++++ bpkg/rep-add.cli | 22 +++++++++++----------- bpkg/rep-create.cli | 6 +++--- bpkg/rep-create.cxx | 28 ++++++++++++++-------------- bpkg/rep-fetch.cxx | 15 ++++++++------- 7 files changed, 50 insertions(+), 46 deletions(-) (limited to 'bpkg') diff --git a/bpkg/fetch-pkg.cxx b/bpkg/fetch-pkg.cxx index 09422e7..aba95ab 100644 --- a/bpkg/fetch-pkg.cxx +++ b/bpkg/fetch-pkg.cxx @@ -11,6 +11,7 @@ #include #include +#include using namespace std; using namespace butl; @@ -164,13 +165,11 @@ namespace bpkg } } - 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; + nullptr, d / repositories_file, iu).first; } pair @@ -183,20 +182,18 @@ namespace bpkg repository_url u (rl.url ()); path& f (*u.path); - f /= repositories; + f /= repositories_file; 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; + nullptr, d / packages_file, iu).first; } pair @@ -209,15 +206,13 @@ namespace bpkg repository_url u (rl.url ()); path& f (*u.path); - f /= packages; + f /= packages_file; 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, @@ -228,7 +223,7 @@ namespace bpkg repository_url u (rl.url ()); path& f (*u.path); - f /= signature; + f /= signature_file; return rl.remote () ? fetch_manifest (o, u, iu).first diff --git a/bpkg/manifest-utility.cxx b/bpkg/manifest-utility.cxx index 6162c21..9f4a012 100644 --- a/bpkg/manifest-utility.cxx +++ b/bpkg/manifest-utility.cxx @@ -14,6 +14,10 @@ using namespace butl; namespace bpkg { + const path repositories_file ("repositories.manifest"); + const path packages_file ("packages.manifest"); + const path signature_file ("signature.manifest"); + package_scheme parse_package_scheme (const char*& s) { diff --git a/bpkg/manifest-utility.hxx b/bpkg/manifest-utility.hxx index 0f820ec..f608858 100644 --- a/bpkg/manifest-utility.hxx +++ b/bpkg/manifest-utility.hxx @@ -12,6 +12,10 @@ namespace bpkg { + extern const path repositories_file; // repositories.manifest + extern const path packages_file; // packages.manifest + extern const path signature_file; // signature.manifest + // Package naming schemes. // enum class package_scheme diff --git a/bpkg/rep-add.cli b/bpkg/rep-add.cli index b566bbd..72da5e5 100644 --- a/bpkg/rep-add.cli +++ b/bpkg/rep-add.cli @@ -84,18 +84,18 @@ namespace bpkg \ 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 + \cb{packages.manifest} 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 - \cb{git} Repositories}. - - 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. + Otherwise the \cb{packages.manifest} file should list the available + packages as described in \l{bpkg#manifest-package-list-git Package List + Manifest for \cb{git} Repositories}. + + A \cb{git} repository may also contain the \cb{repositories.manifest} + 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. Supported git protocols are \cb{git://}, \cb{http://}, and \cb{https://} for remote repositories and \cb{file://} for local repositories. While diff --git a/bpkg/rep-create.cli b/bpkg/rep-create.cli index 970125d..40269ab 100644 --- a/bpkg/rep-create.cli +++ b/bpkg/rep-create.cli @@ -19,10 +19,10 @@ namespace bpkg \h|DESCRIPTION| - The \cb{rep-create} command regenerates the \cb{packages} manifest file + The \cb{rep-create} command regenerates the \cb{packages.manifest} file based on the files present in the repository directory. If the - \cb{repositories} manifest file contains a certificate, then the - \cb{signature} manifest file is regenerated as well. In this case the + \cb{repositories.manifest} file contains a certificate, then the + \cb{signature.manifest} file is regenerated as well. In this case the \cb{--key} option must be used to specify the certificate's private key. If is not specified, then the current working directory is used as the repository root." diff --git a/bpkg/rep-create.cxx b/bpkg/rep-create.cxx index 3940c48..56f2f87 100644 --- a/bpkg/rep-create.cxx +++ b/bpkg/rep-create.cxx @@ -16,6 +16,7 @@ #include #include #include +#include #include @@ -49,10 +50,6 @@ namespace bpkg using package_map = map; - static const path repositories ("repositories"); - static const path packages ("packages"); - static const path signature ("signature"); - static void collect (const rep_create_options& o, package_map& map, @@ -91,7 +88,9 @@ namespace bpkg // if (d == root) { - if (p == repositories || p == packages || p == signature) + if (p == repositories_file || + p == packages_file || + p == signature_file) continue; } @@ -181,8 +180,8 @@ namespace bpkg l4 ([&]{trace << "creating repository in " << d;}); - // Load the 'repositories' file to make sure it is there and - // is valid. + // Load the repositories.manifest file to make sure it is there and is + // valid. // pkg_repository_manifests rms ( pkg_fetch_repositories (d, o.ignore_unknown ())); @@ -197,7 +196,7 @@ namespace bpkg collect (o, pm, d, d); pkg_package_manifests manifests; - manifests.sha256sum = sha256 (o, path (d / repositories)); + manifests.sha256sum = sha256 (o, path (d / repositories_file)); for (auto& p: pm) { @@ -211,14 +210,15 @@ namespace bpkg // Serialize packages manifest, optionally generate the signature manifest. // - path p (d / packages); + path p (d / packages_file); try { { - // While we can do nothing about repositories files edited on Windows - // and littered with the carriage return characters, there is no - // reason to litter the auto-generated packages and signature files. + // While we can do nothing about repositories manifest files edited on + // Windows and littered with the carriage return characters, there is + // no reason to litter the auto-generated packages and signature + // manifest files. // ofdstream ofs (p, ios::binary); @@ -240,7 +240,7 @@ namespace bpkg m.sha256sum = sha256 (o, p); m.signature = sign_repository (o, m.sha256sum, key, *cert, d); - p = path (d / signature); + p = path (d / signature_file); ofdstream ofs (p, ios::binary); @@ -255,7 +255,7 @@ namespace bpkg info << "repository manifest contains no certificate" << info << "run 'bpkg help rep-create' for more information"; - try_rmfile (path (d / signature), true); + try_rmfile (path (d / signature_file), true); } } catch (const manifest_serialization& e) diff --git a/bpkg/rep-fetch.cxx b/bpkg/rep-fetch.cxx index 795a170..ab7ce55 100644 --- a/bpkg/rep-fetch.cxx +++ b/bpkg/rep-fetch.cxx @@ -143,13 +143,13 @@ namespace bpkg // // 2. Move from temp_dir// to repos_dir/// // - // 3. Check if repos_dir///repositories exists: + // 3. Check if repos_dir///repositories.manifest exists: // // 3.a If exists, load. // // 3.b Otherwise, synthesize repository list with base repository. // - // 4. Check if repos_dir///packages exists: + // 4. Check if repos_dir///packages.manifest exists: // // 4.a If exists, load. (into "skeleton" packages list to be filled?) // @@ -211,7 +211,7 @@ namespace bpkg // git_repository_manifests rms; { - path f (fd / path ("repositories")); + path f (fd / repositories_file); if (exists (f)) rms = parse_manifest (f, ignore_unknown, rl); @@ -223,7 +223,7 @@ namespace bpkg // git_package_manifests pms; { - path f (fd / path ("packages")); + path f (fd / packages_file); if (exists (f)) pms = parse_manifest (f, ignore_unknown, rl); @@ -595,9 +595,10 @@ namespace bpkg // we use the root repository as the default complement. // // This supports the common use case where the user has a single-package - // git repository and doesn't want to bother with the repositories file. - // This way their package will still pick up its dependencies from the - // configuration, without regards from which repositories they came from. + // git repository and doesn't want to bother with the + // repositories.manifest file. This way their package will still pick up + // its dependencies from the configuration, without regards from which + // repositories they came from. // if (rl.type () == repository_type::git && r->complements.empty () && -- cgit v1.1