diff options
author | Ishan Jayawardena <udeshike@gmail.com> | 2011-07-19 19:56:31 +0530 |
---|---|---|
committer | Ishan Jayawardena <udeshike@gmail.com> | 2011-07-19 19:56:31 +0530 |
commit | a70fc3877bacf483b034b40dc2c288a26436ceb8 (patch) | |
tree | 4454a65854f9639fc5bcbbea36ca1b631ed83b5e /apt-pkg | |
parent | 8a8ea4baa11f07e1de4cf190f82dbd79ff1affa5 (diff) |
redirected the stdout, stderr of debpatch to not to interfere apt's communication line with debdelta method. Storing the output of them as a string.
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/acquire-item.cc | 47 | ||||
-rw-r--r-- | apt-pkg/acquire-worker.cc | 6 | ||||
-rw-r--r-- | apt-pkg/acquire.cc | 7 |
3 files changed, 37 insertions, 23 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index b85e5d19b..0f7f7c00e 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -2136,7 +2136,8 @@ pkgAcqDebdelta::pkgAcqDebdelta(pkgAcquire *Owner,pkgSourceList *Sources, // priority than authenticated http:// uris if (_config->FindB("APT::Get::AllowUnauthenticated",false) == true) Trusted = false; - if (Debug) { + if (Debug) + { std::cerr << "\n[Debdelta] pkgAcqDebdelta::pkgAcqDebdelta()" << std::endl; std::cerr << " DebdeltaName : " << DebdeltaName << std::endl; std::cerr << " StoreFilename: " << StoreFilename << std::endl; @@ -2243,7 +2244,8 @@ bool pkgAcqDebdelta::QueueNext() Desc.Description = "[Debdelta] " + Index->ArchiveInfo(Version); Desc.Owner = this; Desc.ShortDesc = "[Debdelta] " + string(Version.ParentPkg().Name()); - if (Debug) { + if (Debug) + { std::cerr << "[Debdelta] pkgAcqDebdelta::QueueNext()" << std::endl; std::cerr << " DestFile : " << DestFile << std::endl; std::cerr << " Desc.URI : " << Desc.URI << std::endl; @@ -2258,17 +2260,23 @@ bool pkgAcqDebdelta::QueueNext() void pkgAcqDebdelta::Failed(string Message,pkgAcquire::MethodConfig *Cnf) { - if (Debug) { - std::cerr << "\n[Debdelta] Failed to download " << Desc.URI << std::endl; - std::cerr << "[Debdelta] Message:\n" << Message << 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 - new pkgAcqArchive(Owner, Sources, Recs, Version, StoreFilename); - Complete = false; - Status = StatError; + std::cerr << "\n[Debdelta] Queuing the regular deb for downloading..." << std::endl; + + Complete = true; //false; + Status = pkgAcquire::Item::StatDone; //StatError; DebdeltaStatus = FetchingFailure; - Item::Failed(Message, Cnf); + //Item::Failed(Message, Cnf); Dequeue(); + + new pkgAcqArchive(Owner, Sources, Recs, Version, StoreFilename); } void pkgAcqDebdelta::Done(string Message,unsigned long Size,string Hash, @@ -2276,10 +2284,11 @@ void pkgAcqDebdelta::Done(string Message,unsigned long Size,string Hash, { // TODO: there must be two stages within this method. // one for downloading debdelta. another for verifying the resulting .deb - if (Debug) std::cerr << "[Debdelta] pkgAcqDebdelta::Done() state: " << DebdeltaStatus << std::endl; + if (Debug) std::cerr << "\n\n[Debdelta] pkgAcqDebdelta::Done() state: " << DebdeltaStatus << std::endl; // Grab the output filename string FileName = LookupTag(Message,"Filename"); - if (Debug) { + if (Debug) + { std::cerr << " StoreFileName: " << StoreFilename << "\n DestFile : " << DestFile << "\n Desc.URI : " << Desc.URI @@ -2288,22 +2297,28 @@ 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? + /* if (ExpectedHash.toStr() != Hash) { Status = StatError; ErrorText = _("[Debdelta] Hash Sum mismatch"); - if(FileExists(DestFile)) - if (!Local) - Rename(DestFile, DestFile + ".FAILED"); - //return; // TODO: UNCOMMENT + // if(FileExists(DestFile)) + // if (!Local) + // Rename(DestFile, DestFile + ".FAILED"); + std::cerr << "[Debdelta] Hash Sum mismatch" << std::endl; + std::cerr << " expected: " << ExpectedHash.toStr() << std::endl; + std::cerr << " hash : " << Hash << std::endl; + // return; // TODO: UNCOMMENT } // Check the size if (Size != Version->Size) { Status = StatError; ErrorText = _("[Debdelta] Size mismatch"); + std::cerr << "[Debdelta] Size mismatch" << std::endl; //return; // TODO: UNCOMMEnT - } + } */ DebdeltaStatus = Completed; Complete = true; Status = StatDone; diff --git a/apt-pkg/acquire-worker.cc b/apt-pkg/acquire-worker.cc index 1a17dfa5c..6d430741f 100644 --- a/apt-pkg/acquire-worker.cc +++ b/apt-pkg/acquire-worker.cc @@ -332,7 +332,7 @@ bool pkgAcquire::Worker::RunMessages() // 400 URI Failure case 400: { - std::cerr <<" 400 URI Failure" << std::endl; + std::cerr <<" 400 URI Failure" << std::endl; if (Itm == 0) { _error->Error("Method gave invalid 400 URI Failure message"); @@ -365,13 +365,13 @@ bool pkgAcquire::Worker::RunMessages() // 401 General Failure case 401: - std::cerr <<" 401 General Failure" << std::endl; + 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; + std::cerr <<" 403 Media Change" << std::endl; MediaChange(Message); break; } diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 7596aa956..9478cdfb4 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -228,10 +228,9 @@ void pkgAcquire::Enqueue(ItemDesc &Item) // Some trace stuff if (Debug == true) { - clog << "pkgAcquire::Enqueue()" << endl; - clog << " Fetching " << Item.URI << endl; - clog << " to " << Item.Owner->DestFile << endl; - clog << " Queue is: " << Name << endl; + clog << "Fetching " << Item.URI << endl; + clog << " to " << Item.Owner->DestFile << endl; + clog << " Queue is: " << Name << endl; } } /*}}}*/ |