diff --git a/doc/prt-get.8 b/doc/prt-get.8 index 6149da3..cb5167e 100644 --- a/doc/prt-get.8 +++ b/doc/prt-get.8 @@ -76,7 +76,7 @@ non-option argument passed. This is very similar to .TP .B install [\-\-margs] [\-\-aargs] [\-\-log] [\-\-nodeps] [\-\-softdeps] [ ...] -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 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 @@ -98,7 +98,7 @@ file). .TP .B remove [ ...] -remove packages listed in this order +Remove packages listed in this order .TP .B sysup [\-\-softdeps] [\-\-nodeps] @@ -142,7 +142,7 @@ switch will slow down the operation remarkably. .TP .B diff [\-\-all] [\-\-prefer\-higher] [ ...] -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 @@ -154,7 +154,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). @@ -202,14 +202,14 @@ 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 +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. .TP .B quickdep [\-\-softdeps] [ ...] -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. 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 @@ -226,7 +226,7 @@ for successful builds. .TP .B deptree [\-\-softdeps] -print a tree of the dependencies of the package +Print a tree of the dependencies of the package .B . Pass the --softdeps flag to also show the installed packages that mention .B @@ -238,12 +238,12 @@ order to show them all, add the --all switch. .TP .B dependent [\-\-softdeps] -print a list of ports which have +Print a list of ports which have .B in their "Depends on:" line. Use the --softdeps flag to also search the "Optional:" lines for \fB\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 (without duplication), and --tree to get a nicely indented one. @@ -316,7 +316,7 @@ are replaced like this: .TP \ \ \ \(bu -%P -> optional dependencies +%P \-> optional dependencies .TP \ \ \ \(bu @@ -324,23 +324,23 @@ are replaced like this: .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 @@ -400,11 +400,11 @@ that is not installed. .TP .B ls [\-\-path] -Prints out a listing of the port's directory +Print out a listing of the port's directory .TP .B cat [] -Prints out the file to stdout. If is not specified, 'Pkgfile' is used. +Print out the file to stdout. If is not specified, 'Pkgfile' is used. If set, uses $PAGER. .TP @@ -415,7 +415,7 @@ If is not specified, 'Pkgfile' is used. .TP .B help -Shows a help screen +Show a help screen .TP .B dumpconfig @@ -423,11 +423,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. @@ -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 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. + 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 diff --git a/src/configuration.cpp b/src/configuration.cpp index 5e814db..c4a7b12 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -150,10 +150,10 @@ void Configuration::parseLine(const string& line, bool prepend) } else if ( startsWithNoCase( s, "writelog" ) ) { s = stripWhiteSpace( s.replace( 0, 8, "" ) ); 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; - } + } else if ( s == "disabled" ) { + m_writeLog = false; + } } else if ( startsWithNoCase( s, "logfile" ) ) { s = stripWhiteSpace( s.replace( 0, 7, "" ) ); m_logFilePattern = s; @@ -166,7 +166,9 @@ void Configuration::parseLine(const string& line, bool prepend) s = stripWhiteSpace( s.replace( 0, 16, "" ) ); if ( s == "yes" ) { m_removeLogOnSuccess = true; - } + } else if ( s == "no" ) { + m_removeLogOnSuccess = false; + } } else if ( startsWithNoCase( s, "readme" ) ) { s = stripWhiteSpace( s.replace( 0, 6, "" ) ); if ( s == "compact" ) { @@ -178,23 +180,28 @@ void Configuration::parseLine(const string& line, bool prepend) s = stripWhiteSpace( s.replace( 0, 10, "" ) ); if ( s == "yes" ) { m_runScripts = true; + } else if ( s == "no" ) { + m_runScripts = false; } } else if ( startsWithNoCase( s, "preferhigher" ) ) { s = stripWhiteSpace( s.replace( 0, 12, "" ) ); if ( s == "yes" ) { m_preferHigher = true; - } + } else if ( s == "no" ) { + m_preferHigher = false; + } } else if ( startsWithNoCase( s, "useregex" ) ) { s = stripWhiteSpace( s.replace( 0, 8, "" ) ); if ( s == "yes" ) { m_useRegex = true; - } + } else if ( s == "no" ) { + m_useRegex = false; + } } else if ( startsWithNoCase( s, "softdeps" ) ) { s = stripWhiteSpace( s.replace( 0, 8, "" ) ); if ( s == "yes" ) { m_followSoftdeps = true; - } - if ( s == "no" ) { + } else if ( s == "no" ) { m_followSoftdeps = false; } } else if ( startsWithNoCase( s, "makecommand" ) ) { diff --git a/src/installtransaction.cpp b/src/installtransaction.cpp index 21107e9..c5df06a 100644 --- a/src/installtransaction.cpp +++ b/src/installtransaction.cpp @@ -172,7 +172,7 @@ InstallTransaction::install( const ArgParser* parser ) if ( parser->isTest() || (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 { // log failures and pkgdest errors are critical, @@ -185,7 +185,7 @@ InstallTransaction::install( const ArgParser* parser ) 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() ) { return PKGMK_FAILURE; } @@ -284,10 +284,14 @@ const { string portdir = package->path() + "/" + package->name(); chdir( portdir.c_str() ); - string runscriptCommand = "sh"; + string runscriptCommand = "/bin/sh"; if (m_config->runscriptCommand() != "") { runscriptCommand = m_config->runscriptCommand(); } + if (parser->installRoot() != "") { + runscriptCommand = "chroot " + parser->installRoot() + " " + + runscriptCommand; + } // -- pre-install struct stat statData; struct stat fstatData; diff --git a/src/prtget.cpp b/src/prtget.cpp index 30d6038..b43e5a6 100644 --- a/src/prtget.cpp +++ b/src/prtget.cpp @@ -986,15 +986,13 @@ void PrtGet::evaluateResult( InstallTransaction& transaction, bool atLeastOnePackageHasReadme = false; for ( ; iit != inst.end(); ++iit ) { - if (m_parser->printPath()) { - // TODO: avoid lookup by tuning - // InstallTransaction::installedPackages() - const Package* p = m_repo->getPackage(iit->first); - if (p) { - cout << p->path() << "/"; - } + size_t pos = (iit->first).find_last_of('/'); + if ( m_parser->printPath() || (pos == string::npos) + || (pos+2 > (iit->first).length()) ) { + cout << iit->first; + } else { + cout << (iit->first).substr(pos+1); } - cout << iit->first; if ( iit->second.hasReadme ) { if ( m_config->readmeMode() == Configuration::COMPACT_README ) { @@ -1013,8 +1011,11 @@ void PrtGet::evaluateResult( InstallTransaction& transaction, << " Successful packages with README files:" << endl; iit = inst.begin(); for ( ; iit != inst.end(); ++iit ) { + size_t pos = (iit->first).find_last_of('/'); if ( iit->second.hasReadme ) { - cout << iit->first; + (pos != string::npos && pos+1 < (iit->first).length()) ? + cout << (iit->first).substr(pos+1) : + cout << iit->first; cout << endl; } } @@ -1696,7 +1697,7 @@ void PrtGet::printDepTree() { m_returnValue = PG_GENERAL_ERROR; return; } else if (reverse) { - depTreeHeader = "Packages that need " + p->name(); + depTreeHeader = "Packages that depend on " + p->name(); } if ( !m_followSoftdeps ) { @@ -1805,28 +1806,26 @@ void PrtGet::printDepsLevel(int level, const Package* package, } } } - } else { + } else if ( level==0 || m_parser->recursive() ) { list dependent; list eagerlyLinked; m_repo->getDependentPackages(package->name(), dependent, false); if ( m_followSoftdeps ) { m_repo->getDependentPackages(package->name(), eagerlyLinked, true); } - if ( level==0 || m_parser->recursive() ) { - list::iterator it = dependent.begin(); - for (; it != dependent.end(); ++it) { + list::iterator it = dependent.begin(); + for (; it != dependent.end(); ++it) { if ( m_parser->all() || m_pkgDB->isInstalled((*it)->name(), false) ) { printDepsLevel( level+2, *it, greedy ); } - } - list::iterator il = eagerlyLinked.begin(); - for (; il != eagerlyLinked.end(); ++il) { + } + list::iterator il = eagerlyLinked.begin(); + for (; il != eagerlyLinked.end(); ++il) { if ( m_parser->all() || m_pkgDB->isInstalled((*il)->name(), false) ) { printDepsLevel( level+2, *il, true ); } - } } }