'How to use logical conditions in XML?

<install-condition header-file="platform/lib_platform.h">is_bcm_soc_brd1() || is_bcm_soc_brd2() || is_bcm_soc_brd3()</install-condition>

Here my input board type is is_board_jkl, so the function is_bcm_soc_brd3() will return True. The problem is is_bcm_soc_brd3() and is_bcm_soc_brd4 have a common item.

But my requirement is that, if the board is is_board_jkl, dont execute further. i.e. in C code I can written this as follows,

If ( is_bcm_soc_brd1() || is_bcm_soc_brd2() ||   (is_bcm_soc_brd3() && !is_bcm_soc_brd4())
 {
    //do the action
 }

How to write the equivalent code in the below given XML tag?

 <install-condition header-file="platform/lib_platform.h">is_bcm_soc_brd1() || is_bcm_soc_brd2() || is_bcm_soc_brd3()</install-condition>

cat platform/lib_platform.h

#include <string.h>
#include <stdint.h>
#include <unistd.h>
#include <stdlib.h>

int is_bcm_soc_brd1()
{
  if (is_board_abc())
    return TRUE;

  return FALSE;
}

int is_bcm_soc_brd2()
{
  if (is_board_def())
    return TRUE;

  return FALSE;
}


int is_bcm_soc_brd3()
{
  if (is_board_ghi() || (is_board_jkl()))  
    return TRUE;

  return FALSE;
}

int is_bcm_soc_brd4()
{
  if (is_board_jkl())
    return TRUE;

  return FALSE;
}


Solution 1:[1]

You can write following in XML:

(name is 'ABC' AND (language is NOT english) AND (country is Belgium OR Germany OR France OR Italy)) as:

['|','|','|',('country_id.code','=','be'),('country_id.code','=','ge'),('country_id.code','=','fr'),('country_id.code','=','it'),('name','=','ABC'),('language.code','!=','en_US'),]

Country code maybe different you can replace country code with correct one in above sentense.

Thanks

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1