diff options
Diffstat (limited to 'scripts/lib/devtool/standard.py')
-rw-r--r-- | scripts/lib/devtool/standard.py | 58 |
1 files changed, 29 insertions, 29 deletions
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 | ||
1301 | def _determine_files_dir(rd): | 1301 | def _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 | ||
1313 | def _update_recipe_srcrev(srctree, rd, appendlayerdir, wildcard_version, no_remove): | 1313 | def _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 | ||
1672 | def _get_layer(layername, d): | 1672 | def _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) |