diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2023-02-09 15:46:32 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2023-03-09 12:31:18 +0200 |
commit | 854c668b5e63e26a9d7a6e55226a0940638e0453 (patch) | |
tree | 86b03f5db9d65c925941fc872aaa76d24248e0d3 /bpkg/system-package-manager.test.hxx | |
parent | eaebfcff492cf7f707b44a3d28620e786116faf1 (diff) |
Add pkg-bindist command (generate binary distribution package)
This commit includes an implementation for Debian and alike.
Diffstat (limited to 'bpkg/system-package-manager.test.hxx')
-rw-r--r-- | bpkg/system-package-manager.test.hxx | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/bpkg/system-package-manager.test.hxx b/bpkg/system-package-manager.test.hxx index 0eb6717..688eb72 100644 --- a/bpkg/system-package-manager.test.hxx +++ b/bpkg/system-package-manager.test.hxx @@ -20,25 +20,33 @@ namespace bpkg { // Parse the manifest as if it comes from a git repository with a single - // package and make an available package out of it. + // package and make an available package out of it. If the file name is + // `-` then read fro stdin. If the package name is empty, then take the + // name from the manifest. Otherwise, assert they match. // inline pair<shared_ptr<available_package>, lazy_shared_ptr<repository_fragment>> - make_available_from_manifest (const string& n, const string& f) + make_available_from_manifest (const string& pn, const string& f) { using butl::manifest_parser; using butl::manifest_parsing; + path fp (f); + path_name fn (fp); + try { - ifdstream ifs (f); - manifest_parser mp (ifs, f); + ifdstream ifds; + istream& ifs (butl::open_file_or_stdin (fn, ifds)); + + manifest_parser mp (ifs, fn.name ? *fn.name : fn.path->string ()); package_manifest m (mp, false /* ignore_unknown */, true /* complete_values */); - assert (m.name.string () == n); + const string& n (m.name.string ()); + assert (pn.empty () || n == pn); m.alt_naming = false; m.bootstrap_build = "project = " + n + '\n'; @@ -61,7 +69,7 @@ namespace bpkg } catch (const io_error& e) { - fail << "unable to read from " << f << ": " << e << endf; + fail << "unable to read from " << fn << ": " << e << endf; } } |