<?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>15909</bug_id>
          
          <creation_ts>2025-06-18 04:36:25 +0000</creation_ts>
          <short_desc>crate://crates.io is not a valid download_location for SPDX 2.2</short_desc>
          <delta_ts>2025-11-06 06:08: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>oe-core other</component>
          <version>5.0.15</version>
          <rep_platform>All</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.3 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Billie Alsup">balsup</reporter>
          <assigned_to name="Jayasurya Maganuru">Maganuru.Jayasurya</assigned_to>
          <cc>ccasciato</cc>
    
    <cc>JPEWhacker</cc>
    
    <cc>Maganuru.Jayasurya</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>sundeep.kokkonda</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>102283</commentid>
    <comment_count>0</comment_count>
    <who name="Billie Alsup">balsup</who>
    <bug_when>2025-06-18 04:36:25 +0000</bug_when>
    <thetext>After moving from dunfell to scarthgap, I am seeing validation errors in the generated SPDX files, e.g.

[sbom] package download_location must be a valid URL or download location according to the specification, but is: crate://crates.io/windows_i686_gnu/0.52.3
[sbom] package download_location must be a valid URL or download location according to the specification, but is: crate://crates.io/windows_aarch64_msvc/0.52.3
[sbom] package download_location must be a valid URL or download location according to the specification, but is: crate://crates.io/windows_aarch64_gnullvm/0.52.3

I am also finding that SPDX generation behavior has changed between dunfell and scarthgap, with SPDX files not being generated where expected.  This seems related to certain tasks not being built if they are only runtime dependencies (possibly related to https://git.openembedded.org/openembedded-core/commit/?id=220d29a5abb5be8b80c64d8f2f48949bc8c534a3 ).  A workaround seems to be explicitly adding 

--runall create_runtime_spdx --runall create_spdx

to the bitbake command (similar to the workaround suggested in the given url to use --runall build)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102284</commentid>
    <comment_count>1</comment_count>
    <who name="Billie Alsup">balsup</who>
    <bug_when>2025-06-18 04:37:41 +0000</bug_when>
    <thetext>I presume create-spdx class should massage the url similar to how the fetcher does it, e.g.

        if host == &apos;crates.io&apos;:
            host = &apos;crates.io/api/v1/crates&apos;

        ud.url = &quot;https://%s/%s/%s/download&quot; % (host, name, version)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102288</commentid>
    <comment_count>2</comment_count>
    <who name="Billie Alsup">balsup</who>
    <bug_when>2025-06-18 15:36:25 +0000</bug_when>
    <thetext>Should the fetcher itself support a function to translate a given (fetcher) URL into a list of download locations?  This problem first presented itself with gitsm, and there is a translation in fetch_data_to_uri (although it seems to simply ignore the submodules).  There are bound to be fetchers in the future that do their own thing, so supporting an optional fetcher method to return a list of download locations (or perhaps mappings between download locations and sets of downloaded files) would seem to make sense, rather than putting exceptions into spdx_common.py.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102303</commentid>
    <comment_count>3</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2025-06-19 14:40:46 +0000</bug_when>
    <thetext>Internally spdx has mappings of varioius URLS.
Rust wasn&apos;t in dunfell so it&apos;s likely that there&apos;s just a missing mapping for crates.io.

So yes, we should have a translation function as Billie suggested.
Can you do that Billie ?

-- YP bug triage</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102329</commentid>
    <comment_count>4</comment_count>
      <attachid>5124</attachid>
    <who name="Billie Alsup">balsup</who>
    <bug_when>2025-06-23 15:52:59 +0000</bug_when>
    <thetext>Created attachment 5124
Workaround for crate fetcher URLs being invalid SPDX URLs</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102330</commentid>
    <comment_count>5</comment_count>
    <who name="Billie Alsup">balsup</who>
    <bug_when>2025-06-23 15:55:18 +0000</bug_when>
    <thetext>Let me get the required approvals here, and then I&apos;ll take a look at a long term solution.  In the meantime, I&apos;ve attached our scarthgap workaround.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102352</commentid>
    <comment_count>6</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2025-06-26 17:53:32 +0000</bug_when>
    <thetext>Hi Billie,

Thanks for the patch / workaround. 
It might help someone who happens to read this defect.

I&apos;ll move this bug to accepted and hopefully it won&apos;t take too long for you to get local approval to contribute to Yocto so the patch can be merged to master and then back-ported as needed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102546</commentid>
    <comment_count>7</comment_count>
    <who name="Billie Alsup">balsup</who>
    <bug_when>2025-08-05 15:21:31 +0000</bug_when>
    <thetext>I am still in the waiting for business approval state (which is unlikely to come until I finish some internal projects).  The given workaround was sufficient for us to proceed, and deprioritized work to have a generic solution going forward.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102610</commentid>
    <comment_count>8</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2025-08-14 16:24:23 +0000</bug_when>
    <thetext>Joshua, 
Should Sundeep have someone submit the work-around or is there a better approach?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102798</commentid>
    <comment_count>9</comment_count>
    <who name="Joshua Watt">JPEWhacker</who>
    <bug_when>2025-09-18 15:04:45 +0000</bug_when>
    <thetext>Yes, the munging of the URI is correct for crates, but please do it in the fetch_data_to_uri function in spdx_common.py. Ideally, the actual URI comes from the fetcher and we just need to know to use that for crates (or others)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102829</commentid>
    <comment_count>10</comment_count>
    <who name="Joshua Watt">JPEWhacker</who>
    <bug_when>2025-09-25 15:07:07 +0000</bug_when>
    <thetext>See above comment</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102928</commentid>
    <comment_count>11</comment_count>
    <who name="Jayasurya Maganuru">Maganuru.Jayasurya</who>
    <bug_when>2025-10-14 13:00:58 +0000</bug_when>
    <thetext>(In reply to Joshua Watt from comment #10)
&gt; See above comment

Hi Joshua, 

I&apos;ve made the equivalent changes of the workaround, to fetch_data_to_uri function of spdx_common.py and manually verified the generated spdx.json (for the recipe python3-bcrypt).

The software_downloadLocation is now correctly set to a valid URL, e.g.:
&quot;software_downloadLocation&quot;: &quot;https://crates.io/api/v1/crates/windows_i686_gnu/0.48.5/download&quot;
instead of the invalid crate://crates.io/... format previously used for Rust crates.

Should I be validating the spdx.json output using any specific tool before sending a patch to poky master? Or is this manual check sufficient to move forward?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103191</commentid>
    <comment_count>12</comment_count>
    <who name="Sundeep Kokkonda">sundeep.kokkonda</who>
    <bug_when>2025-11-06 06:08:07 +0000</bug_when>
    <thetext>Patch merged - https://git.openembedded.org/openembedded-core/commit/?id=7cadbd1a22e18847d03b5baa902f5581d3e0aafa</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>5124</attachid>
            <date>2025-06-23 15:52:59 +0000</date>
            <delta_ts>2025-06-23 15:52:59 +0000</delta_ts>
            <desc>Workaround for crate fetcher URLs being invalid SPDX URLs</desc>
            <filename>file_15909.txt</filename>
            <type>text/plain</type>
            <size>1128</size>
            <attacher name="Billie Alsup">balsup</attacher>
            
              <data encoding="base64">Y29tbWl0IDBhODZ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gdmFsaWQgVVJMLiAgVXNlIHVybCBmaWVsZCBpbnN0ZWFkIGlmIGV4aXN0DQorICAgICAg
ICAgICAgaWYgZi50eXBlID09ICJjcmF0ZSIgYW5kICd1cmwnIGluIGRpcihmKToNCisgICAgICAg
ICAgICAgICAgdXJpID0gZi51cmwNCisNCiAgICAgICAgICAgICBpZiBmLm1ldGhvZC5zdXBwb3J0
c19jaGVja3N1bShmKToNCiAgICAgICAgICAgICAgICAgZm9yIGNoZWNrc3VtX2lkIGluIENIRUNL
U1VNX0xJU1Q6DQogICAgICAgICAgICAgICAgICAgICBpZiBjaGVja3N1bV9pZC51cHBlcigpIG5v
dCBpbiBvZS5zcGR4LlNQRFhQYWNrYWdlLkFMTE9XRURfQ0hFQ0tTVU1TOg0K
</data>

          </attachment>
      

    </bug>

</bugzilla>