summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Rossi <nathan@nathanrossi.com>2018-02-03 00:04:30 +1000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-02-14 15:26:03 +0000
commit9c44aee83d5a3e74e33e492fb0892c419756fb00 (patch)
tree19c283feb51bd6d987985ba5f0ef4822fe7a09e1
parentc75985f40a4fc9ff2217fd22d0f84c59f7cec82b (diff)
downloadpoky-9c44aee83d5a3e74e33e492fb0892c419756fb00.tar.gz
bitbake: fetch/git: Use 'git-make-shallow' from bin directory
Move the code that existed in tests/fetch.py for determining the path to 'git-make-shallow' into the git module and reference it. This ensures that 'git-make-shallow' is always available and the desired version regardless of the path variable or whether git exposes the command. (Bitbake rev: 6b508ab8fd5aa796c1c00c970e81e5e93f84d35d) Signed-off-by: Nathan Rossi <nathan@nathanrossi.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/fetch2/git.py5
-rw-r--r--bitbake/lib/bb/tests/fetch.py5
2 files changed, 5 insertions, 5 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index d34ea1de29..35e0db56cf 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -125,6 +125,9 @@ class GitProgressHandler(bb.progress.LineFilterProgressHandler):
125 125
126 126
127class Git(FetchMethod): 127class Git(FetchMethod):
128 bitbake_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.join(os.path.abspath(__file__))), '..', '..', '..'))
129 make_shallow_path = os.path.join(bitbake_dir, 'bin', 'git-make-shallow')
130
128 """Class to fetch a module or modules from git repositories""" 131 """Class to fetch a module or modules from git repositories"""
129 def init(self, d): 132 def init(self, d):
130 pass 133 pass
@@ -446,7 +449,7 @@ class Git(FetchMethod):
446 shallow_branches.append(r) 449 shallow_branches.append(r)
447 450
448 # Make the repository shallow 451 # Make the repository shallow
449 shallow_cmd = ['git', 'make-shallow', '-s'] 452 shallow_cmd = [self.make_shallow_path, '-s']
450 for b in shallow_branches: 453 for b in shallow_branches:
451 shallow_cmd.append('-r') 454 shallow_cmd.append('-r')
452 shallow_cmd.append(b) 455 shallow_cmd.append(b)
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index 11698f2091..62b88f1380 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -874,9 +874,6 @@ class FetchCheckStatusTest(FetcherTest):
874 874
875 875
876class GitMakeShallowTest(FetcherTest): 876class GitMakeShallowTest(FetcherTest):
877 bitbake_dir = os.path.join(os.path.dirname(os.path.join(os.path.abspath(__file__))), '..', '..', '..')
878 make_shallow_path = os.path.join(bitbake_dir, 'bin', 'git-make-shallow')
879
880 def setUp(self): 877 def setUp(self):
881 FetcherTest.setUp(self) 878 FetcherTest.setUp(self)
882 self.gitdir = os.path.join(self.tempdir, 'gitshallow') 879 self.gitdir = os.path.join(self.tempdir, 'gitshallow')
@@ -905,7 +902,7 @@ class GitMakeShallowTest(FetcherTest):
905 def make_shallow(self, args=None): 902 def make_shallow(self, args=None):
906 if args is None: 903 if args is None:
907 args = ['HEAD'] 904 args = ['HEAD']
908 return bb.process.run([self.make_shallow_path] + args, cwd=self.gitdir) 905 return bb.process.run([bb.fetch2.git.Git.make_shallow_path] + args, cwd=self.gitdir)
909 906
910 def add_empty_file(self, path, msg=None): 907 def add_empty_file(self, path, msg=None):
911 if msg is None: 908 if msg is None: