File release_string.patch of Package apt

diff --git a/apt-pkg/rpm/rpmindexfile.cc b/apt-pkg/rpm/rpmindexfile.cc
index 1dd1244..0e7e3ed 100644
--- a/apt-pkg/rpm/rpmindexfile.cc
+++ b/apt-pkg/rpm/rpmindexfile.cc
@@ -774,7 +774,7 @@ bool rpmRepomdIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const
    string RelFile = ReleasePath();
    if (FileExists(RelFile) == true)
    {
-      Parser.LoadReleaseInfo(File,RelFile,Dist);
+      Parser.LoadReleaseInfo(File,RelFile,URI,Dist);
    }
 
    return true;
diff --git a/apt-pkg/rpm/rpmlistparser.cc b/apt-pkg/rpm/rpmlistparser.cc
index 749c91e..f18476a 100644
--- a/apt-pkg/rpm/rpmlistparser.cc
+++ b/apt-pkg/rpm/rpmlistparser.cc
@@ -518,9 +518,25 @@ void rpmListParser::VirtualizePackage(string Name)
 
 #ifdef APT_WITH_REPOMD
 bool rpmRepomdParser::LoadReleaseInfo(pkgCache::PkgFileIterator FileI,
-                                      const string File, const string Dist)
+                                      const string File, const string URI, const string Dist)
 {
    string::size_type start, stop, size;
+   string origin;
+
+   start = URI.find_first_not_of("/", URI.find_first_of("/"));
+   size = URI.length();
+   while ((start != string::npos) && (start < size)) {
+      stop = URI.find_first_of("/", start);
+      string part = URI.substr(start, stop - start);
+      if (origin.empty()) {
+	 origin = part;
+      } else {
+	 origin += "-" + part;
+      }
+      if ((stop == string::npos) || (stop > size)) stop = size;
+      start = URI.find_first_not_of("/", stop + 1);
+   }
+
    string comp;
 
    // Munge sources.list distribution into something that can be used 
@@ -538,11 +554,11 @@ bool rpmRepomdParser::LoadReleaseInfo(pkgCache::PkgFileIterator FileI,
       if ((stop == string::npos) || (stop > size)) stop = size;
       start = Dist.find_first_not_of("/", stop + 1);
    }
-   FileI->Component = WriteUniqString(comp);
+   FileI->Origin = WriteUniqString(origin);
+   FileI->Archive = WriteUniqString(comp);
    // Should these be populated with something (what?) a well?
-   //FileI->Archive = WriteUniqString("Unknown");
+   //FileI->Component = WriteUniqString("Unknown");
    //FileI->Version = WriteUniqString("Unknown");
-   //FileI->Origin = WriteUniqString("Unknown");
    //FileI->Label = WriteUniqString("Unknown");
 
    xmlDocPtr RepoMD = NULL;
diff --git a/apt-pkg/rpm/rpmlistparser.h b/apt-pkg/rpm/rpmlistparser.h
index 7ed5cd0..f8e94f9 100644
--- a/apt-pkg/rpm/rpmlistparser.h
+++ b/apt-pkg/rpm/rpmlistparser.h
@@ -102,7 +102,7 @@ class rpmRepomdParser : public rpmListParser
    public:
  
    bool LoadReleaseInfo(pkgCache::PkgFileIterator FileI,const string File,
-		   	const string Dist);
+			const string URI, const string Dist);
 
    rpmRepomdParser(RPMHandler *Handler) : rpmListParser(Handler) {}
 };
openSUSE Build Service is sponsored by