summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/deblistparser.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2020-01-17 12:53:20 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2020-01-17 12:53:20 +0100
commit8ebabf3d9026d1a738a4e8988e168902af7446e3 (patch)
treefd53dd025b002f418e45749d6cf1be3c20f2aa39 /apt-pkg/deb/deblistparser.cc
parent25353dc6646e5b9fff55059a5c85183589cf472d (diff)
Allow querying all binaries built by a source package
This adds a simple way to lookup binaries by a source package, but this adds all binaries into one list, even with different source versions. Be careful.
Diffstat (limited to 'apt-pkg/deb/deblistparser.cc')
-rw-r--r--apt-pkg/deb/deblistparser.cc34
1 files changed, 12 insertions, 22 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 21d1736e4..7614423df 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -166,8 +166,12 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver)
}
// Parse the source package name
pkgCache::GrpIterator G = Ver.ParentPkg().Group();
+
+ // Setup the defaults
Ver->SourcePkgName = G->Name;
Ver->SourceVerStr = Ver->VerStr;
+
+ // Parse the name and version str
if (Section.Find(pkgTagSection::Key::Source,Start,Stop) == true)
{
const char * const Space = static_cast<const char *>(memchr(Start, ' ', Stop - Start));
@@ -194,33 +198,19 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver)
}
APT::StringView const pkgname(Start, Stop - Start);
+ // Oh, our group is the wrong one for the source package. Make a new one.
if (pkgname != G.Name())
{
- for (pkgCache::PkgIterator P = G.PackageList(); P.end() == false; P = G.NextPkg(P))
- {
- for (V = P.VersionList(); V.end() == false; ++V)
- {
- if (pkgname == V.SourcePkgName())
- {
- Ver->SourcePkgName = V->SourcePkgName;
- break;
- }
- }
- if (V.end() == false)
- break;
- }
- if (V.end() == true)
- {
- pkgCache::GrpIterator SG;
- if (not NewGroup(SG, pkgname))
- return false;
-
- G = Ver.ParentPkg().Group();
- Ver->SourcePkgName = SG->Name;
- }
+ if (not NewGroup(G, pkgname))
+ return false;
}
}
+ // Link into by source package group.
+ Ver->SourcePkgName = G->Name;
+ Ver->NextInSource = G->VersionsInSource;
+ G->VersionsInSource = Ver.Index();
+
Ver->MultiArch = ParseMultiArch(true);
// Archive Size
Ver->Size = Section.FindULL(pkgTagSection::Key::Size);