<?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>13798</bug_id>
          
          <creation_ts>2020-02-19 11:57:09 +0000</creation_ts>
          <short_desc>Exception: UnboundLocalError: local variable &apos;svnfetchcmd&apos; referenced before assignment when fetch from svn</short_desc>
          <delta_ts>2020-02-20 15:29:45 +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>3.0</version>
          <rep_platform>Other</rep_platform>
          <op_sys>arm</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Undecided</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Georgi">georgi.georgiev</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>86478</commentid>
    <comment_count>0</comment_count>
    <who name="Georgi">georgi.georgiev</who>
    <bug_when>2020-02-19 11:57:09 +0000</bug_when>
    <thetext>When doing incremental builds on our build server always we observe the following:
ERROR: ww-pacman-121204-r0 do_fetch: Error executing a python function in exec_python_func() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: &apos;exec_python_func() autogenerated&apos;, lineno: 2, function: &lt;module&gt;
     0001:
 *** 0002:base_do_fetch(d)
     0003:
File: &apos;/data/home/w23698/projects/proj/build/../sources/poky/meta/classes/base.bbclass&apos;, lineno: 163, function: base_do_fetch
     0159:        return
     0160:
     0161:    try:
     0162:        fetcher = bb.fetch2.Fetch(src_uri, d)
 *** 0163:        fetcher.download()
     0164:    except bb.fetch2.BBFetchException as e:
     0165:        bb.fatal(str(e))
     0166:}
     0167:
File: &apos;/data/home/w23698/projects/proj/sources/poky/bitbake/lib/bb/fetch2/__init__.py&apos;, lineno: 1678, function: download
     1674:                    try:
     1675:                        if not trusted_network(self.d, ud.url):
     1676:                            raise UntrustedUrl(ud.url)
     1677:                        logger.debug(1, &quot;Trying Upstream&quot;)
 *** 1678:                        m.download(ud, self.d)
     1679:                        if hasattr(m, &quot;build_mirror_data&quot;):
     1680:                            m.build_mirror_data(ud, self.d)
     1681:                        localpath = ud.localpath
     1682:                        # early checksum verify, so that if checksum mismatched,
File: &apos;/data/home/w23698/projects/proj/sources/poky/bitbake/lib/bb/fetch2/svn.py&apos;, lineno: 150, function: download
     0146:            if not (&quot;externals&quot; in ud.parm and ud.parm[&quot;externals&quot;] == &quot;nowarn&quot;):
     0147:                # Warn the user if this had externals (won&apos;t catch them all)
     0148:                output = runfetchcmd(&quot;svn propget svn:externals || true&quot;, d, workdir=ud.moddir)
     0149:                if output:
 *** 0150:                    if &quot;--ignore-externals&quot; in svnfetchcmd.split():
     0151:                        bb.warn(&quot;%s contains svn:externals.&quot; % ud.url)
     0152:                        bb.warn(&quot;These should be added to the recipe SRC_URI as necessary.&quot;)
     0153:                        bb.warn(&quot;svn fetch has ignored externals:\n%s&quot; % output)
     0154:                        bb.warn(&quot;To disable this warning add &apos;;externals=nowarn&apos; to the url.&quot;)
Exception: UnboundLocalError: local variable &apos;svnfetchcmd&apos; referenced before assignment

This puts a serious obstacle to automate our builds and make CI in the future.
I made a change which works. I am aware that it is possible this not to be the proper solution:
--- a/bitbake/lib/bb/fetch2/svn.py
+++ b/bitbake/lib/bb/fetch2/svn.py
@@ -145,6 +145,7 @@ class Svn(FetchMethod):

             if not (&quot;externals&quot; in ud.parm and ud.parm[&quot;externals&quot;] == &quot;nowarn&quot;):
                 # Warn the user if this had externals (won&apos;t catch them all)
+                svnfetchcmd = self._buildsvncommand(ud, d, &quot;fetch&quot;)
                 output = runfetchcmd(&quot;svn propget svn:externals || true&quot;, d, workdir=ud.moddir)
                 if output:
                     if &quot;--ignore-externals&quot; in svnfetchcmd.split():
Greetings,
Georgi</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86486</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2020-02-19 18:44:54 +0000</bug_when>
    <thetext>I&apos;ve put a patch to test in master-next</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86512</commentid>
    <comment_count>2</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2020-02-20 12:06:07 +0000</bug_when>
    <thetext>http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=9b312bca47e22cc3a93df356dcae73a8ee4a6787</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86521</commentid>
    <comment_count>3</comment_count>
    <who name="Georgi">georgi.georgiev</who>
    <bug_when>2020-02-20 15:29:45 +0000</bug_when>
    <thetext>Thanks Richard,
It works on our side too. What is the process? Should I close this or you handle this?

Cheers
Georgi</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>