Author: dmacvicar Date: Sun Feb 17 12:05:42 2008 New Revision: 8767 URL: http://svn.opensuse.org/viewcvs/zypp?rev=8767&view=rev Log: refactor srcinstall in two pieces Modified: trunk/zypper/src/zypper-misc.cc Modified: trunk/zypper/src/zypper-misc.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper-misc.cc?rev=8767&r1=8766&r2=8767&view=diff ============================================================================== --- trunk/zypper/src/zypper-misc.cc (original) +++ trunk/zypper/src/zypper-misc.cc Sun Feb 17 12:05:42 2008 @@ -1667,28 +1667,20 @@ return confirmed; } -int source_install(std::vectorstd::string & arguments) +SrcPackage::constPtr source_find( const string & arg ) { - /* + /* * Workflow: * - * 1. load repo resolvables (to gData.repo_resolvables) - * 2. interate all SrcPackage resolvables with specified name - * 3. find the latest version or version satisfying specification. - * 4. install the source package with ZYpp->installSrcPackage(SrcPackage::constPtr); + * 1. interate all SrcPackage resolvables with specified name + * 2. find the latest version or version satisfying specification. */ - - int ret = ZYPPER_EXIT_OK; - - for (vector<string>::const_iterator it = arguments.begin(); - it != arguments.end(); ++it) - { SrcPackage::constPtr srcpkg; ResPool pool(God->pool()); - cout_vv << "looking source for : " << *it << endl; - for_( srcit, pool.byIdentBegin<SrcPackage>(*it), - pool.byIdentEnd<SrcPackage>(*it) ) + cout_vv << "looking source for : " << arg << endl; + for_( srcit, pool.byIdentBegin<SrcPackage>(arg), + pool.byIdentEnd<SrcPackage>(arg) ) { cout_vv << *srcit << endl; if ( ! srcit->status().isInstalled() ) @@ -1710,6 +1702,24 @@ _srcpkg.swap(srcpkg); } } + return srcpkg; +} + +int source_install(std::vectorstd::string & arguments) +{ + /* + * Workflow: + * + * 1. find the latest version or version satisfying specification. + * 2. install the source package with ZYpp->installSrcPackage(SrcPackage::constPtr); + */ + + int ret = ZYPPER_EXIT_OK; + + for (vector<string>::const_iterator it = arguments.begin(); + it != arguments.end(); ++it) + { + SrcPackage::constPtr srcpkg = source_find(*it); if (srcpkg) { -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org