diff options
author | Ishan Jayawardena <udeshike@gmail.com> | 2011-07-08 21:09:25 +0530 |
---|---|---|
committer | Ishan Jayawardena <udeshike@gmail.com> | 2011-07-08 21:09:25 +0530 |
commit | ad9364e4f0e8a65c2ae16fab9508485e5d915bd2 (patch) | |
tree | 3def3ae36d17d140b16614cc50f24f1b357b1d30 /apt-pkg | |
parent | 1792371c2700e42a18c934a91442340c4fce7924 (diff) |
added support for a 'debdelta' entry in the sources.list file and modified existing implementation of replacement rule.
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/acquire-item.cc | 5 | ||||
-rw-r--r-- | apt-pkg/deb/debindexfile.cc | 12 | ||||
-rw-r--r-- | apt-pkg/deb/debmetaindex.cc | 21 | ||||
-rw-r--r-- | apt-pkg/init.cc | 3 |
4 files changed, 32 insertions, 9 deletions
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<metaIndex *> &List, string const &URI, + string const &Dist, string const &Section, + std::map<string, string> 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/"); |