From 882665a4fead26fce4649f85c842ac79aaf29f8b Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 27 Jun 2023 13:27:01 +0300 Subject: Add --sys-* options for sync and init commands --- bdep/init.cli | 34 ++++++++++++++++++++++++++++++++++ bdep/init.cxx | 3 +++ bdep/init.hxx | 2 ++ bdep/sync.cli | 34 ++++++++++++++++++++++++++++++++++ bdep/sync.cxx | 18 ++++++++++++++++++ bdep/sync.hxx | 24 ++++++++++++++++++++++++ 6 files changed, 115 insertions(+) diff --git a/bdep/init.cli b/bdep/init.cli index ed44efa..2bd41b1 100644 --- a/bdep/init.cli +++ b/bdep/init.cli @@ -186,6 +186,40 @@ namespace bdep an explicit \l{bdep-sync(1)} command." } + bool --sys-no-query + { + "Do not query the system package manager for the installed versions of + packages specified with the \cb{sys} scheme. See the corresponding + \l{bpkg-pkg-build(1)} option for details." + } + + bool --sys-install + { + "Instruct the system package manager to install available versions of + packages specified with the \cb{sys} scheme that are not already + installed. See the corresponding \l{bpkg-pkg-build(1)} option for + details." + } + + bool --sys-no-fetch + { + "Do not fetch the system package manager metadata before querying for + available versions of packages specified with the \cb{sys} scheme. See + the corresponding \l{bpkg-pkg-build(1)} option for details." + } + + bool --sys-no-stub + { + "Do no require a stub for packages specified with the \cb{sys} scheme. + See the corresponding \l{bpkg-pkg-build(1)} option for details." + } + + bool --sys-yes + { + "Assume the answer to the system package manager prompts is \cb{yes}. + See the corresponding \l{bpkg-pkg-build(1)} option for details." + } + bool --create-host-config { "Create a configuration for build-time dependencies without prompt (see diff --git a/bdep/init.cxx b/bdep/init.cxx index 9865531..f575b52 100644 --- a/bdep/init.cxx +++ b/bdep/init.cxx @@ -95,6 +95,7 @@ namespace bdep const package_locations& pkgs, const strings& pkg_args, bool sync, + const sys_options& so, bool create_host_config, bool create_build2_config) { @@ -268,6 +269,7 @@ namespace bdep true /* fetch */, true /* yes */, false /* name_cfg */, + so, create_host_config, create_build2_config, &t, @@ -443,6 +445,7 @@ namespace bdep pp.packages, scan_arguments (args) /* pkg_args */, !o.no_sync (), + sys_options (o), o.create_host_config (), o.create_build2_config ()); diff --git a/bdep/init.hxx b/bdep/init.hxx index e72abb2..6f03025 100644 --- a/bdep/init.hxx +++ b/bdep/init.hxx @@ -7,6 +7,7 @@ #include #include +#include // sys_options #include #include @@ -37,6 +38,7 @@ namespace bdep const package_locations&, const strings& pkg_args, bool sync = true, + const sys_options& = sys_options (), bool create_host_config = false, bool create_build2_config = false); diff --git a/bdep/sync.cli b/bdep/sync.cli index 60254a1..db567b3 100644 --- a/bdep/sync.cli +++ b/bdep/sync.cli @@ -225,6 +225,40 @@ namespace bdep "Perform the \cb{fetch --full} command prior to synchronization." } + bool --sys-no-query + { + "Do not query the system package manager for the installed versions of + packages specified with the \cb{sys} scheme. See the corresponding + \l{bpkg-pkg-build(1)} option for details." + } + + bool --sys-install + { + "Instruct the system package manager to install available versions of + packages specified with the \cb{sys} scheme that are not already + installed. See the corresponding \l{bpkg-pkg-build(1)} option for + details." + } + + bool --sys-no-fetch + { + "Do not fetch the system package manager metadata before querying for + available versions of packages specified with the \cb{sys} scheme. See + the corresponding \l{bpkg-pkg-build(1)} option for details." + } + + bool --sys-no-stub + { + "Do no require a stub for packages specified with the \cb{sys} scheme. + See the corresponding \l{bpkg-pkg-build(1)} option for details." + } + + bool --sys-yes + { + "Assume the answer to the system package manager prompts is \cb{yes}. + See the corresponding \l{bpkg-pkg-build(1)} option for details." + } + bool --create-host-config { "Create a configuration for build-time dependencies without prompt." diff --git a/bdep/sync.cxx b/bdep/sync.cxx index 602c9aa..4978169 100644 --- a/bdep/sync.cxx +++ b/bdep/sync.cxx @@ -850,6 +850,7 @@ namespace bdep const package_locations& prj_pkgs, const strings& dep_pkgs, const strings& deinit_pkgs, + const sys_options& so, bool create_host_config, bool create_build2_config, transaction* origin_tr = nullptr, @@ -1708,6 +1709,11 @@ namespace bdep "--keep-out", "--plan", plan, (yes ? "--yes" : nullptr), + (so.no_query ? "--sys-no-query" : nullptr), + (so.install ? "--sys-install" : nullptr), + (so.no_fetch ? "--sys-no-fetch" : nullptr), + (so.no_stub ? "--sys-no-stub" : nullptr), + (so.yes ? "--sys-yes" : nullptr), args)); // Shouldn't throw, unless something is severely damaged. @@ -2125,6 +2131,7 @@ namespace bdep bool fetch, bool yes, bool name_cfg, + const sys_options& so, bool create_host_config, bool create_build2_config, transaction* t, @@ -2162,6 +2169,7 @@ namespace bdep package_locations () /* prj_pkgs */, strings () /* dep_pkgs */, strings () /* deinit_pkgs */, + so, create_host_config, create_build2_config, t, @@ -2179,6 +2187,7 @@ namespace bdep bool fetch, bool yes, bool name_cfg, + const sys_options& so, bool create_host_config, bool create_build2_config) { @@ -2238,6 +2247,7 @@ namespace bdep package_locations () /* prj_pkgs */, strings () /* dep_pkgs */, strings () /* deinit_pkgs */, + so, create_host_config, create_build2_config, nullptr, @@ -2251,6 +2261,7 @@ namespace bdep bool fetch, bool yes, bool name_cfg, + const sys_options& so, bool create_host_config, bool create_build2_config) { @@ -2284,6 +2295,7 @@ namespace bdep package_locations () /* prj_pkgs */, strings () /* dep_pkgs */, strings () /* deinit_pkgs */, + so, create_host_config, create_build2_config); @@ -2296,6 +2308,7 @@ namespace bdep bool fetch, bool yes, bool name_cfg, + const sys_options& so, bool create_host_config, bool create_build2_config) { @@ -2351,6 +2364,7 @@ namespace bdep package_locations () /* prj_pkgs */, strings () /* dep_pkgs */, strings () /* deinit_pkgs */, + so, create_host_config, create_build2_config); } @@ -2380,6 +2394,7 @@ namespace bdep package_locations () /* prj_pkgs */, strings () /* dep_pkgs */, pkgs, + sys_options (), false /* create_host_config */, false /* create_build2_config */); } @@ -2727,6 +2742,7 @@ namespace bdep package_locations () /* prj_pkgs */, dep_pkgs, strings () /* deinit_pkgs */, + sys_options (o), o.create_host_config (), o.create_build2_config ()); } @@ -2750,6 +2766,7 @@ namespace bdep prj_pkgs, strings () /* dep_pkgs */, strings () /* deinit_pkgs */, + sys_options (o), o.create_host_config (), o.create_build2_config ()); } @@ -2775,6 +2792,7 @@ namespace bdep package_locations () /* prj_pkgs */, strings () /* dep_pkgs */, strings () /* deinit_pkgs */, + sys_options (o), o.create_host_config (), o.create_build2_config ()); } diff --git a/bdep/sync.hxx b/bdep/sync.hxx index fdd6d0b..f370ae3 100644 --- a/bdep/sync.hxx +++ b/bdep/sync.hxx @@ -59,6 +59,26 @@ namespace bdep // the created configurations with the project using the configuration types // also as their names. // + struct sys_options + { + bool no_query = false; + bool install = false; + bool no_fetch = false; + bool no_stub = false; + bool yes = false; + + sys_options () = default; + + template + explicit + sys_options (const O& o) + : no_query (o.sys_no_query ()), + install (o.sys_install ()), + no_fetch (o.sys_no_fetch ()), + no_stub (o.sys_no_stub ()), + yes (o.sys_yes ()) {} + }; + synced_configs_guard cmd_sync (const common_options&, const dir_path& prj, @@ -68,6 +88,7 @@ namespace bdep bool fetch = true, bool yes = true, bool name_cfg = false, + const sys_options& = sys_options (), bool create_host_config = false, bool create_build2_config = false, transaction* = nullptr, @@ -85,6 +106,7 @@ namespace bdep bool fetch = true, bool yes = true, bool name_cfg = false, + const sys_options& = sys_options (), bool create_host_config = false, bool create_build2_config = false); @@ -97,6 +119,7 @@ namespace bdep bool fetch = true, bool yes = true, bool name_cfg = true, + const sys_options& = sys_options (), bool create_host_config = false, bool create_build2_config = false); @@ -109,6 +132,7 @@ namespace bdep bool fetch = true, bool yes = true, bool name_cfg = true, + const sys_options& = sys_options (), bool create_host_config = false, bool create_build2_config = false); -- cgit v1.1