From 77278c2b5249162036121c20d537ca53e5914f0d Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 28 Apr 2010 09:41:44 +0200 Subject: * [ 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/acquire-item.cc | 14 ++++++++++++-- apt-pkg/acquire-item.h | 9 ++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index d2aca597e..270838f0e 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -1539,8 +1539,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); @@ -1655,3 +1656,12 @@ void pkgAcqFile::Failed(string Message,pkgAcquire::MethodConfig *Cnf) 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 --git a/apt-pkg/acquire-item.h b/apt-pkg/acquire-item.h index 3f073de5b..592924f3b 100644 --- a/apt-pkg/acquire-item.h +++ b/apt-pkg/acquire-item.h @@ -856,6 +856,9 @@ class pkgAcqFile : public pkgAcquire::Item */ unsigned int Retries; + /** \brief Should this file be considered a index file */ + bool IsIndexFile; + public: // Specialized action members @@ -864,6 +867,7 @@ class pkgAcqFile : public pkgAcquire::Item pkgAcquire::MethodConfig *Cnf); virtual string DescURI() {return Desc.URI;}; virtual string HashSum() {return ExpectedHash.toStr(); }; + virtual string Custom600Headers(); /** \brief Create a new pkgAcqFile object. * @@ -887,6 +891,8 @@ class pkgAcqFile : public pkgAcquire::Item * * \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 @@ -896,7 +902,8 @@ class pkgAcqFile : public pkgAcquire::Item 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); }; /*}}}*/ /** @} */ -- cgit v1.2.3 From 0c01e682d29051d4e26ea60e378796d30569ba5f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 28 Apr 2010 15:45:06 +0200 Subject: * apt-pkg/depcache.cc: - fix incorrect std::cout usage for debug output --- apt-pkg/depcache.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index ec7a5de64..37b1c889d 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -186,7 +186,7 @@ bool pkgDepCache::readStateFile(OpProgress *Prog) /*{{{*/ 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, @@ -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; } } -- cgit v1.2.3 From 4dec007b1d8af31824903ffa3099ff4839ab528e Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 28 Apr 2010 15:49:55 +0200 Subject: apt-pkg/policy.cc: yet another cout -> clog fix --- apt-pkg/policy.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc index f9901bc9a..a24ab7452 100644 --- a/apt-pkg/policy.cc +++ b/apt-pkg/policy.cc @@ -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; } -- cgit v1.2.3 From 8f40076991ecc89ab1e3c486da2696a44c285f18 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 3 May 2010 10:07:13 +0200 Subject: * 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 --- apt-pkg/indexfile.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'apt-pkg') diff --git a/apt-pkg/indexfile.cc b/apt-pkg/indexfile.cc index 34fd71b20..5a82b7b2e 100644 --- a/apt-pkg/indexfile.cc +++ b/apt-pkg/indexfile.cc @@ -127,6 +127,8 @@ string pkgIndexFile::LanguageCode() if(lang.find("_") != lang.npos) return lang.substr(0, lang.find("_")); + else if(lang.find(".") != lang.npos) + return lang.substr(0, lang.find(".")); else return lang; } -- cgit v1.2.3