diff options
author | Adrian Freihofer <adrian.freihofer@gmail.com> | 2024-01-22 14:58:24 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-02-02 10:38:28 +0000 |
commit | 50618e59ddf6603a198df36f2c12cd66539b3667 (patch) | |
tree | 4b41179eb553e5135a46079f6dd1aa356462d1bd /scripts | |
parent | c17ce99a2fd6bf95543f3559b847cf98c34d4563 (diff) | |
download | poky-50618e59ddf6603a198df36f2c12cd66539b3667.tar.gz |
devtool: refactor deploy to use exec_fakeroot_no_d
This is a step towards a deploy function which can be called without
passing the d variable.
(From OE-Core rev: 3e8c41ec373a1766f68932d3b979d00e4e3bb3a9)
Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/devtool/deploy.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py index eadf6e1521..b71d55e231 100644 --- a/scripts/lib/devtool/deploy.py +++ b/scripts/lib/devtool/deploy.py | |||
@@ -16,7 +16,7 @@ import bb.utils | |||
16 | import argparse_oe | 16 | import argparse_oe |
17 | import oe.types | 17 | import oe.types |
18 | 18 | ||
19 | from devtool import exec_fakeroot, setup_tinfoil, check_workspace_recipe, DevtoolError | 19 | from devtool import exec_fakeroot_no_d, setup_tinfoil, check_workspace_recipe, DevtoolError |
20 | 20 | ||
21 | logger = logging.getLogger('devtool') | 21 | logger = logging.getLogger('devtool') |
22 | 22 | ||
@@ -160,19 +160,22 @@ def deploy(args, config, basepath, workspace): | |||
160 | except Exception as e: | 160 | except Exception as e: |
161 | raise DevtoolError('Exception parsing recipe %s: %s' % | 161 | raise DevtoolError('Exception parsing recipe %s: %s' % |
162 | (args.recipename, e)) | 162 | (args.recipename, e)) |
163 | |||
163 | recipe_outdir = rd.getVar('D') | 164 | recipe_outdir = rd.getVar('D') |
164 | if not os.path.exists(recipe_outdir) or not os.listdir(recipe_outdir): | 165 | if not os.path.exists(recipe_outdir) or not os.listdir(recipe_outdir): |
165 | raise DevtoolError('No files to deploy - have you built the %s ' | 166 | raise DevtoolError('No files to deploy - have you built the %s ' |
166 | 'recipe? If so, the install step has not installed ' | 167 | 'recipe? If so, the install step has not installed ' |
167 | 'any files.' % args.recipename) | 168 | 'any files.' % args.recipename) |
168 | 169 | ||
170 | fakerootcmd = rd.getVar('FAKEROOTCMD') | ||
171 | fakerootenv = rd.getVar('FAKEROOTENV') | ||
169 | if args.strip and not args.dry_run: | 172 | if args.strip and not args.dry_run: |
170 | # Fakeroot copy to new destination | 173 | # Fakeroot copy to new destination |
171 | srcdir = recipe_outdir | 174 | srcdir = recipe_outdir |
172 | recipe_outdir = os.path.join(rd.getVar('WORKDIR'), 'devtool-deploy-target-stripped') | 175 | recipe_outdir = os.path.join(rd.getVar('WORKDIR'), 'devtool-deploy-target-stripped') |
173 | if os.path.isdir(recipe_outdir): | 176 | if os.path.isdir(recipe_outdir): |
174 | exec_fakeroot(rd, "rm -rf %s" % recipe_outdir, shell=True) | 177 | exec_fakeroot_no_d(fakerootcmd, fakerootenv, "rm -rf %s" % recipe_outdir, shell=True) |
175 | exec_fakeroot(rd, "cp -af %s %s" % (os.path.join(srcdir, '.'), recipe_outdir), shell=True) | 178 | exec_fakeroot_no_d(fakerootcmd, fakerootenv, "cp -af %s %s" % (os.path.join(srcdir, '.'), recipe_outdir), shell=True) |
176 | os.environ['PATH'] = ':'.join([os.environ['PATH'], rd.getVar('PATH') or '']) | 179 | os.environ['PATH'] = ':'.join([os.environ['PATH'], rd.getVar('PATH') or '']) |
177 | oe.package.strip_execs(args.recipename, recipe_outdir, rd.getVar('STRIP'), rd.getVar('libdir'), | 180 | oe.package.strip_execs(args.recipename, recipe_outdir, rd.getVar('STRIP'), rd.getVar('libdir'), |
178 | rd.getVar('base_libdir'), oe.utils.get_bb_number_threads(rd), rd) | 181 | rd.getVar('base_libdir'), oe.utils.get_bb_number_threads(rd), rd) |
@@ -251,7 +254,7 @@ def deploy(args, config, basepath, workspace): | |||
251 | shutil.rmtree(tmpdir) | 254 | shutil.rmtree(tmpdir) |
252 | 255 | ||
253 | # Now run the script | 256 | # Now run the script |
254 | ret = exec_fakeroot(rd, 'tar cf - . | %s %s %s %s \'sh %s %s %s %s\'' % (ssh_sshexec, ssh_port, extraoptions, args.target, tmpscript, args.recipename, destdir, tmpfilelist), cwd=recipe_outdir, shell=True) | 257 | ret = exec_fakeroot_no_d(fakerootcmd, fakerootenv, 'tar cf - . | %s %s %s %s \'sh %s %s %s %s\'' % (ssh_sshexec, ssh_port, extraoptions, args.target, tmpscript, args.recipename, destdir, tmpfilelist), cwd=recipe_outdir, shell=True) |
255 | if ret != 0: | 258 | if ret != 0: |
256 | raise DevtoolError('Deploy failed - rerun with -s to get a complete ' | 259 | raise DevtoolError('Deploy failed - rerun with -s to get a complete ' |
257 | 'error message') | 260 | 'error message') |