summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/hashes.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-06-08 00:06:41 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2015-06-09 12:57:36 +0200
commit4f51fd8636592a96aecf17c8bf4cfdb3ea2207cc (patch)
tree0510ab4c8b6a78fe15798d5cac4455e4c0ae5178 /apt-pkg/contrib/hashes.cc
parentfec55559451dc1c440c4770ee3faa116522fc59c (diff)
support hashes for compressed pdiff files
At the moment we only have hashes for the uncompressed pdiff files, but via the new '$HASH-Download' field in the .diff/Index hashes can be provided for the .gz compressed pdiff file, which apt will pick up now and use to verify the download. Now, we "just" need a buy in from the creators of repositories…
Diffstat (limited to 'apt-pkg/contrib/hashes.cc')
-rw-r--r--apt-pkg/contrib/hashes.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/apt-pkg/contrib/hashes.cc b/apt-pkg/contrib/hashes.cc
index 11a7e479b..46cf0ba08 100644
--- a/apt-pkg/contrib/hashes.cc
+++ b/apt-pkg/contrib/hashes.cc
@@ -188,6 +188,13 @@ unsigned long long HashStringList::FileSize() const /*{{{*/
return strtoull(hv.c_str(), NULL, 10);
}
/*}}}*/
+bool HashStringList::FileSize(unsigned long long const Size) /*{{{*/
+{
+ std::string size;
+ strprintf(size, "%llu", Size);
+ return push_back(HashString("Checksum-FileSize", size));
+}
+ /*}}}*/
bool HashStringList::supported(char const * const type) /*{{{*/
{
for (char const * const * t = HashString::SupportedHashes(); *t != NULL; ++t)
@@ -361,9 +368,7 @@ APT_IGNORE_DEPRECATED_PUSH
if ((d->CalcHashes & SHA512SUM) == SHA512SUM)
hashes.push_back(HashString("SHA512", SHA512.Result().Value()));
APT_IGNORE_DEPRECATED_POP
- std::string SizeStr;
- strprintf(SizeStr, "%llu", d->FileSize);
- hashes.push_back(HashString("Checksum-FileSize", SizeStr));
+ hashes.FileSize(d->FileSize);
return hashes;
}
APT_IGNORE_DEPRECATED_PUSH