Fixed installing rpms with epoch (bnc #404048)
authorJán Kupec <jkupec@suse.cz>
Mon, 27 Jul 2009 14:45:42 +0000 (16:45 +0200)
committerJán Kupec <jkupec@suse.cz>
Mon, 27 Jul 2009 14:45:42 +0000 (16:45 +0200)
src/Zypper.cc
src/install.cc

index 31ae08e..7fef72d 100644 (file)
@@ -3138,6 +3138,7 @@ void Zypper::doCommand()
             {
               string nvrcap =
                 header->tag_name() + "=" +
+                str::numstring(header->tag_epoch()) + ":" +
                 header->tag_version() + "-" +
                 header->tag_release();
               DBG << "rpm package capability: " << nvrcap << endl;
index d63cd6d..c6978a4 100755 (executable)
@@ -554,16 +554,26 @@ void install_remove(Zypper & zypper,
     string::size_type pos;
 
     // force repository specified by prefixing 'repo:' to the package name
+    //! \todo FIXME this causes problems when requesting symbols containing
+    //! ':', like perl(Foo::Bar) or package with specified epoch.
+    //! Maybe we should drop or introduce another
+    //! way to enforce repo per package.
     if (!force_by_capability &&
-        //! \todo FIXME this causes problems when requesting symbols containing
-        //! ':', like perl(Foo::Bar). Maybe we should drop or introduce another
-        //! way to enforce repo per package.
         (pos = str.rfind(':')) != string::npos &&
         !(str.find("perl(") == 0)) // bnc #433679
     {
       repo = str.substr(0, pos);
-      str = str.substr(pos + 1);
-      force_by_name = true; // until there is a solver API for this
+      if (match_repo(zypper, repo, &RepoInfo()))
+      {
+        str = str.substr(pos + 1);
+        force_by_name = true; //! \todo until there is a solver API for this
+        DBG << "will install " << str << " from repo " << repo << endl;
+      }
+      // not a repo, continue as usual
+      else
+      {
+        repo.clear();
+      }
     }
 
     // force arch with '.'
@@ -589,6 +599,7 @@ void install_remove(Zypper & zypper,
       {
         DBG << "Unknown arch (" << arch << ") in package " << str
             << ", will treat it like part of the name" << endl;
+        arch.clear();
         /*
         zypper.out().error(
             str::form(_("Unknown architecture '%s'"), arch.c_str()),