From 996aba4f0989de1fa2b8cf13ef482bf228bd410e Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 29 Jun 2023 14:55:44 +0300 Subject: Add --sys-sudo options for sync and init commands --- bdep/init.cli | 9 +++++++++ bdep/sync.cli | 9 +++++++++ bdep/sync.cxx | 3 +++ bdep/sync.hxx | 6 +++++- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/bdep/init.cli b/bdep/init.cli index 2bd41b1..f1b78f4 100644 --- a/bdep/init.cli +++ b/bdep/init.cli @@ -220,6 +220,15 @@ namespace bdep See the corresponding \l{bpkg-pkg-build(1)} option for details." } + string --sys-sudo = "sudo" + { + "", + "The \cb{sudo} program to use for system package manager interactions + that normally require administrative privileges (fetch package + metadata, install packages, etc). 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/sync.cli b/bdep/sync.cli index db567b3..bee9e29 100644 --- a/bdep/sync.cli +++ b/bdep/sync.cli @@ -259,6 +259,15 @@ namespace bdep See the corresponding \l{bpkg-pkg-build(1)} option for details." } + string --sys-sudo = "sudo" + { + "", + "The \cb{sudo} program to use for system package manager interactions + that normally require administrative privileges (fetch package + metadata, install packages, etc). 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 4978169..45ee46c 100644 --- a/bdep/sync.cxx +++ b/bdep/sync.cxx @@ -1714,6 +1714,9 @@ namespace bdep (so.no_fetch ? "--sys-no-fetch" : nullptr), (so.no_stub ? "--sys-no-stub" : nullptr), (so.yes ? "--sys-yes" : nullptr), + (so.sudo + ? cstrings ({"--sys-sudo", so.sudo->c_str ()}) + : cstrings ()), args)); // Shouldn't throw, unless something is severely damaged. diff --git a/bdep/sync.hxx b/bdep/sync.hxx index f370ae3..9003836 100644 --- a/bdep/sync.hxx +++ b/bdep/sync.hxx @@ -66,6 +66,7 @@ namespace bdep bool no_fetch = false; bool no_stub = false; bool yes = false; + optional sudo; sys_options () = default; @@ -76,7 +77,10 @@ namespace bdep install (o.sys_install ()), no_fetch (o.sys_no_fetch ()), no_stub (o.sys_no_stub ()), - yes (o.sys_yes ()) {} + yes (o.sys_yes ()), + sudo (o.sys_sudo_specified () + ? o.sys_sudo () + : optional ()) {} }; synced_configs_guard -- cgit v1.1