From 479c7935881a5cd6f7ec560918f74245e73111f8 Mon Sep 17 00:00:00 2001 From: Mike Frysinger <vapier@gentoo.org> Date: Mon, 7 Sep 2015 01:46:14 -0400 Subject: app-emulation/qemu: add target sanity checks This way we know up front when a new target appears rather than when someone happens to check & notice. --- app-emulation/qemu/qemu-9999.ebuild | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'app-emulation/qemu/qemu-9999.ebuild') diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-9999.ebuild index b95be31a1969..9a8f7bd119c4 100644 --- a/app-emulation/qemu/qemu-9999.ebuild +++ b/app-emulation/qemu/qemu-9999.ebuild @@ -268,7 +268,29 @@ pkg_setup() { enewgroup kvm 78 } +# Sanity check to make sure target lists are kept up-to-date. +check_targets() { + local var=$1 mak=$2 + local detected sorted + + pushd "${S}"/default-configs >/dev/null || die + + detected=$(echo $(printf '%s\n' *-${mak}.mak | sed "s:-${mak}.mak::" | sort -u)) + sorted=$(echo $(printf '%s\n' ${!var} | sort -u)) + if [[ ${sorted} != "${detected}" ]] ; then + eerror "The ebuild needs to be kept in sync." + eerror "${var}: ${sorted}" + eerror "$(printf '%-*s' ${#var} configure): ${detected}" + die "sync ${var} to the list of targets" + fi + + popd >/dev/null +} + src_prepare() { + check_targets IUSE_SOFTMMU_TARGETS softmmu + check_targets IUSE_USER_TARGETS linux-user + # Alter target makefiles to accept CFLAGS set via flag-o sed -i -r \ -e 's/^(C|OP_C|HELPER_C)FLAGS=/\1FLAGS+=/' \ -- cgit v1.2.3-65-gdbad