diff options
Diffstat (limited to 'apt-private/private-source.cc')
-rw-r--r-- | apt-private/private-source.cc | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/apt-private/private-source.cc b/apt-private/private-source.cc index 32651cfdb..a24493421 100644 --- a/apt-private/private-source.cc +++ b/apt-private/private-source.cc @@ -658,7 +658,15 @@ bool DoBuildDep(CommandLine &CmdL) StripMultiArch = true; std::ostringstream buildDepsPkgFile; - std::vector<std::pair<std::string,std::string>> pseudoPkgs; + struct PseudoPkg + { + std::string name; + std::string arch; + std::string release; + PseudoPkg(std::string const &n, std::string const &a, std::string const &r) : + name(n), arch(a), release(r) {} + }; + std::vector<PseudoPkg> pseudoPkgs; // deal with the build essentials first { std::vector<pkgSrcRecords::Parser::BuildDepRec> BuildDeps; @@ -675,7 +683,7 @@ bool DoBuildDep(CommandLine &CmdL) std::string const pseudo = "builddeps:essentials"; std::string const nativeArch = _config->Find("APT::Architecture"); WriteBuildDependencyPackage(buildDepsPkgFile, pseudo, nativeArch, BuildDeps); - pseudoPkgs.emplace_back(pseudo, nativeArch); + pseudoPkgs.emplace_back(pseudo, nativeArch, ""); } // Read the source list @@ -703,7 +711,7 @@ bool DoBuildDep(CommandLine &CmdL) std::string const pseudo = std::string("builddeps:") + Src; WriteBuildDependencyPackage(buildDepsPkgFile, pseudo, pseudoArch, GetBuildDeps(Last.get(), Src.c_str(), StripMultiArch, hostArch)); - pseudoPkgs.emplace_back(pseudo, pseudoArch); + pseudoPkgs.emplace_back(pseudo, pseudoArch, ""); } } else @@ -731,7 +739,13 @@ bool DoBuildDep(CommandLine &CmdL) std::string const pseudo = std::string("builddeps:") + Src; WriteBuildDependencyPackage(buildDepsPkgFile, pseudo, pseudoArch, GetBuildDeps(Last, Src.c_str(), StripMultiArch, hostArch)); - pseudoPkgs.emplace_back(pseudo, pseudoArch); + std::string reltag = *I; + size_t found = reltag.find_last_of("/"); + if (found == std::string::npos) + reltag.clear(); + else + reltag.erase(0, found + 1); + pseudoPkgs.emplace_back(pseudo, pseudoArch, std::move(reltag)); } } @@ -745,12 +759,24 @@ bool DoBuildDep(CommandLine &CmdL) { pkgDepCache::ActionGroup group(Cache); TryToInstall InstallAction(Cache, &Fix, false); + std::list<std::pair<pkgCache::VerIterator, std::string>> candSwitch; + for (auto const &pkg: pseudoPkgs) + { + pkgCache::PkgIterator const Pkg = Cache->FindPkg(pkg.name, pkg.arch); + if (Pkg.end()) + continue; + if (pkg.release.empty()) + Cache->SetCandidateVersion(Pkg.VersionList()); + else + candSwitch.emplace_back(Pkg.VersionList(), pkg.release); + } + if (candSwitch.empty() == false) + InstallAction.propergateReleaseCandiateSwitching(candSwitch, c0out); for (auto const &pkg: pseudoPkgs) { - pkgCache::PkgIterator const Pkg = Cache->FindPkg(pkg.first, pkg.second); + pkgCache::PkgIterator const Pkg = Cache->FindPkg(pkg.name, pkg.arch); if (Pkg.end()) continue; - Cache->SetCandidateVersion(Pkg.VersionList()); InstallAction(Cache[Pkg].CandidateVerIter(Cache)); removeAgain.push_back(Pkg); } |