summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/upgrade.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-09-22 17:21:27 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-23 09:53:15 +0100
commit30c7e7ac41ba201d41613d1482abeebdbd05ae46 (patch)
treeddea262ec8e5d690008b427191a7b98b4a079cbc /scripts/lib/devtool/upgrade.py
parent99fc284545d3a493ce57e904c233e0130022dae7 (diff)
downloadpoky-30c7e7ac41ba201d41613d1482abeebdbd05ae46.tar.gz
devtool: add: properly handle separate build directory
When we were adding a recipe for software that would typically be built in the same directory as the source, we were always using a separate build directory unless the user explicitly specified not to, leading to errors for software that doesn't expect to be built that way (such as Python modules using distutils). Split out the code that makes this determination automatically from the "devtool modify" and "devtool upgrade" code and re-use that here so the behaviour is consistent. (From OE-Core rev: 320585b7ff6340df0b0dbc63f95ed3ca8fc3a993) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool/upgrade.py')
-rw-r--r--scripts/lib/devtool/upgrade.py20
1 files changed, 3 insertions, 17 deletions
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index 86443b0735..6c1dfee3fe 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -29,7 +29,7 @@ import errno
29import bb 29import bb
30import oe.recipeutils 30import oe.recipeutils
31from devtool import standard 31from devtool import standard
32from devtool import exec_build_env_command, setup_tinfoil, DevtoolError, parse_recipe 32from devtool import exec_build_env_command, setup_tinfoil, DevtoolError, parse_recipe, use_external_build
33 33
34logger = logging.getLogger('devtool') 34logger = logging.getLogger('devtool')
35 35
@@ -126,21 +126,6 @@ def _rename_recipe_files(bpn, oldpv, newpv, path):
126 _rename_recipe_dirs(oldpv, newpv, path) 126 _rename_recipe_dirs(oldpv, newpv, path)
127 return _rename_recipe_file(bpn, oldpv, newpv, path) 127 return _rename_recipe_file(bpn, oldpv, newpv, path)
128 128
129def _use_external_build(same_dir, no_same_dir, d):
130 b_is_s = True
131 if no_same_dir:
132 logger.info('using separate build directory since --no-same-dir specified')
133 b_is_s = False
134 elif same_dir:
135 logger.info('using source tree as build directory since --same-dir specified')
136 elif bb.data.inherits_class('autotools-brokensep', d):
137 logger.info('using source tree as build directory since original recipe inherits autotools-brokensep')
138 elif d.getVar('B', True) == os.path.abspath(d.getVar('S', True)):
139 logger.info('using source tree as build directory since that is the default for this recipe')
140 else:
141 b_is_s = False
142 return b_is_s
143
144def _write_append(rc, srctree, same_dir, no_same_dir, rev, workspace, d): 129def _write_append(rc, srctree, same_dir, no_same_dir, rev, workspace, d):
145 """Writes an append file""" 130 """Writes an append file"""
146 if not os.path.exists(rc): 131 if not os.path.exists(rc):
@@ -161,7 +146,8 @@ def _write_append(rc, srctree, same_dir, no_same_dir, rev, workspace, d):
161 f.write(('# NOTE: We use pn- overrides here to avoid affecting' 146 f.write(('# NOTE: We use pn- overrides here to avoid affecting'
162 'multiple variants in the case where the recipe uses BBCLASSEXTEND\n')) 147 'multiple variants in the case where the recipe uses BBCLASSEXTEND\n'))
163 f.write('EXTERNALSRC_pn-%s = "%s"\n' % (pn, srctree)) 148 f.write('EXTERNALSRC_pn-%s = "%s"\n' % (pn, srctree))
164 if _use_external_build(same_dir, no_same_dir, d): 149 b_is_s = use_external_build(same_dir, no_same_dir, d)
150 if b_is_s:
165 f.write('EXTERNALSRC_BUILD_pn-%s = "%s"\n' % (pn, srctree)) 151 f.write('EXTERNALSRC_BUILD_pn-%s = "%s"\n' % (pn, srctree))
166 if rev: 152 if rev:
167 f.write('\n# initial_rev: %s\n' % rev) 153 f.write('\n# initial_rev: %s\n' % rev)