]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/deb/debrecords.cc
German translation proof read by Helge Kreutzmann
[apt.git] / apt-pkg / deb / debrecords.cc
index 335bcfda0ac2207307c05d4ba67764ba1e98d2b1..a132f34a6d95182879830e7c5b0712c64b890a32 100644 (file)
@@ -34,7 +34,7 @@ using std::string;
 
 // RecordParser::debRecordParser - Constructor                         /*{{{*/
 debRecordParser::debRecordParser(string FileName,pkgCache &Cache) :
 
 // RecordParser::debRecordParser - Constructor                         /*{{{*/
 debRecordParser::debRecordParser(string FileName,pkgCache &Cache) :
-   debRecordParserBase(), File(FileName, FileFd::ReadOnly, FileFd::Extension),
+   debRecordParserBase(), d(NULL), File(FileName, FileFd::ReadOnly, FileFd::Extension),
    Tags(&File, std::max(Cache.Head().MaxVerFileSize, Cache.Head().MaxDescFileSize) + 200)
 {
 }
    Tags(&File, std::max(Cache.Head().MaxVerFileSize, Cache.Head().MaxDescFileSize) + 200)
 {
 }
@@ -42,15 +42,20 @@ debRecordParser::debRecordParser(string FileName,pkgCache &Cache) :
 // RecordParser::Jump - Jump to a specific record                      /*{{{*/
 bool debRecordParser::Jump(pkgCache::VerFileIterator const &Ver)
 {
 // RecordParser::Jump - Jump to a specific record                      /*{{{*/
 bool debRecordParser::Jump(pkgCache::VerFileIterator const &Ver)
 {
+   if (Ver.end() == true)
+      return false;
    return Tags.Jump(Section,Ver->Offset);
 }
 bool debRecordParser::Jump(pkgCache::DescFileIterator const &Desc)
 {
    return Tags.Jump(Section,Ver->Offset);
 }
 bool debRecordParser::Jump(pkgCache::DescFileIterator const &Desc)
 {
+   if (Desc.end() == true)
+      return false;
    return Tags.Jump(Section,Desc->Offset);
 }
                                                                        /*}}}*/
 debRecordParser::~debRecordParser() {}
 
    return Tags.Jump(Section,Desc->Offset);
 }
                                                                        /*}}}*/
 debRecordParser::~debRecordParser() {}
 
+debRecordParserBase::debRecordParserBase() : Parser(), d(NULL) {}
 // RecordParserBase::FileName - Return the archive filename on the site        /*{{{*/
 string debRecordParserBase::FileName()
 {
 // RecordParserBase::FileName - Return the archive filename on the site        /*{{{*/
 string debRecordParserBase::FileName()
 {
@@ -60,7 +65,13 @@ string debRecordParserBase::FileName()
 // RecordParserBase::Name - Return the package name                    /*{{{*/
 string debRecordParserBase::Name()
 {
 // RecordParserBase::Name - Return the package name                    /*{{{*/
 string debRecordParserBase::Name()
 {
-   return Section.FindS("Package");
+   string Result = Section.FindS("Package");
+
+   // Normalize mixed case package names to lower case, like dpkg does
+   // See Bug#807012 for details
+   std::transform(Result.begin(), Result.end(), Result.begin(), tolower_ascii);
+
+   return Result;
 }
                                                                        /*}}}*/
 // RecordParserBase::Homepage - Return the package homepage            /*{{{*/
 }
                                                                        /*}}}*/
 // RecordParserBase::Homepage - Return the package homepage            /*{{{*/
@@ -79,6 +90,9 @@ HashStringList debRecordParserBase::Hashes() const
       if (hash.empty() == false)
         hashes.push_back(HashString(*type, hash));
    }
       if (hash.empty() == false)
         hashes.push_back(HashString(*type, hash));
    }
+   auto const size = Section.FindULL("Size", 0);
+   if (size != 0)
+      hashes.FileSize(size);
    return hashes;
 }
                                                                        /*}}}*/
    return hashes;
 }
                                                                        /*}}}*/
@@ -207,3 +221,9 @@ bool debDebFileRecordParser::LoadContent()
       return _error->Error(_("Unable to parse package file %s (%d)"), debFileName.c_str(), 3);
    return true;
 }
       return _error->Error(_("Unable to parse package file %s (%d)"), debFileName.c_str(), 3);
    return true;
 }
+bool debDebFileRecordParser::Jump(pkgCache::VerFileIterator const &) { return LoadContent(); }
+bool debDebFileRecordParser::Jump(pkgCache::DescFileIterator const &) { return LoadContent(); }
+std::string debDebFileRecordParser::FileName() { return debFileName; }
+
+debDebFileRecordParser::debDebFileRecordParser(std::string FileName) : debRecordParserBase(), d(NULL), debFileName(FileName) {}
+debDebFileRecordParser::~debDebFileRecordParser() {}