bitbake.conf: add ssh-keygen to HOSTTOOLS_NONFATAL

Message ID 20220218073535.5097-1-f_l_k@t-online.de
State New
Headers show
Series bitbake.conf: add ssh-keygen to HOSTTOOLS_NONFATAL | expand

Commit Message

Markus Volk Feb. 18, 2022, 7:35 a.m. UTC
Gnome Seahorse needs an external ssh-keygen to build and there is no provider
for it in yocto/oe. openssh-native is not allowed to build and if allowed there
are problems building it with '--enable-pam'.

'ssh' is already set to be added as a HOSTTOOL when it is found.
This commit also adds ssh-keygen.

Signed-off-by: Markus Volk <f_l_k@t-online.de>
---
 meta/conf/bitbake.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Purdie Feb. 25, 2022, 3:47 p.m. UTC | #1
On Fri, 2022-02-18 at 08:35 +0100, Markus Volk wrote:
> Gnome Seahorse needs an external ssh-keygen to build and there is no provider
> for it in yocto/oe. openssh-native is not allowed to build and if allowed there
> are problems building it with '--enable-pam'.
> 
> 'ssh' is already set to be added as a HOSTTOOL when it is found.
> This commit also adds ssh-keygen.
> 
> Signed-off-by: Markus Volk <f_l_k@t-online.de>
> ---
>  meta/conf/bitbake.conf | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index fba99e8f0c..15ea0bc29e 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -499,7 +499,7 @@ HOSTTOOLS += " \
>  HOSTTOOLS += "${@'ip ping ps scp ssh stty' if (bb.utils.contains_any('IMAGE_CLASSES', 'testimage testsdk', True, False, d) or any(x in (d.getVar("BBINCLUDED") or "") for x in ["testimage.bbclass", "testsdk.bbclass"])) else ''}"
>  
>  # Link to these if present
> -HOSTTOOLS_NONFATAL += "aws gcc-ar gpg gpg-agent ld.bfd ld.gold nc pigz sftp socat ssh sudo"
> +HOSTTOOLS_NONFATAL += "aws gcc-ar gpg gpg-agent ld.bfd ld.gold nc pigz sftp socat ssh ssh-keygen sudo"
>  

Does it actually need to generate keys or is it just checking for the presence
of the tool? I'm not a big fan of adding new tools like this, particularly as
this could still cause a deterministic build issue...

Cheers,

Richard
Markus Volk Feb. 26, 2022, 6:25 a.m. UTC | #2
Am 25.02.22 um 16:47 schrieb Richard Purdie:
> On Fri, 2022-02-18 at 08:35 +0100, Markus Volk wrote:
>> Gnome Seahorse needs an external ssh-keygen to build and there is no provider
>> for it in yocto/oe. openssh-native is not allowed to build and if allowed there
>> are problems building it with '--enable-pam'.
>>
>> 'ssh' is already set to be added as a HOSTTOOL when it is found.
>> This commit also adds ssh-keygen.
>>
>> Signed-off-by: Markus Volk <f_l_k@t-online.de>
>> ---
>>   meta/conf/bitbake.conf | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
>> index fba99e8f0c..15ea0bc29e 100644
>> --- a/meta/conf/bitbake.conf
>> +++ b/meta/conf/bitbake.conf
>> @@ -499,7 +499,7 @@ HOSTTOOLS += " \
>>   HOSTTOOLS += "${@'ip ping ps scp ssh stty' if (bb.utils.contains_any('IMAGE_CLASSES', 'testimage testsdk', True, False, d) or any(x in (d.getVar("BBINCLUDED") or "") for x in ["testimage.bbclass", "testsdk.bbclass"])) else ''}"
>>   
>>   # Link to these if present
>> -HOSTTOOLS_NONFATAL += "aws gcc-ar gpg gpg-agent ld.bfd ld.gold nc pigz sftp socat ssh sudo"
>> +HOSTTOOLS_NONFATAL += "aws gcc-ar gpg gpg-agent ld.bfd ld.gold nc pigz sftp socat ssh ssh-keygen sudo"
>>   
> Does it actually need to generate keys or is it just checking for the presence
> of the tool? I'm not a big fan of adding new tools like this, particularly as
> this could still cause a deterministic build issue...

It looks like there is no need to generate keys. ssh-keygen is only 
looked for to get SSH_KEYGEN_PATH.

https://gitlab.gnome.org/GNOME/seahorse/-/blob/master/meson.build#L48

https://gitlab.gnome.org/GNOME/seahorse/-/blob/master/meson.build#L126

If that Path isn't set compile fails like this:

d -o ssh/libseahorse-ssh.a.p/meson-generated_operation.c.o -c 
ssh/libseahorse-ssh.a.p/operation.c
| ssh/libseahorse-ssh.a.p/operation.c: In function 
'seahorse_ssh_change_passphrase_operation_change_passphrase_async_co':
| ssh/libseahorse-ssh.a.p/operation.c:1834:61: error: 'SSH_KEYGEN_PATH' 
undeclared (first use in this function)
|  1834 |         _data_->_tmp15_ = g_strdup_printf ("%s -p -f '%s'", 
SSH_KEYGEN_PATH, _data_->_tmp14_);
| | ^~~~~~~~~~~~~~~
| ssh/libseahorse-ssh.a.p/operation.c:1834:61: note: each undeclared 
identifier is reported only once for each function it appears in
| ssh/libseahorse-ssh.a.p/operation.c: In function 
'seahorse_ssh_generate_operation_generate_async_co':
| ssh/libseahorse-ssh.a.p/operation.c:2032:75: error: 'SSH_KEYGEN_PATH' 
undeclared (first use in this function)
|  2032 |         _data_->_tmp12_ = g_strdup_printf ("%s %s -t '%s' -C 
%s -f '%s'", SSH_KEYGEN_PATH, _data_->bits_str, _data_->_tmp11_, 
_data_->comment, _data_->filename);
| | ^~~~~~~~~~~~~~~
| ssh/libseahorse-ssh.a.p/operation.c: In function 
'seahorse_ssh_private_import_operation_import_private_async_co':
| ssh/libseahorse-ssh.a.p/operation.c:2299:61: error: 'SSH_KEYGEN_PATH' 
undeclared (first use in this function)
|  2299 |         _data_->_tmp25_ = g_strdup_printf ("%s -y -f '%s'", 
SSH_KEYGEN_PATH, _data_->_tmp24_);

Actually it is not really ideal to derive that  from hosts path. But 
what would be best to do here?

Hack it like this in seahorse.bb?

do_configure:prepend() {
     sed -i "s|ssh_keygen = find_program('ssh-keygen')|#ssh_keygen = 
find_program('ssh-keygen')|" ${S}/meson.build
     sed -i "s|ssh_keygen.path()|'${bindir}/ssh-keygen'|" ${S}/meson.build
}

Patch

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index fba99e8f0c..15ea0bc29e 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -499,7 +499,7 @@  HOSTTOOLS += " \
 HOSTTOOLS += "${@'ip ping ps scp ssh stty' if (bb.utils.contains_any('IMAGE_CLASSES', 'testimage testsdk', True, False, d) or any(x in (d.getVar("BBINCLUDED") or "") for x in ["testimage.bbclass", "testsdk.bbclass"])) else ''}"
 
 # Link to these if present
-HOSTTOOLS_NONFATAL += "aws gcc-ar gpg gpg-agent ld.bfd ld.gold nc pigz sftp socat ssh sudo"
+HOSTTOOLS_NONFATAL += "aws gcc-ar gpg gpg-agent ld.bfd ld.gold nc pigz sftp socat ssh ssh-keygen sudo"
 
 # Temporary add few more detected in bitbake world
 HOSTTOOLS_NONFATAL += "join nl size yes zcat"