commit:     479c7935881a5cd6f7ec560918f74245e73111f8
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Sep  7 05:46:14 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Sep  7 05:49:17 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=479c7935

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(+)

diff --git a/app-emulation/qemu/qemu-9999.ebuild 
b/app-emulation/qemu/qemu-9999.ebuild
index b95be31..9a8f7bd 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+=/' \

Reply via email to