<?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>7128</bug_id>
          
          <creation_ts>2015-01-09 08:35:05 +0000</creation_ts>
          <short_desc>net-tools do_patch failure after enabling multilib in an old build directory</short_desc>
          <delta_ts>2015-02-02 15:50:47 +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>OE-Core</product>
          <component>core</component>
          <version>1.8</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.8</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Chen Qi">Qi.Chen</reporter>
          <assigned_to name="Saul Wold">sgw</assigned_to>
          <cc>bluelightning</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>richard.purdie</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>47819</commentid>
    <comment_count>0</comment_count>
    <who name="Chen Qi">Qi.Chen</who>
    <bug_when>2015-01-09 08:35:05 +0000</bug_when>
    <thetext>Steps to reproduce the bug:
===========================
1. bitbake net-tools
2. add in local.conf:
   require conf/multilib.conf
   MULTILIBS = &quot;multilib:lib32&quot;
   DEFAULTTUNE_virtclass-multilib-lib32 = &quot;x86&quot;
3. bitbake net-tools

Error message:
===============
| Patch /buildarea2/chenqi/poky/build-systemd/tmp/work/core2-64-poky-linux/net-tools/1.60-25-r0/net-tools-1.60/debian/patches/fix-fprintf.patch is already applied; check your series file
| WARNING: exit code 1 from a shell command.
| DEBUG: Python function do_patch finished
| ERROR: Function failed: nettools_do_patch (log file is located at /buildarea2/chenqi/poky/build-systemd/tmp/work/core2-64-poky-linux/net-tools/1.60-25-r0/temp/log.do_patch.4014)
ERROR: Task 1 (/buildarea2/chenqi/poky/meta/recipes-extended/net-tools/net-tools_1.60-25.bb, do_patch) failed with exit code &apos;1&apos;

Simple analysis
===============
The error is caused by re-execution of do_patch task.
The re-execution of do_patch task due to the fact the the do_patch task of net-tools is customized as follows.

nettools_do_patch() {
        cd ${S}
        quilt pop -a || true
        if [ -d ${S}/.pc-nettools ]; then
                mv ${S}/.pc-nettools ${S}/.pc
                QUILT_PATCHES=${S}/debian/patches quilt pop -a
                rm -rf ${S}/.pc ${S}/debian
        fi
        patch -p1 &lt; ${WORKDIR}/${BPN}_${PV}.diff
        QUILT_PATCHES=${S}/debian/patches quilt push -a
        mv ${S}/.pc ${S}/.pc-nettools
}

do_unpack[cleandirs] += &quot;${S}&quot;

# We invoke base do_patch at end, to incorporate any local patch                                                                                                                                                 
python do_patch() {
    bb.build.exec_func(&apos;nettools_do_patch&apos;, d)
    bb.build.exec_func(&apos;patch_do_patch&apos;, d)
}

As the nettools_do_patch is a shell function, it by defaults depends on all environment variable in bitbake build environment, including variables that do not affect the do_patch task like TUNE_ARCH.

Workaround
===========
bitbake nettools -c clean

Other information
=================
Normally, do_patch task should not re-executed in the above use case.
Only recipes that defines its own do_patch task which includes a customized shell function would re-execute the do_patch task.

//Chen Qi</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48450</commentid>
    <comment_count>1</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2015-01-30 18:24:56 +0000</bug_when>
    <thetext>Is this fixed by Richard&apos;s recent patch?

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=2b899a472a850c52f3f5228868d58cf2e6fac621</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>48492</commentid>
    <comment_count>2</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2015-02-02 15:50:47 +0000</bug_when>
    <thetext>Paul is correct this above patch fixes this issue</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>