prune unreachable code paths; update man-page with fresh examples

expand the discussion of --install-root
This commit is contained in:
John McQuah 2023-08-22 17:41:54 -04:00
parent af59c55bed
commit c029a01d00
3 changed files with 66 additions and 57 deletions

View File

@ -76,28 +76,36 @@ non-option argument passed. This is very similar to
.TP
.B install [\-\-margs] [\-\-aargs] [\-\-log] <package1> [<package2> ...]
install all packages in the listed order. Note that you can do this
Install all packages in the listed order. Note that you can do this
from any directory.
.TP
.B depinst [\-\-margs] [\-\-aargs] [\-\-log] [\-\-softdeps] <package1> [<package2> ...]
install all packages given on the command line, including their dependencies.
Install all packages given on the command line, including their dependencies.
Note that already-installed packages will be left at their current version,
even if out of date. prt\-get depinst behaves this way because all of its
child pkgadd processes will \fBlack\fP the \-u flag, which is needed when
updating an already-installed package.
Passing the --softdeps flag tells \fBprt-get\fP to consider also the optional
dependencies when sorting. Note that already-installed packages will be left
at their current version, even if out of date. prt\-get depinst behaves this
way because all of its child pkgadd processes will \fBlack\fP the \-u flag,
which is needed when updating an already-installed package.
dependencies when sorting. The --softdeps flag does NOT affect the
calculation of the minimal set of packages needed to satisfy the
transaction; only hard dependencies are used when constructing this set. But
if there are any optional dependency relationships among the ports in the
resulting set, they will be respected when prt-get determines the sequence
in which to build.
.TP
.B update [\-\-margs] [\-\-aargs] [\-\-log] <package1> [<package2> ...]
update all packages listed in this order. Note: if the latest version of
a package has acquired dependencies that were not needed by the currently-installed
version and are not present on the system, the update command will not attempt to
resolve this omission. prt-get update behaves this way because pkgadd invocations
inherit the flag -u for every package in the transaction, causing an error if
the package is not already installed. You can follow the CRUX mailing list or the
IRC channels to stay informed of the situations where an update will require manual
intervention, or filter the output of
Update all packages listed in this order. Note: if the latest version of a
package has acquired dependencies that were not needed by the
currently-installed version and are not present on the system, the update
command will not attempt to resolve this omission. prt-get update behaves
this way because pkgadd invocations inherit the flag -u for every package in
the transaction, causing an error if the package is not already installed.
You can follow the CRUX mailing list or the IRC channels to stay informed of
the situations where an update will require manual intervention, or filter
the output of
.B prt\-get quickdep $(prt\-get quickdiff)
through \fBprt\-get isinst\fP to get a list of packages suitable for an
\fBinstall\fP or \fBupdate\fP command.
@ -105,7 +113,7 @@ See the \fBEXAMPLES\fP section below for details.
.TP
.B remove <package1> [<package2> ...]
remove packages listed in this order
Remove packages listed in this order
.TP
.B sysup [\-\-softdeps] [\-\-nodeps]
@ -150,7 +158,7 @@ switch will slow down the operation remarkably.
.TP
.B diff [\-\-all] [\-\-prefer\-higher] [<package1> <package2> ...]
show differences between installed packages and ports in the ports
Show differences between installed packages and ports in the ports
tree. If arguments are given, shows only differences for these
packages, otherwise all differences are shown. It's also possible to use
shell-like
@ -162,7 +170,7 @@ the ports tree, use the --prefer-higher option.
.TP
.B quickdiff
prints a simple list of packages which have a different version in the
Print a simple list of packages which have a different version in the
ports tree than what is installed. The output is sorted alphabetically,
but you can generate a (larger) list sorted by dependencies using
.B prt\-get quickdep $(prt\-get quickdiff).
@ -216,7 +224,7 @@ Print the port's README file if it exists; if set, uses $PAGER
.TP
.B depends [\-\-softdeps] <package1> [<package2> ...]
print a recursive list of dependencies needed to install the packages
Print a recursive list of dependencies needed to install the packages
passed as argument. It shows a list of the dependencies that were found in
the ports tree, plus a list of the dependencies that could not be found.
Pass the --softdeps flag if you want the sorting algorithm to consider
@ -224,7 +232,7 @@ optional dependencies too.
.TP
.B quickdep [\-\-softdeps] <package1> [<package2> ...]
same output as \fBdepends\fP, but separated by spaces rather than newlines,
Same output as \fBdepends\fP, but separated by spaces rather than newlines,
and stripped of any dependencies that could not be found in the ports tree.
Useful in case the list of dependencies is too large to fit on one screen,
or if you don't want to filter out manually the ports that are invalid
@ -241,7 +249,7 @@ for successful builds.
.TP
.B deptree [\-\-softdeps] <package>
print a tree of the dependencies of the package
Print a tree of the dependencies of the package
.B <package>.
Pass the --softdeps flag to also show the installed packages that might
have been eagerly linked, if they were present when
@ -254,7 +262,7 @@ order to show them all, add the --all switch.
.TP
.B dependent [\-\-recursive] [\-\-softdeps] [\-\-all] [\-\-tree] <package>
print a list of ports whose "Depends on:" line contains
Print a list of ports whose "Depends on:" line contains
.B <package>
(or its dependents, if --recursive was passed). Use the --softdeps flag to
also search the "Optional:" lines for \fB<package>\fP.
@ -283,7 +291,7 @@ symbols will be replaced as follows.
.TP
\ \ \ \(bu
%p1 \-> Full path (including name) to port taking precendence
%p1 \-> Full path (including name) to port taking precedence
.TP
\ \ \ \(bu
@ -291,7 +299,7 @@ symbols will be replaced as follows.
.TP
\ \ \ \(bu
%v1 \-> Version of port taking precendence
%v1 \-> Version of port taking precedence
.TP
\ \ \ \(bu
@ -396,16 +404,16 @@ to filter by package name.
.B listinst [\-v|\-vv] [\-\-regex] [\-\-depsort] [filter]
List installed ports. It's basically the same as
.B pkginfo \-i,
but omits version when called without verbose (\-v, \-vv) switch. Plus
it is notably faster in my tests. \-v adds version information, \-vv
but omits version when called without verbose (-v, -vv) switch. Plus
it is notably faster in my tests. -v adds version information, -vv
adds version and description.
.B Warning:
\-vv will slow down the process because it requires prt\-get to scan
-vv will slow down the process because it requires prt-get to scan
both the ports database and the ports tree.
It's also possible to use shell-like
.B wildcards
for the listinst command. Make sure you escape where needed. By default
it's sorted alphabetically; use the \-\-depsort switch to sort by
it's sorted alphabetically; use the --depsort switch to sort by
dependencies.
.TP
@ -432,7 +440,7 @@ greater than 0.
.TP
.B current <package>
Shows the currently-installed version of <package>, or a message
Show the currently-installed version of <package>, or a message
that <package> is not installed. Unlike
.B prt\-get isinst package1 package2,
this command does \fBnot\fP accept more than one package as argument. Use
@ -441,11 +449,11 @@ to work around this limitation.
.TP
.B ls [\-\-path] <package>
Prints out a listing of the port's directory
List the contents of the port's directory
.TP
.B cat <package> [<file>]
Prints out the file to stdout. If <file> is not specified, 'Pkgfile' is used. If set, uses $PAGER.
Print the file to stdout. If <file> is not specified, 'Pkgfile' is used. If set, uses $PAGER.
.TP
.B edit <package> [<file>]
@ -455,7 +463,7 @@ If <file> is not specified, 'Pkgfile' is used.
.TP
.B help
Shows a help screen
Show a help screen
.TP
.B dumpconfig
@ -463,11 +471,11 @@ Dump the configuration to the current terminal
.TP
.B version
Shows the current version of prt-get
Show the current version of prt-get
.TP
.B cache
create a cache file from the ports tree to be used by prt-get using the
Create a cache file from the ports tree to be used by prt-get using the
--cache option. Remember to run prt-get cache each time you update the
ports tree.
@ -591,9 +599,18 @@ reading/writing (so <dir>/var/lib/pkg/db must exist), and where the pkg.tar.?z
archives get unpacked, but the relevant prt-get.conf and ports tree are those
on the parent filesystem. Therefore it is not necessary for <dir> to contain
its own copy of the ports tree (unless 'runscripts yes' is desired, as
explained above) However, if <dir>/etc/pkgadd.conf exists and is different
from /etc/pkgadd.conf, then install or update commands might behave
unexpectedly. In order to preserve the \fBpkgadd.conf(5)\fP settings from
explained above). But each \fBpkgmk(8)\fP process will take place on the parent
filesystem, inspecting \fIthe parent filesystem\fP's environment for
information about installed ports and available shared libraries. The
\fBpkgmk(8)\fP process might therefore draw the wrong conclusions about what
functionality should be enabled for an installation to <dir>. If the parent
filesystem is more richly populated than <dir>, with respect to installed
packages, then the built package might exhibit breakage when \fBpkgadd\fP
unpacks it into <dir>.
When setting --install-root=<dir>, install or update commands might behave
unexpectedly if <dir>/etc/pkgadd.conf exists and is different from
/etc/pkgadd.conf . In order to preserve the \fBpkgadd.conf(5)\fP settings from
the host system, append the option --aargs='-c /etc/pkgadd.conf' to your
\fBprt-get install\fP command, or just copy the desired directives into
<dir>/etc/pkgadd.conf .
@ -602,7 +619,7 @@ the host system, append the option --aargs='-c /etc/pkgadd.conf' to your
.B \-\-log
Write build output to log file. Basically a convenient alias for
\fB\-\-config\-set=\(dqwritelog enabled\(dq\fP. Note that there is no similar
alias allowing you to temporarily override the configuration directive
alias allowing you to temporarily override the one configuration directive
\(dqwritelog enabled\(dq; you have to resort to \fB\-\-config\-set=\(dqwritelog
disabled\(dq\fP if that is your intention.
@ -669,13 +686,8 @@ Download, build and install irssi, with one simple command
.TP
.B prt\-get install paper yasm
Install paper and yasm. Abort with an informative error message if either package is already
installed, allowing you to issue a revised command.
.TP
.B prt\-get update bmake cmake
Update bmake and cmake. Abort with an informative error message if either package is not yet
installed, allowing you to issue a revised command.
Install paper and yasm. Abort with an informative error message if either
package is already installed, allowing you to issue a revised command.
.TP
.B prt\-get update -fr openssh
@ -689,11 +701,11 @@ indicates a broken package. :\-)
If any are absent, search the footprints to determine which ports provide the missing libraries.
.TP
.B prt\-get isinst $(prt-get info ffmpeg | awk -v FS=: '/^Optional/ {gsub(/,/,\(dq \(dq,$2); print $2}') | awk -v FS=\(dq \(dq '/not installed/ {print $2}'
.B prt\-get isinst $(prt\-get info ffmpeg | awk \-v FS=: '/^Optional/ {gsub(/,/,\(dq \(dq,$2); print $2}') | awk -v FS=\(dq \(dq '/not installed/ {print $2}'
Show all the optional dependencies of ffmpeg that are not currently installed.
.TP
.B prt\-get isinst $(prt-get info ffmpeg | awk -v FS=: '/^Optional/ {gsub(/,/,\(dq \(dq,$2); print $2}') | awk -v FS=\(dq \(dq '/not installed/ {print $2}' | xargs prt\-get depinst \-\-group \-\-softdeps ffmpeg
.B prt\-get isinst $(prt\-get info ffmpeg | awk \-v FS=: '/^Optional/ {gsub(/,/,\(dq \(dq,$2); print $2}') | awk \-v FS=\(dq \(dq '/not installed/ {print $2}' | xargs prt\-get depinst \-\-group \-\-softdeps ffmpeg
Extension of the above. Installs ffmpeg and all its optional dependencies, in
the order that guarantees a maximal feature set. The --group flag tells
\fBprt\-get\fP to abort the operation if any port fails to build, so as not to
@ -743,6 +755,14 @@ suitable for piping to \fBxargs prt\-get install\fP.
Same as above, but only print the dependencies that are already installed. The output of this
command is suitable for piping to \fBxargs prt\-get update\fP.
.TP
.B prt\-get isinst $(prt\-get quickdep i3) | awk '/not installed/ { print $2 }' | xargs prt\-get depinst \-\-softdeps \-\-test
(inspired by a troubleshooting session with hestia) Assemble a set of install
targets needed to build the i3 window manager; sort the list, respecting both
hard and soft dependencies; then print how the installation would proceed. The
awk filter in the middle is needed to prevent the command from failing with the
error message "already installed".
.TP
.B comm -3 <(prt\-get printf \(dq%i:%n %v-%r\en\(dq | grep -v ^no | cut -d: -f2 | sort) <(pkginfo -i | sort)
(inspired by a bug report from teodor) an alternative to \fBprt\-get diff\fP.

View File

@ -56,9 +56,7 @@ public:
SUCCESS, /*!< yeah, success */
NO_PACKAGE_GIVEN, /*!< no package give to install */
PACKAGE_NOT_FOUND, /*!< package not found */
PKGMK_EXEC_ERROR, /*!< can't execute pkgmk */
PKGMK_FAILURE, /*!< error while pkgmk */
PKGADD_EXEC_ERROR, /*!< can't execute pkgadd */
PKGDEST_ERROR, /*!< can't change to PKGDEST */
PKGADD_FAILURE, /*!< error while pkgadd */
CYCLIC_DEPEND, /*!< cyclic dependencies found */

View File

@ -697,11 +697,6 @@ void PrtGet::executeTransaction( InstallTransaction& transaction,
case InstallTransaction::PACKAGE_NOT_FOUND:
cout << m_appName << ": package(s) not found" << endl;
break;
case InstallTransaction::PKGMK_EXEC_ERROR:
cout << m_appName << " couldn't excecute pkgmk "
<< "(or alternative command). "
<< "Make sure it's installed properly" << endl;
break;
case InstallTransaction::PKGMK_FAILURE:
cout << m_appName << ": error while " << command[0] << endl;
break;
@ -709,10 +704,6 @@ void PrtGet::executeTransaction( InstallTransaction& transaction,
cout << m_appName << ": no package specified for "
<< command[0] << endl;
break;
case InstallTransaction::PKGADD_EXEC_ERROR:
cout << m_appName << " couldn't excecute pkgadd. "
<< "Make sure it's installed properly" << endl;
break;
case InstallTransaction::PKGDEST_ERROR:
cout << m_appName << ": error changing to PKGDEST directory "
<< transaction.getPkgmkPackageDir() << endl;