<?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>15326</bug_id>
          
          <creation_ts>2023-12-15 13:15:09 +0000</creation_ts>
          <short_desc>Resolving RPROVIDER for dynamic kernel modules always match the kernel recipe</short_desc>
          <delta_ts>2024-08-06 14:23:27 +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>RESOLVED</bug_status>
          <resolution>NOTABUG</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Future</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ola Nilsson">ola.x.nilsson</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>randy.macleod</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>97577</commentid>
    <comment_count>0</comment_count>
    <who name="Ola Nilsson">ola.x.nilsson</who>
    <bug_when>2023-12-15 13:15:09 +0000</bug_when>
    <thetext>When two (or more) recipes provide regexps in PACKAGES_DYNAMIC that match a package mentioned in RDEPENDS or PACKAGE_INSTALL, bitbake chooses one of them as the potential RPROVIDER of that package.  The selection is based on things like PREFERRED_PROVIDER.  

This is problematic for external kernel modules.  The kernel recipe provides a regex ${KERNEL_PACKAGE_NAME}-module-.* that will match ANY kernel module provided by external module recipes.  And since the kernel recipe is likely to be a PREFERRED_PROVIDER, it is likely that the kernel will be chosen as RPROVIDER over the external module even if the external modules dynamic package regex matches more of the package name. 

It&apos;s probably hard to find a method that always picks the correct RPROVIDER, maybe all potential RPROVIDERS should be added to the build graph?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97633</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-12-21 15:39:08 +0000</bug_when>
    <thetext>This is a valid problem but it&apos;s not clear how to fix it.
Adding *all* potential RPROVIDERs would not be the place to start.
- Richard Purdie &amp;&amp; YP bug review team</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97635</commentid>
    <comment_count>2</comment_count>
    <who name="Joshua Watt">JPEWhacker</who>
    <bug_when>2023-12-21 15:42:25 +0000</bug_when>
    <thetext>PACKAGES_DYNAMIC matching in two recipes is not really supported by bitbake, and it would be really hard to make it figure out how to correctly resolve that without some really hard and expensive logic.

The recommended fix is not to use PACKAGES_DYANMIC in your external modules recipe; in most cases this isn&apos;t necessary anyway since you should know which modules the recipe is building and can explicitly list them out instead of relying on the regex matching.

PACKAGES_DYNAMIC is really only intended for the case where it&apos;s impossible to know what packages a recipe will produce beforehand, as is the case with the kernel as the modules will depend on the kernel config. If you can at all possibly know what packages your recipe produces, you should explicitly list them instead of using PACKAGES_DYNAMIC.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97701</commentid>
    <comment_count>3</comment_count>
    <who name="Ola Nilsson">ola.x.nilsson</who>
    <bug_when>2023-12-22 07:39:25 +0000</bug_when>
    <thetext>You&apos;re right, in most cases you probably do know which packages are provided even if dynamic splitting is used.

I&apos;m sure it&apos;s possible to come up with a scenario where you don&apos;t know until the build has been configured which packages will be provided, but at least you will get some kind of indication when the recipe fails to provide a package someone else RDEPENDS on.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97702</commentid>
    <comment_count>4</comment_count>
    <who name="Ola Nilsson">ola.x.nilsson</who>
    <bug_when>2023-12-22 08:42:35 +0000</bug_when>
    <thetext>For posterity; you should add the (potential) names of any dynamic packages to PACKAGES. Prepend or append according to the do_split_packages&apos; prepend argument used.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99501</commentid>
    <comment_count>5</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2024-08-06 14:23:27 +0000</bug_when>
    <thetext>Resolving this as we have an agree solution which sounds like the right thing to do to me.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>