From: Michael Vogt Date: Thu, 18 Feb 2010 10:22:26 +0000 (+0100) Subject: Change the package index Info methods to allow apt-cache policy to be X-Git-Tag: 0.7.25.3ubuntu2~7^2~5 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/5e02df826dc8e1f2a1d687f2cc4e55daba4c5452?hp=937bc486b9ce42e144e00467658bd431ef826664 Change the package index Info methods to allow apt-cache policy to be useful when using several different archives on the same host. (Closes: #329814, LP: #22354) --- diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc index 2913fbf44..8e8820949 100644 --- a/apt-pkg/contrib/strutl.cc +++ b/apt-pkg/contrib/strutl.cc @@ -1323,3 +1323,15 @@ string URI::SiteOnly(const string &URI) return U; } /*}}}*/ +// URI::NoUserPassword - Return the schema, site and path for the URI /*{{{*/ +// --------------------------------------------------------------------- +/* */ +string URI::NoUserPassword(const string &URI) +{ + ::URI U(URI); + U.User.clear(); + U.Password.clear(); + U.Port = 0; + return U; +} + /*}}}*/ diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h index 2b2e147fb..a1e7f3934 100644 --- a/apt-pkg/contrib/strutl.h +++ b/apt-pkg/contrib/strutl.h @@ -120,6 +120,7 @@ class URI inline void operator =(const string &From) {CopyFrom(From);}; inline bool empty() {return Access.empty();}; static string SiteOnly(const string &URI); + static string NoUserPassword(const string &URI); URI(string Path) {CopyFrom(Path);}; URI() : Port(0) {}; diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index be8175e31..3b11ad2eb 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -35,12 +35,12 @@ debSourcesIndex::debSourcesIndex(string URI,string Dist,string Section,bool Trus // SourcesIndex::SourceInfo - Short 1 liner describing a source /*{{{*/ // --------------------------------------------------------------------- /* The result looks like: - http://foo/ stable/main src 1.1.1 (dsc) */ + http://foo/debian/ stable/main src 1.1.1 (dsc) */ string debSourcesIndex::SourceInfo(pkgSrcRecords::Parser const &Record, pkgSrcRecords::File const &File) const { string Res; - Res = ::URI::SiteOnly(URI) + ' '; + Res = ::URI::NoUserPassword(URI) + ' '; if (Dist[Dist.size() - 1] == '/') { if (Dist != "/") @@ -88,7 +88,7 @@ string debSourcesIndex::Describe(bool Short) const /* */ string debSourcesIndex::Info(const char *Type) const { - string Info = ::URI::SiteOnly(URI) + ' '; + string Info = ::URI::NoUserPassword(URI) + ' '; if (Dist[Dist.size() - 1] == '/') { if (Dist != "/") @@ -159,7 +159,7 @@ debPackagesIndex::debPackagesIndex(string URI,string Dist,string Section,bool Tr /* This is a shorter version that is designed to be < 60 chars or so */ string debPackagesIndex::ArchiveInfo(pkgCache::VerIterator Ver) const { - string Res = ::URI::SiteOnly(URI) + ' '; + string Res = ::URI::NoUserPassword(URI) + ' '; if (Dist[Dist.size() - 1] == '/') { if (Dist != "/") @@ -195,7 +195,7 @@ string debPackagesIndex::Describe(bool Short) const /* */ string debPackagesIndex::Info(const char *Type) const { - string Info = ::URI::SiteOnly(URI) + ' '; + string Info = ::URI::NoUserPassword(URI) + ' '; if (Dist[Dist.size() - 1] == '/') { if (Dist != "/") @@ -394,7 +394,7 @@ string debTranslationsIndex::Describe(bool Short) const /* */ string debTranslationsIndex::Info(const char *Type) const { - string Info = ::URI::SiteOnly(URI) + ' '; + string Info = ::URI::NoUserPassword(URI) + ' '; if (Dist[Dist.size() - 1] == '/') { if (Dist != "/") diff --git a/debian/changelog b/debian/changelog index c2c3524a6..a900cdec4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,6 +15,11 @@ apt (0.7.25.4) UNRELEASED; urgency=low proxy configuration and return it to apt via stdout (this is a step towards WPAD and zeroconf/avahi support) + [ Robert Collins ] + * Change the package index Info methods to allow apt-cache policy to be + useful when using several different archives on the same host. + (Closes: #329814, LP: #22354) + -- Michael Vogt Fri, 18 Dec 2009 16:54:18 +0100 apt (0.7.25.3) unstable; urgency=low