All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] toolchain-shar-relocate.sh: Add check for missing command 'file'
@ 2024-03-16 17:35 Tom Hochstein
  2024-03-21 15:19 ` [OE-core] " Alexandre Belloni
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Hochstein @ 2024-03-16 17:35 UTC (permalink / raw)
  To: openembedded-core; +Cc: Tom Hochstein

On a machine without the file command, the SDK install fails with a
cryptic error message.

```
xargs: file: No such file or directory
sed: no input files
Failed to replace perl. Relocate script failed. Abort!
```

Add a test for 'file' to print a clear error message.

```
The command 'file' is required by the relocation script, please install it first. Abort!
```

Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
---
 meta/files/toolchain-shar-relocate.sh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/meta/files/toolchain-shar-relocate.sh b/meta/files/toolchain-shar-relocate.sh
index e8ab357717..3d55e38102 100644
--- a/meta/files/toolchain-shar-relocate.sh
+++ b/meta/files/toolchain-shar-relocate.sh
@@ -1,7 +1,9 @@
-if ! xargs --version > /dev/null 2>&1; then
-	echo "xargs is required by the relocation script, please install it first. Abort!"
-	exit 1
-fi
+for cmd in xargs file; do
+	if ! command -v $cmd &> /dev/null; then
+		echo "The command '$cmd' is required by the relocation script, please install it first. Abort!"
+		exit 1
+	fi
+done
 
 # fix dynamic loader paths in all ELF SDK binaries
 # allow symlinks to be accessed via the find command too
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH] toolchain-shar-relocate.sh: Add check for missing command 'file'
  2024-03-16 17:35 [PATCH] toolchain-shar-relocate.sh: Add check for missing command 'file' Tom Hochstein
@ 2024-03-21 15:19 ` Alexandre Belloni
  2024-03-21 17:30   ` Tom Hochstein
  0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Belloni @ 2024-03-21 15:19 UTC (permalink / raw)
  To: Tom Hochstein; +Cc: openembedded-core

Hello Tom,

On 16/03/2024 12:35:58-0500, Tom Hochstein wrote:
> On a machine without the file command, the SDK install fails with a
> cryptic error message.
> 
> ```
> xargs: file: No such file or directory
> sed: no input files
> Failed to replace perl. Relocate script failed. Abort!
> ```
> 
> Add a test for 'file' to print a clear error message.
> 
> ```
> The command 'file' is required by the relocation script, please install it first. Abort!
> ```
> 
> Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
> ---
>  meta/files/toolchain-shar-relocate.sh | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/meta/files/toolchain-shar-relocate.sh b/meta/files/toolchain-shar-relocate.sh
> index e8ab357717..3d55e38102 100644
> --- a/meta/files/toolchain-shar-relocate.sh
> +++ b/meta/files/toolchain-shar-relocate.sh
> @@ -1,7 +1,9 @@
> -if ! xargs --version > /dev/null 2>&1; then
> -	echo "xargs is required by the relocation script, please install it first. Abort!"
> -	exit 1
> -fi
> +for cmd in xargs file; do
> +	if ! command -v $cmd &> /dev/null; then

This fails on some of our builders:
https://autobuilder.yoctoproject.org/typhoon/#/builders/20/builds/9148/steps/12/logs/stdio

> +		echo "The command '$cmd' is required by the relocation script, please install it first. Abort!"
> +		exit 1
> +	fi
> +done
>  
>  # fix dynamic loader paths in all ELF SDK binaries
>  # allow symlinks to be accessed via the find command too
> -- 
> 2.25.1
> 

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#197256): https://lists.openembedded.org/g/openembedded-core/message/197256
> Mute This Topic: https://lists.openembedded.org/mt/104970783/3617179
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alexandre.belloni@bootlin.com]
> -=-=-=-=-=-=-=-=-=-=-=-
> 


-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH] toolchain-shar-relocate.sh: Add check for missing command 'file'
  2024-03-21 15:19 ` [OE-core] " Alexandre Belloni
@ 2024-03-21 17:30   ` Tom Hochstein
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Hochstein @ 2024-03-21 17:30 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: openembedded-core

Thanks Alexandre,

On 3/21/2024 10:19 AM, Alexandre Belloni wrote:
> Hello Tom,
>
> On 16/03/2024 12:35:58-0500, Tom Hochstein wrote:
>> On a machine without the file command, the SDK install fails with a
>> cryptic error message.
>>
>> ```
>> xargs: file: No such file or directory
>> sed: no input files
>> Failed to replace perl. Relocate script failed. Abort!
>> ```
>>
>> Add a test for 'file' to print a clear error message.
>>
>> ```
>> The command 'file' is required by the relocation script, please install it first. Abort!
>> ```
>>
>> Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
>> ---
>>   meta/files/toolchain-shar-relocate.sh | 10 ++++++----
>>   1 file changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/meta/files/toolchain-shar-relocate.sh b/meta/files/toolchain-shar-relocate.sh
>> index e8ab357717..3d55e38102 100644
>> --- a/meta/files/toolchain-shar-relocate.sh
>> +++ b/meta/files/toolchain-shar-relocate.sh
>> @@ -1,7 +1,9 @@
>> -if ! xargs --version > /dev/null 2>&1; then
>> -	echo "xargs is required by the relocation script, please install it first. Abort!"
>> -	exit 1
>> -fi
>> +for cmd in xargs file; do
>> +	if ! command -v $cmd &> /dev/null; then
> This fails on some of our builders:
> https://autobuilder.yoctoproject.org/typhoon/#/builders/20/builds/9148/steps/12/logs/stdio

Aha, looks like &> is a bashism. V2 coming.

>
>> +		echo "The command '$cmd' is required by the relocation script, please install it first. Abort!"
>> +		exit 1
>> +	fi
>> +done
>>   
>>   # fix dynamic loader paths in all ELF SDK binaries
>>   # allow symlinks to be accessed via the find command too
>> -- 
>> 2.25.1
>>
>> -=-=-=-=-=-=-=-=-=-=-=-
>> Links: You receive all messages sent to this group.
>> View/Reply Online (#197256): https://lists.openembedded.org/g/openembedded-core/message/197256
>> Mute This Topic: https://lists.openembedded.org/mt/104970783/3617179
>> Group Owner: openembedded-core+owner@lists.openembedded.org
>> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alexandre.belloni@bootlin.com]
>> -=-=-=-=-=-=-=-=-=-=-=-
>>
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-21 17:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-16 17:35 [PATCH] toolchain-shar-relocate.sh: Add check for missing command 'file' Tom Hochstein
2024-03-21 15:19 ` [OE-core] " Alexandre Belloni
2024-03-21 17:30   ` Tom Hochstein

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.