[poky] [PATCH 2/8] git.py: move git specific url data initialization earlier
Yu Ke
ke.yu at intel.com
Mon Dec 27 05:57:25 PST 2010
move the url data init earlier, so that Git.latest_revision()
can work before Git.localpath()
This change allow FetchData:__init__ to set FetchData.revison by
Git.latest_revision()
Signed-off-by: Yu Ke <ke.yu at intel.com>
---
bitbake/lib/bb/fetch/git.py | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/bitbake/lib/bb/fetch/git.py b/bitbake/lib/bb/fetch/git.py
index a8ec104..df582a3 100644
--- a/bitbake/lib/bb/fetch/git.py
+++ b/bitbake/lib/bb/fetch/git.py
@@ -38,10 +38,17 @@ class Git(Fetch):
"""
Check to see if a given url can be fetched with git.
"""
- return ud.type in ['git']
-
- def localpath(self, url, ud, d):
+ if ud.type in ['git']:
+ self.urldata_init(ud, d)
+ return True
+ else:
+ return False
+ def urldata_init(self, ud, d):
+ """
+ init git specific variable within url data
+ so that the git method like latest_revision() can work
+ """
if 'protocol' in ud.parm:
ud.proto = ud.parm['protocol']
elif not ud.host:
@@ -55,6 +62,10 @@ class Git(Fetch):
ud.mirrortarball = 'git_%s.tar.gz' % (gitsrcname)
ud.clonedir = os.path.join(data.expand('${GITDIR}', d), gitsrcname)
+ ud.basecmd = data.getVar("FETCHCMD_git", d, True) or "git"
+
+ def localpath(self, url, ud, d):
+
tag = Fetch.srcrev_internal_helper(ud, d)
if tag is True:
ud.tag = self.latest_revision(url, ud, d)
@@ -77,8 +88,6 @@ class Git(Fetch):
else:
ud.localfile = data.expand('git_%s%s_%s.tar.gz' % (ud.host, subdirpath.replace('/', '.'), ud.tag), d)
- ud.basecmd = data.getVar("FETCHCMD_git", d, True) or "git"
-
if 'noclone' in ud.parm:
ud.localfile = None
return None
--
1.7.0.4
More information about the poky
mailing list