summaryrefslogtreecommitdiff
path: root/bitbake-dev/lib/bb/fetch
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-01-19 14:48:19 +0000
committerRichard Purdie <rpurdie@linux.intel.com>2010-01-19 14:48:19 +0000
commit22a271aaa99daeb6b29c42c2c1dc670bf204310e (patch)
treed2690b66e7a613820f34ceaecbce65809cbd22a3 /bitbake-dev/lib/bb/fetch
parentcefe87fc3c4202e942f34666813bc094df2ffb4b (diff)
downloadopenembedded-core-22a271aaa99daeb6b29c42c2c1dc670bf204310e.tar.gz
openembedded-core-22a271aaa99daeb6b29c42c2c1dc670bf204310e.tar.bz2
openembedded-core-22a271aaa99daeb6b29c42c2c1dc670bf204310e.tar.xz
openembedded-core-22a271aaa99daeb6b29c42c2c1dc670bf204310e.zip
bitbake-dev: Sync with upstream
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake-dev/lib/bb/fetch')
-rw-r--r--bitbake-dev/lib/bb/fetch/cvs.py2
-rw-r--r--bitbake-dev/lib/bb/fetch/git.py86
-rw-r--r--bitbake-dev/lib/bb/fetch/local.py4
-rw-r--r--bitbake-dev/lib/bb/fetch/svk.py2
-rw-r--r--bitbake-dev/lib/bb/fetch/wget.py2
5 files changed, 65 insertions, 31 deletions
diff --git a/bitbake-dev/lib/bb/fetch/cvs.py b/bitbake-dev/lib/bb/fetch/cvs.py
index d8bd4eaf7..90a006500 100644
--- a/bitbake-dev/lib/bb/fetch/cvs.py
+++ b/bitbake-dev/lib/bb/fetch/cvs.py
@@ -41,7 +41,7 @@ class Cvs(Fetch):
"""
Check to see if a given url can be fetched with cvs.
"""
- return ud.type in ['cvs', 'pserver']
+ return ud.type in ['cvs']
def localpath(self, url, ud, d):
if not "module" in ud.parm:
diff --git a/bitbake-dev/lib/bb/fetch/git.py b/bitbake-dev/lib/bb/fetch/git.py
index 43053d6c4..0e68325db 100644
--- a/bitbake-dev/lib/bb/fetch/git.py
+++ b/bitbake-dev/lib/bb/fetch/git.py
@@ -51,6 +51,10 @@ class Git(Fetch):
ud.branch = ud.parm.get("branch", "master")
+ gitsrcname = '%s%s' % (ud.host, ud.path.replace('/', '.'))
+ ud.mirrortarball = 'git_%s.tar.gz' % (gitsrcname)
+ ud.clonedir = os.path.join(data.expand('${GITDIR}', d), gitsrcname)
+
tag = Fetch.srcrev_internal_helper(ud, d)
if tag is True:
ud.tag = self.latest_revision(url, ud, d)
@@ -60,7 +64,18 @@ class Git(Fetch):
if not ud.tag or ud.tag == "master":
ud.tag = self.latest_revision(url, ud, d)
- ud.localfile = data.expand('git_%s%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.tag), d)
+ subdir = ud.parm.get("subpath", "")
+ if subdir != "":
+ if subdir.endswith("/"):
+ subdir = subdir[:-1]
+ subdirpath = os.path.join(ud.path, subdir);
+ else:
+ subdirpath = ud.path;
+
+ if 'fullclone' in ud.parm:
+ ud.localfile = ud.mirrortarball
+ else:
+ ud.localfile = data.expand('git_%s%s_%s.tar.gz' % (ud.host, subdirpath.replace('/', '.'), ud.tag), d)
return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
@@ -76,24 +91,20 @@ class Git(Fetch):
else:
username = ""
- gitsrcname = '%s%s' % (ud.host, ud.path.replace('/', '.'))
-
- repofilename = 'git_%s.tar.gz' % (gitsrcname)
- repofile = os.path.join(data.getVar("DL_DIR", d, 1), repofilename)
- repodir = os.path.join(data.expand('${GITDIR}', d), gitsrcname)
+ repofile = os.path.join(data.getVar("DL_DIR", d, 1), ud.mirrortarball)
coname = '%s' % (ud.tag)
- codir = os.path.join(repodir, coname)
+ codir = os.path.join(ud.clonedir, coname)
- if not os.path.exists(repodir):
- if Fetch.try_mirror(d, repofilename):
- bb.mkdirhier(repodir)
- os.chdir(repodir)
+ if not os.path.exists(ud.clonedir):
+ if Fetch.try_mirror(d, ud.mirrortarball):
+ bb.mkdirhier(ud.clonedir)
+ os.chdir(ud.clonedir)
runfetchcmd("tar -xzf %s" % (repofile), d)
else:
- runfetchcmd("git clone -n %s://%s%s%s %s" % (ud.proto, username, ud.host, ud.path, repodir), d)
+ runfetchcmd("git clone -n %s://%s%s%s %s" % (ud.proto, username, ud.host, ud.path, ud.clonedir), d)
- os.chdir(repodir)
+ os.chdir(ud.clonedir)
# Remove all but the .git directory
if not self._contains_ref(ud.tag, d):
runfetchcmd("rm * -Rf", d)
@@ -102,25 +113,45 @@ class Git(Fetch):
runfetchcmd("git prune-packed", d)
runfetchcmd("git pack-redundant --all | xargs -r rm", d)
- os.chdir(repodir)
+ os.chdir(ud.clonedir)
mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True)
- if mirror_tarballs != "0":
+ if mirror_tarballs != "0" or 'fullclone' in ud.parm:
bb.msg.note(1, bb.msg.domain.Fetcher, "Creating tarball of git repository")
runfetchcmd("tar -czf %s %s" % (repofile, os.path.join(".", ".git", "*") ), d)
+ if 'fullclone' in ud.parm:
+ return
+
if os.path.exists(codir):
bb.utils.prunedir(codir)
+ subdir = ud.parm.get("subpath", "")
+ if subdir != "":
+ if subdir.endswith("/"):
+ subdirbase = os.path.basename(subdir[:-1])
+ else:
+ subdirbase = os.path.basename(subdir)
+ else:
+ subdirbase = ""
+
+ if subdir != "":
+ readpathspec = ":%s" % (subdir)
+ codir = os.path.join(codir, "git")
+ coprefix = os.path.join(codir, subdirbase, "")
+ else:
+ readpathspec = ""
+ coprefix = os.path.join(codir, "git", "")
+
bb.mkdirhier(codir)
- os.chdir(repodir)
- runfetchcmd("git read-tree %s" % (ud.tag), d)
- runfetchcmd("git checkout-index -q -f --prefix=%s -a" % (os.path.join(codir, "git", "")), d)
+ os.chdir(ud.clonedir)
+ runfetchcmd("git read-tree %s%s" % (ud.tag, readpathspec), d)
+ runfetchcmd("git checkout-index -q -f --prefix=%s -a" % (coprefix), d)
os.chdir(codir)
bb.msg.note(1, bb.msg.domain.Fetcher, "Creating tarball of git checkout")
runfetchcmd("tar -czf %s %s" % (ud.localpath, os.path.join(".", "*") ), d)
- os.chdir(repodir)
+ os.chdir(ud.clonedir)
bb.utils.prunedir(codir)
def suppports_srcrev(self):
@@ -145,7 +176,10 @@ class Git(Fetch):
else:
username = ""
- output = runfetchcmd("git ls-remote %s://%s%s%s %s" % (ud.proto, username, ud.host, ud.path, ud.branch), d, True)
+ cmd = "git ls-remote %s://%s%s%s %s" % (ud.proto, username, ud.host, ud.path, ud.branch)
+ output = runfetchcmd(cmd, d, True)
+ if not output:
+ raise bb.fetch.FetchError("Fetch command %s gave empty output\n" % (cmd))
return output.split()[0]
def _build_revision(self, url, ud, d):
@@ -156,20 +190,20 @@ class Git(Fetch):
Return a suitable buildindex for the revision specified. This is done by counting revisions
using "git rev-list" which may or may not work in different circumstances.
"""
- gitsrcname = '%s%s' % (ud.host, ud.path.replace('/', '.'))
- repodir = os.path.join(data.expand('${GITDIR}', d), gitsrcname)
cwd = os.getcwd()
# Check if we have the rev already
- if not os.path.exists(repodir):
+
+ if not os.path.exists(ud.clonedir):
+ print "no repo"
self.go(None, ud, d)
- if not os.path.exists(repodir):
- bb.msg.error(bb.msg.domain.Fetcher, "GIT repository for %s doesn't exist in %s, cannot get sortable buildnumber, using old value" % (url, repodir))
+ if not os.path.exists(ud.clonedir):
+ bb.msg.error(bb.msg.domain.Fetcher, "GIT repository for %s doesn't exist in %s, cannot get sortable buildnumber, using old value" % (url, ud.clonedir))
return None
- os.chdir(repodir)
+ os.chdir(ud.clonedir)
if not self._contains_ref(rev, d):
self.go(None, ud, d)
diff --git a/bitbake-dev/lib/bb/fetch/local.py b/bitbake-dev/lib/bb/fetch/local.py
index 577774e59..f9bdf589c 100644
--- a/bitbake-dev/lib/bb/fetch/local.py
+++ b/bitbake-dev/lib/bb/fetch/local.py
@@ -33,9 +33,9 @@ from bb.fetch import Fetch
class Local(Fetch):
def supports(self, url, urldata, d):
"""
- Check to see if a given url can be fetched with cvs.
+ Check to see if a given url represents a local fetch.
"""
- return urldata.type in ['file','patch']
+ return urldata.type in ['file']
def localpath(self, url, urldata, d):
"""
diff --git a/bitbake-dev/lib/bb/fetch/svk.py b/bitbake-dev/lib/bb/fetch/svk.py
index 442f85804..120dad9d4 100644
--- a/bitbake-dev/lib/bb/fetch/svk.py
+++ b/bitbake-dev/lib/bb/fetch/svk.py
@@ -36,7 +36,7 @@ class Svk(Fetch):
"""Class to fetch a module or modules from svk repositories"""
def supports(self, url, ud, d):
"""
- Check to see if a given url can be fetched with cvs.
+ Check to see if a given url can be fetched with svk.
"""
return ud.type in ['svk']
diff --git a/bitbake-dev/lib/bb/fetch/wget.py b/bitbake-dev/lib/bb/fetch/wget.py
index a0dca9404..fd93c7ec4 100644
--- a/bitbake-dev/lib/bb/fetch/wget.py
+++ b/bitbake-dev/lib/bb/fetch/wget.py
@@ -36,7 +36,7 @@ class Wget(Fetch):
"""Class to fetch urls via 'wget'"""
def supports(self, url, ud, d):
"""
- Check to see if a given url can be fetched with cvs.
+ Check to see if a given url can be fetched with wget.
"""
return ud.type in ['http','https','ftp']