]> git.saurik.com Git - apt.git/blobdiff - apt-private/acqprogress.cc
Only check for valid Date if checking Valid-Until.
[apt.git] / apt-private / acqprogress.cc
index f6c3d1204ac8feab6441b0634ab0e7bbdbc084ff..e4bfbd4e5b44372d30573cc85c24fc73ff4ca5fd 100644 (file)
@@ -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                      /*{{{*/
@@ -119,24 +121,40 @@ void AcqTextStatus::Fail(pkgAcquire::ItemDesc &Itm)
    AssignItemID(Itm);
    clearLastLine();
 
+   bool ShowErrorText = true;
    if (Itm.Owner->Status == pkgAcquire::Item::StatDone || Itm.Owner->Status == pkgAcquire::Item::StatIdle)
    {
       // 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 << std::endl << "  " << Itm.Owner->ErrorText;
-      out << std::endl;
+      if (Itm.Owner->ErrorText.empty() ||
+           _config->FindB("Acquire::Progress::Ignore::ShowErrorText", false) == false)
+        ShowErrorText = false;
    }
    else
    {
       // 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;
    }
 
+   if (ShowErrorText)
+   {
+      std::string::size_type line_start = 0;
+      std::string::size_type line_end;
+      while ((line_end = Itm.Owner->ErrorText.find_first_of("\n\r", line_start)) != std::string::npos) {
+        out << std::endl << "  " << Itm.Owner->ErrorText.substr(line_start, line_end - line_start);
+        line_start = Itm.Owner->ErrorText.find_first_not_of("\n\r", line_end + 1);
+        if (line_start == std::string::npos)
+           break;
+      }
+      if (line_start == 0)
+        out << std::endl << "  " << Itm.Owner->ErrorText;
+      else if (line_start != std::string::npos)
+        out << std::endl << "  " << Itm.Owner->ErrorText.substr(line_start);
+   }
+   out << std::endl;
+
    Update = true;
 }
                                                                        /*}}}*/
@@ -174,8 +192,6 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
    if (Quiet > 0)
       return true;
 
-   enum {Long = 0,Medium,Short} Mode = Medium;
-
    std::string Line;
    {
       std::stringstream S;
@@ -194,16 +210,17 @@ bool AcqTextStatus::Pulse(pkgAcquire *Owner)
         // Add in the short description
         S << " [";
         if (I->CurrentItem->Owner->ID != 0)
-           S << I->CurrentItem->Owner->ID << " ";
+           S << std::to_string(I->CurrentItem->Owner->ID) << " ";
         S << I->CurrentItem->ShortDesc;
 
         // Show the short mode string
         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;
+           S << " " << std::to_string(I->CurrentSize);
         else
         {
            if (Mode == Medium || I->TotalSize == 0)
@@ -296,7 +313,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;