bitbake/fetch2: Fix the problems introduced by the git fetcher AUTOREV fix
The ordering constrains on the urldata_init functions are not straight forward. To avoid further problems, create a helper function to setup the source revisions which the init functions can all at the appropriate point. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
f3ade6b0b6
commit
c4371138f7
|
@ -558,18 +558,6 @@ class FetchData(object):
|
||||||
if hasattr(self.method, "urldata_init"):
|
if hasattr(self.method, "urldata_init"):
|
||||||
self.method.urldata_init(self, d)
|
self.method.urldata_init(self, d)
|
||||||
|
|
||||||
if self.method.supports_srcrev():
|
|
||||||
self.revisions = {}
|
|
||||||
for name in self.names:
|
|
||||||
self.revisions[name] = srcrev_internal_helper(self, d, name)
|
|
||||||
|
|
||||||
# add compatibility code for non name specified case
|
|
||||||
if len(self.names) == 1:
|
|
||||||
self.revision = self.revisions[self.names[0]]
|
|
||||||
|
|
||||||
if hasattr(self.method, "fixuprevisions"):
|
|
||||||
self.method.fixuprevisions(self, d)
|
|
||||||
|
|
||||||
if "localpath" in self.parm:
|
if "localpath" in self.parm:
|
||||||
# if user sets localpath for file, use it instead.
|
# if user sets localpath for file, use it instead.
|
||||||
self.localpath = self.parm["localpath"]
|
self.localpath = self.parm["localpath"]
|
||||||
|
@ -582,6 +570,15 @@ class FetchData(object):
|
||||||
self.donestamp = basepath + '.done'
|
self.donestamp = basepath + '.done'
|
||||||
self.lockfile = basepath + '.lock'
|
self.lockfile = basepath + '.lock'
|
||||||
|
|
||||||
|
def setup_revisons(self, d):
|
||||||
|
self.revisions = {}
|
||||||
|
for name in self.names:
|
||||||
|
self.revisions[name] = srcrev_internal_helper(self, d, name)
|
||||||
|
|
||||||
|
# add compatibility code for non name specified case
|
||||||
|
if len(self.names) == 1:
|
||||||
|
self.revision = self.revisions[self.names[0]]
|
||||||
|
|
||||||
def setup_localpath(self, d):
|
def setup_localpath(self, d):
|
||||||
if not self.localpath:
|
if not self.localpath:
|
||||||
self.localpath = self.method.localpath(self.url, self, d)
|
self.localpath = self.method.localpath(self.url, self, d)
|
||||||
|
|
|
@ -45,6 +45,8 @@ class Bzr(FetchMethod):
|
||||||
relpath = self._strip_leading_slashes(ud.path)
|
relpath = self._strip_leading_slashes(ud.path)
|
||||||
ud.pkgdir = os.path.join(data.expand('${BZRDIR}', d), ud.host, relpath)
|
ud.pkgdir = os.path.join(data.expand('${BZRDIR}', d), ud.host, relpath)
|
||||||
|
|
||||||
|
ud.setup_revisons(d)
|
||||||
|
|
||||||
if not ud.revision:
|
if not ud.revision:
|
||||||
ud.revision = self.latest_revision(ud.url, ud, d)
|
ud.revision = self.latest_revision(ud.url, ud, d)
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,8 @@ class Git(FetchMethod):
|
||||||
|
|
||||||
ud.localfile = ud.clonedir
|
ud.localfile = ud.clonedir
|
||||||
|
|
||||||
def fixuprevisions(self, ud, d):
|
ud.setup_revisons(d)
|
||||||
|
|
||||||
for name in ud.names:
|
for name in ud.names:
|
||||||
# Ensure anything that doesn't look like a sha256 checksum/revision is translated into one
|
# Ensure anything that doesn't look like a sha256 checksum/revision is translated into one
|
||||||
if not ud.revisions[name] or len(ud.revisions[name]) != 40 or (False in [c in "abcdef0123456789" for c in ud.revisions[name]]):
|
if not ud.revisions[name] or len(ud.revisions[name]) != 40 or (False in [c in "abcdef0123456789" for c in ud.revisions[name]]):
|
||||||
|
|
|
@ -57,6 +57,8 @@ class Hg(FetchMethod):
|
||||||
ud.pkgdir = os.path.join(data.expand('${HGDIR}', d), ud.host, relpath)
|
ud.pkgdir = os.path.join(data.expand('${HGDIR}', d), ud.host, relpath)
|
||||||
ud.moddir = os.path.join(ud.pkgdir, ud.module)
|
ud.moddir = os.path.join(ud.pkgdir, ud.module)
|
||||||
|
|
||||||
|
ud.setup_revisons(d)
|
||||||
|
|
||||||
if 'rev' in ud.parm:
|
if 'rev' in ud.parm:
|
||||||
ud.revision = ud.parm['rev']
|
ud.revision = ud.parm['rev']
|
||||||
elif not ud.revision:
|
elif not ud.revision:
|
||||||
|
|
|
@ -56,6 +56,8 @@ class Svn(FetchMethod):
|
||||||
ud.pkgdir = os.path.join(data.expand('${SVNDIR}', d), ud.host, relpath)
|
ud.pkgdir = os.path.join(data.expand('${SVNDIR}', d), ud.host, relpath)
|
||||||
ud.moddir = os.path.join(ud.pkgdir, ud.module)
|
ud.moddir = os.path.join(ud.pkgdir, ud.module)
|
||||||
|
|
||||||
|
ud.setup_revisons(d)
|
||||||
|
|
||||||
if 'rev' in ud.parm:
|
if 'rev' in ud.parm:
|
||||||
ud.revision = ud.parm['rev']
|
ud.revision = ud.parm['rev']
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue