summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/deblistparser.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2009-12-19 16:25:56 +0100
committerDavid Kalnischkies <kalnischkies@gmail.com>2009-12-19 16:25:56 +0100
commit5bf15716398fdb767ca6249a0155219b88d7ae60 (patch)
tree35a5f1db804539d0fb2d3260d5557a4edde73838 /apt-pkg/deb/deblistparser.cc
parent201d1fa0d25deeda77c2570ee5342eaf18499699 (diff)
Implement the first step toward Multi-Arch by setting up a Group
infrastructor for packages. APT is now aware of the fact that a package A in architecture X can't satisfy a dependency on package A in architecture Y - to handle these packages are now identified by name and architecture, so different architectures of the same package are handled internally as completly different packages. This is great for pinning, dependency checking and in many other situations, but sometimes we need to know which archs are available for a given package: Here Groups come to our rescue!
Diffstat (limited to 'apt-pkg/deb/deblistparser.cc')
-rw-r--r--apt-pkg/deb/deblistparser.cc40
1 files changed, 29 insertions, 11 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 25a1df3f9..fe68aec0b 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -53,12 +53,25 @@ unsigned long debListParser::UniqFindTagWrite(const char *Tag)
// ListParser::Package - Return the package name /*{{{*/
// ---------------------------------------------------------------------
/* This is to return the name of the package this section describes */
-string debListParser::Package()
-{
- string Result = Section.FindS("Package");
- if (Result.empty() == true)
- _error->Error("Encountered a section with no Package: header");
- return Result;
+string debListParser::Package() {
+ string const Result = Section.FindS("Package");
+ if(unlikely(Result.empty() == true))
+ _error->Error("Encountered a section with no Package: header");
+ return Result;
+}
+ /*}}}*/
+// ListParser::Architecture - Return the package arch /*{{{*/
+// ---------------------------------------------------------------------
+/* This will return the Architecture of the package this section describes
+ Note that architecture "all" packages will get the architecture of the
+ Packages file parsed here */
+string debListParser::Architecture() {
+ string const Result = Section.FindS("Architecture");
+ if (Result.empty() == true)
+ return Arch;
+ if (Result == "all")
+ return Arch;
+ return Result;
}
/*}}}*/
// ListParser::Version - Return the version string /*{{{*/
@@ -78,8 +91,10 @@ bool debListParser::NewVersion(pkgCache::VerIterator Ver)
{
// Parse the section
Ver->Section = UniqFindTagWrite("Section");
- Ver->Arch = UniqFindTagWrite("Architecture");
-
+
+ // Parse the architecture
+ Ver->Arch = WriteUniqString(Architecture());
+
// Archive Size
Ver->Size = (unsigned)Section.FindI("Size");
@@ -537,6 +552,7 @@ bool debListParser::ParseDepends(pkgCache::VerIterator Ver,
return true;
string Package;
+ string const pkgArch = Ver.Arch();
string Version;
unsigned int Op;
@@ -546,7 +562,7 @@ bool debListParser::ParseDepends(pkgCache::VerIterator Ver,
if (Start == 0)
return _error->Error("Problem parsing dependency %s",Tag);
- if (NewDepends(Ver,Package,Version,Op,Type) == false)
+ if (NewDepends(Ver,Package,pkgArch,Version,Op,Type) == false)
return false;
if (Start == Stop)
break;
@@ -619,6 +635,7 @@ bool debListParser::Step()
if (Section.Find("Architecture",Start,Stop) == false)
return true;
+ //FIXME: Accept different Architectures here
if (stringcmp(Arch,Start,Stop) == 0)
return true;
@@ -641,8 +658,9 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator FileI,
if (Tags.Step(Section) == false)
return false;
- //mvo: I don't think we need to fill that in (it's unused since apt-0.6)
- //FileI->Architecture = WriteUniqString(Arch);
+ // FIXME: Do we need it now for multi-arch?
+ // mvo: I don't think we need to fill that in (it's unused since apt-0.6)
+// FileI->Architecture = WriteUniqString(Arch);
// apt-secure does no longer download individual (per-section) Release
// file. to provide Component pinning we use the section name now