[M5+] verify_link retries with libc++ stdenv override on link failure
This commit is contained in:
@@ -18,6 +18,7 @@ struct DepBinding {
|
||||
std::string sanitized; // "nixpkgs_fmt_10_2_1" — input attr,
|
||||
// let-binding stem, lambda param
|
||||
std::optional<std::string> rev; // pinned commit (null → unpinned)
|
||||
bool libcxx_override = false; // wrap in .override { stdenv = libcxx }
|
||||
};
|
||||
|
||||
// Replaces every char outside [a-zA-Z0-9_] with '_'. The result is safe
|
||||
@@ -76,6 +77,7 @@ auto build_bindings(const GenerateInputs& in) -> std::vector<DepBinding> {
|
||||
.nixpkgs_attr = std::move(attr),
|
||||
.sanitized = sanitize_input_attr(dep.name, dep.version_spec),
|
||||
.rev = std::move(ref.rev),
|
||||
.libcxx_override = rec.requires_libcxx_override,
|
||||
};
|
||||
out.push_back(std::move(b));
|
||||
}
|
||||
@@ -138,20 +140,36 @@ auto emit_let_bindings(const std::vector<const DepBinding*>& pinned)
|
||||
return out;
|
||||
}
|
||||
|
||||
auto base_expr(const DepBinding& b) -> std::string {
|
||||
return b.rev && !b.rev->empty()
|
||||
? std::format("pkgs_{}.{}", b.sanitized, b.nixpkgs_attr)
|
||||
: std::format("pkgs.{}", b.nixpkgs_attr);
|
||||
}
|
||||
|
||||
auto emit_build_input_line(const DepBinding& b) -> std::string {
|
||||
if (b.rev && !b.rev->empty()) {
|
||||
return std::format(" pkgs_{}.{}\n", b.sanitized, b.nixpkgs_attr);
|
||||
auto expr = base_expr(b);
|
||||
if (b.libcxx_override) {
|
||||
// Stdenv swap (libc++) plus a `doCheck = false` overrideAttrs
|
||||
// to skip the package's test suite — without it, the rebuilt
|
||||
// dep would re-run its full check phase under the new stdenv,
|
||||
// adding minutes to hours of evaluation/build time.
|
||||
expr = std::format(
|
||||
"(({}.override {{ stdenv = llvmPkgs.libcxxStdenv; }})"
|
||||
".overrideAttrs (old: {{ doCheck = false; }}))",
|
||||
expr);
|
||||
}
|
||||
return std::format(" pkgs.{}\n", b.nixpkgs_attr);
|
||||
return std::format(" {}\n", expr);
|
||||
}
|
||||
|
||||
auto emit_build_inputs(const std::vector<DepBinding>& bindings) -> std::string {
|
||||
std::set<std::string> seen;
|
||||
std::string out;
|
||||
for (const auto& b : bindings) {
|
||||
auto key = b.rev && !b.rev->empty()
|
||||
? std::format("pkgs_{}.{}", b.sanitized, b.nixpkgs_attr)
|
||||
: std::format("pkgs.{}", b.nixpkgs_attr);
|
||||
// Dedupe by base expression — two deps that resolve to the same
|
||||
// (set, attr) but differ only in override are considered distinct
|
||||
// because the dedup key includes the override flag.
|
||||
auto key = std::format("{}{}", base_expr(b),
|
||||
b.libcxx_override ? "@libcxx" : "");
|
||||
if (seen.insert(key).second) {
|
||||
out += emit_build_input_line(b);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user