<?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>15162</bug_id>
          
          <creation_ts>2023-07-15 14:46:06 +0000</creation_ts>
          <short_desc>devtool build does not cope with multiple SRC_URI in a recipe</short_desc>
          <delta_ts>2024-08-08 14:59:07 +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>devtools / tool chain</component>
          <version>unspecified</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>5.1 M2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>worryelectric</reporter>
          <assigned_to name="Julien Stephan">jstephan</assigned_to>
          <cc>chris.laplante</cc>
    
    <cc>jstephan</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>tgamblin</cc>
    
    <cc>tom.isaacson</cc>
          
          
          <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>95924</commentid>
    <comment_count>0</comment_count>
    <who name="">worryelectric</who>
    <bug_when>2023-07-15 14:46:06 +0000</bug_when>
    <thetext>For a recipe with multiple SRC_URI devtool doesn&apos;t collect all of the required sources correctly.

Take for example bzip2 recipe which has the following:

SRC_URI = &quot;https://sourceware.org/pub/${BPN}/${BPN}-${PV}.tar.gz \
           git://sourceware.org/git/bzip2-tests.git;name=bzip2-tests;branch=master \
           file://configure.ac;subdir=${BP} \
           file://Makefile.am;subdir=${BP} \
           file://run-ptest \
           &quot;

On running `devtool modify bzip2`, the do_fetch, do_unpack, and do_patch tasks will be run into the devtool tmpdir. The temporary result of that is that the following files exist in tmp/work/cortexa53-poky-linux/bzip2/1.0.8-r0/devtooltmp-xxxxxxxx:

initial_rev
oe-local-files
srcsubdir
stamps
temp
workdir
|-bzip2-1.0.8
|-git
|-recipe-sysroot
|-recipe-sysroot-native
|-source-date-epoch

The contents of srcsubdir is the absolute path to tmp/work/cortexa53-poky-linux/bzip2/1.0.8-r0/devtooltmp-8idreg9n/workdir/bzip2-1.0.8. Therefore it is the bzip2-1.0.8 directory that is copied to the workspace layer, and the git directory is missed.

This results in `devtool build bzip2` failing at the do_install_ptest_base task when it expects files from the git directory to be present.

Is this a known limitation in devtool?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>95992</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-07-20 14:34:59 +0000</bug_when>
    <thetext>It is a bug, the tool should either handle the case or warn the user that they need to handle the recipe manually.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96578</commentid>
    <comment_count>2</comment_count>
    <who name="Julien Stephan">jstephan</who>
    <bug_when>2023-09-27 16:54:03 +0000</bug_when>
    <thetext>Hi worryelectric and Randy,

I just send a fix for this https://lists.openembedded.org/g/openembedded-core/message/188335 can you check it? 

Julien</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96581</commentid>
    <comment_count>3</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-09-28 14:36:32 +0000</bug_when>
    <thetext>Thanks Julien.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96747</commentid>
    <comment_count>4</comment_count>
    <who name="Chris Laplante">chris.laplante</who>
    <bug_when>2023-10-19 15:25:28 +0000</bug_when>
    <thetext>(In reply to Julien Stephan from comment #2)
&gt; Hi worryelectric and Randy,
&gt; 
&gt; I just send a fix for this
&gt; https://lists.openembedded.org/g/openembedded-core/message/188335 can you
&gt; check it? 
&gt; 
&gt; Julien

This patch seems a bit too invasive. It just moves everything in WORKDIR (except for source-date-epoch, recipe-sysroot, recipe-sysroot-native) but I think we need a more surgical approach that actually considers whether things are part of SRC_URI. I am going to try to take a look.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96749</commentid>
    <comment_count>5</comment_count>
    <who name="Julien Stephan">jstephan</who>
    <bug_when>2023-10-19 21:21:57 +0000</bug_when>
    <thetext>Hi Chris,

agree with you, and as explained in this thread, this workaround is clearly not suitable as a fix: https://lists.openembedded.org/g/openembedded-core/message/188765

I didn&apos;t have time to look at it more deeply.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97789</commentid>
    <comment_count>6</comment_count>
    <who name="Julien Stephan">jstephan</who>
    <bug_when>2024-01-15 14:15:10 +0000</bug_when>
    <thetext>Hi All,

I&apos;ve been thinking about this bug and how to reliably fix it and I would like to discuss it.

The fix I sent (https://lists.openembedded.org/g/openembedded-core/message/188335) can be partially improved by using a devtool unpack tracer (see https://bugzilla.yoctoproject.org/show_bug.cgi?id=15294) but the main issue is: where secondary sources extracted in WORKDIR should be placed in devtool context? I can think of three possible solutions: 
 1: move them in WORKDIR (as my previous fix does it but get the correct list from the unpack tracer)
 2: create a devtool specific workdir to put them. The specific workdir can be placed in build/workspace/workdir/&lt;PN&gt; (near sources/appends/recipes/).
 3: modify bitbake itself to extract all SRC_URI&apos;s element in a subdir of WORKDIR (let&apos;s call it &quot;sources&quot;)

But each solution has its drawback:
 1: we will end up with sources in 2 different places: main source and sources extracted in S in an isolated place and other sources in WORKDIR (which is not isolated and can be wiped out). Moreover, devtool can not be used to create patches for secondary sources. And we need to decide the strategy to copy secondary sources i.e what about if the package was already built and we do a devtool modify on it: should we erase old files? copy only if file doesn&apos;t exists? 

 2: it fits well with devtool idea to have sources in an isolated place.
This can be easily implemented by setting WORKDIR in externalsrc.bbclass, BUT we will have B, T, D .. in build/workspace/workdir/&lt;PN&gt;, which may not be something we want.. 

 3: it would be much easier for devtool to handle all sources at once BUT that would require a LOT of changes in all recipes that expect sources to be extracted in WORKDIR. We will require a way to not allow recipes to extract sources in WORKDIR in the future, probably modify a lot of selftest, and this will impact a lot of external layers.. 

Also we need to take into consideration that devtool should (or not?) be able to produce patches for secondary sources... 

Maybe I am missing another strategy?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97801</commentid>
    <comment_count>7</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2024-01-16 15:48:02 +0000</bug_when>
    <thetext>Ultimately we may well end up moving to 3). I have tried something like it and it was extremely painful and requires changes in many places. As such it probably isn&apos;t an option right now.

I was thinking of something along the lines of your original patch but using the tracer to remove the need to make assumptions about files.

I think the idea here is to incrementally improve on things and that would seem in keeping with that...

Quite often the solution becomes clearer when you actually try and implement it, I wouldn&apos;t push really hard on something which appears to be becoming very hard to implement.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97952</commentid>
    <comment_count>8</comment_count>
    <who name="Julien Stephan">jstephan</who>
    <bug_when>2024-01-23 14:10:06 +0000</bug_when>
    <thetext>Hi Richard, all,

I tried to implement the unpack tracer mechanism, but found a more easiest fix for this bug. 
I sent a new version of the series here: https://lists.openembedded.org/g/openembedded-core/message/194237. 

Let me know if that works for you as a fix. 

Cheers
Julien</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99520</commentid>
    <comment_count>9</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-08-08 14:59:07 +0000</bug_when>
    <thetext>poky commit facab170b60e521d69262e62f7d60ceb064ff3a2</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>