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();
pkgAcqIndexDiffs::pkgAcqIndexDiffs(pkgAcquire *Owner,
string URI,string URIDesc,string ShortDesc,
HashString ExpectedHash,
+ string ServerSha1,
vector<DiffInfo> diffs)
: Item(Owner), RealURI(URI), ExpectedHash(ExpectedHash),
- available_patches(diffs)
+ available_patches(diffs), ServerSha1(ServerSha1)
{
DestFile = _config->FindDir("Dir::State::lists") + "partial/";
std::clog << "QueueNextDiff: "
<< FinalFile << " (" << local_sha1 << ")"<<std::endl;
+ // final file reached before all patches are applied
+ if(local_sha1 == ServerSha1)
+ {
+ Finish(true);
+ return true;
+ }
+
// remove all patches until the next matching patch is found
// this requires the Index file to be ordered
for(vector<DiffInfo>::iterator I=available_patches.begin();
// 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);
/* 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);
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";
+ }
+ /*}}}*/
* off the front?
*/
vector<DiffInfo> available_patches;
+
+ /** Stop applying patches when reaching that sha1 */
+ string ServerSha1;
+
/** The current status of this patch. */
enum DiffState
{
*/
pkgAcqIndexDiffs(pkgAcquire *Owner,string URI,string URIDesc,
string ShortDesc, HashString ExpectedHash,
+ string ServerSha1,
vector<DiffInfo> diffs=vector<DiffInfo>());
};
/*}}}*/
*/
unsigned int Retries;
+ /** \brief Should this file be considered a index file */
+ bool IsIndexFile;
+
public:
// Specialized action members
pkgAcquire::MethodConfig *Cnf);
virtual string DescURI() {return Desc.URI;};
virtual string HashSum() {return ExpectedHash.toStr(); };
+ virtual string Custom600Headers();
/** \brief Create a new pkgAcqFile object.
*
*
* \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/<basename> if
* DestDir is non-empty, $CWD/<basename> otherwise. If
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);
};
/*}}}*/
/** @} */
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;
{
state.Garbage=true;
if(debug_autoremove)
- std::cout << "Garbage: " << p.Name() << std::endl;
+ std::clog << "Garbage: " << p.Name() << std::endl;
}
}
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;
}
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;
{
Pref = Ver;
Max = Prio;
+ }
+ if (Prio > MaxAlt)
+ {
+ PrefAlt = Ver;
+ MaxAlt = Prio;
}
}
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;
}
/*}}}*/
-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 <michael.vogt@ubuntu.com> 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 <bubulle@debian.org> 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 <mvo@debian.org> 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:
* 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 <michael.vogt@ubuntu.com> Fri, 18 Dec 2009 16:54:18 +0100
+ -- Michael Vogt <mvo@debian.org> Thu, 18 Feb 2010 16:11:39 +0100
apt (0.7.25.3) unstable; urgency=low
--- /dev/null
+#include <apt-pkg/aptconfiguration.h>
+#include <apt-pkg/configuration.h>
+
+#include "assert.h"
+#include <string>
+#include <vector>
+
+#include <iostream>
+
+// simple helper to quickly output a vector of strings
+void dumpVector(std::vector<std::string> vec) {
+ for (std::vector<std::string>::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<std::string> 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;
+}