From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com ([143.182.124.21]) by linuxtogo.org with esmtp (Exim 4.72) (envelope-from ) id 1Qu9he-0006Yk-Tx for openembedded-core@lists.openembedded.org; Thu, 18 Aug 2011 23:00:39 +0200 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 18 Aug 2011 13:55:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.68,247,1312182000"; d="scan'208";a="39980186" Received: from unknown (HELO swold-MOBL.local) ([10.255.13.226]) by azsmga001.ch.intel.com with ESMTP; 18 Aug 2011 13:55:56 -0700 From: Saul Wold To: openembedded-core@lists.openembedded.org Date: Thu, 18 Aug 2011 13:55:21 -0700 Message-Id: <75e3875341ddc8940e9ee2ccbbb2ec18194a68e6.1313700595.git.sgw@linux.intel.com> X-Mailer: git-send-email 1.7.6 In-Reply-To: References: In-Reply-To: References: Subject: [CONSOLIDATED PULL 02/32] sanity.bbclass: add optional untested host distro warning X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: Patches and discussions about the oe-core layer List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 21:00:39 -0000 From: Paul Eggleton SANITY_TESTED_DISTROS, if specified, is expected to be a newline-delimited list of distro identifier strings, e.g. SANITY_TESTED_DISTROS = " \ Ubuntu 11.04 \ Fedora release 14 (Laughlin) \ " (spaces, tabs etc. are trimmed) If SANITY_TESTED_DISTROS is defined, we will attempt to detect the host distribution. If the distribution is not in SANITY_TESTED_DISTROS or we could not detect the distribution then we show a warning during sanity checking. Provides the mechanism for fixing [YOCTO #1096]. Signed-off-by: Paul Eggleton --- meta/classes/sanity.bbclass | 48 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 48 insertions(+), 0 deletions(-) diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass index d50c843..16af029 100644 --- a/meta/classes/sanity.bbclass +++ b/meta/classes/sanity.bbclass @@ -118,6 +118,52 @@ def check_connectivity(d): return retval +def check_supported_distro(e): + tested_distros = e.data.getVar('SANITY_TESTED_DISTROS', True) + if not tested_distros: + return + + if os.path.exists("/etc/redhat-release"): + f = open("/etc/redhat-release", "r") + try: + distro = f.readline() + finally: + f.close() + elif os.path.exists("/etc/SuSE-release"): + f = open("/etc/SuSE-release", "r") + try: + distro = f.readline() + # Remove the architecture suffix e.g. (i586) + distro = re.sub(r' \([a-zA-Z0-9\-_]*\)$', '', distro).strip() + finally: + f.close() + else: + # Use LSB method + import subprocess as sub + try: + p = sub.Popen(['lsb_release','-d','-s'],stdout=sub.PIPE,stderr=sub.PIPE) + out, err = p.communicate() + distro = out.rstrip() + except Exception: + distro = None + + if not distro: + if os.path.exists("/etc/lsb-release"): + f = open("/etc/lsb-release", "r") + try: + for line in f: + lns = line.split('=') + if lns[0] == "DISTRIB_DESCRIPTION": + distro = lns[1].strip('"\n') + break + finally: + f.close() + if distro: + if distro not in [x.strip() for x in tested_distros.split('\n')]: + bb.warn('Host distribution "%s" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.' % distro) + else: + bb.warn('Host distribution could not be determined; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.') + def check_sanity(e): from bb import note, error, data, __version__ @@ -249,6 +295,8 @@ def check_sanity(e): if pseudo_msg != "": messages = messages + pseudo_msg + '\n' + check_supported_distro(e) + # Check if DISPLAY is set if IMAGETEST is set if not data.getVar( 'DISPLAY', e.data, True ) and data.getVar( 'IMAGETEST', e.data, True ) == 'qemu': messages = messages + 'qemuimagetest needs a X desktop to start qemu, please set DISPLAY correctly (e.g. DISPLAY=:1.0)\n' -- 1.7.6