diff options
-rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 65 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/osc.py | 2 |
2 files changed, 32 insertions, 35 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index b60ed0ce6..03a80d989 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 5c3a6fea6..f252b5e4a 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: |