- changed zypper source-install to take more arguments at once
authorJan Kupec <jkupec@suse.cz>
Mon, 6 Aug 2007 16:10:40 +0000 (16:10 +0000)
committerJan Kupec <jkupec@suse.cz>
Mon, 6 Aug 2007 16:10:40 +0000 (16:10 +0000)
doc/zypper.8
src/zypper-misc.cc
src/zypper.cc

index 3ed601f..0286ef0 100644 (file)
@@ -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) <name>
-Install a source package specified by its name.
+.B source-install (si) <name> ...
+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]
index a158189..d504c1c 100644 (file)
@@ -1304,43 +1304,47 @@ int source_install(std::vector<std::string> & 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<SrcPackage>::kind)),
-      FindSrcPackage(srcpkg));
-
-  if (srcpkg)
+  int ret = ZYPPER_EXIT_OK;
+  
+  for (vector<string>::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<SrcPackage>::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:
index 04c8ad6..90be891 100644 (file)
@@ -329,9 +329,9 @@ int one_command(const ZypperCommand & command, int argc, char **argv)
     };
     specific_options = src_install_options;
     specific_help = _(
-      "source-install (si) <name>\n"
+      "source-install (si) <name> ...\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"
     );