- force installation by capability if name.arch is specified
authorJan Kupec <jkupec@suse.cz>
Mon, 27 Oct 2008 14:16:04 +0000 (14:16 +0000)
committerJan Kupec <jkupec@suse.cz>
Mon, 27 Oct 2008 14:16:04 +0000 (14:16 +0000)
  (bnc #305445)
- complain if installing by --name and arch is specified

doc/zypper.8
src/Zypper.cc
src/install.cc

index 3204089..dd07d5f 100644 (file)
@@ -158,8 +158,9 @@ Install or update packages.
 
 The packages can be selected by their name or by a capability they provide.
 
-Capability is: NAME, or "NAME[OP<EDITION>]", where OP is <, <=, =, >=, or > and
-EDITION is VERSION[-RELEASE], for example: zypper=0.8.8-2.
+Capability is: NAME, or "NAME[.ARCH][OP<EDITION>]", where ARCH is architecture
+code, OP is <, <=, =, >=, or > and EDITION is VERSION[-RELEASE].
+For example: zypper=0.8.8-2.
 
 The NAME component of a capability is not only a package name but any symbol
 provided by packages: /bin/vi, libcurl.so.3, perl(Time::ParseDate).
@@ -170,6 +171,11 @@ If EDITION is not specified, the newest installable version will be installed.
 This also means that if the package is already installed and newer versions
 are available, it will get upgraded to the newest installable version.
 
+If ARCH is not specified, or the last dot of the capability name string is not
+followed by known architecture, the solver will treat the whole string
+as a capability name. If the ARCH is know, the solver will try to choose
+a package with the best compatible architecture to the one specified.
+
 Zypper is also able to install plain RPM files while trying to satisfy their
 dependencies using packages from defined repositories. You can install a plain
 RPM file by specifying its location in the install command arguments either
index 656a447..072e501 100644 (file)
@@ -876,6 +876,8 @@ void Zypper::processCommandOptions()
     _command_help = str::form(_(
       // TranslatorExplanation the first %s = "package, patch, pattern, product"
       //  and the second %s = "package"
+      //! \todo A capability is NAME[.ARCH][OP<VERSION>] now,
+      //!  the help text will be changed after release
       "install (in) [options] <capability|rpm_file_uri> ...\n"
       "\n"
       "Install packages with specified capabilities or RPM files with"
index 2f4f9ba..37b8f80 100755 (executable)
@@ -511,12 +511,34 @@ void install_remove(Zypper & zypper,
     if ((pos = str.rfind('.')) != string::npos)
     {
       arch = str.substr(pos + 1);
-      str = str.substr(0, pos);
+      //str = str.substr(0, pos);
       if (Arch(arch).isBuiltIn())
-         force_by_name = true; // until there is a solver API for this
+      {
+        if (force_by_name)
+        {
+          zypper.out().error(
+            _("Specifying architecture when selecting packages by name"
+              " is not implemented."));
+          zypper.setExitCode(ZYPPER_EXIT_ERR_INVALID_ARGS);
+          throw ExitRequestException();
+        }
+
+        // name.arch is a valid capability since libzypp-4.15.0 (bnc #305445)
+        by_capability = true;
+      }
       else
+      {
         DBG << "Unknown arch (" << arch << ") in package " << str
-          << ", will treat it like capability name." << endl;
+            << ", will treat it like part of the name" << endl;
+        /*
+        zypper.out().error(
+            str::form(_("Unknown architecture '%s'"), arch.c_str()),
+            _("When selecting packages by name, the last dot character must be followed\n"
+              "by a valid architecture code."));
+        zypper.setExitCode(ZYPPER_EXIT_ERR_INVALID_ARGS);
+        throw ExitRequestException();
+        */
+      }
     }
 
     // mark by name by force