diff options
author | Michael Vogt <mvo@ubuntu.com> | 2015-10-05 15:21:47 +0200 |
---|---|---|
committer | Michael Vogt <mvo@ubuntu.com> | 2015-10-05 15:21:47 +0200 |
commit | 6f2f5f4afa6f628ad3d068e9ba55fc6455eefa12 (patch) | |
tree | d360bbbdff678c19142facabc46f30f693fe32e9 /apt-pkg/deb | |
parent | 1f5a2d63b784eb919143d0be3f2dee7ff0bb7e83 (diff) | |
parent | 56e47f3111ad714c6506c0d60dccb92cfc9311cb (diff) |
Merge branch 'debian/sid' into ubuntu/master
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r-- | apt-pkg/deb/debindexfile.cc | 28 | ||||
-rw-r--r-- | apt-pkg/deb/debindexfile.h | 12 | ||||
-rw-r--r-- | apt-pkg/deb/deblistparser.cc | 9 | ||||
-rw-r--r-- | apt-pkg/deb/deblistparser.h | 9 | ||||
-rw-r--r-- | apt-pkg/deb/debmetaindex.cc | 2 | ||||
-rw-r--r-- | apt-pkg/deb/debmetaindex.h | 2 | ||||
-rw-r--r-- | apt-pkg/deb/dpkgpm.cc | 17 | ||||
-rw-r--r-- | apt-pkg/deb/dpkgpm.h | 5 |
8 files changed, 54 insertions, 30 deletions
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index 5b4289e92..de6371ace 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -411,8 +411,8 @@ pkgCache::PkgFileIterator debPackagesIndex::FindInCache(pkgCache &Cache) const // TranslationsIndex::debTranslationsIndex - Contructor /*{{{*/ // --------------------------------------------------------------------- /* */ -debTranslationsIndex::debTranslationsIndex(string URI,string Dist,string Section, - char const * const Translation) : +debTranslationsIndex::debTranslationsIndex(std::string URI, std::string Dist, + std::string Section, std::string const &Translation) : pkgIndexFile(true), URI(URI), Dist(Dist), Section(Section), Language(Translation) {} @@ -457,7 +457,7 @@ string debTranslationsIndex::IndexURI(const char *Type) const bool debTranslationsIndex::GetIndexes(pkgAcquire *Owner) const { string const TranslationFile = string("Translation-").append(Language); - new pkgAcqIndexTrans(Owner, IndexURI(Language), + new pkgAcqIndexTrans(Owner, IndexURI(Language.c_str()), Info(TranslationFile.c_str()), TranslationFile); @@ -469,13 +469,13 @@ bool debTranslationsIndex::GetIndexes(pkgAcquire *Owner) const /* This should help the user find the index in the sources.list and in the filesystem for problem solving */ string debTranslationsIndex::Describe(bool Short) const -{ - char S[300]; +{ + std::string S; if (Short == true) - snprintf(S,sizeof(S),"%s",Info(TranslationFile().c_str()).c_str()); + strprintf(S,"%s",Info(TranslationFile().c_str()).c_str()); else - snprintf(S,sizeof(S),"%s (%s)",Info(TranslationFile().c_str()).c_str(), - IndexFile(Language).c_str()); + strprintf(S,"%s (%s)",Info(TranslationFile().c_str()).c_str(), + IndexFile(Language.c_str()).c_str()); return S; } /*}}}*/ @@ -499,7 +499,7 @@ string debTranslationsIndex::Info(const char *Type) const /*}}}*/ bool debTranslationsIndex::HasPackages() const /*{{{*/ { - return FileExists(IndexFile(Language)); + return FileExists(IndexFile(Language.c_str())); } /*}}}*/ // TranslationsIndex::Exists - Check if the index is available /*{{{*/ @@ -507,7 +507,7 @@ bool debTranslationsIndex::HasPackages() const /*{{{*/ /* */ bool debTranslationsIndex::Exists() const { - return FileExists(IndexFile(Language)); + return FileExists(IndexFile(Language.c_str())); } /*}}}*/ // TranslationsIndex::Size - Return the size of the index /*{{{*/ @@ -520,7 +520,7 @@ unsigned long debTranslationsIndex::Size() const /* we need to ignore errors here; if the lists are absent, just return 0 */ _error->PushToStack(); - FileFd f(IndexFile(Language), FileFd::ReadOnly, FileFd::Extension); + FileFd f(IndexFile(Language.c_str()), FileFd::ReadOnly, FileFd::Extension); if (!f.Failed()) size = f.Size(); @@ -537,7 +537,7 @@ unsigned long debTranslationsIndex::Size() const bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const { // Check the translation file, if in use - string TranslationFile = IndexFile(Language); + string TranslationFile = IndexFile(Language.c_str()); if (FileExists(TranslationFile)) { FileFd Trans(TranslationFile,FileFd::ReadOnly, FileFd::Extension); @@ -567,7 +567,7 @@ bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const /* */ pkgCache::PkgFileIterator debTranslationsIndex::FindInCache(pkgCache &Cache) const { - string FileName = IndexFile(Language); + string FileName = IndexFile(Language.c_str()); pkgCache::PkgFileIterator File = Cache.FileBegin(); for (; File.end() == false; ++File) @@ -621,7 +621,7 @@ bool debStatusIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const FileFd Pkg(File,FileFd::ReadOnly, FileFd::Extension); if (_error->PendingError() == true) return false; - debListParser Parser(&Pkg); + debStatusListParser Parser(&Pkg); if (_error->PendingError() == true) return false; diff --git a/apt-pkg/deb/debindexfile.h b/apt-pkg/deb/debindexfile.h index 017c69a0a..2c674087e 100644 --- a/apt-pkg/deb/debindexfile.h +++ b/apt-pkg/deb/debindexfile.h @@ -100,8 +100,8 @@ class debTranslationsIndex : public pkgIndexFile std::string URI; std::string Dist; std::string Section; - const char * const Language; - + std::string Language; + std::string Info(const char *Type) const; std::string IndexFile(const char *Type) const; std::string IndexURI(const char *Type) const; @@ -109,13 +109,13 @@ class debTranslationsIndex : public pkgIndexFile inline std::string TranslationFile() const {return std::string("Translation-").append(Language);}; public: - + virtual const Type *GetType() const APT_CONST; // Interface for acquire - virtual std::string Describe(bool Short) const; + virtual std::string Describe(bool Short) const; virtual bool GetIndexes(pkgAcquire *Owner) const; - + // Interface for the Cache Generator virtual bool Exists() const; virtual bool HasPackages() const; @@ -123,7 +123,7 @@ class debTranslationsIndex : public pkgIndexFile virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const; virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; - debTranslationsIndex(std::string URI,std::string Dist,std::string Section, char const * const Language); + debTranslationsIndex(std::string URI,std::string Dist,std::string Section, std::string const &Language); virtual ~debTranslationsIndex() {}; }; diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index e87e7b5e4..336414775 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -333,7 +333,7 @@ unsigned short debListParser::VersionHash() return Result; } /*}}}*/ -// ListParser::ParseStatus - Parse the status field /*{{{*/ +// StatusListParser::ParseStatus - Parse the status field /*{{{*/ // --------------------------------------------------------------------- /* Status lines are of the form, Status: want flag status @@ -345,6 +345,11 @@ unsigned short debListParser::VersionHash() bool debListParser::ParseStatus(pkgCache::PkgIterator &Pkg, pkgCache::VerIterator &Ver) { + return true; +} +bool debStatusListParser::ParseStatus(pkgCache::PkgIterator &Pkg, + pkgCache::VerIterator &Ver) +{ const char *Start; const char *Stop; if (Section.Find("Status",Start,Stop) == false) @@ -964,7 +969,7 @@ unsigned char debListParser::GetPrio(string Str) return Out; } /*}}}*/ -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 17) bool debListParser::SameVersion(unsigned short const Hash, /*{{{*/ pkgCache::VerIterator const &Ver) { diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h index 3b6963211..d479997a3 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -71,7 +71,7 @@ class debListParser : public pkgCacheGenerator::ListParser virtual std::string DescriptionLanguage(); virtual MD5SumValue Description_md5(); virtual unsigned short VersionHash(); -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 17) virtual bool SameVersion(unsigned short const Hash, pkgCache::VerIterator const &Ver); #endif virtual bool UsePackage(pkgCache::PkgIterator &Pkg, @@ -117,4 +117,11 @@ class debTranslationsParser : public debListParser : debListParser(File, Arch) {}; }; +class APT_HIDDEN debStatusListParser : public debListParser +{ + public: + virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver); + debStatusListParser(FileFd *File) + : debListParser(File) {}; +}; #endif diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 6fd12add8..7d72a6b2b 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -78,7 +78,7 @@ string debReleaseIndex::MetaIndexURI(const char *Type) const return Res; } -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 17) std::string debReleaseIndex::LocalFileName() const { // see if we have a InRelease file diff --git a/apt-pkg/deb/debmetaindex.h b/apt-pkg/deb/debmetaindex.h index 2286fa8b2..7e9e0d482 100644 --- a/apt-pkg/deb/debmetaindex.h +++ b/apt-pkg/deb/debmetaindex.h @@ -51,7 +51,7 @@ class debReleaseIndex : public metaIndex { std::string MetaIndexFile(const char *Types) const; std::string MetaIndexURI(const char *Type) const; -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 17) virtual std::string LocalFileName() const; #endif diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 535db5e9a..eca14f626 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -1057,8 +1057,18 @@ void pkgDPkgPM::BuildPackagesProgressMap() ++PackagesTotal; } /*}}}*/ - -// compat +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 17) +bool pkgDPkgPM::Go(int StatusFd) +{ + APT::Progress::PackageManager *progress = NULL; + if (StatusFd == -1) + progress = APT::Progress::PackageManagerProgressFactory(); + else + progress = new APT::Progress::PackageManagerProgressFd(StatusFd); + + return GoNoABIBreak(progress); +} +#else bool pkgDPkgPM::Go(int StatusFd) { APT::Progress::PackageManager *progress = NULL; @@ -1069,6 +1079,7 @@ bool pkgDPkgPM::Go(int StatusFd) return Go(progress); } +#endif void pkgDPkgPM::StartPtyMagic() { @@ -1223,7 +1234,7 @@ void pkgDPkgPM::StopPtyMagic() * through to human readable (and i10n-able) * names and calculates a percentage for each step. */ -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 17) bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress) #else bool pkgDPkgPM::GoNoABIBreak(APT::Progress::PackageManager *progress) diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h index 733962bdc..a5e1fe221 100644 --- a/apt-pkg/deb/dpkgpm.h +++ b/apt-pkg/deb/dpkgpm.h @@ -118,7 +118,7 @@ class pkgDPkgPM : public pkgPackageManager void DoTerminalPty(int master); void DoDpkgStatusFd(int statusfd); void ProcessDpkgStatusLine(char *line); -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 13) +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR < 17) void DoDpkgStatusFd(int statusfd, int /*unused*/) { DoDpkgStatusFd(statusfd); } @@ -133,8 +133,9 @@ class pkgDPkgPM : public pkgPackageManager virtual bool Configure(PkgIterator Pkg); virtual bool Remove(PkgIterator Pkg,bool Purge = false); -#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) +#if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 17) virtual bool Go(APT::Progress::PackageManager *progress); + // compat virtual bool Go(int StatusFd=-1); #else virtual bool Go(int StatusFd=-1); |