diff mbox

[pacman-dev] RFC: [PATCH] Deprecate --root in favour of --sysroot

Message ID 20180119114942.4142-1-allan@archlinux.org
State Accepted, archived
Headers show

Commit Message

Allan McRae Jan. 19, 2018, 11:49 a.m. UTC
The --root option was widely misunderstood, and is now replaced by
--sysroot.

Signed-off-by: Allan McRae <allan@archlinux.org>
---

The idea of --sysroot was to provide something that --root never quite
did.  Is there any reason to keep --root?

 doc/pacman.8.txt    | 10 ----------
 src/pacman/pacman.c |  3 ++-
 2 files changed, 2 insertions(+), 11 deletions(-)

Comments

Eli Schwartz Jan. 19, 2018, 1:22 p.m. UTC | #1
On 01/19/2018 06:49 AM, Allan McRae wrote:
> The --root option was widely misunderstood, and is now replaced by
> --sysroot.
> 
> Signed-off-by: Allan McRae <allan@archlinux.org>
> ---
> 
> The idea of --sysroot was to provide something that --root never quite
> did.  Is there any reason to keep --root?

pacstrap breaks if you try to replace --root with --sysroot, since the
--sysroot does not yet exist and does not have a pacman.conf.

We could prepare the newroot by copying /etc/pacman.conf and
/etc/pacman.d/mirrorlist within pacstrap, but this means if the
pacman.conf differs from whatever the latest version of pacman has, it
will be installed as a pacnew.

Other than that, I cannot think of any reason anyone would wish to use
--root.
Eli Schwartz Jan. 19, 2018, 1:42 p.m. UTC | #2
On 01/19/2018 08:22 AM, Eli Schwartz wrote:
> On 01/19/2018 06:49 AM, Allan McRae wrote:
>> The --root option was widely misunderstood, and is now replaced by
>> --sysroot.
>>
>> Signed-off-by: Allan McRae <allan@archlinux.org>
>> ---
>>
>> The idea of --sysroot was to provide something that --root never quite
>> did.  Is there any reason to keep --root?
> 
> pacstrap breaks if you try to replace --root with --sysroot, since the
> --sysroot does not yet exist and does not have a pacman.conf.
> 
> We could prepare the newroot by copying /etc/pacman.conf and
> /etc/pacman.d/mirrorlist within pacstrap, but this means if the
> pacman.conf differs from whatever the latest version of pacman has, it
> will be installed as a pacnew.
> 
> Other than that, I cannot think of any reason anyone would wish to use
> --root.

And of course agregory pointed out that now that we also have
pacman-conf we can generate a config and copy it to $newroot/tmp

I say we deprecate --root as fast as possible then. It's basically a bug
that it doesn't behave like --sysroot already, and IIRC we are only
using --sysroot instead of "fixing" --root, is in order to avoid
surprising people who are by now used to the behavior of --root.
diff mbox

Patch

diff --git a/doc/pacman.8.txt b/doc/pacman.8.txt
index 48958358..a395b777 100644
--- a/doc/pacman.8.txt
+++ b/doc/pacman.8.txt
@@ -133,16 +133,6 @@  Options
 	*NOTE*: If specified, this is an absolute path, and the root path is
 	not automatically prepended.
 
-*-r, \--root* <path>::
-	Specify an alternative installation root (default is `/`). This should
-	not be used as a way to install software into `/usr/local` instead of
-	`/usr`.
-	*NOTE*: If database path or log file are not specified on either the
-	command line or in linkman:pacman.conf[5], their default location will
-	be inside this root path.
-	*NOTE*: This option is not suitable for performing operations on a mounted
-	guest system. See '\--sysroot' instead.
-
 *-v, \--verbose*::
 	Output paths such as as the Root, Conf File, DB Path, Cache Dirs, etc.
 
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 8c7f715e..98b3f326 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -211,7 +211,6 @@  static void usage(int op, const char * const myname)
 		}
 
 		addlist(_("  -b, --dbpath <path>  set an alternate database location\n"));
-		addlist(_("  -r, --root <path>    set an alternate installation root\n"));
 		addlist(_("  -v, --verbose        be verbose\n"));
 		addlist(_("      --arch <arch>    set an alternate architecture\n"));
 		addlist(_("      --sysroot        operate on a mounted guest system (root-only)\n"));
@@ -450,6 +449,8 @@  static int parsearg_global(int opt)
 			break;
 		case OP_ROOT:
 		case 'r':
+			pm_printf(ALPM_LOG_WARNING,
+					_("option --root is deprecated; use --sysroot instead\n"));
 			free(config->rootdir);
 			config->rootdir = strdup(optarg);
 			break;