From 088d195e079e83cb67ebc0de1ebffe857bf477e1 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 30 Jan 2023 12:04:12 +0300 Subject: Pass host target triplet to system_package_manager constructor --- bpkg/system-package-manager-debian.cxx | 8 ++++---- bpkg/system-package-manager-debian.hxx | 10 +++++----- bpkg/system-package-manager-debian.test.cxx | 3 +++ bpkg/system-package-manager.cxx | 2 +- bpkg/system-package-manager.hxx | 5 ++++- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/bpkg/system-package-manager-debian.cxx b/bpkg/system-package-manager-debian.cxx index 44a3aef..71d3596 100644 --- a/bpkg/system-package-manager-debian.cxx +++ b/bpkg/system-package-manager-debian.cxx @@ -425,7 +425,7 @@ namespace bpkg } // Execute `apt-cache show` and return the Depends value, if any, for the - // specified package and version. Fail if either package or version is + // specified package and version. Fail if either package or version is // unknown. // string system_package_manager_debian:: @@ -618,7 +618,7 @@ namespace bpkg catch (const io_error& e) { if (pr.wait ()) - fail << "unable to read " << args[0] << " policy output: " << e; + fail << "unable to read " << args[0] << " show output: " << e; // Fall through. } @@ -626,7 +626,7 @@ namespace bpkg if (!pr.wait () || no_version) { diag_record dr (fail); - dr << args[0] << " policy exited with non-zero code"; + dr << args[0] << " show exited with non-zero code"; if (verb < 3) { @@ -993,7 +993,7 @@ namespace bpkg i = true; } - return (!u ? package_status::installed : + return (!u ? package_status::installed : !i ? package_status::not_installed : package_status::partially_installed); }; diff --git a/bpkg/system-package-manager-debian.hxx b/bpkg/system-package-manager-debian.hxx index cbf4828..b945a54 100644 --- a/bpkg/system-package-manager-debian.hxx +++ b/bpkg/system-package-manager-debian.hxx @@ -50,7 +50,7 @@ namespace bpkg // Where each is the space-separated list of one or more // package names: // - // [ ...] + // [ ...] // // All the packages in the group should be "package components" (for the // lack of a better term) of the same "logical package", such as -dev, -doc, @@ -61,10 +61,10 @@ namespace bpkg // (installed) but only the main group is produced (packaged). // // We allow/recommend specifying the -dev package instead of the main - // package for libraries (the name starts with lib), seeing that we are - // capable of detecting the main package automatically. If the library name - // happens to end with -dev (which poses an ambiguity), then the -dev - // package should be specified explicitly as the second package to + // package for libraries (the bpkg package name starts with lib), seeing + // that we are capable of detecting the main package automatically. If the + // library name happens to end with -dev (which poses an ambiguity), then + // the -dev package should be specified explicitly as the second package to // disambiguate this situation (if a non-library name happened to start with // lib and end with -dev, well, you are out of luck, I guess). // diff --git a/bpkg/system-package-manager-debian.test.cxx b/bpkg/system-package-manager-debian.test.cxx index 0b1e1c8..1853a4f 100644 --- a/bpkg/system-package-manager-debian.test.cxx +++ b/bpkg/system-package-manager-debian.test.cxx @@ -93,6 +93,7 @@ namespace bpkg s.apt_cache_policy_.emplace (move (key), path ("-")); system_package_manager_debian m (move (osr), + host_triplet, false /* install */, false /* fetch */, nullopt /* progress */, @@ -119,6 +120,7 @@ namespace bpkg s.apt_cache_show_.emplace (key, path ("-")); system_package_manager_debian m (move (osr), + host_triplet, false /* install */, false /* fetch */, nullopt /* progress */, @@ -327,6 +329,7 @@ namespace bpkg } system_package_manager_debian m (move (osr), + host_triplet, install, fetch, nullopt /* progress */, diff --git a/bpkg/system-package-manager.cxx b/bpkg/system-package-manager.cxx index bf4b968..3585ba3 100644 --- a/bpkg/system-package-manager.cxx +++ b/bpkg/system-package-manager.cxx @@ -67,7 +67,7 @@ namespace bpkg // @@ TODO: verify name if specified. r.reset (new system_package_manager_debian ( - move (*osr), install, fetch, progress, yes, sudo)); + move (*osr), host, install, fetch, progress, yes, sudo)); } } } diff --git a/bpkg/system-package-manager.hxx b/bpkg/system-package-manager.hxx index e872f3e..e0a424b 100644 --- a/bpkg/system-package-manager.hxx +++ b/bpkg/system-package-manager.hxx @@ -117,7 +117,7 @@ namespace bpkg // if really necessary. // // The returned status can be NULL, which indicates that no such package - // is available from the system package manager. Note that empty is also + // is available from the system package manager. Note that NULL is also // returned if no fully installed package is available from the system and // package installation is not enabled (see the constructor below). // @@ -160,12 +160,14 @@ namespace bpkg // packages. // system_package_manager (os_release&& osr, + const target_triplet& host, bool install, bool fetch, optional progress, bool yes, string sudo) : os_release_ (osr), + host_ (host), progress_ (progress), install_ (install), fetch_ (fetch), @@ -233,6 +235,7 @@ namespace bpkg const vector& like_ids); protected: os_release os_release_; + target_triplet host_; optional progress_; // --[no]-progress (see also stderr_term) // The --sys-* option values. -- cgit v1.1