aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUrs Fässler <urs.fassler@bbv.ch>2018-10-08 08:15:12 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-10-17 12:24:05 +0100
commit27a2214bf6f2e7c61bfc422a20959a55f7e0d25d (patch)
tree86da4a8ad3d1646f497cb8e4d979f7127faece60
parent78d8fb3a7899e1404a513be1c2b2b4440da8b12d (diff)
downloadbitbake-27a2214bf6f2e7c61bfc422a20959a55f7e0d25d.tar.gz
fetch2/git: provide information about missing sources
Provide more information in the case the sources are not found in the unpack step. Signed-off-by: Urs Fässler <urs.fassler@bbv.ch> Signed-off-by: Pascal Bach <pascal.bach@siemens.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/fetch2/git.py29
-rw-r--r--lib/bb/tests/fetch.py2
2 files changed, 23 insertions, 8 deletions
diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 51259df93..15858a624 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -476,14 +476,27 @@ class Git(FetchMethod):
if os.path.exists(destdir):
bb.utils.prunedir(destdir)
- clonedir_is_up_to_date = not self.clonedir_need_update(ud, d)
- if clonedir_is_up_to_date:
- runfetchcmd("%s clone %s %s/ %s" % (ud.basecmd, ud.cloneflags, ud.clonedir, destdir), d)
- elif ud.shallow and os.path.exists(ud.fullshallow):
- bb.utils.mkdirhier(destdir)
- runfetchcmd("tar -xzf %s" % ud.fullshallow, d, workdir=destdir)
- else:
- raise bb.fetch2.UnpackError("No up to date source found", ud.url)
+ source_found = False
+ source_error = []
+
+ if not source_found:
+ clonedir_is_up_to_date = not self.clonedir_need_update(ud, d)
+ if clonedir_is_up_to_date:
+ runfetchcmd("%s clone %s %s/ %s" % (ud.basecmd, ud.cloneflags, ud.clonedir, destdir), d)
+ source_found = True
+ else:
+ 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
+ else:
+ source_error.append("shallow clone not enabled or not available: " + ud.fullshallow)
+
+ if not source_found:
+ raise bb.fetch2.UnpackError("No up to date source found: " + "; ".join(source_error), ud.url)
repourl = self._get_repo_url(ud)
runfetchcmd("%s remote set-url origin %s" % (ud.basecmd, repourl), d, workdir=destdir)
diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index f52241fbe..17909ec62 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -1709,6 +1709,8 @@ class GitShallowTest(FetcherTest):
fetcher.unpack(self.d.getVar('WORKDIR'))
self.assertTrue("No up to date source found" in context.exception.msg)
+ self.assertTrue("clone directory not available or not up to date" in context.exception.msg)
+ self.assertTrue("shallow clone not enabled or not available" in context.exception.msg)
@skipIfNoNetwork()
def test_that_unpack_does_work_when_using_git_shallow_tarball_but_tarball_is_not_available(self):