summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/fetch2/git.py4
-rw-r--r--bitbake/lib/bb/tests/fetch.py11
2 files changed, 14 insertions, 1 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index f13a25f99d..3e37f76ffb 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -479,8 +479,10 @@ class Git(FetchMethod):
479 if ud.shallow and os.path.exists(ud.fullshallow) and self.clonedir_need_update(ud, d): 479 if ud.shallow and os.path.exists(ud.fullshallow) and self.clonedir_need_update(ud, d):
480 bb.utils.mkdirhier(destdir) 480 bb.utils.mkdirhier(destdir)
481 runfetchcmd("tar -xzf %s" % ud.fullshallow, d, workdir=destdir) 481 runfetchcmd("tar -xzf %s" % ud.fullshallow, d, workdir=destdir)
482 else: 482 elif not self.clonedir_need_update(ud, d):
483 runfetchcmd("%s clone %s %s/ %s" % (ud.basecmd, ud.cloneflags, ud.clonedir, destdir), d) 483 runfetchcmd("%s clone %s %s/ %s" % (ud.basecmd, ud.cloneflags, ud.clonedir, destdir), d)
484 else:
485 raise bb.fetch2.UnpackError("No up to date source found", ud.url)
484 486
485 repourl = self._get_repo_url(ud) 487 repourl = self._get_repo_url(ud)
486 runfetchcmd("%s remote set-url origin %s" % (ud.basecmd, repourl), d, workdir=destdir) 488 runfetchcmd("%s remote set-url origin %s" % (ud.basecmd, repourl), d, workdir=destdir)
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index 9bed06ba0e..f52241fbea 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -1699,6 +1699,17 @@ class GitShallowTest(FetcherTest):
1699 self.assertRefs(['master', 'origin/master']) 1699 self.assertRefs(['master', 'origin/master'])
1700 self.assertRevCount(orig_revs - 1758) 1700 self.assertRevCount(orig_revs - 1758)
1701 1701
1702 def test_that_unpack_throws_an_error_when_the_git_clone_nor_shallow_tarball_exist(self):
1703 self.add_empty_file('a')
1704 fetcher, ud = self.fetch()
1705 bb.utils.remove(self.gitdir, recurse=True)
1706 bb.utils.remove(self.dldir, recurse=True)
1707
1708 with self.assertRaises(bb.fetch2.UnpackError) as context:
1709 fetcher.unpack(self.d.getVar('WORKDIR'))
1710
1711 self.assertTrue("No up to date source found" in context.exception.msg)
1712
1702 @skipIfNoNetwork() 1713 @skipIfNoNetwork()
1703 def test_that_unpack_does_work_when_using_git_shallow_tarball_but_tarball_is_not_available(self): 1714 def test_that_unpack_does_work_when_using_git_shallow_tarball_but_tarball_is_not_available(self):
1704 self.d.setVar('SRCREV', 'e5939ff608b95cdd4d0ab0e1935781ab9a276ac0') 1715 self.d.setVar('SRCREV', 'e5939ff608b95cdd4d0ab0e1935781ab9a276ac0')