From: Richard Purdie Date: Thu, 21 Oct 2010 22:26:40 +0000 (+0100) Subject: metadata_scm: Ensure that if an SCM isn't present, we dont print a revision of 'fatal... X-Git-Tag: 2011-1~4200 X-Git-Url: https://code.ossystems.io/gitweb?a=commitdiff_plain;h=d5504a4275d94868e28b00c272411e82f4999d95;p=openembedded-core.git metadata_scm: Ensure that if an SCM isn't present, we dont print a revision of 'fatal:' as it looks bad Signed-off-by: Richard Purdie --- diff --git a/meta/classes/metadata_scm.bbclass b/meta/classes/metadata_scm.bbclass index b3c06dd7f6..7112ad512b 100644 --- a/meta/classes/metadata_scm.bbclass +++ b/meta/classes/metadata_scm.bbclass @@ -70,8 +70,11 @@ def base_get_metadata_git_branch(path, d): return "" def base_get_metadata_git_revision(path, d): - rev = os.popen("cd %s; git log -n 1 --pretty=oneline -- 2>&1" % path).read().split(" ")[0] - if len(rev) != 0: - return rev + f = os.popen("cd %s; git log -n 1 --pretty=oneline -- 2>&1" % path) + data = f.read() + if f.close() is None: + rev = data.split(" ")[0] + if len(rev) != 0: + return rev return ""