diff options
author | Michael Vogt <mvo@debian.org> | 2010-07-12 13:26:10 +0200 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2010-07-12 13:26:10 +0200 |
commit | 2a679f4f71784800b6643b5c4eecb4b11865a439 (patch) | |
tree | c8b5f2967f09a3001becf5fb6ff634d933e171a2 /apt-pkg/deb | |
parent | 137a73dc58b14f71a11da5940e099725f6dad8ef (diff) | |
parent | d10cef824604012516f26efaae8bab1f29a7820a (diff) |
merged from lp:~donkult/apt/sid
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r-- | apt-pkg/deb/debindexfile.cc | 47 | ||||
-rw-r--r-- | apt-pkg/deb/deblistparser.cc | 2 | ||||
-rw-r--r-- | apt-pkg/deb/debmetaindex.cc | 16 | ||||
-rw-r--r-- | apt-pkg/deb/debrecords.cc | 2 | ||||
-rw-r--r-- | apt-pkg/deb/debsrcrecords.h | 2 |
5 files changed, 50 insertions, 19 deletions
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index 5e6db3f38..ba5b3f266 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -63,9 +63,13 @@ string debSourcesIndex::SourceInfo(pkgSrcRecords::Parser const &Record, /* */ pkgSrcRecords::Parser *debSourcesIndex::CreateSrcParser() const { - string SourcesURI = URItoFileName(IndexURI("Sources")); - return new debSrcRecordParser(_config->FindDir("Dir::State::lists") + - SourcesURI,this); + string SourcesURI = _config->FindDir("Dir::State::lists") + + URItoFileName(IndexURI("Sources")); + string SourcesURIgzip = SourcesURI + ".gz"; + if (!FileExists(SourcesURI) && FileExists(SourcesURIgzip)) + SourcesURI = SourcesURIgzip; + + return new debSrcRecordParser(SourcesURI,this); } /*}}}*/ // SourcesIndex::Describe - Give a descriptive path to the index /*{{{*/ @@ -106,8 +110,14 @@ string debSourcesIndex::Info(const char *Type) const /* */ inline string debSourcesIndex::IndexFile(const char *Type) const { - return URItoFileName(IndexURI(Type)); + string s = URItoFileName(IndexURI(Type)); + string sgzip = s + ".gz"; + if (!FileExists(s) && FileExists(sgzip)) + return sgzip; + else + return s; } + string debSourcesIndex::IndexURI(const char *Type) const { string Res; @@ -174,8 +184,8 @@ string debPackagesIndex::ArchiveInfo(pkgCache::VerIterator Ver) const Res += " "; Res += Ver.ParentPkg().Name(); Res += " "; - Res += Ver.Arch(); - Res += " "; + if (Dist[Dist.size() - 1] != '/') + Res.append(Ver.Arch()).append(" "); Res += Ver.VerStr(); return Res; } @@ -209,8 +219,8 @@ string debPackagesIndex::Info(const char *Type) const else Info += Dist + '/' + Section; Info += " "; - Info += Architecture; - Info += " "; + if (Dist[Dist.size() - 1] != '/') + Info += Architecture + " "; Info += Type; return Info; } @@ -220,7 +230,12 @@ string debPackagesIndex::Info(const char *Type) const /* */ inline string debPackagesIndex::IndexFile(const char *Type) const { - return _config->FindDir("Dir::State::lists") + URItoFileName(IndexURI(Type)); + string s =_config->FindDir("Dir::State::lists") + URItoFileName(IndexURI(Type)); + string sgzip = s + ".gz"; + if (!FileExists(s) && FileExists(sgzip)) + return sgzip; + else + return s; } string debPackagesIndex::IndexURI(const char *Type) const { @@ -265,8 +280,9 @@ unsigned long debPackagesIndex::Size() const bool debPackagesIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const { string PackageFile = IndexFile("Packages"); - FileFd Pkg(PackageFile,FileFd::ReadOnly); + FileFd Pkg(PackageFile,FileFd::ReadOnlyGzip); debListParser Parser(&Pkg, Architecture); + if (_error->PendingError() == true) return _error->Error("Problem opening %s",PackageFile.c_str()); if (Prog != NULL) @@ -348,7 +364,12 @@ debTranslationsIndex::debTranslationsIndex(string URI,string Dist,string Section /* */ inline string debTranslationsIndex::IndexFile(const char *Type) const { - return _config->FindDir("Dir::State::lists") + URItoFileName(IndexURI(Type)); + string s =_config->FindDir("Dir::State::lists") + URItoFileName(IndexURI(Type)); + string sgzip = s + ".gz"; + if (!FileExists(s) && FileExists(sgzip)) + return sgzip; + else + return s; } string debTranslationsIndex::IndexURI(const char *Type) const { @@ -452,7 +473,7 @@ bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const string TranslationFile = IndexFile(Language); if (TranslationsAvailable() && FileExists(TranslationFile)) { - FileFd Trans(TranslationFile,FileFd::ReadOnly); + FileFd Trans(TranslationFile,FileFd::ReadOnlyGzip); debListParser TransParser(&Trans); if (_error->PendingError() == true) return false; @@ -533,7 +554,7 @@ unsigned long debStatusIndex::Size() const /* */ bool debStatusIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const { - FileFd Pkg(File,FileFd::ReadOnly); + FileFd Pkg(File,FileFd::ReadOnlyGzip); if (_error->PendingError() == true) return false; debListParser Parser(&Pkg); diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 2cfeb23e9..5fb737970 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -757,7 +757,7 @@ bool debListParser::Step() if (Architecture.empty() == true) return true; - if (Arch.empty() == true || MultiArchEnabled == false) + if (Arch.empty() == true || Arch == "any" || MultiArchEnabled == false) { if (APT::Configuration::checkArchitecture(Architecture) == true) return true; diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 8df3ed18d..717d0bcde 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -23,7 +23,7 @@ string debReleaseIndex::Info(const char *Type, string const &Section, string con else { Info += Dist + '/' + Section; - if (Arch.empty() == true) + if (Arch.empty() != true) Info += " " + Arch; } Info += " "; @@ -332,7 +332,12 @@ class debSLTypeDebian : public pkgSourceList::Type if (IsSrc == true) Deb->PushSectionEntry("source", new debReleaseIndex::debSectionEntry(Section, IsSrc)); else - Deb->PushSectionEntry(Archs, new debReleaseIndex::debSectionEntry(Section, IsSrc)); + { + if (Dist[Dist.size() - 1] == '/') + Deb->PushSectionEntry("any", new debReleaseIndex::debSectionEntry(Section, IsSrc)); + else + Deb->PushSectionEntry(Archs, new debReleaseIndex::debSectionEntry(Section, IsSrc)); + } return true; } } @@ -342,7 +347,12 @@ class debSLTypeDebian : public pkgSourceList::Type if (IsSrc == true) Deb->PushSectionEntry ("source", new debReleaseIndex::debSectionEntry(Section, IsSrc)); else - Deb->PushSectionEntry (Archs, new debReleaseIndex::debSectionEntry(Section, IsSrc)); + { + if (Dist[Dist.size() - 1] == '/') + Deb->PushSectionEntry ("any", new debReleaseIndex::debSectionEntry(Section, IsSrc)); + else + Deb->PushSectionEntry (Archs, new debReleaseIndex::debSectionEntry(Section, IsSrc)); + } List.push_back(Deb); return true; } diff --git a/apt-pkg/deb/debrecords.cc b/apt-pkg/deb/debrecords.cc index 34ef0d8f2..ec9e395ef 100644 --- a/apt-pkg/deb/debrecords.cc +++ b/apt-pkg/deb/debrecords.cc @@ -19,7 +19,7 @@ // --------------------------------------------------------------------- /* */ debRecordParser::debRecordParser(string FileName,pkgCache &Cache) : - File(FileName,FileFd::ReadOnly), + File(FileName,FileFd::ReadOnlyGzip), Tags(&File, std::max(Cache.Head().MaxVerFileSize, Cache.Head().MaxDescFileSize) + 200) { diff --git a/apt-pkg/deb/debsrcrecords.h b/apt-pkg/deb/debsrcrecords.h index c39d78bae..905264daa 100644 --- a/apt-pkg/deb/debsrcrecords.h +++ b/apt-pkg/deb/debsrcrecords.h @@ -48,7 +48,7 @@ class debSrcRecordParser : public pkgSrcRecords::Parser virtual bool Files(vector<pkgSrcRecords::File> &F); debSrcRecordParser(string const &File,pkgIndexFile const *Index) - : Parser(Index), Fd(File,FileFd::ReadOnly), Tags(&Fd,102400), + : Parser(Index), Fd(File,FileFd::ReadOnlyGzip), Tags(&Fd,102400), Buffer(0), BufSize(0) {} ~debSrcRecordParser(); }; |