<?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>10296</bug_id>
          
          <creation_ts>2016-09-17 03:15:11 +0000</creation_ts>
          <short_desc>Suggested documentation on using overrides with functions</short_desc>
          <delta_ts>2016-09-22 23:28:43 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>9</classification_id>
          <classification>Documentation</classification>
          <product>BitBake User Manual</product>
          <component>bitbake-manual</component>
          <version>2.2</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>22 Sept 2016: RESOLVED</status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.2 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>ulfalizer</reporter>
          <assigned_to name="Scott Rifenbark">srifenbark</assigned_to>
          <cc>bluelightning</cc>
    
    <cc>sgw</cc>
    
    <cc>srifenbark</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Done (doc changes complete)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>66279</commentid>
    <comment_count>0</comment_count>
    <who name="">ulfalizer</who>
    <bug_when>2016-09-17 03:15:11 +0000</bug_when>
    <thetext>Hello,

There doesn&apos;t seem to be any documentation that explicitly mentions that you
can append and prepend to functions. I suggest the following changes:

Add this to the end of &apos;3.1.8. Appending and Prepending (Override Style
Syntax)&apos;:

  It is also possible to append and prepend to shell functions and
  BitBake-style Python functions. See
  [3.5.1. Shell Functions] and [3.5.2. BitBake Style Python Functions] for
  examples of how to do this.


Add this to the end of &apos;3.5.1. Shell Functions&apos;:

  Overrides and override-style operators like &quot;_append&quot; and &quot;_prepend&quot; can also
  be applied to shell functions. Most commonly, this would be used in a
  .bbappend to modify functions in the main recipe. It can also be used to
  modify functions inherited from classes.
  
  As an example, consider the following snippet:

    do_foo() {
        bbplain first
        fn
    }
    
    fn_prepend() {
        bbplain second
    }
    
    fn() {
        bbplain third
    }
    
    do_foo_append() {
        bbplain fourth
    }

  The output from do_foo would be the following:

    recipename do_foo: first
    recipename do_foo: second
    recipename do_foo: third
    recipename do_foo: fourth

  Note {
  Overrides and override-style operators can be applied to any shell function,
  not just
  [tasks](http://www.yoctoproject.org/docs/2.2/bitbake-user-manual/bitbake-user-manual.html#tasks).
  }

  &apos;bitbake -e recipename&apos; can be used to view the final assembled function
  after all overrides have been applied.


Add this to the end of &apos;3.5.2. BitBake Style Python Functions&apos;:

  Like with shell functions, overrides and override-style operators can also be
  applied to BitBake-style Python functions. As an example, consider the
  following snippet:

    python do_foo_prepend() {
        bb.plain(&quot;first&quot;)
    }
    
    python do_foo() {
        bb.plain(&quot;second&quot;)
    }
    
    python do_foo_append() {
        bb.plain(&quot;third&quot;)
    }

  The output from do_foo would be the following:

    recipename do_foo: first
    recipename do_foo: second
    recipename do_foo: third

  &apos;bitbake -e recipename&apos; can be used to view the final assembled function
  after all overrides have been applied.


Cheers,
Ulf</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66447</commentid>
    <comment_count>1</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2016-09-21 22:35:11 +0000</bug_when>
    <thetext>Ulf, 

See http://www.yoctoproject.org/docs/2.2/bitbake-user-manual/bitbake-user-manual.html#appending-and-prepending-override-style-syntax for the change to the &quot;Appending and Prepending (Override Style Syntax)&quot; section.

See http://www.yoctoproject.org/docs/2.2/bitbake-user-manual/bitbake-user-manual.html#shell-functions for the addition to the &quot;Shell Functions&quot; section.

See http://www.yoctoproject.org/docs/2.2/bitbake-user-manual/bitbake-user-manual.html#bitbake-style-python-functions for the change to the &quot;BitBake Style Python Functions&quot; section.

thanks, 
Scott</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66459</commentid>
    <comment_count>2</comment_count>
    <who name="">ulfalizer</who>
    <bug_when>2016-09-22 05:17:45 +0000</bug_when>
    <thetext>Maybe

  Running do_foo prints the following

sounds a bit better than

  The output from do_foo results in the following

(in both places where it appears).

Looks good to me otherwise.

Thanks,
Ulf</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66534</commentid>
    <comment_count>3</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2016-09-22 23:28:43 +0000</bug_when>
    <thetext>Got it. 

See http://www.yoctoproject.org/docs/2.2/bitbake-user-manual/bitbake-user-manual.html#shell-functions and http://www.yoctoproject.org/docs/2.2/bitbake-user-manual/bitbake-user-manual.html#bitbake-style-python-functions.

I am going to set the bug to RESOLVED and put the doc flag into &quot;done.&quot;

Thanks,
Scott</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>