summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-06 10:20:18 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-06 11:44:12 +0000
commite4c1e99f234491af1c0fc886e73deedaef108a1a (patch)
tree42e8c7d29448fb583f96d4063962d2059d2f5e34 /bitbake/lib/bb/fetch2
parent66e6a9798e5462a6cd8dce22a400b81f1dcae88b (diff)
downloadpoky-e4c1e99f234491af1c0fc886e73deedaef108a1a.tar.gz
bitbake/fetch2/git: Switch to completely use bare clones
We no longer need index/workdir support in the mirror tree and it causes all kind of reference naming problems.Simplifying the code to remove this and use just bare clones addresses this problem. We increase the "version" number on the mirror tarballs to reflect the change and ensure older mirror tarballs are not used as they would break. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2')
-rw-r--r--bitbake/lib/bb/fetch2/git.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index ba8126f003..a4a1278b68 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -66,7 +66,7 @@ class Git(Fetch):
66 ud.branches[name] = branch 66 ud.branches[name] = branch
67 67
68 gitsrcname = '%s%s' % (ud.host, ud.path.replace('/', '.')) 68 gitsrcname = '%s%s' % (ud.host, ud.path.replace('/', '.'))
69 ud.mirrortarball = 'git_%s.tar.gz' % (gitsrcname) 69 ud.mirrortarball = 'git2_%s.tar.gz' % (gitsrcname)
70 ud.clonedir = os.path.join(data.expand('${GITDIR}', d), gitsrcname) 70 ud.clonedir = os.path.join(data.expand('${GITDIR}', d), gitsrcname)
71 71
72 ud.basecmd = data.getVar("FETCHCMD_git", d, True) or "git" 72 ud.basecmd = data.getVar("FETCHCMD_git", d, True) or "git"
@@ -116,8 +116,8 @@ class Git(Fetch):
116 116
117 # If the repo still doesn't exist, fallback to cloning it 117 # If the repo still doesn't exist, fallback to cloning it
118 if not os.path.exists(ud.clonedir): 118 if not os.path.exists(ud.clonedir):
119 bb.fetch2.check_network_access(d, "git clone %s%s" % (ud.host, ud.path)) 119 bb.fetch2.check_network_access(d, "git clone --bare %s%s" % (ud.host, ud.path))
120 runfetchcmd("%s clone -n %s://%s%s%s %s" % (ud.basecmd, ud.proto, username, ud.host, ud.path, ud.clonedir), d) 120 runfetchcmd("%s clone --bare %s://%s%s%s %s" % (ud.basecmd, ud.proto, username, ud.host, ud.path, ud.clonedir), d)
121 121
122 os.chdir(ud.clonedir) 122 os.chdir(ud.clonedir)
123 # Update the checkout if needed 123 # Update the checkout if needed
@@ -147,7 +147,7 @@ class Git(Fetch):
147 mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) 147 mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True)
148 if mirror_tarballs != "0" and ud.repochanged: 148 if mirror_tarballs != "0" and ud.repochanged:
149 logger.info("Creating tarball of git repository") 149 logger.info("Creating tarball of git repository")
150 runfetchcmd("tar -czf %s %s" % (repofile, os.path.join(".", ".git", "*") ), d) 150 runfetchcmd("tar -czf %s %s" % (repofile, os.path.join(".") ), d)
151 151
152 def unpack(self, ud, destdir, d): 152 def unpack(self, ud, destdir, d):
153 """ unpack the downloaded src to destdir""" 153 """ unpack the downloaded src to destdir"""
@@ -163,11 +163,6 @@ class Git(Fetch):
163 bb.utils.prunedir(destdir) 163 bb.utils.prunedir(destdir)
164 164
165 runfetchcmd("git clone -s -n %s %s" % (ud.clonedir, destdir), d) 165 runfetchcmd("git clone -s -n %s %s" % (ud.clonedir, destdir), d)
166 if os.path.exists("%s/.git/refs/remotes/origin" % ud.clonedir):
167 bb.mkdirhier("%s/.git/refs/remotes/origin/" % destdir)
168 runfetchcmd("cp -af %s/.git/refs/remotes/origin/* %s/.git/refs/remotes/origin/" %(ud.clonedir, destdir), d)
169 if os.path.exists("%s/.git/packed-refs" % ud.clonedir):
170 runfetchcmd("cp -af %s/.git/packed-refs %s/.git/" %(ud.clonedir, destdir), d)
171 if not ud.nocheckout: 166 if not ud.nocheckout:
172 os.chdir(destdir) 167 os.chdir(destdir)
173 runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.revisions[ud.names[0]], readpathspec), d) 168 runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.revisions[ud.names[0]], readpathspec), d)