From 82f348577dfc0712662db444e54f95eba245e301 Mon Sep 17 00:00:00 2001 From: Ishan Jayawardena Date: Wed, 27 Jul 2011 17:55:40 +0530 Subject: Some modifications to the queuing. --- 40debdeltareprules-debian | 4 ++++ 40debdeltareprules-ubuntu | 5 +++++ apt-pkg/acquire-item.cc | 41 ++++++++++++++++++++++++++++++++++------- apt-pkg/deb/debindexfile.cc | 6 +++--- apt-pkg/init.cc | 4 ++-- cmdline/apt-get.cc | 4 ++-- methods/debdelta.cc | 2 +- 7 files changed, 51 insertions(+), 15 deletions(-) create mode 100644 40debdeltareprules-debian create mode 100644 40debdeltareprules-ubuntu diff --git a/40debdeltareprules-debian b/40debdeltareprules-debian new file mode 100644 index 000000000..751b31172 --- /dev/null +++ b/40debdeltareprules-debian @@ -0,0 +1,4 @@ +Aquire::Debdelta::Replace-Rule { + "http://security.debian.org/" "http://debdeltas.debian.net/debian-security-deltas/"; + "http://ftp.de.debian.org/debian/" "http://debdeltas.debian.net/debian-deltas/"; +}; diff --git a/40debdeltareprules-ubuntu b/40debdeltareprules-ubuntu new file mode 100644 index 000000000..2335dbf09 --- /dev/null +++ b/40debdeltareprules-ubuntu @@ -0,0 +1,5 @@ +Aquire::Debdelta::Replace-Rule { + "http://security.ubuntu.com/ubuntu/" "http://macaroni.ubuntu.com/~mvo/debdelta/ubuntu-security-deltas/"; + "http://lk.archive.ubuntu.com/ubuntu/" "http://debdeltas.debian.net/debian-deltas/"; + "http://archive.canonical.com/ubuntu/" "http://debdeltas.debian.net/debian-deltas/"; +}; diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index c22b7fb31..503fac61e 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -2125,7 +2125,8 @@ pkgAcqDebdelta::pkgAcqDebdelta(pkgAcquire *Owner,pkgSourceList *Sources, std::cerr << "Checking index: " << Index->Describe() << "(Trusted=" << Index->IsTrusted() << ")\n"; } - if (Index->IsTrusted()) { + if (Index->IsTrusted()) + { Trusted = true; break; } @@ -2143,11 +2144,25 @@ pkgAcqDebdelta::pkgAcqDebdelta(pkgAcquire *Owner,pkgSourceList *Sources, std::cerr << " StoreFilename: " << StoreFilename << std::endl; std::cerr << " DestFile : " << DestFile << std::endl; } - DebdeltaStatus = Fetching; - if (QueueNext() == false && _error->PendingError() == false) - _error->Error(_("I wasn't able to locate a file for the %s package. " + + if (QueueNext() == false) + { + if (DebdeltaStatus == Completed && DestFile == "") + { + new pkgAcqArchive(Owner, Sources, Recs, Version, StoreFilename); + Dequeue(); + delete this; + return; + } + else if (_error->PendingError() == false) + { + _error->Error(_("I wasn't able to locate a file for the %s package. " "This might mean you need to manually fix this package."), Version.ParentPkg().Name()); + } + + } + DebdeltaStatus = Fetching; } bool pkgAcqDebdelta::QueueNext() @@ -2239,7 +2254,14 @@ bool pkgAcqDebdelta::QueueNext() else { Desc.URI = flNotFile(Index->ArchiveURI(PkgFile)) + DebdeltaName; - ReplaceURI(); + if (ReplaceURI() == false) + { + Complete = true; + Status = StatDone; + DebdeltaStatus = Completed; + StoreFilename = DestFile = ""; + return false; + } } Desc.Description = Desc.URI; // "[Debdelta] " + Index->ArchiveInfo(Version); Desc.Owner = this; @@ -2368,7 +2390,8 @@ void pkgAcqDebdelta::Finished() bool pkgAcqDebdelta::ReplaceURI() { - const Configuration::Item* item = _config->Tree("Aquire::Debdelta::Replace-Rule"); + // if we cant find a replace URI, just queue the deb instead. remove setting the rep rules from other places. + const Configuration::Item* item = _config->Tree("Aquire::Debdelta::Replace-Rule"); for (item = item->Child; item != 0; item = item->Next) { size_t pos = 0; @@ -2384,7 +2407,11 @@ bool pkgAcqDebdelta::ReplaceURI() return true; } } - return _error->Error("[Debdelta] Could not find a replacement URI."); + // no replacement rule found for this URI. Therefore, queue a reagular deb for downloading. + if (Debug) + std::cerr << "[Debdelta] No replacement rule => " << Desc.URI << std::endl; + + return false; } bool IndexTarget::IsOptional() const { diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index 057a99a86..d8d972cc7 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -178,9 +178,9 @@ debPackagesIndex::debPackagesIndex(string const &URI, string const &Dist, string { 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)); + //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; diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc index 4d2eae913..ab4c4ba37 100644 --- a/apt-pkg/init.cc +++ b/apt-pkg/init.cc @@ -41,8 +41,8 @@ bool pkgInitConfig(Configuration &Cnf) Cnf.CndSet("Dir","/"); // Debdelta replacement rule - Cnf.Set("Aquire::Debdelta::Replace-Rule::Default", "http://debdeltas.debian.net/debian-deltas/");// http://www.bononia.it/debian-deltas/ - Cnf.Set("Aquire::Debdelta::Replace-Rule::http://security.debian.org/", "http://debdeltas.debian.net/debian-security-deltas/"); // http://security.ubuntu.com/ubuntu/ => http://www.bononia.it/debian-security-deltas/ + //Cnf.Set("Aquire::Debdelta::Replace-Rule::Default", "http://debdeltas.debian.net/debian-deltas/");// http://www.bononia.it/debian-deltas/ + //Cnf.Set("Aquire::Debdelta::Replace-Rule::http://security.debian.org/", "http://debdeltas.debian.net/debian-security-deltas/"); // http://security.ubuntu.com/ubuntu/ => http://www.bononia.it/debian-security-deltas/ // State Cnf.CndSet("Dir::State","var/lib/apt/"); diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 61caa45cf..d22c86555 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1139,12 +1139,12 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true, if (DebBytes != FetchBytes) //TRANSLATOR: The required space between number and unit is already included // in the replacement strings, so %sB will be correctly translate in e.g. 1,5 MB - ioprintf(c1out,_("Need to get %sB/%sB of archives.\n"), + ioprintf(c1out,_("Need to get at most %sB/%sB of archives.\n"), SizeToStr(FetchBytes).c_str(),SizeToStr(DebBytes).c_str()); else if (DebBytes != 0) //TRANSLATOR: The required space between number and unit is already included // in the replacement string, so %sB will be correctly translate in e.g. 1,5 MB - ioprintf(c1out,_("Need to get %sB of archives.\n"), + ioprintf(c1out,_("Need to get at most %sB of archives.\n"), SizeToStr(DebBytes).c_str()); // Size delta diff --git a/methods/debdelta.cc b/methods/debdelta.cc index 421829e79..37b62a5f5 100644 --- a/methods/debdelta.cc +++ b/methods/debdelta.cc @@ -100,7 +100,7 @@ bool DebdeltaMethod::Fetch(FetchItem *Itm) /*{{{*/ std::cerr << Args[0] << " " << Args[1] << " " << Args[2] << " " << Args[3] << " " << Args[4] << std::endl; } - std::cerr << "\n\n[Debdelta] Patching " << ToFile << "..." << std::endl; + std::cerr << "[Debdelta] Patching " << ToFile << "..." << std::endl; execv(Args[0], (char **)Args); return _error->Error("[Debdelta] Could not execv debpatch."); } -- cgit v1.2.3