From 8ebabf3d9026d1a738a4e8988e168902af7446e3 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 17 Jan 2020 12:53:20 +0100 Subject: 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. --- apt-pkg/deb/deblistparser.cc | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) (limited to 'apt-pkg/deb/deblistparser.cc') 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(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); -- cgit v1.2.3