diff options
author | Christopher Larson <kergoth@gmail.com> | 2017-05-13 02:46:31 +0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-06-02 13:36:57 +0100 |
commit | f5308b8cc167e2fbb25406da074c334960902b20 (patch) | |
tree | 48b667e0bdd00f8dd439473e84f5c2f73ba09d67 /bitbake/lib/bb/tests | |
parent | 8144f6f408a77b7fb3367a91c55288b977a9bf88 (diff) | |
download | poky-f5308b8cc167e2fbb25406da074c334960902b20.tar.gz |
bitbake: fetch/gitsm: add support for shallow mirror tarballs
When we're building from a shallow mirror tarball, we don't want to do
anything with ud.clonedir, as it's not being used when we unpack. As such,
disable updating the submodules in that case. Also include the repositories in
.git/modules in the shallow tarball. It does not actually make the submodule
repositories shallow at this time.
(Bitbake rev: 6c0613f1f2f9d4f009545f82a9173e80396f9d34)
Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/tests')
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 3e2ce53056..2a9019b05f 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -1027,12 +1027,14 @@ class GitShallowTest(FetcherTest): | |||
1027 | cwd = self.gitdir | 1027 | cwd = self.gitdir |
1028 | return bb.process.run(cmd, cwd=cwd)[0] | 1028 | return bb.process.run(cmd, cwd=cwd)[0] |
1029 | 1029 | ||
1030 | def add_empty_file(self, path, msg=None): | 1030 | def add_empty_file(self, path, cwd=None, msg=None): |
1031 | if msg is None: | 1031 | if msg is None: |
1032 | msg = path | 1032 | msg = path |
1033 | open(os.path.join(self.srcdir, path), 'w').close() | 1033 | if cwd is None: |
1034 | self.git(['add', path], self.srcdir) | 1034 | cwd = self.srcdir |
1035 | self.git(['commit', '-m', msg, path], self.srcdir) | 1035 | open(os.path.join(cwd, path), 'w').close() |
1036 | self.git(['add', path], cwd) | ||
1037 | self.git(['commit', '-m', msg, path], cwd) | ||
1036 | 1038 | ||
1037 | def fetch(self, uri=None): | 1039 | def fetch(self, uri=None): |
1038 | if uri is None: | 1040 | if uri is None: |
@@ -1211,6 +1213,27 @@ class GitShallowTest(FetcherTest): | |||
1211 | self.assertRefs(['master', 'origin/master']) | 1213 | self.assertRefs(['master', 'origin/master']) |
1212 | self.assertRevCount(1) | 1214 | self.assertRevCount(1) |
1213 | 1215 | ||
1216 | def test_shallow_submodules(self): | ||
1217 | self.add_empty_file('a') | ||
1218 | self.add_empty_file('b') | ||
1219 | |||
1220 | smdir = os.path.join(self.tempdir, 'gitsubmodule') | ||
1221 | bb.utils.mkdirhier(smdir) | ||
1222 | self.git('init', cwd=smdir) | ||
1223 | self.add_empty_file('asub', cwd=smdir) | ||
1224 | |||
1225 | self.git('submodule init', cwd=self.srcdir) | ||
1226 | self.git('submodule add file://%s' % smdir, cwd=self.srcdir) | ||
1227 | self.git('submodule update', cwd=self.srcdir) | ||
1228 | self.git('commit -m submodule -a', cwd=self.srcdir) | ||
1229 | |||
1230 | uri = 'gitsm://%s;protocol=file;subdir=${S}' % self.srcdir | ||
1231 | fetcher, ud = self.fetch_shallow(uri) | ||
1232 | |||
1233 | self.assertRevCount(1) | ||
1234 | assert './.git/modules/' in bb.process.run('tar -tzf %s' % os.path.join(self.dldir, ud.mirrortarballs[0]))[0] | ||
1235 | assert os.listdir(os.path.join(self.gitdir, 'gitsubmodule')) | ||
1236 | |||
1214 | def test_shallow_multi_one_uri(self): | 1237 | def test_shallow_multi_one_uri(self): |
1215 | # Create initial git repo | 1238 | # Create initial git repo |
1216 | self.add_empty_file('a') | 1239 | self.add_empty_file('a') |