diff options
author | David Kalnischkies <david@kalnischkies.de> | 2015-06-23 15:16:08 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2015-08-10 17:25:26 +0200 |
commit | 5ad0096a4e19e191b59634e8a8817995ec4045ad (patch) | |
tree | 70b2310cdff52e809ffebcdfae4ffa4cd42f10fb /apt-pkg/deb/debmetaindex.h | |
parent | 268ffcebb9ae4278b1e3c3f89f8167f229164dbd (diff) |
merge indexRecords into metaIndex
indexRecords was used to parse the Release file – mostly the hashes –
while metaIndex deals with downloading the Release file, storing all
indexes coming from this release and … parsing the Release file, but
this time mostly for the other fields.
That wasn't a problem in metaIndex as this was done in the type specific
subclass, but indexRecords while allowing to override the parsing method
did expect by default a specific format.
APT isn't really supporting different types at the moment, but this is
a violation of the abstraction we have everywhere else and, which is the
actual reason for this merge: Options e.g. coming from the sources.list
come to metaIndex naturally, which needs to wrap them up and bring them
into indexRecords, so the acquire system is told about it as they don't
get to see the metaIndex, but they don't really belong in indexRecords
as this is just for storing data loaded from the Release file… the
result is a complete mess.
I am not saying it is a lot prettier after the merge, but at least
adding new options is now slightly easier and there is just one place
responsible for parsing the Release file. That can't hurt.
Diffstat (limited to 'apt-pkg/deb/debmetaindex.h')
-rw-r--r-- | apt-pkg/deb/debmetaindex.h | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/apt-pkg/deb/debmetaindex.h b/apt-pkg/deb/debmetaindex.h index a6db4e287..19fe6806c 100644 --- a/apt-pkg/deb/debmetaindex.h +++ b/apt-pkg/deb/debmetaindex.h @@ -27,6 +27,8 @@ class APT_HIDDEN debReleaseIndex : public metaIndex { debReleaseIndexPrivate * const d; + APT_HIDDEN bool parseSumData(const char *&Start, const char *End, std::string &Name, + std::string &Hash, unsigned long long &Size); public: APT_HIDDEN std::string MetaIndexInfo(const char *Type) const; @@ -38,20 +40,18 @@ class APT_HIDDEN debReleaseIndex : public metaIndex virtual ~debReleaseIndex(); virtual std::string ArchiveURI(std::string const &File) const {return URI + File;}; - virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false) const; + virtual bool GetIndexes(pkgAcquire *Owner, bool const &GetAll=false); virtual std::vector<IndexTarget> GetIndexTargets() const; virtual std::string Describe() const; virtual pkgCache::RlsFileIterator FindInCache(pkgCache &Cache, bool const ModifyCheck) const; virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const; - virtual std::string LocalFileName() const; + virtual bool Load(std::string const &Filename, std::string * const ErrorText); + virtual metaIndex * UnloadedClone() const; virtual std::vector <pkgIndexFile *> *GetIndexFiles(); - enum APT_HIDDEN TriState { - TRI_YES, TRI_DONTCARE, TRI_NO, TRI_UNSET - }; bool SetTrusted(TriState const Trusted); virtual bool IsTrusted() const; @@ -64,15 +64,15 @@ class APT_HIDDEN debReleaseIndex : public metaIndex class APT_HIDDEN debDebFileMetaIndex : public metaIndex { - private: - void * const d; +private: + void * const d; std::string DebFile; debDebPkgFileIndex *DebIndex; - public: +public: virtual std::string ArchiveURI(std::string const& /*File*/) const { return DebFile; } - virtual bool GetIndexes(pkgAcquire* /*Owner*/, const bool& /*GetAll=false*/) const { + virtual bool GetIndexes(pkgAcquire* /*Owner*/, const bool& /*GetAll=false*/) { return true; } virtual std::vector<IndexTarget> GetIndexTargets() const { @@ -84,6 +84,17 @@ class APT_HIDDEN debDebFileMetaIndex : public metaIndex virtual bool IsTrusted() const { return true; } + virtual bool Load(std::string const &, std::string * const ErrorText) + { + LoadedSuccessfully = TRI_NO; + if (ErrorText != NULL) + strprintf(*ErrorText, "Unparseable metaindex as it represents the standalone deb file %s", DebFile.c_str()); + return false; + } + virtual metaIndex * UnloadedClone() const + { + return NULL; + } debDebFileMetaIndex(std::string const &DebFile); virtual ~debDebFileMetaIndex(); |