X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/36375005d9e971d2fdfc62224671f009ce7adaf9..e5d83da5732ab4ae18cab192345726ba13fd8c34:/apt-pkg/sourcelist.cc diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc index c4f225fde..1fdbd834e 100644 --- a/apt-pkg/sourcelist.cc +++ b/apt-pkg/sourcelist.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: sourcelist.cc,v 1.13 1999/04/07 05:30:17 jgg Exp $ +// $Id: sourcelist.cc,v 1.17 1999/10/17 07:30:23 jgg Exp $ /* ###################################################################### List of Sources @@ -73,7 +73,7 @@ bool pkgSourceList::Read(string File) string Type; string URI; Item Itm; - char *C = Buffer; + const char *C = Buffer; if (ParseQuoteWord(C,Type) == false) return _error->Error("Malformed line %u in source list %s (type)",CurLine,File.c_str()); if (ParseQuoteWord(C,URI) == false) @@ -169,7 +169,12 @@ string pkgSourceList::Item::PackagesURI() const { case Deb: if (Dist[Dist.size() - 1] == '/') - Res = URI + Dist; + { + if (Dist != "/") + Res = URI + Dist; + else + Res = URI; + } else Res = URI + "dists/" + Dist + '/' + Section + "/binary-" + _config->Find("APT::Architecture") + '/'; @@ -201,7 +206,10 @@ string pkgSourceList::Item::PackagesInfo() const case Deb: Res += SiteOnly(URI) + ' '; if (Dist[Dist.size() - 1] == '/') - Res += Dist; + { + if (Dist != "/") + Res += Dist; + } else Res += Dist + '/' + Section; @@ -231,7 +239,12 @@ string pkgSourceList::Item::ReleaseURI() const { case Deb: if (Dist[Dist.size() - 1] == '/') - Res = URI + Dist; + { + if (Dist != "/") + Res = URI + Dist; + else + Res = URI; + } else Res = URI + "dists/" + Dist + '/' + Section + "/binary-" + _config->Find("APT::Architecture") + '/'; @@ -264,7 +277,10 @@ string pkgSourceList::Item::ReleaseInfo() const case DebSrc: Res += SiteOnly(URI) + ' '; if (Dist[Dist.size() - 1] == '/') - Res += Dist; + { + if (Dist != "/") + Res += Dist; + } else Res += Dist + '/' + Section; @@ -286,7 +302,10 @@ string pkgSourceList::Item::ArchiveInfo(pkgCache::VerIterator Ver) const case Deb: Res += SiteOnly(URI) + ' '; if (Dist[Dist.size() - 1] == '/') - Res += Dist; + { + if (Dist != "/") + Res += Dist; + } else Res += Dist + '/' + Section; @@ -328,7 +347,10 @@ string pkgSourceList::Item::SourceInfo(string Pkg,string Ver,string Comp) const case Deb: Res += SiteOnly(URI) + ' '; if (Dist[Dist.size() - 1] == '/') - Res += Dist; + { + if (Dist != "/") + Res += Dist; + } else Res += Dist + '/' + Section; @@ -348,15 +370,11 @@ string pkgSourceList::Item::SourceInfo(string Pkg,string Ver,string Comp) const /* */ string pkgSourceList::Item::SiteOnly(string URI) const { - unsigned int Pos = URI.find(':'); - if (Pos == string::npos || Pos + 3 > URI.length()) - return URI; - if (URI[Pos + 1] != '/' || URI[Pos + 2] != '/') - return URI; - - Pos = URI.find('/',Pos + 3); - if (Pos == string::npos) - return URI; - return string(URI,0,Pos); + ::URI U(URI); + U.User = string(); + U.Password = string(); + U.Path = string(); + U.Port = 0; + return U; } /*}}}*/