From 7c1126f0b0f636073af14046c51b8db8d5ce1612 Mon Sep 17 00:00:00 2001 From: John McQuah Date: Mon, 19 Jun 2023 14:54:06 -0400 Subject: [PATCH] man-page: fix indentation and formatting document the interaction between --install-root and 'runscripts yes' --- doc/prt-get.8 | 134 +++++++++++++++++++------------------ src/installtransaction.cpp | 6 +- 2 files changed, 73 insertions(+), 67 deletions(-) diff --git a/doc/prt-get.8 b/doc/prt-get.8 index cb5167e..58b4362 100644 --- a/doc/prt-get.8 +++ b/doc/prt-get.8 @@ -14,7 +14,7 @@ pkgutils from CRUX (see http://www.crux.nu) .B prt\-get command [options] .br .SH "DESCRIPTION" -prt\-get is a package management tool which provides additional +prt-get is a package management tool which provides additional functionality to the CRUX package management system. It works with the local ports tree and is therefore fully compatible with ports(8) and pkgmk(8)/pkgadd(8)/pkgrm(8). It offers the following features: @@ -42,16 +42,16 @@ search within the ports .PP -What prt\-get basically does is build, install/upgrade, and remove packages, using -pkgmk, pkgadd, and pkgrm. Additionally, you don't have be in the port's -directory to call prt\-get. prt\-get will search for the respective port -itself in a list of directories specified in /etc/prt\-get.conf. This +What prt-get basically does is build, install/upgrade, and remove packages, +using pkgmk, pkgadd, and pkgrm. Additionally, you don't have be in the port's +directory to call prt-get. prt-get will search for the respective port +itself in a list of directories specified in /etc/prt-get.conf. This allows you to just install or update a package, without caring where it actually is located on your file system. .PP -prt\-get also lets you search for ports by name, +prt-get also lets you search for ports by name, find information about ports (without installing them of course), or print the dependencies of a port (as a space- or newline-separated list, or a formatted tree). Note that dependencies are no @@ -59,16 +59,16 @@ requirement for crux packages and therefore not always accurate. .PP -prt\-get has a test mode so you can see what effect an install/update -operation would have. Use the \-\-test switch for this (more details in +prt-get has a test mode so you can see what effect an install/update +operation would have. Use the --test switch for this (more details in the \fBOPTIONS\fP section below). .SH "RETURN VALUE" -prt\-get returns 0 on success and a non-zero value otherwise (exact +prt-get returns 0 on success and a non-zero value otherwise (exact value -> meaning mapping to be determined...) .SH "COMMANDS" -prt\-get uses so\-called commands, which always have to be the first +prt-get uses so-called commands, which always have to be the first non-option argument passed. This is very similar to .B cvs(1). [command] can be one of the following: @@ -88,13 +88,13 @@ Basically a synonym for install (without the --nodeps flag). .TP .B update [\-\-margs] [\-\-aargs] [\-\-log] [\-\-softdeps] [ ...] -Basically a synonym for install. Earlier versions of \fBprt\-get\fP did not adjust -the \fBpkgadd(8)\fP arguments on a package-by-package basis, but applied "install -mode" or "update mode" to the entire transaction. This latest \fBprt\-get\fP -interprets the install command less rigidly, and tries to sync your installed -ports with their repository versions unless instructed otherwise (using -\fBprt\-get lock\fP, the --prefer-higher option, or the \fIprt-get.aliases\fP -file). +Basically a synonym for install. Earlier versions of \fBprt\-get\fP did not +adjust the \fBpkgadd(8)\fP arguments on a package-by-package basis, but +applied "install mode" or "update mode" to the entire transaction. This +latest \fBprt\-get\fP interprets the install command less rigidly, and tries +to sync your installed ports with their repository versions unless instructed +otherwise (using \fBprt\-get lock\fP, the --prefer-higher option, or the +\fIprt-get.aliases\fP file). .TP .B remove [ ...] @@ -106,11 +106,13 @@ Update all installed packages which are outdated. Sorts by hard dependencies by default. Passing the --softdeps switch tells \fBprt\-get\fP to also consider optional dependencies when sorting. Passing the --nodeps switch tells prt-get not to sort by dependencies at all. + .B Breaking Change: If a port has acquired new dependencies since its last successful build, those new dependencies will be injected into the transaction. This feature lingered many years on the TODO list, and its absence was the motivation for many clever workarounds (documented in the \fBEXAMPLES\fP section below). + You can use the .B lock and @@ -173,10 +175,10 @@ in their name Search the ports tree (both name and description) for the pattern .B expr (which can be a shell-like wildcard pattern or a regexp). The search in -the description is not case sensitive. Note that this requires prt\-get -to read every Pkgfile, which makes it rather slow; if you like this, -consider using the cache functionality, so you only have to spend this -time once after updating the ports tree has been updated. +the description is not case sensitive. Note that this requires prt-get +to read every Pkgfile, which makes it rather slow; if you like searching +by description, consider using the cache functionality, so you only have to +read every Pkgfile when the ports tree is updated. .TP .B fsearch [\-\-full] [\-\-regex] @@ -203,9 +205,10 @@ Print the port's README file if it exists; if set, uses $PAGER .TP .B depends [\-\-softdeps] [ ...] 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 optional dependencies too. +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 +optional dependencies too. .TP .B quickdep [\-\-softdeps] [ ...] @@ -292,27 +295,27 @@ Print formatted port list format string can contain variables, which are replaced like this: .TP \ \ \ \(bu -%n \-> name +%n -> name .TP \ \ \ \(bu -%p \-> path +%p -> path .TP \ \ \ \(bu -%v \-> version +%v -> version .TP \ \ \ \(bu -%r \-> release +%r -> release .TP \ \ \ \(bu -%d \-> description +%d -> description .TP \ \ \ \(bu -%e \-> dependencies +%e -> dependencies .TP \ \ \ \(bu @@ -320,36 +323,36 @@ are replaced like this: .TP \ \ \ \(bu -%u \-> URL +%u -> URL .TP \ \ \ \(bu -%M \-> Maintainer +%M -> Maintainer .TP \ \ \ \(bu -%R \-> Readme ("yes"/"no") +%R -> Readme ("yes"/"no") .TP \ \ \ \(bu -%E \-> pre-install script ("yes"/"no") +%E -> pre-install script ("yes"/"no") .TP \ \ \ \(bu -%O \-> post-install script ("yes"/"no") +%O -> post-install script ("yes"/"no") .TP \ \ \ \(bu -%l \-> is locked ("yes"/"no") +%l -> is locked ("yes"/"no") .TP \ \ \ \(bu -%i \-> "no" if not installed, "yes" if it's installed and +%i -> "no" if not installed, "yes" if it's installed and up to date and "diff" if it's installed and a new version is in the ports tree. -Use "\\n" and "\\t" to format your output (no additional format specified -suported). The optional format string2 can contain the same variables +Use "\\n" and "\\t" to format your output (no additional format codes +supported). The optional format string2 can contain the same variables as format string1 and is used to sort the output. You can specify a .B wildcard filter to filter by package name. @@ -359,16 +362,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 @@ -380,8 +383,8 @@ Output appears alphabetically separated by newlines, making it suitable for process substitution as shown in the .B EXAMPLES section below. Note that some core ports might be runtime -dependencies despite their absence in the "Depends on:" line; see \fBPkgfile(5)\fP -for an explanation of this practice. +dependencies despite their absence in the "Depends on:" line; +see \fBPkgfile(5)\fP for an explanation of this practice. .TP .B isinst [ ...] @@ -528,25 +531,25 @@ the requested packages onto a different directory than '/'. In daily usage, this option is not required; it's primarily interesting if you're developing an independent installation. -Some pre- or post-install scripts might not have the intended effect if invoked -as -.B chroot /bin/sh -(the naive way to respect --install-root). -So if you're maintaining an installation mounted somewhere different than '/', -it might be safer to ensure that your \fBprt\-get.conf(5)\fP has the line -.B runscripts no -and then run any pre- or post-install scripts by hand. +Pre- and post-install scripts will not be executed if the requested +root directory lacks a copy of the ports tree. So if you're maintaining an +installation mounted somewhere different than '/', it's not enough to put +the line +.B runscripts yes +in your prt-get.conf; you also have to ensure that the pre- and post-install +scripts can be found in the same location relative to . The setting for --install-root determines which package database is used for reading/writing (so /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 +archives get unpacked, but the relevant prt-get.conf and ports tree are those on the parent filesystem. Therefore it is not necessary for to contain -its own copy of the ports tree, or even a copy of prt-get.conf. -However, if /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 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 /etc/pkgadd.conf . +its own copy of the ports tree (unless 'runscripts yes' is desired, as +explained above). However, if /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 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 +/etc/pkgadd.conf . .TP .B \-\-log @@ -580,8 +583,9 @@ transactions as well. .TP .B \-v, \-vv -(verbosity level) Show version of a port (\-v), or show both version -and description (\-vv). Passing more than one of these options is equivalent to \-vv. +(verbosity level) Show version of a port (-v), or show both version +and description (-vv). Passing more than one of these options is equivalent +to -vv. .TP .B \-\-path @@ -606,7 +610,7 @@ Override the 'preferhigher' configuration option. Equivalent to .SH "CONFIGURATION" .TP -See man prt\-get.conf(5) +See man prt-get.conf(5) .SH "EXAMPLES" .TP @@ -628,7 +632,7 @@ Get the latest version of webkitgtk, rebuilding any of its outdated dependencies Update your current version of openssh, forcing a rebuild even if no version difference is detected. Useful if there was a major soversion change in one of its dependencies, -and \fBrevdep openssh\fP indicates a broken package. :\-) +and \fBrevdep openssh\fP indicates a broken package. :-) .TP .B MISSLIBS=$(revdep -vvv mpv | awk -v FS=: '/(missing library)/ {print $3}'); [ -n \(dq${MISSLIBS[@]}\(dq ] && for i in ${MISSLIBS[@]}; do prt\-get fsearch $i; done @@ -728,4 +732,4 @@ xorg port collection. .SH "AUTHORS" Johannes Winkelmann , and others cited inline .SH "SEE ALSO" -prt\-get.conf(5), prt\-cache(8), Pkgfile(5), pkgmk(8), pkgadd(8), ports(8) +prt-get.conf(5), prt-cache(8), Pkgfile(5), pkgmk(8), pkgadd(8), ports(8) diff --git a/src/installtransaction.cpp b/src/installtransaction.cpp index 0054f2a..d4810d0 100644 --- a/src/installtransaction.cpp +++ b/src/installtransaction.cpp @@ -296,7 +296,8 @@ const { // -- pre-install struct stat statData; struct stat fstatData; if ((parser->execPreInstall() || m_config->runScripts()) && - stat((portdir + "/pre-install").c_str(), &statData) == 0) { + stat((parser->installRoot() + portdir + "/pre-install").c_str(), + &statData) == 0) { Process preProc( runscriptCommand, portdir + "/pre-install", fdlog ); @@ -405,7 +406,8 @@ const { } else { // exec post install if ((parser->execPostInstall() || m_config->runScripts() ) && - stat((portdir + "/post-install").c_str(), &statData) == 0) { + stat((parser->installRoot() + portdir + "/post-install").c_str(), + &statData) == 0) { Process postProc( runscriptCommand, portdir + "/post-install", fdlog ); if (postProc.executeShell()) {