diff options
Diffstat (limited to 'scripts/lib/devtool/standard.py')
-rw-r--r-- | scripts/lib/devtool/standard.py | 93 |
1 files changed, 47 insertions, 46 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index 1d0fe13788..1fd5947c41 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py | |||
@@ -18,11 +18,13 @@ import argparse_oe | |||
18 | import scriptutils | 18 | import scriptutils |
19 | import errno | 19 | import errno |
20 | import glob | 20 | import glob |
21 | import filecmp | ||
22 | from collections import OrderedDict | 21 | from collections import OrderedDict |
22 | |||
23 | from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, use_external_build, setup_git_repo, recipe_to_append, get_bbclassextend_targets, update_unlockedsigs, check_prerelease_version, check_git_repo_dirty, check_git_repo_op, DevtoolError | 23 | from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, use_external_build, setup_git_repo, recipe_to_append, get_bbclassextend_targets, update_unlockedsigs, check_prerelease_version, check_git_repo_dirty, check_git_repo_op, DevtoolError |
24 | from devtool import parse_recipe | 24 | from devtool import parse_recipe |
25 | 25 | ||
26 | import bb.utils | ||
27 | |||
26 | logger = logging.getLogger('devtool') | 28 | logger = logging.getLogger('devtool') |
27 | 29 | ||
28 | override_branch_prefix = 'devtool-override-' | 30 | override_branch_prefix = 'devtool-override-' |
@@ -30,7 +32,8 @@ override_branch_prefix = 'devtool-override-' | |||
30 | 32 | ||
31 | def add(args, config, basepath, workspace): | 33 | def add(args, config, basepath, workspace): |
32 | """Entry point for the devtool 'add' subcommand""" | 34 | """Entry point for the devtool 'add' subcommand""" |
33 | import bb | 35 | import bb.data |
36 | import bb.process | ||
34 | import oe.recipeutils | 37 | import oe.recipeutils |
35 | 38 | ||
36 | if not args.recipename and not args.srctree and not args.fetch and not args.fetchuri: | 39 | if not args.recipename and not args.srctree and not args.fetch and not args.fetchuri: |
@@ -206,7 +209,7 @@ def add(args, config, basepath, workspace): | |||
206 | for fn in os.listdir(tempdir): | 209 | for fn in os.listdir(tempdir): |
207 | shutil.move(os.path.join(tempdir, fn), recipedir) | 210 | shutil.move(os.path.join(tempdir, fn), recipedir) |
208 | else: | 211 | else: |
209 | raise DevtoolError('Command \'%s\' did not create any recipe file:\n%s' % (e.command, e.stdout)) | 212 | raise DevtoolError(f'Failed to create a recipe file for source {source}') |
210 | attic_recipe = os.path.join(config.workspace_path, 'attic', recipename, os.path.basename(recipefile)) | 213 | attic_recipe = os.path.join(config.workspace_path, 'attic', recipename, os.path.basename(recipefile)) |
211 | if os.path.exists(attic_recipe): | 214 | if os.path.exists(attic_recipe): |
212 | logger.warning('A modified recipe from a previous invocation exists in %s - you may wish to move this over the top of the new recipe if you had changes in it that you want to continue with' % attic_recipe) | 215 | logger.warning('A modified recipe from a previous invocation exists in %s - you may wish to move this over the top of the new recipe if you had changes in it that you want to continue with' % attic_recipe) |
@@ -305,6 +308,7 @@ def add(args, config, basepath, workspace): | |||
305 | 308 | ||
306 | def _check_compatible_recipe(pn, d): | 309 | def _check_compatible_recipe(pn, d): |
307 | """Check if the recipe is supported by devtool""" | 310 | """Check if the recipe is supported by devtool""" |
311 | import bb.data | ||
308 | if pn == 'perf': | 312 | if pn == 'perf': |
309 | raise DevtoolError("The perf recipe does not actually check out " | 313 | raise DevtoolError("The perf recipe does not actually check out " |
310 | "source and thus cannot be supported by this tool", | 314 | "source and thus cannot be supported by this tool", |
@@ -374,7 +378,7 @@ def _copy_file(src, dst, dry_run_outdir=None, base_outdir=None): | |||
374 | 378 | ||
375 | def _git_ls_tree(repodir, treeish='HEAD', recursive=False): | 379 | def _git_ls_tree(repodir, treeish='HEAD', recursive=False): |
376 | """List contents of a git treeish""" | 380 | """List contents of a git treeish""" |
377 | import bb | 381 | import bb.process |
378 | cmd = ['git', 'ls-tree', '-z', treeish] | 382 | cmd = ['git', 'ls-tree', '-z', treeish] |
379 | if recursive: | 383 | if recursive: |
380 | cmd.append('-r') | 384 | cmd.append('-r') |
@@ -389,7 +393,7 @@ def _git_ls_tree(repodir, treeish='HEAD', recursive=False): | |||
389 | 393 | ||
390 | def _git_modified(repodir): | 394 | def _git_modified(repodir): |
391 | """List the difference between HEAD and the index""" | 395 | """List the difference between HEAD and the index""" |
392 | import bb | 396 | import bb.process |
393 | cmd = ['git', 'status', '--porcelain'] | 397 | cmd = ['git', 'status', '--porcelain'] |
394 | out, _ = bb.process.run(cmd, cwd=repodir) | 398 | out, _ = bb.process.run(cmd, cwd=repodir) |
395 | ret = [] | 399 | ret = [] |
@@ -427,8 +431,6 @@ def _ls_tree(directory): | |||
427 | 431 | ||
428 | def extract(args, config, basepath, workspace): | 432 | def extract(args, config, basepath, workspace): |
429 | """Entry point for the devtool 'extract' subcommand""" | 433 | """Entry point for the devtool 'extract' subcommand""" |
430 | import bb | ||
431 | |||
432 | tinfoil = setup_tinfoil(basepath=basepath, tracking=True) | 434 | tinfoil = setup_tinfoil(basepath=basepath, tracking=True) |
433 | if not tinfoil: | 435 | if not tinfoil: |
434 | # Error already shown | 436 | # Error already shown |
@@ -451,8 +453,6 @@ def extract(args, config, basepath, workspace): | |||
451 | 453 | ||
452 | def sync(args, config, basepath, workspace): | 454 | def sync(args, config, basepath, workspace): |
453 | """Entry point for the devtool 'sync' subcommand""" | 455 | """Entry point for the devtool 'sync' subcommand""" |
454 | import bb | ||
455 | |||
456 | tinfoil = setup_tinfoil(basepath=basepath, tracking=True) | 456 | tinfoil = setup_tinfoil(basepath=basepath, tracking=True) |
457 | if not tinfoil: | 457 | if not tinfoil: |
458 | # Error already shown | 458 | # Error already shown |
@@ -475,9 +475,9 @@ def sync(args, config, basepath, workspace): | |||
475 | 475 | ||
476 | def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, workspace, fixed_setup, d, tinfoil, no_overrides=False): | 476 | def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, workspace, fixed_setup, d, tinfoil, no_overrides=False): |
477 | """Extract sources of a recipe""" | 477 | """Extract sources of a recipe""" |
478 | import oe.recipeutils | ||
479 | import oe.patch | ||
480 | import oe.path | 478 | import oe.path |
479 | import bb.data | ||
480 | import bb.process | ||
481 | 481 | ||
482 | pn = d.getVar('PN') | 482 | pn = d.getVar('PN') |
483 | 483 | ||
@@ -542,6 +542,7 @@ def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, works | |||
542 | tempbasedir = d.getVar('WORKDIR') | 542 | tempbasedir = d.getVar('WORKDIR') |
543 | bb.utils.mkdirhier(tempbasedir) | 543 | bb.utils.mkdirhier(tempbasedir) |
544 | tempdir = tempfile.mkdtemp(prefix='devtooltmp-', dir=tempbasedir) | 544 | tempdir = tempfile.mkdtemp(prefix='devtooltmp-', dir=tempbasedir) |
545 | appendbackup = None | ||
545 | try: | 546 | try: |
546 | tinfoil.logger.setLevel(logging.WARNING) | 547 | tinfoil.logger.setLevel(logging.WARNING) |
547 | 548 | ||
@@ -552,7 +553,6 @@ def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, works | |||
552 | appendbackup = os.path.join(tempdir, os.path.basename(appendfile) + '.bak') | 553 | appendbackup = os.path.join(tempdir, os.path.basename(appendfile) + '.bak') |
553 | shutil.copyfile(appendfile, appendbackup) | 554 | shutil.copyfile(appendfile, appendbackup) |
554 | else: | 555 | else: |
555 | appendbackup = None | ||
556 | bb.utils.mkdirhier(os.path.dirname(appendfile)) | 556 | bb.utils.mkdirhier(os.path.dirname(appendfile)) |
557 | logger.debug('writing append file %s' % appendfile) | 557 | logger.debug('writing append file %s' % appendfile) |
558 | with open(appendfile, 'a') as f: | 558 | with open(appendfile, 'a') as f: |
@@ -625,7 +625,7 @@ def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, works | |||
625 | srcsubdir = f.read() | 625 | srcsubdir = f.read() |
626 | except FileNotFoundError as e: | 626 | except FileNotFoundError as e: |
627 | raise DevtoolError('Something went wrong with source extraction - the devtool-source class was not active or did not function correctly:\n%s' % str(e)) | 627 | raise DevtoolError('Something went wrong with source extraction - the devtool-source class was not active or did not function correctly:\n%s' % str(e)) |
628 | srcsubdir_rel = os.path.relpath(srcsubdir, os.path.join(tempdir, 'workdir')) | 628 | srcsubdir_rel = os.path.relpath(srcsubdir, os.path.join(tempdir, 'workdir', os.path.relpath(d.getVar('UNPACKDIR'), d.getVar('WORKDIR')))) |
629 | 629 | ||
630 | # Check if work-shared is empty, if yes | 630 | # Check if work-shared is empty, if yes |
631 | # find source and copy to work-shared | 631 | # find source and copy to work-shared |
@@ -678,8 +678,6 @@ def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, works | |||
678 | 678 | ||
679 | def _add_md5(config, recipename, filename): | 679 | def _add_md5(config, recipename, filename): |
680 | """Record checksum of a file (or recursively for a directory) to the md5-file of the workspace""" | 680 | """Record checksum of a file (or recursively for a directory) to the md5-file of the workspace""" |
681 | import bb.utils | ||
682 | |||
683 | def addfile(fn): | 681 | def addfile(fn): |
684 | md5 = bb.utils.md5_file(fn) | 682 | md5 = bb.utils.md5_file(fn) |
685 | with open(os.path.join(config.workspace_path, '.devtool_md5'), 'a+') as f: | 683 | with open(os.path.join(config.workspace_path, '.devtool_md5'), 'a+') as f: |
@@ -698,7 +696,6 @@ def _add_md5(config, recipename, filename): | |||
698 | def _check_preserve(config, recipename): | 696 | def _check_preserve(config, recipename): |
699 | """Check if a file was manually changed and needs to be saved in 'attic' | 697 | """Check if a file was manually changed and needs to be saved in 'attic' |
700 | directory""" | 698 | directory""" |
701 | import bb.utils | ||
702 | origfile = os.path.join(config.workspace_path, '.devtool_md5') | 699 | origfile = os.path.join(config.workspace_path, '.devtool_md5') |
703 | newfile = os.path.join(config.workspace_path, '.devtool_md5_new') | 700 | newfile = os.path.join(config.workspace_path, '.devtool_md5_new') |
704 | preservepath = os.path.join(config.workspace_path, 'attic', recipename) | 701 | preservepath = os.path.join(config.workspace_path, 'attic', recipename) |
@@ -729,36 +726,36 @@ def _check_preserve(config, recipename): | |||
729 | 726 | ||
730 | def get_staging_kver(srcdir): | 727 | def get_staging_kver(srcdir): |
731 | # Kernel version from work-shared | 728 | # Kernel version from work-shared |
732 | kerver = [] | 729 | import itertools |
733 | staging_kerVer="" | 730 | try: |
734 | if os.path.exists(srcdir) and os.listdir(srcdir): | ||
735 | with open(os.path.join(srcdir, "Makefile")) as f: | 731 | with open(os.path.join(srcdir, "Makefile")) as f: |
736 | version = [next(f) for x in range(5)][1:4] | 732 | # Take VERSION, PATCHLEVEL, SUBLEVEL from lines 1, 2, 3 |
737 | for word in version: | 733 | return ".".join(line.rstrip().split('= ')[1] for line in itertools.islice(f, 1, 4)) |
738 | kerver.append(word.split('= ')[1].split('\n')[0]) | 734 | except FileNotFoundError: |
739 | staging_kerVer = ".".join(kerver) | 735 | return "" |
740 | return staging_kerVer | ||
741 | 736 | ||
742 | def get_staging_kbranch(srcdir): | 737 | def get_staging_kbranch(srcdir): |
738 | import bb.process | ||
743 | staging_kbranch = "" | 739 | staging_kbranch = "" |
744 | if os.path.exists(srcdir) and os.listdir(srcdir): | 740 | if os.path.exists(srcdir) and os.listdir(srcdir): |
745 | (branch, _) = bb.process.run('git branch | grep \\* | cut -d \' \' -f2', cwd=srcdir) | 741 | (branch, _) = bb.process.run('git branch | grep \\* | cut -d \' \' -f2', cwd=srcdir) |
746 | staging_kbranch = "".join(branch.split('\n')[0]) | 742 | staging_kbranch = "".join(branch.split('\n')[0]) |
747 | return staging_kbranch | 743 | return staging_kbranch |
748 | 744 | ||
749 | def get_real_srctree(srctree, s, workdir): | 745 | def get_real_srctree(srctree, s, unpackdir): |
750 | # Check that recipe isn't using a shared workdir | 746 | # Check that recipe isn't using a shared workdir |
751 | s = os.path.abspath(s) | 747 | s = os.path.abspath(s) |
752 | workdir = os.path.abspath(workdir) | 748 | unpackdir = os.path.abspath(unpackdir) |
753 | if s.startswith(workdir) and s != workdir and os.path.dirname(s) != workdir: | 749 | if s.startswith(unpackdir) and s != unpackdir and os.path.dirname(s) != unpackdir: |
754 | # Handle if S is set to a subdirectory of the source | 750 | # Handle if S is set to a subdirectory of the source |
755 | srcsubdir = os.path.relpath(s, workdir).split(os.sep, 1)[1] | 751 | srcsubdir = os.path.relpath(s, unpackdir).split(os.sep, 1)[1] |
756 | srctree = os.path.join(srctree, srcsubdir) | 752 | srctree = os.path.join(srctree, srcsubdir) |
757 | return srctree | 753 | return srctree |
758 | 754 | ||
759 | def modify(args, config, basepath, workspace): | 755 | def modify(args, config, basepath, workspace): |
760 | """Entry point for the devtool 'modify' subcommand""" | 756 | """Entry point for the devtool 'modify' subcommand""" |
761 | import bb | 757 | import bb.data |
758 | import bb.process | ||
762 | import oe.recipeutils | 759 | import oe.recipeutils |
763 | import oe.patch | 760 | import oe.patch |
764 | import oe.path | 761 | import oe.path |
@@ -814,10 +811,8 @@ def modify(args, config, basepath, workspace): | |||
814 | staging_kbranch = get_staging_kbranch(srcdir) | 811 | staging_kbranch = get_staging_kbranch(srcdir) |
815 | if (os.path.exists(srcdir) and os.listdir(srcdir)) and (kernelVersion in staging_kerVer and staging_kbranch == kbranch): | 812 | if (os.path.exists(srcdir) and os.listdir(srcdir)) and (kernelVersion in staging_kerVer and staging_kbranch == kbranch): |
816 | oe.path.copyhardlinktree(srcdir, srctree) | 813 | oe.path.copyhardlinktree(srcdir, srctree) |
817 | workdir = rd.getVar('WORKDIR') | ||
818 | unpackdir = rd.getVar('UNPACKDIR') | 814 | unpackdir = rd.getVar('UNPACKDIR') |
819 | srcsubdir = rd.getVar('S') | 815 | srcsubdir = rd.getVar('S') |
820 | localfilesdir = os.path.join(srctree, 'oe-local-files') | ||
821 | 816 | ||
822 | # Add locally copied files to gitignore as we add back to the metadata directly | 817 | # Add locally copied files to gitignore as we add back to the metadata directly |
823 | local_files = oe.recipeutils.get_recipe_local_files(rd) | 818 | local_files = oe.recipeutils.get_recipe_local_files(rd) |
@@ -912,7 +907,7 @@ def modify(args, config, basepath, workspace): | |||
912 | 907 | ||
913 | # Need to grab this here in case the source is within a subdirectory | 908 | # Need to grab this here in case the source is within a subdirectory |
914 | srctreebase = srctree | 909 | srctreebase = srctree |
915 | srctree = get_real_srctree(srctree, rd.getVar('S'), rd.getVar('WORKDIR')) | 910 | srctree = get_real_srctree(srctree, rd.getVar('S'), rd.getVar('UNPACKDIR')) |
916 | 911 | ||
917 | bb.utils.mkdirhier(os.path.dirname(appendfile)) | 912 | bb.utils.mkdirhier(os.path.dirname(appendfile)) |
918 | with open(appendfile, 'w') as f: | 913 | with open(appendfile, 'w') as f: |
@@ -952,13 +947,6 @@ def modify(args, config, basepath, workspace): | |||
952 | f.write('EXTERNALSRC_BUILD:pn-%s = "%s"\n' % (pn, srctree)) | 947 | f.write('EXTERNALSRC_BUILD:pn-%s = "%s"\n' % (pn, srctree)) |
953 | 948 | ||
954 | if bb.data.inherits_class('kernel', rd): | 949 | if bb.data.inherits_class('kernel', rd): |
955 | f.write('SRCTREECOVEREDTASKS = "do_validate_branches do_kernel_checkout ' | ||
956 | 'do_fetch do_unpack do_kernel_configcheck"\n') | ||
957 | f.write('\ndo_patch[noexec] = "1"\n') | ||
958 | f.write('\ndo_configure:append() {\n' | ||
959 | ' cp ${B}/.config ${S}/.config.baseline\n' | ||
960 | ' ln -sfT ${B}/.config ${S}/.config.new\n' | ||
961 | '}\n') | ||
962 | f.write('\ndo_kernel_configme:prepend() {\n' | 950 | f.write('\ndo_kernel_configme:prepend() {\n' |
963 | ' if [ -e ${S}/.config ]; then\n' | 951 | ' if [ -e ${S}/.config ]; then\n' |
964 | ' mv ${S}/.config ${S}/.config.old\n' | 952 | ' mv ${S}/.config ${S}/.config.old\n' |
@@ -982,6 +970,8 @@ def modify(args, config, basepath, workspace): | |||
982 | if branch == args.branch: | 970 | if branch == args.branch: |
983 | continue | 971 | continue |
984 | f.write('# patches_%s: %s\n' % (branch, ','.join(branch_patches[branch]))) | 972 | f.write('# patches_%s: %s\n' % (branch, ','.join(branch_patches[branch]))) |
973 | if args.debug_build: | ||
974 | f.write('\nDEBUG_BUILD = "1"\n') | ||
985 | 975 | ||
986 | update_unlockedsigs(basepath, workspace, args.fixed_setup, [pn]) | 976 | update_unlockedsigs(basepath, workspace, args.fixed_setup, [pn]) |
987 | 977 | ||
@@ -1026,6 +1016,7 @@ def rename(args, config, basepath, workspace): | |||
1026 | origfnver = '' | 1016 | origfnver = '' |
1027 | 1017 | ||
1028 | recipefilemd5 = None | 1018 | recipefilemd5 = None |
1019 | newrecipefilemd5 = None | ||
1029 | tinfoil = setup_tinfoil(basepath=basepath, tracking=True) | 1020 | tinfoil = setup_tinfoil(basepath=basepath, tracking=True) |
1030 | try: | 1021 | try: |
1031 | rd = parse_recipe(config, tinfoil, args.recipename, True) | 1022 | rd = parse_recipe(config, tinfoil, args.recipename, True) |
@@ -1103,6 +1094,7 @@ def rename(args, config, basepath, workspace): | |||
1103 | 1094 | ||
1104 | # Rename source tree if it's the default path | 1095 | # Rename source tree if it's the default path |
1105 | appendmd5 = None | 1096 | appendmd5 = None |
1097 | newappendmd5 = None | ||
1106 | if not args.no_srctree: | 1098 | if not args.no_srctree: |
1107 | srctree = workspace[args.recipename]['srctree'] | 1099 | srctree = workspace[args.recipename]['srctree'] |
1108 | if os.path.abspath(srctree) == os.path.join(config.workspace_path, 'sources', args.recipename): | 1100 | if os.path.abspath(srctree) == os.path.join(config.workspace_path, 'sources', args.recipename): |
@@ -1191,7 +1183,7 @@ def _get_patchset_revs(srctree, recipe_path, initial_rev=None, force_patch_refre | |||
1191 | """Get initial and update rev of a recipe. These are the start point of the | 1183 | """Get initial and update rev of a recipe. These are the start point of the |
1192 | whole patchset and start point for the patches to be re-generated/updated. | 1184 | whole patchset and start point for the patches to be re-generated/updated. |
1193 | """ | 1185 | """ |
1194 | import bb | 1186 | import bb.process |
1195 | 1187 | ||
1196 | # Get current branch | 1188 | # Get current branch |
1197 | stdout, _ = bb.process.run('git rev-parse --abbrev-ref HEAD', | 1189 | stdout, _ = bb.process.run('git rev-parse --abbrev-ref HEAD', |
@@ -1317,6 +1309,7 @@ def _export_patches(srctree, rd, start_revs, destdir, changed_revs=None): | |||
1317 | """ | 1309 | """ |
1318 | import oe.recipeutils | 1310 | import oe.recipeutils |
1319 | from oe.patch import GitApplyTree | 1311 | from oe.patch import GitApplyTree |
1312 | import bb.process | ||
1320 | updated = OrderedDict() | 1313 | updated = OrderedDict() |
1321 | added = OrderedDict() | 1314 | added = OrderedDict() |
1322 | seqpatch_re = re.compile('^([0-9]{4}-)?(.+)') | 1315 | seqpatch_re = re.compile('^([0-9]{4}-)?(.+)') |
@@ -1338,6 +1331,7 @@ def _export_patches(srctree, rd, start_revs, destdir, changed_revs=None): | |||
1338 | # values, but they ought to be anyway... | 1331 | # values, but they ought to be anyway... |
1339 | new_basename = seqpatch_re.match(new_patch).group(2) | 1332 | new_basename = seqpatch_re.match(new_patch).group(2) |
1340 | match_name = None | 1333 | match_name = None |
1334 | old_patch = None | ||
1341 | for old_patch in existing_patches: | 1335 | for old_patch in existing_patches: |
1342 | old_basename = seqpatch_re.match(old_patch).group(2) | 1336 | old_basename = seqpatch_re.match(old_patch).group(2) |
1343 | old_basename_splitext = os.path.splitext(old_basename) | 1337 | old_basename_splitext = os.path.splitext(old_basename) |
@@ -1386,6 +1380,7 @@ def _export_patches(srctree, rd, start_revs, destdir, changed_revs=None): | |||
1386 | 1380 | ||
1387 | def _create_kconfig_diff(srctree, rd, outfile): | 1381 | def _create_kconfig_diff(srctree, rd, outfile): |
1388 | """Create a kconfig fragment""" | 1382 | """Create a kconfig fragment""" |
1383 | import bb.process | ||
1389 | # Only update config fragment if both config files exist | 1384 | # Only update config fragment if both config files exist |
1390 | orig_config = os.path.join(srctree, '.config.baseline') | 1385 | orig_config = os.path.join(srctree, '.config.baseline') |
1391 | new_config = os.path.join(srctree, '.config.new') | 1386 | new_config = os.path.join(srctree, '.config.new') |
@@ -1423,6 +1418,8 @@ def _export_local_files(srctree, rd, destdir, srctreebase): | |||
1423 | - for removed dict, the absolute path to the existing file in recipe space | 1418 | - for removed dict, the absolute path to the existing file in recipe space |
1424 | """ | 1419 | """ |
1425 | import oe.recipeutils | 1420 | import oe.recipeutils |
1421 | import bb.data | ||
1422 | import bb.process | ||
1426 | 1423 | ||
1427 | # Find out local files (SRC_URI files that exist in the "recipe space"). | 1424 | # Find out local files (SRC_URI files that exist in the "recipe space"). |
1428 | # Local files that reside in srctree are not included in patch generation. | 1425 | # Local files that reside in srctree are not included in patch generation. |
@@ -1481,7 +1478,7 @@ def _export_local_files(srctree, rd, destdir, srctreebase): | |||
1481 | added[fragment_fn] = {} | 1478 | added[fragment_fn] = {} |
1482 | else: | 1479 | else: |
1483 | if fragment_fn in updated: | 1480 | if fragment_fn in updated: |
1484 | revoved[fragment_fn] = updated[fragment_fn] | 1481 | removed[fragment_fn] = updated[fragment_fn] |
1485 | del updated[fragment_fn] | 1482 | del updated[fragment_fn] |
1486 | 1483 | ||
1487 | # Special handling for cml1, ccmake, etc bbclasses that generated | 1484 | # Special handling for cml1, ccmake, etc bbclasses that generated |
@@ -1514,7 +1511,7 @@ def _determine_files_dir(rd): | |||
1514 | 1511 | ||
1515 | def _update_recipe_srcrev(recipename, workspace, srctree, rd, appendlayerdir, wildcard_version, no_remove, no_report_remove, dry_run_outdir=None): | 1512 | def _update_recipe_srcrev(recipename, workspace, srctree, rd, appendlayerdir, wildcard_version, no_remove, no_report_remove, dry_run_outdir=None): |
1516 | """Implement the 'srcrev' mode of update-recipe""" | 1513 | """Implement the 'srcrev' mode of update-recipe""" |
1517 | import bb | 1514 | import bb.process |
1518 | import oe.recipeutils | 1515 | import oe.recipeutils |
1519 | 1516 | ||
1520 | dry_run_suffix = ' (dry-run)' if dry_run_outdir else '' | 1517 | dry_run_suffix = ' (dry-run)' if dry_run_outdir else '' |
@@ -1552,6 +1549,7 @@ def _update_recipe_srcrev(recipename, workspace, srctree, rd, appendlayerdir, wi | |||
1552 | local_files_dir = tempfile.mkdtemp(dir=tempdir) | 1549 | local_files_dir = tempfile.mkdtemp(dir=tempdir) |
1553 | srctreebase = workspace[recipename]['srctreebase'] | 1550 | srctreebase = workspace[recipename]['srctreebase'] |
1554 | upd_f, new_f, del_f = _export_local_files(srctree, rd, local_files_dir, srctreebase) | 1551 | upd_f, new_f, del_f = _export_local_files(srctree, rd, local_files_dir, srctreebase) |
1552 | removedentries = {} | ||
1555 | if not no_remove: | 1553 | if not no_remove: |
1556 | # Find list of existing patches in recipe file | 1554 | # Find list of existing patches in recipe file |
1557 | patches_dir = tempfile.mkdtemp(dir=tempdir) | 1555 | patches_dir = tempfile.mkdtemp(dir=tempdir) |
@@ -1615,7 +1613,6 @@ def _update_recipe_srcrev(recipename, workspace, srctree, rd, appendlayerdir, wi | |||
1615 | 1613 | ||
1616 | def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wildcard_version, no_remove, no_report_remove, initial_rev, dry_run_outdir=None, force_patch_refresh=False): | 1614 | def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wildcard_version, no_remove, no_report_remove, initial_rev, dry_run_outdir=None, force_patch_refresh=False): |
1617 | """Implement the 'patch' mode of update-recipe""" | 1615 | """Implement the 'patch' mode of update-recipe""" |
1618 | import bb | ||
1619 | import oe.recipeutils | 1616 | import oe.recipeutils |
1620 | 1617 | ||
1621 | recipefile = rd.getVar('FILE') | 1618 | recipefile = rd.getVar('FILE') |
@@ -1729,6 +1726,7 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil | |||
1729 | for basepath, param in upd_p.items(): | 1726 | for basepath, param in upd_p.items(): |
1730 | path = param['path'] | 1727 | path = param['path'] |
1731 | patchdir = param.get('patchdir', ".") | 1728 | patchdir = param.get('patchdir', ".") |
1729 | patchdir_param = {} | ||
1732 | if patchdir != "." : | 1730 | if patchdir != "." : |
1733 | patchdir_param = dict(patchdir_params) | 1731 | patchdir_param = dict(patchdir_params) |
1734 | if patchdir_param: | 1732 | if patchdir_param: |
@@ -1794,6 +1792,7 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil | |||
1794 | 1792 | ||
1795 | def _guess_recipe_update_mode(srctree, rdata): | 1793 | def _guess_recipe_update_mode(srctree, rdata): |
1796 | """Guess the recipe update mode to use""" | 1794 | """Guess the recipe update mode to use""" |
1795 | import bb.process | ||
1797 | src_uri = (rdata.getVar('SRC_URI') or '').split() | 1796 | src_uri = (rdata.getVar('SRC_URI') or '').split() |
1798 | git_uris = [uri for uri in src_uri if uri.startswith('git://')] | 1797 | git_uris = [uri for uri in src_uri if uri.startswith('git://')] |
1799 | if not git_uris: | 1798 | if not git_uris: |
@@ -1815,6 +1814,8 @@ def _guess_recipe_update_mode(srctree, rdata): | |||
1815 | return 'patch' | 1814 | return 'patch' |
1816 | 1815 | ||
1817 | def _update_recipe(recipename, workspace, rd, mode, appendlayerdir, wildcard_version, no_remove, initial_rev, no_report_remove=False, dry_run_outdir=None, no_overrides=False, force_patch_refresh=False): | 1816 | def _update_recipe(recipename, workspace, rd, mode, appendlayerdir, wildcard_version, no_remove, initial_rev, no_report_remove=False, dry_run_outdir=None, no_overrides=False, force_patch_refresh=False): |
1817 | import bb.data | ||
1818 | import bb.process | ||
1818 | srctree = workspace[recipename]['srctree'] | 1819 | srctree = workspace[recipename]['srctree'] |
1819 | if mode == 'auto': | 1820 | if mode == 'auto': |
1820 | mode = _guess_recipe_update_mode(srctree, rd) | 1821 | mode = _guess_recipe_update_mode(srctree, rd) |
@@ -1937,6 +1938,7 @@ def status(args, config, basepath, workspace): | |||
1937 | 1938 | ||
1938 | def _reset(recipes, no_clean, remove_work, config, basepath, workspace): | 1939 | def _reset(recipes, no_clean, remove_work, config, basepath, workspace): |
1939 | """Reset one or more recipes""" | 1940 | """Reset one or more recipes""" |
1941 | import bb.process | ||
1940 | import oe.path | 1942 | import oe.path |
1941 | 1943 | ||
1942 | def clean_preferred_provider(pn, layerconf_path): | 1944 | def clean_preferred_provider(pn, layerconf_path): |
@@ -1949,7 +1951,7 @@ def _reset(recipes, no_clean, remove_work, config, basepath, workspace): | |||
1949 | lines = f.readlines() | 1951 | lines = f.readlines() |
1950 | with open(new_layerconf_file, 'a') as nf: | 1952 | with open(new_layerconf_file, 'a') as nf: |
1951 | for line in lines: | 1953 | for line in lines: |
1952 | pprovider_exp = r'^PREFERRED_PROVIDER_.*? = "' + pn + r'"$' | 1954 | pprovider_exp = r'^PREFERRED_PROVIDER_.*? = "' + re.escape(pn) + r'"$' |
1953 | if not re.match(pprovider_exp, line): | 1955 | if not re.match(pprovider_exp, line): |
1954 | nf.write(line) | 1956 | nf.write(line) |
1955 | else: | 1957 | else: |
@@ -2040,8 +2042,6 @@ def _reset(recipes, no_clean, remove_work, config, basepath, workspace): | |||
2040 | 2042 | ||
2041 | def reset(args, config, basepath, workspace): | 2043 | def reset(args, config, basepath, workspace): |
2042 | """Entry point for the devtool 'reset' subcommand""" | 2044 | """Entry point for the devtool 'reset' subcommand""" |
2043 | import bb | ||
2044 | import shutil | ||
2045 | 2045 | ||
2046 | recipes = "" | 2046 | recipes = "" |
2047 | 2047 | ||
@@ -2320,6 +2320,7 @@ def register_commands(subparsers, context): | |||
2320 | parser_modify.add_argument('--branch', '-b', default="devtool", help='Name for development branch to checkout (when not using -n/--no-extract) (default "%(default)s")') | 2320 | parser_modify.add_argument('--branch', '-b', default="devtool", help='Name for development branch to checkout (when not using -n/--no-extract) (default "%(default)s")') |
2321 | parser_modify.add_argument('--no-overrides', '-O', action="store_true", help='Do not create branches for other override configurations') | 2321 | parser_modify.add_argument('--no-overrides', '-O', action="store_true", help='Do not create branches for other override configurations') |
2322 | parser_modify.add_argument('--keep-temp', help='Keep temporary directory (for debugging)', action="store_true") | 2322 | parser_modify.add_argument('--keep-temp', help='Keep temporary directory (for debugging)', action="store_true") |
2323 | parser_modify.add_argument('--debug-build', action="store_true", help='Add DEBUG_BUILD = "1" to the modified recipe') | ||
2323 | parser_modify.set_defaults(func=modify, fixed_setup=context.fixed_setup) | 2324 | parser_modify.set_defaults(func=modify, fixed_setup=context.fixed_setup) |
2324 | 2325 | ||
2325 | parser_extract = subparsers.add_parser('extract', help='Extract the source for an existing recipe', | 2326 | parser_extract = subparsers.add_parser('extract', help='Extract the source for an existing recipe', |