aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2018-11-21 23:14:07 +0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-11-26 20:15:54 +0000
commitb0ad961064ef6ecd77fab3435e5652c4ae284426 (patch)
treef9445d0d492b8d0432261576a8de56c9b9cf9686
parentafee3f594e1510051a0b18e430e92549caf72fa2 (diff)
downloadbitbake-contrib-b0ad961064ef6ecd77fab3435e5652c4ae284426.tar.gz
fetch/git: fix AttributeError in shallow extraction logic
This code checks to see if shallow is either disabled or the tarball is missing, but the else block tries to print the tarball filename, and this attribute doesn't exist at all when shallow is disabled. Handle the two cases separately to give sane errors for both cases without the exception: Exception: AttributeError: 'FetchData' object has no attribute 'fullshallow' Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/fetch2/git.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 15858a624..59a2ee8f8 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -488,12 +488,15 @@ class Git(FetchMethod):
source_error.append("clone directory not available or not up to date: " + ud.clonedir)
if not source_found:
- if ud.shallow and os.path.exists(ud.fullshallow):
- bb.utils.mkdirhier(destdir)
- runfetchcmd("tar -xzf %s" % ud.fullshallow, d, workdir=destdir)
- source_found = True
+ if ud.shallow:
+ if os.path.exists(ud.fullshallow):
+ bb.utils.mkdirhier(destdir)
+ runfetchcmd("tar -xzf %s" % ud.fullshallow, d, workdir=destdir)
+ source_found = True
+ else:
+ source_error.append("shallow clone not available: " + ud.fullshallow)
else:
- source_error.append("shallow clone not enabled or not available: " + ud.fullshallow)
+ source_error.append("shallow clone not enabled")
if not source_found:
raise bb.fetch2.UnpackError("No up to date source found: " + "; ".join(source_error), ud.url)