report pre- and post-install scripts in test mode
support more format codes in the argument to 'dup' expand man-page to explain some asymmetries
This commit is contained in:
parent
8f71c4fe8b
commit
7175591b00
100
doc/prt-get.8
100
doc/prt-get.8
@ -252,23 +252,28 @@ order to show them all, add the --all switch.
|
||||
.SH ""
|
||||
|
||||
.TP
|
||||
.B dependent [\-\-softdeps] <package>
|
||||
print a list of ports which have
|
||||
.B dependent [\-\-recursive] [\-\-softdeps] [\-\-all] <package>
|
||||
Print a list of ports whose "Depends on:" line contains
|
||||
.B <package>
|
||||
in their "Depends on:" line. Use the --softdeps flag to also search the
|
||||
"Optional:" lines for \fB<package>\fP.
|
||||
(or its dependents, if --recursive is passed). Use the --softdeps flag to also
|
||||
search the "Optional:" lines for \fB<package>\fP .
|
||||
|
||||
By default, output is restricted to ports that are installed. To see all
|
||||
the dependencies, add the --all switch; use --recursive to get a recursive
|
||||
list (without duplication), and --tree to get a nicely indented one.
|
||||
By default, output is restricted to ports that are installed. To see all the
|
||||
dependencies, add the --all switch. Use --tree to get a nicely indented list.
|
||||
|
||||
.TP
|
||||
.B dup [-v] [format]
|
||||
List ports which can be found in multiple directories configured in
|
||||
.B /etc/prt-get.conf
|
||||
Use the verbose switch to simulate the output of version 5.12 and older (likely
|
||||
to go away in the future). The format string can be used to create user
|
||||
specified formats. The following symbols are currently replaced:
|
||||
Use the \fB\-v\fP switch to see a verbose report, which will show for each
|
||||
dup the port that takes precedence, and the port that is hidden (including
|
||||
full path and version info). The verbose switch is basically an alias for a
|
||||
particular combination of the recognized format symbols, namely
|
||||
|
||||
.B '* %n\en %p1 %v1 precedes over\en %p2 %v2\en'.
|
||||
|
||||
You can customize the output by passing a different format string, whose
|
||||
symbols will be replaced as follows.
|
||||
|
||||
.TP
|
||||
\ \ \ \(bu
|
||||
@ -276,20 +281,35 @@ specified formats. The following symbols are currently replaced:
|
||||
|
||||
.TP
|
||||
\ \ \ \(bu
|
||||
%p1 \-> Full path (including name) to port taking precendence
|
||||
%p1 \-> full path (including name) to port taking precedence
|
||||
|
||||
.TP
|
||||
\ \ \ \(bu
|
||||
%p2 \-> Full path (including name) to port being hidden
|
||||
%p2 \-> full path (including name) to port being hidden
|
||||
|
||||
.TP
|
||||
\ \ \ \(bu
|
||||
%v1 \-> Version of port taking precendence
|
||||
%v1 \-> version of port taking precedence
|
||||
|
||||
.TP
|
||||
\ \ \ \(bu
|
||||
%v2 \-> Version of port being hidden
|
||||
%v2 \-> version of port being hidden
|
||||
|
||||
.TP
|
||||
\ \ \ \(bu
|
||||
%M1 \-> maintainer of port taking precedence
|
||||
|
||||
.TP
|
||||
\ \ \ \(bu
|
||||
%M2 \-> maintainer of port being hidden
|
||||
|
||||
.TP
|
||||
\ \ \ \(bu
|
||||
%u1 \-> URL of port taking precedence
|
||||
|
||||
.TP
|
||||
\ \ \ \(bu
|
||||
%u2 \-> URL of port being hidden
|
||||
|
||||
.TP
|
||||
.B list [\-v|\-vv] [\-\-path] [\-\-regex] [filter]
|
||||
@ -363,7 +383,7 @@ are replaced like this:
|
||||
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
|
||||
Use "\\n" and "\\t" to format your output (no additional format symbols
|
||||
suported). 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
|
||||
@ -395,8 +415,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 <package1> [<package2> ...]
|
||||
@ -423,14 +443,14 @@ Prints out a listing 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 to stdout (or $PAGER, if set) the contents of <file> in the port's
|
||||
directory. If <file> is not specified, 'Pkgfile' is used.
|
||||
|
||||
.TP
|
||||
.B edit <package> [<file>]
|
||||
Edit the file using the editor specified in the $EDITOR environment variable.
|
||||
If <file> is not specified, 'Pkgfile' is used.
|
||||
|
||||
|
||||
.TP
|
||||
.B help
|
||||
Shows a help screen
|
||||
@ -542,6 +562,14 @@ Execute post-install script if it's there
|
||||
.B \-\-install-scripts
|
||||
Execute pre-install and post-install script if they're there
|
||||
|
||||
The options --pre-install, --post-install, and --install-scripts offer a
|
||||
convenient way to temporarily override the prt-get.conf directive 'runscripts
|
||||
no', which was the historical default. Starting with CRUX 3.7, prt-get.conf is
|
||||
being shipped with 'runscripts yes'. To override this default at the command
|
||||
line, you have to pass the more cumbersome option --config-set=\(dqrunscripts
|
||||
no\(dq, or point prt-get to an alternative configuration file using
|
||||
--config=<file>. (see below for the documentation of these options)
|
||||
|
||||
.TP
|
||||
.B \-\-install-root=<dir>
|
||||
Use <dir> as root directory for your installation; allows you to install
|
||||
@ -549,30 +577,32 @@ 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 <dir> /bin/sh <path/to/script>
|
||||
(the naive way to respect --install-root).
|
||||
So if you're maintaining an installation on a volume mounted somewhere
|
||||
other 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 '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 <dir>.
|
||||
|
||||
The setting for --install-root determines which package database is used for
|
||||
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, or even a copy of prt-get.conf.
|
||||
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 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 .
|
||||
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 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 .
|
||||
|
||||
.TP
|
||||
.B \-\-log
|
||||
Write build output to log file
|
||||
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
|
||||
\(dqwritelog enabled\(dq; you have to resort to \fB\-\-config\-set=\(dqwritelog
|
||||
disabled\(dq\fP if that is your intention.
|
||||
|
||||
.TP
|
||||
.B \-\-no-std-config
|
||||
|
@ -20,7 +20,7 @@ It might look like this:
|
||||
# prt-get.conf
|
||||
|
||||
# root directories
|
||||
prtdir /usr/ports/base
|
||||
prtdir /usr/ports/core
|
||||
prtdir /usr/ports/opt
|
||||
prtdir /usr/ports/contrib
|
||||
|
||||
@ -130,7 +130,7 @@ and %n would be
|
||||
This allows you to have separate log files per port.
|
||||
|
||||
.B readme
|
||||
which can be set to 'disabled', to suppress the notification after
|
||||
can be set to 'disabled', to suppress the notification after
|
||||
installing a port with a README file; 'compact', to collect all the READMEs
|
||||
into one post-transaction output; or 'verbose', to print separate
|
||||
information about each port with a README file. See
|
||||
@ -149,13 +149,13 @@ append a comma separated list of ports to be used after the path,
|
||||
using a colon (':') character to separate the two components
|
||||
.B path:package1, package2,...
|
||||
Note that this slows down prt-get a lot if you list a lot of packages.
|
||||
If you become aware of speed problems due to this, create a separate
|
||||
ports directory instead and use symlinks for the ports you want to use.
|
||||
If you become aware of speed problems due to this feature, create a separate
|
||||
ports directory instead and fill it with symlinks to the ports you want.
|
||||
|
||||
.LP
|
||||
You can write comments after a '#' character. If you have '#'
|
||||
characters in your paths, there's no way to escape them (as there is no
|
||||
way to escape ':' characters). Complain to the author if this is a
|
||||
characters in your paths, there's no way to escape them (likewise there is
|
||||
no way to escape ':' characters). Complain to the author if this is a
|
||||
problem :-)
|
||||
|
||||
|
||||
|
@ -184,8 +184,19 @@ InstallTransaction::install( const ArgParser* parser,
|
||||
|
||||
InstallTransaction::InstallResult result;
|
||||
InstallInfo info( package->hasReadme() );
|
||||
if ( parser->isTest() ||
|
||||
(result = installPackage( package, parser, update, info )) == SUCCESS) {
|
||||
if ( parser->isTest() ) {
|
||||
info.preState = ( package->hasPreInstall() &&
|
||||
(parser->execPreInstall() || m_config->runScripts())
|
||||
) ? DEFERRED : NONEXISTENT;
|
||||
info.postState = ( package->hasPostInstall() &&
|
||||
(parser->execPostInstall() || m_config->runScripts())
|
||||
) ? DEFERRED : NONEXISTENT;
|
||||
m_installedPackages.push_back( make_pair(package->path()
|
||||
+ "/" + package->name(), info) );
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((result = installPackage( package, parser, update, info )) == SUCCESS) {
|
||||
|
||||
m_installedPackages.push_back( make_pair( package->path()
|
||||
+ "/" + package->name(), info));
|
||||
@ -315,8 +326,7 @@ InstallTransaction::installPackage( const Package* package,
|
||||
if ((parser->execPreInstall() || m_config->runScripts()) &&
|
||||
stat((parser->installRoot() + pkgdir + "/" + "pre-install").c_str(),
|
||||
&statData) == 0) {
|
||||
Process preProc( runscriptCommand, parser->installRoot() + pkgdir
|
||||
+ "/" + "pre-install", fdlog );
|
||||
Process preProc( runscriptCommand, pkgdir + "/" + "pre-install", fdlog );
|
||||
if (preProc.executeShell()) {
|
||||
info.preState = FAILED;
|
||||
} else {
|
||||
@ -425,8 +435,7 @@ InstallTransaction::installPackage( const Package* package,
|
||||
+ package->name() + "/" + "post-install").c_str(),
|
||||
&statData) == 0) {
|
||||
// Work around the pkgdir variable change
|
||||
Process postProc( runscriptCommand,
|
||||
parser->installRoot() + "/" + package->path() + "/"
|
||||
Process postProc( runscriptCommand, package->path() + "/"
|
||||
+ package->name() + "/post-install", fdlog );
|
||||
if (postProc.executeShell()) {
|
||||
info.postState = FAILED;
|
||||
|
@ -69,6 +69,7 @@ public:
|
||||
};
|
||||
|
||||
enum State {
|
||||
DEFERRED,
|
||||
EXEC_SUCCESS,
|
||||
FAILED,
|
||||
NONEXISTENT
|
||||
|
@ -289,8 +289,13 @@ void PrtGet::listShadowed()
|
||||
StringHelper::replaceAll(output, "%p2", p2->path() + "/" + p2->name());
|
||||
StringHelper::replaceAll(output, "%v1", p1->versionReleaseString());
|
||||
StringHelper::replaceAll(output, "%v2", p2->versionReleaseString());
|
||||
StringHelper::replaceAll(output, "%M1", p1->maintainer());
|
||||
StringHelper::replaceAll(output, "%M2", p2->maintainer());
|
||||
StringHelper::replaceAll(output, "%u1", p1->url());
|
||||
StringHelper::replaceAll(output, "%u2", p2->url());
|
||||
|
||||
StringHelper::replaceAll(output, "\\n", "\n");
|
||||
StringHelper::replaceAll(output, "\\t", "\t");
|
||||
cout << output;
|
||||
}
|
||||
}
|
||||
@ -1190,20 +1195,21 @@ void PrtGet::evaluateResult( InstallTransaction& transaction,
|
||||
|
||||
void PrtGet::reportPrePost(const InstallTransaction::InstallInfo& info) {
|
||||
if (info.preState != InstallTransaction::NONEXISTENT) {
|
||||
string preString = "failed";
|
||||
if (info.preState == InstallTransaction::EXEC_SUCCESS) {
|
||||
preString = "ok";
|
||||
string preString =
|
||||
(info.preState == InstallTransaction::FAILED) ? "failed" : "ok";
|
||||
if (info.preState == InstallTransaction::DEFERRED) {
|
||||
preString = "deferred";
|
||||
}
|
||||
cout << " [pre: " << preString << "]";
|
||||
}
|
||||
if ( info.postState != InstallTransaction::NONEXISTENT) {
|
||||
string postString = "failed";
|
||||
if (info.postState == InstallTransaction::EXEC_SUCCESS){
|
||||
postString = "ok";
|
||||
string postString =
|
||||
(info.postState == InstallTransaction::FAILED) ? "failed" : "ok";
|
||||
if (info.postState == InstallTransaction::DEFERRED) {
|
||||
postString = "deferred";
|
||||
}
|
||||
cout << " [post: " << postString << "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*! create a cache */
|
||||
|
Loading…
Reference in New Issue
Block a user