X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/cdcc6d34b0256aa5efe159351bb24b2e28ed143b..8e34bee58db2ca432ff24d241c85c3e6eb14aecc:/apt-pkg/sourcelist.cc?ds=inline diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc index 61d5dc7ab..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.10 1999/01/27 02:48:52 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) @@ -129,7 +129,13 @@ bool pkgSourceList::Item::SetType(string S) return true; } - return true; + if (S == "deb-src") + { + Type = DebSrc; + return true; + } + + return false; } /*}}}*/ // SourceList::Item::SetURI - Set the URI /*{{{*/ @@ -163,13 +169,28 @@ 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") + '/'; Res += "Packages"; break; + + case DebSrc: + if (Dist[Dist.size() - 1] == '/') + Res = URI + Dist; + else + Res = URI + "dists/" + Dist + '/' + Section + + "/source/"; + + Res += "Sources"; + break; }; return Res; } @@ -185,12 +206,25 @@ 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; Res += " Packages"; break; + + case DebSrc: + Res += SiteOnly(URI) + ' '; + if (Dist[Dist.size() - 1] == '/') + Res += Dist; + else + Res += Dist + '/' + Section; + + Res += " Sources"; + break; }; return Res; } @@ -205,13 +239,28 @@ 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") + '/'; Res += "Release"; break; + + case DebSrc: + if (Dist[Dist.size() - 1] == '/') + Res = URI + Dist; + else + Res = URI + "dists/" + Dist + '/' + Section + + "/source/"; + + Res += "Release"; + break; }; return Res; } @@ -225,9 +274,13 @@ string pkgSourceList::Item::ReleaseInfo() const switch (Type) { case Deb: + case DebSrc: Res += SiteOnly(URI) + ' '; if (Dist[Dist.size() - 1] == '/') - Res += Dist; + { + if (Dist != "/") + Res += Dist; + } else Res += Dist + '/' + Section; @@ -245,10 +298,14 @@ string pkgSourceList::Item::ArchiveInfo(pkgCache::VerIterator Ver) const string Res; switch (Type) { + case DebSrc: case Deb: Res += SiteOnly(URI) + ' '; if (Dist[Dist.size() - 1] == '/') - Res += Dist; + { + if (Dist != "/") + Res += Dist; + } else Res += Dist + '/' + Section; @@ -271,26 +328,53 @@ string pkgSourceList::Item::ArchiveURI(string File) const switch (Type) { case Deb: + case DebSrc: Res = URI + File; break; }; return Res; } /*}}}*/ +// SourceList::Item::SourceInfo - Returns an info line for a source /*{{{*/ +// --------------------------------------------------------------------- +/* */ +string pkgSourceList::Item::SourceInfo(string Pkg,string Ver,string Comp) const +{ + string Res; + switch (Type) + { + case DebSrc: + case Deb: + Res += SiteOnly(URI) + ' '; + if (Dist[Dist.size() - 1] == '/') + { + if (Dist != "/") + Res += Dist; + } + else + Res += Dist + '/' + Section; + + Res += " "; + Res += Pkg; + Res += " "; + Res += Ver; + if (Comp.empty() == false) + Res += " (" + Comp + ")"; + break; + }; + return Res; +} + /*}}}*/ // SourceList::Item::SiteOnly - Strip off the path part of a URI /*{{{*/ // --------------------------------------------------------------------- /* */ 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; } /*}}}*/