<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>4787</bug_id>
          
          <creation_ts>2013-06-28 08:20:28 +0000</creation_ts>
          <short_desc>bitbake -e: Failure expanding variable SRCPV</short_desc>
          <delta_ts>2013-06-28 10:10:58 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>BitBake</product>
          <component>bitbake</component>
          <version>1.5</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Undecided</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.5 M2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Robert Yang">liezhi.yang</reporter>
          <assigned_to name="Robert Yang">liezhi.yang</assigned_to>
          <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>richard.purdie</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>34202</commentid>
    <comment_count>0</comment_count>
    <who name="Robert Yang">liezhi.yang</who>
    <bug_when>2013-06-28 08:20:28 +0000</bug_when>
    <thetext>The &quot;bitbake -e&quot; 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 &quot;bitbake -e&quot; 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(&quot;SRCREV was used yet no valid SCM was found in SRC_URI&quot;)
+        SRCREV = d.getVar(&apos;SRCREV&apos;, True)
+        if SRCREV == &quot;INVALID&quot;:
+            return SRCREV
+        else:
+            raise FetchError(&quot;SRCREV was used yet no valid SCM was found in SRC_URI&quot;)
 
     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])</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>34211</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2013-06-28 09:45:18 +0000</bug_when>
    <thetext>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&apos;d suggest we therefore just mark this bug as WONTFIX unless there is some bigger issue I&apos;m not seeing?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>34214</commentid>
    <comment_count>2</comment_count>
    <who name="Robert Yang">liezhi.yang</who>
    <bug_when>2013-06-28 10:10:58 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; We intentionally need to throw this exception when an invalid SRCREV is
&gt; specified to aid usability in other areas. In the -e output, the exception
&gt; is simply shown as a comment, no error code is set or error raised. I&apos;d
&gt; suggest we therefore just mark this bug as WONTFIX unless there is some
&gt; bigger issue I&apos;m not seeing?

Sounds reasonable, I happened to see this error when I ran &quot;bb show&quot; which is similar to &quot;bitbake -e&quot;, I will mark this bug as WONTFIX and try to fix it from &quot;bb&quot;.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>