summaryrefslogtreecommitdiff
path: root/apt-pkg/acquire-item.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-11-09 23:32:02 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2016-11-09 23:32:02 +0100
commit28ee7f19b865c32ce1b03cc0afa26983a0208693 (patch)
tree7ecb081440b2b0d7e344250b9c351816ea580897 /apt-pkg/acquire-item.cc
parentd96c997ebeab76f690564fc1c93a35b1a885adf5 (diff)
rename Checksum-FileSize to Filesize in hashsum mismatch
Some people do not recognize the field value with such an arcane name and/or expect it to refer to something different (e.g. #839257). We can't just rename it internally as its an avoidance strategy as such fieldname existed previously with less clear semantics, but we can spare the general public from this implementation detail.
Diffstat (limited to 'apt-pkg/acquire-item.cc')
-rw-r--r--apt-pkg/acquire-item.cc31
1 files changed, 17 insertions, 14 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 9c6f85093..163743ce0 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -748,6 +748,18 @@ APT_CONST bool pkgAcquire::Item::IsTrusted() const /*{{{*/
// ---------------------------------------------------------------------
/* We return to an idle state if there are still other queues that could
fetch this object */
+static void formatHashsum(std::ostream &out, HashString const &hs)
+{
+ auto const type = hs.HashType();
+ if (type == "Checksum-FileSize")
+ out << " - Filesize";
+ else
+ out << " - " << type;
+ out << ':' << hs.HashValue();
+ if (hs.usable() == false)
+ out << " [weak]";
+ out << std::endl;
+}
void pkgAcquire::Item::Failed(string const &Message,pkgAcquire::MethodConfig const * const Cnf)
{
if (QueueCounter <= 1)
@@ -819,12 +831,7 @@ void pkgAcquire::Item::Failed(string const &Message,pkgAcquire::MethodConfig con
{
out << "Hashes of expected file:" << std::endl;
for (auto const &hs: ExpectedHashes)
- {
- out << " - " << hs.toStr();
- if (hs.usable() == false)
- out << " [weak]";
- out << std::endl;
- }
+ formatHashsum(out, hs);
}
if (failreason == HASHSUM_MISMATCH)
{
@@ -834,16 +841,12 @@ void pkgAcquire::Item::Failed(string const &Message,pkgAcquire::MethodConfig con
std::string const tagname = std::string(*type) + "-Hash";
std::string const hashsum = LookupTag(Message, tagname.c_str());
if (hashsum.empty() == false)
- {
- auto const hs = HashString(*type, hashsum);
- out << " - " << hs.toStr();
- if (hs.usable() == false)
- out << " [weak]";
- out << std::endl;
- }
+ formatHashsum(out, HashString(*type, hashsum));
}
- out << "Last modification reported: " << LookupTag(Message, "Last-Modified", "<none>") << std::endl;
}
+ auto const lastmod = LookupTag(Message, "Last-Modified", "");
+ if (lastmod.empty() == false)
+ out << "Last modification reported: " << lastmod << std::endl;
}
ErrorText = out.str();
}