]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/sourcelist.cc
Hide hit for local uris
[apt.git] / apt-pkg / sourcelist.cc
index f9de995848ea3f07321fe267d2538f31d3439450..371898810c84885411c071e9f2dd9430fab363c1 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: sourcelist.cc,v 1.3 1998/07/12 23:58:36 jgg Exp $
+// $Id: sourcelist.cc,v 1.9 1998/12/10 04:22:47 jgg Exp $
 /* ######################################################################
 
    List of Sources
@@ -41,7 +41,7 @@ pkgSourceList::pkgSourceList(string File)
 /* */
 bool pkgSourceList::ReadMainList()
 {
-   return Read(_config->Find("APT::Etc:sourcelist"));
+   return Read(_config->FindFile("Dir::Etc::sourcelist"));
 }
                                                                        /*}}}*/
 // SourceList::Read - Parse the sourcelist file                                /*{{{*/
@@ -108,52 +108,13 @@ bool pkgSourceList::Read(string File)
    return true;
 }
                                                                        /*}}}*/
-// SourceList::SanitizeURI - Hash the uri                              /*{{{*/
-// ---------------------------------------------------------------------
-/* This converts a URI into a safe filename. It quotes all unsafe characters
-   and converts / to _ and removes the scheme identifier. */
-string pkgSourceList::SanitizeURI(string URI)
-{
-   string::const_iterator I = URI.begin() + URI.find(':') + 1;
-   for (; I < URI.end() && *I == '/'; I++);
-
-   // "\x00-\x20{}|\\\\^\\[\\]<>\"\x7F-\xFF";
-   URI = QuoteString(string(I,URI.end() - I),"\\|{}[]<>\"^~_=!@#$%^&*");
-   string::iterator J = URI.begin();
-   for (; J != URI.end(); J++)
-      if (*J == '/') 
-        *J = '_';
-   return URI;
-}
-                                                                       /*}}}*/
-// SourceList::MatchPkgFile - Find the package file that has the ver   /*{{{*/
-// ---------------------------------------------------------------------
-/* This will return List.end() if it could not find the matching 
-   file */
-pkgSourceList::const_iterator pkgSourceList::MatchPkgFile(pkgCache::VerIterator Ver)
-{
-   string Base = _config->Find("APT::Architecture");
-   for (const_iterator I = List.begin(); I != List.end(); I++)
-   {
-      string URI = I->PackagesURI();
-      switch (I->Type)
-      {
-        case Item::Deb:
-/*      if (Base + SanitizeURI(URI) == Ver.File().FileName())
-           return I;*/
-        break;
-      };      
-   }
-   return List.end();
-}
-                                                                       /*}}}*/
 // SourceList::Item << - Writes the item to a stream                   /*{{{*/
 // ---------------------------------------------------------------------
 /* This is not suitable for rebuilding the sourcelist file but it good for
    debugging. */
 ostream &operator <<(ostream &O,pkgSourceList::Item &Itm)
 {
-   O << Itm.Type << ' ' << Itm.URI << ' ' << Itm.Dist << ' ' << Itm.Section;
+   O << (int)Itm.Type << ' ' << Itm.URI << ' ' << Itm.Dist << ' ' << Itm.Section;
    return O;
 }
                                                                        /*}}}*/
@@ -234,6 +195,48 @@ string pkgSourceList::Item::PackagesInfo() const
    return Res;
 }
                                                                        /*}}}*/
+// SourceList::Item::ReleaseURI - Returns a URI to the release file    /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+string pkgSourceList::Item::ReleaseURI() const
+{
+   string Res;
+   switch (Type)
+   {
+      case Deb:
+      if (Dist[Dist.size() - 1] == '/')
+        Res = URI + Dist;
+      else
+        Res = URI + "dists/" + Dist + '/' + Section +
+        "/binary-" + _config->Find("APT::Architecture") + '/';
+      
+      Res += "Release";
+      break;
+   };
+   return Res;
+}
+                                                                       /*}}}*/
+// SourceList::Item::ReleaseInfo - Shorter version of the URI          /*{{{*/
+// ---------------------------------------------------------------------
+/* This is a shorter version that is designed to be < 60 chars or so */
+string pkgSourceList::Item::ReleaseInfo() const
+{
+   string Res;
+   switch (Type)
+   {
+      case Deb:
+      Res += SiteOnly(URI) + ' ';
+      if (Dist[Dist.size() - 1] == '/')
+        Res += Dist;
+      else
+        Res += Dist + '/' + Section;
+      
+      Res += " Release";
+      break;
+   };
+   return Res;
+}
+                                                                       /*}}}*/
 // SourceList::Item::ArchiveInfo - Shorter version of the archive spec /*{{{*/
 // ---------------------------------------------------------------------
 /* This is a shorter version that is designed to be < 60 chars or so */
@@ -251,6 +254,9 @@ string pkgSourceList::Item::ArchiveInfo(pkgCache::VerIterator Ver) const
       
       Res += " ";
       Res += Ver.ParentPkg().Name();
+      Res += " ";
+      Res += Ver.VerStr();
+      
       break;
    };
    return Res;