diff options
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r-- | apt-pkg/deb/debindexfile.cc | 174 | ||||
-rw-r--r-- | apt-pkg/deb/debindexfile.h | 30 | ||||
-rw-r--r-- | apt-pkg/deb/deblistparser.cc | 47 | ||||
-rw-r--r-- | apt-pkg/deb/deblistparser.h | 4 | ||||
-rw-r--r-- | apt-pkg/deb/debmetaindex.cc | 15 | ||||
-rw-r--r-- | apt-pkg/deb/debrecords.cc | 23 | ||||
-rw-r--r-- | apt-pkg/deb/debrecords.h | 2 |
7 files changed, 5 insertions, 290 deletions
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index 38ecdd16a..ff8bce85d 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -320,170 +320,6 @@ pkgCache::PkgFileIterator debPackagesIndex::FindInCache(pkgCache &Cache) const } /*}}}*/ -// TranslationsIndex::debTranslationsIndex - Contructor /*{{{*/ -// --------------------------------------------------------------------- -/* */ -debTranslationsIndex::debTranslationsIndex(string URI,string Dist,string Section) : - pkgIndexFile(true), URI(URI), Dist(Dist), Section(Section) -{ -} - /*}}}*/ -// TranslationIndex::Trans* - Return the URI to the translation files /*{{{*/ -// --------------------------------------------------------------------- -/* */ -inline string debTranslationsIndex::IndexFile(const char *Type) const -{ - return _config->FindDir("Dir::State::lists") + URItoFileName(IndexURI(Type)); -} -string debTranslationsIndex::IndexURI(const char *Type) const -{ - string Res; - if (Dist[Dist.size() - 1] == '/') - { - if (Dist != "/") - Res = URI + Dist; - else - Res = URI; - } - else - Res = URI + "dists/" + Dist + '/' + Section + - "/i18n/Translation-"; - - Res += Type; - return Res; -} - /*}}}*/ -// TranslationsIndex::GetIndexes - Fetch the index files /*{{{*/ -// --------------------------------------------------------------------- -/* */ -bool debTranslationsIndex::GetIndexes(pkgAcquire *Owner) const -{ - if (TranslationsAvailable()) { - string TranslationFile = "Translation-" + LanguageCode(); - new pkgAcqIndexTrans(Owner, IndexURI(LanguageCode().c_str()), - Info(TranslationFile.c_str()), - TranslationFile); - } - - return true; -} - /*}}}*/ -// TranslationsIndex::Describe - Give a descriptive path to the index /*{{{*/ -// --------------------------------------------------------------------- -/* 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]; - if (Short == true) - snprintf(S,sizeof(S),"%s",Info(TranslationFile().c_str()).c_str()); - else - snprintf(S,sizeof(S),"%s (%s)",Info(TranslationFile().c_str()).c_str(), - IndexFile(LanguageCode().c_str()).c_str()); - return S; -} - /*}}}*/ -// TranslationsIndex::Info - One liner describing the index URI /*{{{*/ -// --------------------------------------------------------------------- -/* */ -string debTranslationsIndex::Info(const char *Type) const -{ - string Info = ::URI::SiteOnly(URI) + ' '; - if (Dist[Dist.size() - 1] == '/') - { - if (Dist != "/") - Info += Dist; - } - else - Info += Dist + '/' + Section; - Info += " "; - Info += Type; - return Info; -} - /*}}}*/ -bool debTranslationsIndex::HasPackages() const -{ - if(!TranslationsAvailable()) - return false; - - return FileExists(IndexFile(LanguageCode().c_str())); -} - -// TranslationsIndex::Exists - Check if the index is available /*{{{*/ -// --------------------------------------------------------------------- -/* */ -bool debTranslationsIndex::Exists() const -{ - return FileExists(IndexFile(LanguageCode().c_str())); -} - /*}}}*/ -// TranslationsIndex::Size - Return the size of the index /*{{{*/ -// --------------------------------------------------------------------- -/* This is really only used for progress reporting. */ -unsigned long debTranslationsIndex::Size() const -{ - struct stat S; - if (stat(IndexFile(LanguageCode().c_str()).c_str(),&S) != 0) - return 0; - return S.st_size; -} - /*}}}*/ -// TranslationsIndex::Merge - Load the index file into a cache /*{{{*/ -// --------------------------------------------------------------------- -/* */ -bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const -{ - // Check the translation file, if in use - string TranslationFile = IndexFile(LanguageCode().c_str()); - if (TranslationsAvailable() && FileExists(TranslationFile)) - { - FileFd Trans(TranslationFile,FileFd::ReadOnly); - debListParser TransParser(&Trans); - if (_error->PendingError() == true) - return false; - - Prog.SubProgress(0, Info(TranslationFile.c_str())); - if (Gen.SelectFile(TranslationFile,string(),*this) == false) - return _error->Error("Problem with SelectFile %s",TranslationFile.c_str()); - - // Store the IMS information - pkgCache::PkgFileIterator TransFile = Gen.GetCurFile(); - struct stat TransSt; - if (fstat(Trans.Fd(),&TransSt) != 0) - return _error->Errno("fstat","Failed to stat"); - TransFile->Size = TransSt.st_size; - TransFile->mtime = TransSt.st_mtime; - - if (Gen.MergeList(TransParser) == false) - return _error->Error("Problem with MergeList %s",TranslationFile.c_str()); - } - - return true; -} - /*}}}*/ -// TranslationsIndex::FindInCache - Find this index /*{{{*/ -// --------------------------------------------------------------------- -/* */ -pkgCache::PkgFileIterator debTranslationsIndex::FindInCache(pkgCache &Cache) const -{ - string FileName = IndexFile(LanguageCode().c_str()); - - pkgCache::PkgFileIterator File = Cache.FileBegin(); - for (; File.end() == false; File++) - { - if (FileName != File.FileName()) - continue; - - struct stat St; - if (stat(File.FileName(),&St) != 0) - return pkgCache::PkgFileIterator(Cache); - if ((unsigned)St.st_size != File->Size || St.st_mtime != File->mtime) - return pkgCache::PkgFileIterator(Cache); - return File; - } - return File; -} - /*}}}*/ // StatusIndex::debStatusIndex - Constructor /*{{{*/ // --------------------------------------------------------------------- /* */ @@ -580,11 +416,6 @@ class debIFTypePkg : public pkgIndexFile::Type }; debIFTypePkg() {Label = "Debian Package Index";}; }; -class debIFTypeTrans : public debIFTypePkg -{ - public: - debIFTypeTrans() {Label = "Debian Translation Index";}; -}; class debIFTypeStatus : public pkgIndexFile::Type { public: @@ -597,7 +428,6 @@ class debIFTypeStatus : public pkgIndexFile::Type }; static debIFTypeSrc _apt_Src; static debIFTypePkg _apt_Pkg; -static debIFTypeTrans _apt_Trans; static debIFTypeStatus _apt_Status; const pkgIndexFile::Type *debSourcesIndex::GetType() const @@ -608,10 +438,6 @@ const pkgIndexFile::Type *debPackagesIndex::GetType() const { return &_apt_Pkg; } -const pkgIndexFile::Type *debTranslationsIndex::GetType() const -{ - return &_apt_Trans; -} const pkgIndexFile::Type *debStatusIndex::GetType() const { return &_apt_Status; diff --git a/apt-pkg/deb/debindexfile.h b/apt-pkg/deb/debindexfile.h index 57005222f..a1b9583a4 100644 --- a/apt-pkg/deb/debindexfile.h +++ b/apt-pkg/deb/debindexfile.h @@ -74,36 +74,6 @@ class debPackagesIndex : public pkgIndexFile debPackagesIndex(string URI,string Dist,string Section,bool Trusted); }; -class debTranslationsIndex : public pkgIndexFile -{ - string URI; - string Dist; - string Section; - - string Info(const char *Type) const; - string IndexFile(const char *Type) const; - string IndexURI(const char *Type) const; - - inline string TranslationFile() const {return "Translation-" + LanguageCode();}; - - public: - - virtual const Type *GetType() const; - - // Interface for acquire - virtual string Describe(bool Short) const; - virtual bool GetIndexes(pkgAcquire *Owner) const; - - // Interface for the Cache Generator - virtual bool Exists() const; - virtual bool HasPackages() const; - virtual unsigned long Size() const; - virtual bool Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const; - virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; - - debTranslationsIndex(string URI,string Dist,string Section); -}; - class debSourcesIndex : public pkgIndexFile { string URI; diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 97553ab82..b11d2531c 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -15,7 +15,6 @@ #include <apt-pkg/configuration.h> #include <apt-pkg/strutl.h> #include <apt-pkg/crc-16.h> -#include <apt-pkg/md5.h> #include <ctype.h> @@ -118,48 +117,6 @@ bool debListParser::NewVersion(pkgCache::VerIterator Ver) return true; } /*}}}*/ -// ListParser::Description - Return the description string /*{{{*/ -// --------------------------------------------------------------------- -/* This is to return the string describing the package in debian - form. If this returns the blank string then the entry is assumed to - only describe package properties */ -string debListParser::Description() -{ - if (DescriptionLanguage().empty()) - return Section.FindS("Description"); - else - return Section.FindS(("Description-" + pkgIndexFile::LanguageCode()).c_str()); -} - /*}}}*/ -// ListParser::DescriptionLanguage - Return the description lang string /*{{{*/ -// --------------------------------------------------------------------- -/* This is to return the string describing the language of - description. If this returns the blank string then the entry is - assumed to describe original description. */ -string debListParser::DescriptionLanguage() -{ - return Section.FindS("Description").empty() ? pkgIndexFile::LanguageCode() : ""; -} - /*}}}*/ -// ListParser::Description - Return the description_md5 MD5SumValue /*{{{*/ -// --------------------------------------------------------------------- -/* This is to return the md5 string to allow the check if it is the right - description. If no Description-md5 is found in the section it will be - calculated. - */ -MD5SumValue debListParser::Description_md5() -{ - string value = Section.FindS("Description-md5"); - - if (value.empty()) - { - MD5Summation md5; - md5.Add((Description() + "\n").c_str()); - return md5.Result(); - } else - return MD5SumValue(value); -} - /*}}}*/ // ListParser::UsePackage - Update a package structure /*{{{*/ // --------------------------------------------------------------------- /* This is called to update the package with any new information @@ -420,12 +377,12 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop, const char *End = I; for (; End > Start && isspace(End[-1]); End--); - Ver = string(Start,End-Start); + Ver.assign(Start,End-Start); I++; } else { - Ver = string(); + Ver.clear(); Op = pkgCache::Dep::NoOp; } diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h index 34bb29c72..3a0e0421b 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -12,7 +12,6 @@ #define PKGLIB_DEBLISTPARSER_H #include <apt-pkg/pkgcachegen.h> -#include <apt-pkg/indexfile.h> #include <apt-pkg/tagfile.h> class debListParser : public pkgCacheGenerator::ListParser @@ -48,9 +47,6 @@ class debListParser : public pkgCacheGenerator::ListParser virtual string Package(); virtual string Version(); virtual bool NewVersion(pkgCache::VerIterator Ver); - virtual string Description(); - virtual string DescriptionLanguage(); - virtual MD5SumValue Description_md5(); virtual unsigned short VersionHash(); virtual bool UsePackage(pkgCache::PkgIterator Pkg, pkgCache::VerIterator Ver); diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index d3b6ed957..85e5b16b3 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -157,14 +157,6 @@ bool debReleaseIndex::GetIndexes(pkgAcquire *Owner, bool GetAll) const ComputeIndexTargets(), new indexRecords (Dist)); - // Queue the translations - for (vector<const debSectionEntry *>::const_iterator I = SectionEntries.begin(); - I != SectionEntries.end(); I++) { - - debTranslationsIndex i = debTranslationsIndex(URI,Dist,(*I)->Section); - i.GetIndexes(Owner); - } - return true; } @@ -189,16 +181,11 @@ vector <pkgIndexFile *> *debReleaseIndex::GetIndexFiles() Indexes = new vector <pkgIndexFile*>; for (vector<const debSectionEntry *>::const_iterator I = SectionEntries.begin(); - I != SectionEntries.end(); I++) { + I != SectionEntries.end(); I++) if ((*I)->IsSrc) Indexes->push_back(new debSourcesIndex (URI, Dist, (*I)->Section, IsTrusted())); else - { Indexes->push_back(new debPackagesIndex (URI, Dist, (*I)->Section, IsTrusted())); - Indexes->push_back(new debTranslationsIndex(URI, Dist, (*I)->Section)); - } - } - return Indexes; } diff --git a/apt-pkg/deb/debrecords.cc b/apt-pkg/deb/debrecords.cc index 518988bb6..6652a6ad9 100644 --- a/apt-pkg/deb/debrecords.cc +++ b/apt-pkg/deb/debrecords.cc @@ -12,9 +12,7 @@ #pragma implementation "apt-pkg/debrecords.h" #endif #include <apt-pkg/debrecords.h> -#include <apt-pkg/strutl.h> #include <apt-pkg/error.h> -#include <langinfo.h> /*}}}*/ // RecordParser::debRecordParser - Constructor /*{{{*/ @@ -33,10 +31,6 @@ bool debRecordParser::Jump(pkgCache::VerFileIterator const &Ver) { return Tags.Jump(Section,Ver->Offset); } -bool debRecordParser::Jump(pkgCache::DescFileIterator const &Desc) -{ - return Tags.Jump(Section,Desc->Offset); -} /*}}}*/ // RecordParser::FileName - Return the archive filename on the site /*{{{*/ // --------------------------------------------------------------------- @@ -83,7 +77,7 @@ string debRecordParser::Maintainer() /* */ string debRecordParser::ShortDesc() { - string Res = LongDesc(); + string Res = Section.FindS("Description"); string::size_type Pos = Res.find('\n'); if (Pos == string::npos) return Res; @@ -95,20 +89,7 @@ string debRecordParser::ShortDesc() /* */ string debRecordParser::LongDesc() { - string orig, dest; - char *codeset = nl_langinfo(CODESET); - - if (!Section.FindS("Description").empty()) - orig = Section.FindS("Description").c_str(); - else - orig = Section.FindS(("Description-" + pkgIndexFile::LanguageCode()).c_str()).c_str(); - - if (strcmp(codeset,"UTF-8") != 0) { - UTF8ToCodeset(codeset, orig, &dest); - orig = dest; - } - - return orig; + return Section.FindS("Description"); } /*}}}*/ // RecordParser::SourcePkg - Return the source package name if any /*{{{*/ diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h index 24e5aab88..efef2e588 100644 --- a/apt-pkg/deb/debrecords.h +++ b/apt-pkg/deb/debrecords.h @@ -19,7 +19,6 @@ #endif #include <apt-pkg/pkgrecords.h> -#include <apt-pkg/indexfile.h> #include <apt-pkg/tagfile.h> class debRecordParser : public pkgRecords::Parser @@ -31,7 +30,6 @@ class debRecordParser : public pkgRecords::Parser protected: virtual bool Jump(pkgCache::VerFileIterator const &Ver); - virtual bool Jump(pkgCache::DescFileIterator const &Desc); public: |