bitbake: fetcher updates - Add BB_GENERATE_MIRROR_TARBALLS option to allow disabling tarball creation to speedup git fetches, improve srcrev handling to remove some hacks and remove the need for external workarounds
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@3101 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
parent
e7198e4903
commit
e9b7bc6914
|
@ -170,6 +170,8 @@ def localpaths(d):
|
||||||
|
|
||||||
return local
|
return local
|
||||||
|
|
||||||
|
srcrev_internal_call = False
|
||||||
|
|
||||||
def get_srcrev(d):
|
def get_srcrev(d):
|
||||||
"""
|
"""
|
||||||
Return the version string for the current package
|
Return the version string for the current package
|
||||||
|
@ -178,6 +180,19 @@ def get_srcrev(d):
|
||||||
In the multi SCM case, we build a value based on SRCREV_FORMAT which must
|
In the multi SCM case, we build a value based on SRCREV_FORMAT which must
|
||||||
have been set.
|
have been set.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
#
|
||||||
|
# Ugly code alert. localpath in the fetchers will try to evaluate SRCREV which
|
||||||
|
# could translate into a call to here. If it does, we need to catch this
|
||||||
|
# and provide some way so it knows get_srcrev is active instead of being
|
||||||
|
# some number etc. hence the srcrev_internal_call tracking and the magic
|
||||||
|
# "SRCREVINACTION" return value.
|
||||||
|
#
|
||||||
|
# Neater solutions welcome!
|
||||||
|
#
|
||||||
|
if bb.fetch.srcrev_internal_call:
|
||||||
|
return "SRCREVINACTION"
|
||||||
|
|
||||||
scms = []
|
scms = []
|
||||||
# Only call setup_localpath on URIs which suppports_srcrev()
|
# Only call setup_localpath on URIs which suppports_srcrev()
|
||||||
urldata = init(bb.data.getVar('SRC_URI', d, 1).split(), d, False)
|
urldata = init(bb.data.getVar('SRC_URI', d, 1).split(), d, False)
|
||||||
|
@ -273,12 +288,14 @@ class FetchData(object):
|
||||||
def setup_localpath(self, d):
|
def setup_localpath(self, d):
|
||||||
self.setup = True
|
self.setup = True
|
||||||
if "localpath" in self.parm:
|
if "localpath" in self.parm:
|
||||||
|
# if user sets localpath for file, use it instead.
|
||||||
self.localpath = self.parm["localpath"]
|
self.localpath = self.parm["localpath"]
|
||||||
else:
|
else:
|
||||||
|
bb.fetch.srcrev_internal_call = True
|
||||||
self.localpath = self.method.localpath(self.url, self, d)
|
self.localpath = self.method.localpath(self.url, self, d)
|
||||||
|
bb.fetch.srcrev_internal_call = False
|
||||||
self.md5 = self.localpath + '.md5'
|
self.md5 = self.localpath + '.md5'
|
||||||
self.lockfile = self.localpath + '.lock'
|
self.lockfile = self.localpath + '.lock'
|
||||||
# if user sets localpath for file, use it instead.
|
|
||||||
|
|
||||||
|
|
||||||
class Fetch(object):
|
class Fetch(object):
|
||||||
|
|
|
@ -48,16 +48,14 @@ class Bzr(Fetch):
|
||||||
if 'rev' in ud.parm:
|
if 'rev' in ud.parm:
|
||||||
ud.revision = ud.parm['rev']
|
ud.revision = ud.parm['rev']
|
||||||
else:
|
else:
|
||||||
# ***Nasty hack***
|
rev = data.getVar("SRCREV", d, 1)
|
||||||
rev = data.getVar("SRCREV", d, 0)
|
if rev is "SRCREVINACTION":
|
||||||
if rev and "get_srcrev" in rev:
|
rev = self.latest_revision(url, ud, d)
|
||||||
ud.revision = self.latest_revision(url, ud, d)
|
if rev:
|
||||||
elif rev:
|
|
||||||
ud.revision = rev
|
ud.revision = rev
|
||||||
else:
|
else:
|
||||||
ud.revision = ""
|
ud.revision = ""
|
||||||
|
|
||||||
|
|
||||||
ud.localfile = data.expand('bzr_%s_%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.revision), d)
|
ud.localfile = data.expand('bzr_%s_%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.revision), d)
|
||||||
|
|
||||||
return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
|
return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
|
||||||
|
|
|
@ -50,12 +50,15 @@ class Git(Fetch):
|
||||||
if 'protocol' in ud.parm:
|
if 'protocol' in ud.parm:
|
||||||
ud.proto = ud.parm['protocol']
|
ud.proto = ud.parm['protocol']
|
||||||
|
|
||||||
tag = data.getVar("SRCREV", d, 0)
|
tag = data.getVar("SRCREV", d, 1)
|
||||||
if 'tag' in ud.parm:
|
if 'tag' in ud.parm:
|
||||||
ud.tag = ud.parm['tag']
|
ud.tag = ud.parm['tag']
|
||||||
elif tag and "get_srcrev" not in tag and len(tag) == 40:
|
elif tag is "SRCREVINACTION":
|
||||||
ud.tag = tag
|
ud.tag = self.latest_revision(url, ud, d)
|
||||||
else:
|
else:
|
||||||
|
ud.tag = tag
|
||||||
|
|
||||||
|
if ud.tag == "master":
|
||||||
ud.tag = self.latest_revision(url, ud, d)
|
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)
|
ud.localfile = data.expand('git_%s%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.tag), d)
|
||||||
|
@ -93,12 +96,12 @@ class Git(Fetch):
|
||||||
runfetchcmd("git pull --tags %s://%s%s" % (ud.proto, ud.host, ud.path), d)
|
runfetchcmd("git pull --tags %s://%s%s" % (ud.proto, ud.host, ud.path), d)
|
||||||
runfetchcmd("git prune-packed", d)
|
runfetchcmd("git prune-packed", d)
|
||||||
runfetchcmd("git pack-redundant --all | xargs -r rm", d)
|
runfetchcmd("git pack-redundant --all | xargs -r rm", d)
|
||||||
# old method of downloading tags
|
|
||||||
#runfetchcmd("rsync -a --verbose --stats --progress rsync://%s%s/ %s" % (ud.host, ud.path, os.path.join(repodir, ".git", "")), d)
|
|
||||||
|
|
||||||
os.chdir(repodir)
|
os.chdir(repodir)
|
||||||
bb.msg.note(1, bb.msg.domain.Fetcher, "Creating tarball of git repository")
|
mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True)
|
||||||
runfetchcmd("tar -czf %s %s" % (repofile, os.path.join(".", ".git", "*") ), d)
|
if mirror_tarballs != "0":
|
||||||
|
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 os.path.exists(codir):
|
if os.path.exists(codir):
|
||||||
prunedir(codir)
|
prunedir(codir)
|
||||||
|
|
|
@ -57,15 +57,14 @@ class Hg(Fetch):
|
||||||
|
|
||||||
if 'rev' in ud.parm:
|
if 'rev' in ud.parm:
|
||||||
ud.revision = ud.parm['rev']
|
ud.revision = ud.parm['rev']
|
||||||
else:
|
#else:
|
||||||
#
|
# rev = data.getVar("SRCREV", d, 1)
|
||||||
rev = data.getVar("SRCREV", d, 0)
|
# if rev is "SRCREVINACTION":
|
||||||
if rev and "get_srcrev" in rev:
|
# rev = self.latest_revision(url, ud, d)
|
||||||
ud.revision = self.latest_revision(url, ud, d)
|
# if rev:
|
||||||
elif rev:
|
# ud.revision = rev
|
||||||
ud.revision = rev
|
# else:
|
||||||
else:
|
# ud.revision = ""
|
||||||
ud.revision = ""
|
|
||||||
|
|
||||||
ud.localfile = data.expand('%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision), d)
|
ud.localfile = data.expand('%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision), d)
|
||||||
|
|
||||||
|
|
|
@ -62,22 +62,18 @@ class Svn(Fetch):
|
||||||
ud.revision = ""
|
ud.revision = ""
|
||||||
else:
|
else:
|
||||||
#
|
#
|
||||||
# ***Nasty hacks***
|
# ***Nasty hack***
|
||||||
# If DATE in unexpanded PV, use ud.date (which is set from SRCDATE)
|
# If DATE in unexpanded PV, use ud.date (which is set from SRCDATE)
|
||||||
# Will warn people to switch to SRCREV here
|
# Should warn people to switch to SRCREV here
|
||||||
#
|
|
||||||
# How can we tell when a user has overriden SRCDATE?
|
|
||||||
# check for "get_srcdate" in unexpanded SRCREV - ugly
|
|
||||||
#
|
#
|
||||||
pv = data.getVar("PV", d, 0)
|
pv = data.getVar("PV", d, 0)
|
||||||
if "DATE" in pv:
|
if "DATE" in pv:
|
||||||
ud.revision = ""
|
ud.revision = ""
|
||||||
else:
|
else:
|
||||||
rev = data.getVar("SRCREV", d, 0)
|
rev = data.getVar("SRCREV", d, 1)
|
||||||
if rev and "get_srcrev" in rev:
|
if rev is "SRCREVINACTION":
|
||||||
ud.revision = self.latest_revision(url, ud, d)
|
rev = self.latest_revision(url, ud, d)
|
||||||
ud.date = ""
|
if rev:
|
||||||
elif rev:
|
|
||||||
ud.revision = rev
|
ud.revision = rev
|
||||||
ud.date = ""
|
ud.date = ""
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue