From 0d29b9d4368284782862c7b507c47002b79ddb27 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Sat, 26 Apr 2014 00:00:51 +0200 Subject: WIP local deb install --- apt-pkg/deb/debrecords.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'apt-pkg/deb/debrecords.h') diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h index bdac6c90b..d572bc5c2 100644 --- a/apt-pkg/deb/debrecords.h +++ b/apt-pkg/deb/debrecords.h @@ -29,17 +29,16 @@ class debRecordParser : public pkgRecords::Parser { /** \brief dpointer placeholder (for later in case we need it) */ void *d; - + + protected: FileFd File; pkgTagFile Tags; pkgTagSection Section; - protected: - virtual bool Jump(pkgCache::VerFileIterator const &Ver); virtual bool Jump(pkgCache::DescFileIterator const &Desc); - public: + public: // These refer to the archive file for the Version virtual std::string FileName(); @@ -66,4 +65,15 @@ class debRecordParser : public pkgRecords::Parser virtual ~debRecordParser() {}; }; +// custom record parser that reads deb files directly +class debDebFileRecordParser : public debRecordParser +{ + public: + virtual std::string FileName() { + return File.Name(); + } + debDebFileRecordParser(std::string FileName,pkgCache &Cache) + : debRecordParser(FileName, Cache) {}; +}; + #endif -- cgit v1.2.3 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/deb/debrecords.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'apt-pkg/deb/debrecords.h') diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h index d572bc5c2..90c88fefe 100644 --- a/apt-pkg/deb/debrecords.h +++ b/apt-pkg/deb/debrecords.h @@ -42,13 +42,11 @@ class debRecordParser : public pkgRecords::Parser // These refer to the archive file for the Version virtual std::string FileName(); - virtual std::string MD5Hash(); - virtual std::string SHA1Hash(); - virtual std::string SHA256Hash(); - virtual std::string SHA512Hash(); virtual std::string SourcePkg(); virtual std::string SourceVer(); - + + virtual HashStringList Hashes() const; + // These are some general stats about the package virtual std::string Maintainer(); virtual std::string ShortDesc(); -- cgit v1.2.3 From ffe3c68e494efc1c2c4d748fa9d69e150867e5c2 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 18 Aug 2013 22:20:25 +0200 Subject: parse and retrieve multiple Descriptions in one record It seems unlikely for now that proper archives will carry multiple Description-* stanzas in the Packages (or Translation-*) file, but sometimes apt eats its own output as shown by the usage of the CD team and it would be interesting to let apt output multiple translations e.g. in 'apt-cache show'. --- apt-pkg/deb/debrecords.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg/deb/debrecords.h') diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h index 90c88fefe..2bd3f3c8f 100644 --- a/apt-pkg/deb/debrecords.h +++ b/apt-pkg/deb/debrecords.h @@ -49,8 +49,8 @@ class debRecordParser : public pkgRecords::Parser // These are some general stats about the package virtual std::string Maintainer(); - virtual std::string ShortDesc(); - virtual std::string LongDesc(); + virtual std::string ShortDesc(std::string const &lang); + virtual std::string LongDesc(std::string const &lang); virtual std::string Name(); virtual std::string Homepage(); -- cgit v1.2.3 From 862bafea48af2ceaf96345db237b461307a021f6 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 13 Oct 2014 08:05:57 +0200 Subject: do not inline virtual destructors with d-pointers Reimplementing an inline method is opening a can of worms we don't want to open if we ever want to us a d-pointer in those classes, so we do the only thing which can save us from hell: move the destructors into the cc sources and we are good. Technically not an ABI break as the methods inline or not do the same (nothing), so a program compiled against the old version still works with the new version (beside that this version is still in experimental, so nothing really has been build against this library anyway). Git-Dch: Ignore --- apt-pkg/deb/debrecords.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg/deb/debrecords.h') diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h index 2bd3f3c8f..6b5f94334 100644 --- a/apt-pkg/deb/debrecords.h +++ b/apt-pkg/deb/debrecords.h @@ -60,7 +60,7 @@ class debRecordParser : public pkgRecords::Parser virtual void GetRec(const char *&Start,const char *&Stop); debRecordParser(std::string FileName,pkgCache &Cache); - virtual ~debRecordParser() {}; + virtual ~debRecordParser(); }; // custom record parser that reads deb files directly -- cgit v1.2.3 From dce45dbe97531de6806707445da97d3f22285db8 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 6 Nov 2014 12:41:04 +0100 Subject: mark internal interfaces as hidden MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have a bunch of classes which are of no use for the outside world, but were still exported and so needed to preserve ABI/API. Marking them as hidden to not export them any longer is a big API break in theory, but in practice nobody is using them – as if they would its a bug. --- apt-pkg/deb/debrecords.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg/deb/debrecords.h') diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h index 6b5f94334..7091c38e6 100644 --- a/apt-pkg/deb/debrecords.h +++ b/apt-pkg/deb/debrecords.h @@ -25,7 +25,7 @@ #include #endif -class debRecordParser : public pkgRecords::Parser +class APT_HIDDEN debRecordParser : public pkgRecords::Parser { /** \brief dpointer placeholder (for later in case we need it) */ void *d; @@ -64,7 +64,7 @@ class debRecordParser : public pkgRecords::Parser }; // custom record parser that reads deb files directly -class debDebFileRecordParser : public debRecordParser +class APT_HIDDEN debDebFileRecordParser : public debRecordParser { public: virtual std::string FileName() { -- cgit v1.2.3 From 2f6a2fbbdc9f76dc4eace83a427013f4e1c03afc Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 8 Jan 2015 21:07:37 +0100 Subject: properly implement pkgRecord::Parser for *.deb files Implementing FileName() works for most cases for us, but other frontends might need more and even for us its not very stable as the normal Jump() implementation is pretty bad on a deb file and produce errors on its own at times. So, replacing this makeshift with a complete implementation by mostly just shuffling code around. --- apt-pkg/deb/debrecords.h | 49 ++++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 18 deletions(-) (limited to 'apt-pkg/deb/debrecords.h') diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h index 7091c38e6..38e071940 100644 --- a/apt-pkg/deb/debrecords.h +++ b/apt-pkg/deb/debrecords.h @@ -25,21 +25,12 @@ #include #endif -class APT_HIDDEN debRecordParser : public pkgRecords::Parser +class APT_HIDDEN debRecordParserBase : public pkgRecords::Parser { - /** \brief dpointer placeholder (for later in case we need it) */ - void *d; - protected: - FileFd File; - pkgTagFile Tags; pkgTagSection Section; - - virtual bool Jump(pkgCache::VerFileIterator const &Ver); - virtual bool Jump(pkgCache::DescFileIterator const &Desc); - - public: + public: // These refer to the archive file for the Version virtual std::string FileName(); virtual std::string SourcePkg(); @@ -58,20 +49,42 @@ class APT_HIDDEN debRecordParser : public pkgRecords::Parser virtual std::string RecordField(const char *fieldName); virtual void GetRec(const char *&Start,const char *&Stop); - + + debRecordParserBase() : Parser() {} + virtual ~debRecordParserBase(); +}; + +class APT_HIDDEN debRecordParser : public debRecordParserBase +{ + protected: + FileFd File; + pkgTagFile Tags; + + virtual bool Jump(pkgCache::VerFileIterator const &Ver); + virtual bool Jump(pkgCache::DescFileIterator const &Desc); + + public: debRecordParser(std::string FileName,pkgCache &Cache); virtual ~debRecordParser(); }; // custom record parser that reads deb files directly -class APT_HIDDEN debDebFileRecordParser : public debRecordParser +class APT_HIDDEN debDebFileRecordParser : public debRecordParserBase { + std::string debFileName; + std::string controlContent; + + APT_HIDDEN bool LoadContent(); + protected: + // single file files, so no jumping whatsoever + bool Jump(pkgCache::VerFileIterator const &) { return LoadContent(); } + bool Jump(pkgCache::DescFileIterator const &) { return LoadContent(); } + public: - virtual std::string FileName() { - return File.Name(); - } - debDebFileRecordParser(std::string FileName,pkgCache &Cache) - : debRecordParser(FileName, Cache) {}; + virtual std::string FileName() { return debFileName; } + + debDebFileRecordParser(std::string FileName) + : debRecordParserBase(), debFileName(FileName) {}; }; #endif -- cgit v1.2.3