From 6cbe417f510a776abdb6c9bc8dc44de3b2c78d51 Mon Sep 17 00:00:00 2001 From: Ishan Jayawardena Date: Fri, 22 Jul 2011 09:52:57 +0530 Subject: Fixed some progress reporting output. --- apt-pkg/acquire-item.cc | 27 ++++++++++++++++----------- apt-pkg/acquire-worker.cc | 3 --- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index e81906714..a4dff39e3 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -2241,9 +2241,9 @@ bool pkgAcqDebdelta::QueueNext() Desc.URI = flNotFile(Index->ArchiveURI(PkgFile)) + DebdeltaName; ReplaceURI(); } - Desc.Description = "[Debdelta] " + Index->ArchiveInfo(Version); + Desc.Description = Desc.URI; // "[Debdelta] " + Index->ArchiveInfo(Version); Desc.Owner = this; - Desc.ShortDesc = "[Debdelta] " + string(Version.ParentPkg().Name()); + Desc.ShortDesc = DebdeltaName; // "[Debdelta] " + string(Version.ParentPkg().Name()); if (Debug) { std::cerr << "[Debdelta] pkgAcqDebdelta::QueueNext()" << std::endl; @@ -2260,22 +2260,26 @@ bool pkgAcqDebdelta::QueueNext() void pkgAcqDebdelta::Failed(string Message,pkgAcquire::MethodConfig *Cnf) { + string FileStatus = ""; + if (DebdeltaStatus == Fetching) + FileStatus = "fetch " + Desc.URI; + else if (DebdeltaStatus == Patching) + FileStatus = "patch " + DestFile; + std::cerr << "\n[Debdelta] Failed to " << FileStatus << "." << std::endl; if (Debug) { - std::cerr << "\n[Debdelta] Failed to fetch/patch " << DestFile - << " state: " << DebdeltaStatus << std::endl; std::cerr << "[Debdelta] Message:\n=====================\n" << Message << "\n=====================" << std::endl; } - // TODO: find out what went wrong and display to the user std::cerr << "\n[Debdelta] Queuing the regular deb for downloading..." << std::endl; - - Complete = true; //false; - Status = pkgAcquire::Item::StatDone; //StatError; + // download the regular deb if debdelta failed to download or the patching failed. + Complete = true; // false; + Status = pkgAcquire::Item::StatDone; // StatError; DebdeltaStatus = FetchingFailure; //Item::Failed(Message, Cnf); Dequeue(); - + if (DebdeltaStatus == Patching) // then remove the debdelta file + unlink(DestFile.c_str()); new pkgAcqArchive(Owner, Sources, Recs, Version, StoreFilename); } @@ -2297,7 +2301,7 @@ void pkgAcqDebdelta::Done(string Message,unsigned long Size,string Hash, if (DebdeltaStatus == Patching) { if (Debug) std::cerr << "[Debdelta] Patching Done. Verifying "<< FileName << "..." << std::endl; - // check the hash. TODO: Is this handled by debpatch internally? + // check the hash/size of the patched deb. TODO: Is this handled by debpatch internally? /* if (ExpectedHash.toStr() != Hash) { @@ -2324,9 +2328,10 @@ void pkgAcqDebdelta::Done(string Message,unsigned long Size,string Hash, Status = StatDone; StoreFilename = FileName; Item::Done(Message,Size,Hash,Cnf); + unlink(DestFile.c_str()); return; } - // TODO: Check the sum/size + // TODO: Check the hash/size of the downloaded debdelta. //std::cerr << "[Debdelta] Verifying " << DestFile << std::endl; if (FileName.empty() == true) { diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc index 6d430741f..75e03232a 100644 --- a/apt-pkg/acquire-worker.cc +++ b/apt-pkg/acquire-worker.cc @@ -332,7 +332,6 @@ bool pkgAcquire::Worker::RunMessages() // 400 URI Failure case 400: { - std::cerr <<" 400 URI Failure" << std::endl; if (Itm == 0) { _error->Error("Method gave invalid 400 URI Failure message"); @@ -365,13 +364,11 @@ bool pkgAcquire::Worker::RunMessages() // 401 General Failure case 401: - std::cerr <<" 401 General Failure" << std::endl; _error->Error("Method %s General failure: %s",Access.c_str(),LookupTag(Message,"Message").c_str()); break; // 403 Media Change case 403: - std::cerr <<" 403 Media Change" << std::endl; MediaChange(Message); break; } -- cgit v1.2.3