Ignore libs for cross-compilation when checking any packages for binaries

Not really generic yet (e.g. doesn't cover `aarch64-linux-gnu-glibc`) but
good enough for now.
This commit is contained in:
Martchus 2022-03-04 21:49:43 +01:00
parent 1f3abd5596
commit 4293eb92bf
1 changed files with 14 additions and 1 deletions

View File

@ -469,7 +469,20 @@ void CheckForProblems::run()
}
}
if (package->packageInfo->arch == "any" && (!package->libdepends.empty() || !package->libprovides.empty())) {
problems.emplace_back(RepositoryProblem{ .desc = "\"any\"-arch package but binary present", .pkg = package->name });
auto crossOnly = true;
for (const auto &libnames : { package->libdepends, package->libprovides }) {
for (const auto &libname : libnames) {
// ignore Windows and Android libs
if (!libname.starts_with("pe-") && !libname.starts_with("android-")) {
crossOnly = false;
goto break2;
}
}
}
break2:
if (!crossOnly) {
problems.emplace_back(RepositoryProblem{ .desc = "\"any\"-arch package but binary present", .pkg = package->name });
}
}
return false;
});