From ad9364e4f0e8a65c2ae16fab9508485e5d915bd2 Mon Sep 17 00:00:00 2001 From: Ishan Jayawardena Date: Fri, 8 Jul 2011 21:09:25 +0530 Subject: added support for a 'debdelta' entry in the sources.list file and modified existing implementation of replacement rule. --- apt-pkg/acquire-item.cc | 5 ++--- apt-pkg/deb/debindexfile.cc | 12 ++++++++---- apt-pkg/deb/debmetaindex.cc | 21 ++++++++++++++++++++- apt-pkg/init.cc | 3 ++- 4 files changed, 32 insertions(+), 9 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 9b7eeaa35..4160767b7 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -2291,11 +2291,10 @@ void pkgAcqDebdelta::Finished() bool pkgAcqDebdelta::ReplaceURI() { - if (_config->Find("Aquire::Debdelta::Replace-Rule::Replace-URI", "empty") == "empty") - return _error->Error("[Debdelta] Could not find a Replace-URI"); - const Configuration::Item* item =_config->Tree("Aquire::Debdelta::Replace-Rule::URI-Space"); + const Configuration::Item* item =_config->Tree("Aquire::Debdelta::Replace-Rule"); for (item = item->Child; item != 0; item = item->Next) { size_t pos = 0; + // see if the Des.URI is available in the URI-Space if ((pos = Desc.URI.find(item->Tag, pos)) != std::string::npos) { Desc.URI.replace(pos, item->Tag.length(), item->Value); diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index 4c8a6719d..4f549b7db 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -176,10 +176,14 @@ debPackagesIndex::debPackagesIndex(string const &URI, string const &Dist, string bool const &Trusted, string const &Arch) : pkgIndexFile(Trusted), URI(URI), Dist(Dist), Section(Section), Architecture(Arch) { - if (Architecture == "native") - Architecture = _config->Find("APT::Architecture"); - _config->Set("Aquire::Debdelta::Replace-Rule::URI-Space::"+URI, - _config->Find("Aquire::Debdelta::Replace-Rule::Replace-URI")); + if (Architecture == "native") + Architecture = _config->Find("APT::Architecture"); + string ReplacementItem = "Aquire::Debdelta::Replace-Rule::" + URI;//::URI::URI(URI); + string ReplacementDefault = _config->Find("Aquire::Debdelta::Replace-Rule::Default"); + _config->Set(ReplacementItem, _config->Find(ReplacementItem, ReplacementDefault)); + + //std::cerr << "==== Replacement rule: " << ReplacementItem + // << " => "<< ReplacementDefault << std::endl; } /*}}}*/ // PackagesIndex::ArchiveInfo - Short version of the archive url /*{{{*/ diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index a91cc34e9..5c4a591f1 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -425,8 +425,27 @@ class debSLTypeDebSrc : public debSLTypeDebian { Name = "deb-src"; Label = "Standard Debian source tree"; - } + } +}; + +class debSLTypeDebdelta : public debSLTypeDebian +{ +public: + + bool CreateItem(vector &List, string const &URI, + string const &Dist, string const &Section, + std::map const &Options) const + { + return CreateItemInternal(List, URI, Dist, Section, false, Options); + } + + debSLTypeDebdelta() + { + Name = "debdelta"; + Label = "Standard Debdelta tree"; + } }; debSLTypeDeb _apt_DebType; debSLTypeDebSrc _apt_DebSrcType; +debSLTypeDebdelta _apt_DebdeltaType; diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc index ef43c4415..55b6b64f4 100644 --- a/apt-pkg/init.cc +++ b/apt-pkg/init.cc @@ -41,7 +41,8 @@ bool pkgInitConfig(Configuration &Cnf) Cnf.Set("Dir","/"); // Debdelta replacement rule - Cnf.Set("Aquire::Debdelta::Replace-Rule::Replace-URI", "http://debdeltas.debian.net/debian-deltas/"); + Cnf.Set("Aquire::Debdelta::Replace-Rule::Default", "http://debdeltas.debian.net/debian-deltas/"); + Cnf.Set("Aquire::Debdelta::Replace-Rule::http://security.debian.org/", "http://debdeltas.debian.net/debian-security-deltas/"); // State Cnf.Set("Dir::State","var/lib/apt/"); -- cgit v1.2.3