From b3501edb7091ca3aa6c2d6d96dc667b8161dd2b9 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 19 Aug 2013 00:00:23 +0200 Subject: use HashStringList in the acquire system It is not very extensible to have the supported Hashes hardcoded everywhere and especially if it is part of virtual method names. It is also possible that a method does not support the 'best' hash (yet), so we might end up not being able to verify a file even though we have a common subset of supported hashes. And those are just two of the cases in which it is handy to have a more dynamic selection. The downside is that this is a MAJOR API break, but the HashStringList has a string constructor for compatibility, so with a bit of luck the few frontends playing with the acquire system directly are okay. --- apt-pkg/acquire-method.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'apt-pkg/acquire-method.h') diff --git a/apt-pkg/acquire-method.h b/apt-pkg/acquire-method.h index 221ccf273..8a17a5fd5 100644 --- a/apt-pkg/acquire-method.h +++ b/apt-pkg/acquire-method.h @@ -20,6 +20,7 @@ #ifndef PKGLIB_ACQUIRE_METHOD_H #define PKGLIB_ACQUIRE_METHOD_H +#include #include #include @@ -33,7 +34,6 @@ #include #endif -class Hashes; class pkgAcqMethod { protected: @@ -51,10 +51,7 @@ class pkgAcqMethod struct FetchResult { - std::string MD5Sum; - std::string SHA1Sum; - std::string SHA256Sum; - std::string SHA512Sum; + HashStringList Hashes; std::vector GPGVOutput; time_t LastModified; bool IMSHit; @@ -62,7 +59,7 @@ class pkgAcqMethod unsigned long long Size; unsigned long long ResumePoint; - void TakeHashes(Hashes &Hash); + void TakeHashes(class Hashes &Hash); FetchResult(); }; -- cgit v1.2.3 From d003a557a516e3063de3190950e911c61c3dd53e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 27 Apr 2014 23:02:00 +0200 Subject: tell download methods the expected hashes Now that we have all hashes in the acquire system, pass the info down to the methods, so that it can use it in the request and/or to precheck the response. --- apt-pkg/acquire-method.h | 1 + 1 file changed, 1 insertion(+) (limited to 'apt-pkg/acquire-method.h') diff --git a/apt-pkg/acquire-method.h b/apt-pkg/acquire-method.h index 8a17a5fd5..cbf79f860 100644 --- a/apt-pkg/acquire-method.h +++ b/apt-pkg/acquire-method.h @@ -47,6 +47,7 @@ class pkgAcqMethod time_t LastModified; bool IndexFile; bool FailIgnore; + HashStringList ExpectedHashes; }; struct FetchResult -- cgit v1.2.3