<?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>5427</bug_id>
          
          <creation_ts>2013-10-30 17:38:04 +0000</creation_ts>
          <short_desc>Extend and tidy up layer sanity checking</short_desc>
          <delta_ts>2017-02-06 22:59:06 +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.6</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>10596</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>2.3 M3</target_milestone>
          
          <blocked>10596</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Paul Eggleton">bluelightning</reporter>
          <assigned_to name="Aníbal Limón">anibal.limon</assigned_to>
          <cc>chong.lu</cc>
    
    <cc>kergoth</cc>
    
    <cc>liezhi.yang</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>Qi.Chen</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>sgw</cc>
    
    <cc>srifenbark</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Yes (doc changes required)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>38319</commentid>
    <comment_count>0</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2013-10-30 17:38:04 +0000</bug_when>
    <thetext>Provide a script or inheritable class that will check if a layer is doing things it shouldn&apos;t; these would be more stringent checks than we could enable by default in sanity.bbclass/insane.bbclass. Suggested checks:

* Check that a BSP layer isn&apos;t making any changes when the layer is included but MACHINE is not set to point to one of the conf/machine/*.conf that the layer provides
* Similarly for DISTRO?
* Check that conf/distro and conf/machine don&apos;t appear in the same layer
* Check for ${PN} or ${P} usage in SRC_URI or S (should use ${BPN} or ${BP} instead to avoid breaking multilib)
* Check that BSP/distro layers don&apos;t provide their own linux-libc-headers
* Check that distro variables such as DISTRO_FEATURES are not being set in machine conf files
* Check that all patches have Signed-off-by and Upstream-Status ?

We do have recipe_sanity.bbclass and oelint.bbclass - these should be tidied up in the process.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44123</commentid>
    <comment_count>1</comment_count>
    <who name="Chong Lu">chong.lu</who>
    <bug_when>2014-06-20 09:30:41 +0000</bug_when>
    <thetext>Hi Paul,

I will fix oelint.bbclass and make it work.
And I will remove three checks there are LICENSE, MAINTAINER and PRIORITY.
LICENSE check is included in license.bbclass.
MAINTAINER and PRIORITY checks are unneeded.
I add two checks in this oelint.bbclass:

* Check for ${PN} or ${P} usage in SRC_URI or S (should use ${BPN} or ${BP} instead to avoid breaking multilib)
* Check that all patches have Signed-off-by and Upstream-Status


I don&apos;t understand what do you mean about three checks. Can you describe in details?

* Check that a BSP layer isn&apos;t making any changes when the layer is included but MACHINE is not set to point to one of the conf/machine/*.conf that the layer provides
* Similarly for DISTRO?
* Check that conf/distro and conf/machine don&apos;t appear in the same layer

Best Regards
Chong</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>47461</commentid>
    <comment_count>2</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2014-12-09 14:30:03 +0000</bug_when>
    <thetext>So to update the status of this bug, some of the changes have now been made:

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=7c85585bf6d436ee874e63cf375d4262ebe204a9
http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=207e94d4e1ffb7cae5310c16efc6224a7f0ce056
http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=268688a489add5ac3f378cf69d39f6c8c769549a

Chong and I have discussed the outstanding checks via email, here is an excerpt of one of my earlier messages answering the questions above:

----------- snip -----------

&gt; * Check that a BSP layer isn&apos;t making any changes when the layer is
&gt; included but MACHINE is not set to point to one of the
&gt; conf/machine/*.conf that the layer provides

If a layer providing a machine is included but the machine is not selected in
MACHINE, there should be no changes to the configuration of the system; i.e.
any bbappends should have:

VARIABLENAME_machine = &quot;value&quot;

not:

VARIABLENAME = &quot;value&quot;

How you check this is a good question. You could examine it at a file level,
but it might be better to look through the available recipes and check the
variable history to see if anything within the layer is making a change to the
values. Here is an example of using tinfoil to look at variable values per
recipe:

  https://gist.github.com/bluelightning/6138980

You&apos;d need to look elsewhere for examples on how to look at the variable
history, perhaps in the layer index:

http://git.yoctoproject.org/cgit/cgit.cgi/layerindex-web/tree/layerindex/recipeparse.py

&gt; * Similarly for DISTRO?

Same thing as above but for distro layers.

&gt; * Check that conf/distro and conf/machine don&apos;t appear in the same layer

A layer shouldn&apos;t be providing both a distro and a machine, those should be in
separate layers.

&gt; * Check that BSP/distro layers don&apos;t provide their own linux-libc-headers

Probably the check here would be to look for a recipe that has 
linux-libc-headers in its PROVIDES.

----------- snip -----------</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>51428</commentid>
    <comment_count>3</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2015-06-02 15:39:42 +0000</bug_when>
    <thetext>Note about the docs - Not quite implemented but the likelihood is it&apos;ll be an additional class and then we would add something to the section where we talk about creating layers on how to validate them using this functionality - From Paul

Scott</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54688</commentid>
    <comment_count>4</comment_count>
    <who name="Christopher Larson">kergoth</who>
    <bug_when>2015-09-25 17:17:12 +0000</bug_when>
    <thetext>There&apos;ve been a couple of creations of standalone scripts to check the machine / distro aspect of this, though I&apos;m not sure if a standalone script is the ideal method or not.

I can&apos;t seem to find a link to the one I didn&apos;t write, but I had a simple one at https://github.com/kergoth/oe-test-scripts, see &apos;leaky-layer-tests&apos; -- it just gathers a list of the appends from a layer, does a -S none on those with the layer not included, then does a -S printdiff on each (with empty SSTATE_DIR, to ensure it uses the sigdata in STAMPS_DIR) with the layer included. Previously, it did a bitbake-whatchanged. I only mention this for reference or possible inspiration, I doubt it&apos;d be worth including as is.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54693</commentid>
    <comment_count>5</comment_count>
    <who name="Christopher Larson">kergoth</who>
    <bug_when>2015-09-25 17:49:56 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; There&apos;ve been a couple of creations of standalone scripts to check the
&gt; machine / distro aspect of this, though I&apos;m not sure if a standalone script
&gt; is the ideal method or not.
&gt; 
&gt; I can&apos;t seem to find a link to the one I didn&apos;t write, but I had a simple
&gt; one at https://github.com/kergoth/oe-test-scripts, see &apos;leaky-layer-tests&apos;
&gt; -- it just gathers a list of the appends from a layer, does a -S none on
&gt; those with the layer not included, then does a -S printdiff on each (with
&gt; empty SSTATE_DIR, to ensure it uses the sigdata in STAMPS_DIR) with the
&gt; layer included. Previously, it did a bitbake-whatchanged. I only mention
&gt; this for reference or possible inspiration, I doubt it&apos;d be worth including
&gt; as is.

Found it. For reference, Chong Lu submitted a &apos;check-layers.py&apos; script to do some of this, I had some concerns with it. Also Chen Qi submitted layer_extra_sanity.bbclass as a version which wasn&apos;t as separate script, which I think probably wasn&apos;t ideal, but is worth mentioning for reference and posterity in this issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54699</commentid>
    <comment_count>6</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2015-09-25 20:04:07 +0000</bug_when>
    <thetext>For the documentation component of this bug, is it sufficient to document the layer_extra_sanity.bbclass in the reference manual?

Scott</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54700</commentid>
    <comment_count>7</comment_count>
    <who name="Christopher Larson">kergoth</who>
    <bug_when>2015-09-25 20:39:31 +0000</bug_when>
    <thetext>(In reply to comment #6)
&gt; For the documentation component of this bug, is it sufficient to document
&gt; the layer_extra_sanity.bbclass in the reference manual?

I don&apos;t think any of those mechanisms (the checks of the BSP and DISTRO layers) have been merged, so it wouldn&apos;t be appropriate to document them, but once an official mechanism makes it into oe-core, yes, we should definitely document how to use it. I wouldn&apos;t know which document would be most appropriate, I expect that depends on the final implementation selected, I only mentioned thme here for reference.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54701</commentid>
    <comment_count>8</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2015-09-25 20:45:33 +0000</bug_when>
    <thetext>Christopher, 

Thanks for the clarification and the heads up.  I will monitor.

Scott</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70380</commentid>
    <comment_count>9</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2017-02-02 16:21:11 +0000</bug_when>
    <thetext>Anibal: I think this is related to another bug you&apos;re now working on. Could you look through this one and see if there are useful pieces to combine into that work, then make this one depend on that one and/or close it as appropriate please?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70387</commentid>
    <comment_count>10</comment_count>
    <who name="Aníbal Limón">anibal.limon</who>
    <bug_when>2017-02-02 16:32:43 +0000</bug_when>
    <thetext>(In reply to comment #9)
&gt; Anibal: I think this is related to another bug you&apos;re now working on. Could
&gt; you look through this one and see if there are useful pieces to combine into
&gt; that work, then make this one depend on that one and/or close it as
&gt; appropriate please?

Sure, i&apos;ll take into account this bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70391</commentid>
    <comment_count>11</comment_count>
    <who name="Aníbal Limón">anibal.limon</who>
    <bug_when>2017-02-02 17:14:53 +0000</bug_when>
    <thetext>Currently i&apos;m working on standalone script (#10596) to make compatibility checking of layers, this will include the rules described in the Yocto Project Compabile page [1].

The unique difference with this bug is about the implementation as a bbclass instead of standalone script, but for the use case is better to have a standalone script because the checking needs to be made only at time of the process to be Yocto Project Compatible. I&apos;m open to add some layer checking into insane class but needs to be discuss.

I will close this bug as duplicated, objections?

[1] https://www.yoctoproject.org/webform/yocto-project-compatible-registration</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70397</commentid>
    <comment_count>12</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2017-02-02 18:34:44 +0000</bug_when>
    <thetext>Hi Anibal, 

Can you make sure that I am on the CC list for the bug that you are going to use as this issue?  I am assuming that it still could affect documentation.

thanks,
Scott</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70398</commentid>
    <comment_count>13</comment_count>
    <who name="Aníbal Limón">anibal.limon</who>
    <bug_when>2017-02-02 18:36:39 +0000</bug_when>
    <thetext>(In reply to comment #12)
&gt; Hi Anibal, 
&gt; 
&gt; Can you make sure that I am on the CC list for the bug that you are going to
&gt; use as this issue?  I am assuming that it still could affect documentation.
&gt; 
&gt; thanks,
&gt; Scott

Yes Scott, np.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70402</commentid>
    <comment_count>14</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2017-02-02 20:24:14 +0000</bug_when>
    <thetext>Standalone script is fine - but one thing I do want the script to be able to do is check more than just what&apos;s in YP compatible - i.e. there&apos;s a standard mode and &quot;YP compatible mode&quot; where what goes into the YP compatible checks is more strictly defined (and documented), and the standard mode is a superset of that. That way the script can live in OE-core and it will be easier to accept patches to add additional checks that are outside the scope of the YP compatible programme.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70458</commentid>
    <comment_count>15</comment_count>
    <who name="Aníbal Limón">anibal.limon</who>
    <bug_when>2017-02-06 22:59:06 +0000</bug_when>
    <thetext>Resolve as duplicated in working on #10596.

*** This bug has been marked as a duplicate of bug 10596 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>