From 092ae175f070124ba0857429609e5613a4606934 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 4 Jan 2006 17:52:59 +0000 Subject: * make apt-get source smarter about not downloading the same sources twice --- cmdline/apt-get.cc | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'cmdline/apt-get.cc') diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 48b21a31f..5ff6d2f8f 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -45,6 +46,7 @@ #include "acqprogress.h" +#include #include #include #include @@ -1899,6 +1901,9 @@ bool DoSource(CommandLine &CmdL) DscFile *Dsc = new DscFile[CmdL.FileSize()]; + // insert all downloaded uris into this set to avoid downloading them + // twice + set queued; // Load the requestd sources into the fetcher unsigned J = 0; for (const char **I = CmdL.FileList + 1; *I != 0; I++, J++) @@ -1935,7 +1940,28 @@ bool DoSource(CommandLine &CmdL) if (_config->FindB("APT::Get::Tar-Only",false) == true && I->Type != "tar") continue; - + + // don't download the same uri twice (should this be moved to + // the fetcher interface itself?) + if(queued.find(Last->Index().ArchiveURI(I->Path)) != queued.end()) + continue; + queued.insert(Last->Index().ArchiveURI(I->Path)); + + // check if we have a file with that md5 sum already localy + if(!I->MD5Hash.empty() && FileExists(flNotDir(I->Path))) + { + FileFd Fd(flNotDir(I->Path), FileFd::ReadOnly); + MD5Summation sum; + sum.AddFD(Fd.Fd(), Fd.Size()); + Fd.Close(); + if((string)sum.Result() == I->MD5Hash) + { + ioprintf(c1out,_("Skiping already downloaded file '%s'\n"), + flNotDir(I->Path).c_str()); + continue; + } + } + new pkgAcqFile(&Fetcher,Last->Index().ArchiveURI(I->Path), I->MD5Hash,I->Size, Last->Index().SourceInfo(*Last,*I),Src); -- cgit v1.2.3-70-g09d2 From 443cb67cf5ab303e78776814c5d607e3803088a3 Mon Sep 17 00:00:00 2001 From: Christian Perrier Date: Fri, 6 Jan 2006 07:47:34 +0000 Subject: Fix typo in apt-get.cc and update PO files --- cmdline/apt-get.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cmdline/apt-get.cc') diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 5ff6d2f8f..abeb57c6f 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1956,7 +1956,7 @@ bool DoSource(CommandLine &CmdL) Fd.Close(); if((string)sum.Result() == I->MD5Hash) { - ioprintf(c1out,_("Skiping already downloaded file '%s'\n"), + ioprintf(c1out,_("Skipping already downloaded file '%s'\n"), flNotDir(I->Path).c_str()); continue; } -- cgit v1.2.3-70-g09d2 From a546101c245d4096961e0917c9aa9ab937b6e0ae Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 8 Feb 2006 10:19:02 +0000 Subject: * fix regression about not working --print-uris in "install" --- cmdline/apt-get.cc | 9 --------- debian/changelog | 5 ++++- 2 files changed, 4 insertions(+), 10 deletions(-) (limited to 'cmdline/apt-get.cc') diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index abeb57c6f..837094ee0 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1411,15 +1411,6 @@ bool DoUpgrade(CommandLine &CmdL) /* Install named packages */ bool DoInstall(CommandLine &CmdL) { - // Lock the list directory - FileFd Lock; - if (_config->FindB("Debug::NoLocking",false) == false) - { - Lock.Fd(GetLock(_config->FindDir("Dir::State::Lists") + "lock")); - if (_error->PendingError() == true) - return _error->Error(_("Unable to lock the list directory")); - } - CacheFile Cache; if (Cache.OpenForInstall() == false || Cache.CheckDeps(CmdL.FileSize() != 1) == false) diff --git a/debian/changelog b/debian/changelog index b71fe095a..4f2ea848a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,8 +3,11 @@ apt (0.6.43.3) unstable; urgency=low * apt-pkg/deb/deblistparser.cc: - don't explode on a DepCompareOp in a Provides line, but warn about it and ignore it otherwise (thanks to James Troup for reporting it) + * cmdline/apt-get.cc: + - don't lock the lists directory in DoInstall, breaks --print-uri + (thanks to James Troup for reporting it) - -- Michael Vogt Thu, 19 Jan 2006 01:05:52 +0100 + -- apt (0.6.43.2) unstable; urgency=low -- cgit v1.2.3-70-g09d2 From 7f016f53293f9c8c149debd2b84b1efd4d9cc827 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 16 Feb 2006 13:27:36 +0000 Subject: * only clean out the list dir if the update was successful --- cmdline/apt-get.cc | 2 +- debian/changelog | 35 ++++++++++++++++------------------- 2 files changed, 17 insertions(+), 20 deletions(-) (limited to 'cmdline/apt-get.cc') diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 837094ee0..d4a6bee32 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1368,7 +1368,7 @@ bool DoUpdate(CommandLine &CmdL) } // Clean out any old list files - if (_config->FindB("APT::Get::List-Cleanup",true) == true) + if (!Failed && _config->FindB("APT::Get::List-Cleanup",true) == true) { if (Fetcher.Clean(_config->FindDir("Dir::State::lists")) == false || Fetcher.Clean(_config->FindDir("Dir::State::lists") + "partial/") == false) diff --git a/debian/changelog b/debian/changelog index 7042906d2..b6f2a5d0c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,25 +1,20 @@ apt (0.6.43.3) unstable; urgency=low * Merge bubulle@debian.org--2005/apt--main--0 up to patch-182: - * ca.po: Completed to 512t. Closes: #351592 - * eu.po: Completed to 512t. Closes: #350483 - * ja.po: Completed to 512t. Closes: #349806 - * pl.po: Completed to 512t. Closes: #349514 - * sk.po: Completed to 512t. Closes: #349474 - * gl.po: Completed to 512 strings - Closes: #349407 - * vi.po: Completed to 512 strings - * sv.po: Completed to 512 strings - Closes: #349210 - * ru.po: Completed to 512 strings - Closes: #349154 - * da.po: Completed to 512 strings - Closes: #349084 - * fr.po: Completed to 512 strings - * LINGUAS: Add Welsh - * *.po: Updated from sources (512 strings) - * vi.po: Completed to 511 strings - Closes: #348968 + * ca.po: Completed to 512t. Closes: #351592 + * eu.po: Completed to 512t. Closes: #350483 + * ja.po: Completed to 512t. Closes: #349806 + * pl.po: Completed to 512t. Closes: #349514 + * sk.po: Completed to 512t. Closes: #349474 + * gl.po: Completed to 512 strings Closes: #349407 + * vi.po: Completed to 512 strings + * sv.po: Completed to 512 strings Closes: #349210 + * ru.po: Completed to 512 strings Closes: #349154 + * da.po: Completed to 512 strings Closes: #349084 + * fr.po: Completed to 512 strings + * LINGUAS: Add Welsh + * *.po: Updated from sources (512 strings) + * vi.po: Completed to 511 strings Closes: #348968 * apt-pkg/deb/deblistparser.cc: - don't explode on a DepCompareOp in a Provides line, but warn about it and ignore it otherwise (thanks to James Troup for reporting it) @@ -28,6 +23,8 @@ apt (0.6.43.3) unstable; urgency=low (thanks to James Troup for reporting it) * debian/apt.dirs: create /etc/apt/sources.list.d * make apt-cache madison work without deb-src entries (#352583) + * cmdline/apt-get.cc: only run the list-cleaner if a update was + successfull -- -- cgit v1.2.3-70-g09d2