[oe-commits] [openembedded-core] 15/17: devtool: deploy-target: Avoid unnecessary dependency on awk on the target

git at git.openembedded.org git at git.openembedded.org
Tue Oct 4 23:19:22 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 7bab454b0bf0075fbb2a5de06286a9da1df2adc6
Author: Peter Kjellerstedt <peter.kjellerstedt at axis.com>
AuthorDate: Fri Sep 30 21:53:40 2016 +0200

    devtool: deploy-target: Avoid unnecessary dependency on awk on the target
    
    Relying 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.
    
    Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt at axis.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 scripts/lib/devtool/deploy.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py
index fb84f2d..c4c7bf6 100644
--- a/scripts/lib/devtool/deploy.py
+++ b/scripts/lib/devtool/deploy.py
@@ -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')

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list