From: Michael Vogt Date: Tue, 4 May 2010 07:57:24 +0000 (+0200) Subject: merge from the mvo branch X-Git-Tag: 0.8.0~15 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/52d9d000a74ea71edff93f00ae38aceb9ada53d4?ds=inline;hp=-c merge from the mvo branch --- 52d9d000a74ea71edff93f00ae38aceb9ada53d4 diff --combined apt-pkg/acquire-item.cc index 4f0abbb91,270838f0e..6d4336425 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@@ -310,7 -310,7 +310,7 @@@ bool pkgAcqDiffIndex::ParseDiffIndex(st if(last_space != string::npos) Description.erase(last_space, Description.size()-last_space); new pkgAcqIndexDiffs(Owner, RealURI, Description, Desc.ShortDesc, - ExpectedHash, available_patches); + ExpectedHash, ServerSha1, available_patches); Complete = false; Status = StatDone; Dequeue(); @@@ -378,10 -378,9 +378,10 @@@ void pkgAcqDiffIndex::Done(string Messa pkgAcqIndexDiffs::pkgAcqIndexDiffs(pkgAcquire *Owner, string URI,string URIDesc,string ShortDesc, HashString ExpectedHash, + string ServerSha1, vector diffs) : Item(Owner), RealURI(URI), ExpectedHash(ExpectedHash), - available_patches(diffs) + available_patches(diffs), ServerSha1(ServerSha1) { DestFile = _config->FindDir("Dir::State::lists") + "partial/"; @@@ -467,13 -466,6 +467,13 @@@ bool pkgAcqIndexDiffs::QueueNextDiff( std::clog << "QueueNextDiff: " << FinalFile << " (" << local_sha1 << ")"<::iterator I=available_patches.begin(); @@@ -571,7 -563,7 +571,7 @@@ void pkgAcqIndexDiffs::Done(string Mess // see if there is more to download if(available_patches.size() > 0) { new pkgAcqIndexDiffs(Owner, RealURI, Description, Desc.ShortDesc, - ExpectedHash, available_patches); + ExpectedHash, ServerSha1, available_patches); return Finish(); } else return Finish(true); @@@ -1547,8 -1539,9 +1547,9 @@@ void pkgAcqArchive::Finished( /* The file is added to the queue */ pkgAcqFile::pkgAcqFile(pkgAcquire *Owner,string URI,string Hash, unsigned long Size,string Dsc,string ShortDesc, - const string &DestDir, const string &DestFilename) : - Item(Owner), ExpectedHash(Hash) + const string &DestDir, const string &DestFilename, + bool IsIndexFile) : + Item(Owner), ExpectedHash(Hash), IsIndexFile(IsIndexFile) { Retries = _config->FindI("Acquire::Retries",0); @@@ -1663,3 -1656,12 +1664,12 @@@ void pkgAcqFile::Failed(string Message, Item::Failed(Message,Cnf); } /*}}}*/ + // AcqIndex::Custom600Headers - Insert custom request headers /*{{{*/ + // --------------------------------------------------------------------- + /* The only header we use is the last-modified header. */ + string pkgAcqFile::Custom600Headers() + { + if (IsIndexFile) + return "\nIndex-File: true"; + } + /*}}}*/ diff --combined apt-pkg/acquire-item.h index d862d0fdd,592924f3b..bafa8263a --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@@ -422,10 -422,6 +422,10 @@@ class pkgAcqIndexDiffs : public pkgAcqu * off the front? */ vector available_patches; + + /** Stop applying patches when reaching that sha1 */ + string ServerSha1; + /** The current status of this patch. */ enum DiffState { @@@ -479,7 -475,6 +479,7 @@@ */ pkgAcqIndexDiffs(pkgAcquire *Owner,string URI,string URIDesc, string ShortDesc, HashString ExpectedHash, + string ServerSha1, vector diffs=vector()); }; /*}}}*/ @@@ -861,6 -856,9 +861,9 @@@ class pkgAcqFile : public pkgAcquire::I */ unsigned int Retries; + /** \brief Should this file be considered a index file */ + bool IsIndexFile; + public: // Specialized action members @@@ -869,6 -867,7 +872,7 @@@ pkgAcquire::MethodConfig *Cnf); virtual string DescURI() {return Desc.URI;}; virtual string HashSum() {return ExpectedHash.toStr(); }; + virtual string Custom600Headers(); /** \brief Create a new pkgAcqFile object. * @@@ -892,6 -891,8 +896,8 @@@ * * \param DestFilename The filename+path the file is downloaded to. * + * \param IsIndexFile The file is considered a IndexFile and cache-control + * headers like "cache-control: max-age=0" are send * * If DestFilename is empty, download to DestDir/ if * DestDir is non-empty, $CWD/ otherwise. If @@@ -901,7 -902,8 +907,8 @@@ pkgAcqFile(pkgAcquire *Owner, string URI, string Hash, unsigned long Size, string Desc, string ShortDesc, - const string &DestDir="", const string &DestFilename=""); + const string &DestDir="", const string &DestFilename="", + bool IsIndexFile=false); }; /*}}}*/ /** @} */ diff --combined apt-pkg/depcache.cc index 5943d858a,37b1c889d..0f30f13c2 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@@ -186,16 -186,16 +186,16 @@@ bool pkgDepCache::readStateFile(OpProgr if(reason > 0) PkgState[pkg->ID].Flags |= Flag::Auto; if(debug_autoremove) - std::cout << "Auto-Installed : " << pkgname << std::endl; + std::clog << "Auto-Installed : " << pkgname << std::endl; amt+=section.size(); if(Prog != NULL) Prog->OverallProgress(amt, file_size, 1, _("Reading state information")); } - if(Prog != NULL) - Prog->OverallProgress(file_size, file_size, 1, - _("Reading state information")); } + if(Prog != NULL) + Prog->OverallProgress(file_size, file_size, 1, + _("Reading state information")); } return true; @@@ -1511,7 -1511,7 +1511,7 @@@ bool pkgDepCache::Sweep() /*{{{* { state.Garbage=true; if(debug_autoremove) - std::cout << "Garbage: " << p.Name() << std::endl; + std::clog << "Garbage: " << p.Name() << std::endl; } } diff --combined apt-pkg/policy.cc index b12a50d0a,a24ab7452..4996007a3 --- a/apt-pkg/policy.cc +++ b/apt-pkg/policy.cc @@@ -106,7 -106,7 +106,7 @@@ bool pkgPolicy::InitDefaults( if (_config->FindB("Debug::pkgPolicy",false) == true) for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F != Cache->FileEnd(); F++) - cout << "Prio of " << F.FileName() << ' ' << PFPriority[F->ID] << endl; + std::clog << "Prio of " << F.FileName() << ' ' << PFPriority[F->ID] << std::endl; return true; } @@@ -121,10 -121,6 +121,10 @@@ pkgCache::VerIterator pkgPolicy::GetCan signed Max = GetPriority(Pkg); pkgCache::VerIterator Pref = GetMatch(Pkg); + // Alternatives in case we can not find our package pin (Bug#512318). + signed MaxAlt = 0; + pkgCache::VerIterator PrefAlt; + // no package = no candidate version if (Pkg.end() == true) return Pref; @@@ -163,11 -159,6 +163,11 @@@ { Pref = Ver; Max = Prio; + } + if (Prio > MaxAlt) + { + PrefAlt = Ver; + MaxAlt = Prio; } } @@@ -184,11 -175,6 +184,11 @@@ break; } } + // If we do not find our candidate, use the one with the highest pin. + // This means that if there is a version available with pin > 0; there + // will always be a candidate (Closes: #512318) + if (!Pref.IsGood() && MaxAlt > 0) + Pref = PrefAlt; return Pref; } /*}}}*/ diff --combined debian/changelog index f166b7d32,7c0024160..eb618118d --- a/debian/changelog +++ b/debian/changelog @@@ -1,97 -1,14 +1,110 @@@ -apt (0.7.25.4) UNRELEASED; urgency=low ++apt (0.7.26~exp4) unstable; urgency=low ++ ++ * [ Abi break ] apt-pkg/acquire-item.{cc,h}: ++ - add "IsIndexFile" to constructor of pkgAcqFile so that it sends ++ the right cache control headers ++ * apt-pkg/depcache.cc: ++ - fix incorrect std::cout usage for debug output ++ * test/libapt/getlanguages_test.cc: ++ - Add test for Esperanto that has nocounty associated with them ++ (LP: #560956) ++ ++ -- Michael Vogt Tue, 04 May 2010 09:55:08 +0200 ++ +apt (0.7.26~exp3) UNRELEASED; urgency=low + + [ Christian Perrier ] + * German translation update. Closes: #571037 + * Spanish manpages translation update. Closes: #573293 + * Dutch translation update. Closes: #573946 + * Polish manpages translation update. Closes: #574558 + * Add "manpages-pl (<< 20060617-3~)" to avoid file conflicts with + that package that was providing some manpages for APT utilities. + + [ Julian Andres Klode ] + * cmdline/apt-cache.cc: + - Change behavior of showsrc to match the one of show (Closes: #512046). + * cmdline/apt-key: + - Honor Apt::GPGV::TrustedKeyring (Closes: #316390) + * cmdline/apt-mark: + - Use the new python-apt API (and conflict with python-apt << 0.7.93.2). + * apt-inst/contrib/arfile.h: + - Add public ARArchive::Members() which returns the list of members. + * apt-pkg/policy.cc: + - Always return a candidate if there is at least one version pinned > 0 + (Closes: #512318) + * ftparchive/apt-ftparchive.cc: + - Read default configuration (Closes: #383257) + * debian/rules: + - Fix the libraries name to be e.g. libapt-pkg4.9 instead of + libapt-pkg-4.9. + + [ Michael Vogt ] + * apt-pkg/deb/dpkgpm.cc: + - fix backgrounding when dpkg runs (closes: #486222) + * cmdline/apt-mark: + - show error on incorrect aguments (LP: #517917), thanks to + Torsten Spindler + * cmdline/apt-get.cc: + - if apt-get source foo=version or foo/distro can not be found, + error out (LP: #502641) + * apt-pkg/packagemanager.cc: + - better debug output + * doc/examples/configure-index: + - add missing Debug::pkgPackageManager option + + -- Christian Perrier Wed, 24 Feb 2010 22:13:50 +0100 + +apt (0.7.26~exp2) experimental; urgency=low + + * fix crash when LANGUAGE is not set + + -- Michael Vogt Thu, 18 Feb 2010 22:07:23 +0100 + +apt (0.7.26~exp1) experimental; urgency=low + + [ David Kalnischkies ] + * [BREAK] add possibility to download and use multiply + Translation files, configurable with Acquire::Translation + (Closes: #444222, #448216, #550564) + * Ignore :qualifiers after package name in build dependencies + for now as long we don't understand them (Closes: #558103) + * apt-pkg/contrib/mmap.{cc,h}: + - extend it to have a growable flag - unused now but maybe... + * apt-pkg/pkgcache.h: + - use long instead of short for {Ver,Desc}File size, + patch from Víctor Manuel Jáquez Leal, thanks! (Closes: #538917) + * apt-pkg/acquire-item.cc: + - allow also to skip the last patch if target is reached, + thanks Bernhard R. Link! (Closes: #545699) + * ftparchive/writer.{cc,h}: + - add --arch option for packages and contents commands + - if an arch is given accept only *_all.deb and *_arch.deb instead + of *.deb. Thanks Stephan Bosch for the patch! (Closes: #319710) + - add APT::FTPArchive::AlwaysStat to disable the too aggressive + caching if versions are build multiply times (not recommend) + Patch by Christoph Goehre, thanks! (Closes: #463260) + * apt-pkg/deb/dpkgpm.cc: + - stdin redirected to /dev/null takes all CPU (Closes: #569488) + Thanks to Aurelien Jarno for providing (again) a patch! + * buildlib/apti18n.h.in, po/makefile: + - add ngettext support with P_() + * aptconfiguration.cc: + - include all existing Translation files in the Cache (Closes: 564137) + * debian/control: + - update with no changes to debian policy 3.8.4 + * doc/apt_preferences.5.xml: + - explicitly warn against careless use (Closes: #567669) + * debian/rules: + - remove creation of empty dir /usr/share/apt + * doc/apt-cdrom.8.xml: + - fix typo spotted by lintian: proc(c)eed - [ Evan Dandrea ] - * Remember hosts with general failures for - https://wiki.ubuntu.com/NetworklessInstallationFixes (LP: #556831). - [ Ivan Masár ] * Slovak translation update. Closes: #568294 [ Michael Vogt ] - * merged lp:~mvo/apt/history + * [BREAK] merged lp:~mvo/apt/history - this writes a /var/log/apt/history tagfile that contains details from the transaction (complements term.log) * methods/http.cc: @@@ -104,13 -21,33 +117,13 @@@ * abicheck/ - add new abitest tester using the ABI Compliance Checker from http://ispras.linuxfoundation.org/index.php/ABI_compliance_checker - * apt-pkg/deb/dpkgpm.cc: - - fix backgrounding when dpkg runs (closes: #486222) - * cmdline/apt-mark: - - show error on incorrect aguments (LP: #517917), thanks to - Torsten Spindler - * cmdline/apt-get.cc: - - if apt-get source foo=version or foo/distro can not be found, - error out (LP: #502641) - * apt-pkg/indexfile.cc: - - deal correctly with three letter langcodes (LP: #391409) - * [ Abi break ] apt-pkg/acquire-item.{cc,h}: - - add "IsIndexFile" to constructor of pkgAcqFile so that it sends - the right cache control headers - * apt-pkg/depcache.cc: - - fix incorrect std::cout usage for debug output - * apt-pkg/indexfile.cc: - - If no "_" is found in the language code, try to find a "." - This is required for languages like Esperanto that have no - county associated with them (LP: #560956) - Thanks to "Aisano" for the fix [ 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 + -- Michael Vogt Thu, 18 Feb 2010 16:11:39 +0100 apt (0.7.25.3) unstable; urgency=low diff --combined test/libapt/getlanguages_test.cc index 0db190b50,000000000..9a8910b58 mode 100644,000000..100644 --- a/test/libapt/getlanguages_test.cc +++ b/test/libapt/getlanguages_test.cc @@@ -1,142 -1,0 +1,149 @@@ +#include +#include + +#include "assert.h" +#include +#include + +#include + +// simple helper to quickly output a vector of strings +void dumpVector(std::vector vec) { + for (std::vector::const_iterator v = vec.begin(); + v != vec.end(); v++) + std::cout << *v << std::endl; +} + +int main(int argc,char *argv[]) +{ + if (argc != 2) { + std::cout << "One parameter expected - given " << argc << std::endl; + return 100; + } + + char const* env[2]; + env[0] = "de_DE.UTF-8"; + env[1] = ""; + + std::vector vec = APT::Configuration::getLanguages(false, false, env); + equals(vec.size(), 2); + equals(vec[0], "de"); + equals(vec[1], "en"); + + // Special: Check if the cache is actually in use + env[0] = "en_GB.UTF-8"; + vec = APT::Configuration::getLanguages(false, true, env); + equals(vec.size(), 2); + equals(vec[0], "de"); + equals(vec[1], "en"); + + env[0] = "en_GB.UTF-8"; + vec = APT::Configuration::getLanguages(false, false, env); + equals(vec.size(), 2); + equals(vec[0], "en_GB"); + equals(vec[1], "en"); + ++ // esperanto ++ env[0] = "eo.UTF-8"; ++ vec = APT::Configuration::getLanguages(false, false, env); ++ equals(vec.size(), 2); ++ equals(vec[0], "eo"); ++ equals(vec[1], "en"); ++ + env[0] = "tr_DE@euro"; + vec = APT::Configuration::getLanguages(false, false, env); + equals(vec.size(), 2); + equals(vec[0], "tr"); + equals(vec[1], "en"); + + env[0] = "de_NO"; + env[1] = "se_NO:en_GB:nb_NO:nb:no_NO:no:nn_NO:nn:da:sv:en"; + vec = APT::Configuration::getLanguages(false, false, env); + equals(vec.size(), 5); + equals(vec[0], "de"); + equals(vec[1], "en_GB"); + equals(vec[2], "nb"); + equals(vec[3], "no"); + equals(vec[4], "en"); + + env[0] = "pt_PR.UTF-8"; + env[1] = ""; + vec = APT::Configuration::getLanguages(false, false, env); + equals(vec.size(), 3); + equals(vec[0], "pt_PR"); + equals(vec[1], "pt"); + equals(vec[2], "en"); + + env[0] = "ast_DE.UTF-8"; + vec = APT::Configuration::getLanguages(false, false, env); // bogus, but syntactical correct + equals(vec.size(), 2); + equals(vec[0], "ast"); + equals(vec[1], "en"); + + env[0] = "C"; + vec = APT::Configuration::getLanguages(false, false, env); + equals(vec.size(), 1); + equals(vec[0], "en"); + + _config->Set("Acquire::Languages::1", "environment"); + _config->Set("Acquire::Languages::2", "en"); + env[0] = "de_DE.UTF-8"; + vec = APT::Configuration::getLanguages(false, false, env); + equals(vec.size(), 2); + equals(vec[0], "de"); + equals(vec[1], "en"); + + _config->Set("Acquire::Languages::3", "de"); + env[0] = "de_DE.UTF-8"; + vec = APT::Configuration::getLanguages(false, false, env); + equals(vec.size(), 2); + equals(vec[0], "de"); + equals(vec[1], "en"); + + _config->Set("Dir::State::lists", argv[1]); + vec = APT::Configuration::getLanguages(true, false, env); + equals(vec.size(), 5); + equals(vec[0], "de"); + equals(vec[1], "en"); + equals(vec[2], "none"); + equals(vec[3], "pt"); + equals(vec[4], "tr"); + + _config->Set("Dir::State::lists", "/non-existing-dir"); + _config->Set("Acquire::Languages::1", "none"); + env[0] = "de_DE.UTF-8"; + vec = APT::Configuration::getLanguages(false, false, env); + equals(vec.size(), 0); + env[0] = "de_DE.UTF-8"; + vec = APT::Configuration::getLanguages(true, false, env); + equals(vec[0], "en"); + equals(vec[1], "de"); + + _config->Set("Acquire::Languages::1", "fr"); + _config->Set("Acquire::Languages", "de_DE"); + env[0] = "de_DE.UTF-8"; + vec = APT::Configuration::getLanguages(false, false, env); + equals(vec.size(), 1); + equals(vec[0], "de_DE"); + + _config->Set("Acquire::Languages", "none"); + env[0] = "de_DE.UTF-8"; + vec = APT::Configuration::getLanguages(true, false, env); + equals(vec.size(), 0); + + _config->Set("Acquire::Languages", ""); + //FIXME: Remove support for this deprecated setting + _config->Set("APT::Acquire::Translation", "ast_DE"); + env[0] = "de_DE.UTF-8"; + vec = APT::Configuration::getLanguages(true, false, env); + equals(vec.size(), 2); + equals(vec[0], "ast_DE"); + equals(vec[1], "en"); + _config->Set("APT::Acquire::Translation", "none"); + env[0] = "de_DE.UTF-8"; + vec = APT::Configuration::getLanguages(true, false, env); + equals(vec.size(), 1); + equals(vec[0], "en"); + + return 0; +}