From db61549ca68b231610e885a234de415464796ede Mon Sep 17 00:00:00 2001 From: Jan Kupec Date: Mon, 6 Aug 2007 16:10:40 +0000 Subject: [PATCH] - changed zypper source-install to take more arguments at once --- doc/zypper.8 | 6 ++--- src/zypper-misc.cc | 64 +++++++++++++++++++++++++++++------------------------- src/zypper.cc | 4 ++-- 3 files changed, 39 insertions(+), 35 deletions(-) diff --git a/doc/zypper.8 b/doc/zypper.8 index 3ed601f..0286ef0 100644 --- a/doc/zypper.8 +++ b/doc/zypper.8 @@ -77,10 +77,10 @@ directory to your bug report. To use this option, simply add it to the problemat install or remove command. .TP -.B source-install (si) -Install a source package specified by its name. +.B source-install (si) ... +Install source packages specified by their names. -This command will try to find the newest available version of the source package and use rpm -i to install it. +This command will try to find the newest available versions of the source packages and use rpm -i to install them. .TP .B list-updates (lu) [options] diff --git a/src/zypper-misc.cc b/src/zypper-misc.cc index a158189..d504c1c 100644 --- a/src/zypper-misc.cc +++ b/src/zypper-misc.cc @@ -1304,43 +1304,47 @@ int source_install(std::vector & arguments) * 4. install the source package with ZYpp->installSrcPackage(SrcPackage::constPtr); */ - SrcPackage::Ptr srcpkg; - - gData.repo_resolvables.forEach( - functor::chain( - resfilter::ByName(arguments[0]), - resfilter::ByKind(ResTraits::kind)), - FindSrcPackage(srcpkg)); - - if (srcpkg) + int ret = ZYPPER_EXIT_OK; + + for (vector::const_iterator it = arguments.begin(); + it != arguments.end(); ++it) { - cout << format(_("Installing source package %s-%s")) - % srcpkg->name() % srcpkg->edition() << endl; - MIL << "Going to install srcpackage: " << srcpkg << endl; - - try - { - God->installSrcPackage(srcpkg); - - cout << format(_("Source package %s-%s successfully installed.")) - % srcpkg->name() % srcpkg->edition() << endl; + SrcPackage::Ptr srcpkg; - return ZYPPER_EXIT_OK; - } - catch (const Exception & ex) + gData.repo_resolvables.forEach( + functor::chain( + resfilter::ByName(*it), + resfilter::ByKind(ResTraits::kind)), + FindSrcPackage(srcpkg)); + + if (srcpkg) { - ZYPP_CAUGHT(ex); - cerr << format(_("Problem installing source package %s-%s:")) + cout << format(_("Installing source package %s-%s")) % srcpkg->name() % srcpkg->edition() << endl; - cerr << ex.asUserString() << endl; - - return ZYPPER_EXIT_ERR_ZYPP; + MIL << "Going to install srcpackage: " << srcpkg << endl; + + try + { + God->installSrcPackage(srcpkg); + + cout << format(_("Source package %s-%s successfully installed.")) + % srcpkg->name() % srcpkg->edition() << endl; + } + catch (const Exception & ex) + { + ZYPP_CAUGHT(ex); + cerr << format(_("Problem installing source package %s-%s:")) + % srcpkg->name() % srcpkg->edition() << endl; + cerr << ex.asUserString() << endl; + + ret = ZYPPER_EXIT_ERR_ZYPP; + } } + else + cerr << format(_("Source package '%s' not found.")) % (*it) << endl; } - else - cerr << format(_("Source package '%s' not found.")) % arguments[0] << endl; - return ZYPPER_EXIT_OK; + return ret; } // Local Variables: diff --git a/src/zypper.cc b/src/zypper.cc index 04c8ad6..90be891 100644 --- a/src/zypper.cc +++ b/src/zypper.cc @@ -329,9 +329,9 @@ int one_command(const ZypperCommand & command, int argc, char **argv) }; specific_options = src_install_options; specific_help = _( - "source-install (si) \n" + "source-install (si) ...\n" "\n" - "Install a source package specified by its name.\n" + "Install source packages specified by their names.\n" "\n" "This command has no additional options.\n" ); -- 2.7.4