summaryrefslogtreecommitdiff
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-04 10:59:42 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-07 09:06:36 +0000
commit831c6c1d3c23c50f9c55a6bbf8dc6311bca3881b (patch)
treea64ec10c8e8146fe6d280550a229f34c0e488f7d /bitbake
parentab0dd1397491478ee6149283e5ba8775dd8cdc3b (diff)
downloadopenembedded-core-831c6c1d3c23c50f9c55a6bbf8dc6311bca3881b.tar.gz
openembedded-core-831c6c1d3c23c50f9c55a6bbf8dc6311bca3881b.tar.bz2
openembedded-core-831c6c1d3c23c50f9c55a6bbf8dc6311bca3881b.zip
bitbake/fetch2: Make srcrev_internal_helper a normal function, doesn't belong in the FetchMethod class
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py65
-rw-r--r--bitbake/lib/bb/fetch2/osc.py2
2 files changed, 32 insertions, 35 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index b60ed0ce67..03a80d9891 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -577,6 +577,36 @@ def try_mirrors(d, uri, mirrors, check = False, force = False):
continue
return None
+def srcrev_internal_helper(ud, d, name):
+ """
+ Return:
+ a) a source revision if specified
+ b) latest revision if SREREV="AUTOINC"
+ c) None if not specified
+ """
+
+ if 'rev' in ud.parm:
+ return ud.parm['rev']
+
+ if 'tag' in ud.parm:
+ return ud.parm['tag']
+
+ rev = None
+ if name != '':
+ pn = data.getVar("PN", d, 1)
+ rev = data.getVar("SRCREV_%s_pn-%s" % (name, pn), d, 1)
+ if not rev:
+ rev = data.getVar("SRCREV_pn-%s_%s" % (pn, name), d, 1)
+ if not rev:
+ rev = data.getVar("SRCREV_%s" % name, d, 1)
+ if not rev:
+ rev = data.getVar("SRCREV", d, 1)
+ if rev == "INVALID":
+ raise FetchError("Please set SRCREV to a valid value", ud.url)
+ if rev == "AUTOINC":
+ rev = ud.method.latest_revision(ud.url, ud, d, name)
+
+ return rev
class FetchData(object):
"""
@@ -618,7 +648,7 @@ class FetchData(object):
if self.method.supports_srcrev():
self.revisions = {}
for name in self.names:
- self.revisions[name] = FetchMethod.srcrev_internal_helper(self, d, name)
+ self.revisions[name] = srcrev_internal_helper(self, d, name)
# add compatibility code for non name specified case
if len(self.names) == 1:
@@ -810,39 +840,6 @@ class FetchMethod(object):
return data.getVar("SRCDATE", d, 1) or data.getVar("CVSDATE", d, 1) or data.getVar("DATE", d, 1)
getSRCDate = staticmethod(getSRCDate)
- def srcrev_internal_helper(ud, d, name):
- """
- Return:
- a) a source revision if specified
- b) latest revision if SREREV="AUTOINC"
- c) None if not specified
- """
-
- if 'rev' in ud.parm:
- return ud.parm['rev']
-
- if 'tag' in ud.parm:
- return ud.parm['tag']
-
- rev = None
- if name != '':
- pn = data.getVar("PN", d, 1)
- rev = data.getVar("SRCREV_%s_pn-%s" % (name, pn), d, 1)
- if not rev:
- rev = data.getVar("SRCREV_pn-%s_%s" % (pn, name), d, 1)
- if not rev:
- rev = data.getVar("SRCREV_%s" % name, d, 1)
- if not rev:
- rev = data.getVar("SRCREV", d, 1)
- if rev == "INVALID":
- raise FetchError("Please set SRCREV to a valid value", ud.url)
- if rev == "AUTOINC":
- rev = ud.method.latest_revision(ud.url, ud, d, name)
-
- return rev
-
- srcrev_internal_helper = staticmethod(srcrev_internal_helper)
-
def localcount_internal_helper(ud, d, name):
"""
Return:
diff --git a/bitbake/lib/bb/fetch2/osc.py b/bitbake/lib/bb/fetch2/osc.py
index 5c3a6fea68..f252b5e4a3 100644
--- a/bitbake/lib/bb/fetch2/osc.py
+++ b/bitbake/lib/bb/fetch2/osc.py
@@ -41,7 +41,7 @@ class Osc(FetchMethod):
ud.revision = ud.parm['rev']
else:
pv = data.getVar("PV", d, 0)
- rev = FetchMethod.srcrev_internal_helper(ud, d)
+ rev = bb.fetch2.srcrev_internal_helper(ud, d)
if rev and rev != True:
ud.revision = rev
else: