Re: [OE-core] [PATCH v3 4/4] devtool: deploy-target: Support stripped libs and execs

2017-08-24 Thread Tobias Hagelborn

On 06/21/2017 12:09 PM, Jussi Kukkonen wrote:



On 20 June 2017 at 10:42, Tobias Hagelborn > wrote:

 >
 > New devtool deploy-target option --strip which enables deploying
 > stripped binaries, saving some space on target.
 >
 > * Copies the files of ${D} into a new directory and strips them in place
 > * Used oe.package.strip_execs for stripping directory
 > * Added devtool.conf option "strip" for changing default behavior
 >
 > Config example:
 > [Deploy]
 > strip = true
 >
 > [YOCTO #11227]
 >
 > Signed-off-by: Tobias Hagelborn >

 > ---
 >  scripts/lib/devtool/deploy.py | 32 
 >  1 file changed, 28 insertions(+), 4 deletions(-)
 >
 > diff --git a/scripts/lib/devtool/deploy.py 
b/scripts/lib/devtool/deploy.py

 > index 04c34cb..96b877e 100644
 > --- a/scripts/lib/devtool/deploy.py
 > +++ b/scripts/lib/devtool/deploy.py
 > @@ -16,12 +16,16 @@
 >  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 >  """Devtool plugin containing the deploy subcommands"""
 >
 > +import logging
 >  import os
 > +import shutil
 >  import subprocess
 > -import logging
 >  import tempfile
 > -import shutil
 > +
 > +import bb.utils
 >  import argparse_oe
 > +import oe
 > +
 >  from devtool import exec_fakeroot, setup_tinfoil, 
check_workspace_recipe, DevtoolError

 >
 >  logger = logging.getLogger('devtool')
 > @@ -140,9 +144,9 @@ def _prepare_remote_script(deploy, verbose=False, 
dryrun=False, undeployall=Fals

 >  return '\n'.join(lines)
 >
 >
 > +
 >  def deploy(args, config, basepath, workspace):
 >  """Entry point for the devtool 'deploy' subcommand"""
 > -import re
 >  import math
 >  import oe.recipeutils
 >
 > @@ -170,6 +174,17 @@ def deploy(args, config, basepath, workspace):
 >  'recipe? If so, the install step has not 
installed '

 >  'any files.' % args.recipename)
 >
 > +if args.strip and not args.dry_run:
 > +# Fakeroot copy to new destination
 > +srcdir = recipe_outdir
 > +recipe_outdir = os.path.join(rd.getVar('WORKDIR', True), 
'deploy-target-stripped')

 > +if os.path.isdir(recipe_outdir):
 > +bb.utils.remove(recipe_outdir, True)
 > +exec_fakeroot(rd, "cp -af %s %s" % (os.path.join(srcdir, 
'.'), recipe_outdir), shell=True)
 > +os.environ['PATH'] = ':'.join([os.environ['PATH'], 
rd.getVar('PATH', True) or ''])
 > +oe.package.strip_execs(args.recipename, recipe_outdir, 
rd.getVar('STRIP', True), rd.getVar('libdir', True),

 > +rd.getVar('base_libdir', True))
 > +
 >  filelist = []
 >  ftotalsize = 0
 >  for root, _, files in os.walk(recipe_outdir):
 > @@ -189,7 +204,6 @@ def deploy(args, config, basepath, workspace):
 >  print('  %s' % item)
 >  return 0
 >
 > -
 >  extraoptions = ''
 >  if args.no_host_check:
 >  extraoptions += '-o UserKnownHostsFile=/dev/null -o 
StrictHostKeyChecking=no'

 > @@ -301,6 +315,7 @@ def undeploy(args, config, basepath, workspace):
 >
 >  def register_commands(subparsers, context):
 >  """Register devtool subcommands from the deploy plugin"""
 > +
 >  parser_deploy = subparsers.add_parser('deploy-target',
 >help='Deploy recipe output 
files to live target machine',
 >description='Deploys a 
recipe\'s build output (i.e. the output of the do_install task) to a 
live target machine over ssh. By default, any existing files will be 
preserved instead of being overwritten and will be restored if you run 
devtool undeploy-target. Note: this only deploys the recipe itself and 
not any runtime dependencies, so it is assumed that those have been 
installed on the target beforehand.',

 > @@ -313,6 +328,15 @@ def register_commands(subparsers, context):
 >  parser_deploy.add_argument('-p', '--no-preserve', help='Do not 
preserve existing files', action='store_true')
 >  parser_deploy.add_argument('--no-check-space', help='Do not 
check for available space before deploying', action='store_true')
 >  parser_deploy.add_argument('-P', '--port', default='22', 
help='Port to use for connection to the target')

 > +
 > +strip_opts = 
parser_deploy.add_mutually_exclusive_group(required=False)

 > +strip_opts.add_argument('-S', '--strip',
 > +   help='Strip executables prior to 
deploying (default: %(default)s). '
 > +'The default value of this 
option can be controlled by setting the strip option in the [Deploy] 
section to True or False.',
 > +   
default=oe.types.boolean(context.config.get('Deploy', 'strip', 
default='0')),

 > +  

Re: [OE-core] [PATCH v3 4/4] devtool: deploy-target: Support stripped libs and execs

2017-06-21 Thread Jussi Kukkonen
On 20 June 2017 at 10:42, Tobias Hagelborn 
wrote:
>
> New devtool deploy-target option --strip which enables deploying
> stripped binaries, saving some space on target.
>
> * Copies the files of ${D} into a new directory and strips them in place
> * Used oe.package.strip_execs for stripping directory
> * Added devtool.conf option "strip" for changing default behavior
>
> Config example:
> [Deploy]
> strip = true
>
> [YOCTO #11227]
>
> Signed-off-by: Tobias Hagelborn 
> ---
>  scripts/lib/devtool/deploy.py | 32 
>  1 file changed, 28 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py
> index 04c34cb..96b877e 100644
> --- a/scripts/lib/devtool/deploy.py
> +++ b/scripts/lib/devtool/deploy.py
> @@ -16,12 +16,16 @@
>  # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
>  """Devtool plugin containing the deploy subcommands"""
>
> +import logging
>  import os
> +import shutil
>  import subprocess
> -import logging
>  import tempfile
> -import shutil
> +
> +import bb.utils
>  import argparse_oe
> +import oe
> +
>  from devtool import exec_fakeroot, setup_tinfoil,
check_workspace_recipe, DevtoolError
>
>  logger = logging.getLogger('devtool')
> @@ -140,9 +144,9 @@ def _prepare_remote_script(deploy, verbose=False,
dryrun=False, undeployall=Fals
>  return '\n'.join(lines)
>
>
> +
>  def deploy(args, config, basepath, workspace):
>  """Entry point for the devtool 'deploy' subcommand"""
> -import re
>  import math
>  import oe.recipeutils
>
> @@ -170,6 +174,17 @@ def deploy(args, config, basepath, workspace):
>  'recipe? If so, the install step has not
installed '
>  'any files.' % args.recipename)
>
> +if args.strip and not args.dry_run:
> +# Fakeroot copy to new destination
> +srcdir = recipe_outdir
> +recipe_outdir = os.path.join(rd.getVar('WORKDIR', True),
'deploy-target-stripped')
> +if os.path.isdir(recipe_outdir):
> +bb.utils.remove(recipe_outdir, True)
> +exec_fakeroot(rd, "cp -af %s %s" % (os.path.join(srcdir,
'.'), recipe_outdir), shell=True)
> +os.environ['PATH'] = ':'.join([os.environ['PATH'],
rd.getVar('PATH', True) or ''])
> +oe.package.strip_execs(args.recipename, recipe_outdir,
rd.getVar('STRIP', True), rd.getVar('libdir', True),
> +rd.getVar('base_libdir', True))
> +
>  filelist = []
>  ftotalsize = 0
>  for root, _, files in os.walk(recipe_outdir):
> @@ -189,7 +204,6 @@ def deploy(args, config, basepath, workspace):
>  print('  %s' % item)
>  return 0
>
> -
>  extraoptions = ''
>  if args.no_host_check:
>  extraoptions += '-o UserKnownHostsFile=/dev/null -o
StrictHostKeyChecking=no'
> @@ -301,6 +315,7 @@ def undeploy(args, config, basepath, workspace):
>
>  def register_commands(subparsers, context):
>  """Register devtool subcommands from the deploy plugin"""
> +
>  parser_deploy = subparsers.add_parser('deploy-target',
>help='Deploy recipe output
files to live target machine',
>description='Deploys a
recipe\'s build output (i.e. the output of the do_install task) to a live
target machine over ssh. By default, any existing files will be preserved
instead of being overwritten and will be restored if you run devtool
undeploy-target. Note: this only deploys the recipe itself and not any
runtime dependencies, so it is assumed that those have been installed on
the target beforehand.',
> @@ -313,6 +328,15 @@ def register_commands(subparsers, context):
>  parser_deploy.add_argument('-p', '--no-preserve', help='Do not
preserve existing files', action='store_true')
>  parser_deploy.add_argument('--no-check-space', help='Do not check
for available space before deploying', action='store_true')
>  parser_deploy.add_argument('-P', '--port', default='22', help='Port
to use for connection to the target')
> +
> +strip_opts =
parser_deploy.add_mutually_exclusive_group(required=False)
> +strip_opts.add_argument('-S', '--strip',
> +   help='Strip executables prior to
deploying (default: %(default)s). '
> +'The default value of this option
can be controlled by setting the strip option in the [Deploy] section to
True or False.',
> +
default=oe.types.boolean(context.config.get('Deploy', 'strip',
default='0')),
> +   action='store_true')

Autobuilder is complaining about this:

Exception: bb.process.ExecutionError: Execution of 'devtool --bbpath

[OE-core] [PATCH v3 4/4] devtool: deploy-target: Support stripped libs and execs

2017-06-20 Thread Tobias Hagelborn
New devtool deploy-target option --strip which enables deploying
stripped binaries, saving some space on target.

* Copies the files of ${D} into a new directory and strips them in place
* Used oe.package.strip_execs for stripping directory
* Added devtool.conf option "strip" for changing default behavior

Config example:
[Deploy]
strip = true

[YOCTO #11227]

Signed-off-by: Tobias Hagelborn 
---
 scripts/lib/devtool/deploy.py | 32 
 1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py
index 04c34cb..96b877e 100644
--- a/scripts/lib/devtool/deploy.py
+++ b/scripts/lib/devtool/deploy.py
@@ -16,12 +16,16 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 """Devtool plugin containing the deploy subcommands"""
 
+import logging
 import os
+import shutil
 import subprocess
-import logging
 import tempfile
-import shutil
+
+import bb.utils
 import argparse_oe
+import oe
+
 from devtool import exec_fakeroot, setup_tinfoil, check_workspace_recipe, 
DevtoolError
 
 logger = logging.getLogger('devtool')
@@ -140,9 +144,9 @@ def _prepare_remote_script(deploy, verbose=False, 
dryrun=False, undeployall=Fals
 return '\n'.join(lines)
 
 
+
 def deploy(args, config, basepath, workspace):
 """Entry point for the devtool 'deploy' subcommand"""
-import re
 import math
 import oe.recipeutils
 
@@ -170,6 +174,17 @@ def deploy(args, config, basepath, workspace):
 'recipe? If so, the install step has not installed 
'
 'any files.' % args.recipename)
 
+if args.strip and not args.dry_run:
+# Fakeroot copy to new destination
+srcdir = recipe_outdir
+recipe_outdir = os.path.join(rd.getVar('WORKDIR', True), 
'deploy-target-stripped')
+if os.path.isdir(recipe_outdir):
+bb.utils.remove(recipe_outdir, True)
+exec_fakeroot(rd, "cp -af %s %s" % (os.path.join(srcdir, '.'), 
recipe_outdir), shell=True)
+os.environ['PATH'] = ':'.join([os.environ['PATH'], 
rd.getVar('PATH', True) or ''])
+oe.package.strip_execs(args.recipename, recipe_outdir, 
rd.getVar('STRIP', True), rd.getVar('libdir', True),
+rd.getVar('base_libdir', True))
+
 filelist = []
 ftotalsize = 0
 for root, _, files in os.walk(recipe_outdir):
@@ -189,7 +204,6 @@ def deploy(args, config, basepath, workspace):
 print('  %s' % item)
 return 0
 
-
 extraoptions = ''
 if args.no_host_check:
 extraoptions += '-o UserKnownHostsFile=/dev/null -o 
StrictHostKeyChecking=no'
@@ -301,6 +315,7 @@ def undeploy(args, config, basepath, workspace):
 
 def register_commands(subparsers, context):
 """Register devtool subcommands from the deploy plugin"""
+
 parser_deploy = subparsers.add_parser('deploy-target',
   help='Deploy recipe output files to 
live target machine',
   description='Deploys a recipe\'s 
build output (i.e. the output of the do_install task) to a live target machine 
over ssh. By default, any existing files will be preserved instead of being 
overwritten and will be restored if you run devtool undeploy-target. Note: this 
only deploys the recipe itself and not any runtime dependencies, so it is 
assumed that those have been installed on the target beforehand.',
@@ -313,6 +328,15 @@ def register_commands(subparsers, context):
 parser_deploy.add_argument('-p', '--no-preserve', help='Do not preserve 
existing files', action='store_true')
 parser_deploy.add_argument('--no-check-space', help='Do not check for 
available space before deploying', action='store_true')
 parser_deploy.add_argument('-P', '--port', default='22', help='Port to use 
for connection to the target')
+
+strip_opts = parser_deploy.add_mutually_exclusive_group(required=False)
+strip_opts.add_argument('-S', '--strip',
+   help='Strip executables prior to deploying 
(default: %(default)s). '
+'The default value of this option can be 
controlled by setting the strip option in the [Deploy] section to True or 
False.',
+   
default=oe.types.boolean(context.config.get('Deploy', 'strip', default='0')),
+   action='store_true')
+strip_opts.add_argument('--no-strip', help='Do not strip executables prior 
to deploy', dest='strip', action='store_false')
+
 parser_deploy.set_defaults(func=deploy)
 
 parser_undeploy = subparsers.add_parser('undeploy-target',
-- 
2.1.4

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core