summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2014-01-20 13:10:46 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-01-21 10:20:13 +0000
commit721d3d6e0a55c767001a32e9fbc9a999f5fd1a66 (patch)
treea3dc0901b0d67ff9d7ed93263321209884212ca5 /bitbake/lib/bb
parent1180ec37e4d2c0ea509c7532e43faab003ae8390 (diff)
downloadpoky-721d3d6e0a55c767001a32e9fbc9a999f5fd1a66.tar.gz
bitbake: fetch2: Clean up srcrev_internal_helper
Currently INVALID and None are checked as incorrect values under different circumstances. This code standardises those checks to be consistent. We should phase out the use of "INVALID". (Bitbake rev: 86ef4e65ce18b71dc69643586bd2aa8f48703171) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index f2a9f15fd9..f4cff03225 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -873,17 +873,24 @@ def srcrev_internal_helper(ud, d, name):
873 if 'tag' in ud.parm: 873 if 'tag' in ud.parm:
874 return ud.parm['tag'] 874 return ud.parm['tag']
875 875
876 rev = None 876 srcrev = None
877 pn = d.getVar("PN", True) 877 pn = d.getVar("PN", True)
878 attempts = []
879 if name != '' and pn:
880 attempts.append("SRCREV_%s_pn-%s" % (name, pn))
878 if name != '': 881 if name != '':
879 rev = d.getVar("SRCREV_%s_pn-%s" % (name, pn), True) 882 attempts.append("SRCREV_%s" % name)
880 if not rev: 883 if pn:
881 rev = d.getVar("SRCREV_%s" % name, True) 884 attempts.append("SRCREV_pn-%s" % pn)
882 if not rev: 885 attempts.append("SRCREV")
883 rev = d.getVar("SRCREV_pn-%s" % pn, True) 886
884 if not rev: 887 for a in attempts:
885 rev = d.getVar("SRCREV", True) 888 srcrev = d.getVar(a, True)
886 if rev == "INVALID": 889 if srcrev and srcrev != "INVALID":
890 break
891
892 rev = srcrev
893 if rev == "INVALID" or not rev:
887 var = "SRCREV_pn-%s" % pn 894 var = "SRCREV_pn-%s" % pn
888 if name != '': 895 if name != '':
889 var = "SRCREV_%s_pn-%s" % (name, pn) 896 var = "SRCREV_%s_pn-%s" % (name, pn)