<?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>3095</bug_id>
          
          <creation_ts>2012-09-12 08:19:04 +0000</creation_ts>
          <short_desc>PRINC is an undocumented feature.</short_desc>
          <delta_ts>2012-11-01 13:14:44 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>9</classification_id>
          <classification>Documentation</classification>
          <product>Development Manual</product>
          <component>development</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://git.yoctoproject.org/cgit.cgi/yocto-docs/commit/?id=053e4558cc90eb1618e697394aff6d40edbeb3b1</bug_file_loc>
          <status_whiteboard>26 Sept 2012</status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>1.3 M5</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="T OCallaghan">tocallaghan</reporter>
          <assigned_to name="Scott Rifenbark">srifenbark</assigned_to>
          <cc>dvhart</cc>
    
    <cc>laurentiu.serban</cc>
    
    <cc>sgw</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>25094</commentid>
    <comment_count>0</comment_count>
    <who name="T OCallaghan">tocallaghan</who>
    <bug_when>2012-09-12 08:19:04 +0000</bug_when>
    <thetext>PRINC is only mentioned in passing in the yocto documentation, and it is used in two forms:

PRINC = &quot;1&quot;
and
PRINC := &quot;${@int(PRINC) + 2}&quot;. 

neither of which are explained. though I&apos;m guessing the second form is to guarantee PRINC works with multiple bbappends.

The only documentation is a comment in base.bbclass:
/meta/classes/base.bbclass:362:    # If PRINC is set, try and increase the PR value by the amount specified

Google highlights the issue best, search for:
site:http://www.yoctoproject.org/docs/ PRINC</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25194</commentid>
    <comment_count>1</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2012-09-13 15:27:54 +0000</bug_when>
    <thetext>Can someone give me a rough paragraph or two describing the use for PRINC?  In comment 1 two uses are shown.  Are these the only valid uses?  What are the parameters for use? What is the general purpose for the variable, etc. 

Once I get this information I can create a glossary entry for the variable and, if appropriate, find a place in the mainstream documentation where it is used and expand on it.

Scott</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25501</commentid>
    <comment_count>2</comment_count>
    <who name="Darren Hart">dvhart</who>
    <bug_when>2012-09-20 21:49:44 +0000</bug_when>
    <thetext>Some discussion from the Yocto mailing list:

https://lists.yoctoproject.org/pipermail/yocto/2012-September/011411.html

&gt;&gt;&gt; +PR .= &quot;.1&quot;
&gt;&gt;
&gt;&gt; why not
&gt;&gt; PRINC := &quot;${@int(PRINC) + 1}&quot;
&gt;&gt; ?
&gt;
&gt; I understood that the .1 adds more finer granularity instead of 
&gt; incrementing the base PR itself.  You end up with a potential r1.2.1 
&gt; which is still legal.

Yes but also makes order of .bbappends applied even more important.

In case one layer has
PR .= &quot;.2&quot;

and other
PR .= &quot;.1&quot;

Then it will provide r1.2.1 or r1.1.2 depending on order of bbappends
applied. Hopefully you want change order of layers to break every
upgrade path, but why not use PRINC which does not suffer from this?
 
&gt; What happens with a r1.2 and the above @int(PRINC) + 1?

I guess it will produce r2.2

    princ = d.getVar(&apos;PRINC&apos;, True)
    if princ and princ != &quot;0&quot;:
        pr = d.getVar(&apos;PR&apos;, True)
        pr_prefix = re.search(&quot;\D+&quot;,pr)
        prval = re.search(&quot;\d+&quot;,pr)
        if pr_prefix is None or prval is None:
            bb.error(&quot;Unable to analyse format of PR variable: %s&quot; % pr)
        nval = int(prval.group(0)) + int(princ)
        pr = pr_prefix.group(0) + str(nval) + pr[prval.end():]
        d.setVar(&apos;PR&apos;, pr)


And another discussion:
https://lists.yoctoproject.org/pipermail/yocto/2012-July/009887.html

&gt; PRINC := &quot;${@int(PRINC) + 2}&quot;

This is the correct method to use in a bbappend. Start with 1,
obviously, and bump it each time the bbappend changes.


From what I have gathered from the above is that the proper way to use PRINC is as follows:

&quot;
PRINC will dynamically increment the PR value of a recipe while minimizing the impact of layer ordering. In order to ensure multiple bbappend files can co-exist, PRINC should be self referencing (it defaults to 0):

PRINC := &quot;${@int(PRINC) + 2}&quot;

It is adviseable not to use strings such as &quot;.= &apos;.1&apos;&quot; as this usage is very sensitive to layer ordering. Explicit assignments should be avoided as they cannot adequately represent multiple bbappend files.
&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25551</commentid>
    <comment_count>3</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2012-09-21 21:40:11 +0000</bug_when>
    <thetext>Here is a first cut at the PRINC glossary entry.  Previously emailed to Darren Hart only.  this makes it more visible to the community.  Please comment on the entry for improvements or inacurracies:

PRINC

    Causes the PR variable to dynamically increment. This incrementation increases the value of a recipe&apos;s revision (PR) while minimizing the impact of layer ordering.

    In order to ensure multiple .bbappend files can co-exist, PRINC should be self referencing. The variable defaults to 0.

    Following is an example that increments PR by two:

         PRINC := &quot;${@int(PRINC) + 2}&quot;
                        

    It is adviseable not to use strings such as &quot;.= &apos;.1&apos;&quot; with the variable because this usage is very sensitive to layer ordering. Explicit assignments should be avoided as they cannot adequately represent multiple .bbappend files.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25558</commentid>
    <comment_count>4</comment_count>
    <who name="T OCallaghan">tocallaghan</who>
    <bug_when>2012-09-24 05:48:31 +0000</bug_when>
    <thetext>I just came across this, which adds another perspective to this, the INC_PR variable seems very similar to PRINC:
http://www.yoctoproject.org/docs/current/poky-ref-manual/poky-ref-manual.html#var-INC_PR

Does PRINC duplicate INC_PR? if not, what are the situations where one is more appropriate than the other?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25610</commentid>
    <comment_count>5</comment_count>
    <who name="Darren Hart">dvhart</who>
    <bug_when>2012-09-24 15:22:55 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; I just came across this, which adds another perspective to this, the INC_PR
&gt; variable seems very similar to PRINC:
&gt; http://www.yoctoproject.org/docs/current/poky-ref-manual/poky-ref-manual.
&gt; html#var-INC_PR
&gt; 
&gt; Does PRINC duplicate INC_PR? if not, what are the situations where one is
&gt; more appropriate than the other?


PRINC is used to INCrement the PR value when bbappend&apos;ing recipes.

INC_PR is used to reference, and typically append to, an INClude file&apos;s PR value. It is used when multiple recipes are built from a common include file.

The naminig is seriously unfortunately, but they perform distinct functions.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25721</commentid>
    <comment_count>6</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2012-09-25 18:32:53 +0000</bug_when>
    <thetext>I have been hacking away at both glossary definitions (INC_PR and PRINC) off and on for the last few days.  Here are links to the definitions I have.  Input into these definitions have come from Paul Eggleton, Scott Garman, and Darren Hart.  Further comments?

INC_PR - http://www.yoctoproject.org/docs/latest/poky-ref-manual/poky-ref-manual.html#var-INC_PR

PRINC - http://www.yoctoproject.org/docs/latest/poky-ref-manual/poky-ref-manual.html#var-PRINC

Scott</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25730</commentid>
    <comment_count>7</comment_count>
    <who name="Darren Hart">dvhart</who>
    <bug_when>2012-09-25 21:26:06 +0000</bug_when>
    <thetext>(In reply to comment #6)

These look good to me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25741</commentid>
    <comment_count>8</comment_count>
    <who name="T OCallaghan">tocallaghan</who>
    <bug_when>2012-09-26 07:14:44 +0000</bug_when>
    <thetext>Looks fine to me too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25779</commentid>
    <comment_count>9</comment_count>
    <who name="Scott Rifenbark">srifenbark</who>
    <bug_when>2012-09-26 13:51:39 +0000</bug_when>
    <thetext>I am marking this bug FIXED/RESOLVED.  Three commits combined to come to the final solution.

http://git.yoctoproject.org/cgit.cgi/yocto-docs/commit/?id=053e4558cc90eb1618e697394aff6d40edbeb3b1

http://git.yoctoproject.org/cgit.cgi/yocto-docs/commit/?id=7647cef96643b3723f80013c2c51ba6d7480122a

http://git.yoctoproject.org/cgit.cgi/yocto-docs/commit/?id=418862011e79940ee378f64c6171618d29568014

Scott</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>27147</commentid>
    <comment_count>10</comment_count>
    <who name="Laurentiu Serban">laurentiu.serban</who>
    <bug_when>2012-11-01 13:14:44 +0000</bug_when>
    <thetext>Verified</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>