[meta-swupdate] Fix DEPENDS in swupdate recipe for building against mbedTLS
diff mbox series

Message ID 0683a7bf-1142-456d-b47d-ce6c259b41ca@googlegroups.com
State New
Headers show
Series
  • [meta-swupdate] Fix DEPENDS in swupdate recipe for building against mbedTLS
Related show

Commit Message

Alexander Vickberg Dec. 3, 2019, 7:44 a.m. UTC
Signed-off-by: Alexander Vickberg <wickbergster@gmail.com>
---
 recipes-support/swupdate/swupdate.inc        |  4 ----
 recipes-support/swupdate/swupdate_2019.04.bb | 21 +++++++++++++++++
 recipes-support/swupdate/swupdate_2019.11.bb | 24 ++++++++++++++++++++
 recipes-support/swupdate/swupdate_git.bb     | 24 ++++++++++++++++++++
 4 files changed, 69 insertions(+), 4 deletions(-)

Comments

Alexander Vickberg Dec. 3, 2019, 7:46 a.m. UTC | #1
I want to use swupdate with mbedTLS in my Yocto project. Could we merge 
something like this? It's not beautiful but when the 2019.04 recipe gets 
removed this can be done in swupdate.inc.
Stefano Babic Dec. 3, 2019, 9:04 a.m. UTC | #2
Hi Alexander,

On 03/12/19 08:44, Alexander Vickberg wrote:
> Signed-off-by: Alexander Vickberg <wickbergster@gmail.com>
> ---
>  recipes-support/swupdate/swupdate.inc        |  4 ----
>  recipes-support/swupdate/swupdate_2019.04.bb | 21 +++++++++++++++++
>  recipes-support/swupdate/swupdate_2019.11.bb | 24 ++++++++++++++++++++
>  recipes-support/swupdate/swupdate_git.bb     | 24 ++++++++++++++++++++
>  4 files changed, 69 insertions(+), 4 deletions(-)
> 
> diff --git a/recipes-support/swupdate/swupdate.inc
> b/recipes-support/swupdate/swupdate.inc
> index 700d5a1..bc0980c 100644
> --- a/recipes-support/swupdate/swupdate.inc
> +++ b/recipes-support/swupdate/swupdate.inc
> @@ -96,10 +96,6 @@ python () {
>          depends = d.getVar('DEPENDS', False)
>          d.setVar('DEPENDS', depends + ' zeromq')
>  
> -    if 'CONFIG_ENCRYPTED_IMAGES=y\n' in features or
> 'CONFIG_MONGOOSESSL=y\n' in features or 'CONFIG_HASH_VERIFY=y\n' in
> features or 'CONFIG_SURICATTA_SSL=y\n' in features:
> -        depends = d.getVar('DEPENDS', False)
> -        d.setVar('DEPENDS', depends + ' openssl')
> -
>      if 'CONFIG_JSON=y\n' in features:
>          depends = d.getVar('DEPENDS', False)
>          d.setVar('DEPENDS', depends + ' json-c')
> diff --git a/recipes-support/swupdate/swupdate_2019.04.bb
> b/recipes-support/swupdate/swupdate_2019.04.bb
> index 9d1528e..cda11a1 100644
> --- a/recipes-support/swupdate/swupdate_2019.04.bb
> +++ b/recipes-support/swupdate/swupdate_2019.04.bb
> @@ -9,3 +9,24 @@ do_install_append () {
>      test -f ${D}${bindir}/hawkbitcfg && mv ${D}${bindir}/hawkbitcfg
> ${D}${bindir}/swupdate-hawkbitcfg
>      test -f ${D}${bindir}/sendtohawkbit && mv
> ${D}${bindir}/sendtohawkbit ${D}${bindir}/swupdate-sendtohawkbit
>  }
> +
> +python () {
> +    try:
> +        defconfig = bb.fetch2.localpath('file://defconfig', d)
> +    except bb.fetch2.FetchError:
> +        return
> +
> +    try:
> +        configfile = open(defconfig)
> +    except IOError:
> +        return
> +
> +    features = configfile.readlines()
> +    configfile.close()
> +
> +    depends = d.getVar('DEPENDS', False)
> +    if 'CONFIG_ENCRYPTED_IMAGES=y\n' in features or
> 'CONFIG_MONGOOSESSL=y\n' in features or 'CONFIG_HASH_VERIFY=y\n' in
> features or 'CONFIG_SURICATTA_SSL=y\n' in features:
> +        depends += ' openssl'
> +
> +    d.setVar('DEPENDS', depends)
> +}

Why is the test outside of the main anonymous python function ? Why do
we need to duplicate the test for each recipe ? This is bad.

Please note: 2019.04 has no support for mbedTLS. This means that the
defoconfig that is parsed does not have CONFIG_SSL_IMPL_MBEDTLS set, and
if the test is done for 2019.04, too, has no effect.

> diff --git a/recipes-support/swupdate/swupdate_2019.11.bb
> b/recipes-support/swupdate/swupdate_2019.11.bb
> index 1cce343..f9372c1 100644
> --- a/recipes-support/swupdate/swupdate_2019.11.bb
> +++ b/recipes-support/swupdate/swupdate_2019.11.bb
> @@ -1,3 +1,27 @@
>  require swupdate.inc
>  
>  SRCREV = "5de3bc30a203ee218f9ebbe256b42e26cf06c74f"
> +
> +python () {
> +    try:
> +        defconfig = bb.fetch2.localpath('file://defconfig', d)
> +    except bb.fetch2.FetchError:
> +        return

This is wrong. It does not work with fragments, "bitbake -c menuconfig"
(or diffconfig) gets broken. NAK.

IMHO it is ok to put the simple test inside the anonymous python
function. If 2019.04 will be a big issue, it is ok on -master and -zeus
to drop 2019.04.

Best regards,
Stefano Babic

> +
> +    try:
> +        configfile = open(defconfig)
> +    except IOError:
> +        return
> +
> +    features = configfile.readlines()
> +    configfile.close()
> +
> +    depends = d.getVar('DEPENDS', False)
> +    if 'CONFIG_SSL_IMPL_OPENSSL=y\n' in features:
> +        depends += ' openssl'
> +
> +    if 'CONFIG_SSL_IMPL_MBEDTLS=y\n' in features:
> +        depends += ' mbedtls'
> +
> +    d.setVar('DEPENDS', depends)
> +}
> diff --git a/recipes-support/swupdate/swupdate_git.bb
> b/recipes-support/swupdate/swupdate_git.bb
> index 50d47cd..e73b394 100644
> --- a/recipes-support/swupdate/swupdate_git.bb
> +++ b/recipes-support/swupdate/swupdate_git.bb
> @@ -4,3 +4,27 @@ DEFAULT_PREFERENCE = "-1"
>  
>  SRCREV ?= "e9df70498e604febf6ff9d56ce742522094cebd5"
>  PV = "2019.04+git${SRCPV}"
> +
> +python () {
> +    try:
> +        defconfig = bb.fetch2.localpath('file://defconfig', d)
> +    except bb.fetch2.FetchError:
> +        return
> +
> +    try:
> +        configfile = open(defconfig)
> +    except IOError:
> +        return
> +
> +    features = configfile.readlines()
> +    configfile.close()
> +
> +    depends = d.getVar('DEPENDS', False)
> +    if 'CONFIG_SSL_IMPL_OPENSSL=y\n' in features:
> +        depends += ' openssl'
> +
> +    if 'CONFIG_SSL_IMPL_MBEDTLS=y\n' in features:
> +        depends += ' mbedtls'
> +
> +    d.setVar('DEPENDS', depends)
> +}
> -- 
> 2.17.1
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swupdate+unsubscribe@googlegroups.com
> <mailto:swupdate+unsubscribe@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/swupdate/0683a7bf-1142-456d-b47d-ce6c259b41ca%40googlegroups.com
> <https://groups.google.com/d/msgid/swupdate/0683a7bf-1142-456d-b47d-ce6c259b41ca%40googlegroups.com?utm_medium=email&utm_source=footer>.
Alexander Vickberg Dec. 3, 2019, 9:35 a.m. UTC | #3
Den tisdag 3 december 2019 kl. 10:04:34 UTC+1 skrev Stefano Babic:
>
> Hi Alexander, 
>
> On 03/12/19 08:44, Alexander Vickberg wrote: 
> > Signed-off-by: Alexander Vickberg <wickbe...@gmail.com <javascript:>> 
> > --- 
> >  recipes-support/swupdate/swupdate.inc        |  4 ---- 
> >  recipes-support/swupdate/swupdate_2019.04.bb | 21 +++++++++++++++++ 
> >  recipes-support/swupdate/swupdate_2019.11.bb | 24 ++++++++++++++++++++ 
> >  recipes-support/swupdate/swupdate_git.bb     | 24 ++++++++++++++++++++ 
> >  4 files changed, 69 insertions(+), 4 deletions(-) 
> > 
> > diff --git a/recipes-support/swupdate/swupdate.inc 
> > b/recipes-support/swupdate/swupdate.inc 
> > index 700d5a1..bc0980c 100644 
> > --- a/recipes-support/swupdate/swupdate.inc 
> > +++ b/recipes-support/swupdate/swupdate.inc 
> > @@ -96,10 +96,6 @@ python () { 
> >          depends = d.getVar('DEPENDS', False) 
> >          d.setVar('DEPENDS', depends + ' zeromq') 
> >   
> > -    if 'CONFIG_ENCRYPTED_IMAGES=y\n' in features or 
> > 'CONFIG_MONGOOSESSL=y\n' in features or 'CONFIG_HASH_VERIFY=y\n' in 
> > features or 'CONFIG_SURICATTA_SSL=y\n' in features: 
> > -        depends = d.getVar('DEPENDS', False) 
> > -        d.setVar('DEPENDS', depends + ' openssl') 
> > - 
> >      if 'CONFIG_JSON=y\n' in features: 
> >          depends = d.getVar('DEPENDS', False) 
> >          d.setVar('DEPENDS', depends + ' json-c') 
> > diff --git a/recipes-support/swupdate/swupdate_2019.04.bb 
> > b/recipes-support/swupdate/swupdate_2019.04.bb 
> > index 9d1528e..cda11a1 100644 
> > --- a/recipes-support/swupdate/swupdate_2019.04.bb 
> > +++ b/recipes-support/swupdate/swupdate_2019.04.bb 
> > @@ -9,3 +9,24 @@ do_install_append () { 
> >      test -f ${D}${bindir}/hawkbitcfg && mv ${D}${bindir}/hawkbitcfg 
> > ${D}${bindir}/swupdate-hawkbitcfg 
> >      test -f ${D}${bindir}/sendtohawkbit && mv 
> > ${D}${bindir}/sendtohawkbit ${D}${bindir}/swupdate-sendtohawkbit 
> >  } 
> > + 
> > +python () { 
> > +    try: 
> > +        defconfig = bb.fetch2.localpath('file://defconfig', d) 
> > +    except bb.fetch2.FetchError: 
> > +        return 
> > + 
> > +    try: 
> > +        configfile = open(defconfig) 
> > +    except IOError: 
> > +        return 
> > + 
> > +    features = configfile.readlines() 
> > +    configfile.close() 
> > + 
> > +    depends = d.getVar('DEPENDS', False) 
> > +    if 'CONFIG_ENCRYPTED_IMAGES=y\n' in features or 
> > 'CONFIG_MONGOOSESSL=y\n' in features or 'CONFIG_HASH_VERIFY=y\n' in 
> > features or 'CONFIG_SURICATTA_SSL=y\n' in features: 
> > +        depends += ' openssl' 
> > + 
> > +    d.setVar('DEPENDS', depends) 
> > +} 
>
> Why is the test outside of the main anonymous python function ? Why do 
> we need to duplicate the test for each recipe ? This is bad. 
>
> Please note: 2019.04 has no support for mbedTLS. This means that the 
> defoconfig that is parsed does not have CONFIG_SSL_IMPL_MBEDTLS set, and 
> if the test is done for 2019.04, too, has no effect. 


I am aware of this. The test is different for 2019.04.

>  
>
> diff --git a/recipes-support/swupdate/swupdate_2019.11.bb 
> > b/recipes-support/swupdate/swupdate_2019.11.bb 
> > index 1cce343..f9372c1 100644 
> > --- a/recipes-support/swupdate/swupdate_2019.11.bb 
> > +++ b/recipes-support/swupdate/swupdate_2019.11.bb 
> > @@ -1,3 +1,27 @@ 
> >  require swupdate.inc 
> >   
> >  SRCREV = "5de3bc30a203ee218f9ebbe256b42e26cf06c74f" 
> > + 
> > +python () { 
> > +    try: 
> > +        defconfig = bb.fetch2.localpath('file://defconfig', d) 
> > +    except bb.fetch2.FetchError: 
> > +        return 
>
> This is wrong. It does not work with fragments, "bitbake -c menuconfig" 
> (or diffconfig) gets broken. NAK. 
>
> IMHO it is ok to put the simple test inside the anonymous python 
> function. If 2019.04 will be a big issue, it is ok on -master and -zeus 
> to drop 2019.04. 
>
 
I have already stepped on that mine. Diffconfig is already broken as is. 
All I did was trying to extend current behavior. I can do a v2 with either 
a check for ${PV} in swupdate.inc (if possible) or dropping 2019.04 recipe.

>
> Best regards, 
> Stefano Babic 
>
> > + 
> > +    try: 
> > +        configfile = open(defconfig) 
> > +    except IOError: 
> > +        return 
> > + 
> > +    features = configfile.readlines() 
> > +    configfile.close() 
> > + 
> > +    depends = d.getVar('DEPENDS', False) 
> > +    if 'CONFIG_SSL_IMPL_OPENSSL=y\n' in features: 
> > +        depends += ' openssl' 
> > + 
> > +    if 'CONFIG_SSL_IMPL_MBEDTLS=y\n' in features: 
> > +        depends += ' mbedtls' 
> > + 
> > +    d.setVar('DEPENDS', depends) 
> > +} 
> > diff --git a/recipes-support/swupdate/swupdate_git.bb 
> > b/recipes-support/swupdate/swupdate_git.bb 
> > index 50d47cd..e73b394 100644 
> > --- a/recipes-support/swupdate/swupdate_git.bb 
> > +++ b/recipes-support/swupdate/swupdate_git.bb 
> > @@ -4,3 +4,27 @@ DEFAULT_PREFERENCE = "-1" 
> >   
> >  SRCREV ?= "e9df70498e604febf6ff9d56ce742522094cebd5" 
> >  PV = "2019.04+git${SRCPV}" 
> > + 
> > +python () { 
> > +    try: 
> > +        defconfig = bb.fetch2.localpath('file://defconfig', d) 
> > +    except bb.fetch2.FetchError: 
> > +        return 
> > + 
> > +    try: 
> > +        configfile = open(defconfig) 
> > +    except IOError: 
> > +        return 
> > + 
> > +    features = configfile.readlines() 
> > +    configfile.close() 
> > + 
> > +    depends = d.getVar('DEPENDS', False) 
> > +    if 'CONFIG_SSL_IMPL_OPENSSL=y\n' in features: 
> > +        depends += ' openssl' 
> > + 
> > +    if 'CONFIG_SSL_IMPL_MBEDTLS=y\n' in features: 
> > +        depends += ' mbedtls' 
> > + 
> > +    d.setVar('DEPENDS', depends) 
> > +} 
> > --  
> > 2.17.1 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "swupdate" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> > an email to swup...@googlegroups.com <javascript:> 
> > <mailto:swup...@googlegroups.com <javascript:>>. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/swupdate/0683a7bf-1142-456d-b47d-ce6c259b41ca%40googlegroups.com 
> > <
> https://groups.google.com/d/msgid/swupdate/0683a7bf-1142-456d-b47d-ce6c259b41ca%40googlegroups.com?utm_medium=email&utm_source=footer>. 
>
>
> -- 
> ===================================================================== 
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk 
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany 
> Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de 
> <javascript:> 
> ===================================================================== 
>
Stefano Babic Dec. 3, 2019, 9:46 a.m. UTC | #4
On 03/12/19 10:35, Alexander Vickberg wrote:
> 
> 
> Den tisdag 3 december 2019 kl. 10:04:34 UTC+1 skrev Stefano Babic:
> 
>     Hi Alexander,
> 
>     On 03/12/19 08:44, Alexander Vickberg wrote:
>     > Signed-off-by: Alexander Vickberg <wickbe...@gmail.com <javascript:>>
>     > ---
>     >  recipes-support/swupdate/swupdate.inc        |  4 ----
>     >  recipes-support/swupdate/swupdate_2019.04.bb
>     <http://swupdate_2019.04.bb> | 21 +++++++++++++++++
>     >  recipes-support/swupdate/swupdate_2019.11.bb
>     <http://swupdate_2019.11.bb> | 24 ++++++++++++++++++++
>     >  recipes-support/swupdate/swupdate_git.bb
>     <http://swupdate_git.bb>     | 24 ++++++++++++++++++++
>     >  4 files changed, 69 insertions(+), 4 deletions(-)
>     >
>     > diff --git a/recipes-support/swupdate/swupdate.inc
>     > b/recipes-support/swupdate/swupdate.inc
>     > index 700d5a1..bc0980c 100644
>     > --- a/recipes-support/swupdate/swupdate.inc
>     > +++ b/recipes-support/swupdate/swupdate.inc
>     > @@ -96,10 +96,6 @@ python () {
>     >          depends = d.getVar('DEPENDS', False)
>     >          d.setVar('DEPENDS', depends + ' zeromq')
>     >  
>     > -    if 'CONFIG_ENCRYPTED_IMAGES=y\n' in features or
>     > 'CONFIG_MONGOOSESSL=y\n' in features or 'CONFIG_HASH_VERIFY=y\n' in
>     > features or 'CONFIG_SURICATTA_SSL=y\n' in features:
>     > -        depends = d.getVar('DEPENDS', False)
>     > -        d.setVar('DEPENDS', depends + ' openssl')
>     > -
>     >      if 'CONFIG_JSON=y\n' in features:
>     >          depends = d.getVar('DEPENDS', False)
>     >          d.setVar('DEPENDS', depends + ' json-c')
>     > diff --git a/recipes-support/swupdate/swupdate_2019.04.bb
>     <http://swupdate_2019.04.bb>
>     > b/recipes-support/swupdate/swupdate_2019.04.bb
>     <http://swupdate_2019.04.bb>
>     > index 9d1528e..cda11a1 100644
>     > --- a/recipes-support/swupdate/swupdate_2019.04.bb
>     <http://swupdate_2019.04.bb>
>     > +++ b/recipes-support/swupdate/swupdate_2019.04.bb
>     <http://swupdate_2019.04.bb>
>     > @@ -9,3 +9,24 @@ do_install_append () {
>     >      test -f ${D}${bindir}/hawkbitcfg && mv ${D}${bindir}/hawkbitcfg
>     > ${D}${bindir}/swupdate-hawkbitcfg
>     >      test -f ${D}${bindir}/sendtohawkbit && mv
>     > ${D}${bindir}/sendtohawkbit ${D}${bindir}/swupdate-sendtohawkbit
>     >  }
>     > +
>     > +python () {
>     > +    try:
>     > +        defconfig = bb.fetch2.localpath('file://defconfig', d)
>     > +    except bb.fetch2.FetchError:
>     > +        return
>     > +
>     > +    try:
>     > +        configfile = open(defconfig)
>     > +    except IOError:
>     > +        return
>     > +
>     > +    features = configfile.readlines()
>     > +    configfile.close()
>     > +
>     > +    depends = d.getVar('DEPENDS', False)
>     > +    if 'CONFIG_ENCRYPTED_IMAGES=y\n' in features or
>     > 'CONFIG_MONGOOSESSL=y\n' in features or 'CONFIG_HASH_VERIFY=y\n' in
>     > features or 'CONFIG_SURICATTA_SSL=y\n' in features:
>     > +        depends += ' openssl'
>     > +
>     > +    d.setVar('DEPENDS', depends)
>     > +}
> 
>     Why is the test outside of the main anonymous python function ? Why do
>     we need to duplicate the test for each recipe ? This is bad.
> 
>     Please note: 2019.04 has no support for mbedTLS. This means that the
>     defoconfig that is parsed does not have CONFIG_SSL_IMPL_MBEDTLS set,
>     and
>     if the test is done for 2019.04, too, has no effect. 
> 
> 
> I am aware of this. The test is different for 2019.04.
> 

But why not:
	 if 'CONFIG_SSL_IMPL_OPENSSL=y\n' in features:
		depends += ' openssl'
	elif 'CONFIG_SSL_IMPL_MBEDTLS=y\n' in features:
		depends += ' mbedtls'
	elif if 'CONFIG_ENCRYPTED_IMAGES=y\n' in features or
'CONFIG_MONGOOSESSL=y\n' in features or 'CONFIG_HASH_VERIFY=y\n' in
features or 'CONFIG_SURICATTA_SSL=y\n' in features:
		depends += ' openssl'

It seems to me that this can work on both 2019.04 and 2019.11

>      
> 
>     > diff --git a/recipes-support/swupdate/swupdate_2019.11.bb
>     <http://swupdate_2019.11.bb>
>     > b/recipes-support/swupdate/swupdate_2019.11.bb
>     <http://swupdate_2019.11.bb>
>     > index 1cce343..f9372c1 100644
>     > --- a/recipes-support/swupdate/swupdate_2019.11.bb
>     <http://swupdate_2019.11.bb>
>     > +++ b/recipes-support/swupdate/swupdate_2019.11.bb
>     <http://swupdate_2019.11.bb>
>     > @@ -1,3 +1,27 @@
>     >  require swupdate.inc
>     >  
>     >  SRCREV = "5de3bc30a203ee218f9ebbe256b42e26cf06c74f"
>     > +
>     > +python () {
>     > +    try:
>     > +        defconfig = bb.fetch2.localpath('file://defconfig', d)
>     > +    except bb.fetch2.FetchError:
>     > +        return
> 
>     This is wrong. It does not work with fragments, "bitbake -c menuconfig"
>     (or diffconfig) gets broken. NAK.
> 
>     IMHO it is ok to put the simple test inside the anonymous python
>     function. If 2019.04 will be a big issue, it is ok on -master and -zeus
>     to drop 2019.04.
> 
>  
> I have already stepped on that mine. Diffconfig is already broken as is.

???

I am not aware of it. Is it really broken ? But again, if it is broken,
it should be fixed instead of going on to let it broken.

> All I did was trying to extend current behavior. I can do a v2 with
> either a check for ${PV} in swupdate.inc (if possible) or dropping
> 2019.04 recipe.

See above.

Best regards,
Stefano Babic

> 
> 
>     Best regards,
>     Stefano Babic
> 
>     > +
>     > +    try:
>     > +        configfile = open(defconfig)
>     > +    except IOError:
>     > +        return
>     > +
>     > +    features = configfile.readlines()
>     > +    configfile.close()
>     > +
>     > +    depends = d.getVar('DEPENDS', False)
>     > +    if 'CONFIG_SSL_IMPL_OPENSSL=y\n' in features:
>     > +        depends += ' openssl'
>     > +
>     > +    if 'CONFIG_SSL_IMPL_MBEDTLS=y\n' in features:
>     > +        depends += ' mbedtls'
>     > +
>     > +    d.setVar('DEPENDS', depends)
>     > +}
>     > diff --git a/recipes-support/swupdate/swupdate_git.bb
>     <http://swupdate_git.bb>
>     > b/recipes-support/swupdate/swupdate_git.bb <http://swupdate_git.bb>
>     > index 50d47cd..e73b394 100644
>     > --- a/recipes-support/swupdate/swupdate_git.bb
>     <http://swupdate_git.bb>
>     > +++ b/recipes-support/swupdate/swupdate_git.bb
>     <http://swupdate_git.bb>
>     > @@ -4,3 +4,27 @@ DEFAULT_PREFERENCE = "-1"
>     >  
>     >  SRCREV ?= "e9df70498e604febf6ff9d56ce742522094cebd5"
>     >  PV = "2019.04+git${SRCPV}"
>     > +
>     > +python () {
>     > +    try:
>     > +        defconfig = bb.fetch2.localpath('file://defconfig', d)
>     > +    except bb.fetch2.FetchError:
>     > +        return
>     > +
>     > +    try:
>     > +        configfile = open(defconfig)
>     > +    except IOError:
>     > +        return
>     > +
>     > +    features = configfile.readlines()
>     > +    configfile.close()
>     > +
>     > +    depends = d.getVar('DEPENDS', False)
>     > +    if 'CONFIG_SSL_IMPL_OPENSSL=y\n' in features:
>     > +        depends += ' openssl'
>     > +
>     > +    if 'CONFIG_SSL_IMPL_MBEDTLS=y\n' in features:
>     > +        depends += ' mbedtls'
>     > +
>     > +    d.setVar('DEPENDS', depends)
>     > +}
>     > -- 
>     > 2.17.1
>     >
>     > --
>     > You received this message because you are subscribed to the Google
>     > Groups "swupdate" group.
>     > To unsubscribe from this group and stop receiving emails from it,
>     send
>     > an email to swup...@googlegroups.com <javascript:>
>     > <mailto:swup...@googlegroups.com <javascript:>>.
>     > To view this discussion on the web visit
>     >
>     https://groups.google.com/d/msgid/swupdate/0683a7bf-1142-456d-b47d-ce6c259b41ca%40googlegroups.com
>     <https://groups.google.com/d/msgid/swupdate/0683a7bf-1142-456d-b47d-ce6c259b41ca%40googlegroups.com>
> 
>     >
>     <https://groups.google.com/d/msgid/swupdate/0683a7bf-1142-456d-b47d-ce6c259b41ca%40googlegroups.com?utm_medium=email&utm_source=footer
>     <https://groups.google.com/d/msgid/swupdate/0683a7bf-1142-456d-b47d-ce6c259b41ca%40googlegroups.com?utm_medium=email&utm_source=footer>>.
> 
> 
>     -- 
>     =====================================================================
>     DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
>     HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
>     Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email:
>     sba...@denx.de <javascript:>
>     =====================================================================
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swupdate+unsubscribe@googlegroups.com
> <mailto:swupdate+unsubscribe@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/swupdate/fa28d569-8cff-4319-882b-841692445638%40googlegroups.com
> <https://groups.google.com/d/msgid/swupdate/fa28d569-8cff-4319-882b-841692445638%40googlegroups.com?utm_medium=email&utm_source=footer>.
Alexander Vickberg Dec. 3, 2019, 10:01 a.m. UTC | #5
Den tisdag 3 december 2019 kl. 10:46:26 UTC+1 skrev Stefano Babic:
>
> On 03/12/19 10:35, Alexander Vickberg wrote: 
> > 
> > 
> > Den tisdag 3 december 2019 kl. 10:04:34 UTC+1 skrev Stefano Babic: 
> > 
> >     Hi Alexander, 
> > 
> >     On 03/12/19 08:44, Alexander Vickberg wrote: 
> >     > Signed-off-by: Alexander Vickberg <wickbe...@gmail.com 
> <javascript:>> 
> >     > --- 
> >     >  recipes-support/swupdate/swupdate.inc        |  4 ---- 
> >     >  recipes-support/swupdate/swupdate_2019.04.bb 
> >     <http://swupdate_2019.04.bb> | 21 +++++++++++++++++ 
> >     >  recipes-support/swupdate/swupdate_2019.11.bb 
> >     <http://swupdate_2019.11.bb> | 24 ++++++++++++++++++++ 
> >     >  recipes-support/swupdate/swupdate_git.bb 
> >     <http://swupdate_git.bb>     | 24 ++++++++++++++++++++ 
> >     >  4 files changed, 69 insertions(+), 4 deletions(-) 
> >     > 
> >     > diff --git a/recipes-support/swupdate/swupdate.inc 
> >     > b/recipes-support/swupdate/swupdate.inc 
> >     > index 700d5a1..bc0980c 100644 
> >     > --- a/recipes-support/swupdate/swupdate.inc 
> >     > +++ b/recipes-support/swupdate/swupdate.inc 
> >     > @@ -96,10 +96,6 @@ python () { 
> >     >          depends = d.getVar('DEPENDS', False) 
> >     >          d.setVar('DEPENDS', depends + ' zeromq') 
> >     >   
> >     > -    if 'CONFIG_ENCRYPTED_IMAGES=y\n' in features or 
> >     > 'CONFIG_MONGOOSESSL=y\n' in features or 'CONFIG_HASH_VERIFY=y\n' 
> in 
> >     > features or 'CONFIG_SURICATTA_SSL=y\n' in features: 
> >     > -        depends = d.getVar('DEPENDS', False) 
> >     > -        d.setVar('DEPENDS', depends + ' openssl') 
> >     > - 
> >     >      if 'CONFIG_JSON=y\n' in features: 
> >     >          depends = d.getVar('DEPENDS', False) 
> >     >          d.setVar('DEPENDS', depends + ' json-c') 
> >     > diff --git a/recipes-support/swupdate/swupdate_2019.04.bb 
> >     <http://swupdate_2019.04.bb> 
> >     > b/recipes-support/swupdate/swupdate_2019.04.bb 
> >     <http://swupdate_2019.04.bb> 
> >     > index 9d1528e..cda11a1 100644 
> >     > --- a/recipes-support/swupdate/swupdate_2019.04.bb 
> >     <http://swupdate_2019.04.bb> 
> >     > +++ b/recipes-support/swupdate/swupdate_2019.04.bb 
> >     <http://swupdate_2019.04.bb> 
> >     > @@ -9,3 +9,24 @@ do_install_append () { 
> >     >      test -f ${D}${bindir}/hawkbitcfg && mv 
> ${D}${bindir}/hawkbitcfg 
> >     > ${D}${bindir}/swupdate-hawkbitcfg 
> >     >      test -f ${D}${bindir}/sendtohawkbit && mv 
> >     > ${D}${bindir}/sendtohawkbit ${D}${bindir}/swupdate-sendtohawkbit 
> >     >  } 
> >     > + 
> >     > +python () { 
> >     > +    try: 
> >     > +        defconfig = bb.fetch2.localpath('file://defconfig', d) 
> >     > +    except bb.fetch2.FetchError: 
> >     > +        return 
> >     > + 
> >     > +    try: 
> >     > +        configfile = open(defconfig) 
> >     > +    except IOError: 
> >     > +        return 
> >     > + 
> >     > +    features = configfile.readlines() 
> >     > +    configfile.close() 
> >     > + 
> >     > +    depends = d.getVar('DEPENDS', False) 
> >     > +    if 'CONFIG_ENCRYPTED_IMAGES=y\n' in features or 
> >     > 'CONFIG_MONGOOSESSL=y\n' in features or 'CONFIG_HASH_VERIFY=y\n' 
> in 
> >     > features or 'CONFIG_SURICATTA_SSL=y\n' in features: 
> >     > +        depends += ' openssl' 
> >     > + 
> >     > +    d.setVar('DEPENDS', depends) 
> >     > +} 
> > 
> >     Why is the test outside of the main anonymous python function ? Why 
> do 
> >     we need to duplicate the test for each recipe ? This is bad. 
> > 
> >     Please note: 2019.04 has no support for mbedTLS. This means that the 
> >     defoconfig that is parsed does not have CONFIG_SSL_IMPL_MBEDTLS set, 
> >     and 
> >     if the test is done for 2019.04, too, has no effect.  
> > 
> > 
> > I am aware of this. The test is different for 2019.04. 
> > 
>
> But why not: 
>          if 'CONFIG_SSL_IMPL_OPENSSL=y\n' in features: 
>                 depends += ' openssl' 
>         elif 'CONFIG_SSL_IMPL_MBEDTLS=y\n' in features: 
>                 depends += ' mbedtls' 
>         elif if 'CONFIG_ENCRYPTED_IMAGES=y\n' in features or 
> 'CONFIG_MONGOOSESSL=y\n' in features or 'CONFIG_HASH_VERIFY=y\n' in 
> features or 'CONFIG_SURICATTA_SSL=y\n' in features: 
>                 depends += ' openssl' 
>
> It seems to me that this can work on both 2019.04 and 2019.11 
>

Looks good to me. Please commit.


> >       
> > 
> >     > diff --git a/recipes-support/swupdate/swupdate_2019.11.bb 
> >     <http://swupdate_2019.11.bb> 
> >     > b/recipes-support/swupdate/swupdate_2019.11.bb 
> >     <http://swupdate_2019.11.bb> 
> >     > index 1cce343..f9372c1 100644 
> >     > --- a/recipes-support/swupdate/swupdate_2019.11.bb 
> >     <http://swupdate_2019.11.bb> 
> >     > +++ b/recipes-support/swupdate/swupdate_2019.11.bb 
> >     <http://swupdate_2019.11.bb> 
> >     > @@ -1,3 +1,27 @@ 
> >     >  require swupdate.inc 
> >     >   
> >     >  SRCREV = "5de3bc30a203ee218f9ebbe256b42e26cf06c74f" 
> >     > + 
> >     > +python () { 
> >     > +    try: 
> >     > +        defconfig = bb.fetch2.localpath('file://defconfig', d) 
> >     > +    except bb.fetch2.FetchError: 
> >     > +        return 
> > 
> >     This is wrong. It does not work with fragments, "bitbake -c 
> menuconfig" 
> >     (or diffconfig) gets broken. NAK. 
> > 
> >     IMHO it is ok to put the simple test inside the anonymous python 
> >     function. If 2019.04 will be a big issue, it is ok on -master and 
> -zeus 
> >     to drop 2019.04. 
> > 
> >   
> > I have already stepped on that mine. Diffconfig is already broken as is. 
>
> ??? 
>
> I am not aware of it. Is it really broken ? But again, if it is broken, 
> it should be fixed instead of going on to let it broken. 
>

This should be discussed in another thread. If I can reproduce my previous 
issues I'll post again.

> All I did was trying to extend current behavior. I can do a v2 with 
> > either a check for ${PV} in swupdate.inc (if possible) or dropping 
> > 2019.04 recipe. 
>
> See above. 
>
> Best regards, 
> Stefano Babic 
>
> > 
> > 
> >     Best regards, 
> >     Stefano Babic 
> > 
> >     > + 
> >     > +    try: 
> >     > +        configfile = open(defconfig) 
> >     > +    except IOError: 
> >     > +        return 
> >     > + 
> >     > +    features = configfile.readlines() 
> >     > +    configfile.close() 
> >     > + 
> >     > +    depends = d.getVar('DEPENDS', False) 
> >     > +    if 'CONFIG_SSL_IMPL_OPENSSL=y\n' in features: 
> >     > +        depends += ' openssl' 
> >     > + 
> >     > +    if 'CONFIG_SSL_IMPL_MBEDTLS=y\n' in features: 
> >     > +        depends += ' mbedtls' 
> >     > + 
> >     > +    d.setVar('DEPENDS', depends) 
> >     > +} 
> >     > diff --git a/recipes-support/swupdate/swupdate_git.bb 
> >     <http://swupdate_git.bb> 
> >     > b/recipes-support/swupdate/swupdate_git.bb <http://swupdate_git.bb> 
>
> >     > index 50d47cd..e73b394 100644 
> >     > --- a/recipes-support/swupdate/swupdate_git.bb 
> >     <http://swupdate_git.bb> 
> >     > +++ b/recipes-support/swupdate/swupdate_git.bb 
> >     <http://swupdate_git.bb> 
> >     > @@ -4,3 +4,27 @@ DEFAULT_PREFERENCE = "-1" 
> >     >   
> >     >  SRCREV ?= "e9df70498e604febf6ff9d56ce742522094cebd5" 
> >     >  PV = "2019.04+git${SRCPV}" 
> >     > + 
> >     > +python () { 
> >     > +    try: 
> >     > +        defconfig = bb.fetch2.localpath('file://defconfig', d) 
> >     > +    except bb.fetch2.FetchError: 
> >     > +        return 
> >     > + 
> >     > +    try: 
> >     > +        configfile = open(defconfig) 
> >     > +    except IOError: 
> >     > +        return 
> >     > + 
> >     > +    features = configfile.readlines() 
> >     > +    configfile.close() 
> >     > + 
> >     > +    depends = d.getVar('DEPENDS', False) 
> >     > +    if 'CONFIG_SSL_IMPL_OPENSSL=y\n' in features: 
> >     > +        depends += ' openssl' 
> >     > + 
> >     > +    if 'CONFIG_SSL_IMPL_MBEDTLS=y\n' in features: 
> >     > +        depends += ' mbedtls' 
> >     > + 
> >     > +    d.setVar('DEPENDS', depends) 
> >     > +} 
> >     > --  
> >     > 2.17.1 
> >     > 
> >     > -- 
> >     > You received this message because you are subscribed to the Google 
> >     > Groups "swupdate" group. 
> >     > To unsubscribe from this group and stop receiving emails from it, 
> >     send 
> >     > an email to swup...@googlegroups.com <javascript:> 
> >     > <mailto:swup...@googlegroups.com <javascript:>>. 
> >     > To view this discussion on the web visit 
> >     > 
> >     
> https://groups.google.com/d/msgid/swupdate/0683a7bf-1142-456d-b47d-ce6c259b41ca%40googlegroups.com 
> >     <
> https://groups.google.com/d/msgid/swupdate/0683a7bf-1142-456d-b47d-ce6c259b41ca%40googlegroups.com> 
>
> > 
> >     > 
> >     <
> https://groups.google.com/d/msgid/swupdate/0683a7bf-1142-456d-b47d-ce6c259b41ca%40googlegroups.com?utm_medium=email&utm_source=footer 
> >     <
> https://groups.google.com/d/msgid/swupdate/0683a7bf-1142-456d-b47d-ce6c259b41ca%40googlegroups.com?utm_medium=email&utm_source=footer>>. 
>
> > 
> > 
> >     -- 
> >     
> ===================================================================== 
> >     DENX Software Engineering GmbH,      Managing Director: Wolfgang 
> Denk 
> >     HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, 
> Germany 
> >     Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: 
> >     sba...@denx.de <javascript:> 
> >     
> ===================================================================== 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "swupdate" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> > an email to swup...@googlegroups.com <javascript:> 
> > <mailto:swup...@googlegroups.com <javascript:>>. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/swupdate/fa28d569-8cff-4319-882b-841692445638%40googlegroups.com 
> > <
> https://groups.google.com/d/msgid/swupdate/fa28d569-8cff-4319-882b-841692445638%40googlegroups.com?utm_medium=email&utm_source=footer>. 
>
>
>
> -- 
> ===================================================================== 
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk 
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany 
> Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de 
> <javascript:> 
> ===================================================================== 
>
Alexander Vickberg Dec. 3, 2019, 6:10 p.m. UTC | #6
Hi,

I realized that the reason this worked at all is because I used my own 
defconfig in another meta-layer where I have a bbappend file. This will not 
work if trying to use mbedTLS from a fragment. It seems this will need a 
different approach.

Best regards
Alexander Vickberg

Den tisdag 3 december 2019 kl. 11:01:58 UTC+1 skrev Alexander Vickberg:
>
>
>
> Den tisdag 3 december 2019 kl. 10:46:26 UTC+1 skrev Stefano Babic:
>>
>> On 03/12/19 10:35, Alexander Vickberg wrote: 
>> > 
>> > 
>> > Den tisdag 3 december 2019 kl. 10:04:34 UTC+1 skrev Stefano Babic: 
>> > 
>> >     Hi Alexander, 
>> > 
>> >     On 03/12/19 08:44, Alexander Vickberg wrote: 
>> >     > Signed-off-by: Alexander Vickberg <wickbe...@gmail.com 
>> <javascript:>> 
>> >     > --- 
>> >     >  recipes-support/swupdate/swupdate.inc        |  4 ---- 
>> >     >  recipes-support/swupdate/swupdate_2019.04.bb 
>> >     <http://swupdate_2019.04.bb> | 21 +++++++++++++++++ 
>> >     >  recipes-support/swupdate/swupdate_2019.11.bb 
>> >     <http://swupdate_2019.11.bb> | 24 ++++++++++++++++++++ 
>> >     >  recipes-support/swupdate/swupdate_git.bb 
>> >     <http://swupdate_git.bb>     | 24 ++++++++++++++++++++ 
>> >     >  4 files changed, 69 insertions(+), 4 deletions(-) 
>> >     > 
>> >     > diff --git a/recipes-support/swupdate/swupdate.inc 
>> >     > b/recipes-support/swupdate/swupdate.inc 
>> >     > index 700d5a1..bc0980c 100644 
>> >     > --- a/recipes-support/swupdate/swupdate.inc 
>> >     > +++ b/recipes-support/swupdate/swupdate.inc 
>> >     > @@ -96,10 +96,6 @@ python () { 
>> >     >          depends = d.getVar('DEPENDS', False) 
>> >     >          d.setVar('DEPENDS', depends + ' zeromq') 
>> >     >   
>> >     > -    if 'CONFIG_ENCRYPTED_IMAGES=y\n' in features or 
>> >     > 'CONFIG_MONGOOSESSL=y\n' in features or 'CONFIG_HASH_VERIFY=y\n' 
>> in 
>> >     > features or 'CONFIG_SURICATTA_SSL=y\n' in features: 
>> >     > -        depends = d.getVar('DEPENDS', False) 
>> >     > -        d.setVar('DEPENDS', depends + ' openssl') 
>> >     > - 
>> >     >      if 'CONFIG_JSON=y\n' in features: 
>> >     >          depends = d.getVar('DEPENDS', False) 
>> >     >          d.setVar('DEPENDS', depends + ' json-c') 
>> >     > diff --git a/recipes-support/swupdate/swupdate_2019.04.bb 
>> >     <http://swupdate_2019.04.bb> 
>> >     > b/recipes-support/swupdate/swupdate_2019.04.bb 
>> >     <http://swupdate_2019.04.bb> 
>> >     > index 9d1528e..cda11a1 100644 
>> >     > --- a/recipes-support/swupdate/swupdate_2019.04.bb 
>> >     <http://swupdate_2019.04.bb> 
>> >     > +++ b/recipes-support/swupdate/swupdate_2019.04.bb 
>> >     <http://swupdate_2019.04.bb> 
>> >     > @@ -9,3 +9,24 @@ do_install_append () { 
>> >     >      test -f ${D}${bindir}/hawkbitcfg && mv 
>> ${D}${bindir}/hawkbitcfg 
>> >     > ${D}${bindir}/swupdate-hawkbitcfg 
>> >     >      test -f ${D}${bindir}/sendtohawkbit && mv 
>> >     > ${D}${bindir}/sendtohawkbit ${D}${bindir}/swupdate-sendtohawkbit 
>> >     >  } 
>> >     > + 
>> >     > +python () { 
>> >     > +    try: 
>> >     > +        defconfig = bb.fetch2.localpath('file://defconfig', d) 
>> >     > +    except bb.fetch2.FetchError: 
>> >     > +        return 
>> >     > + 
>> >     > +    try: 
>> >     > +        configfile = open(defconfig) 
>> >     > +    except IOError: 
>> >     > +        return 
>> >     > + 
>> >     > +    features = configfile.readlines() 
>> >     > +    configfile.close() 
>> >     > + 
>> >     > +    depends = d.getVar('DEPENDS', False) 
>> >     > +    if 'CONFIG_ENCRYPTED_IMAGES=y\n' in features or 
>> >     > 'CONFIG_MONGOOSESSL=y\n' in features or 'CONFIG_HASH_VERIFY=y\n' 
>> in 
>> >     > features or 'CONFIG_SURICATTA_SSL=y\n' in features: 
>> >     > +        depends += ' openssl' 
>> >     > + 
>> >     > +    d.setVar('DEPENDS', depends) 
>> >     > +} 
>> > 
>> >     Why is the test outside of the main anonymous python function ? Why 
>> do 
>> >     we need to duplicate the test for each recipe ? This is bad. 
>> > 
>> >     Please note: 2019.04 has no support for mbedTLS. This means that 
>> the 
>> >     defoconfig that is parsed does not have CONFIG_SSL_IMPL_MBEDTLS 
>> set, 
>> >     and 
>> >     if the test is done for 2019.04, too, has no effect.  
>> > 
>> > 
>> > I am aware of this. The test is different for 2019.04. 
>> > 
>>
>> But why not: 
>>          if 'CONFIG_SSL_IMPL_OPENSSL=y\n' in features: 
>>                 depends += ' openssl' 
>>         elif 'CONFIG_SSL_IMPL_MBEDTLS=y\n' in features: 
>>                 depends += ' mbedtls' 
>>         elif if 'CONFIG_ENCRYPTED_IMAGES=y\n' in features or 
>> 'CONFIG_MONGOOSESSL=y\n' in features or 'CONFIG_HASH_VERIFY=y\n' in 
>> features or 'CONFIG_SURICATTA_SSL=y\n' in features: 
>>                 depends += ' openssl' 
>>
>> It seems to me that this can work on both 2019.04 and 2019.11 
>>
>
> Looks good to me. Please commit.
>
>
>> >       
>> > 
>> >     > diff --git a/recipes-support/swupdate/swupdate_2019.11.bb 
>> >     <http://swupdate_2019.11.bb> 
>> >     > b/recipes-support/swupdate/swupdate_2019.11.bb 
>> >     <http://swupdate_2019.11.bb> 
>> >     > index 1cce343..f9372c1 100644 
>> >     > --- a/recipes-support/swupdate/swupdate_2019.11.bb 
>> >     <http://swupdate_2019.11.bb> 
>> >     > +++ b/recipes-support/swupdate/swupdate_2019.11.bb 
>> >     <http://swupdate_2019.11.bb> 
>> >     > @@ -1,3 +1,27 @@ 
>> >     >  require swupdate.inc 
>> >     >   
>> >     >  SRCREV = "5de3bc30a203ee218f9ebbe256b42e26cf06c74f" 
>> >     > + 
>> >     > +python () { 
>> >     > +    try: 
>> >     > +        defconfig = bb.fetch2.localpath('file://defconfig', d) 
>> >     > +    except bb.fetch2.FetchError: 
>> >     > +        return 
>> > 
>> >     This is wrong. It does not work with fragments, "bitbake -c 
>> menuconfig" 
>> >     (or diffconfig) gets broken. NAK. 
>> > 
>> >     IMHO it is ok to put the simple test inside the anonymous python 
>> >     function. If 2019.04 will be a big issue, it is ok on -master and 
>> -zeus 
>> >     to drop 2019.04. 
>> > 
>> >   
>> > I have already stepped on that mine. Diffconfig is already broken as 
>> is. 
>>
>> ??? 
>>
>> I am not aware of it. Is it really broken ? But again, if it is broken, 
>> it should be fixed instead of going on to let it broken. 
>>
>
> This should be discussed in another thread. If I can reproduce my previous 
> issues I'll post again.
>
> > All I did was trying to extend current behavior. I can do a v2 with 
>> > either a check for ${PV} in swupdate.inc (if possible) or dropping 
>> > 2019.04 recipe. 
>>
>> See above. 
>>
>> Best regards, 
>> Stefano Babic 
>>
>> > 
>> > 
>> >     Best regards, 
>> >     Stefano Babic 
>> > 
>> >     > + 
>> >     > +    try: 
>> >     > +        configfile = open(defconfig) 
>> >     > +    except IOError: 
>> >     > +        return 
>> >     > + 
>> >     > +    features = configfile.readlines() 
>> >     > +    configfile.close() 
>> >     > + 
>> >     > +    depends = d.getVar('DEPENDS', False) 
>> >     > +    if 'CONFIG_SSL_IMPL_OPENSSL=y\n' in features: 
>> >     > +        depends += ' openssl' 
>> >     > + 
>> >     > +    if 'CONFIG_SSL_IMPL_MBEDTLS=y\n' in features: 
>> >     > +        depends += ' mbedtls' 
>> >     > + 
>> >     > +    d.setVar('DEPENDS', depends) 
>> >     > +} 
>> >     > diff --git a/recipes-support/swupdate/swupdate_git.bb 
>> >     <http://swupdate_git.bb> 
>> >     > b/recipes-support/swupdate/swupdate_git.bb <
>> http://swupdate_git.bb> 
>> >     > index 50d47cd..e73b394 100644 
>> >     > --- a/recipes-support/swupdate/swupdate_git.bb 
>> >     <http://swupdate_git.bb> 
>> >     > +++ b/recipes-support/swupdate/swupdate_git.bb 
>> >     <http://swupdate_git.bb> 
>> >     > @@ -4,3 +4,27 @@ DEFAULT_PREFERENCE = "-1" 
>> >     >   
>> >     >  SRCREV ?= "e9df70498e604febf6ff9d56ce742522094cebd5" 
>> >     >  PV = "2019.04+git${SRCPV}" 
>> >     > + 
>> >     > +python () { 
>> >     > +    try: 
>> >     > +        defconfig = bb.fetch2.localpath('file://defconfig', d) 
>> >     > +    except bb.fetch2.FetchError: 
>> >     > +        return 
>> >     > + 
>> >     > +    try: 
>> >     > +        configfile = open(defconfig) 
>> >     > +    except IOError: 
>> >     > +        return 
>> >     > + 
>> >     > +    features = configfile.readlines() 
>> >     > +    configfile.close() 
>> >     > + 
>> >     > +    depends = d.getVar('DEPENDS', False) 
>> >     > +    if 'CONFIG_SSL_IMPL_OPENSSL=y\n' in features: 
>> >     > +        depends += ' openssl' 
>> >     > + 
>> >     > +    if 'CONFIG_SSL_IMPL_MBEDTLS=y\n' in features: 
>> >     > +        depends += ' mbedtls' 
>> >     > + 
>> >     > +    d.setVar('DEPENDS', depends) 
>> >     > +} 
>> >     > --  
>> >     > 2.17.1 
>> >     > 
>> >     > -- 
>> >     > You received this message because you are subscribed to the 
>> Google 
>> >     > Groups "swupdate" group. 
>> >     > To unsubscribe from this group and stop receiving emails from it, 
>> >     send 
>> >     > an email to swup...@googlegroups.com <javascript:> 
>> >     > <mailto:swup...@googlegroups.com <javascript:>>. 
>> >     > To view this discussion on the web visit 
>> >     > 
>> >     
>> https://groups.google.com/d/msgid/swupdate/0683a7bf-1142-456d-b47d-ce6c259b41ca%40googlegroups.com 
>> >     <
>> https://groups.google.com/d/msgid/swupdate/0683a7bf-1142-456d-b47d-ce6c259b41ca%40googlegroups.com> 
>>
>> > 
>> >     > 
>> >     <
>> https://groups.google.com/d/msgid/swupdate/0683a7bf-1142-456d-b47d-ce6c259b41ca%40googlegroups.com?utm_medium=email&utm_source=footer 
>> >     <
>> https://groups.google.com/d/msgid/swupdate/0683a7bf-1142-456d-b47d-ce6c259b41ca%40googlegroups.com?utm_medium=email&utm_source=footer>>. 
>>
>> > 
>> > 
>> >     -- 
>> >     
>> ===================================================================== 
>> >     DENX Software Engineering GmbH,      Managing Director: Wolfgang 
>> Denk 
>> >     HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, 
>> Germany 
>> >     Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: 
>> >     sba...@denx.de <javascript:> 
>> >     
>> ===================================================================== 
>> > 
>> > -- 
>> > You received this message because you are subscribed to the Google 
>> > Groups "swupdate" group. 
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> > an email to swup...@googlegroups.com 
>> > <mailto:swup...@googlegroups.com>. 
>> > To view this discussion on the web visit 
>> > 
>> https://groups.google.com/d/msgid/swupdate/fa28d569-8cff-4319-882b-841692445638%40googlegroups.com 
>> > <
>> https://groups.google.com/d/msgid/swupdate/fa28d569-8cff-4319-882b-841692445638%40googlegroups.com?utm_medium=email&utm_source=footer>. 
>>
>>
>>
>> -- 
>> ===================================================================== 
>> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk 
>> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany 
>> Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de 
>> ===================================================================== 
>>
>

Patch
diff mbox series

diff --git a/recipes-support/swupdate/swupdate.inc 
b/recipes-support/swupdate/swupdate.inc
index 700d5a1..bc0980c 100644
--- a/recipes-support/swupdate/swupdate.inc
+++ b/recipes-support/swupdate/swupdate.inc
@@ -96,10 +96,6 @@  python () {
         depends = d.getVar('DEPENDS', False)
         d.setVar('DEPENDS', depends + ' zeromq')
 
-    if 'CONFIG_ENCRYPTED_IMAGES=y\n' in features or 
'CONFIG_MONGOOSESSL=y\n' in features or 'CONFIG_HASH_VERIFY=y\n' in 
features or 'CONFIG_SURICATTA_SSL=y\n' in features:
-        depends = d.getVar('DEPENDS', False)
-        d.setVar('DEPENDS', depends + ' openssl')
-
     if 'CONFIG_JSON=y\n' in features:
         depends = d.getVar('DEPENDS', False)
         d.setVar('DEPENDS', depends + ' json-c')
diff --git a/recipes-support/swupdate/swupdate_2019.04.bb 
b/recipes-support/swupdate/swupdate_2019.04.bb
index 9d1528e..cda11a1 100644
--- a/recipes-support/swupdate/swupdate_2019.04.bb
+++ b/recipes-support/swupdate/swupdate_2019.04.bb
@@ -9,3 +9,24 @@  do_install_append () {
     test -f ${D}${bindir}/hawkbitcfg && mv ${D}${bindir}/hawkbitcfg 
${D}${bindir}/swupdate-hawkbitcfg
     test -f ${D}${bindir}/sendtohawkbit && mv ${D}${bindir}/sendtohawkbit 
${D}${bindir}/swupdate-sendtohawkbit
 }
+
+python () {
+    try:
+        defconfig = bb.fetch2.localpath('file://defconfig', d)
+    except bb.fetch2.FetchError:
+        return
+
+    try:
+        configfile = open(defconfig)
+    except IOError:
+        return
+
+    features = configfile.readlines()
+    configfile.close()
+
+    depends = d.getVar('DEPENDS', False)
+    if 'CONFIG_ENCRYPTED_IMAGES=y\n' in features or 
'CONFIG_MONGOOSESSL=y\n' in features or 'CONFIG_HASH_VERIFY=y\n' in 
features or 'CONFIG_SURICATTA_SSL=y\n' in features:
+        depends += ' openssl'
+
+    d.setVar('DEPENDS', depends)
+}
diff --git a/recipes-support/swupdate/swupdate_2019.11.bb 
b/recipes-support/swupdate/swupdate_2019.11.bb
index 1cce343..f9372c1 100644
--- a/recipes-support/swupdate/swupdate_2019.11.bb
+++ b/recipes-support/swupdate/swupdate_2019.11.bb
@@ -1,3 +1,27 @@ 
 require swupdate.inc
 
 SRCREV = "5de3bc30a203ee218f9ebbe256b42e26cf06c74f"
+
+python () {
+    try:
+        defconfig = bb.fetch2.localpath('file://defconfig', d)
+    except bb.fetch2.FetchError:
+        return
+
+    try:
+        configfile = open(defconfig)
+    except IOError:
+        return
+
+    features = configfile.readlines()
+    configfile.close()
+
+    depends = d.getVar('DEPENDS', False)
+    if 'CONFIG_SSL_IMPL_OPENSSL=y\n' in features:
+        depends += ' openssl'
+
+    if 'CONFIG_SSL_IMPL_MBEDTLS=y\n' in features:
+        depends += ' mbedtls'
+
+    d.setVar('DEPENDS', depends)
+}
diff --git a/recipes-support/swupdate/swupdate_git.bb 
b/recipes-support/swupdate/swupdate_git.bb
index 50d47cd..e73b394 100644
--- a/recipes-support/swupdate/swupdate_git.bb
+++ b/recipes-support/swupdate/swupdate_git.bb
@@ -4,3 +4,27 @@  DEFAULT_PREFERENCE = "-1"
 
 SRCREV ?= "e9df70498e604febf6ff9d56ce742522094cebd5"
 PV = "2019.04+git${SRCPV}"
+
+python () {
+    try:
+        defconfig = bb.fetch2.localpath('file://defconfig', d)
+    except bb.fetch2.FetchError:
+        return
+
+    try:
+        configfile = open(defconfig)
+    except IOError:
+        return
+
+    features = configfile.readlines()
+    configfile.close()
+
+    depends = d.getVar('DEPENDS', False)
+    if 'CONFIG_SSL_IMPL_OPENSSL=y\n' in features:
+        depends += ' openssl'
+
+    if 'CONFIG_SSL_IMPL_MBEDTLS=y\n' in features:
+        depends += ' mbedtls'
+
+    d.setVar('DEPENDS', depends)
+}