summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2009-05-11 22:34:07 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2009-05-11 22:34:07 +0100
commit1ca980646deb13b2cf85b17e78de9faba0191dbf (patch)
treee7b1548cbf0ea8645b108ac13c48b772ed5a3f47 /bitbake/lib/bb/fetch
parent62d37206681c3049c5ee7590cb9bce59e782ed15 (diff)
downloadpoky-1ca980646deb13b2cf85b17e78de9faba0191dbf.tar.gz
bitbake: Sync git fetcher with changes upstream
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/fetch')
-rw-r--r--bitbake/lib/bb/fetch/git.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/bitbake/lib/bb/fetch/git.py b/bitbake/lib/bb/fetch/git.py
index 010a4f57a2..4cae1c1879 100644
--- a/bitbake/lib/bb/fetch/git.py
+++ b/bitbake/lib/bb/fetch/git.py
@@ -37,9 +37,12 @@ class Git(Fetch):
37 37
38 def localpath(self, url, ud, d): 38 def localpath(self, url, ud, d):
39 39
40 ud.proto = "rsync"
41 if 'protocol' in ud.parm: 40 if 'protocol' in ud.parm:
42 ud.proto = ud.parm['protocol'] 41 ud.proto = ud.parm['protocol']
42 elif not ud.host:
43 ud.proto = 'file'
44 else:
45 ud.proto = "rsync"
43 46
44 ud.branch = ud.parm.get("branch", "master") 47 ud.branch = ud.parm.get("branch", "master")
45 48
@@ -49,12 +52,9 @@ class Git(Fetch):
49 elif tag: 52 elif tag:
50 ud.tag = tag 53 ud.tag = tag
51 54
52 if not ud.tag: 55 if not ud.tag or ud.tag == "master":
53 ud.tag = self.latest_revision(url, ud, d) 56 ud.tag = self.latest_revision(url, ud, d)
54 57
55 if ud.tag == "master":
56 ud.tag = self.latest_revision(url, ud, d)
57
58 ud.localfile = data.expand('git_%s%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.tag), d) 58 ud.localfile = data.expand('git_%s%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.tag), d)
59 59
60 return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) 60 return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
@@ -90,11 +90,12 @@ class Git(Fetch):
90 90
91 os.chdir(repodir) 91 os.chdir(repodir)
92 # Remove all but the .git directory 92 # Remove all but the .git directory
93 runfetchcmd("rm * -Rf", d) 93 if not self._contains_ref(ud.tag, d):
94 runfetchcmd("git fetch %s://%s%s%s %s" % (ud.proto, username, ud.host, ud.path, ud.branch), d) 94 runfetchcmd("rm * -Rf", d)
95 runfetchcmd("git fetch --tags %s://%s%s%s" % (ud.proto, username, ud.host, ud.path), d) 95 runfetchcmd("git fetch %s://%s%s%s %s" % (ud.proto, username, ud.host, ud.path, ud.branch), d)
96 runfetchcmd("git prune-packed", d) 96 runfetchcmd("git fetch --tags %s://%s%s%s" % (ud.proto, username, ud.host, ud.path), d)
97 runfetchcmd("git pack-redundant --all | xargs -r rm", d) 97 runfetchcmd("git prune-packed", d)
98 runfetchcmd("git pack-redundant --all | xargs -r rm", d)
98 99
99 os.chdir(repodir) 100 os.chdir(repodir)
100 mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) 101 mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True)
@@ -120,6 +121,10 @@ class Git(Fetch):
120 def suppports_srcrev(self): 121 def suppports_srcrev(self):
121 return True 122 return True
122 123
124 def _contains_ref(self, tag, d):
125 output = runfetchcmd("git log --pretty=oneline -n 1 %s -- 2> /dev/null | wc -l" % tag, d, quiet=True)
126 return output.split()[0] != "0"
127
123 def _revision_key(self, url, ud, d): 128 def _revision_key(self, url, ud, d):
124 """ 129 """
125 Return a unique key for the url 130 Return a unique key for the url