diff --git a/doc/prt-get.8 b/doc/prt-get.8 index 30d3d93..a19243b 100644 --- a/doc/prt-get.8 +++ b/doc/prt-get.8 @@ -85,6 +85,11 @@ from any directory install all packages in the listed order including their dependencies. Note that outdated packages won't be updated. +.TP +.B depupdate [\-\-margs] [\-\-aargs] [\-\-log] [ ...] +update all packages in the listed order including their missing +dependencies. + .TP .B grpinst [\-\-margs] [\-\-aargs] [\-\-log] [ ...] install all packages in the listed order, but stop if installation of diff --git a/misc/prt-get_complete b/misc/prt-get_complete index 57dfc01..ec256b7 100644 --- a/misc/prt-get_complete +++ b/misc/prt-get_complete @@ -14,7 +14,7 @@ _prt-get() if [ $COMP_CWORD -eq 1 ]; then COMPREPLY=( $( compgen -W ' \ - install depinst update grpinst help \ + install depinst update depupdate grpinst help \ version readme list info path \ search dsearch fsearch printf cache \ dependent sysup current lock unlock \ @@ -28,7 +28,7 @@ _prt-get() if [[ "$cur" != -* ]]; then case ${COMP_WORDS[1]} in "install" | "depinst" | "grpinst" | "path" | "dependent" | \ - "depends" | "quickdep" | "info" | "readme" | \ + "depends" | "quickdep" | "info" | "readme" | "depupdate" | \ "ls" | "isinst" | "deptree" ) if [ -f /var/lib/pkg/prt-get.cache ]; then plist=`prt-cache list` diff --git a/src/argparser.cpp b/src/argparser.cpp index b971212..30907ac 100644 --- a/src/argparser.cpp +++ b/src/argparser.cpp @@ -122,11 +122,12 @@ const string& ArgParser::alternateConfigFile() const */ bool ArgParser::parse() { - const int commandCount = 35; + const int commandCount = 36; string commands[commandCount] = { "list", "search", "dsearch", "info", "depends", "install", "depinst", "help", "isinst", "dup", "update", + "depupdate", "quickdep", "diff", "quickdiff", "grpinst", "version", "cache", "path", "listinst", "printf", "readme", @@ -138,7 +139,7 @@ bool ArgParser::parse() Type commandID[commandCount] = { LIST, SEARCH, DSEARCH, INFO, DEPENDS, INSTALL, DEPINST, - HELP, ISINST, DUP, UPDATE, + HELP, ISINST, DUP, UPDATE, DEPUPDATE, QUICKDEP, DIFF, QUICKDIFF, GRPINST, SHOW_VERSION, CREATE_CACHE, PATH, LISTINST, PRINTF, README, diff --git a/src/argparser.h b/src/argparser.h index c24e7bd..799196d 100644 --- a/src/argparser.h +++ b/src/argparser.h @@ -31,7 +31,7 @@ public: /*! Command type */ enum Type { HELP, LIST, SEARCH, DSEARCH, INSTALL, DEPINST, - INFO, DEPENDS, ISINST, DUP, UPDATE, + INFO, DEPENDS, ISINST, DUP, UPDATE, DEPUPDATE, QUICKDEP, DIFF, GRPINST, GRPUPDATE, QUICKDIFF, SHOW_VERSION, CREATE_CACHE, PATH, LISTINST, PRINTF, README, DEPENDENT, SYSUP, diff --git a/src/main.cpp b/src/main.cpp index d3eb097..ebb6955 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -101,6 +101,9 @@ int main( int argc, char** argv ) case ArgParser::UPDATE: prtGet.install( true ); break; + case ArgParser::DEPUPDATE: + prtGet.install(true, true, true); + break; case ArgParser::DIFF: prtGet.printDiff(); break; diff --git a/src/prtget.cpp b/src/prtget.cpp index 3d9863f..4ea1e42 100644 --- a/src/prtget.cpp +++ b/src/prtget.cpp @@ -165,13 +165,15 @@ void PrtGet::printUsage() << "'pattern'" << endl; cout << "\nINSTALL, UPDATE and REMOVAL" << endl; - cout << " install [opt] install ports" << endl; - cout << " update [opt] update ports" << endl; - cout << " grpinst [opt] install ports, stop on error" + cout << " install [opt] install ports" << endl; + cout << " update [opt] update ports" << endl; + cout << " grpinst [opt] install ports, stop on error" << endl; - cout << " depinst [opt] install ports and their dependencies" + cout << " depinst [opt] install ports and their dependencies" << endl; - cout << " remove [opt] remove ports" + cout << " depupdate [opt] update ports and install missing dependencies" + << endl; + cout << " remove [opt] remove ports" << endl; cout << " where opt can be:" << endl; cout << " -f, -fi force installation" << endl; @@ -644,9 +646,21 @@ void PrtGet::install( bool update, bool group, bool dependencies ) deps.push_back(*it); } } - - InstallTransaction transaction( deps, m_repo, m_pkgDB, m_config ); - executeTransaction( transaction, update, group ); + // update + dependencies == depupdate + if ( update ) { + // install missing deps + if (deps.size() > 0) { + InstallTransaction installTransaction( deps, m_repo, m_pkgDB, m_config); + executeTransaction( installTransaction, false, group ); + } + // update port + InstallTransaction updateTransaction( m_parser->otherArgs(), + m_repo, m_pkgDB, m_config ); + executeTransaction( updateTransaction, update, group ); + } else { + InstallTransaction transaction( deps, m_repo, m_pkgDB, m_config ); + executeTransaction( transaction, update, group ); + } } else { InstallTransaction transaction( m_parser->otherArgs(), m_repo, m_pkgDB, m_config );