From 56d724dfb58962bd444e082c6b7a2ccc66e68e00 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Fri, 27 May 2011 06:31:31 +0000 Subject: [PATCH] Attempt to skip and resync any seriously broken semantics in package sections. A torque.diff git-svn-id: http://svn.telesphoreo.org/trunk@756 514c082c-b64e-11dc-b46d-3d985efe055d --- apt-pkg/deb/deblistparser.cc | 13 ++++++--- apt-pkg/pkgcachegen.cc | 56 ++++++++++++++++++++++++------------ 2 files changed, 47 insertions(+), 22 deletions(-) diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 6557e76..20739e0 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -572,8 +572,10 @@ bool debListParser::ParseDepends(pkgCache::VerIterator Ver, while (1) { Start = ParseDepends(Start,Stop,Package,Version,Op); - if (Start == 0) - return _error->Error("Problem parsing dependency %s",Tag); + if (Start == 0) { + _error->Warning("Problem parsing dependency %s",Tag); + return false; + } if (NewDepends(Ver,Package,Version,Op,Type) == false) return false; @@ -600,8 +602,11 @@ bool debListParser::ParseProvides(pkgCache::VerIterator Ver) while (1) { Start = ParseDepends(Start,Stop,Package,Version,Op); - if (Start == 0) - return _error->Error("Problem parsing Provides line"); + if (Start == 0) { + _error->Warning("Problem parsing Provides line"); + return false; + } + if (Op != pkgCache::Dep::NoOp) { _error->Warning("Ignoring Provides line with DepCompareOp for package %s", std::string(Package).c_str()); } else { diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index 48a7976..f20c3e5 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -108,6 +108,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List, debListParser *debian(dynamic_cast(&List)); unsigned int Counter = 0; + step: while (List.Step() == true) { // Get a pointer to the package structure @@ -120,8 +121,11 @@ bool pkgCacheGenerator::MergeList(ListParser &List, return false; pkgCache::PkgIterator Pkg; - if (NewPackage(Pkg,PackageName) == false) - return _error->Error(_("Error occurred while processing %s (NewPackage)"),std::string(PackageName).c_str()); + if (NewPackage(Pkg,PackageName) == false) { + _error->Warning(_("Error occurred while processing %s (NewPackage)"),std::string(PackageName).c_str()); + goto step; + } + Counter++; if (Counter % 100 == 0 && Progress != 0) Progress->Progress(List.Offset()); @@ -141,9 +145,11 @@ bool pkgCacheGenerator::MergeList(ListParser &List, // we first process the package, then the descriptions // (this has the bonus that we get MMap error when we run out // of MMap space) - if (List.UsePackage(Pkg,pkgCache::VerIterator(Cache)) == false) - return _error->Error(_("Error occurred while processing %s (UsePackage1)"), + if (List.UsePackage(Pkg,pkgCache::VerIterator(Cache)) == false) { + _error->Warning(_("Error occurred while processing %s (UsePackage1)"), std::string(PackageName).c_str()); + goto step; + } // Find the right version to write the description MD5SumValue CurMd5 = List.Description_md5(); @@ -175,8 +181,10 @@ bool pkgCacheGenerator::MergeList(ListParser &List, *LastDesc = NewDescription(Desc, language, CurMd5, *LastDesc); Desc->ParentPkg = Pkg.Index(); - if ((*LastDesc == 0 && _error->PendingError()) || NewFileDesc(Desc,List) == false) - return _error->Error(_("Error occurred while processing %s (NewFileDesc1)"),std::string(PackageName).c_str()); + if ((*LastDesc == 0 && _error->PendingError()) || NewFileDesc(Desc,List) == false) { + _error->Warning(_("Error occurred while processing %s (NewFileDesc1)"),std::string(PackageName).c_str()); + goto step; + } break; } } @@ -200,13 +208,17 @@ bool pkgCacheGenerator::MergeList(ListParser &List, unsigned long Hash = List.VersionHash(); if (Res == 0 && Ver->Hash == Hash) { - if (List.UsePackage(Pkg,Ver) == false) - return _error->Error(_("Error occurred while processing %s (UsePackage2)"), + if (List.UsePackage(Pkg,Ver) == false) { + _error->Warning(_("Error occurred while processing %s (UsePackage2)"), std::string(PackageName).c_str()); + goto step; + } - if (NewFileVer(Ver,List) == false) - return _error->Error(_("Error occurred while processing %s (NewFileVer1)"), + if (NewFileVer(Ver,List) == false) { + _error->Warning(_("Error occurred while processing %s (NewFileVer1)"), std::string(PackageName).c_str()); + goto step; + } // Read only a single record and return if (OutVer != 0) @@ -235,17 +247,23 @@ bool pkgCacheGenerator::MergeList(ListParser &List, Ver->ParentPkg = Pkg.Index(); Ver->Hash = Hash; - if ((*LastVer == 0 && _error->PendingError()) || List.NewVersion(Ver) == false) - return _error->Error(_("Error occurred while processing %s (NewVersion1)"), + if ((*LastVer == 0 && _error->PendingError()) || List.NewVersion(Ver) == false) { + _error->Warning(_("Error occurred while processing %s (NewVersion1)"), std::string(PackageName).c_str()); + goto step; + } - if (List.UsePackage(Pkg,Ver) == false) - return _error->Error(_("Error occurred while processing %s (UsePackage3)"), + if (List.UsePackage(Pkg,Ver) == false) { + _error->Warning(_("Error occurred while processing %s (UsePackage3)"), std::string(PackageName).c_str()); + goto step; + } - if (NewFileVer(Ver,List) == false) - return _error->Error(_("Error occurred while processing %s (NewVersion2)"), + if (NewFileVer(Ver,List) == false) { + _error->Warning(_("Error occurred while processing %s (NewVersion2)"), std::string(PackageName).c_str()); + goto step; + } // Read only a single record and return if (OutVer != 0) @@ -267,8 +285,10 @@ bool pkgCacheGenerator::MergeList(ListParser &List, *LastDesc = NewDescription(Desc, language, List.Description_md5(), *LastDesc); Desc->ParentPkg = Pkg.Index(); - if ((*LastDesc == 0 && _error->PendingError()) || NewFileDesc(Desc,List) == false) - return _error->Error(_("Error occurred while processing %s (NewFileDesc2)"),std::string(PackageName).c_str()); + if ((*LastDesc == 0 && _error->PendingError()) || NewFileDesc(Desc,List) == false) { + _error->Warning(_("Error occurred while processing %s (NewFileDesc2)"),std::string(PackageName).c_str()); + goto step; + } } FoundFileDeps |= List.HasFileDeps(); -- 2.47.2