From 894d672e9b7517573266cda333612e70441cbda8 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 17 May 2011 18:14:25 +0200 Subject: * apt-pkg/pkgcache.h: - clean up mess with the "all" handling in MultiArch to fix LP: #733741 cleanly for everyone now --- apt-pkg/pkgcache.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'apt-pkg/pkgcache.h') diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 1b1743724..280f37bca 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -500,15 +500,18 @@ struct pkgCache::Version map_ptrloc VerStr; // StringItem /** \brief section this version is filled in */ map_ptrloc Section; // StringItem + + /** \brief Multi-Arch capabilities of a package version */ + enum VerMultiArch { None = 0, /*!< is the default and doesn't trigger special behaviour */ + All = (1<<0), /*!< will cause that Ver.Arch() will report "all" */ + Foreign = (1<<1), /*!< can satisfy dependencies in another architecture */ + Same = (1<<2), /*!< can be co-installed with itself from other architectures */ + Allowed = (1<<3) /*!< other packages are allowed to depend on thispkg:any */ }; /** \brief stores the MultiArch capabilities of this version - None is the default and doesn't trigger special behaviour, - Foreign means that this version can fulfill dependencies even - if it is built for another architecture as the requester. - Same indicates that builds for different architectures can - be co-installed on the system */ - /* FIXME: A bitflag would be better with the next abibreak… */ - enum {None, All, Foreign, Same, Allowed, AllForeign, AllAllowed} MultiArch; + Flags used are defined in pkgCache::Version::VerMultiArch + */ + unsigned char MultiArch; /** \brief references all the PackageFile's that this version came from -- cgit v1.2.3 From 00b6a181fe1efb86ba5eb98a369da8f9d2ab063f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 29 Jun 2011 19:38:52 +0200 Subject: * apt-pkg/pkgcache.h: - readd All{Foreign,Allowed} as suggested by Julian to remain strictly API compatible --- apt-pkg/pkgcache.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'apt-pkg/pkgcache.h') diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 280f37bca..9a9f79420 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -506,7 +506,9 @@ struct pkgCache::Version All = (1<<0), /*!< will cause that Ver.Arch() will report "all" */ Foreign = (1<<1), /*!< can satisfy dependencies in another architecture */ Same = (1<<2), /*!< can be co-installed with itself from other architectures */ - Allowed = (1<<3) /*!< other packages are allowed to depend on thispkg:any */ }; + Allowed = (1<<3), /*!< other packages are allowed to depend on thispkg:any */ + AllForeign = All | Foreign, + AllAllowed = All | Allowed }; /** \brief stores the MultiArch capabilities of this version Flags used are defined in pkgCache::Version::VerMultiArch -- cgit v1.2.3 From 0688ccd8d9ae40741f1a2ef0de25a59e2203fc5e Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 20 Jul 2011 16:37:56 +0200 Subject: apt-pkg/pkgcache.h: Add pkgCache::Header::CacheFileSize, storing the cache size --- apt-pkg/pkgcache.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'apt-pkg/pkgcache.h') diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 9a9f79420..87912aead 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -314,6 +314,9 @@ struct pkgCache::Header map_ptrloc PkgHashTable[2*1048]; map_ptrloc GrpHashTable[2*1048]; + /** \brief Size of the complete cache file */ + unsigned long CacheFileSize; + bool CheckSizes(Header &Against) const; Header(); }; -- cgit v1.2.3 From 8f3ba4e8708cb72be19dacc2af4f601ee5fea292 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 19 Sep 2011 13:31:29 +0200 Subject: do not pollute namespace in the headers with using (Closes: #500198) --- apt-pkg/pkgcache.h | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'apt-pkg/pkgcache.h') diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 87912aead..7e32a3a96 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -79,8 +79,6 @@ #include #include -using std::string; - class pkgVersioningSystem; class pkgCache /*{{{*/ { @@ -152,10 +150,10 @@ class pkgCache /*{{{*/ protected: // Memory mapped cache file - string CacheFile; + std::string CacheFile; MMap ⤅ - unsigned long sHash(const string &S) const; + unsigned long sHash(const std::string &S) const; unsigned long sHash(const char *S) const; public: @@ -180,16 +178,16 @@ class pkgCache /*{{{*/ inline void *DataEnd() {return ((unsigned char *)Map.Data()) + Map.Size();}; // String hashing function (512 range) - inline unsigned long Hash(const string &S) const {return sHash(S);}; + inline unsigned long Hash(const std::string &S) const {return sHash(S);}; inline unsigned long Hash(const char *S) const {return sHash(S);}; // Useful transformation things const char *Priority(unsigned char Priority); // Accessors - GrpIterator FindGrp(const string &Name); - PkgIterator FindPkg(const string &Name); - PkgIterator FindPkg(const string &Name, const string &Arch); + GrpIterator FindGrp(const std::string &Name); + PkgIterator FindPkg(const std::string &Name); + PkgIterator FindPkg(const std::string &Name, const std::string &Arch); Header &Head() {return *HeaderP;}; inline GrpIterator GrpBegin(); @@ -214,7 +212,7 @@ class pkgCache /*{{{*/ private: bool MultiArchEnabled; - PkgIterator SingleArchFindPkg(const string &Name); + PkgIterator SingleArchFindPkg(const std::string &Name); inline char const * const NativeArch() const; }; /*}}}*/ -- cgit v1.2.3 From 2b5c35c7bb915dbd46fefd7c79f05364ba22f93b Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 23 Nov 2011 00:49:45 +0100 Subject: * apt-pkg/depcache.cc: - prefer native providers over foreigns even if the chain is foreign The code preferred real over virtual packages and based on priorities. This is changed in so far that a real package from any arch is preferred over any virtual provider and if priorities doesn't help in choosing the best provider we choose it based on architectures --- apt-pkg/pkgcache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg/pkgcache.h') diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 7e32a3a96..fd1a02149 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -198,6 +198,7 @@ class pkgCache /*{{{*/ inline PkgFileIterator FileEnd(); inline bool MultiArchCache() const { return MultiArchEnabled; }; + inline char const * const NativeArch() const; // Make me a function pkgVersioningSystem *VS; @@ -213,7 +214,6 @@ class pkgCache /*{{{*/ private: bool MultiArchEnabled; PkgIterator SingleArchFindPkg(const std::string &Name); - inline char const * const NativeArch() const; }; /*}}}*/ // Header structure /*{{{*/ -- cgit v1.2.3 From a4f6bdc8bd91c7282ae9ac60c44844c6f0058a65 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 13 Dec 2011 00:54:37 +0100 Subject: revert 2184.1.2: do not pollute namespace in headers The breakage is just to big for now, so guard the change with #ifndef APT_8_CLEANER_HEADERS and be nice to library users --- apt-pkg/pkgcache.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'apt-pkg/pkgcache.h') diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index fd1a02149..1a7013551 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -74,11 +74,14 @@ #ifndef PKGLIB_PKGCACHE_H #define PKGLIB_PKGCACHE_H - #include #include #include +#ifndef APT_8_CLEANER_HEADERS +using std::string; +#endif + class pkgVersioningSystem; class pkgCache /*{{{*/ { -- cgit v1.2.3