diff options
| author | Urs Fässler <urs.fassler@bbv.ch> | 2018-10-03 12:04:06 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-10-04 23:00:24 +0100 |
| commit | b907303b92f597d159d1057a9d47148a23f30219 (patch) | |
| tree | f4e6ea8b7d773bfc79e915c1ae59dafd384f0a3a | |
| parent | 073c62cb56f3cd45d9ae28e0fcfc522be7480d4f (diff) | |
| download | poky-b907303b92f597d159d1057a9d47148a23f30219.tar.gz | |
bitbake: fetch2/git: prevent access to non-existing fullshallow tarball
(Bitbake rev: b7f00a8c11672a2ee0408e210fb174cda3384e3f)
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-- | bitbake/lib/bb/fetch2/git.py | 2 | ||||
| -rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index e46ea4893b..63c433a4aa 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py | |||
| @@ -476,7 +476,7 @@ class Git(FetchMethod): | |||
| 476 | if os.path.exists(destdir): | 476 | if os.path.exists(destdir): |
| 477 | bb.utils.prunedir(destdir) | 477 | bb.utils.prunedir(destdir) |
| 478 | 478 | ||
| 479 | if ud.shallow and self.need_update(ud, d): | 479 | if ud.shallow and os.path.exists(ud.fullshallow) and self.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 | else: |
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 2c314f46d7..ff66315aa5 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
| @@ -1580,3 +1580,17 @@ class GitShallowTest(FetcherTest): | |||
| 1580 | self.assertNotEqual(orig_revs, revs) | 1580 | self.assertNotEqual(orig_revs, revs) |
| 1581 | self.assertRefs(['master', 'origin/master']) | 1581 | self.assertRefs(['master', 'origin/master']) |
| 1582 | self.assertRevCount(orig_revs - 1758) | 1582 | self.assertRevCount(orig_revs - 1758) |
| 1583 | |||
| 1584 | @skipIfNoNetwork() | ||
| 1585 | def test_that_unpack_does_work_when_using_git_shallow_tarball_but_tarball_is_not_available(self): | ||
| 1586 | self.d.setVar('SRCREV', 'e5939ff608b95cdd4d0ab0e1935781ab9a276ac0') | ||
| 1587 | self.d.setVar('BB_GIT_SHALLOW', '1') | ||
| 1588 | self.d.setVar('BB_GENERATE_SHALLOW_TARBALLS', '1') | ||
| 1589 | fetcher = bb.fetch.Fetch(["git://git.yoctoproject.org/fstests"], self.d) | ||
| 1590 | fetcher.download() | ||
| 1591 | |||
| 1592 | bb.utils.remove(self.dldir + "/*.tar.gz") | ||
| 1593 | fetcher.unpack(self.unpackdir) | ||
| 1594 | |||
| 1595 | dir = os.listdir(self.unpackdir + "/git/") | ||
| 1596 | self.assertIn("fstests.doap", dir) | ||
