<?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>14235</bug_id>
          
          <creation_ts>2021-02-15 20:23:23 +0000</creation_ts>
          <short_desc>bbclass file name convention is not consistent wrt dash and underscore ( - _ )</short_desc>
          <delta_ts>2024-05-23 15:22:41 +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>3.3</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>NEWCOMER</status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>5.0</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Randy MacLeod">randy.macleod</reporter>
          <assigned_to name="Saul Wold">sgw</assigned_to>
          <cc>open.source</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>sgw</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>89267</commentid>
    <comment_count>0</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2021-02-15 20:23:23 +0000</bug_when>
    <thetext>ls meta/classes/*_*
meta/classes/bin_package.bbclass            meta/classes/lib_package.bbclass         meta/classes/package_rpm.bbclass                meta/classes/rm_work.bbclass
...

$ ls meta/classes/*-*
meta/classes/autotools-brokensep.bbclass         meta/classes/go-mod.bbclass                     meta/classes/kernel-devicetree.bbclass    meta/classes/remove-libtool.bbclass
meta/classes/baremetal-image.bbclass             meta/classes/go-ptest.bbclass                   meta/classes/kernel-fitimage.bbclass      meta/classes/report-error.bbclass


Should we wrap the files witn an underscopre, issue a warning for a release or two and then make the evil _ files be an error at some point?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89268</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2021-02-15 20:24:18 +0000</bug_when>
    <thetext>$ ls meta/classes/*-* | wc -l
68
$ ls meta/classes/*_* | wc -l
38

dashes win!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89293</commentid>
    <comment_count>2</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2021-02-18 15:40:44 +0000</bug_when>
    <thetext>We should improve usability by:

1. Check export functions for dashes
2. Check for shell function names with dashes
3. Create a list of known classes and error if not in that list and contains a dash
4. We could do pattern matching on names that are not found.

Some of these things can be done by a NEWCOMER, Please comment on this bug if you are going to work on it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89333</commentid>
    <comment_count>3</comment_count>
    <who name="Oleksandr Kravchuk">open.source</who>
    <bug_when>2021-02-20 20:21:13 +0000</bug_when>
    <thetext>I would happily work on this one. Is there a decision on how to handle the issue?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89450</commentid>
    <comment_count>4</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2021-03-01 01:57:57 +0000</bug_when>
    <thetext>Oleksandr,
Richard wanted to do this incrementally and certainly not do a mass renaming.
Perhaps the best way to get started is to implement:

3. Create a list of known classes and error if not in that list and contains a dash
4. We could do pattern matching on names that are not found.

I think that 4. starts as a warning and becomes an error in a future release.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97160</commentid>
    <comment_count>5</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-10-30 15:37:33 +0000</bug_when>
    <thetext>Build move to 5.0 -- ../Randy</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97760</commentid>
    <comment_count>6</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2024-01-09 01:39:19 +0000</bug_when>
    <thetext>Proof of concept scripts attached it uses tinfoil to scan the BBCLASS path and find bbclasses then searches for unknwon bbclasses that contains &quot;_&quot; in filename.

It also checks existing bbclasses for &apos;-&apos; in either addtask or EXPORT_FUNCTIONS directives.

/poky$ scripts/check-bbclasses
Loading cache: 100% |#################################################| Time: 0:00:00
Loaded 1927 entries from dependency cache.
Warning: BBClass file name contains &apos;_&apos;: poky/meta/classes/bad_bbclass.bbclass
Warning: addtask contains &apos;-&apos;: /poky/meta/classes/bad_bbclass.bbclass: addtask do-bad-task

Warning: EXPORT_FUNCTIONS contains &apos;-&apos;: /poky/meta/classes/bad_bbclass.bbclass: EXPORT_FUNCTIONS do-bad-function</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97761</commentid>
    <comment_count>7</comment_count>
      <attachid>5003</attachid>
    <who name="Saul Wold">sgw</who>
    <bug_when>2024-01-09 01:40:33 +0000</bug_when>
    <thetext>Created attachment 5003
Prototype script</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97762</commentid>
    <comment_count>8</comment_count>
      <attachid>5004</attachid>
    <who name="Saul Wold">sgw</who>
    <bug_when>2024-01-09 01:41:15 +0000</bug_when>
    <thetext>Created attachment 5004
test bbclass</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98121</commentid>
    <comment_count>9</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2024-02-02 20:14:18 +0000</bug_when>
    <thetext>Due to the combination of &apos;-&apos; and shell function, we can not use &apos;-&apos; in bbclass file names, so instead it should be _, which just means more change over time.

ERROR: The classname dash-bbclass contains a dash character and is calling an sh function dash-bbclass_do_dash_shell_function using EXPORT_FUNCTIONS. Since a dash is illegal in sh function names, this cannot work, please rename the class or don&apos;t use EXPORT_FUNCTIONS.
ERROR: Unable to parse /home/swold/src/yocto/poky/bitbake/lib/bb/__init__.py</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98122</commentid>
    <comment_count>10</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-02-02 20:29:13 +0000</bug_when>
    <thetext>Saul,
Thanks for looking into this bug which aims at making the class file names follow a pattern.

I&apos;m fine with picking &quot;_&quot; rather than &quot;-&quot; due to shell restrictions.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98177</commentid>
    <comment_count>11</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2024-02-09 14:57:09 +0000</bug_when>
    <thetext>As you&apos;ve found, dashes give problems with shell and function names so underscores are preferred when used in class names. Users to tend to prefer dashes though.

I added the error to export functions a while back as a compromise around this issue, to ensure people know in the cases things really break.

I&apos;m torn on all this to be honest, not sure what the best thing to do is.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99060</commentid>
    <comment_count>12</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-05-23 15:06:50 +0000</bug_when>
    <thetext>Since we have limits to how consistent things can be we are closing this bug and if people are working on one of the files that can be renamed, they can do so.

-- YP bug review (Randy)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99068</commentid>
    <comment_count>13</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-05-23 15:22:41 +0000</bug_when>
    <thetext>moving back to 5.0 since we aren&apos;t going to be doing a mass change.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>5003</attachid>
            <date>2024-01-09 01:40:33 +0000</date>
            <delta_ts>2024-01-09 01:40:33 +0000</delta_ts>
            <desc>Prototype script</desc>
            <filename>check-bbclasses</filename>
            <type>text/x-python3</type>
            <size>3383</size>
            <attacher name="Saul Wold">sgw</attacher>
            
              <data enc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YW1lIGFuZCBlbnRy
eS5pc19kaXIoKToKICAgICAgICAgICAgICAgICAgICB3aXRoIG9zLnNjYW5kaXIocGF0aCArICIv
IiArIGVudHJ5Lm5hbWUpIGFzIGNsYXNzZXM6CiAgICAgICAgICAgICAgICAgICAgICAgIGZvciBj
IGluIGNsYXNzZXM6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiBjLm5hbWUuZW5kc3dp
dGgoIi5iYmNsYXNzIikgYW5kICJfIiBpbiBjLm5hbWUgYW5kIG5vdCBjLm5hbWUgaW4ga25vd25f
Y2xhc3NlczoKCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJpbnQoIldhcm5pbmc6
IEJCQ2xhc3MgZmlsZSBuYW1lIGNvbnRhaW5zICdfJzogIiArIHBhdGggKyAiLyIgKyBlbnRyeS5u
YW1lICsgIi8iICsgYy5uYW1lKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgd2l0aCBvcGVu
KHBhdGggKyAiLyIgKyBlbnRyeS5uYW1lICsgIi8iICsgYy5uYW1lKSBhcyBmOgogICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgIGZvciBsaW5lIGluIGYucmVhZGxpbmVzKCk6CiAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIGxpbmUuc3RhcnRzd2l0aCgiYWRkdGFzayAi
KSBhbmQgIi0iIGluIGxpbmU6CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICBwcmludCgiV2FybmluZzogYWRkdGFzayBjb250YWlucyAnLSc6ICIgKyBwYXRoICsgIi8iICsg
ZW50cnkubmFtZSArICIvIiArIGMubmFtZSArICI6ICIgKyBsaW5lKQogICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICBpZiBsaW5lLnN0YXJ0c3dpdGgoIkVYUE9SVF9GVU5DVElPTlMg
IikgYW5kICItIiBpbiBsaW5lOgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgcHJpbnQoIldhcm5pbmc6IEVYUE9SVF9GVU5DVElPTlMgY29udGFpbnMgJy0nOiAiICsgcGF0
aCArICIvIiArIGVudHJ5Lm5hbWUgKyAiLyIgKyBjLm5hbWUgKyAiOiAiICsgbGluZSkKCgoKICAg
IHRpbmZvaWwuc2h1dGRvd24oKQo=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>5004</attachid>
            <date>2024-01-09 01:41:15 +0000</date>
            <delta_ts>2024-01-09 01:41:15 +0000</delta_ts>
            <desc>test bbclass</desc>
            <filename>bad_bbclass.bbclass</filename>
            <type>text/plain</type>
            <size>54</size>
            <attacher name="Saul Wold">sgw</attacher>
            
              <data encoding="base64">YWRkdGFzayBkby1iYWQtdGFzawoKRVhQT1JUX0ZVTkNUSU9OUyBkby1iYWQtZnVuY3Rpb24K
</data>

          </attachment>
      

    </bug>

</bugzilla>