From 460260affe1c3ac55992d94581672a49abdb2fcf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20G=C3=B3rny?= Date: Tue, 1 Oct 2019 14:09:04 +0200 Subject: [PATCH] sys-devel/llvm: Add target obsolescence check MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- sys-devel/llvm/llvm-10.0.0.9999.ebuild | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/sys-devel/llvm/llvm-10.0.0.9999.ebuild b/sys-devel/llvm/llvm-10.0.0.9999.ebuild index a58ed35b5419..6bfea01a7391 100644 --- a/sys-devel/llvm/llvm-10.0.0.9999.ebuild +++ b/sys-devel/llvm/llvm-10.0.0.9999.ebuild @@ -90,6 +90,38 @@ python_check_deps() { has_version -b "dev-python/sphinx[${PYTHON_USEDEP}]" } +check_live_ebuild() { + local prod_targets=( + $(sed -n -e '/set(LLVM_ALL_TARGETS/,/)/p' CMakeLists.txt \ + | tail -n +2 | head -n -1) + ) + local all_targets=( + lib/Target/*/ + ) + all_targets=( "${all_targets[@]#lib/Target/}" ) + all_targets=( "${all_targets[@]%/}" ) + + local exp_targets=() i + for i in "${all_targets[@]}"; do + has "${i}" "${prod_targets[@]}" || exp_targets+=( "${i}" ) + done + # reorder + all_targets=( "${prod_targets[@]}" "${exp_targets[@]}" ) + + if [[ ${exp_targets[*]} != ${ALL_LLVM_EXPERIMENTAL_TARGETS[*]} ]]; then + ewarn "ALL_LLVM_EXPERIMENTAL_TARGETS is outdated!" + ewarn " Have: ${ALL_LLVM_EXPERIMENTAL_TARGETS[*]}" + ewarn "Expected: ${exp_targets[*]}" + ewarn + fi + + if [[ ${all_targets[*]} != ${ALL_LLVM_TARGETS[*]#llvm_targets_} ]]; then + ewarn "ALL_LLVM_TARGETS is outdated!" + ewarn " Have: ${ALL_LLVM_TARGETS[*]#llvm_targets_}" + ewarn "Expected: ${all_targets[*]}" + fi +} + src_prepare() { # Fix llvm-config for shared linking and sane flags # https://bugs.gentoo.org/show_bug.cgi?id=565358 @@ -100,6 +132,9 @@ src_prepare() { # User patches + QA cmake-utils_src_prepare + + # Verify that the live ebuild is up-to-date + check_live_ebuild } # Is LLVM being linked against libc++? -- 2.26.2