diff options
| -rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index b1ff2c005f..16a1b6f342 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
| @@ -402,6 +402,13 @@ class FetcherTest(unittest.TestCase): | |||
| 402 | cwd = self.gitdir | 402 | cwd = self.gitdir |
| 403 | return bb.process.run(cmd, cwd=cwd)[0] | 403 | return bb.process.run(cmd, cwd=cwd)[0] |
| 404 | 404 | ||
| 405 | def git_init(self, cwd=None): | ||
| 406 | self.git('init', cwd=cwd) | ||
| 407 | if not self.git(['config', 'user.email'], cwd=cwd): | ||
| 408 | self.git(['config', 'user.email', 'you@example.com'], cwd=cwd) | ||
| 409 | if not self.git(['config', 'user.name'], cwd=cwd): | ||
| 410 | self.git(['config', 'user.name', 'Your Name'], cwd=cwd) | ||
| 411 | |||
| 405 | class MirrorUriTest(FetcherTest): | 412 | class MirrorUriTest(FetcherTest): |
| 406 | 413 | ||
| 407 | replaceuris = { | 414 | replaceuris = { |
| @@ -709,9 +716,7 @@ class FetcherLocalTest(FetcherTest): | |||
| 709 | src_dir = tempfile.mkdtemp(dir=self.tempdir, | 716 | src_dir = tempfile.mkdtemp(dir=self.tempdir, |
| 710 | prefix='gitfetch_localusehead_') | 717 | prefix='gitfetch_localusehead_') |
| 711 | self.gitdir = os.path.abspath(src_dir) | 718 | self.gitdir = os.path.abspath(src_dir) |
| 712 | self.git('init') | 719 | self.git_init() |
| 713 | self.git('config user.email "you@example.com"') | ||
| 714 | self.git('config user.name "Your Name"') | ||
| 715 | self.git(['commit', '--allow-empty', '-m', 'Dummy commit']) | 720 | self.git(['commit', '--allow-empty', '-m', 'Dummy commit']) |
| 716 | # Use other branch than master | 721 | # Use other branch than master |
| 717 | self.git(['checkout', '-b', 'my-devel']) | 722 | self.git(['checkout', '-b', 'my-devel']) |
| @@ -1443,9 +1448,7 @@ class GitMakeShallowTest(FetcherTest): | |||
| 1443 | FetcherTest.setUp(self) | 1448 | FetcherTest.setUp(self) |
| 1444 | self.gitdir = os.path.join(self.tempdir, 'gitshallow') | 1449 | self.gitdir = os.path.join(self.tempdir, 'gitshallow') |
| 1445 | bb.utils.mkdirhier(self.gitdir) | 1450 | bb.utils.mkdirhier(self.gitdir) |
| 1446 | self.git('init') | 1451 | self.git_init() |
| 1447 | self.git('config user.email "you@example.com"') | ||
| 1448 | self.git('config user.name "Your Name"') | ||
| 1449 | 1452 | ||
| 1450 | def assertRefs(self, expected_refs): | 1453 | def assertRefs(self, expected_refs): |
| 1451 | actual_refs = self.git(['for-each-ref', '--format=%(refname)']).splitlines() | 1454 | actual_refs = self.git(['for-each-ref', '--format=%(refname)']).splitlines() |
| @@ -1561,9 +1564,7 @@ class GitShallowTest(FetcherTest): | |||
| 1561 | self.srcdir = os.path.join(self.tempdir, 'gitsource') | 1564 | self.srcdir = os.path.join(self.tempdir, 'gitsource') |
| 1562 | 1565 | ||
| 1563 | bb.utils.mkdirhier(self.srcdir) | 1566 | bb.utils.mkdirhier(self.srcdir) |
| 1564 | self.git('init', cwd=self.srcdir) | 1567 | self.git_init(cwd=self.srcdir) |
| 1565 | self.git('config user.email "you@example.com"', cwd=self.srcdir) | ||
| 1566 | self.git('config user.name "Your Name"', cwd=self.srcdir) | ||
| 1567 | self.d.setVar('WORKDIR', self.tempdir) | 1568 | self.d.setVar('WORKDIR', self.tempdir) |
| 1568 | self.d.setVar('S', self.gitdir) | 1569 | self.d.setVar('S', self.gitdir) |
| 1569 | self.d.delVar('PREMIRRORS') | 1570 | self.d.delVar('PREMIRRORS') |
| @@ -1788,9 +1789,7 @@ class GitShallowTest(FetcherTest): | |||
| 1788 | 1789 | ||
| 1789 | smdir = os.path.join(self.tempdir, 'gitsubmodule') | 1790 | smdir = os.path.join(self.tempdir, 'gitsubmodule') |
| 1790 | bb.utils.mkdirhier(smdir) | 1791 | bb.utils.mkdirhier(smdir) |
| 1791 | self.git('init', cwd=smdir) | 1792 | self.git_init(cwd=smdir) |
| 1792 | self.git('config user.email "you@example.com"', cwd=smdir) | ||
| 1793 | self.git('config user.name "Your Name"', cwd=smdir) | ||
| 1794 | # Make this look like it was cloned from a remote... | 1793 | # Make this look like it was cloned from a remote... |
| 1795 | self.git('config --add remote.origin.url "%s"' % smdir, cwd=smdir) | 1794 | self.git('config --add remote.origin.url "%s"' % smdir, cwd=smdir) |
| 1796 | self.git('config --add remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"', cwd=smdir) | 1795 | self.git('config --add remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"', cwd=smdir) |
| @@ -1820,9 +1819,7 @@ class GitShallowTest(FetcherTest): | |||
| 1820 | 1819 | ||
| 1821 | smdir = os.path.join(self.tempdir, 'gitsubmodule') | 1820 | smdir = os.path.join(self.tempdir, 'gitsubmodule') |
| 1822 | bb.utils.mkdirhier(smdir) | 1821 | bb.utils.mkdirhier(smdir) |
| 1823 | self.git('init', cwd=smdir) | 1822 | self.git_init(cwd=smdir) |
| 1824 | self.git('config user.email "you@example.com"', cwd=smdir) | ||
| 1825 | self.git('config user.name "Your Name"', cwd=smdir) | ||
| 1826 | # Make this look like it was cloned from a remote... | 1823 | # Make this look like it was cloned from a remote... |
| 1827 | self.git('config --add remote.origin.url "%s"' % smdir, cwd=smdir) | 1824 | self.git('config --add remote.origin.url "%s"' % smdir, cwd=smdir) |
| 1828 | self.git('config --add remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"', cwd=smdir) | 1825 | self.git('config --add remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"', cwd=smdir) |
| @@ -2140,9 +2137,7 @@ class GitLfsTest(FetcherTest): | |||
| 2140 | self.d.setVar('AUTOREV', '${@bb.fetch2.get_autorev(d)}') | 2137 | self.d.setVar('AUTOREV', '${@bb.fetch2.get_autorev(d)}') |
| 2141 | 2138 | ||
| 2142 | bb.utils.mkdirhier(self.srcdir) | 2139 | bb.utils.mkdirhier(self.srcdir) |
| 2143 | self.git('init', cwd=self.srcdir) | 2140 | self.git_init(cwd=self.srcdir) |
| 2144 | self.git('config user.email "you@example.com"', cwd=self.srcdir) | ||
| 2145 | self.git('config user.name "Your Name"', cwd=self.srcdir) | ||
| 2146 | with open(os.path.join(self.srcdir, '.gitattributes'), 'wt') as attrs: | 2141 | with open(os.path.join(self.srcdir, '.gitattributes'), 'wt') as attrs: |
| 2147 | attrs.write('*.mp3 filter=lfs -text') | 2142 | attrs.write('*.mp3 filter=lfs -text') |
| 2148 | self.git(['add', '.gitattributes'], cwd=self.srcdir) | 2143 | self.git(['add', '.gitattributes'], cwd=self.srcdir) |
