From 5ef499349c609f5ef50bd633692faa2665f4f96f Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 9 Mar 2009 16:33:39 +0100 Subject: * cmdline/apt-get.cc - fix "apt-get source pkg" if there is a binary package and a source package of the same name but from different packages (LP: #330103) --- cmdline/apt-get.cc | 21 ++++++++++++++------- debian/changelog | 8 ++++++-- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 2117a7f2a..0339afdf1 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -1272,16 +1272,23 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, } } } - - // No source package name.. - if (Src.empty() == true) - Src = TmpSrc; - + // The best hit pkgSrcRecords::Parser *Last = 0; unsigned long Offset = 0; string Version; bool IsMatch = false; + bool MatchSrcOnly = false; + + // No source package name.. + if (Src.empty() == true) + Src = TmpSrc; + else + // if we have a source pkg name, make sure to only search + // for srcpkg names, otherwise apt gets confused if there + // is a binary package "pkg1" and a source package "pkg1" + // with the same name but that comes from different packages + MatchSrcOnly = true; // If we are matching by version then we need exact matches to be happy if (VerTag.empty() == false) @@ -1291,13 +1298,13 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, binary packages in the search */ pkgSrcRecords::Parser *Parse; SrcRecs.Restart(); - while ((Parse = SrcRecs.Find(Src.c_str(),false)) != 0) + while ((Parse = SrcRecs.Find(Src.c_str(), MatchSrcOnly)) != 0) { string Ver = Parse->Version(); // show name mismatches if (IsMatch == true && Parse->Package() != Src) - ioprintf(c1out, _("No source package '%s' picking '%s' instead"), Parse->Package().c_str(), Src.c_str()); + ioprintf(c1out, _("No source package '%s' picking '%s' instead\n"), Parse->Package().c_str(), Src.c_str()); if (VerTag.empty() == false) { diff --git a/debian/changelog b/debian/changelog index b485c36aa..bef5c3cad 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,13 @@ -apt (0.7.20.2ubuntu2) UNRELEASED; urgency=low +apt (0.7.20.2ubuntu2) jaunty; urgency=low * apt-pkg/deb/dpkgpm.cc: - revert termios patch (LP: #338514) + * cmdline/apt-get.cc + - fix "apt-get source pkg" if there is a binary package and + a source package of the same name but from different + packages (LP: #330103) - -- Michael Vogt Fri, 06 Mar 2009 10:15:15 +0100 + -- Michael Vogt Mon, 09 Mar 2009 16:33:28 +0100 apt (0.7.20.2ubuntu1) jaunty; urgency=low -- cgit v1.2.3