summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool
diff options
context:
space:
mode:
authorJoshua Lock <joshua.g.lock@intel.com>2016-12-14 21:13:05 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-12-16 10:23:23 +0000
commitc0f2890c01882e9ea14e781c044f3a84f75bd0fc (patch)
tree0962d17b0bf752ba4c009fb624f044b89fd6fd87 /scripts/lib/devtool
parentc4e2c59088765d1f1de7ec57cde91980f887c2ff (diff)
downloadpoky-c0f2890c01882e9ea14e781c044f3a84f75bd0fc.tar.gz
scripts: remove True option to getVar calls
getVar() now defaults to expanding by default, thus remove the True option from getVar() calls with a regex search and replace. Search made with the following regex: getVar ?\(( ?[^,()]*), True\) (From OE-Core rev: 0a36bd96e6b29fd99a296efc358ca3e9fb5af735) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool')
-rw-r--r--scripts/lib/devtool/__init__.py8
-rw-r--r--scripts/lib/devtool/build_image.py10
-rw-r--r--scripts/lib/devtool/deploy.py2
-rw-r--r--scripts/lib/devtool/package.py2
-rw-r--r--scripts/lib/devtool/runqemu.py4
-rw-r--r--scripts/lib/devtool/sdk.py8
-rw-r--r--scripts/lib/devtool/search.py4
-rw-r--r--scripts/lib/devtool/standard.py58
-rw-r--r--scripts/lib/devtool/upgrade.py20
-rw-r--r--scripts/lib/devtool/utilcmds.py18
10 files changed, 67 insertions, 67 deletions
diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py
index 99c5534893..fd2f042ba5 100644
--- a/scripts/lib/devtool/__init__.py
+++ b/scripts/lib/devtool/__init__.py
@@ -87,13 +87,13 @@ def exec_watch(cmd, **options):
87def exec_fakeroot(d, cmd, **kwargs): 87def exec_fakeroot(d, cmd, **kwargs):
88 """Run a command under fakeroot (pseudo, in fact) so that it picks up the appropriate file permissions""" 88 """Run a command under fakeroot (pseudo, in fact) so that it picks up the appropriate file permissions"""
89 # Grab the command and check it actually exists 89 # Grab the command and check it actually exists
90 fakerootcmd = d.getVar('FAKEROOTCMD', True) 90 fakerootcmd = d.getVar('FAKEROOTCMD')
91 if not os.path.exists(fakerootcmd): 91 if not os.path.exists(fakerootcmd):
92 logger.error('pseudo executable %s could not be found - have you run a build yet? pseudo-native should install this and if you have run any build then that should have been built') 92 logger.error('pseudo executable %s could not be found - have you run a build yet? pseudo-native should install this and if you have run any build then that should have been built')
93 return 2 93 return 2
94 # Set up the appropriate environment 94 # Set up the appropriate environment
95 newenv = dict(os.environ) 95 newenv = dict(os.environ)
96 fakerootenv = d.getVar('FAKEROOTENV', True) 96 fakerootenv = d.getVar('FAKEROOTENV')
97 for varvalue in fakerootenv.split(): 97 for varvalue in fakerootenv.split():
98 if '=' in varvalue: 98 if '=' in varvalue:
99 splitval = varvalue.split('=', 1) 99 splitval = varvalue.split('=', 1)
@@ -179,7 +179,7 @@ def use_external_build(same_dir, no_same_dir, d):
179 logger.info('Using source tree as build directory since --same-dir specified') 179 logger.info('Using source tree as build directory since --same-dir specified')
180 elif bb.data.inherits_class('autotools-brokensep', d): 180 elif bb.data.inherits_class('autotools-brokensep', d):
181 logger.info('Using source tree as build directory since recipe inherits autotools-brokensep') 181 logger.info('Using source tree as build directory since recipe inherits autotools-brokensep')
182 elif d.getVar('B', True) == os.path.abspath(d.getVar('S', True)): 182 elif d.getVar('B') == os.path.abspath(d.getVar('S')):
183 logger.info('Using source tree as build directory since that would be the default for this recipe') 183 logger.info('Using source tree as build directory since that would be the default for this recipe')
184 else: 184 else:
185 b_is_s = False 185 b_is_s = False
@@ -256,7 +256,7 @@ def ensure_npm(config, basepath, fixed_setup=False):
256 """ 256 """
257 tinfoil = setup_tinfoil(config_only=True, basepath=basepath) 257 tinfoil = setup_tinfoil(config_only=True, basepath=basepath)
258 try: 258 try:
259 nativepath = tinfoil.config_data.getVar('STAGING_BINDIR_NATIVE', True) 259 nativepath = tinfoil.config_data.getVar('STAGING_BINDIR_NATIVE')
260 finally: 260 finally:
261 tinfoil.shutdown() 261 tinfoil.shutdown()
262 262
diff --git a/scripts/lib/devtool/build_image.py b/scripts/lib/devtool/build_image.py
index ae75511dc7..e5810389be 100644
--- a/scripts/lib/devtool/build_image.py
+++ b/scripts/lib/devtool/build_image.py
@@ -34,8 +34,8 @@ def _get_packages(tinfoil, workspace, config):
34 result = [] 34 result = []
35 for recipe in workspace: 35 for recipe in workspace:
36 data = parse_recipe(config, tinfoil, recipe, True) 36 data = parse_recipe(config, tinfoil, recipe, True)
37 if 'class-target' in data.getVar('OVERRIDES', True).split(':'): 37 if 'class-target' in data.getVar('OVERRIDES').split(':'):
38 if recipe in data.getVar('PACKAGES', True).split(): 38 if recipe in data.getVar('PACKAGES').split():
39 result.append(recipe) 39 result.append(recipe)
40 else: 40 else:
41 logger.warning("Skipping recipe %s as it doesn't produce a " 41 logger.warning("Skipping recipe %s as it doesn't produce a "
@@ -95,7 +95,7 @@ def build_image_task(config, basepath, workspace, image, add_packages=None, task
95 raise TargetNotImageError() 95 raise TargetNotImageError()
96 96
97 # Get the actual filename used and strip the .bb and full path 97 # Get the actual filename used and strip the .bb and full path
98 target_basename = rd.getVar('FILE', True) 98 target_basename = rd.getVar('FILE')
99 target_basename = os.path.splitext(os.path.basename(target_basename))[0] 99 target_basename = os.path.splitext(os.path.basename(target_basename))[0]
100 config.set('SDK', 'target_basename', target_basename) 100 config.set('SDK', 'target_basename', target_basename)
101 config.write() 101 config.write()
@@ -132,9 +132,9 @@ def build_image_task(config, basepath, workspace, image, add_packages=None, task
132 afile.write('%s\n' % line) 132 afile.write('%s\n' % line)
133 133
134 if task in ['populate_sdk', 'populate_sdk_ext']: 134 if task in ['populate_sdk', 'populate_sdk_ext']:
135 outputdir = rd.getVar('SDK_DEPLOY', True) 135 outputdir = rd.getVar('SDK_DEPLOY')
136 else: 136 else:
137 outputdir = rd.getVar('DEPLOY_DIR_IMAGE', True) 137 outputdir = rd.getVar('DEPLOY_DIR_IMAGE')
138 138
139 tmp_tinfoil = tinfoil 139 tmp_tinfoil = tinfoil
140 tinfoil = None 140 tinfoil = None
diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py
index db7dffa307..9ec04e366a 100644
--- a/scripts/lib/devtool/deploy.py
+++ b/scripts/lib/devtool/deploy.py
@@ -160,7 +160,7 @@ 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 recipe_outdir = rd.getVar('D', True) 163 recipe_outdir = rd.getVar('D')
164 if not os.path.exists(recipe_outdir) or not os.listdir(recipe_outdir): 164 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 ' 165 raise DevtoolError('No files to deploy - have you built the %s '
166 'recipe? If so, the install step has not installed ' 166 'recipe? If so, the install step has not installed '
diff --git a/scripts/lib/devtool/package.py b/scripts/lib/devtool/package.py
index 47640641d1..b4f4720fd3 100644
--- a/scripts/lib/devtool/package.py
+++ b/scripts/lib/devtool/package.py
@@ -32,7 +32,7 @@ def package(args, config, basepath, workspace):
32 try: 32 try:
33 image_pkgtype = config.get('Package', 'image_pkgtype', '') 33 image_pkgtype = config.get('Package', 'image_pkgtype', '')
34 if not image_pkgtype: 34 if not image_pkgtype:
35 image_pkgtype = tinfoil.config_data.getVar('IMAGE_PKGTYPE', True) 35 image_pkgtype = tinfoil.config_data.getVar('IMAGE_PKGTYPE')
36 36
37 deploy_dir_pkg = tinfoil.config_data.getVar('DEPLOY_DIR_%s' % image_pkgtype.upper(), True) 37 deploy_dir_pkg = tinfoil.config_data.getVar('DEPLOY_DIR_%s' % image_pkgtype.upper(), True)
38 finally: 38 finally:
diff --git a/scripts/lib/devtool/runqemu.py b/scripts/lib/devtool/runqemu.py
index ae25cee08c..641664e565 100644
--- a/scripts/lib/devtool/runqemu.py
+++ b/scripts/lib/devtool/runqemu.py
@@ -31,8 +31,8 @@ def runqemu(args, config, basepath, workspace):
31 31
32 tinfoil = setup_tinfoil(config_only=True, basepath=basepath) 32 tinfoil = setup_tinfoil(config_only=True, basepath=basepath)
33 try: 33 try:
34 machine = tinfoil.config_data.getVar('MACHINE', True) 34 machine = tinfoil.config_data.getVar('MACHINE')
35 bindir_native = tinfoil.config_data.getVar('STAGING_BINDIR_NATIVE', True) 35 bindir_native = tinfoil.config_data.getVar('STAGING_BINDIR_NATIVE')
36 finally: 36 finally:
37 tinfoil.shutdown() 37 tinfoil.shutdown()
38 38
diff --git a/scripts/lib/devtool/sdk.py b/scripts/lib/devtool/sdk.py
index 922277b79f..f629db1876 100644
--- a/scripts/lib/devtool/sdk.py
+++ b/scripts/lib/devtool/sdk.py
@@ -132,9 +132,9 @@ def sdk_update(args, config, basepath, workspace):
132 # Grab variable values 132 # Grab variable values
133 tinfoil = setup_tinfoil(config_only=True, basepath=basepath) 133 tinfoil = setup_tinfoil(config_only=True, basepath=basepath)
134 try: 134 try:
135 stamps_dir = tinfoil.config_data.getVar('STAMPS_DIR', True) 135 stamps_dir = tinfoil.config_data.getVar('STAMPS_DIR')
136 sstate_mirrors = tinfoil.config_data.getVar('SSTATE_MIRRORS', True) 136 sstate_mirrors = tinfoil.config_data.getVar('SSTATE_MIRRORS')
137 site_conf_version = tinfoil.config_data.getVar('SITE_CONF_VERSION', True) 137 site_conf_version = tinfoil.config_data.getVar('SITE_CONF_VERSION')
138 finally: 138 finally:
139 tinfoil.shutdown() 139 tinfoil.shutdown()
140 140
@@ -273,7 +273,7 @@ def sdk_install(args, config, basepath, workspace):
273 rd = parse_recipe(config, tinfoil, recipe, True) 273 rd = parse_recipe(config, tinfoil, recipe, True)
274 if not rd: 274 if not rd:
275 return 1 275 return 1
276 stampprefixes[recipe] = '%s.%s' % (rd.getVar('STAMP', True), tasks[0]) 276 stampprefixes[recipe] = '%s.%s' % (rd.getVar('STAMP'), tasks[0])
277 if checkstamp(recipe): 277 if checkstamp(recipe):
278 logger.info('%s is already installed' % recipe) 278 logger.info('%s is already installed' % recipe)
279 else: 279 else:
diff --git a/scripts/lib/devtool/search.py b/scripts/lib/devtool/search.py
index b44bed7f6f..054985b85d 100644
--- a/scripts/lib/devtool/search.py
+++ b/scripts/lib/devtool/search.py
@@ -31,7 +31,7 @@ def search(args, config, basepath, workspace):
31 31
32 tinfoil = setup_tinfoil(config_only=False, basepath=basepath) 32 tinfoil = setup_tinfoil(config_only=False, basepath=basepath)
33 try: 33 try:
34 pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR', True) 34 pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR')
35 defsummary = tinfoil.config_data.getVar('SUMMARY', False) or '' 35 defsummary = tinfoil.config_data.getVar('SUMMARY', False) or ''
36 36
37 keyword_rc = re.compile(args.keyword) 37 keyword_rc = re.compile(args.keyword)
@@ -70,7 +70,7 @@ def search(args, config, basepath, workspace):
70 70
71 if match: 71 if match:
72 rd = parse_recipe(config, tinfoil, fn, True) 72 rd = parse_recipe(config, tinfoil, fn, True)
73 summary = rd.getVar('SUMMARY', True) 73 summary = rd.getVar('SUMMARY')
74 if summary == rd.expand(defsummary): 74 if summary == rd.expand(defsummary):
75 summary = '' 75 summary = ''
76 print("%s %s" % (fn.ljust(20), summary)) 76 print("%s %s" % (fn.ljust(20), summary))
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index c52b00678e..e662e3b505 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -303,7 +303,7 @@ def _check_compatible_recipe(pn, d):
303 raise DevtoolError("The %s recipe is a meta-recipe, and therefore is " 303 raise DevtoolError("The %s recipe is a meta-recipe, and therefore is "
304 "not supported by this tool" % pn, 4) 304 "not supported by this tool" % pn, 4)
305 305
306 if bb.data.inherits_class('externalsrc', d) and d.getVar('EXTERNALSRC', True): 306 if bb.data.inherits_class('externalsrc', d) and d.getVar('EXTERNALSRC'):
307 # Not an incompatibility error per se, so we don't pass the error code 307 # Not an incompatibility error per se, so we don't pass the error code
308 raise DevtoolError("externalsrc is currently enabled for the %s " 308 raise DevtoolError("externalsrc is currently enabled for the %s "
309 "recipe. This prevents the normal do_patch task " 309 "recipe. This prevents the normal do_patch task "
@@ -439,7 +439,7 @@ def _extract_source(srctree, keep_temp, devbranch, sync, d, tinfoil):
439 """Extract sources of a recipe""" 439 """Extract sources of a recipe"""
440 import oe.recipeutils 440 import oe.recipeutils
441 441
442 pn = d.getVar('PN', True) 442 pn = d.getVar('PN')
443 443
444 _check_compatible_recipe(pn, d) 444 _check_compatible_recipe(pn, d)
445 445
@@ -473,13 +473,13 @@ def _extract_source(srctree, keep_temp, devbranch, sync, d, tinfoil):
473 # Make a subdir so we guard against WORKDIR==S 473 # Make a subdir so we guard against WORKDIR==S
474 workdir = os.path.join(tempdir, 'workdir') 474 workdir = os.path.join(tempdir, 'workdir')
475 crd.setVar('WORKDIR', workdir) 475 crd.setVar('WORKDIR', workdir)
476 if not crd.getVar('S', True).startswith(workdir): 476 if not crd.getVar('S').startswith(workdir):
477 # Usually a shared workdir recipe (kernel, gcc) 477 # Usually a shared workdir recipe (kernel, gcc)
478 # Try to set a reasonable default 478 # Try to set a reasonable default
479 if bb.data.inherits_class('kernel', d): 479 if bb.data.inherits_class('kernel', d):
480 crd.setVar('S', '${WORKDIR}/source') 480 crd.setVar('S', '${WORKDIR}/source')
481 else: 481 else:
482 crd.setVar('S', '${WORKDIR}/%s' % os.path.basename(d.getVar('S', True))) 482 crd.setVar('S', '${WORKDIR}/%s' % os.path.basename(d.getVar('S')))
483 if bb.data.inherits_class('kernel', d): 483 if bb.data.inherits_class('kernel', d):
484 # We don't want to move the source to STAGING_KERNEL_DIR here 484 # We don't want to move the source to STAGING_KERNEL_DIR here
485 crd.setVar('STAGING_KERNEL_DIR', '${S}') 485 crd.setVar('STAGING_KERNEL_DIR', '${S}')
@@ -533,7 +533,7 @@ def _extract_source(srctree, keep_temp, devbranch, sync, d, tinfoil):
533 # Extra step for kernel to populate the source directory 533 # Extra step for kernel to populate the source directory
534 runtask(fn, 'kernel_checkout') 534 runtask(fn, 'kernel_checkout')
535 535
536 srcsubdir = crd.getVar('S', True) 536 srcsubdir = crd.getVar('S')
537 537
538 # Move local source files into separate subdir 538 # Move local source files into separate subdir
539 recipe_patches = [os.path.basename(patch) for patch in 539 recipe_patches = [os.path.basename(patch) for patch in
@@ -581,7 +581,7 @@ def _extract_source(srctree, keep_temp, devbranch, sync, d, tinfoil):
581 "doesn't use any source or the correct source " 581 "doesn't use any source or the correct source "
582 "directory could not be determined" % pn) 582 "directory could not be determined" % pn)
583 583
584 setup_git_repo(srcsubdir, crd.getVar('PV', True), devbranch, d=d) 584 setup_git_repo(srcsubdir, crd.getVar('PV'), devbranch, d=d)
585 585
586 (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srcsubdir) 586 (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srcsubdir)
587 initial_rev = stdout.rstrip() 587 initial_rev = stdout.rstrip()
@@ -596,7 +596,7 @@ def _extract_source(srctree, keep_temp, devbranch, sync, d, tinfoil):
596 # Store generate and store kernel config 596 # Store generate and store kernel config
597 logger.info('Generating kernel config') 597 logger.info('Generating kernel config')
598 runtask(fn, 'configure') 598 runtask(fn, 'configure')
599 kconfig = os.path.join(crd.getVar('B', True), '.config') 599 kconfig = os.path.join(crd.getVar('B'), '.config')
600 600
601 601
602 tempdir_localdir = os.path.join(tempdir, 'oe-local-files') 602 tempdir_localdir = os.path.join(tempdir, 'oe-local-files')
@@ -628,7 +628,7 @@ def _extract_source(srctree, keep_temp, devbranch, sync, d, tinfoil):
628 628
629 shutil.move(srcsubdir, srctree) 629 shutil.move(srcsubdir, srctree)
630 630
631 if os.path.abspath(d.getVar('S', True)) == os.path.abspath(d.getVar('WORKDIR', True)): 631 if os.path.abspath(d.getVar('S')) == os.path.abspath(d.getVar('WORKDIR')):
632 # If recipe extracts to ${WORKDIR}, symlink the files into the srctree 632 # If recipe extracts to ${WORKDIR}, symlink the files into the srctree
633 # (otherwise the recipe won't build as expected) 633 # (otherwise the recipe won't build as expected)
634 local_files_dir = os.path.join(srctree, 'oe-local-files') 634 local_files_dir = os.path.join(srctree, 'oe-local-files')
@@ -725,7 +725,7 @@ def modify(args, config, basepath, workspace):
725 if not rd: 725 if not rd:
726 return 1 726 return 1
727 727
728 pn = rd.getVar('PN', True) 728 pn = rd.getVar('PN')
729 if pn != args.recipename: 729 if pn != args.recipename:
730 logger.info('Mapping %s to %s' % (args.recipename, pn)) 730 logger.info('Mapping %s to %s' % (args.recipename, pn))
731 if pn in workspace: 731 if pn in workspace:
@@ -747,7 +747,7 @@ def modify(args, config, basepath, workspace):
747 # Error already shown 747 # Error already shown
748 return 1 748 return 1
749 749
750 recipefile = rd.getVar('FILE', True) 750 recipefile = rd.getVar('FILE')
751 appendfile = recipe_to_append(recipefile, config, args.wildcard) 751 appendfile = recipe_to_append(recipefile, config, args.wildcard)
752 if os.path.exists(appendfile): 752 if os.path.exists(appendfile):
753 raise DevtoolError("Another variant of recipe %s is already in your " 753 raise DevtoolError("Another variant of recipe %s is already in your "
@@ -784,8 +784,8 @@ def modify(args, config, basepath, workspace):
784 initial_rev = stdout.rstrip() 784 initial_rev = stdout.rstrip()
785 785
786 # Check that recipe isn't using a shared workdir 786 # Check that recipe isn't using a shared workdir
787 s = os.path.abspath(rd.getVar('S', True)) 787 s = os.path.abspath(rd.getVar('S'))
788 workdir = os.path.abspath(rd.getVar('WORKDIR', True)) 788 workdir = os.path.abspath(rd.getVar('WORKDIR'))
789 if s.startswith(workdir) and s != workdir and os.path.dirname(s) != workdir: 789 if s.startswith(workdir) and s != workdir and os.path.dirname(s) != workdir:
790 # Handle if S is set to a subdirectory of the source 790 # Handle if S is set to a subdirectory of the source
791 srcsubdir = os.path.relpath(s, workdir).split(os.sep, 1)[1] 791 srcsubdir = os.path.relpath(s, workdir).split(os.sep, 1)[1]
@@ -866,17 +866,17 @@ def rename(args, config, basepath, workspace):
866 if not rd: 866 if not rd:
867 return 1 867 return 1
868 868
869 bp = rd.getVar('BP', True) 869 bp = rd.getVar('BP')
870 bpn = rd.getVar('BPN', True) 870 bpn = rd.getVar('BPN')
871 if newname != args.recipename: 871 if newname != args.recipename:
872 localdata = rd.createCopy() 872 localdata = rd.createCopy()
873 localdata.setVar('PN', newname) 873 localdata.setVar('PN', newname)
874 newbpn = localdata.getVar('BPN', True) 874 newbpn = localdata.getVar('BPN')
875 else: 875 else:
876 newbpn = bpn 876 newbpn = bpn
877 s = rd.getVar('S', False) 877 s = rd.getVar('S', False)
878 src_uri = rd.getVar('SRC_URI', False) 878 src_uri = rd.getVar('SRC_URI', False)
879 pv = rd.getVar('PV', True) 879 pv = rd.getVar('PV')
880 880
881 # Correct variable values that refer to the upstream source - these 881 # Correct variable values that refer to the upstream source - these
882 # values must stay the same, so if the name/version are changing then 882 # values must stay the same, so if the name/version are changing then
@@ -1277,8 +1277,8 @@ def _export_local_files(srctree, rd, destdir):
1277 elif fname != '.gitignore': 1277 elif fname != '.gitignore':
1278 added[fname] = None 1278 added[fname] = None
1279 1279
1280 workdir = rd.getVar('WORKDIR', True) 1280 workdir = rd.getVar('WORKDIR')
1281 s = rd.getVar('S', True) 1281 s = rd.getVar('S')
1282 if not s.endswith(os.sep): 1282 if not s.endswith(os.sep):
1283 s += os.sep 1283 s += os.sep
1284 1284
@@ -1300,14 +1300,14 @@ def _export_local_files(srctree, rd, destdir):
1300 1300
1301def _determine_files_dir(rd): 1301def _determine_files_dir(rd):
1302 """Determine the appropriate files directory for a recipe""" 1302 """Determine the appropriate files directory for a recipe"""
1303 recipedir = rd.getVar('FILE_DIRNAME', True) 1303 recipedir = rd.getVar('FILE_DIRNAME')
1304 for entry in rd.getVar('FILESPATH', True).split(':'): 1304 for entry in rd.getVar('FILESPATH').split(':'):
1305 relpth = os.path.relpath(entry, recipedir) 1305 relpth = os.path.relpath(entry, recipedir)
1306 if not os.sep in relpth: 1306 if not os.sep in relpth:
1307 # One (or zero) levels below only, so we don't put anything in machine-specific directories 1307 # One (or zero) levels below only, so we don't put anything in machine-specific directories
1308 if os.path.isdir(entry): 1308 if os.path.isdir(entry):
1309 return entry 1309 return entry
1310 return os.path.join(recipedir, rd.getVar('BPN', True)) 1310 return os.path.join(recipedir, rd.getVar('BPN'))
1311 1311
1312 1312
1313def _update_recipe_srcrev(srctree, rd, appendlayerdir, wildcard_version, no_remove): 1313def _update_recipe_srcrev(srctree, rd, appendlayerdir, wildcard_version, no_remove):
@@ -1315,7 +1315,7 @@ def _update_recipe_srcrev(srctree, rd, appendlayerdir, wildcard_version, no_remo
1315 import bb 1315 import bb
1316 import oe.recipeutils 1316 import oe.recipeutils
1317 1317
1318 recipefile = rd.getVar('FILE', True) 1318 recipefile = rd.getVar('FILE')
1319 logger.info('Updating SRCREV in recipe %s' % os.path.basename(recipefile)) 1319 logger.info('Updating SRCREV in recipe %s' % os.path.basename(recipefile))
1320 1320
1321 # Get HEAD revision 1321 # Get HEAD revision
@@ -1397,7 +1397,7 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil
1397 import bb 1397 import bb
1398 import oe.recipeutils 1398 import oe.recipeutils
1399 1399
1400 recipefile = rd.getVar('FILE', True) 1400 recipefile = rd.getVar('FILE')
1401 append = workspace[recipename]['bbappend'] 1401 append = workspace[recipename]['bbappend']
1402 if not os.path.exists(append): 1402 if not os.path.exists(append):
1403 raise DevtoolError('unable to find workspace bbappend for recipe %s' % 1403 raise DevtoolError('unable to find workspace bbappend for recipe %s' %
@@ -1408,7 +1408,7 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil
1408 raise DevtoolError('Unable to find initial revision - please specify ' 1408 raise DevtoolError('Unable to find initial revision - please specify '
1409 'it with --initial-rev') 1409 'it with --initial-rev')
1410 1410
1411 dl_dir = rd.getVar('DL_DIR', True) 1411 dl_dir = rd.getVar('DL_DIR')
1412 if not dl_dir.endswith('/'): 1412 if not dl_dir.endswith('/'):
1413 dl_dir += '/' 1413 dl_dir += '/'
1414 1414
@@ -1567,7 +1567,7 @@ def update_recipe(args, config, basepath, workspace):
1567 updated = _update_recipe(args.recipename, workspace, rd, args.mode, args.append, args.wildcard_version, args.no_remove, args.initial_rev) 1567 updated = _update_recipe(args.recipename, workspace, rd, args.mode, args.append, args.wildcard_version, args.no_remove, args.initial_rev)
1568 1568
1569 if updated: 1569 if updated:
1570 rf = rd.getVar('FILE', True) 1570 rf = rd.getVar('FILE')
1571 if rf.startswith(config.workspace_path): 1571 if rf.startswith(config.workspace_path):
1572 logger.warn('Recipe file %s has been updated but is inside the workspace - you will need to move it (and any associated files next to it) out to the desired layer before using "devtool reset" in order to keep any changes' % rf) 1572 logger.warn('Recipe file %s has been updated but is inside the workspace - you will need to move it (and any associated files next to it) out to the desired layer before using "devtool reset" in order to keep any changes' % rf)
1573 finally: 1573 finally:
@@ -1671,7 +1671,7 @@ def reset(args, config, basepath, workspace):
1671 1671
1672def _get_layer(layername, d): 1672def _get_layer(layername, d):
1673 """Determine the base layer path for the specified layer name/path""" 1673 """Determine the base layer path for the specified layer name/path"""
1674 layerdirs = d.getVar('BBLAYERS', True).split() 1674 layerdirs = d.getVar('BBLAYERS').split()
1675 layers = {os.path.basename(p): p for p in layerdirs} 1675 layers = {os.path.basename(p): p for p in layerdirs}
1676 # Provide some shortcuts 1676 # Provide some shortcuts
1677 if layername.lower() in ['oe-core', 'openembedded-core']: 1677 if layername.lower() in ['oe-core', 'openembedded-core']:
@@ -1697,7 +1697,7 @@ def finish(args, config, basepath, workspace):
1697 return 1 1697 return 1
1698 1698
1699 destlayerdir = _get_layer(args.destination, tinfoil.config_data) 1699 destlayerdir = _get_layer(args.destination, tinfoil.config_data)
1700 origlayerdir = oe.recipeutils.find_layerdir(rd.getVar('FILE', True)) 1700 origlayerdir = oe.recipeutils.find_layerdir(rd.getVar('FILE'))
1701 1701
1702 if not os.path.isdir(destlayerdir): 1702 if not os.path.isdir(destlayerdir):
1703 raise DevtoolError('Unable to find layer or directory matching "%s"' % args.destination) 1703 raise DevtoolError('Unable to find layer or directory matching "%s"' % args.destination)
@@ -1728,7 +1728,7 @@ def finish(args, config, basepath, workspace):
1728 if not destpath: 1728 if not destpath:
1729 raise DevtoolError("Unable to determine destination layer path - check that %s specifies an actual layer and %s/conf/layer.conf specifies BBFILES. You may also need to specify a more complete path." % (args.destination, destlayerdir)) 1729 raise DevtoolError("Unable to determine destination layer path - check that %s specifies an actual layer and %s/conf/layer.conf specifies BBFILES. You may also need to specify a more complete path." % (args.destination, destlayerdir))
1730 # Warn if the layer isn't in bblayers.conf (the code to create a bbappend will do this in other cases) 1730 # Warn if the layer isn't in bblayers.conf (the code to create a bbappend will do this in other cases)
1731 layerdirs = [os.path.abspath(layerdir) for layerdir in rd.getVar('BBLAYERS', True).split()] 1731 layerdirs = [os.path.abspath(layerdir) for layerdir in rd.getVar('BBLAYERS').split()]
1732 if not os.path.abspath(destlayerdir) in layerdirs: 1732 if not os.path.abspath(destlayerdir) in layerdirs:
1733 bb.warn('Specified destination layer is not currently enabled in bblayers.conf, so the %s recipe will now be unavailable in your current configuration until you add the layer there' % args.recipename) 1733 bb.warn('Specified destination layer is not currently enabled in bblayers.conf, so the %s recipe will now be unavailable in your current configuration until you add the layer there' % args.recipename)
1734 1734
@@ -1758,7 +1758,7 @@ def finish(args, config, basepath, workspace):
1758 # associated files to the specified layer 1758 # associated files to the specified layer
1759 no_clean = True 1759 no_clean = True
1760 logger.info('Moving recipe file to %s' % destpath) 1760 logger.info('Moving recipe file to %s' % destpath)
1761 recipedir = os.path.dirname(rd.getVar('FILE', True)) 1761 recipedir = os.path.dirname(rd.getVar('FILE'))
1762 for root, _, files in os.walk(recipedir): 1762 for root, _, files in os.walk(recipedir):
1763 for fn in files: 1763 for fn in files:
1764 srcpath = os.path.join(root, fn) 1764 srcpath = os.path.join(root, fn)
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index d89e9a23ac..9595f3e7a4 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -68,7 +68,7 @@ def _remove_patch_dirs(recipefolder):
68 shutil.rmtree(os.path.join(root,d)) 68 shutil.rmtree(os.path.join(root,d))
69 69
70def _recipe_contains(rd, var): 70def _recipe_contains(rd, var):
71 rf = rd.getVar('FILE', True) 71 rf = rd.getVar('FILE')
72 varfiles = oe.recipeutils.get_var_files(rf, [var], rd) 72 varfiles = oe.recipeutils.get_var_files(rf, [var], rd)
73 for var, fn in varfiles.items(): 73 for var, fn in varfiles.items():
74 if fn and fn.startswith(os.path.dirname(rf) + os.sep): 74 if fn and fn.startswith(os.path.dirname(rf) + os.sep):
@@ -132,7 +132,7 @@ def _write_append(rc, srctree, same_dir, no_same_dir, rev, copied, workspace, d)
132 if rev: 132 if rev:
133 f.write('# initial_rev: %s\n' % rev) 133 f.write('# initial_rev: %s\n' % rev)
134 if copied: 134 if copied:
135 f.write('# original_path: %s\n' % os.path.dirname(d.getVar('FILE', True))) 135 f.write('# original_path: %s\n' % os.path.dirname(d.getVar('FILE')))
136 f.write('# original_files: %s\n' % ' '.join(copied)) 136 f.write('# original_files: %s\n' % ' '.join(copied))
137 return af 137 return af
138 138
@@ -154,7 +154,7 @@ def _upgrade_error(e, rf, srctree):
154 raise DevtoolError(e) 154 raise DevtoolError(e)
155 155
156def _get_uri(rd): 156def _get_uri(rd):
157 srcuris = rd.getVar('SRC_URI', True).split() 157 srcuris = rd.getVar('SRC_URI').split()
158 if not len(srcuris): 158 if not len(srcuris):
159 raise DevtoolError('SRC_URI not found on recipe') 159 raise DevtoolError('SRC_URI not found on recipe')
160 # Get first non-local entry in SRC_URI - usually by convention it's 160 # Get first non-local entry in SRC_URI - usually by convention it's
@@ -185,7 +185,7 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev, branch, keep_temp, tin
185 185
186 crd = rd.createCopy() 186 crd = rd.createCopy()
187 187
188 pv = crd.getVar('PV', True) 188 pv = crd.getVar('PV')
189 crd.setVar('PV', newpv) 189 crd.setVar('PV', newpv)
190 190
191 tmpsrctree = None 191 tmpsrctree = None
@@ -270,15 +270,15 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev, branch, keep_temp, tin
270def _create_new_recipe(newpv, md5, sha256, srcrev, srcbranch, workspace, tinfoil, rd): 270def _create_new_recipe(newpv, md5, sha256, srcrev, srcbranch, workspace, tinfoil, rd):
271 """Creates the new recipe under workspace""" 271 """Creates the new recipe under workspace"""
272 272
273 bpn = rd.getVar('BPN', True) 273 bpn = rd.getVar('BPN')
274 path = os.path.join(workspace, 'recipes', bpn) 274 path = os.path.join(workspace, 'recipes', bpn)
275 bb.utils.mkdirhier(path) 275 bb.utils.mkdirhier(path)
276 copied, _ = oe.recipeutils.copy_recipe_files(rd, path) 276 copied, _ = oe.recipeutils.copy_recipe_files(rd, path)
277 277
278 oldpv = rd.getVar('PV', True) 278 oldpv = rd.getVar('PV')
279 if not newpv: 279 if not newpv:
280 newpv = oldpv 280 newpv = oldpv
281 origpath = rd.getVar('FILE', True) 281 origpath = rd.getVar('FILE')
282 fullpath = _rename_recipe_files(origpath, bpn, oldpv, newpv, path) 282 fullpath = _rename_recipe_files(origpath, bpn, oldpv, newpv, path)
283 logger.debug('Upgraded %s => %s' % (origpath, fullpath)) 283 logger.debug('Upgraded %s => %s' % (origpath, fullpath))
284 284
@@ -341,7 +341,7 @@ def upgrade(args, config, basepath, workspace):
341 if not rd: 341 if not rd:
342 return 1 342 return 1
343 343
344 pn = rd.getVar('PN', True) 344 pn = rd.getVar('PN')
345 if pn != args.recipename: 345 if pn != args.recipename:
346 logger.info('Mapping %s to %s' % (args.recipename, pn)) 346 logger.info('Mapping %s to %s' % (args.recipename, pn))
347 if pn in workspace: 347 if pn in workspace:
@@ -353,12 +353,12 @@ def upgrade(args, config, basepath, workspace):
353 srctree = standard.get_default_srctree(config, pn) 353 srctree = standard.get_default_srctree(config, pn)
354 354
355 standard._check_compatible_recipe(pn, rd) 355 standard._check_compatible_recipe(pn, rd)
356 old_srcrev = rd.getVar('SRCREV', True) 356 old_srcrev = rd.getVar('SRCREV')
357 if old_srcrev == 'INVALID': 357 if old_srcrev == 'INVALID':
358 old_srcrev = None 358 old_srcrev = None
359 if old_srcrev and not args.srcrev: 359 if old_srcrev and not args.srcrev:
360 raise DevtoolError("Recipe specifies a SRCREV value; you must specify a new one when upgrading") 360 raise DevtoolError("Recipe specifies a SRCREV value; you must specify a new one when upgrading")
361 if rd.getVar('PV', True) == args.version and old_srcrev == args.srcrev: 361 if rd.getVar('PV') == args.version and old_srcrev == args.srcrev:
362 raise DevtoolError("Current and upgrade versions are the same version") 362 raise DevtoolError("Current and upgrade versions are the same version")
363 363
364 rf = None 364 rf = None
diff --git a/scripts/lib/devtool/utilcmds.py b/scripts/lib/devtool/utilcmds.py
index b761a80f8f..0437e6417c 100644
--- a/scripts/lib/devtool/utilcmds.py
+++ b/scripts/lib/devtool/utilcmds.py
@@ -39,7 +39,7 @@ def edit_recipe(args, config, basepath, workspace):
39 rd = parse_recipe(config, tinfoil, args.recipename, True) 39 rd = parse_recipe(config, tinfoil, args.recipename, True)
40 if not rd: 40 if not rd:
41 return 1 41 return 1
42 recipefile = rd.getVar('FILE', True) 42 recipefile = rd.getVar('FILE')
43 finally: 43 finally:
44 tinfoil.shutdown() 44 tinfoil.shutdown()
45 else: 45 else:
@@ -62,20 +62,20 @@ def configure_help(args, config, basepath, workspace):
62 rd = parse_recipe(config, tinfoil, args.recipename, appends=True, filter_workspace=False) 62 rd = parse_recipe(config, tinfoil, args.recipename, appends=True, filter_workspace=False)
63 if not rd: 63 if not rd:
64 return 1 64 return 1
65 b = rd.getVar('B', True) 65 b = rd.getVar('B')
66 s = rd.getVar('S', True) 66 s = rd.getVar('S')
67 configurescript = os.path.join(s, 'configure') 67 configurescript = os.path.join(s, 'configure')
68 confdisabled = 'noexec' in rd.getVarFlags('do_configure') or 'do_configure' not in (rd.getVar('__BBTASKS', False) or []) 68 confdisabled = 'noexec' in rd.getVarFlags('do_configure') or 'do_configure' not in (rd.getVar('__BBTASKS', False) or [])
69 configureopts = oe.utils.squashspaces(rd.getVar('CONFIGUREOPTS', True) or '') 69 configureopts = oe.utils.squashspaces(rd.getVar('CONFIGUREOPTS') or '')
70 extra_oeconf = oe.utils.squashspaces(rd.getVar('EXTRA_OECONF', True) or '') 70 extra_oeconf = oe.utils.squashspaces(rd.getVar('EXTRA_OECONF') or '')
71 extra_oecmake = oe.utils.squashspaces(rd.getVar('EXTRA_OECMAKE', True) or '') 71 extra_oecmake = oe.utils.squashspaces(rd.getVar('EXTRA_OECMAKE') or '')
72 do_configure = rd.getVar('do_configure', True) or '' 72 do_configure = rd.getVar('do_configure') or ''
73 do_configure_noexpand = rd.getVar('do_configure', False) or '' 73 do_configure_noexpand = rd.getVar('do_configure', False) or ''
74 packageconfig = rd.getVarFlags('PACKAGECONFIG') or [] 74 packageconfig = rd.getVarFlags('PACKAGECONFIG') or []
75 autotools = bb.data.inherits_class('autotools', rd) and ('oe_runconf' in do_configure or 'autotools_do_configure' in do_configure) 75 autotools = bb.data.inherits_class('autotools', rd) and ('oe_runconf' in do_configure or 'autotools_do_configure' in do_configure)
76 cmake = bb.data.inherits_class('cmake', rd) and ('cmake_do_configure' in do_configure) 76 cmake = bb.data.inherits_class('cmake', rd) and ('cmake_do_configure' in do_configure)
77 cmake_do_configure = rd.getVar('cmake_do_configure', True) 77 cmake_do_configure = rd.getVar('cmake_do_configure')
78 pn = rd.getVar('PN', True) 78 pn = rd.getVar('PN')
79 finally: 79 finally:
80 tinfoil.shutdown() 80 tinfoil.shutdown()
81 81