Skip to content

Commit

Permalink
show item ID in Hit, Ign and Err lines as well
Browse files Browse the repository at this point in the history
Again, consistency is the main sellingpoint here, but this way it is now
also easier to explain that some files move through different stages and
lines are printed for them hence multiple times: That is a bit hard to
believe if the number is changing all the time, but now that it keeps
consistent.
  • Loading branch information
DonKult committed Jun 15, 2015
1 parent ff86d7d commit 1eb1836
Show file tree
Hide file tree
Showing 57 changed files with 618 additions and 422 deletions.
2 changes: 1 addition & 1 deletion apt-pkg/acquire-item.cc
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ class APT_HIDDEN NoActionItem : public pkgAcquire::Item /*{{{*/
// Acquire::Item::Item - Constructor /*{{{*/
APT_IGNORE_DEPRECATED_PUSH
pkgAcquire::Item::Item(pkgAcquire * const Owner) :
FileSize(0), PartialSize(0), Mode(0), Complete(false), Local(false),
FileSize(0), PartialSize(0), Mode(0), ID(0), Complete(false), Local(false),
QueueCounter(0), ExpectedAdditionalItems(0), Owner(Owner)
{
Owner->Add(this);
Expand Down
38 changes: 29 additions & 9 deletions apt-private/acqprogress.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,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 /*{{{*/
// ---------------------------------------------------------------------
/* */
Expand All @@ -57,9 +67,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;
}
Expand All @@ -72,15 +84,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;
Expand All @@ -89,9 +102,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 /*{{{*/
Expand All @@ -106,19 +120,25 @@ void AcqTextStatus::Fail(pkgAcquire::ItemDesc &Itm)
if (Itm.Owner->Status == pkgAcquire::Item::StatIdle)
return;

AssignItemID(Itm);
clearLastLine();

if (Itm.Owner->Status == pkgAcquire::Item::StatDone)
{
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;
Expand Down
3 changes: 2 additions & 1 deletion apt-private/acqprogress.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class APT_PUBLIC AcqTextStatus : public pkgAcquireStatus
unsigned long ID;
unsigned long Quiet;

void clearLastLine();
APT_HIDDEN void clearLastLine();
APT_HIDDEN void AssignItemID(pkgAcquire::ItemDesc &Itm);

public:

Expand Down
12 changes: 8 additions & 4 deletions po/apt-all.pot
Original file line number Diff line number Diff line change
Expand Up @@ -1529,19 +1529,23 @@ msgid "Full Text Search"
msgstr ""

#: apt-private/acqprogress.cc:66
msgid "Hit "
#, c-format
msgid "Hit:%lu %s"
msgstr ""

#: apt-private/acqprogress.cc:88
msgid "Get:"
#, c-format
msgid "Get:%lu %s"
msgstr ""

#: apt-private/acqprogress.cc:119
msgid "Ign "
#, c-format
msgid "Ign:%lu %s"
msgstr ""

#: apt-private/acqprogress.cc:126
msgid "Err "
#, c-format
msgid "Err:%lu %s"
msgstr ""

#: apt-private/acqprogress.cc:150
Expand Down
18 changes: 11 additions & 7 deletions po/ar.po
Original file line number Diff line number Diff line change
Expand Up @@ -1555,20 +1555,24 @@ msgid "Full Text Search"
msgstr ""

#: apt-private/acqprogress.cc:66
msgid "Hit "
#, c-format
msgid "Hit:%lu %s"
msgstr ""

#: apt-private/acqprogress.cc:88
msgid "Get:"
msgstr "جلب:"
#, c-format
msgid "Get:%lu %s"
msgstr "جلب:%lu %s"

#: apt-private/acqprogress.cc:119
msgid "Ign "
msgstr "تجاهل"
#, c-format
msgid "Ign:%lu %s"
msgstr "تجاهل:%lu %s"

#: apt-private/acqprogress.cc:126
msgid "Err "
msgstr "خطأ"
#, c-format
msgid "Err:%lu %s"
msgstr "خطأ:%lu %s"

#: apt-private/acqprogress.cc:150
#, c-format
Expand Down
20 changes: 12 additions & 8 deletions po/ast.po
Original file line number Diff line number Diff line change
Expand Up @@ -1684,20 +1684,24 @@ msgid "Full Text Search"
msgstr ""

#: apt-private/acqprogress.cc:66
msgid "Hit "
msgstr "Oxe "
#, c-format
msgid "Hit:%lu %s"
msgstr "Oxe:%lu %s"

#: apt-private/acqprogress.cc:88
msgid "Get:"
msgstr "Des:"
#, c-format
msgid "Get:%lu %s"
msgstr "Des:%lu %s"

#: apt-private/acqprogress.cc:119
msgid "Ign "
msgstr "Ign "
#, c-format
msgid "Ign:%lu %s"
msgstr ""

#: apt-private/acqprogress.cc:126
msgid "Err "
msgstr "Err "
#, c-format
msgid "Err:%lu %s"
msgstr ""

#: apt-private/acqprogress.cc:150
#, c-format
Expand Down
20 changes: 12 additions & 8 deletions po/bg.po
Original file line number Diff line number Diff line change
Expand Up @@ -1720,20 +1720,24 @@ msgid "Full Text Search"
msgstr ""

#: apt-private/acqprogress.cc:66
msgid "Hit "
msgstr "Поп "
#, c-format
msgid "Hit:%lu %s"
msgstr "Поп:%lu %s"

#: apt-private/acqprogress.cc:88
msgid "Get:"
msgstr "Изт:"
#, c-format
msgid "Get:%lu %s"
msgstr "Изт:%lu %s"

#: apt-private/acqprogress.cc:119
msgid "Ign "
msgstr "Игн "
#, c-format
msgid "Ign:%lu %s"
msgstr "Игн:%lu %s"

#: apt-private/acqprogress.cc:126
msgid "Err "
msgstr "Грш "
#, c-format
msgid "Err:%lu %s"
msgstr "Грш:%lu %s"

#: apt-private/acqprogress.cc:150
#, c-format
Expand Down
8 changes: 4 additions & 4 deletions po/bs.po
Original file line number Diff line number Diff line change
Expand Up @@ -1555,19 +1555,19 @@ msgid "Full Text Search"
msgstr ""

#: apt-private/acqprogress.cc:66
msgid "Hit "
msgid "Hit:%lu %s"
msgstr ""

#: apt-private/acqprogress.cc:88
msgid "Get:"
msgid "Get:%lu %s"
msgstr ""

#: apt-private/acqprogress.cc:119
msgid "Ign "
msgid "Ign:%lu %s"
msgstr ""

#: apt-private/acqprogress.cc:126
msgid "Err "
msgid "Err:%lu %s"
msgstr ""

#: apt-private/acqprogress.cc:150
Expand Down
20 changes: 12 additions & 8 deletions po/ca.po
Original file line number Diff line number Diff line change
Expand Up @@ -1708,20 +1708,24 @@ msgid "Full Text Search"
msgstr ""

#: apt-private/acqprogress.cc:66
msgid "Hit "
msgstr "Obj "
#, c-format
msgid "Hit:%lu %s"
msgstr "Obj:%lu %s"

#: apt-private/acqprogress.cc:88
msgid "Get:"
msgstr "Bai:"
#, c-format
msgid "Get:%lu %s"
msgstr "Bai:%lu %s"

#: apt-private/acqprogress.cc:119
msgid "Ign "
msgstr "Ign "
#, c-format
msgid "Ign:%lu %s"
msgstr ""

#: apt-private/acqprogress.cc:126
msgid "Err "
msgstr "Err "
#, c-format
msgid "Err:%lu %s"
msgstr ""

#: apt-private/acqprogress.cc:150
#, c-format
Expand Down
20 changes: 12 additions & 8 deletions po/cs.po
Original file line number Diff line number Diff line change
Expand Up @@ -1734,20 +1734,24 @@ msgid "Full Text Search"
msgstr "Fulltextové hledání"

#: apt-private/acqprogress.cc:66
msgid "Hit "
msgstr "Cíl "
#, c-format
msgid "Hit:%lu %s"
msgstr "Cíl:%lu %s"

#: apt-private/acqprogress.cc:88
msgid "Get:"
msgstr "Mám:"
#, c-format
msgid "Get:%lu %s"
msgstr "Mám:%lu %s"

#: apt-private/acqprogress.cc:119
msgid "Ign "
msgstr "Ign "
#, c-format
msgid "Ign:%lu %s"
msgstr ""

#: apt-private/acqprogress.cc:126
msgid "Err "
msgstr "Err "
#, c-format
msgid "Err:%lu %s"
msgstr ""

#: apt-private/acqprogress.cc:150
#, c-format
Expand Down
20 changes: 12 additions & 8 deletions po/cy.po
Original file line number Diff line number Diff line change
Expand Up @@ -1706,20 +1706,24 @@ msgid "Full Text Search"
msgstr ""

#: apt-private/acqprogress.cc:66
msgid "Hit "
msgstr "Presennol "
#, c-format
msgid "Hit:%lu %s"
msgstr "Presennol:%lu %s"

#: apt-private/acqprogress.cc:88
msgid "Get:"
msgstr "Cyrchu:"
#, c-format
msgid "Get:%lu %s"
msgstr "Cyrchu:%lu %s"

#: apt-private/acqprogress.cc:119
msgid "Ign "
msgstr "Anwybyddu "
#, c-format
msgid "Ign:%lu %s"
msgstr "Anwybyddu:%lu %s"

#: apt-private/acqprogress.cc:126
msgid "Err "
msgstr "Gwall "
#, c-format
msgid "Err:%lu %s"
msgstr "Gwall:%lu %s"

#: apt-private/acqprogress.cc:150
#, c-format
Expand Down
20 changes: 12 additions & 8 deletions po/da.po
Original file line number Diff line number Diff line change
Expand Up @@ -1749,20 +1749,24 @@ msgid "Full Text Search"
msgstr "Fuldtekst-søgning"

#: apt-private/acqprogress.cc:66
msgid "Hit "
msgstr "Havde "
#, c-format
msgid "Hit:%lu %s"
msgstr "Havde:%lu %s"

#: apt-private/acqprogress.cc:88
msgid "Get:"
msgstr "Henter:"
#, c-format
msgid "Get:%lu %s"
msgstr "Henter:%lu %s"

#: apt-private/acqprogress.cc:119
msgid "Ign "
msgstr "Ignorerer "
#, c-format
msgid "Ign:%lu %s"
msgstr "Ignorerer:%lu %s"

#: apt-private/acqprogress.cc:126
msgid "Err "
msgstr "Fejl "
#, c-format
msgid "Err:%lu %s"
msgstr "Fejl:%lu %s"

#: apt-private/acqprogress.cc:150
#, c-format
Expand Down
Loading

0 comments on commit 1eb1836

Please sign in to comment.