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

login
register
mail settings
Submitter Zhenhua Luo
Date Dec. 24, 2013, 8:06 a.m.
Message ID <1387872393-4567-3-git-send-email-zhenhua.luo@freescale.com>
Download mbox | patch
Permalink /patch/63703/
State New
Headers show

Comments

Zhenhua Luo - Dec. 24, 2013, 8:06 a.m.
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@freescale.com>
---
 lib/bb/fetch2/__init__.py | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

Patch

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 != '':