cmake, lint: Adjust lint_includes_build_config

This commit is contained in:
Hennadii Stepanov 2024-04-28 10:25:31 +01:00
parent 3885441ee0
commit c360837ca5
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F

View File

@ -318,20 +318,14 @@ Please add any false positives, such as subtrees, or externally sourced files to
}
fn lint_includes_build_config() -> LintResult {
let config_path = "./src/config/bitcoin-config.h.in";
if !Path::new(config_path).is_file() {
assert!(Command::new("./autogen.sh")
.status()
.expect("command error")
.success());
}
let config_path = "./cmake/bitcoin-config.h.in";
let defines_regex = format!(
r"^\s*(?!//).*({})",
check_output(Command::new("grep").args(["undef ", "--", config_path]))
check_output(Command::new("grep").args(["define", "--", config_path]))
.expect("grep failed")
.lines()
.map(|line| {
line.split("undef ")
line.split_whitespace()
.nth(1)
.unwrap_or_else(|| panic!("Could not extract name in line: {line}"))
})