Bug 4787 - bitbake -e: Failure expanding variable SRCPV
Summary: bitbake -e: Failure expanding variable SRCPV
Status: RESOLVED WONTFIX
Alias: None
Product: BitBake
Classification: Build System, Metadata & Runtime
Component: bitbake (show other bugs)
Version: 1.5
Hardware: x86 Multiple
: Undecided normal
Target Milestone: 1.5 M2
Assignee: Robert Yang
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2013-06-28 08:20 UTC by Robert Yang
Modified: 2013-06-28 10:10 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Yang 2013-06-28 08:20:28 UTC
The "bitbake -e" got this error:


# expansion of SRCPV threw ExpansionError: Failure expanding variable SRCPV, expression was ${@bb.fetch2.get_srcrev(d)} which triggered exception FetchError: Fetcher failure: SRCREV was used yet no valid SCM was found in SRC_URI

This is because there is no SCM if we run "bitbake -e" with no args, the following patch would fix the problem.

diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 1365335..ec291ac 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -616,7 +616,11 @@ def get_srcrev(d):
             scms.append(u)
 
     if len(scms) == 0:
-        raise FetchError("SRCREV was used yet no valid SCM was found in SRC_URI")
+        SRCREV = d.getVar('SRCREV', True)
+        if SRCREV == "INVALID":
+            return SRCREV
+        else:
+            raise FetchError("SRCREV was used yet no valid SCM was found in SRC_URI")
 
     if len(scms) == 1 and len(urldata[scms[0]].names) == 1:
         autoinc, rev = urldata[scms[0]].method.sortable_revision(scms[0], urldata[scms[0]], d, urldata[scms[0]].names[0])
Comment 1 Richard Purdie 2013-06-28 09:45:18 UTC
We intentionally need to throw this exception when an invalid SRCREV is specified to aid usability in other areas. In the -e output, the exception is simply shown as a comment, no error code is set or error raised. I'd suggest we therefore just mark this bug as WONTFIX unless there is some bigger issue I'm not seeing?
Comment 2 Robert Yang 2013-06-28 10:10:58 UTC
(In reply to comment #1)
> We intentionally need to throw this exception when an invalid SRCREV is
> specified to aid usability in other areas. In the -e output, the exception
> is simply shown as a comment, no error code is set or error raised. I'd
> suggest we therefore just mark this bug as WONTFIX unless there is some
> bigger issue I'm not seeing?

Sounds reasonable, I happened to see this error when I ran "bb show" which is similar to "bitbake -e", I will mark this bug as WONTFIX and try to fix it from "bb".