summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/fetch')
-rw-r--r--bitbake/lib/bb/fetch/git.py36
1 files changed, 17 insertions, 19 deletions
diff --git a/bitbake/lib/bb/fetch/git.py b/bitbake/lib/bb/fetch/git.py
index 6e4e67c40f..5e7cf985f8 100644
--- a/bitbake/lib/bb/fetch/git.py
+++ b/bitbake/lib/bb/fetch/git.py
@@ -45,6 +45,10 @@ class Git(Fetch):
45 45
46 ud.branch = ud.parm.get("branch", "master") 46 ud.branch = ud.parm.get("branch", "master")
47 47
48 gitsrcname = '%s%s' % (ud.host, ud.path.replace('/', '.'))
49 ud.mirrortarball = 'git_%s.tar.gz' % (gitsrcname)
50 ud.clonedir = os.path.join(data.expand('${GITDIR}', d), gitsrcname)
51
48 tag = Fetch.srcrev_internal_helper(ud, d) 52 tag = Fetch.srcrev_internal_helper(ud, d)
49 if tag is True: 53 if tag is True:
50 ud.tag = self.latest_revision(url, ud, d) 54 ud.tag = self.latest_revision(url, ud, d)
@@ -70,24 +74,20 @@ class Git(Fetch):
70 else: 74 else:
71 username = "" 75 username = ""
72 76
73 gitsrcname = '%s%s' % (ud.host, ud.path.replace('/', '.')) 77 repofile = os.path.join(data.getVar("DL_DIR", d, 1), ud.mirrortarbal)
74
75 repofilename = 'git_%s.tar.gz' % (gitsrcname)
76 repofile = os.path.join(data.getVar("DL_DIR", d, 1), repofilename)
77 repodir = os.path.join(data.expand('${GITDIR}', d), gitsrcname)
78 78
79 coname = '%s' % (ud.tag) 79 coname = '%s' % (ud.tag)
80 codir = os.path.join(repodir, coname) 80 codir = os.path.join(ud.clonedir, coname)
81 81
82 if not os.path.exists(repodir): 82 if not os.path.exists(ud.clonedir):
83 if Fetch.try_mirror(d, repofilename): 83 if Fetch.try_mirror(d, ud.mirrortarbal):
84 bb.mkdirhier(repodir) 84 bb.mkdirhier(ud.clonedir)
85 os.chdir(repodir) 85 os.chdir(ud.clonedir)
86 runfetchcmd("tar -xzf %s" % (repofile), d) 86 runfetchcmd("tar -xzf %s" % (repofile), d)
87 else: 87 else:
88 runfetchcmd("git clone -n %s://%s%s%s %s" % (ud.proto, username, ud.host, ud.path, repodir), d) 88 runfetchcmd("git clone -n %s://%s%s%s %s" % (ud.proto, username, ud.host, ud.path, ud.clonedir), d)
89 89
90 os.chdir(repodir) 90 os.chdir(ud.clonedir)
91 # Remove all but the .git directory 91 # Remove all but the .git directory
92 if not self._contains_ref(ud.tag, d): 92 if not self._contains_ref(ud.tag, d):
93 runfetchcmd("rm * -Rf", d) 93 runfetchcmd("rm * -Rf", d)
@@ -96,7 +96,7 @@ class Git(Fetch):
96 runfetchcmd("git prune-packed", d) 96 runfetchcmd("git prune-packed", d)
97 runfetchcmd("git pack-redundant --all | xargs -r rm", d) 97 runfetchcmd("git pack-redundant --all | xargs -r rm", d)
98 98
99 os.chdir(repodir) 99 os.chdir(ud.clonedir)
100 mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) 100 mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True)
101 if mirror_tarballs != "0": 101 if mirror_tarballs != "0":
102 bb.msg.note(1, bb.msg.domain.Fetcher, "Creating tarball of git repository") 102 bb.msg.note(1, bb.msg.domain.Fetcher, "Creating tarball of git repository")
@@ -106,7 +106,7 @@ class Git(Fetch):
106 bb.utils.prunedir(codir) 106 bb.utils.prunedir(codir)
107 107
108 bb.mkdirhier(codir) 108 bb.mkdirhier(codir)
109 os.chdir(repodir) 109 os.chdir(ud.clonedir)
110 runfetchcmd("git read-tree %s" % (ud.tag), d) 110 runfetchcmd("git read-tree %s" % (ud.tag), d)
111 runfetchcmd("git checkout-index -q -f --prefix=%s -a" % (os.path.join(codir, "git", "")), d) 111 runfetchcmd("git checkout-index -q -f --prefix=%s -a" % (os.path.join(codir, "git", "")), d)
112 112
@@ -114,7 +114,7 @@ class Git(Fetch):
114 bb.msg.note(1, bb.msg.domain.Fetcher, "Creating tarball of git checkout") 114 bb.msg.note(1, bb.msg.domain.Fetcher, "Creating tarball of git checkout")
115 runfetchcmd("tar -czf %s %s" % (ud.localpath, os.path.join(".", "*") ), d) 115 runfetchcmd("tar -czf %s %s" % (ud.localpath, os.path.join(".", "*") ), d)
116 116
117 os.chdir(repodir) 117 os.chdir(ud.clonedir)
118 bb.utils.prunedir(codir) 118 bb.utils.prunedir(codir)
119 119
120 def suppports_srcrev(self): 120 def suppports_srcrev(self):
@@ -157,8 +157,6 @@ class Git(Fetch):
157 157
158 We will have to get the updated revision. 158 We will have to get the updated revision.
159 """ 159 """
160 gitsrcname = '%s%s' % (ud.host, ud.path.replace('/', '.'))
161 repodir = os.path.join(data.expand('${GITDIR}', d), gitsrcname)
162 160
163 key = "GIT_CACHED_REVISION-%s-%s" % (gitsrcname, ud.tag) 161 key = "GIT_CACHED_REVISION-%s-%s" % (gitsrcname, ud.tag)
164 if bb.data.getVar(key, d): 162 if bb.data.getVar(key, d):
@@ -173,11 +171,11 @@ class Git(Fetch):
173 cwd = os.getcwd() 171 cwd = os.getcwd()
174 172
175 # Check if we have the rev already 173 # Check if we have the rev already
176 if not os.path.exists(repodir): 174 if not os.path.exists(ud.clonedir):
177 print "no repo" 175 print "no repo"
178 self.go(None, ud, d) 176 self.go(None, ud, d)
179 177
180 os.chdir(repodir) 178 os.chdir(ud.clonedir)
181 if not self._contains_ref(ud.tag, d): 179 if not self._contains_ref(ud.tag, d):
182 self.go(None, ud, d) 180 self.go(None, ud, d)
183 181