diff options
author | Paul Barker <pbarker@konsulko.com> | 2020-03-09 13:52:13 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-03-11 14:43:25 +0000 |
commit | 3c0a53fe75f304267b6407d5e62101daba498c0e (patch) | |
tree | f584a49b05ab0eed87fa7dad5a96df4f12f874cc /bitbake | |
parent | 6932c9757c870b6338e2a525696791bf3de6f703 (diff) | |
download | poky-3c0a53fe75f304267b6407d5e62101daba498c0e.tar.gz |
bitbake: tests: Add test for gitsm fetcher with shallow mirror tarballs
(Bitbake rev: 2e26e97129d4c54bf86cdea8f9791696a06a36b4)
Signed-off-by: Paul Barker <pbarker@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 45dc9e5d08..d0c161a7f6 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -1691,6 +1691,47 @@ class GitShallowTest(FetcherTest): | |||
1691 | # Verify the submodule is also shallow | 1691 | # Verify the submodule is also shallow |
1692 | self.assertRevCount(1, cwd=os.path.join(self.gitdir, 'gitsubmodule')) | 1692 | self.assertRevCount(1, cwd=os.path.join(self.gitdir, 'gitsubmodule')) |
1693 | 1693 | ||
1694 | def test_shallow_submodule_mirrors(self): | ||
1695 | self.add_empty_file('a') | ||
1696 | self.add_empty_file('b') | ||
1697 | |||
1698 | smdir = os.path.join(self.tempdir, 'gitsubmodule') | ||
1699 | bb.utils.mkdirhier(smdir) | ||
1700 | self.git('init', cwd=smdir) | ||
1701 | # Make this look like it was cloned from a remote... | ||
1702 | self.git('config --add remote.origin.url "%s"' % smdir, cwd=smdir) | ||
1703 | self.git('config --add remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"', cwd=smdir) | ||
1704 | self.add_empty_file('asub', cwd=smdir) | ||
1705 | self.add_empty_file('bsub', cwd=smdir) | ||
1706 | |||
1707 | self.git('submodule init', cwd=self.srcdir) | ||
1708 | self.git('submodule add file://%s' % smdir, cwd=self.srcdir) | ||
1709 | self.git('submodule update', cwd=self.srcdir) | ||
1710 | self.git('commit -m submodule -a', cwd=self.srcdir) | ||
1711 | |||
1712 | uri = 'gitsm://%s;protocol=file;subdir=${S}' % self.srcdir | ||
1713 | |||
1714 | # Fetch once to generate the shallow tarball | ||
1715 | fetcher, ud = self.fetch(uri) | ||
1716 | |||
1717 | # Set up the mirror | ||
1718 | mirrordir = os.path.join(self.tempdir, 'mirror') | ||
1719 | os.rename(self.dldir, mirrordir) | ||
1720 | self.d.setVar('PREMIRRORS', 'gitsm://.*/.* file://%s/\n' % mirrordir) | ||
1721 | |||
1722 | # Fetch from the mirror | ||
1723 | bb.utils.remove(self.dldir, recurse=True) | ||
1724 | bb.utils.remove(self.gitdir, recurse=True) | ||
1725 | self.fetch_and_unpack(uri) | ||
1726 | |||
1727 | # Verify the main repository is shallow | ||
1728 | self.assertRevCount(1) | ||
1729 | |||
1730 | # Verify the gitsubmodule directory is present | ||
1731 | assert os.listdir(os.path.join(self.gitdir, 'gitsubmodule')) | ||
1732 | |||
1733 | # Verify the submodule is also shallow | ||
1734 | self.assertRevCount(1, cwd=os.path.join(self.gitdir, 'gitsubmodule')) | ||
1694 | 1735 | ||
1695 | if any(os.path.exists(os.path.join(p, 'git-annex')) for p in os.environ.get('PATH').split(':')): | 1736 | if any(os.path.exists(os.path.join(p, 'git-annex')) for p in os.environ.get('PATH').split(':')): |
1696 | def test_shallow_annex(self): | 1737 | def test_shallow_annex(self): |