<?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>8378</bug_id>
          
          <creation_ts>2015-09-22 21:56:19 +0000</creation_ts>
          <short_desc>archiver class is broken for gcc packages when using patched sources</short_desc>
          <delta_ts>2016-01-06 14:40:42 +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>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</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>2.1 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Alejandro Hernandez">alejandro.hernandez</reporter>
          <assigned_to name="Alejandro Hernandez">alejandro.hernandez</assigned_to>
          <cc>benjamin.esquivel</cc>
    
    <cc>bogdanx.a.voiculescu</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
          
          <qa_contact name="Bogdan Alexandru Voiculescu">bogdanx.a.voiculescu</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>54496</commentid>
    <comment_count>0</comment_count>
    <who name="Alejandro Hernandez">alejandro.hernandez</who>
    <bug_when>2015-09-22 21:56:19 +0000</bug_when>
    <thetext>The archiver class is used to obtain the sources used to build the distribution, it has different options; see http://www.yoctoproject.org/docs/1.8/mega-manual/mega-manual.html#maintaining-open-source-license-compliance-during-your-products-lifecycle for more info.

When using:
ARCHIVER_MODE[src] = &quot;patched&quot;

to obtain the patched sources, we obtain an error like the following:

ERROR: Command Error: exit status: 1  Output:
Applying patch 0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch
patching file configure
Reversed (or previously applied) patch detected!  Assume -R? [n] 
Apply anyway? [n] 
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file configure.rej
Patch 0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch appears to be empty; applied
ERROR: Function failed: patch_do_patch

This simply states that bitbake tried to apply a patch, but that patch had already been applied so it skips it (which is good), but this still causes the task to fail, hence the build fails too.

This is caused because gcc packages use a shared directory for performance and space efficiency (http://www.yoctoproject.org/docs/1.8/mega-manual/mega-manual.html#structure-build-work-shared), now, since several packages use the same source, the first task to patch the source will patch it correctly and succeed, but the second one will find an already patched source and produce the error mentioned above.

I believe gcc packages were initially not supported by the archiver class for this same reason, it appears to me that using shared states to check whether or not the patches have already been applied is not an option (although I don&apos;t know much about SSTATES), since these refer to different tasks for different packages, another option would be to create a specific case to handle gcc packages, perhaps somehow check if the source is already patched and simply return, or do not support gcc packages on the archiver class at all.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54795</commentid>
    <comment_count>1</comment_count>
    <who name="Alejandro Hernandez">alejandro.hernandez</who>
    <bug_when>2015-09-29 17:42:25 +0000</bug_when>
    <thetext>Solved here:
http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=99fc78653a6933e24e57aed9df246b3fda529ca8</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54848</commentid>
    <comment_count>2</comment_count>
    <who name="Alejandro Hernandez">alejandro.hernandez</who>
    <bug_when>2015-09-30 20:44:36 +0000</bug_when>
    <thetext>My mistake, this wasn&apos;t fixed completely, working on it</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>55042</commentid>
    <comment_count>3</comment_count>
    <who name="Alejandro Hernandez">alejandro.hernandez</who>
    <bug_when>2015-10-07 19:43:41 +0000</bug_when>
    <thetext>This started causing errors with the kernel too, a race condition was created when using patched sources between kernel_configme and unpack_and_patch, producing errors during kernel configuration.

Also, as Richard Purdie noted, we don&apos;t need to have multiple identical gcc source tarballs.

I sent a patch to the ML fixing both these new issues along with the original one.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56944</commentid>
    <comment_count>4</comment_count>
    <who name="Alejandro Hernandez">alejandro.hernandez</who>
    <bug_when>2015-12-02 15:03:37 +0000</bug_when>
    <thetext>Fixed:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=2f0ff3abb448dc23d9420986fcbab80c9da7cd25</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57584</commentid>
    <comment_count>5</comment_count>
    <who name="Bogdan Alexandru Voiculescu">bogdanx.a.voiculescu</who>
    <bug_when>2016-01-06 14:40:42 +0000</bug_when>
    <thetext>Verified on master 2cd061a29a94fdcdfec86732e6bcbb71c12c4afc</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>