Openembedded Bitbake Development
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: bitbake-devel <bitbake-devel@lists.openembedded.org>
Subject: [PATCH] fetch2: Clean up srcrev_internal_helper
Date: Mon, 20 Jan 2014 15:19:44 +0000	[thread overview]
Message-ID: <1390231184.874.33.camel@ted> (raw)

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".

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 9306323..4af089d 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):
     if 'tag' in ud.parm:
         return ud.parm['tag']
 
-    rev = None
+    srcrev = None
     pn = d.getVar("PN", True)
+    attempts = []
+    if name != '' and pn:
+        attempts.append("SRCREV_%s_pn-%s" % (name, pn))
     if name != '':
-        rev = d.getVar("SRCREV_%s_pn-%s" % (name, pn), True)
-        if not rev:
-            rev = d.getVar("SRCREV_%s" % name, True)
-    if not rev:
-        rev = d.getVar("SRCREV_pn-%s" % pn, True)
-    if not rev:
-        rev = d.getVar("SRCREV", True)
-    if rev == "INVALID":
+        attempts.append("SRCREV_%s" % name)
+    if pn:
+        attempts.append("SRCREV_pn-%s" % pn)
+    attempts.append("SRCREV")
+
+    for a in attempts:
+        srcrev = d.getVar(a, True)              
+        if srcrev and srcrev != "INVALID":
+            break
+
+    rev = srcrev
+    if rev == "INVALID" or not rev:
         var = "SRCREV_pn-%s" % pn
         if name != '':
             var = "SRCREV_%s_pn-%s" % (name, pn)




                 reply	other threads:[~2014-01-20 15:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1390231184.874.33.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox