Avoid unnecessary dependency on awk in devtool deploy-target
PATCH 1/1 devtool: deploy-target: Avoid unnecessary dependency on awk on the target
In reply to Peter KjellerstedtRelying on that awk is installed on the target just to extract the fourth column (i.e., the free volume size) from df -P is an unnecessary dependency for devtool deploy-target. As it is already using sed to mangle the output from df -P, this can easily be modified to only extract the free volume size.
--- scripts/lib/devtool/deploy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/lib/devtool/deploy.py +1 -1
@@ -85,7 +85,7 @@ def _prepare_remote_script(deploy, verbose=False, dryrun=False, undeployall=Fals lines.append('do') lines.append(' checkpath=`dirname "$checkpath"`') lines.append('done') - lines.append('freespace=`df -P $checkpath | sed "1d" | awk \'{ print $4 }\'`') + lines.append(r'freespace=$(df -P $checkpath | sed -nre "s/^(\S+\s+){3}([0-9]+).*/\2/p")') # First line of the file is the total space lines.append('total=`head -n1 $3`') lines.append('if [ $total -gt $freespace ] ; then')
Signature · 1 line
2.9.0
cover Avoid unnecessary dependency on awk in devtool deploy-target
After updating to Krogoth, our developers were faced with the following error message when using devtool deploy-target:
/tmp/devtool_deploy.sh: line 23: awk: not found
This is of course due to the fact that we do not have awk installed in our products. However, the use of awk in devtool deploy-target is completely unnecessary. It is already using sed, and sed is fully capable of extracting the information that awk was used for.
//Peter
The following changes since commit a75b79a9e9d76db8f75af64c3792c7a1bbfd15b8:
genericx86-64.conf: Add SERIAL_CONSOLES_CHECK = "ttyS0" (2016-09-30 16:52:22 +0100)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib pkj/devtool-minus-awk
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=pkj/devtool-minus-awk
Peter Kjellerstedt (1):
devtool: deploy-target: Avoid unnecessary dependency on awk on the
target
scripts/lib/devtool/deploy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.9.0
Quoted 6 lines · Peter Kjellerstedt
After updating to Krogoth, our developers were faced with the following error message when using devtool deploy-target:
Quoted 6 lines
/tmp/devtool_deploy.sh: line 23: awk: not foundThis is of course due to the fact that we do not have awk installed in our products. However, the use of awk in devtool deploy-target is completely unnecessary. It is already using sed, and sed is fully capable of extracting the information that awk was used for.
sed or awk both are individual packages, some other user may complain they don't have sed installed. it would be good to know if we document this dependency for using devtool.
Quoted 27 lines
//Peter
The following changes since commit
a75b79a9e9d76db8f75af64c3792c7a1bbfd15b8:genericx86-64.conf: Add
SERIAL_CONSOLES_CHECK= "ttyS0" (2016-09-30 16:52:22 +0100)are available in the git repository at:
git://git.yoctoproject.org/poky-contribpkj/devtool-minus-awk
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=pkj/devtool-minus-awkPeter Kjellerstedt (1):
devtool: deploy-target: Avoid unnecessary dependency on awk on the
target
scripts/lib/devtool/deploy.py| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)--
2.9.0--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Quoted 16 lines
-----Original Message-----
From: Khem Raj [mailto:[email protected]]
Sent: den 3 oktober 2016 01:47
To: Peter Kjellerstedt
Cc: [email protected]
Subject: Re: [OE-core] [PATCH 0/1] Avoid unnecessary dependency on awk in devtool deploy-targetQuoted 8 lines
On Sep 30, 2016, at 12:53 PM, Peter Kjellerstedt
<[email protected]> wrote:After updating to Krogoth, our developers were faced with the following error message when using devtool deploy-target:
/tmp/devtool_deploy.sh: line 23: awk: not found
Quoted 10 lines
Quoted 4 lines
This is of course due to the fact that we do not have awk installed in our products. However, the use of awk in devtool deploy-target is completely unnecessary. It is already using sed, and sed is fully capable of extracting the information that awk was used for.
sed or awk both are individual packages, some other user may complain they don't have sed installed. it would be good to know if we document this dependency for using devtool.
Quoted 1 line
//Peter
I find it much less likely to have a system without sed than awk, but you are right that the dependencies should be documented somewhere, unless they already are... After my fix, devtool deploy requires the following commands: cat (can be replaced by letting sed read the file itself), df, dirname (can be replaced with a parameter expansion), find, head (can be replaced with sed), mkdir, mv, rm, rmdir, sed, sh and tar.
//Peter