diff mbox series

[isar-cip-core] linux: Fix warning if USE_CIP_KERNEL_CONFIG is not defined

Message ID 20210125172748.839290-1-florian.bezdeka@siemens.com (mailing list archive)
State Handled Elsewhere
Headers show
Series [isar-cip-core] linux: Fix warning if USE_CIP_KERNEL_CONFIG is not defined | expand

Commit Message

Florian Bezdeka Jan. 25, 2021, 5:28 p.m. UTC
USE_CIP_KERNEL_CONFIG may not be defined in all layers using the
isar-cip-core layer, so we end up with the following warnings:

WARNING: /work/cip-core/recipes-kernel/linux/linux-cip_4.19.140-cip33.bb: Unable to get checksum for linux-cip SRC_URI entry ${MACHINE}_defconfig: file could not be found
WARNING: /work/cip-core/recipes-kernel/linux/linux-cip-rt_4.4.231-cip47-rt30.bb: Unable to get checksum for linux-cip-rt SRC_URI entry ${MACHINE}_defconfig: file could not be found
WARNING: /work/cip-core/recipes-kernel/linux/linux-cip_4.4.230-cip47.bb: Unable to get checksum for linux-cip SRC_URI entry ${MACHINE}_defconfig: file could not be found
WARNING: /work/cip-core/recipes-kernel/linux/linux-cip-rt_4.19.135-cip31-rt13.bb: Unable to get checksum for linux-cip-rt SRC_URI entry ${MACHINE}_defconfig: file could not be found

${MACHINE}_defconfig needs to be added to SRC_URI only if
USE_CIP_KERNEL_CONFIG is set to "1".

There is one in-tree machine definition (the bbb) that does not set
USE_CIP_KERNEL_CONFIG to "1" but still needs the defconfig added.
A machine specific SRC_URI was set to take care of that.

Closes #7.

Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
---

Some additional notes:
  - That's my first contribution, so review carefully ;-)
  - Both branches (master, next) are affected
  - The gitlab MR: [1]
  - The gitlab issue: [2]

  [1]  https://gitlab.com/cip-project/cip-core/isar-cip-core/-/merge_requests/10
  [2]  https://gitlab.com/cip-project/cip-core/isar-cip-core/-/issues/7


 recipes-kernel/linux/linux-cip-common.inc | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

Comments

Quirin Gylstorff Jan. 25, 2021, 6:23 p.m. UTC | #1
On 1/25/21 6:28 PM, Bezdeka, Florian (T RDA IOT SES-DE) wrote:
> USE_CIP_KERNEL_CONFIG may not be defined in all layers using the
> isar-cip-core layer, so we end up with the following warnings:
> 
> WARNING: /work/cip-core/recipes-kernel/linux/linux-cip_4.19.140-cip33.bb: Unable to get checksum for linux-cip SRC_URI entry ${MACHINE}_defconfig: file could not be found
> WARNING: /work/cip-core/recipes-kernel/linux/linux-cip-rt_4.4.231-cip47-rt30.bb: Unable to get checksum for linux-cip-rt SRC_URI entry ${MACHINE}_defconfig: file could not be found
> WARNING: /work/cip-core/recipes-kernel/linux/linux-cip_4.4.230-cip47.bb: Unable to get checksum for linux-cip SRC_URI entry ${MACHINE}_defconfig: file could not be found
> WARNING: /work/cip-core/recipes-kernel/linux/linux-cip-rt_4.19.135-cip31-rt13.bb: Unable to get checksum for linux-cip-rt SRC_URI entry ${MACHINE}_defconfig: file could not be found
> 
> ${MACHINE}_defconfig needs to be added to SRC_URI only if
> USE_CIP_KERNEL_CONFIG is set to "1".
> 
> There is one in-tree machine definition (the bbb) that does not set
> USE_CIP_KERNEL_CONFIG to "1" but still needs the defconfig added.
> A machine specific SRC_URI was set to take care of that.
> 
> Closes #7.
> 
> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
> ---
> 
> Some additional notes:
>    - That's my first contribution, so review carefully ;-)
>    - Both branches (master, next) are affected
>    - The gitlab MR: [1]
>    - The gitlab issue: [2]
> 
>    [1]  https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.com%2Fcip-project%2Fcip-core%2Fisar-cip-core%2F-%2Fmerge_requests%2F10&amp;data=04%7C01%7C6549bcd2-981c-4c06-8e1b-b5c6cc3441b4%40ad011.siemens.com%7C1a78e530b9ba4e41925b08d8c156918d%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637471924851339538%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=FHMuzH9wdzo2s%2FHfd5B2y3sMfOSN7Y1ZF23E8xa4TEg%3D&amp;reserved=0
>    [2]  https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.com%2Fcip-project%2Fcip-core%2Fisar-cip-core%2F-%2Fissues%2F7&amp;data=04%7C01%7C6549bcd2-981c-4c06-8e1b-b5c6cc3441b4%40ad011.siemens.com%7C1a78e530b9ba4e41925b08d8c156918d%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637471924851349487%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=NCLmMQK68OT0eM9lr2FN85i8EIdkvz73gc1ewGmGCjc%3D&amp;reserved=0
> 
> 
>   recipes-kernel/linux/linux-cip-common.inc | 15 ++++++---------
>   1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/recipes-kernel/linux/linux-cip-common.inc b/recipes-kernel/linux/linux-cip-common.inc
> index 6db1d1d..9aca9af 100644
> --- a/recipes-kernel/linux/linux-cip-common.inc
> +++ b/recipes-kernel/linux/linux-cip-common.inc
> @@ -11,21 +11,18 @@
> 
>   KERNEL_DEFCONFIG ?= "${MACHINE}_defconfig"
> 
> -def conditional(variable, checkvalue, truevalue, falsevalue, d):
> -    if d.getVar(variable) == checkvalue:
> -        return truevalue
> -    else:
> -        return falsevalue
> -
>   require recipes-kernel/linux/linux-custom.inc
> 
>   SRC_URI += " \
>       https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.com%2Fcip-project%2Fcip-kernel%2Flinux-cip%2F-%2Farchive%2Fv%24&amp;data=04%7C01%7C6549bcd2-981c-4c06-8e1b-b5c6cc3441b4%40ad011.siemens.com%7C1a78e530b9ba4e41925b08d8c156918d%7C38ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637471924851349487%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=lPFSoIApETXAdkPI0fyWSfK%2FuIThRGuBQx9kOf3MQ5s%3D&amp;reserved=0{PV}/linux-cip-v${PV}.tar.gz \
>       "
> 
> -SRC_URI_append = " ${@conditional("USE_CIP_KERNEL_CONFIG", "1", \
> -    "git://gitlab.com/cip-project/cip-kernel/cip-kernel-config.git;protocol=https;destsuffix=cip-kernel-config;name=cip-kernel-config", \
> -    "file://${KERNEL_DEFCONFIG}",d)}"
The easier way would have been to delete file://${KERNEL_DEFCONFIG} 
instead of create the logic anew. The conditional function should allow 
an empty string.

> +SRC_URI_append = " ${@ "git://gitlab.com/cip-project/cip-kernel/cip-kernel-config.git;protocol=https;destsuffix=cip-kernel-config;name=cip-kernel-config" \
> +    if d.getVar('USE_CIP_KERNEL_CONFIG') == '1' else '' \
> +    }"
> +
> +SRC_URI_append_bbb = "file://${KERNEL_DEFCONFIG}"
> +
>   SRCREV_cip-kernel-config ?= "7f2930b9667372f94f2edb42ca9cf6fc6c0aed50"
> 
>   S = "${WORKDIR}/linux-cip-v${PV}"
> --
> 2.29.2
> 

Quirin
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#6140): https://lists.cip-project.org/g/cip-dev/message/6140
Mute This Topic: https://lists.cip-project.org/mt/80109577/4520388
Group Owner: cip-dev+owner@lists.cip-project.org
Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129055/727948398/xyzzy [cip-dev@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-
Jan Kiszka Jan. 28, 2021, 2:13 p.m. UTC | #2
On 25.01.21 19:23, Gylstorff Quirin wrote:
> 
> 
> On 1/25/21 6:28 PM, Bezdeka, Florian (T RDA IOT SES-DE) wrote:
>> USE_CIP_KERNEL_CONFIG may not be defined in all layers using the
>> isar-cip-core layer, so we end up with the following warnings:
>>
>> WARNING:
>> /work/cip-core/recipes-kernel/linux/linux-cip_4.19.140-cip33.bb:
>> Unable to get checksum for linux-cip SRC_URI entry
>> ${MACHINE}_defconfig: file could not be found
>> WARNING:
>> /work/cip-core/recipes-kernel/linux/linux-cip-rt_4.4.231-cip47-rt30.bb: Unable
>> to get checksum for linux-cip-rt SRC_URI entry ${MACHINE}_defconfig:
>> file could not be found
>> WARNING:
>> /work/cip-core/recipes-kernel/linux/linux-cip_4.4.230-cip47.bb: Unable
>> to get checksum for linux-cip SRC_URI entry ${MACHINE}_defconfig: file
>> could not be found
>> WARNING:
>> /work/cip-core/recipes-kernel/linux/linux-cip-rt_4.19.135-cip31-rt13.bb:
>> Unable to get checksum for linux-cip-rt SRC_URI entry
>> ${MACHINE}_defconfig: file could not be found
>>
>> ${MACHINE}_defconfig needs to be added to SRC_URI only if
>> USE_CIP_KERNEL_CONFIG is set to "1".
>>
>> There is one in-tree machine definition (the bbb) that does not set
>> USE_CIP_KERNEL_CONFIG to "1" but still needs the defconfig added.
>> A machine specific SRC_URI was set to take care of that.
>>
>> Closes #7.
>>
>> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
>> ---
>>
>> Some additional notes:
>>    - That's my first contribution, so review carefully ;-)
>>    - Both branches (master, next) are affected
>>    - The gitlab MR: [1]
>>    - The gitlab issue: [2]
>>
>>    [1] 
>> https://gitlab.com/cip-project/cip-core/isar-cip-core/-/merge_requests/10
>>
>>    [2] 
>> https://gitlab.com/cip-project/cip-core/isar-cip-core/-/issues/7
>>
>>
>>
>>   recipes-kernel/linux/linux-cip-common.inc | 15 ++++++---------
>>   1 file changed, 6 insertions(+), 9 deletions(-)
>>
>> diff --git a/recipes-kernel/linux/linux-cip-common.inc
>> b/recipes-kernel/linux/linux-cip-common.inc
>> index 6db1d1d..9aca9af 100644
>> --- a/recipes-kernel/linux/linux-cip-common.inc
>> +++ b/recipes-kernel/linux/linux-cip-common.inc
>> @@ -11,21 +11,18 @@
>>
>>   KERNEL_DEFCONFIG ?= "${MACHINE}_defconfig"
>>
>> -def conditional(variable, checkvalue, truevalue, falsevalue, d):
>> -    if d.getVar(variable) == checkvalue:
>> -        return truevalue
>> -    else:
>> -        return falsevalue
>> -
>>   require recipes-kernel/linux/linux-custom.inc
>>
>>   SRC_URI += " \
>>      
>> https://gitlab.com/cip-project/cip-kernel/linux-cip/-/archive/v$
>> \
>>       "
>>
>> -SRC_URI_append = " ${@conditional("USE_CIP_KERNEL_CONFIG", "1", \
>> -   
>> "git://gitlab.com/cip-project/cip-kernel/cip-kernel-config.git;protocol=https;destsuffix=cip-kernel-config;name=cip-kernel-config",
>> \
>> -    "file://${KERNEL_DEFCONFIG}",d)}"
> The easier way would have been to delete file://${KERNEL_DEFCONFIG}
> instead of create the logic anew. The conditional function should allow
> an empty string.

I'm not yet sure which string should be empty and would break with the
new version. Can you elaborate?

Jan

> 
>> +SRC_URI_append = " ${@
>> "git://gitlab.com/cip-project/cip-kernel/cip-kernel-config.git;protocol=https;destsuffix=cip-kernel-config;name=cip-kernel-config"
>> \
>> +    if d.getVar('USE_CIP_KERNEL_CONFIG') == '1' else '' \
>> +    }"
>> +
>> +SRC_URI_append_bbb = "file://${KERNEL_DEFCONFIG}"
>> +
>>   SRCREV_cip-kernel-config ?= "7f2930b9667372f94f2edb42ca9cf6fc6c0aed50"
>>
>>   S = "${WORKDIR}/linux-cip-v${PV}"
>> -- 
>> 2.29.2
>>
> 
> Quirin
Quirin Gylstorff Jan. 29, 2021, 12:22 p.m. UTC | #3
On 1/28/21 3:13 PM, Jan Kiszka wrote:
> On 25.01.21 19:23, Gylstorff Quirin wrote:
>>
>>
>> On 1/25/21 6:28 PM, Bezdeka, Florian (T RDA IOT SES-DE) wrote:
>>> USE_CIP_KERNEL_CONFIG may not be defined in all layers using the
>>> isar-cip-core layer, so we end up with the following warnings:
>>>
>>> WARNING:
>>> /work/cip-core/recipes-kernel/linux/linux-cip_4.19.140-cip33.bb:
>>> Unable to get checksum for linux-cip SRC_URI entry
>>> ${MACHINE}_defconfig: file could not be found
>>> WARNING:
>>> /work/cip-core/recipes-kernel/linux/linux-cip-rt_4.4.231-cip47-rt30.bb: Unable
>>> to get checksum for linux-cip-rt SRC_URI entry ${MACHINE}_defconfig:
>>> file could not be found
>>> WARNING:
>>> /work/cip-core/recipes-kernel/linux/linux-cip_4.4.230-cip47.bb: Unable
>>> to get checksum for linux-cip SRC_URI entry ${MACHINE}_defconfig: file
>>> could not be found
>>> WARNING:
>>> /work/cip-core/recipes-kernel/linux/linux-cip-rt_4.19.135-cip31-rt13.bb:
>>> Unable to get checksum for linux-cip-rt SRC_URI entry
>>> ${MACHINE}_defconfig: file could not be found
>>>
>>> ${MACHINE}_defconfig needs to be added to SRC_URI only if
>>> USE_CIP_KERNEL_CONFIG is set to "1".
>>>
>>> There is one in-tree machine definition (the bbb) that does not set
>>> USE_CIP_KERNEL_CONFIG to "1" but still needs the defconfig added.
>>> A machine specific SRC_URI was set to take care of that.
>>>
>>> Closes #7.
>>>
>>> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
>>> ---
>>>
>>> Some additional notes:
>>>     - That's my first contribution, so review carefully ;-)
>>>     - Both branches (master, next) are affected
>>>     - The gitlab MR: [1]
>>>     - The gitlab issue: [2]
>>>
>>>     [1]
>>> https://gitlab.com/cip-project/cip-core/isar-cip-core/-/merge_requests/10
>>>
>>>     [2]
>>> https://gitlab.com/cip-project/cip-core/isar-cip-core/-/issues/7
>>>
>>>
>>>
>>>    recipes-kernel/linux/linux-cip-common.inc | 15 ++++++---------
>>>    1 file changed, 6 insertions(+), 9 deletions(-)
>>>
>>> diff --git a/recipes-kernel/linux/linux-cip-common.inc
>>> b/recipes-kernel/linux/linux-cip-common.inc
>>> index 6db1d1d..9aca9af 100644
>>> --- a/recipes-kernel/linux/linux-cip-common.inc
>>> +++ b/recipes-kernel/linux/linux-cip-common.inc
>>> @@ -11,21 +11,18 @@
>>>
>>>    KERNEL_DEFCONFIG ?= "${MACHINE}_defconfig"
>>>
>>> -def conditional(variable, checkvalue, truevalue, falsevalue, d):
>>> -    if d.getVar(variable) == checkvalue:
>>> -        return truevalue
>>> -    else:
>>> -        return falsevalue
>>> -
>>>    require recipes-kernel/linux/linux-custom.inc
>>>
>>>    SRC_URI += " \
>>>       
>>> https://gitlab.com/cip-project/cip-kernel/linux-cip/-/archive/v$
>>> \
>>>        "
>>>
>>> -SRC_URI_append = " ${@conditional("USE_CIP_KERNEL_CONFIG", "1", \
>>> -
>>> "git://gitlab.com/cip-project/cip-kernel/cip-kernel-config.git;protocol=https;destsuffix=cip-kernel-config;name=cip-kernel-config",
>>> \
>>> -    "file://${KERNEL_DEFCONFIG}",d)}"
>> The easier way would have been to delete file://${KERNEL_DEFCONFIG}
>> instead of create the logic anew. The conditional function should allow
>> an empty string.
> 
> I'm not yet sure which string should be empty and would break with the
> new version. Can you elaborate?
> 
> Jan
> 


I will skip the url.
You could have written

SRC_URI_append =  "${@conditional("USE_CIP_KERNEL_CONFIG", 
"1","git://...","",d)"

instead of

SRC_URI_append = "${@ "git://..." if d.getVar('USE_CIP_KERNEL_CONFIG') 
== '1' else ''}"

The result is the same. The second method saves some code in form of a 
function.

Quirin
>>
>>> +SRC_URI_append = "${@
>>> "git://gitlab.com/cip-project/cip-kernel/cip-kernel-config.git;protocol=https;destsuffix=cip-kernel-config;name=cip-kernel-config"
>>> \
>>> +    if d.getVar('USE_CIP_KERNEL_CONFIG') == '1' else '' \
>>> +    }"
>>> +
>>> +SRC_URI_append_bbb = "file://${KERNEL_DEFCONFIG}"
>>> +
>>>    SRCREV_cip-kernel-config ?= "7f2930b9667372f94f2edb42ca9cf6fc6c0aed50"
>>>
>>>    S = "${WORKDIR}/linux-cip-v${PV}"
>>> -- 
>>> 2.29.2
>>>
>>
>> Quirin
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#6151): https://lists.cip-project.org/g/cip-dev/message/6151
Mute This Topic: https://lists.cip-project.org/mt/80109577/4520388
Group Owner: cip-dev+owner@lists.cip-project.org
Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129055/727948398/xyzzy [cip-dev@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-
Jan Kiszka Jan. 29, 2021, 2:18 p.m. UTC | #4
On 29.01.21 13:22, Gylstorff Quirin wrote:
> 
> 
> On 1/28/21 3:13 PM, Jan Kiszka wrote:
>> On 25.01.21 19:23, Gylstorff Quirin wrote:
>>>
>>>
>>> On 1/25/21 6:28 PM, Bezdeka, Florian (T RDA IOT SES-DE) wrote:
>>>> USE_CIP_KERNEL_CONFIG may not be defined in all layers using the
>>>> isar-cip-core layer, so we end up with the following warnings:
>>>>
>>>> WARNING:
>>>> /work/cip-core/recipes-kernel/linux/linux-cip_4.19.140-cip33.bb:
>>>> Unable to get checksum for linux-cip SRC_URI entry
>>>> ${MACHINE}_defconfig: file could not be found
>>>> WARNING:
>>>> /work/cip-core/recipes-kernel/linux/linux-cip-rt_4.4.231-cip47-rt30.bb:
>>>> Unable
>>>> to get checksum for linux-cip-rt SRC_URI entry ${MACHINE}_defconfig:
>>>> file could not be found
>>>> WARNING:
>>>> /work/cip-core/recipes-kernel/linux/linux-cip_4.4.230-cip47.bb: Unable
>>>> to get checksum for linux-cip SRC_URI entry ${MACHINE}_defconfig: file
>>>> could not be found
>>>> WARNING:
>>>> /work/cip-core/recipes-kernel/linux/linux-cip-rt_4.19.135-cip31-rt13.bb:
>>>>
>>>> Unable to get checksum for linux-cip-rt SRC_URI entry
>>>> ${MACHINE}_defconfig: file could not be found
>>>>
>>>> ${MACHINE}_defconfig needs to be added to SRC_URI only if
>>>> USE_CIP_KERNEL_CONFIG is set to "1".
>>>>
>>>> There is one in-tree machine definition (the bbb) that does not set
>>>> USE_CIP_KERNEL_CONFIG to "1" but still needs the defconfig added.
>>>> A machine specific SRC_URI was set to take care of that.
>>>>
>>>> Closes #7.
>>>>
>>>> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
>>>> ---
>>>>
>>>> Some additional notes:
>>>>     - That's my first contribution, so review carefully ;-)
>>>>     - Both branches (master, next) are affected
>>>>     - The gitlab MR: [1]
>>>>     - The gitlab issue: [2]
>>>>
>>>>     [1]
>>>> https://gitlab.com/cip-project/cip-core/isar-cip-core/-/merge_requests/10
>>>>
>>>>
>>>>     [2]
>>>> https://gitlab.com/cip-project/cip-core/isar-cip-core/-/issues/7
>>>>
>>>>
>>>>
>>>>    recipes-kernel/linux/linux-cip-common.inc | 15 ++++++---------
>>>>    1 file changed, 6 insertions(+), 9 deletions(-)
>>>>
>>>> diff --git a/recipes-kernel/linux/linux-cip-common.inc
>>>> b/recipes-kernel/linux/linux-cip-common.inc
>>>> index 6db1d1d..9aca9af 100644
>>>> --- a/recipes-kernel/linux/linux-cip-common.inc
>>>> +++ b/recipes-kernel/linux/linux-cip-common.inc
>>>> @@ -11,21 +11,18 @@
>>>>
>>>>    KERNEL_DEFCONFIG ?= "${MACHINE}_defconfig"
>>>>
>>>> -def conditional(variable, checkvalue, truevalue, falsevalue, d):
>>>> -    if d.getVar(variable) == checkvalue:
>>>> -        return truevalue
>>>> -    else:
>>>> -        return falsevalue
>>>> -
>>>>    require recipes-kernel/linux/linux-custom.inc
>>>>
>>>>    SRC_URI += " \
>>>>       https://gitlab.com/cip-project/cip-kernel/linux-cip/-/archive/v$
>>>> \
>>>>        "
>>>>
>>>> -SRC_URI_append = " ${@conditional("USE_CIP_KERNEL_CONFIG", "1", \
>>>> -
>>>> "git://gitlab.com/cip-project/cip-kernel/cip-kernel-config.git;protocol=https;destsuffix=cip-kernel-config;name=cip-kernel-config",
>>>>
>>>> \
>>>> -    "file://${KERNEL_DEFCONFIG}",d)}"
>>> The easier way would have been to delete file://${KERNEL_DEFCONFIG}
>>> instead of create the logic anew. The conditional function should allow
>>> an empty string.
>>
>> I'm not yet sure which string should be empty and would break with the
>> new version. Can you elaborate?
>>
>> Jan
>>
> 
> 
> I will skip the url.
> You could have written
> 
> SRC_URI_append =  "${@conditional("USE_CIP_KERNEL_CONFIG",
> "1","git://...","",d)"
> 
> instead of
> 
> SRC_URI_append = "${@ "git://..." if d.getVar('USE_CIP_KERNEL_CONFIG')
> == '1' else ''}"
> 
> The result is the same. The second method saves some code in form of a
> function.

Means you are fine with Florian's patch? If there are no downsides, I
would prefer that pattern as well.

Jan

> 
> Quirin
>>>
>>>> +SRC_URI_append = "${@
>>>> "git://gitlab.com/cip-project/cip-kernel/cip-kernel-config.git;protocol=https;destsuffix=cip-kernel-config;name=cip-kernel-config"
>>>>
>>>> \
>>>> +    if d.getVar('USE_CIP_KERNEL_CONFIG') == '1' else '' \
>>>> +    }"
>>>> +
>>>> +SRC_URI_append_bbb = "file://${KERNEL_DEFCONFIG}"
>>>> +
>>>>    SRCREV_cip-kernel-config ?=
>>>> "7f2930b9667372f94f2edb42ca9cf6fc6c0aed50"
>>>>
>>>>    S = "${WORKDIR}/linux-cip-v${PV}"
>>>> -- 
>>>> 2.29.2
>>>>
>>>
>>> Quirin
>>
Quirin Gylstorff Jan. 29, 2021, 2:19 p.m. UTC | #5
On 1/29/21 3:18 PM, Jan Kiszka wrote:
> On 29.01.21 13:22, Gylstorff Quirin wrote:
>>
>>
>> On 1/28/21 3:13 PM, Jan Kiszka wrote:
>>> On 25.01.21 19:23, Gylstorff Quirin wrote:
>>>>
>>>>
>>>> On 1/25/21 6:28 PM, Bezdeka, Florian (T RDA IOT SES-DE) wrote:
>>>>> USE_CIP_KERNEL_CONFIG may not be defined in all layers using the
>>>>> isar-cip-core layer, so we end up with the following warnings:
>>>>>
>>>>> WARNING:
>>>>> /work/cip-core/recipes-kernel/linux/linux-cip_4.19.140-cip33.bb:
>>>>> Unable to get checksum for linux-cip SRC_URI entry
>>>>> ${MACHINE}_defconfig: file could not be found
>>>>> WARNING:
>>>>> /work/cip-core/recipes-kernel/linux/linux-cip-rt_4.4.231-cip47-rt30.bb:
>>>>> Unable
>>>>> to get checksum for linux-cip-rt SRC_URI entry ${MACHINE}_defconfig:
>>>>> file could not be found
>>>>> WARNING:
>>>>> /work/cip-core/recipes-kernel/linux/linux-cip_4.4.230-cip47.bb: Unable
>>>>> to get checksum for linux-cip SRC_URI entry ${MACHINE}_defconfig: file
>>>>> could not be found
>>>>> WARNING:
>>>>> /work/cip-core/recipes-kernel/linux/linux-cip-rt_4.19.135-cip31-rt13.bb:
>>>>>
>>>>> Unable to get checksum for linux-cip-rt SRC_URI entry
>>>>> ${MACHINE}_defconfig: file could not be found
>>>>>
>>>>> ${MACHINE}_defconfig needs to be added to SRC_URI only if
>>>>> USE_CIP_KERNEL_CONFIG is set to "1".
>>>>>
>>>>> There is one in-tree machine definition (the bbb) that does not set
>>>>> USE_CIP_KERNEL_CONFIG to "1" but still needs the defconfig added.
>>>>> A machine specific SRC_URI was set to take care of that.
>>>>>
>>>>> Closes #7.
>>>>>
>>>>> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
>>>>> ---
>>>>>
>>>>> Some additional notes:
>>>>>      - That's my first contribution, so review carefully ;-)
>>>>>      - Both branches (master, next) are affected
>>>>>      - The gitlab MR: [1]
>>>>>      - The gitlab issue: [2]
>>>>>
>>>>>      [1]
>>>>> https://gitlab.com/cip-project/cip-core/isar-cip-core/-/merge_requests/10
>>>>>
>>>>>
>>>>>      [2]
>>>>> https://gitlab.com/cip-project/cip-core/isar-cip-core/-/issues/7
>>>>>
>>>>>
>>>>>
>>>>>     recipes-kernel/linux/linux-cip-common.inc | 15 ++++++---------
>>>>>     1 file changed, 6 insertions(+), 9 deletions(-)
>>>>>
>>>>> diff --git a/recipes-kernel/linux/linux-cip-common.inc
>>>>> b/recipes-kernel/linux/linux-cip-common.inc
>>>>> index 6db1d1d..9aca9af 100644
>>>>> --- a/recipes-kernel/linux/linux-cip-common.inc
>>>>> +++ b/recipes-kernel/linux/linux-cip-common.inc
>>>>> @@ -11,21 +11,18 @@
>>>>>
>>>>>     KERNEL_DEFCONFIG ?= "${MACHINE}_defconfig"
>>>>>
>>>>> -def conditional(variable, checkvalue, truevalue, falsevalue, d):
>>>>> -    if d.getVar(variable) == checkvalue:
>>>>> -        return truevalue
>>>>> -    else:
>>>>> -        return falsevalue
>>>>> -
>>>>>     require recipes-kernel/linux/linux-custom.inc
>>>>>
>>>>>     SRC_URI += " \
>>>>>        https://gitlab.com/cip-project/cip-kernel/linux-cip/-/archive/v$
>>>>> \
>>>>>         "
>>>>>
>>>>> -SRC_URI_append = " ${@conditional("USE_CIP_KERNEL_CONFIG", "1", \
>>>>> -
>>>>> "git://gitlab.com/cip-project/cip-kernel/cip-kernel-config.git;protocol=https;destsuffix=cip-kernel-config;name=cip-kernel-config",
>>>>>
>>>>> \
>>>>> -    "file://${KERNEL_DEFCONFIG}",d)}"
>>>> The easier way would have been to delete file://${KERNEL_DEFCONFIG}
>>>> instead of create the logic anew. The conditional function should allow
>>>> an empty string.
>>>
>>> I'm not yet sure which string should be empty and would break with the
>>> new version. Can you elaborate?
>>>
>>> Jan
>>>
>>
>>
>> I will skip the url.
>> You could have written
>>
>> SRC_URI_append =  "${@conditional("USE_CIP_KERNEL_CONFIG",
>> "1","git://...","",d)"
>>
>> instead of
>>
>> SRC_URI_append = "${@ "git://..." if d.getVar('USE_CIP_KERNEL_CONFIG')
>> == '1' else ''}"
>>
>> The result is the same. The second method saves some code in form of a
>> function.
> 
> Means you are fine with Florian's patch? If there are no downsides, I
> would prefer that pattern as well.
> 
> Jan

I'm fine with Florian's patch.

Quirin
> 
>>
>> Quirin
>>>>
>>>>> +SRC_URI_append = "${@
>>>>> "git://gitlab.com/cip-project/cip-kernel/cip-kernel-config.git;protocol=https;destsuffix=cip-kernel-config;name=cip-kernel-config"
>>>>>
>>>>> \
>>>>> +    if d.getVar('USE_CIP_KERNEL_CONFIG') == '1' else '' \
>>>>> +    }"
>>>>> +
>>>>> +SRC_URI_append_bbb = "file://${KERNEL_DEFCONFIG}"
>>>>> +
>>>>>     SRCREV_cip-kernel-config ?=
>>>>> "7f2930b9667372f94f2edb42ca9cf6fc6c0aed50"
>>>>>
>>>>>     S = "${WORKDIR}/linux-cip-v${PV}"
>>>>> -- 
>>>>> 2.29.2
>>>>>
>>>>
>>>> Quirin
>>>
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#6153): https://lists.cip-project.org/g/cip-dev/message/6153
Mute This Topic: https://lists.cip-project.org/mt/80109577/4520388
Group Owner: cip-dev+owner@lists.cip-project.org
Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129055/727948398/xyzzy [cip-dev@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-
diff mbox series

Patch

diff --git a/recipes-kernel/linux/linux-cip-common.inc b/recipes-kernel/linux/linux-cip-common.inc
index 6db1d1d..9aca9af 100644
--- a/recipes-kernel/linux/linux-cip-common.inc
+++ b/recipes-kernel/linux/linux-cip-common.inc
@@ -11,21 +11,18 @@ 
 
 KERNEL_DEFCONFIG ?= "${MACHINE}_defconfig"
 
-def conditional(variable, checkvalue, truevalue, falsevalue, d):
-    if d.getVar(variable) == checkvalue:
-        return truevalue
-    else:
-        return falsevalue
-
 require recipes-kernel/linux/linux-custom.inc
 
 SRC_URI += " \
     https://gitlab.com/cip-project/cip-kernel/linux-cip/-/archive/v${PV}/linux-cip-v${PV}.tar.gz \
     "
 
-SRC_URI_append = " ${@conditional("USE_CIP_KERNEL_CONFIG", "1", \
-    "git://gitlab.com/cip-project/cip-kernel/cip-kernel-config.git;protocol=https;destsuffix=cip-kernel-config;name=cip-kernel-config", \
-    "file://${KERNEL_DEFCONFIG}",d)}"
+SRC_URI_append = " ${@ "git://gitlab.com/cip-project/cip-kernel/cip-kernel-config.git;protocol=https;destsuffix=cip-kernel-config;name=cip-kernel-config" \
+    if d.getVar('USE_CIP_KERNEL_CONFIG') == '1' else '' \
+    }"
+
+SRC_URI_append_bbb = "file://${KERNEL_DEFCONFIG}"
+
 SRCREV_cip-kernel-config ?= "7f2930b9667372f94f2edb42ca9cf6fc6c0aed50"
 
 S = "${WORKDIR}/linux-cip-v${PV}"