From 84881c1914ca30435ff478b4138cd7559c35c8d1 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 29 Apr 2024 15:14:24 +0200 Subject: source, build-dep: Allow specifying src:name This has the same behavior as --only-source name. --- apt-private/private-source.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'apt-private') diff --git a/apt-private/private-source.cc b/apt-private/private-source.cc index 9b9409c80..6280b9fff 100644 --- a/apt-private/private-source.cc +++ b/apt-private/private-source.cc @@ -77,7 +77,14 @@ static pkgSrcRecords::Parser *FindSrc(const char *Name, std::string ArchTag = ""; std::string RelTag = _config->Find("APT::Default-Release"); std::string TmpSrc = Name; + bool MatchSrcOnly = _config->FindB("APT::Get::Only-Source"); + // Check if we should look by source package + if (APT::String::Startswith(TmpSrc, "src:")) + { + MatchSrcOnly = true; + TmpSrc = TmpSrc.substr(4); + } // extract release size_t found = TmpSrc.find_last_of("/"); if (found != std::string::npos) @@ -103,7 +110,6 @@ static pkgSrcRecords::Parser *FindSrc(const char *Name, /* Lookup the version of the package we would install if we were to install a version and determine the source package name, then look in the archive for a source package of the same name. */ - bool MatchSrcOnly = _config->FindB("APT::Get::Only-Source"); pkgCache::PkgIterator Pkg; if (ArchTag != "") Pkg = Cache.GetPkgCache()->FindPkg(TmpSrc, ArchTag); -- cgit v1.2.3-70-g09d2