respect --install-root when running pre- and post-install scripts
This commit is contained in:
parent
f2c0f370d4
commit
6e4a4d8daa
@ -76,7 +76,7 @@ non-option argument passed. This is very similar to
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B install [\-\-margs] [\-\-aargs] [\-\-log] [\-\-nodeps] [\-\-softdeps] <package1> [<package2> ...]
|
.B install [\-\-margs] [\-\-aargs] [\-\-log] [\-\-nodeps] [\-\-softdeps] <package1> [<package2> ...]
|
||||||
install or update the packages given on the command line. Note that you can do
|
Install or update the packages given on the command line. Note that you can do
|
||||||
this from any directory. Pass the --nodeps flag to prevent \fBprt\-get\fP from
|
this from any directory. Pass the --nodeps flag to prevent \fBprt\-get\fP from
|
||||||
resolving dependencies and injecting any needed ports into the list of targets.
|
resolving dependencies and injecting any needed ports into the list of targets.
|
||||||
Pass the --softdeps flag if you want the dependency resolver to also consider
|
Pass the --softdeps flag if you want the dependency resolver to also consider
|
||||||
@ -98,7 +98,7 @@ file).
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B remove <package1> [<package2> ...]
|
.B remove <package1> [<package2> ...]
|
||||||
remove packages listed in this order
|
Remove packages listed in this order
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B sysup [\-\-softdeps] [\-\-nodeps]
|
.B sysup [\-\-softdeps] [\-\-nodeps]
|
||||||
@ -142,7 +142,7 @@ switch will slow down the operation remarkably.
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B diff [\-\-all] [\-\-prefer\-higher] [<package1> <package2> ...]
|
.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
|
tree. If arguments are given, shows only differences for these
|
||||||
packages, otherwise all differences are shown. It's also possible to use
|
packages, otherwise all differences are shown. It's also possible to use
|
||||||
shell-like
|
shell-like
|
||||||
@ -154,7 +154,7 @@ the ports tree, use the --prefer-higher option.
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B quickdiff
|
.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,
|
ports tree than what is installed. The output is sorted alphabetically,
|
||||||
but you can generate a (larger) list sorted by dependencies using
|
but you can generate a (larger) list sorted by dependencies using
|
||||||
.B prt\-get quickdep $(prt\-get quickdiff).
|
.B prt\-get quickdep $(prt\-get quickdiff).
|
||||||
@ -202,14 +202,14 @@ Print the port's README file if it exists; if set, uses $PAGER
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B depends [\-\-softdeps] <package1> [<package2> ...]
|
.B depends [\-\-softdeps] <package1> [<package2> ...]
|
||||||
print a recursive list of dependencies needed to install the packages passed
|
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,
|
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
|
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.
|
if you want the sorting algorithm to consider optional dependencies too.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B quickdep [\-\-softdeps] <package1> [<package2> ...]
|
.B quickdep [\-\-softdeps] <package1> [<package2> ...]
|
||||||
same output as \fBdepends\fP, but separated by spaces rather than newlines, and
|
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.
|
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
|
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 targets for
|
if you don't want to filter out manually the ports that are invalid targets for
|
||||||
@ -226,7 +226,7 @@ for successful builds.
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B deptree [\-\-softdeps] <package>
|
.B deptree [\-\-softdeps] <package>
|
||||||
print a tree of the dependencies of the package
|
Print a tree of the dependencies of the package
|
||||||
.B <package>.
|
.B <package>.
|
||||||
Pass the --softdeps flag to also show the installed packages that mention
|
Pass the --softdeps flag to also show the installed packages that mention
|
||||||
.B <package>
|
.B <package>
|
||||||
@ -238,12 +238,12 @@ order to show them all, add the --all switch.
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B dependent [\-\-softdeps] <package>
|
.B dependent [\-\-softdeps] <package>
|
||||||
print a list of ports which have
|
Print a list of ports which have
|
||||||
.B <package>
|
.B <package>
|
||||||
in their "Depends on:" line. Use the --softdeps flag to also search the
|
in their "Depends on:" line. Use the --softdeps flag to also search the
|
||||||
"Optional:" lines for \fB<package>\fP.
|
"Optional:" lines for \fB<package>\fP.
|
||||||
|
|
||||||
By default, output is restricted to ports that are installed. To see all hard
|
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
|
dependencies, add the --all switch; use --recursive to get a recursive list
|
||||||
(without duplication), and --tree to get a nicely indented one.
|
(without duplication), and --tree to get a nicely indented one.
|
||||||
|
|
||||||
@ -316,7 +316,7 @@ are replaced like this:
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
\ \ \ \(bu
|
\ \ \ \(bu
|
||||||
%P -> optional dependencies
|
%P \-> optional dependencies
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\ \ \ \(bu
|
\ \ \ \(bu
|
||||||
@ -324,23 +324,23 @@ are replaced like this:
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
\ \ \ \(bu
|
\ \ \ \(bu
|
||||||
%M -> Maintainer
|
%M \-> Maintainer
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\ \ \ \(bu
|
\ \ \ \(bu
|
||||||
%R -> Readme ("yes"/"no")
|
%R \-> Readme ("yes"/"no")
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\ \ \ \(bu
|
\ \ \ \(bu
|
||||||
%E -> pre-install script ("yes"/"no")
|
%E \-> pre-install script ("yes"/"no")
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\ \ \ \(bu
|
\ \ \ \(bu
|
||||||
%O -> post-install script ("yes"/"no")
|
%O \-> post-install script ("yes"/"no")
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\ \ \ \(bu
|
\ \ \ \(bu
|
||||||
%l -> is locked ("yes"/"no")
|
%l \-> is locked ("yes"/"no")
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\ \ \ \(bu
|
\ \ \ \(bu
|
||||||
@ -400,11 +400,11 @@ that <package> is not installed.
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B ls [\-\-path] <package>
|
.B ls [\-\-path] <package>
|
||||||
Prints out a listing of the port's directory
|
Print out a listing of the port's directory
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B cat <package> [<file>]
|
.B cat <package> [<file>]
|
||||||
Prints out the file to stdout. If <file> is not specified, 'Pkgfile' is used.
|
Print out the file to stdout. If <file> is not specified, 'Pkgfile' is used.
|
||||||
If set, uses $PAGER.
|
If set, uses $PAGER.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
@ -415,7 +415,7 @@ If <file> is not specified, 'Pkgfile' is used.
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B help
|
.B help
|
||||||
Shows a help screen
|
Show a help screen
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B dumpconfig
|
.B dumpconfig
|
||||||
@ -423,11 +423,11 @@ Dump the configuration to the current terminal
|
|||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B version
|
.B version
|
||||||
Shows the current version of prt-get
|
Show the current version of prt-get
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.B cache
|
.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
|
--cache option. Remember to run prt-get cache each time you update the
|
||||||
ports tree.
|
ports tree.
|
||||||
|
|
||||||
@ -528,6 +528,15 @@ the requested packages onto a different directory than '/'. In daily usage,
|
|||||||
this option is not required; it's primarily interesting if you're developing
|
this option is not required; it's primarily interesting if you're developing
|
||||||
an independent installation.
|
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 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.
|
||||||
|
|
||||||
The setting for --install-root determines which package database is used for
|
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
|
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
|
archives get unpacked, but the relevant prt\-get.conf and ports tree are those
|
||||||
|
@ -150,9 +150,9 @@ void Configuration::parseLine(const string& line, bool prepend)
|
|||||||
} else if ( startsWithNoCase( s, "writelog" ) ) {
|
} else if ( startsWithNoCase( s, "writelog" ) ) {
|
||||||
s = stripWhiteSpace( s.replace( 0, 8, "" ) );
|
s = stripWhiteSpace( s.replace( 0, 8, "" ) );
|
||||||
if ( s == "enabled" ) {
|
if ( s == "enabled" ) {
|
||||||
// it's already set to false, so we can just enable it.
|
|
||||||
// like this, the command line switch works as well
|
|
||||||
m_writeLog = true;
|
m_writeLog = true;
|
||||||
|
} else if ( s == "disabled" ) {
|
||||||
|
m_writeLog = false;
|
||||||
}
|
}
|
||||||
} else if ( startsWithNoCase( s, "logfile" ) ) {
|
} else if ( startsWithNoCase( s, "logfile" ) ) {
|
||||||
s = stripWhiteSpace( s.replace( 0, 7, "" ) );
|
s = stripWhiteSpace( s.replace( 0, 7, "" ) );
|
||||||
@ -166,6 +166,8 @@ void Configuration::parseLine(const string& line, bool prepend)
|
|||||||
s = stripWhiteSpace( s.replace( 0, 16, "" ) );
|
s = stripWhiteSpace( s.replace( 0, 16, "" ) );
|
||||||
if ( s == "yes" ) {
|
if ( s == "yes" ) {
|
||||||
m_removeLogOnSuccess = true;
|
m_removeLogOnSuccess = true;
|
||||||
|
} else if ( s == "no" ) {
|
||||||
|
m_removeLogOnSuccess = false;
|
||||||
}
|
}
|
||||||
} else if ( startsWithNoCase( s, "readme" ) ) {
|
} else if ( startsWithNoCase( s, "readme" ) ) {
|
||||||
s = stripWhiteSpace( s.replace( 0, 6, "" ) );
|
s = stripWhiteSpace( s.replace( 0, 6, "" ) );
|
||||||
@ -178,23 +180,28 @@ void Configuration::parseLine(const string& line, bool prepend)
|
|||||||
s = stripWhiteSpace( s.replace( 0, 10, "" ) );
|
s = stripWhiteSpace( s.replace( 0, 10, "" ) );
|
||||||
if ( s == "yes" ) {
|
if ( s == "yes" ) {
|
||||||
m_runScripts = true;
|
m_runScripts = true;
|
||||||
|
} else if ( s == "no" ) {
|
||||||
|
m_runScripts = false;
|
||||||
}
|
}
|
||||||
} else if ( startsWithNoCase( s, "preferhigher" ) ) {
|
} else if ( startsWithNoCase( s, "preferhigher" ) ) {
|
||||||
s = stripWhiteSpace( s.replace( 0, 12, "" ) );
|
s = stripWhiteSpace( s.replace( 0, 12, "" ) );
|
||||||
if ( s == "yes" ) {
|
if ( s == "yes" ) {
|
||||||
m_preferHigher = true;
|
m_preferHigher = true;
|
||||||
|
} else if ( s == "no" ) {
|
||||||
|
m_preferHigher = false;
|
||||||
}
|
}
|
||||||
} else if ( startsWithNoCase( s, "useregex" ) ) {
|
} else if ( startsWithNoCase( s, "useregex" ) ) {
|
||||||
s = stripWhiteSpace( s.replace( 0, 8, "" ) );
|
s = stripWhiteSpace( s.replace( 0, 8, "" ) );
|
||||||
if ( s == "yes" ) {
|
if ( s == "yes" ) {
|
||||||
m_useRegex = true;
|
m_useRegex = true;
|
||||||
|
} else if ( s == "no" ) {
|
||||||
|
m_useRegex = false;
|
||||||
}
|
}
|
||||||
} else if ( startsWithNoCase( s, "softdeps" ) ) {
|
} else if ( startsWithNoCase( s, "softdeps" ) ) {
|
||||||
s = stripWhiteSpace( s.replace( 0, 8, "" ) );
|
s = stripWhiteSpace( s.replace( 0, 8, "" ) );
|
||||||
if ( s == "yes" ) {
|
if ( s == "yes" ) {
|
||||||
m_followSoftdeps = true;
|
m_followSoftdeps = true;
|
||||||
}
|
} else if ( s == "no" ) {
|
||||||
if ( s == "no" ) {
|
|
||||||
m_followSoftdeps = false;
|
m_followSoftdeps = false;
|
||||||
}
|
}
|
||||||
} else if ( startsWithNoCase( s, "makecommand" ) ) {
|
} else if ( startsWithNoCase( s, "makecommand" ) ) {
|
||||||
|
@ -172,7 +172,7 @@ InstallTransaction::install( const ArgParser* parser )
|
|||||||
if ( parser->isTest() ||
|
if ( parser->isTest() ||
|
||||||
(result = installPackage( package, parser, update, info )) == SUCCESS) {
|
(result = installPackage( package, parser, update, info )) == SUCCESS) {
|
||||||
|
|
||||||
m_installedPackages.push_back( make_pair( package->name(), info));
|
m_installedPackages.push_back( make_pair( package->path() + "/" + package->name(), info));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// log failures and pkgdest errors are critical,
|
// log failures and pkgdest errors are critical,
|
||||||
@ -185,7 +185,7 @@ InstallTransaction::install( const ArgParser* parser )
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_installErrors.push_back( make_pair(package->name(), info) );
|
m_installErrors.push_back( make_pair(package->path() + "/" + package->name(), info) );
|
||||||
if ( parser->group() ) {
|
if ( parser->group() ) {
|
||||||
return PKGMK_FAILURE;
|
return PKGMK_FAILURE;
|
||||||
}
|
}
|
||||||
@ -284,10 +284,14 @@ const {
|
|||||||
string portdir = package->path() + "/" + package->name();
|
string portdir = package->path() + "/" + package->name();
|
||||||
chdir( portdir.c_str() );
|
chdir( portdir.c_str() );
|
||||||
|
|
||||||
string runscriptCommand = "sh";
|
string runscriptCommand = "/bin/sh";
|
||||||
if (m_config->runscriptCommand() != "") {
|
if (m_config->runscriptCommand() != "") {
|
||||||
runscriptCommand = m_config->runscriptCommand();
|
runscriptCommand = m_config->runscriptCommand();
|
||||||
}
|
}
|
||||||
|
if (parser->installRoot() != "") {
|
||||||
|
runscriptCommand = "chroot " + parser->installRoot() + " "
|
||||||
|
+ runscriptCommand;
|
||||||
|
}
|
||||||
|
|
||||||
// -- pre-install
|
// -- pre-install
|
||||||
struct stat statData; struct stat fstatData;
|
struct stat statData; struct stat fstatData;
|
||||||
|
@ -986,15 +986,13 @@ void PrtGet::evaluateResult( InstallTransaction& transaction,
|
|||||||
bool atLeastOnePackageHasReadme = false;
|
bool atLeastOnePackageHasReadme = false;
|
||||||
|
|
||||||
for ( ; iit != inst.end(); ++iit ) {
|
for ( ; iit != inst.end(); ++iit ) {
|
||||||
if (m_parser->printPath()) {
|
size_t pos = (iit->first).find_last_of('/');
|
||||||
// TODO: avoid lookup by tuning
|
if ( m_parser->printPath() || (pos == string::npos)
|
||||||
// InstallTransaction::installedPackages()
|
|| (pos+2 > (iit->first).length()) ) {
|
||||||
const Package* p = m_repo->getPackage(iit->first);
|
|
||||||
if (p) {
|
|
||||||
cout << p->path() << "/";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cout << iit->first;
|
cout << iit->first;
|
||||||
|
} else {
|
||||||
|
cout << (iit->first).substr(pos+1);
|
||||||
|
}
|
||||||
if ( iit->second.hasReadme ) {
|
if ( iit->second.hasReadme ) {
|
||||||
if ( m_config->readmeMode() ==
|
if ( m_config->readmeMode() ==
|
||||||
Configuration::COMPACT_README ) {
|
Configuration::COMPACT_README ) {
|
||||||
@ -1013,7 +1011,10 @@ void PrtGet::evaluateResult( InstallTransaction& transaction,
|
|||||||
<< " Successful packages with README files:" << endl;
|
<< " Successful packages with README files:" << endl;
|
||||||
iit = inst.begin();
|
iit = inst.begin();
|
||||||
for ( ; iit != inst.end(); ++iit ) {
|
for ( ; iit != inst.end(); ++iit ) {
|
||||||
|
size_t pos = (iit->first).find_last_of('/');
|
||||||
if ( iit->second.hasReadme ) {
|
if ( iit->second.hasReadme ) {
|
||||||
|
(pos != string::npos && pos+1 < (iit->first).length()) ?
|
||||||
|
cout << (iit->first).substr(pos+1) :
|
||||||
cout << iit->first;
|
cout << iit->first;
|
||||||
cout << endl;
|
cout << endl;
|
||||||
}
|
}
|
||||||
@ -1696,7 +1697,7 @@ void PrtGet::printDepTree() {
|
|||||||
m_returnValue = PG_GENERAL_ERROR;
|
m_returnValue = PG_GENERAL_ERROR;
|
||||||
return;
|
return;
|
||||||
} else if (reverse) {
|
} else if (reverse) {
|
||||||
depTreeHeader = "Packages that need " + p->name();
|
depTreeHeader = "Packages that depend on " + p->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !m_followSoftdeps ) {
|
if ( !m_followSoftdeps ) {
|
||||||
@ -1805,14 +1806,13 @@ void PrtGet::printDepsLevel(int level, const Package* package,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if ( level==0 || m_parser->recursive() ) {
|
||||||
list<Package*> dependent;
|
list<Package*> dependent;
|
||||||
list<Package*> eagerlyLinked;
|
list<Package*> eagerlyLinked;
|
||||||
m_repo->getDependentPackages(package->name(), dependent, false);
|
m_repo->getDependentPackages(package->name(), dependent, false);
|
||||||
if ( m_followSoftdeps ) {
|
if ( m_followSoftdeps ) {
|
||||||
m_repo->getDependentPackages(package->name(), eagerlyLinked, true);
|
m_repo->getDependentPackages(package->name(), eagerlyLinked, true);
|
||||||
}
|
}
|
||||||
if ( level==0 || m_parser->recursive() ) {
|
|
||||||
list<Package*>::iterator it = dependent.begin();
|
list<Package*>::iterator it = dependent.begin();
|
||||||
for (; it != dependent.end(); ++it) {
|
for (; it != dependent.end(); ++it) {
|
||||||
if ( m_parser->all()
|
if ( m_parser->all()
|
||||||
@ -1828,7 +1828,6 @@ void PrtGet::printDepsLevel(int level, const Package* package,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// reset the tree traversal history
|
// reset the tree traversal history
|
||||||
treeWalk.pop_back();
|
treeWalk.pop_back();
|
||||||
|
Loading…
Reference in New Issue
Block a user