aboutsummaryrefslogtreecommitdiffstats
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-10 23:37:03 +0000
commit7ffcda8bfacb85f7f11859f0c88f5a406172243a (patch)
treea451d9686421b3ebf4f6d7a68b7c2243784bb803
parentfa426b73b09d273a8eea3436dcf459c352a31212 (diff)
downloadbitbake-7ffcda8bfacb85f7f11859f0c88f5a406172243a.tar.gz
bitbake-7ffcda8bfacb85f7f11859f0c88f5a406172243a.tar.bz2
bitbake-7ffcda8bfacb85f7f11859f0c88f5a406172243a.zip
bitbake/fetch2: Make srcrev_internal_helper a normal function, doesn't belong in the FetchMethod class
(From Poky rev: 831c6c1d3c23c50f9c55a6bbf8dc6311bca3881b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/fetch2/__init__.py65
-rw-r--r--lib/bb/fetch2/osc.py2
2 files changed, 32 insertions, 35 deletions
diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index b60ed0ce..03a80d98 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/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/lib/bb/fetch2/osc.py b/lib/bb/fetch2/osc.py
index 5c3a6fea..f252b5e4 100644
--- a/lib/bb/fetch2/osc.py
+++ b/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: