summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
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/lib/bb
parentab0dd1397491478ee6149283e5ba8775dd8cdc3b (diff)
downloadpoky-831c6c1d3c23c50f9c55a6bbf8dc6311bca3881b.tar.gz
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/lib/bb')
-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):
577 continue 577 continue
578 return None 578 return None
579 579
580def srcrev_internal_helper(ud, d, name):
581 """
582 Return:
583 a) a source revision if specified
584 b) latest revision if SREREV="AUTOINC"
585 c) None if not specified
586 """
587
588 if 'rev' in ud.parm:
589 return ud.parm['rev']
590
591 if 'tag' in ud.parm:
592 return ud.parm['tag']
593
594 rev = None
595 if name != '':
596 pn = data.getVar("PN", d, 1)
597 rev = data.getVar("SRCREV_%s_pn-%s" % (name, pn), d, 1)
598 if not rev:
599 rev = data.getVar("SRCREV_pn-%s_%s" % (pn, name), d, 1)
600 if not rev:
601 rev = data.getVar("SRCREV_%s" % name, d, 1)
602 if not rev:
603 rev = data.getVar("SRCREV", d, 1)
604 if rev == "INVALID":
605 raise FetchError("Please set SRCREV to a valid value", ud.url)
606 if rev == "AUTOINC":
607 rev = ud.method.latest_revision(ud.url, ud, d, name)
608
609 return rev
580 610
581class FetchData(object): 611class FetchData(object):
582 """ 612 """
@@ -618,7 +648,7 @@ class FetchData(object):
618 if self.method.supports_srcrev(): 648 if self.method.supports_srcrev():
619 self.revisions = {} 649 self.revisions = {}
620 for name in self.names: 650 for name in self.names:
621 self.revisions[name] = FetchMethod.srcrev_internal_helper(self, d, name) 651 self.revisions[name] = srcrev_internal_helper(self, d, name)
622 652
623 # add compatibility code for non name specified case 653 # add compatibility code for non name specified case
624 if len(self.names) == 1: 654 if len(self.names) == 1:
@@ -810,39 +840,6 @@ class FetchMethod(object):
810 return data.getVar("SRCDATE", d, 1) or data.getVar("CVSDATE", d, 1) or data.getVar("DATE", d, 1) 840 return data.getVar("SRCDATE", d, 1) or data.getVar("CVSDATE", d, 1) or data.getVar("DATE", d, 1)
811 getSRCDate = staticmethod(getSRCDate) 841 getSRCDate = staticmethod(getSRCDate)
812 842
813 def srcrev_internal_helper(ud, d, name):
814 """
815 Return:
816 a) a source revision if specified
817 b) latest revision if SREREV="AUTOINC"
818 c) None if not specified
819 """
820
821 if 'rev' in ud.parm:
822 return ud.parm['rev']
823
824 if 'tag' in ud.parm:
825 return ud.parm['tag']
826
827 rev = None
828 if name != '':
829 pn = data.getVar("PN", d, 1)
830 rev = data.getVar("SRCREV_%s_pn-%s" % (name, pn), d, 1)
831 if not rev:
832 rev = data.getVar("SRCREV_pn-%s_%s" % (pn, name), d, 1)
833 if not rev:
834 rev = data.getVar("SRCREV_%s" % name, d, 1)
835 if not rev:
836 rev = data.getVar("SRCREV", d, 1)
837 if rev == "INVALID":
838 raise FetchError("Please set SRCREV to a valid value", ud.url)
839 if rev == "AUTOINC":
840 rev = ud.method.latest_revision(ud.url, ud, d, name)
841
842 return rev
843
844 srcrev_internal_helper = staticmethod(srcrev_internal_helper)
845
846 def localcount_internal_helper(ud, d, name): 843 def localcount_internal_helper(ud, d, name):
847 """ 844 """
848 Return: 845 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):
41 ud.revision = ud.parm['rev'] 41 ud.revision = ud.parm['rev']
42 else: 42 else:
43 pv = data.getVar("PV", d, 0) 43 pv = data.getVar("PV", d, 0)
44 rev = FetchMethod.srcrev_internal_helper(ud, d) 44 rev = bb.fetch2.srcrev_internal_helper(ud, d)
45 if rev and rev != True: 45 if rev and rev != True:
46 ud.revision = rev 46 ud.revision = rev
47 else: 47 else: