Added SourceManager::findSourceByUrl to overcome alias mismatches (#177543).
authorMartin Vidner <mvidner@suse.cz>
Mon, 22 May 2006 17:05:17 +0000 (17:05 +0000)
committerMartin Vidner <mvidner@suse.cz>
Mon, 22 May 2006 17:05:17 +0000 (17:05 +0000)
package/libzypp.changes
zypp/SourceManager.cc
zypp/SourceManager.h

index 0623650..60031dc 100644 (file)
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Mon May 22 19:03:20 CEST 2006 - mvidner@suse.cz
+
+- Added SourceManager::findSourceByUrl to overcome alias mismatches
+  (#177543).
+- rev 3420
+
+-------------------------------------------------------------------
 Mon May 22 17:19:25 CEST 2006 - ma@suse.de
 
 - Order all objects according to prerequirements, not just packages.
index 89bfe85..15d1c62 100644 (file)
@@ -463,15 +463,27 @@ namespace zypp
     {
        if (it->second.alias() == alias_r) {
            return it->second;
-           break;
        }
-
     }
     ZYPP_THROW(Exception("Unknown source name '"+alias_r+"'"));
     /*NOTREACHED*/
     return it->second; // just to keep gcc happy
   }
 
+  Source_Ref SourceManager::findSourceByUrl(const Url & url_r)
+  {
+    SourceMap::iterator it;
+    for (it = _sources.begin(); it != _sources.end(); ++it)
+    {
+       if (it->second.url().asCompleteString() == url_r.asCompleteString()) {
+           return it->second;
+       }
+    }
+    ZYPP_THROW(Exception("Unknown source URL '"+url_r.asString()+"'"));
+    /*NOTREACHED*/
+    return it->second; // just to keep gcc happy
+  }
+
   /////////////////////////////////////////////////////////////////
   // FailedSourcesRestoreException
   ///////////////////////////////////////////////////////////////////
index beddc82..f1b26c9 100644 (file)
@@ -178,6 +178,16 @@ namespace zypp
     Source_Ref findSource(const std::string & alias_r);
 
     /**
+     * Find a source with a specified URL.
+     * URLs are unique in zenworks but NOT in zypp.
+     * A bug in SL 10.1 causes alias mismatches so we have to resort to URLs.
+     * #177543
+     *
+     * \throws Exception
+     */
+    Source_Ref findSourceByUrl(const Url & url_r);
+
+    /**
      * Return the list of the currently enabled sources
      *
      */