Meaning of ?= and ??= in bitbake/yocto

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












What does the different assignment types mean in bitbake recipe scripts, such as:



 BB_NUMBER_THREADS ?= "$@oe.utils.cpu_count()"
PARALLEL_MAKE ?= "-j $@oe.utils.cpu_count()"
MACHINE ??= "qemux86"


What of above is analogous to Ruby's bb_number_threads ||= 'something'?







share|improve this question






















  • That's not shell script, as far as I know, anyway. PHP?
    – mikeserv
    Jul 10 '15 at 8:59















up vote
1
down vote

favorite












What does the different assignment types mean in bitbake recipe scripts, such as:



 BB_NUMBER_THREADS ?= "$@oe.utils.cpu_count()"
PARALLEL_MAKE ?= "-j $@oe.utils.cpu_count()"
MACHINE ??= "qemux86"


What of above is analogous to Ruby's bb_number_threads ||= 'something'?







share|improve this question






















  • That's not shell script, as far as I know, anyway. PHP?
    – mikeserv
    Jul 10 '15 at 8:59













up vote
1
down vote

favorite









up vote
1
down vote

favorite











What does the different assignment types mean in bitbake recipe scripts, such as:



 BB_NUMBER_THREADS ?= "$@oe.utils.cpu_count()"
PARALLEL_MAKE ?= "-j $@oe.utils.cpu_count()"
MACHINE ??= "qemux86"


What of above is analogous to Ruby's bb_number_threads ||= 'something'?







share|improve this question














What does the different assignment types mean in bitbake recipe scripts, such as:



 BB_NUMBER_THREADS ?= "$@oe.utils.cpu_count()"
PARALLEL_MAKE ?= "-j $@oe.utils.cpu_count()"
MACHINE ??= "qemux86"


What of above is analogous to Ruby's bb_number_threads ||= 'something'?









share|improve this question













share|improve this question




share|improve this question








edited Jun 13 at 9:40









Kusalananda

103k13202318




103k13202318










asked Jul 10 '15 at 8:53









Frankie_Fomalhaut

16616




16616











  • That's not shell script, as far as I know, anyway. PHP?
    – mikeserv
    Jul 10 '15 at 8:59

















  • That's not shell script, as far as I know, anyway. PHP?
    – mikeserv
    Jul 10 '15 at 8:59
















That's not shell script, as far as I know, anyway. PHP?
– mikeserv
Jul 10 '15 at 8:59





That's not shell script, as far as I know, anyway. PHP?
– mikeserv
Jul 10 '15 at 8:59











1 Answer
1






active

oldest

votes

















up vote
5
down vote













As per this section of Bitbake manual



?= is:




You can use the "?=" operator to achieve a "softer" assignment for a variable. This type of assignment allows you to define a variable if it is undefined when the statement is parsed, but to leave the value alone if the variable has a value. Here is an example:




A ?= "aval"




If A is set at the time this statement is parsed, the variable retains its value. However, if A is not set, the variable is set to "aval".




??= is:




It is possible to use a "weaker" assignment than in the previous section by using the "??=" operator. This assignment behaves identical to "?=" except that the assignment is made at the end of the parsing process rather than immediately. Consequently, when multiple "??=" assignments exist, the last one is used. Also, any "=" or "?=" assignment will override the value set with "??=". Here is an example:




 A ??= "somevalue"
A ??= "someothervalue"



If A is set before the above statements are parsed, the variable
retains its value. If A is not set, the variable is set to
"someothervalue".



Again, this assignment is a "lazy" or "weak" assignment because it
does not occur until the end of the parsing process.







share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );








     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f215044%2fmeaning-of-and-in-bitbake-yocto%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    5
    down vote













    As per this section of Bitbake manual



    ?= is:




    You can use the "?=" operator to achieve a "softer" assignment for a variable. This type of assignment allows you to define a variable if it is undefined when the statement is parsed, but to leave the value alone if the variable has a value. Here is an example:




    A ?= "aval"




    If A is set at the time this statement is parsed, the variable retains its value. However, if A is not set, the variable is set to "aval".




    ??= is:




    It is possible to use a "weaker" assignment than in the previous section by using the "??=" operator. This assignment behaves identical to "?=" except that the assignment is made at the end of the parsing process rather than immediately. Consequently, when multiple "??=" assignments exist, the last one is used. Also, any "=" or "?=" assignment will override the value set with "??=". Here is an example:




     A ??= "somevalue"
    A ??= "someothervalue"



    If A is set before the above statements are parsed, the variable
    retains its value. If A is not set, the variable is set to
    "someothervalue".



    Again, this assignment is a "lazy" or "weak" assignment because it
    does not occur until the end of the parsing process.







    share|improve this answer
























      up vote
      5
      down vote













      As per this section of Bitbake manual



      ?= is:




      You can use the "?=" operator to achieve a "softer" assignment for a variable. This type of assignment allows you to define a variable if it is undefined when the statement is parsed, but to leave the value alone if the variable has a value. Here is an example:




      A ?= "aval"




      If A is set at the time this statement is parsed, the variable retains its value. However, if A is not set, the variable is set to "aval".




      ??= is:




      It is possible to use a "weaker" assignment than in the previous section by using the "??=" operator. This assignment behaves identical to "?=" except that the assignment is made at the end of the parsing process rather than immediately. Consequently, when multiple "??=" assignments exist, the last one is used. Also, any "=" or "?=" assignment will override the value set with "??=". Here is an example:




       A ??= "somevalue"
      A ??= "someothervalue"



      If A is set before the above statements are parsed, the variable
      retains its value. If A is not set, the variable is set to
      "someothervalue".



      Again, this assignment is a "lazy" or "weak" assignment because it
      does not occur until the end of the parsing process.







      share|improve this answer






















        up vote
        5
        down vote










        up vote
        5
        down vote









        As per this section of Bitbake manual



        ?= is:




        You can use the "?=" operator to achieve a "softer" assignment for a variable. This type of assignment allows you to define a variable if it is undefined when the statement is parsed, but to leave the value alone if the variable has a value. Here is an example:




        A ?= "aval"




        If A is set at the time this statement is parsed, the variable retains its value. However, if A is not set, the variable is set to "aval".




        ??= is:




        It is possible to use a "weaker" assignment than in the previous section by using the "??=" operator. This assignment behaves identical to "?=" except that the assignment is made at the end of the parsing process rather than immediately. Consequently, when multiple "??=" assignments exist, the last one is used. Also, any "=" or "?=" assignment will override the value set with "??=". Here is an example:




         A ??= "somevalue"
        A ??= "someothervalue"



        If A is set before the above statements are parsed, the variable
        retains its value. If A is not set, the variable is set to
        "someothervalue".



        Again, this assignment is a "lazy" or "weak" assignment because it
        does not occur until the end of the parsing process.







        share|improve this answer












        As per this section of Bitbake manual



        ?= is:




        You can use the "?=" operator to achieve a "softer" assignment for a variable. This type of assignment allows you to define a variable if it is undefined when the statement is parsed, but to leave the value alone if the variable has a value. Here is an example:




        A ?= "aval"




        If A is set at the time this statement is parsed, the variable retains its value. However, if A is not set, the variable is set to "aval".




        ??= is:




        It is possible to use a "weaker" assignment than in the previous section by using the "??=" operator. This assignment behaves identical to "?=" except that the assignment is made at the end of the parsing process rather than immediately. Consequently, when multiple "??=" assignments exist, the last one is used. Also, any "=" or "?=" assignment will override the value set with "??=". Here is an example:




         A ??= "somevalue"
        A ??= "someothervalue"



        If A is set before the above statements are parsed, the variable
        retains its value. If A is not set, the variable is set to
        "someothervalue".



        Again, this assignment is a "lazy" or "weak" assignment because it
        does not occur until the end of the parsing process.








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jul 10 '15 at 11:35









        Frankie_Fomalhaut

        16616




        16616






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f215044%2fmeaning-of-and-in-bitbake-yocto%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            Peggy Mitchell

            Palaiologos

            The Forum (Inglewood, California)