[bitbake-devel] [PATCH 2/2] bitbake: fetch2: adjust the priority of revision definition

Zhenhua Luo zhenhua.luo at freescale.com
Tue Dec 24 08:06:33 UTC 2013


The sanity check for commit validity has been added for branch, to support the
commit included in tag rather than branch, the commit validity check should be
supported for tag as well.

To allign with above change, the priority of revision needs to be adjusted as
following, otherwise SHA defined by SRCREV will be overriden by rev/tag defined
by SRC_URI.

New SHA check order:
a) a source revision if SHA is specified by SRCREV
b) a source revision if revision is specified in SRC_URI
c) latest revision if SRCREV="AUTOINC"
d) None if not specified

Signed-off-by: Zhenhua Luo <zhenhua.luo at freescale.com>
---
 lib/bb/fetch2/__init__.py | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index 8fdf59c..4c5c2e8 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -862,17 +862,12 @@ def try_mirrors(d, origud, mirrors, check = False):
 def srcrev_internal_helper(ud, d, name):
     """
     Return:
-        a) a source revision if specified
-        b) latest revision if SRCREV="AUTOINC"
-        c) None if not specified
+        a) a source revision if SHA is specified by SRCREV
+        b) a source revision if revision is specified in SRC_URI
+        c) latest revision if SRCREV="AUTOINC"
+        d) None if not specified
     """
 
-    if 'rev' in ud.parm:
-        return ud.parm['rev']
-
-    if 'tag' in ud.parm:
-        return ud.parm['tag']
-
     rev = None
     pn = d.getVar("PN", True)
     if name != '':
@@ -883,6 +878,12 @@ def srcrev_internal_helper(ud, d, name):
         rev = d.getVar("SRCREV_pn-%s" % pn, True)
     if not rev:
         rev = d.getVar("SRCREV", True)
+    if not rev:
+        if 'rev' in ud.parm:
+            return ud.parm['rev']
+    if not rev:
+        if 'tag' in ud.parm:
+            return ud.parm['tag']
     if rev == "INVALID":
         var = "SRCREV_pn-%s" % pn
         if name != '':
-- 
1.8.4.2





More information about the bitbake-devel mailing list