[oe-commits] [bitbake] 02/02: fetch/git: fix AttributeError in shallow extraction logic

git at git.openembedded.org git at git.openembedded.org
Thu Nov 22 10:45:54 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository bitbake.

commit bdbb558342ebb4e64384c9838d2485d9299d91a6
Author: Christopher Larson <chris_larson at mentor.com>
AuthorDate: Wed Nov 21 23:14:07 2018 +0500

    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 at mentor.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/fetch2/git.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 15858a6..59a2ee8 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)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list