X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/dfad5beea77d75983f6ff8a1b8296b74dd48203e..0327b790d40e59e1e35c6ed841308aaebbde8697:/apt-private/acqprogress.cc?ds=sidebyside diff --git a/apt-private/acqprogress.cc b/apt-private/acqprogress.cc index 0c606e48e..a33d51c71 100644 --- a/apt-private/acqprogress.cc +++ b/apt-private/acqprogress.cc @@ -37,6 +37,8 @@ AcqTextStatus::AcqTextStatus(std::ostream &out, unsigned int &ScreenWidth,unsign // testcases use it to disable pulses without disabling other user messages if (Quiet == 0 && _config->FindB("quiet::NoUpdate", false) == true) this->Quiet = 1; + if (Quiet < 2 && _config->FindB("quiet::NoProgress", false) == true) + this->Quiet = 2; } /*}}}*/ // AcqTextStatus::Start - Downloading has started /*{{{*/ @@ -49,6 +51,16 @@ void AcqTextStatus::Start() ID = 1; } /*}}}*/ +void AcqTextStatus::AssignItemID(pkgAcquire::ItemDesc &Itm) /*{{{*/ +{ + /* In theory calling it from Fetch() would be enough, but to be + safe we call it from IMSHit and Fail as well. + Also, an Item can pass through multiple stages, so ensure + that it keeps the same number */ + if (Itm.Owner->ID == 0) + Itm.Owner->ID = ID++; +} + /*}}}*/ // AcqTextStatus::IMSHit - Called when an item got a HIT response /*{{{*/ // --------------------------------------------------------------------- /* */ @@ -57,9 +69,11 @@ void AcqTextStatus::IMSHit(pkgAcquire::ItemDesc &Itm) if (Quiet > 1) return; + AssignItemID(Itm); clearLastLine(); - out << _("Hit ") << Itm.Description; + // TRANSLATOR: Very short word to be displayed before unchanged files in 'apt-get update' + ioprintf(out, _("Hit:%lu %s"), Itm.Owner->ID, Itm.Description.c_str()); out << std::endl; Update = true; } @@ -72,15 +86,16 @@ void AcqTextStatus::Fetch(pkgAcquire::ItemDesc &Itm) Update = true; if (Itm.Owner->Complete == true) return; - - Itm.Owner->ID = ID++; + AssignItemID(Itm); if (Quiet > 1) return; clearLastLine(); - out << _("Get:") << Itm.Owner->ID << ' ' << Itm.Description; + // TRANSLATOR: Very short word to be displayed for files processed in 'apt-get update' + // Potentially replaced later by "Hit:", "Ign:" or "Err:" if something (bad) happens + ioprintf(out, _("Get:%lu %s"), Itm.Owner->ID, Itm.Description.c_str()); if (Itm.Owner->FileSize != 0) out << " [" << SizeToStr(Itm.Owner->FileSize) << "B]"; out << std::endl; @@ -89,9 +104,10 @@ void AcqTextStatus::Fetch(pkgAcquire::ItemDesc &Itm) // AcqTextStatus::Done - Completed a download /*{{{*/ // --------------------------------------------------------------------- /* We don't display anything... */ -void AcqTextStatus::Done(pkgAcquire::ItemDesc &/*Itm*/) +void AcqTextStatus::Done(pkgAcquire::ItemDesc &Itm) { Update = true; + AssignItemID(Itm); } /*}}}*/ // AcqTextStatus::Fail - Called when an item fails to download /*{{{*/ @@ -102,23 +118,25 @@ void AcqTextStatus::Fail(pkgAcquire::ItemDesc &Itm) if (Quiet > 1) return; - // Ignore certain kinds of transient failures (bad code) - if (Itm.Owner->Status == pkgAcquire::Item::StatIdle) - return; - + AssignItemID(Itm); clearLastLine(); - if (Itm.Owner->Status == pkgAcquire::Item::StatDone) + if (Itm.Owner->Status == pkgAcquire::Item::StatDone || Itm.Owner->Status == pkgAcquire::Item::StatIdle) { - out << _("Ign ") << Itm.Description << std::endl; + // TRANSLATOR: Very short word to be displayed for files in 'apt-get update' + // which failed to download, but the error is ignored (compare "Err:") + ioprintf(out, _("Ign:%lu %s"), Itm.Owner->ID, Itm.Description.c_str()); if (Itm.Owner->ErrorText.empty() == false && _config->FindB("Acquire::Progress::Ignore::ShowErrorText", false) == true) - out << " " << Itm.Owner->ErrorText << std::endl; + out << std::endl << " " << Itm.Owner->ErrorText; + out << std::endl; } else { - out << _("Err ") << Itm.Description << std::endl; - out << " " << Itm.Owner->ErrorText << std::endl; + // TRANSLATOR: Very short word to be displayed for files in 'apt-get update' + // which failed to download and the error is critical (compare "Ign:") + ioprintf(out, _("Err:%lu %s"), Itm.Owner->ID, Itm.Description.c_str()); + out << std::endl << " " << Itm.Owner->ErrorText << std::endl; } Update = true; @@ -158,8 +176,6 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) if (Quiet > 0) return true; - enum {Long = 0,Medium,Short} Mode = Medium; - std::string Line; { std::stringstream S; @@ -185,6 +201,7 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner) if (I->CurrentItem->Owner->ActiveSubprocess.empty() == false) S << " " << I->CurrentItem->Owner->ActiveSubprocess; + enum {Long = 0,Medium,Short} Mode = Medium; // Add the current progress if (Mode == Long) S << " " << I->CurrentSize; @@ -280,7 +297,7 @@ bool AcqTextStatus::MediaChange(std::string Media, std::string Drive) clearLastLine(); ioprintf(out,_("Media change: please insert the disc labeled\n" " '%s'\n" - "in the drive '%s' and press enter\n"), + "in the drive '%s' and press [Enter]\n"), Media.c_str(),Drive.c_str()); char C = 0;