summaryrefslogtreecommitdiff
path: root/apt-pkg/srcrecords.h
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2013-08-18 23:27:24 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2014-11-10 17:23:29 +0100
commit3a2b39ee602dd5a98b8fdaee2f1c8e0b13a276e2 (patch)
treec825fbd73efde59e405d3088361ea1771f095c02 /apt-pkg/srcrecords.h
parent3f439e2b7126fb82952cd7bc12b8d6cb01352219 (diff)
use 'best' hash for source authentication
Collect all hashes we can get from the source record and put them into a HashStringList so that 'apt-get source' can use it instead of using always the MD5sum. We therefore also deprecate the MD5 struct member in favor of the list. While at it, the parsing of the Files is enhanced so that records which miss "Files" (aka MD5 checksums) are still searched for other checksums as they include just as much data, just not with a nice and catchy name. This is a cherry-pick of 1262d35 with some dirty tricks to preserve ABI. LP: 1098738
Diffstat (limited to 'apt-pkg/srcrecords.h')
-rw-r--r--apt-pkg/srcrecords.h21
1 files changed, 18 insertions, 3 deletions
diff --git a/apt-pkg/srcrecords.h b/apt-pkg/srcrecords.h
index e000e176a..dde22bd65 100644
--- a/apt-pkg/srcrecords.h
+++ b/apt-pkg/srcrecords.h
@@ -14,6 +14,7 @@
#define PKGLIB_SRCRECORDS_H
#include <apt-pkg/macros.h>
+#include <apt-pkg/hashes.h>
#include <string>
#include <vector>
@@ -29,15 +30,28 @@ class pkgSrcRecords
{
public:
+#if __GNUC__ >= 4
+ // ensure that con- & de-structor don't trigger this warning
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
// Describes a single file
struct File
{
- std::string MD5Hash;
- unsigned long Size;
+ APT_DEPRECATED std::string MD5Hash;
+ APT_DEPRECATED unsigned long Size;
std::string Path;
std::string Type;
};
-
+ struct File2 : public File
+ {
+ unsigned long long FileSize;
+ HashStringList Hashes;
+ };
+#if __GNUC__ >= 4
+ #pragma GCC diagnostic pop
+#endif
+
// Abstract parser for each source record
class Parser
{
@@ -77,6 +91,7 @@ class pkgSrcRecords
static const char *BuildDepType(unsigned char const &Type) APT_PURE;
virtual bool Files(std::vector<pkgSrcRecords::File> &F) = 0;
+ bool Files2(std::vector<pkgSrcRecords::File2> &F);
Parser(const pkgIndexFile *Index) : iIndex(Index) {};
virtual ~Parser() {};