From b07aeb1a6e24825e534167a737043441e871de9f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 12 Jun 2015 02:08:53 +0200 Subject: store Release files data in the Cache We used to read the Release file for each Packages file and store the data in the PackageFile struct even through potentially many Packages (and Translation-*) files could use the same data. The point of the exercise isn't the duplicated data through. Having the Release files as first-class citizens in the Cache allows us to properly track their state as well as allows us to use the information also for files which aren't in the cache, but where we know to which Release file they belong (Sources are an example for this). This modifies the pkgCache structs, especially the PackagesFile struct which depending on how libapt users access the data in these structs can mean huge breakage or no visible change. As a single data point: aptitude seems to be fine with this. Even if there is breakage it is trivial to fix in a backportable way while avoiding breakage for everyone would be a huge pain for us. Note that not all PackageFile structs have a corresponding ReleaseFile. In particular the dpkg/status file as well as *.deb files have not. As these have only a Archive property need, the Component property takes over this duty and the ReleaseFile remains zero. This is also the reason why it isn't needed nor particularily recommended to change from PackagesFile to ReleaseFile blindly. Sticking with the earlier is usually the better option. --- apt-pkg/edsp/edspindexfile.cc | 5 ++--- apt-pkg/edsp/edsplistparser.cc | 4 ++-- apt-pkg/edsp/edsplistparser.h | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) (limited to 'apt-pkg/edsp') diff --git a/apt-pkg/edsp/edspindexfile.cc b/apt-pkg/edsp/edspindexfile.cc index d00536362..43dd44a79 100644 --- a/apt-pkg/edsp/edspindexfile.cc +++ b/apt-pkg/edsp/edspindexfile.cc @@ -49,15 +49,14 @@ bool edspIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const if (Prog != NULL) Prog->SubProgress(0,File); - if (Gen.SelectFile(File,std::string(),*this) == false) + if (Gen.SelectFile(File, *this, "edsp") == false) return _error->Error("Problem with SelectFile %s",File.c_str()); // Store the IMS information pkgCache::PkgFileIterator CFile = Gen.GetCurFile(); + pkgCacheGenerator::Dynamic DynFile(CFile); CFile->Size = Pkg.FileSize(); CFile->mtime = Pkg.ModificationTime(); - map_stringitem_t const storage = Gen.StoreString(pkgCacheGenerator::MIXED, "edsp::scenario"); - CFile->Archive = storage; if (Gen.MergeList(Parser) == false) return _error->Error("Problem with MergeList %s",File.c_str()); diff --git a/apt-pkg/edsp/edsplistparser.cc b/apt-pkg/edsp/edsplistparser.cc index 212dc7840..d62abe709 100644 --- a/apt-pkg/edsp/edsplistparser.cc +++ b/apt-pkg/edsp/edsplistparser.cc @@ -86,8 +86,8 @@ bool edspListParser::ParseStatus(pkgCache::PkgIterator &Pkg, } /*}}}*/ // ListParser::LoadReleaseInfo - Load the release information /*{{{*/ -APT_CONST bool edspListParser::LoadReleaseInfo(pkgCache::PkgFileIterator & /*FileI*/, - FileFd & /*File*/, std::string /*component*/) +APT_CONST bool edspListParser::LoadReleaseInfo(pkgCache::RlsFileIterator & /*FileI*/, + FileFd & /*File*/, std::string const &/*component*/) { return true; } diff --git a/apt-pkg/edsp/edsplistparser.h b/apt-pkg/edsp/edsplistparser.h index 86cd77606..abe2ef139 100644 --- a/apt-pkg/edsp/edsplistparser.h +++ b/apt-pkg/edsp/edsplistparser.h @@ -34,8 +34,8 @@ class APT_HIDDEN edspListParser : public debListParser virtual MD5SumValue Description_md5(); virtual unsigned short VersionHash(); - bool LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,FileFd &File, - std::string section); + bool LoadReleaseInfo(pkgCache::RlsFileIterator &FileI,FileFd &File, + std::string const §ion); edspListParser(FileFd *File, std::string const &Arch = ""); -- cgit v1.2.3 From e185d8b3e39e3840f439cab7d5d265fd96d84c6f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 12 Jun 2015 14:42:17 +0200 Subject: populate the Architecture field for PackageFiles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is mainly visible in the policy, so that you can now pin by b= and let it only effect Packages files of this architecture and hence the packages coming from it (which do not need to be from this architecture, but very likely are in a normal repository setup). If you should pin by architecture in this way is a different question… Closes: 687255 --- apt-pkg/edsp/edspindexfile.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg/edsp') diff --git a/apt-pkg/edsp/edspindexfile.cc b/apt-pkg/edsp/edspindexfile.cc index 43dd44a79..a2ec0a19b 100644 --- a/apt-pkg/edsp/edspindexfile.cc +++ b/apt-pkg/edsp/edspindexfile.cc @@ -49,7 +49,7 @@ bool edspIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const if (Prog != NULL) Prog->SubProgress(0,File); - if (Gen.SelectFile(File, *this, "edsp") == false) + if (Gen.SelectFile(File, *this, "", "edsp") == false) return _error->Error("Problem with SelectFile %s",File.c_str()); // Store the IMS information -- cgit v1.2.3 From c8a4ce6cbed57ae108dc955d4a850f9b129a0693 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 16 Jun 2015 16:22:46 +0200 Subject: add d-pointer, virtual destructors and de-inline de/constructors To have a chance to keep the ABI for a while we need all three to team up. One of them missing and we might loose, so ensuring that they are available is a very tedious but needed task once in a while. Git-Dch: Ignore --- apt-pkg/edsp/edspindexfile.cc | 2 ++ apt-pkg/edsp/edspindexfile.h | 1 + apt-pkg/edsp/edsplistparser.cc | 2 ++ apt-pkg/edsp/edsplistparser.h | 2 ++ apt-pkg/edsp/edspsystem.h | 2 +- 5 files changed, 8 insertions(+), 1 deletion(-) (limited to 'apt-pkg/edsp') diff --git a/apt-pkg/edsp/edspindexfile.cc b/apt-pkg/edsp/edspindexfile.cc index a2ec0a19b..5d9383e94 100644 --- a/apt-pkg/edsp/edspindexfile.cc +++ b/apt-pkg/edsp/edspindexfile.cc @@ -81,3 +81,5 @@ const pkgIndexFile::Type *edspIndex::GetType() const return &_apt_Universe; } /*}}}*/ + +edspIndex::~edspIndex() {} diff --git a/apt-pkg/edsp/edspindexfile.h b/apt-pkg/edsp/edspindexfile.h index 8c18d8cbd..0f63b7b2a 100644 --- a/apt-pkg/edsp/edspindexfile.h +++ b/apt-pkg/edsp/edspindexfile.h @@ -30,6 +30,7 @@ class APT_HIDDEN edspIndex : public debStatusIndex virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const; edspIndex(std::string File); + virtual ~edspIndex(); }; #endif diff --git a/apt-pkg/edsp/edsplistparser.cc b/apt-pkg/edsp/edsplistparser.cc index d62abe709..d1c0cf7e8 100644 --- a/apt-pkg/edsp/edsplistparser.cc +++ b/apt-pkg/edsp/edsplistparser.cc @@ -92,3 +92,5 @@ APT_CONST bool edspListParser::LoadReleaseInfo(pkgCache::RlsFileIterator & /*Fil return true; } /*}}}*/ + +edspListParser::~edspListParser() {} diff --git a/apt-pkg/edsp/edsplistparser.h b/apt-pkg/edsp/edsplistparser.h index abe2ef139..ef5179e68 100644 --- a/apt-pkg/edsp/edsplistparser.h +++ b/apt-pkg/edsp/edsplistparser.h @@ -27,6 +27,7 @@ class FileFd; class APT_HIDDEN edspListParser : public debListParser { + void *d; public: virtual bool NewVersion(pkgCache::VerIterator &Ver); virtual std::string Description(); @@ -38,6 +39,7 @@ class APT_HIDDEN edspListParser : public debListParser std::string const §ion); edspListParser(FileFd *File, std::string const &Arch = ""); + virtual ~edspListParser(); protected: virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver); diff --git a/apt-pkg/edsp/edspsystem.h b/apt-pkg/edsp/edspsystem.h index 06a63f40c..1e27d2cb0 100644 --- a/apt-pkg/edsp/edspsystem.h +++ b/apt-pkg/edsp/edspsystem.h @@ -42,7 +42,7 @@ class APT_HIDDEN edspSystem : public pkgSystem pkgIndexFile *&Found) const; edspSystem(); - ~edspSystem(); + virtual ~edspSystem(); }; #endif -- cgit v1.2.3 From 6c55f07a5fa3612a5d59c61a17da5fe640eadc8b Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 17 Jun 2015 09:29:00 +0200 Subject: make all d-pointer * const pointers Doing this disables the implicit copy assignment operator (among others) which would cause hovac if used on the classes as it would just copy the pointer, not the data the d-pointer points to. For most of the classes we don't need a copy assignment operator anyway and in many classes it was broken before as many contain a pointer of some sort. Only for our Cacheset Container interfaces we define an explicit copy assignment operator which could later be implemented to copy the data from one d-pointer to the other if we need it. Git-Dch: Ignore --- apt-pkg/edsp/edspindexfile.cc | 2 +- apt-pkg/edsp/edspindexfile.h | 2 +- apt-pkg/edsp/edsplistparser.cc | 2 +- apt-pkg/edsp/edsplistparser.h | 2 +- apt-pkg/edsp/edspsystem.cc | 8 ++------ apt-pkg/edsp/edspsystem.h | 2 +- 6 files changed, 7 insertions(+), 11 deletions(-) (limited to 'apt-pkg/edsp') diff --git a/apt-pkg/edsp/edspindexfile.cc b/apt-pkg/edsp/edspindexfile.cc index 5d9383e94..3bffc27e9 100644 --- a/apt-pkg/edsp/edspindexfile.cc +++ b/apt-pkg/edsp/edspindexfile.cc @@ -29,7 +29,7 @@ // edspIndex::edspIndex - Constructor /*{{{*/ // --------------------------------------------------------------------- /* */ -edspIndex::edspIndex(std::string File) : debStatusIndex(File) +edspIndex::edspIndex(std::string File) : debStatusIndex(File), d(NULL) { } /*}}}*/ diff --git a/apt-pkg/edsp/edspindexfile.h b/apt-pkg/edsp/edspindexfile.h index 0f63b7b2a..265a016c5 100644 --- a/apt-pkg/edsp/edspindexfile.h +++ b/apt-pkg/edsp/edspindexfile.h @@ -21,7 +21,7 @@ class pkgCacheGenerator; class APT_HIDDEN edspIndex : public debStatusIndex { /** \brief dpointer placeholder (for later in case we need it) */ - void *d; + void * const d; public: diff --git a/apt-pkg/edsp/edsplistparser.cc b/apt-pkg/edsp/edsplistparser.cc index d1c0cf7e8..63f006628 100644 --- a/apt-pkg/edsp/edsplistparser.cc +++ b/apt-pkg/edsp/edsplistparser.cc @@ -22,7 +22,7 @@ /*}}}*/ // ListParser::edspListParser - Constructor /*{{{*/ -edspListParser::edspListParser(FileFd *File, std::string const &Arch) : debListParser(File, Arch) +edspListParser::edspListParser(FileFd *File, std::string const &Arch) : debListParser(File, Arch), d(NULL) {} /*}}}*/ // ListParser::NewVersion - Fill in the version structure /*{{{*/ diff --git a/apt-pkg/edsp/edsplistparser.h b/apt-pkg/edsp/edsplistparser.h index ef5179e68..98dde4bf5 100644 --- a/apt-pkg/edsp/edsplistparser.h +++ b/apt-pkg/edsp/edsplistparser.h @@ -27,7 +27,7 @@ class FileFd; class APT_HIDDEN edspListParser : public debListParser { - void *d; + void * const d; public: virtual bool NewVersion(pkgCache::VerIterator &Ver); virtual std::string Description(); diff --git a/apt-pkg/edsp/edspsystem.cc b/apt-pkg/edsp/edspsystem.cc index 063517421..4fb34b896 100644 --- a/apt-pkg/edsp/edspsystem.cc +++ b/apt-pkg/edsp/edspsystem.cc @@ -26,13 +26,9 @@ #include /*}}}*/ -// System::debSystem - Constructor /*{{{*/ -edspSystem::edspSystem() +// System::edspSystem - Constructor /*{{{*/ +edspSystem::edspSystem() : pkgSystem("Debian APT solver interface", &debVS), d(NULL), StatusFile(NULL) { - StatusFile = 0; - - Label = "Debian APT solver interface"; - VS = &debVS; } /*}}}*/ // System::~debSystem - Destructor /*{{{*/ diff --git a/apt-pkg/edsp/edspsystem.h b/apt-pkg/edsp/edspsystem.h index 1e27d2cb0..156b02bb5 100644 --- a/apt-pkg/edsp/edspsystem.h +++ b/apt-pkg/edsp/edspsystem.h @@ -25,7 +25,7 @@ class edspIndex; class APT_HIDDEN edspSystem : public pkgSystem { /** \brief dpointer placeholder (for later in case we need it) */ - void *d; + void * const d; edspIndex *StatusFile; -- cgit v1.2.3 From 3b3028467ceccca0b73a8f53051c0fa4de313111 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 9 Jul 2015 00:35:40 +0200 Subject: add c++11 override marker to overridden methods C++11 adds the 'override' specifier to mark that a method is overriding a base class method and error out if not. We hide it in the APT_OVERRIDE macro to ensure that we keep compiling in pre-c++11 standards. Reported-By: clang-modernize -add-override -override-macros Git-Dch: Ignore --- apt-pkg/edsp/edspindexfile.cc | 2 +- apt-pkg/edsp/edspindexfile.h | 2 +- apt-pkg/edsp/edsplistparser.h | 8 ++++---- apt-pkg/edsp/edspsystem.h | 18 ++++++++++-------- 4 files changed, 16 insertions(+), 14 deletions(-) (limited to 'apt-pkg/edsp') diff --git a/apt-pkg/edsp/edspindexfile.cc b/apt-pkg/edsp/edspindexfile.cc index 3bffc27e9..649d94b5d 100644 --- a/apt-pkg/edsp/edspindexfile.cc +++ b/apt-pkg/edsp/edspindexfile.cc @@ -67,7 +67,7 @@ bool edspIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const class APT_HIDDEN edspIFType: public pkgIndexFile::Type { public: - virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator) const + virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator) const APT_OVERRIDE { // we don't have a record parser for this type as the file is not presistent return NULL; diff --git a/apt-pkg/edsp/edspindexfile.h b/apt-pkg/edsp/edspindexfile.h index 265a016c5..b2a510f14 100644 --- a/apt-pkg/edsp/edspindexfile.h +++ b/apt-pkg/edsp/edspindexfile.h @@ -27,7 +27,7 @@ class APT_HIDDEN edspIndex : public debStatusIndex virtual const Type *GetType() const APT_CONST; - virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const; + virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const APT_OVERRIDE; edspIndex(std::string File); virtual ~edspIndex(); diff --git a/apt-pkg/edsp/edsplistparser.h b/apt-pkg/edsp/edsplistparser.h index 98dde4bf5..2a09e8c47 100644 --- a/apt-pkg/edsp/edsplistparser.h +++ b/apt-pkg/edsp/edsplistparser.h @@ -29,11 +29,11 @@ class APT_HIDDEN edspListParser : public debListParser { void * const d; public: - virtual bool NewVersion(pkgCache::VerIterator &Ver); + virtual bool NewVersion(pkgCache::VerIterator &Ver) APT_OVERRIDE; virtual std::string Description(); virtual std::string DescriptionLanguage(); - virtual MD5SumValue Description_md5(); - virtual unsigned short VersionHash(); + virtual MD5SumValue Description_md5() APT_OVERRIDE; + virtual unsigned short VersionHash() APT_OVERRIDE; bool LoadReleaseInfo(pkgCache::RlsFileIterator &FileI,FileFd &File, std::string const §ion); @@ -42,7 +42,7 @@ class APT_HIDDEN edspListParser : public debListParser virtual ~edspListParser(); protected: - virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver); + virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver) APT_OVERRIDE; }; diff --git a/apt-pkg/edsp/edspsystem.h b/apt-pkg/edsp/edspsystem.h index 156b02bb5..ec42bef75 100644 --- a/apt-pkg/edsp/edspsystem.h +++ b/apt-pkg/edsp/edspsystem.h @@ -16,6 +16,8 @@ #include +#include + class Configuration; class pkgDepCache; class pkgIndexFile; @@ -31,15 +33,15 @@ class APT_HIDDEN edspSystem : public pkgSystem public: - virtual bool Lock() APT_CONST; - virtual bool UnLock(bool NoErrors = false) APT_CONST; - virtual pkgPackageManager *CreatePM(pkgDepCache *Cache) const APT_CONST; - virtual bool Initialize(Configuration &Cnf); - virtual bool ArchiveSupported(const char *Type) APT_CONST; - virtual signed Score(Configuration const &Cnf); - virtual bool AddStatusFiles(std::vector &List); + virtual bool Lock() APT_OVERRIDE APT_CONST; + virtual bool UnLock(bool NoErrors = false) APT_OVERRIDE APT_CONST; + virtual pkgPackageManager *CreatePM(pkgDepCache *Cache) const APT_OVERRIDE APT_CONST; + virtual bool Initialize(Configuration &Cnf) APT_OVERRIDE; + virtual bool ArchiveSupported(const char *Type) APT_OVERRIDE APT_CONST; + virtual signed Score(Configuration const &Cnf) APT_OVERRIDE; + virtual bool AddStatusFiles(std::vector &List) APT_OVERRIDE; virtual bool FindIndex(pkgCache::PkgFileIterator File, - pkgIndexFile *&Found) const; + pkgIndexFile *&Found) const APT_OVERRIDE; edspSystem(); virtual ~edspSystem(); -- cgit v1.2.3 From 5465192b9aeb1ccea778950ccf2d1b7b32f2cd91 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 18 Jul 2015 18:03:54 +0200 Subject: add volatile sources support in libapt-pkg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sources are usually defined in sources.list (and co) and are pretty stable, but once in a while a frontend might want to add an additional "source" like a local .deb file to install this package (No support for 'real' sources being added this way as this is a multistep process). We had a hack in place to allow apt-get and apt to pull this of for a short while now, but other frontends are either left in the cold by this and/or the code for it looks dirty with FIXMEs plastering it and has on top of this also some problems (like including these 'volatile' sources in the srcpkgcache.bin file). So the biggest part in this commit is actually the rewrite of the cache generation as it is now potentially a three step process. The biggest problem with adding support now through is that this makes a bunch of previously mostly unusable by externs and therefore hidden classes public, so a bit of further tuneing on this now public API is in order… --- apt-pkg/edsp/edspsystem.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'apt-pkg/edsp') diff --git a/apt-pkg/edsp/edspsystem.cc b/apt-pkg/edsp/edspsystem.cc index 4fb34b896..f65fcc0d2 100644 --- a/apt-pkg/edsp/edspsystem.cc +++ b/apt-pkg/edsp/edspsystem.cc @@ -91,8 +91,7 @@ signed edspSystem::Score(Configuration const &Cnf) return -1000; } /*}}}*/ -// System::AddStatusFiles - Register the status files /*{{{*/ -bool edspSystem::AddStatusFiles(std::vector &List) +bool edspSystem::AddStatusFiles(std::vector &List) /*{{{*/ { if (StatusFile == 0) { -- cgit v1.2.3 From c9443c01208377f0cba9706412ea3a98ad97b56d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 20 Jul 2015 10:17:29 +0200 Subject: elimate duplicated code in pkgIndexFile subclasses Trade deduplication of code for a bunch of new virtuals, so it is actually visible how the different indexes behave cleaning up the interface at large in the process. Git-Dch: Ignore --- apt-pkg/edsp/edspindexfile.cc | 75 +++++++++++++++++++++++-------------------- apt-pkg/edsp/edspindexfile.h | 16 ++++++--- apt-pkg/edsp/edspsystem.cc | 8 ++--- 3 files changed, 54 insertions(+), 45 deletions(-) (limited to 'apt-pkg/edsp') diff --git a/apt-pkg/edsp/edspindexfile.cc b/apt-pkg/edsp/edspindexfile.cc index 649d94b5d..a8a528131 100644 --- a/apt-pkg/edsp/edspindexfile.cc +++ b/apt-pkg/edsp/edspindexfile.cc @@ -26,59 +26,66 @@ #include /*}}}*/ -// edspIndex::edspIndex - Constructor /*{{{*/ -// --------------------------------------------------------------------- -/* */ -edspIndex::edspIndex(std::string File) : debStatusIndex(File), d(NULL) +// EDSP Index /*{{{*/ +edspIndex::edspIndex(std::string const &File) : pkgDebianIndexRealFile(File, true), d(NULL) { } - /*}}}*/ -// StatusIndex::Merge - Load the index file into a cache /*{{{*/ -bool edspIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const +std::string edspIndex::GetComponent() const { - FileFd Pkg; - if (File != "stdin") - Pkg.Open(File, FileFd::ReadOnly); - else - Pkg.OpenDescriptor(STDIN_FILENO, FileFd::ReadOnly); - if (_error->PendingError() == true) - return false; - edspListParser Parser(&Pkg); - if (_error->PendingError() == true) - return false; - - if (Prog != NULL) - Prog->SubProgress(0,File); - if (Gen.SelectFile(File, *this, "", "edsp") == false) - return _error->Error("Problem with SelectFile %s",File.c_str()); - - // Store the IMS information - pkgCache::PkgFileIterator CFile = Gen.GetCurFile(); - pkgCacheGenerator::Dynamic DynFile(CFile); - CFile->Size = Pkg.FileSize(); - CFile->mtime = Pkg.ModificationTime(); - - if (Gen.MergeList(Parser) == false) - return _error->Error("Problem with MergeList %s",File.c_str()); + return "edsp"; +} +std::string edspIndex::GetArchitecture() const +{ + return std::string(); +} +bool edspIndex::HasPackages() const +{ + return true; +} +bool edspIndex::Exists() const +{ + return true; +} +uint8_t edspIndex::GetIndexFlags() const +{ + return 0; +} +bool edspIndex::OpenListFile(FileFd &Pkg, std::string const &FileName) +{ + if (FileName.empty() == false && FileName != "stdin") + return pkgDebianIndexRealFile::OpenListFile(Pkg, FileName); + if (Pkg.OpenDescriptor(STDIN_FILENO, FileFd::ReadOnly) == false) + return _error->Error("Problem opening %s",FileName.c_str()); return true; +} +pkgCacheListParser * edspIndex::CreateListParser(FileFd &Pkg) +{ + if (Pkg.IsOpen() == false) + return NULL; + _error->PushToStack(); + pkgCacheListParser * const Parser = new edspListParser(&Pkg); + bool const newError = _error->PendingError(); + _error->MergeWithStack(); + return newError ? NULL : Parser; } /*}}}*/ + // Index File types for APT /*{{{*/ class APT_HIDDEN edspIFType: public pkgIndexFile::Type { public: - virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator) const APT_OVERRIDE + virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator const &) const APT_OVERRIDE { // we don't have a record parser for this type as the file is not presistent return NULL; }; edspIFType() {Label = "EDSP scenario file";}; }; -APT_HIDDEN edspIFType _apt_Universe; +APT_HIDDEN edspIFType _apt_Edsp; const pkgIndexFile::Type *edspIndex::GetType() const { - return &_apt_Universe; + return &_apt_Edsp; } /*}}}*/ diff --git a/apt-pkg/edsp/edspindexfile.h b/apt-pkg/edsp/edspindexfile.h index b2a510f14..edf799023 100644 --- a/apt-pkg/edsp/edspindexfile.h +++ b/apt-pkg/edsp/edspindexfile.h @@ -18,18 +18,24 @@ class OpProgress; class pkgCacheGenerator; -class APT_HIDDEN edspIndex : public debStatusIndex +class APT_HIDDEN edspIndex : public pkgDebianIndexRealFile { /** \brief dpointer placeholder (for later in case we need it) */ void * const d; - public: +protected: + APT_HIDDEN virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE; + virtual bool OpenListFile(FileFd &Pkg, std::string const &File) APT_OVERRIDE; + virtual uint8_t GetIndexFlags() const APT_OVERRIDE; + virtual std::string GetComponent() const APT_OVERRIDE; + virtual std::string GetArchitecture() const APT_OVERRIDE; +public: virtual const Type *GetType() const APT_CONST; + virtual bool Exists() const APT_OVERRIDE; + virtual bool HasPackages() const APT_OVERRIDE; - virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const APT_OVERRIDE; - - edspIndex(std::string File); + edspIndex(std::string const &File); virtual ~edspIndex(); }; diff --git a/apt-pkg/edsp/edspsystem.cc b/apt-pkg/edsp/edspsystem.cc index f65fcc0d2..c4583252f 100644 --- a/apt-pkg/edsp/edspsystem.cc +++ b/apt-pkg/edsp/edspsystem.cc @@ -81,13 +81,9 @@ bool edspSystem::ArchiveSupported(const char * /*Type*/) return false; } /*}}}*/ -// System::Score - Determine if we should use the edsp system /*{{{*/ -signed edspSystem::Score(Configuration const &Cnf) +// System::Score - Never use the EDSP system automatically /*{{{*/ +signed edspSystem::Score(Configuration const &) { - if (Cnf.Find("edsp::scenario", "") == "stdin") - return 1000; - if (RealFileExists(Cnf.FindFile("edsp::scenario","")) == true) - return 1000; return -1000; } /*}}}*/ -- cgit v1.2.3 From 7f8c0eed6983db7b8959f1498fc8bc80c98d719e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 20 Jul 2015 12:32:46 +0200 Subject: parse packages from all architectures into the cache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that we can dynamically create dependencies and provides as needed rather than requiring to know with which architectures we will deal before running we can allow the listparser to parse all records rather than skipping records of "unknown" architectures. This can e.g. happen if a user has foreign architecture packages in his status file without dpkg knowing about this architecture (or apt configured in this way). A sideeffect is that now arch:all packages are (correctly) recorded as available from any Packages file, not just from the native one – which has its downsides for the resolver as mixed-arch source packages can appear in different architectures at different times, but that is the problem of the resolver and dealing with it in the parser is at best a hack (and also depends on a helpful repository). Another sideeffect is that his allows :none packages to appear in Packages files again as we don't do any kind of checks now, but given that they aren't really supported (anymore) by anyone we can live with that. --- apt-pkg/edsp/edsplistparser.cc | 2 +- apt-pkg/edsp/edsplistparser.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg/edsp') diff --git a/apt-pkg/edsp/edsplistparser.cc b/apt-pkg/edsp/edsplistparser.cc index 63f006628..a54a46b1e 100644 --- a/apt-pkg/edsp/edsplistparser.cc +++ b/apt-pkg/edsp/edsplistparser.cc @@ -22,7 +22,7 @@ /*}}}*/ // ListParser::edspListParser - Constructor /*{{{*/ -edspListParser::edspListParser(FileFd *File, std::string const &Arch) : debListParser(File, Arch), d(NULL) +edspListParser::edspListParser(FileFd *File) : debListParser(File), d(NULL) {} /*}}}*/ // ListParser::NewVersion - Fill in the version structure /*{{{*/ diff --git a/apt-pkg/edsp/edsplistparser.h b/apt-pkg/edsp/edsplistparser.h index 2a09e8c47..221229302 100644 --- a/apt-pkg/edsp/edsplistparser.h +++ b/apt-pkg/edsp/edsplistparser.h @@ -38,7 +38,7 @@ class APT_HIDDEN edspListParser : public debListParser bool LoadReleaseInfo(pkgCache::RlsFileIterator &FileI,FileFd &File, std::string const §ion); - edspListParser(FileFd *File, std::string const &Arch = ""); + edspListParser(FileFd *File); virtual ~edspListParser(); protected: -- cgit v1.2.3 From 6d7122b5356c0b4d8f51aafdfc1c232392fca695 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 11 Aug 2015 15:58:03 +0200 Subject: Annotate more methods with APT_OVERRIDE Gbp-Dch: ignore Reported-By: g++ -Wsuggest-override Thanks: g++ -Wsuggest-override --- apt-pkg/edsp/edspindexfile.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg/edsp') diff --git a/apt-pkg/edsp/edspindexfile.h b/apt-pkg/edsp/edspindexfile.h index edf799023..4548bff3c 100644 --- a/apt-pkg/edsp/edspindexfile.h +++ b/apt-pkg/edsp/edspindexfile.h @@ -31,7 +31,7 @@ protected: virtual std::string GetArchitecture() const APT_OVERRIDE; public: - virtual const Type *GetType() const APT_CONST; + virtual const Type *GetType() const APT_OVERRIDE APT_CONST; virtual bool Exists() const APT_OVERRIDE; virtual bool HasPackages() const APT_OVERRIDE; -- cgit v1.2.3 From 88a8975f156e452d9f3ebe76822b236e8962ebba Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 17 Aug 2015 12:01:45 +0200 Subject: Cleanup includes after running iwyu --- apt-pkg/edsp/edspindexfile.cc | 5 ----- apt-pkg/edsp/edsplistparser.cc | 1 - apt-pkg/edsp/edspsystem.cc | 2 -- 3 files changed, 8 deletions(-) (limited to 'apt-pkg/edsp') diff --git a/apt-pkg/edsp/edspindexfile.cc b/apt-pkg/edsp/edspindexfile.cc index a8a528131..409117c5e 100644 --- a/apt-pkg/edsp/edspindexfile.cc +++ b/apt-pkg/edsp/edspindexfile.cc @@ -12,13 +12,8 @@ #include #include #include -#include -#include #include -#include #include -#include -#include #include #include diff --git a/apt-pkg/edsp/edsplistparser.cc b/apt-pkg/edsp/edsplistparser.cc index a54a46b1e..ff79b537e 100644 --- a/apt-pkg/edsp/edsplistparser.cc +++ b/apt-pkg/edsp/edsplistparser.cc @@ -18,7 +18,6 @@ #include #include -#include /*}}}*/ // ListParser::edspListParser - Constructor /*{{{*/ diff --git a/apt-pkg/edsp/edspsystem.cc b/apt-pkg/edsp/edspsystem.cc index c4583252f..f577efcbd 100644 --- a/apt-pkg/edsp/edspsystem.cc +++ b/apt-pkg/edsp/edspsystem.cc @@ -15,7 +15,6 @@ #include #include #include -#include #include #include @@ -23,7 +22,6 @@ #include #include -#include /*}}}*/ // System::edspSystem - Constructor /*{{{*/ -- cgit v1.2.3