From cb6a2b3eaca4353d7f490fb360b98c08d64a2d8c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 14 Jan 2013 07:09:51 +0100 Subject: first iteration that adds support for checksums-{sha512,sha256} --- apt-pkg/srcrecords.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg/srcrecords.h') diff --git a/apt-pkg/srcrecords.h b/apt-pkg/srcrecords.h index ed69d0d72..7cb490079 100644 --- a/apt-pkg/srcrecords.h +++ b/apt-pkg/srcrecords.h @@ -31,7 +31,7 @@ class pkgSrcRecords // Describes a single file struct File { - std::string MD5Hash; + std::string Hash; unsigned long Size; std::string Path; std::string Type; -- cgit v1.2.3 From a1b5561a036ebbe416cccfb2bd476a838ddb6286 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 28 Feb 2013 18:28:44 +0100 Subject: re-add compat pkgSrcRecords::File::MD5Hash --- apt-pkg/srcrecords.h | 1 + 1 file changed, 1 insertion(+) (limited to 'apt-pkg/srcrecords.h') diff --git a/apt-pkg/srcrecords.h b/apt-pkg/srcrecords.h index 7cb490079..796d2e1bd 100644 --- a/apt-pkg/srcrecords.h +++ b/apt-pkg/srcrecords.h @@ -31,6 +31,7 @@ class pkgSrcRecords // Describes a single file struct File { + std::string MD5Hash; std::string Hash; unsigned long Size; std::string Path; -- cgit v1.2.3 From 1262d35895c930f3fa49d7b4182cdd7a4a841f74 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 18 Aug 2013 23:27:24 +0200 Subject: 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. LP: 1098738 --- apt-pkg/srcrecords.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'apt-pkg/srcrecords.h') diff --git a/apt-pkg/srcrecords.h b/apt-pkg/srcrecords.h index 58a5e242f..69b3cfd99 100644 --- a/apt-pkg/srcrecords.h +++ b/apt-pkg/srcrecords.h @@ -14,6 +14,7 @@ #define PKGLIB_SRCRECORDS_H #include +#include #include #include @@ -29,16 +30,24 @@ 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; - std::string Hash; - unsigned long Size; std::string Path; std::string Type; + unsigned long long Size; + HashStringList Hashes; + APT_DEPRECATED std::string MD5Hash; }; - +#if __GNUC__ >= 4 + #pragma GCC diagnostic pop +#endif + // Abstract parser for each source record class Parser { -- cgit v1.2.3 From 462557017a0d8be321ca7d3eb96072f4db6a92ec Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 9 Jun 2014 09:06:07 +0200 Subject: add pkgSrcRecords::Next() to step through all the pkgSrcRecords --- apt-pkg/srcrecords.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'apt-pkg/srcrecords.h') diff --git a/apt-pkg/srcrecords.h b/apt-pkg/srcrecords.h index 9915debfe..82460d70f 100644 --- a/apt-pkg/srcrecords.h +++ b/apt-pkg/srcrecords.h @@ -95,8 +95,13 @@ class pkgSrcRecords // Reset the search bool Restart(); - // Locate a package by name - Parser *Find(const char *Package,bool const &SrcOnly = false); + // Step to the next SourcePackage and return pointer to the + // next SourceRecord. The pointer is owned by libapt. + const Parser* Next(); + + // Locate a package by name and return pointer to the Parser. + // The pointer is owned by libapt. + Parser* Find(const char *Package,bool const &SrcOnly = false); pkgSrcRecords(pkgSourceList &List); virtual ~pkgSrcRecords(); -- cgit v1.2.3 From 401e5db12dd71ed84e8d17a559ff5932c1b98367 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 10 Jun 2014 15:07:15 +0200 Subject: use pkgSrcRecords::Step() instead of Next() --- apt-pkg/srcrecords.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg/srcrecords.h') diff --git a/apt-pkg/srcrecords.h b/apt-pkg/srcrecords.h index 82460d70f..e000e176a 100644 --- a/apt-pkg/srcrecords.h +++ b/apt-pkg/srcrecords.h @@ -97,7 +97,7 @@ class pkgSrcRecords // Step to the next SourcePackage and return pointer to the // next SourceRecord. The pointer is owned by libapt. - const Parser* Next(); + const Parser* Step(); // Locate a package by name and return pointer to the Parser. // The pointer is owned by libapt. -- cgit v1.2.3 From 586d8704716a10e0f8b9c400cab500f5353eebe6 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 26 Oct 2014 23:17:03 +0100 Subject: replace ignore-deprecated #pragma dance with _Pragma For compatibility we use/provide and fill quiet some deprecated methods and fields, which subsequently earns us a warning for using them. These warnings therefore have to be disabled for these codeparts and that is what this change does now in a slightly more elegant way. Git-Dch: Ignore --- apt-pkg/srcrecords.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'apt-pkg/srcrecords.h') diff --git a/apt-pkg/srcrecords.h b/apt-pkg/srcrecords.h index c68d374bb..de2b6ff64 100644 --- a/apt-pkg/srcrecords.h +++ b/apt-pkg/srcrecords.h @@ -30,11 +30,7 @@ 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 +APT_IGNORE_DEPRECATED_PUSH // Describes a single file struct File { @@ -44,9 +40,7 @@ class pkgSrcRecords HashStringList Hashes; APT_DEPRECATED std::string MD5Hash; }; -#if __GNUC__ >= 4 - #pragma GCC diagnostic pop -#endif +APT_IGNORE_DEPRECATED_POP // Abstract parser for each source record class Parser -- cgit v1.2.3 From 3a2b39ee602dd5a98b8fdaee2f1c8e0b13a276e2 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 18 Aug 2013 23:27:24 +0200 Subject: 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 --- apt-pkg/srcrecords.h | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'apt-pkg/srcrecords.h') 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 +#include #include #include @@ -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 &F) = 0; + bool Files2(std::vector &F); Parser(const pkgIndexFile *Index) : iIndex(Index) {}; virtual ~Parser() {}; -- cgit v1.2.3