Skip to content

Commit 879a3af

Browse files
committed
fix(fetch): a failed install names the first address's failure, not only the compat retry's
A bare or default-namespace dependency is retried as compat:<name> and compat.<name>; those fail as "not found" whatever the cause was. The diagnostic now carries the first address's error ahead of the last one.
1 parent 42e9ca5 commit 879a3af

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎src/build/prepare/graph_load.cpp‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,15 @@ step4a_load_version_dep_fetch(PrepareState& state, LoadVersionDepCtx& ctx) {
10251025
mcpp::platform::env::ScopedEnv hookVar4(hookVars.at(4).first, hookVars.at(4).second);
10261026
mcpp::platform::env::ScopedEnv hookVar5(hookVars.at(5).first, hookVars.at(5).second);
10271027
auto r = install_one(target);
1028+
// The first address's failure is the one about the package; a
1029+
// compat spelling tried after it fails as "not found" whatever
1030+
// the cause was.
1031+
std::string firstError;
1032+
if (r && r->exitCode != 0) {
1033+
firstError = capturedChildError;
1034+
if (r->error)
1035+
firstError += (firstError.empty() ? "" : "; ") + r->error->message;
1036+
}
10281037
if (r && r->exitCode != 0 &&
10291038
(ns.empty() || ns == mcpp::pm::kDefaultNamespace)) {
10301039
// Compat retry for a bare/default-namespace request whose
@@ -1061,6 +1070,10 @@ step4a_load_version_dep_fetch(PrepareState& state, LoadVersionDepCtx& ctx) {
10611070
/ ".xlings.json";
10621071
auto indexRepos = mcpp::pm::read_seeded_index_repos(xlingsJson);
10631072
std::string childErr = capturedChildError;
1073+
if (attempted.size() > 1 && !firstError.empty()) {
1074+
if (!childErr.empty()) childErr += "; ";
1075+
childErr += std::format("{}: {}", attempted.front(), firstError);
1076+
}
10641077
if (r->error) {
10651078
if (!childErr.empty()) childErr += "; ";
10661079
childErr += r->error->message;

0 commit comments

Comments
 (0)