changeset 30411:0fee9e910d84 stable

doc: Update pkg documentation related to local/global install (bug #59821). * scripts/pkg/pkg.m: Clarify global/local selection, limitations of pkg update. * doc/interpreter/package.txi: Add website URL. Add note on warnings.
author Nicholas R. Jankowski <jankowskin@asme.org>
date Tue, 11 May 2021 13:26:38 -0400
parents bc0de453fb6a
children 1fda8d2229d7 181c44079f6c
files doc/interpreter/package.txi scripts/pkg/pkg.m
diffstat 2 files changed, 55 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/package.txi	Wed Dec 01 12:42:08 2021 -0500
+++ b/doc/interpreter/package.txi	Tue May 11 13:26:38 2021 -0400
@@ -26,8 +26,9 @@
 installed in Octave.  At the time of writing the `Octave Forge' project
 can be found online at @url{https://octave.sourceforge.io}, but
 since the Internet is an ever-changing place this may not be true at
-the time of reading.  Therefore it is recommended to see the Octave
-website for an updated reference.
+the time of reading.  Therefore it is recommended to see
+@url{https://octave.org, the Octave website}for an
+updated reference.
 
 @menu
 * Installing and Removing Packages::
@@ -49,12 +50,12 @@
 
 @noindent
 If the package is installed successfully nothing will be printed on
-the prompt, but if an error occurred during installation it will be
-reported.  It is possible to install several packages at once by
-writing several package files after the @code{pkg install} command.
-If a different version of the package is already installed it will
-be removed prior to installing the new package.  This makes it easy to
-upgrade and downgrade the version of a package, but makes it
+the prompt, but if a warning or error occurred during installation it
+will be reported.  It is possible to install several packages at once
+by writing several package file names after the @code{pkg install}
+command.  If a different version of the package is already installed it
+will be removed prior to installing the new package.  This makes it
+easy to upgrade and downgrade the version of a package, but makes it
 impossible to have several versions of the same package installed at
 once.
 
@@ -70,9 +71,9 @@
 @end example
 
 @noindent
-In this case only version 1.0.0 of the @code{image} package is
-installed.  The @qcode{'*'} character next to the package name shows that the
-image package is loaded and ready for use.
+In this case, version 1.0.0 of the @code{image} package is installed.
+The @qcode{'*'} character next to the package name shows that the image
+package is loaded and ready for use.
 
 It is possible to remove a package from the system using the
 @code{pkg uninstall} command like this
@@ -83,14 +84,14 @@
 
 @noindent
 If the package is removed successfully nothing will be printed in the
-prompt, but if an error occurred it will be reported.  It should be
-noted that the package file used for installation is not needed for
-removal, and that only the package name as reported by @code{pkg list}
-should be used when removing a package.  It is possible to remove
-several packages at once by writing several package names after the
-@code{pkg uninstall} command.
+prompt, but if a warning or error occurred it will be reported.  It
+should be noted that the package file used for installation is not
+needed for removal, and that only the package name as reported by
+@code{pkg list} should be used when removing a package.  It is possible
+to remove several packages at once by writing several package names
+after the @code{pkg uninstall} command.
 
-To minimize the amount of code duplication between packages it is
+To minimize the amount of code duplication between packages, it is
 possible that one package depends on another one.  If a package
 depends on another, it will check if that package is installed
 during installation.  If it is not, an error will be reported and
@@ -137,11 +138,12 @@
 
 It is possible to make both per-user (local) and system-wide (global)
 installations of a package.  If the user performing the installation is
-@code{root} (or Administrator with elevated rights on Windows), the
+@code{root} (or Administrator with elevated privileges on Windows), the
 packages by default install in a system-wide directory that defaults to
 @file{@var{OCTAVE_HOME}/share/octave/packages/}.  If the user is not
-@code{root} (or without elevated rights), packages are installed
-locally.  The default installation directory for local packages is
+@code{root} (or Octave is running without elevated privileges),
+packages are installed locally.  The default installation directory for
+local packages is
 @file{@var{user_data_dir}/octave/@var{OCTAVE_API_VERSION}/packages}.
 Packages will be installed in a subdirectory of the installation
 directory that will be named after the package.  It is possible to
--- a/scripts/pkg/pkg.m	Wed Dec 01 12:42:08 2021 -0500
+++ b/scripts/pkg/pkg.m	Tue May 11 13:26:38 2021 -0400
@@ -35,22 +35,32 @@
 ## Global packages are installed by default in a system-wide location.  This is
 ## usually a subdirectory of the folder where Octave itself is installed.
 ## Therefore, Octave needs write access to this folder to install global
-## packages.  That usually means that Octave has to run with root access (or
-## "Run as administrator" on Windows) to be able to install packages globally.
+## packages, which is usually only available when Octave is run with
+## administrative privileges, such as when run as root (or superuser) on
+## Unix-like systems, or run with elevated privileges ("Run as administrator")
+## on Windows.
 ##
-## In contrast, local packages are installed by default in the user's
-## home directory (profile on Windows) and are only available to that specific
-## user.  Usually, they can be installed without root access (or administrative
-## privileges).
+## In contrast, local packages are installed by default in the user's home
+## directory (or user profile on Windows) and are only available to that
+## specific user.  Usually, they can be installed without administrative
+## privileges.
+##
+## When Octave is running with administrative privileges, @code{pkg} will
+## install packages to the global package location by default.  Otherwise,
+## packages will be installed to the local location by default.  The user can
+## override this default installation location with optional arguments
+## (@option{-local} or @option{-global}) as described below.  The currently
+## used default package installation location can be queried with
+## @code{pkg prefix}.
 ##
 ## For global and local packages, there are separate databases holding the
 ## information about the installed packages.  If some package is installed
 ## globally as well as locally, the local installation takes precedence over
-## ("shadows") the global one.  Which package installation (global or local) is
+## ("shadows") the global one.  Which (global or local) package installation is
 ## used can also be manipulated by using prefixes and/or using the
 ## @samp{local_list} input argument.  Using these mechanisms, several different
-## releases of one and the same package can be installed side by side as well
-## (but cannot be loaded simultaneously).
+## releases of the same package can be installed side by side as well (but
+## cannot be loaded simultaneously).
 ##
 ## Packages might depend on external software and/or other packages.  To be
 ## able to install such packages, these dependencies should be installed
@@ -128,18 +138,19 @@
 ##
 ## @item -local
 ## A local installation (package available only to current user) is forced,
-## even if the user has system privileges.
+## even if Octave is being run with administrative privileges.
 ##
 ## @item -global
 ## A global installation (package available to all users) is forced, even if
-## the user doesn't normally have system privileges.
+## Octave is not being run with administrative privileges.  The user must have
+## write access to the global package store.
 ##
 ## @item -forge
 ## Install a package directly from the Octave Forge repository.  This
 ## requires an internet connection and the cURL library.
 ##
 ## @emph{Security risk}: no verification of the package is performed
-## before the installation.  There are no signature for packages, or
+## before the installation.  There are no signatures for packages, or
 ## checksums to confirm the correct file was downloaded.  It has the
 ## same security issues as manually downloading the package from the
 ## Octave Forge repository and installing it.
@@ -151,8 +162,9 @@
 ##
 ## @item update
 ## Check installed Octave Forge packages against repository and update any
-## outdated items.  This requires an internet connection and the cURL library.
-## Usage:
+## outdated items.  Updated packages are installed either globally or locally
+## depending on whether Octave is running with elevated privileges.  This
+## requires an internet connection and the cURL library.  Usage:
 ##
 ## @example
 ## pkg update
@@ -160,6 +172,12 @@
 ##
 ## @noindent
 ## To update a single package use @code{pkg install -forge}
+## 
+## @noindent
+## Updates for multiple packages are sorted alphabetically and not checked for
+## dependencies affected by installation order.  If dependency order related
+## @code{pkg update} failures occur, use @code{pkg install -forge} to update
+## packages individually.
 ##
 ## @item uninstall
 ## Uninstall named packages.  For example,