Return-Path: Received: from mail.hanoverdisplays.com (mail.hanoverdisplays.com [62.7.92.68]) by mail.openembedded.org (Postfix) with ESMTP id 3979772F2A for ; Thu, 3 Aug 2017 13:05:49 +0000 (UTC) Received: from localhost (192.168.0.21) by mail.hanoverdisplays.com (192.168.0.31) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 3 Aug 2017 14:05:49 +0100 From: Alejandro Mery To: , Armin Kuster Date: Thu, 3 Aug 2017 14:05:18 +0100 Message-ID: <20170803130518.6351-4-amery@hanoverdisplays.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170803130518.6351-1-amery@hanoverdisplays.com> References: <20170803130518.6351-1-amery@hanoverdisplays.com> MIME-Version: 1.0 X-Originating-IP: [192.168.0.21] X-GFI-SMTP-Submission: 1 X-GFI-SMTP-HelloDomain: localhost X-GFI-SMTP-RemoteIP: 192.168.0.21 Subject: [meta-oe][pyro][PATCH 3/3] gitver: skip packages instead of panic()ing if ${GITVER} fails to expand X-BeenThere: openembedded-devel@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Using the OpenEmbedded metadata to build Distributions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2017 13:05:49 -0000 Content-Type: text/plain `inherit externalsrc gitver` is a very useful combo to get development trees in your workspace having a ${PN}_git.bb with PV=${GITVER} coexisting with a regular ${PN}_${PV}.bb but not everyone wants to checkout all developments sources and managinging different layers for each options is quite troublesome. making `gitver` skip the .bb instead of panic()ing every time EXTERNALSRC is missing allows people to have a single development layer where packages get enabled if the right sources are present or falling back to the last release if not Signed-off-by: Alejandro Mery Signed-off-by: Martin Jansa --- meta-oe/classes/gitver.bbclass | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/meta-oe/classes/gitver.bbclass b/meta-oe/classes/gitver.bbclass index a09c99749..380374ab2 100644 --- a/meta-oe/classes/gitver.bbclass +++ b/meta-oe/classes/gitver.bbclass @@ -27,23 +27,20 @@ def get_git_pv(d, tagadjust=None): gitdir = os.path.abspath(os.path.join(srcdir, ".git")) try: ver = gitrev_run("git describe --tags", gitdir) - except Exception as exc: - bb.fatal(str(exc)) - - if not ver: + except: try: ver = gitrev_run("git rev-parse --short HEAD", gitdir) + if ver: + return "0.0+%s" % ver + else: + return "0.0" + except Exception as exc: - bb.fatal(str(exc)) + raise bb.parse.SkipPackage(str(exc)) - if ver: - return "0.0+%s" % ver - else: - return "0.0" - else: - if tagadjust: - ver = tagadjust(ver) - return ver + if ver and tagadjust: + ver = tagadjust(ver) + return ver def get_git_hash(d): import os -- 2.13.0