Lines Matching +full:stdout +full:- +full:path

1 # Development tool - standard commands plugin
3 # Copyright (C) 2014-2017 Intel Corporation
5 # SPDX-License-Identifier: GPL-2.0-only
28 override_branch_prefix = 'devtool-override-'
37 …e_oe.ArgumentUsageError('At least one of recipename, srctree, fetchuri or -f/--fetch must be speci…
45 raise DevtoolError('URI specified as positional argument as well as -f/--fetch')
51 raise DevtoolError('URI specified as positional argument as well as -f/--fetch')
58 elif os.path.isdir(args.recipename):
59 …logger.warning('Ambiguous argument "%s" - assuming you mean it to be the recipe name' % args.recip…
63 … raise DevtoolError('The -S/--srcrev option is only valid when fetching from an SCM repository')
65 … raise DevtoolError('The -B/--srcbranch option is only valid when fetching from an SCM repository')
67 if args.srctree and os.path.isfile(args.srctree):
68 args.fetchuri = 'file://' + os.path.abspath(args.srctree)
73 raise DevtoolError('URI specified as positional argument as well as -f/--fetch')
75 …logger.warning('-f/--fetch option is deprecated - you can now simply specify the URL to fetch as a…
87 srctree = os.path.abspath(args.srctree)
96 if srctree and os.path.exists(srctree):
98 if not os.path.isdir(srctree):
99 raise DevtoolError("Cannot fetch into source tree path %s as "
103 raise DevtoolError("Cannot fetch into source tree path %s as "
104 "it already exists and is non-empty" %
111 raise DevtoolError("No source tree exists at default path %s - "
113 "or specify a path to a source tree, or a "
123 if args.color == 'auto' and sys.stdout.isatty():
131 extracmdopts += ' -x %s' % srctree
133 extracmdopts += ' -x %s' % tmpsrcdir
137 extracmdopts += ' -N %s' % args.recipename
139 extracmdopts += ' -V %s' % args.version
141 extracmdopts += ' -b'
143 extracmdopts += ' --also-native'
145 extracmdopts += ' --src-subdir "%s"' % args.src_subdir
147 extracmdopts += ' -a'
149 extracmdopts += ' --npm-dev'
151 extracmdopts += ' --mirrors'
153 extracmdopts += ' --srcrev %s' % args.srcrev
155 extracmdopts += ' --srcbranch %s' % args.srcbranch
157 extracmdopts += ' --provides %s' % args.provides
162stdout, _ = exec_build_env_command(config.init_path, basepath, 'recipetool --color=%s create --dev…
165 … raise DevtoolError('Could not auto-determine recipe name, please specify it on the command line')
169 recipes = glob.glob(os.path.join(tempdir, '*.bb'))
171 recipename = os.path.splitext(os.path.basename(recipes[0]))[0].split('_')[0]
174 recipedir = os.path.join(config.workspace_path, 'recipes', recipename)
176 recipefile = os.path.join(recipedir, os.path.basename(recipes[0]))
178 if os.path.exists(appendfile):
181 if os.path.exists(recipefile):
182 …A recipe file %s already exists in your workspace; this shouldn\'t be there - please delete it bef…
184 srctree = os.path.join(srctreeparent, recipename)
185 if os.path.exists(tmpsrcdir):
186 if os.path.exists(srctree):
187 if os.path.isdir(srctree):
192 … raise DevtoolError('Source tree path %s already exists and is not empty' % srctree)
196 … raise DevtoolError('Source tree path %s already exists and is not a directory' % srctree)
197 logger.info('Using default source tree path %s' % srctree)
205 shutil.move(os.path.join(tempdir, fn), recipedir)
207 … raise DevtoolError('Command \'%s\' did not create any recipe file:\n%s' % (e.command, e.stdout))
208 …attic_recipe = os.path.join(config.workspace_path, 'attic', recipename, os.path.basename(recipefil…
209 if os.path.exists(attic_recipe):
210 …logger.warning('A modified recipe from a previous invocation exists in %s - you may wish to move t…
212 if tmpsrcdir and os.path.exists(tmpsrcdir):
217 _add_md5(config, recipename, os.path.join(recipedir, fn))
238 if os.path.exists(os.path.join(srctree, '.git')):
239 (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree)
240 initial_rev = stdout.rstrip()
243 srctree = os.path.join(srctree, args.src_subdir)
245 bb.utils.mkdirhier(os.path.dirname(appendfile))
258 f.write(' rm -rf ${D}/.git\n')
259 f.write(' rm -f ${D}/singletask.lock\n')
265 f.write(' lockfile = os.path.join(pkgdir, "singletask.lock")\n')
280 layerconf_file = os.path.join(config.workspace_path, "conf", "layer.conf")
306 if pn in ['kernel-devsrc', 'package-index'] or pn.startswith('gcc-source'):
330 relpath = os.path.relpath(dst, base_outdir)
332 raise Exception('Incorrect base path %s for path %s' % (base_outdir, dst))
333 dst = os.path.join(dry_run_outdir, relpath)
334 dst_d = os.path.dirname(dst)
338 # the dry-run written out recipe will be overwritten with an unmodified
340 if not os.path.exists(dst):
344 """Move a file. Creates all the directory components of destination path."""
345 dry_run_suffix = ' (dry-run)' if dry_run_outdir else ''
351 dst_d = os.path.dirname(dst)
357 """Copy a file. Creates all the directory components of destination path."""
358 dry_run_suffix = ' (dry-run)' if dry_run_outdir else ''
363 dst_d = os.path.dirname(dst)
371 cmd = ['git', 'ls-tree', '-z', treeish]
373 cmd.append('-r')
383 def _git_exclude_path(srctree, path): argument
384 """Return pathspec (list of paths) that excludes certain path"""
385 # NOTE: "Filtering out" files/paths in this way is not entirely reliable -
390 path = os.path.normpath(path)
391 recurse = True if len(path.split(os.path.sep)) > 1 else False
393 if path in git_files:
394 git_files.remove(path)
403 ret.extend([os.path.relpath(os.path.join(root, fname), directory) for
421 srctree = os.path.abspath(args.srctree)
445 srctree = os.path.abspath(args.srctree)
458 if os.path.abspath(rd.getVar('S')) == os.path.abspath(rd.getVar('WORKDIR')):
461 local_files_dir = os.path.join(srctree, 'oe-local-files')
464 relpth = os.path.relpath(root, local_files_dir)
466 bb.utils.mkdirhier(os.path.join(srctree, relpth))
470 destpth = os.path.join(srctree, relpth, fn)
471 if os.path.exists(destpth):
474 back_relpth = os.path.relpath(local_files_dir, root)
475 os.symlink('%s/oe-local-files/%s/%s' % (back_relpth, relpth, fn), destpth)
477 os.symlink('oe-local-files/%s' % fn, destpth)
478 addfiles.append(os.path.join(relpth, fn))
483 …bb.process.run('git %s commit -m "Committing local file symlinks\n\n%s"' % (' '.join(useroptions),…
490 import oe.path
497 if not os.path.exists(srctree):
498 raise DevtoolError("output path %s does not exist" % srctree)
500 if os.path.exists(srctree):
501 if not os.path.isdir(srctree):
502 raise DevtoolError("output path %s exists and is not a directory" %
505 raise DevtoolError("output path %s already exists and is "
506 "non-empty" % srctree)
524 if not override.startswith('pn-'):
532 …logger.info('SRC_URI contains some conditional appends/prepends - will create branches to represen…
538 is_kernel_yocto = bb.data.inherits_class('kernel-yocto', d)
544 # However, with recipe-specific sysroots the sysroots for the recipe
547 # our attempts to hardlink files into the recipe-specific sysroots
554 tempdir = tempfile.mkdtemp(prefix='devtooltmp-', dir=tempbasedir)
561 if os.path.exists(appendfile):
562 appendbackup = os.path.join(tempdir, os.path.basename(appendfile) + '.bak')
566 bb.utils.mkdirhier(os.path.dirname(appendfile))
569 f.write('###--- _extract_source\n')
577 f.write('inherit devtool-source\n')
578 f.write('###--- _extract_source\n')
584 preservestampfile = os.path.join(sstate_manifests, 'preserve-stamps')
609 if os.path.exists(preservestampfile):
617 if os.path.islink(srctree):
627 with open(os.path.join(tempdir, 'initial_rev'), 'r') as f:
630 with open(os.path.join(tempdir, 'srcsubdir'), 'r') as f:
633 …raise DevtoolError('Something went wrong with source extraction - the devtool-source class was not…
634 srcsubdir_rel = os.path.relpath(srcsubdir, os.path.join(tempdir, 'workdir'))
636 # Check if work-shared is empty, if yes
637 # find source and copy to work-shared
643 # handle dangling symbolic link in work-shared:
644 if os.path.islink(workshareddir):
647 …if os.path.exists(workshareddir) and (not os.listdir(workshareddir) or kernelVersion != staging_ke…
649 oe.path.copyhardlinktree(srcsubdir,workshareddir)
650 elif not os.path.exists(workshareddir):
651 oe.path.copyhardlinktree(srcsubdir,workshareddir)
653 tempdir_localdir = os.path.join(tempdir, 'oe-local-files')
654 srctree_localdir = os.path.join(srctree, 'oe-local-files')
659 # Move oe-local-files directory to srctree
660 # As the oe-local-files is not part of the constructed git tree,
662 # the users. Instead, we move it to oe-local-files.bak and remind
664 if os.path.exists(srctree_localdir + '.bak'):
667 if os.path.exists(srctree_localdir):
671 if os.path.exists(tempdir_localdir):
675 # Move oe-local-files directory to srctree
676 if os.path.exists(tempdir_localdir):
685 shutil.copy2(os.path.join(tempdir, '.config'), srctree)
690 elif os.path.exists(appendfile):
699 … """Record checksum of a file (or recursively for a directory) to the md5-file of the workspace"""
704 with open(os.path.join(config.workspace_path, '.devtool_md5'), 'a+') as f:
705 md5_str = '%s|%s|%s\n' % (recipename, os.path.relpath(fn, config.workspace_path), md5)
710 if os.path.isdir(filename):
713 addfile(os.path.join(root, f))
721 origfile = os.path.join(config.workspace_path, '.devtool_md5')
722 newfile = os.path.join(config.workspace_path, '.devtool_md5_new')
723 preservepath = os.path.join(config.workspace_path, 'attic', recipename)
729 removefile = os.path.join(config.workspace_path, splitline[1])
740 preservefile = os.path.basename(removefile)
742 shutil.move(removefile, os.path.join(preservepath, preservefile))
750 # Kernel version from work-shared
753 if os.path.exists(srcdir) and os.listdir(srcdir):
754 with open(os.path.join(srcdir,"Makefile")) as f:
763 if os.path.exists(srcdir) and os.listdir(srcdir):
764 (branch, _) = bb.process.run('git branch | grep \* | cut -d \' \' -f2', cwd=srcdir)
770 s = os.path.abspath(s)
771 workdir = os.path.abspath(workdir)
772 if s.startswith(workdir) and s != workdir and os.path.dirname(s) != workdir:
774 srcsubdir = os.path.relpath(s, workdir).split(os.sep, 1)[1]
775 srctree = os.path.join(srctree, srcsubdir)
783 import oe.path
803 srctree = os.path.abspath(args.srctree)
807 if args.no_extract and not os.path.isdir(srctree):
808 raise DevtoolError("--no-extract specified and source path %s does "
814 if os.path.exists(appendfile):
826 if bb.data.inherits_class('kernel-yocto', rd):
834 …if (os.path.exists(srcdir) and os.listdir(srcdir)) and (kernelVersion in staging_kerVer and stagin…
835 oe.path.copyhardlinktree(srcdir,srctree)
838 localfilesdir = os.path.join(srctree,'oe-local-files')
840 … recipe_patches = [os.path.basename(patch) for patch in oe.recipeutils.get_recipe_patches(rd)]
849 cfg = os.path.join(os.path.dirname(local_files[key]), line[-1])
851 local_files[line[-1]] = cfg
856 srcabspath = os.path.abspath(srcsubdir)
857 …me for fname in local_files if os.path.exists(os.path.join(workdir, fname)) and (srcabspath == wo…
860 … _move_file(os.path.join(workdir, fname), os.path.join(srctree, 'oe-local-files', fname))
861 with open(os.path.join(srctree, 'oe-local-files', '.gitignore'), 'w') as f:
872 shutil.copy2(os.path.join(kconfpath, '.config'),srctree)
883 if os.path.exists(os.path.join(srctree, '.git')):
885 … (stdout, _) = bb.process.run('git rev-list --reverse %s..HEAD' % initial_rev, cwd=srctree)
886 commits = stdout.split()
889 if os.path.exists(os.path.join(srctree, '.git')):
891 # by ensuring that devtool-base and args.branch (devtool) exist.
895 (stdout, _) = bb.process.run('git branch --contains devtool-base', cwd=srctree)
896 bb.process.run('git rev-parse %s' % args.branch, cwd=srctree)
898 stdout = ''
899 if stdout:
901 for line in stdout.splitlines():
903 (stdout, _) = bb.process.run('git rev-parse devtool-base', cwd=srctree)
904 initial_rev = stdout.rstrip()
907 (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree)
908 initial_rev = stdout.rstrip()
913 (stdout, _) = bb.process.run('git branch', cwd=srctree)
915 for line in stdout.rstrip().splitlines():
920 …there (duplicates on those branches will be ignored by devtool finish/update-recipe)' % (override_…
925 (stdout, _) = bb.process.run('git log devtool-base..%s' % branch, cwd=srctree)
926 for line in stdout.splitlines():
929 … origpatch = line[len(oe.patch.GitApplyTree.patch_line_prefix):].split(':', 1)[-1].strip()
938 bb.utils.mkdirhier(os.path.dirname(appendfile))
944 os.path.join(srctreebase, 'oe-local-files'))
948 …f.write('# NOTE: We use pn- overrides here to avoid affecting multiple variants in the case where …
949 f.write('EXTERNALSRC:pn-%s = "%s"\n' % (pn, srctree))
953 f.write('EXTERNALSRC_BUILD:pn-%s = "%s"\n' % (pn, srctree))
961 ' ln -sfT ${B}/.config ${S}/.config.new\n'
964 ' if [ -e ${S}/.config ]; then\n'
972 ' ln -sfT ${B}/.config ${S}/.config.new\n'
1005 raise DevtoolError('You must specify a new name, a version with -V/--version, or both')
1020 appendfn = os.path.splitext(os.path.basename(append))[0]
1046 # Correct variable values that refer to the upstream source - these
1055 new_s = new_s.replace('${BP}', '%s-${PV}' % bpn)
1058 new_src_uri = new_src_uri.replace('${BP}', '%s-${PV}' % bpn)
1061 new_s = new_s.replace('${BP}', '${BPN}-%s' % pv)
1063 new_src_uri = new_src_uri.replace('${BP}', '${BPN}-%s' % pv)
1088 oldrecipedir = os.path.dirname(recipefile)
1089 newrecipedir = os.path.join(config.workspace_path, 'recipes', newname)
1093 newappend = os.path.join(os.path.dirname(append), newappend)
1094 newfile = os.path.join(newrecipedir, newfile)
1103 # Rename source tree if it's the default path
1107 … if os.path.abspath(srctree) == os.path.join(config.workspace_path, 'sources', args.recipename):
1108 newsrctree = os.path.join(config.workspace_path, 'sources', newname)
1127 bpndir = os.path.join(oldrecipedir, bpn)
1128 if os.path.exists(bpndir):
1129 newbpndir = os.path.join(newrecipedir, newbpn)
1136 bpdir = os.path.join(oldrecipedir, bp)
1137 if os.path.exists(bpdir):
1138 newbpdir = os.path.join(newrecipedir, '%s-%s' % (newbpn, newver))
1145 oldpath = os.path.join(oldrecipedir, entry)
1146 newpath = os.path.join(newrecipedir, entry)
1153 with open(os.path.join(config.workspace_path, '.devtool_md5'), 'r') as f:
1158 relbpndir = os.path.relpath(bpndir, config.workspace_path) + '/'
1162 relbpdir = os.path.relpath(bpdir, config.workspace_path) + '/'
1166 with open(os.path.join(config.workspace_path, '.devtool_md5'), 'w') as f:
1172 if splitentry[1] == os.path.relpath(append, config.workspace_path):
1173 splitentry[1] = os.path.relpath(newappend, config.workspace_path)
1176 elif splitentry[1] == os.path.relpath(recipefile, config.workspace_path):
1177 splitentry[1] = os.path.relpath(newfile, config.workspace_path)
1181 …splitentry[1] = os.path.relpath(os.path.join(newbpndir, splitentry[1][len(relbpndir):]), config.wo…
1183 …splitentry[1] = os.path.relpath(os.path.join(newbpdir, splitentry[1][len(relbpdir):]), config.work…
1191 whole patchset and start point for the patches to be re-generated/updated.
1196 stdout, _ = bb.process.run('git rev-parse --abbrev-ref HEAD',
1198 branchname = stdout.rstrip()
1207 initial_rev = line.split(':')[-1].strip()
1209 commits.append(line.split(':')[-1].strip())
1211 patches = line.split(':')[-1].strip().split(',')
1217 stdout, _ = bb.process.run('git rev-list --reverse %s..HEAD' %
1219 newcommits = stdout.split()
1225 stdout, _ = bb.process.run('git cherry devtool-patched',
1228 stdout = None
1230 if stdout is not None and not force_patch_refresh:
1232 for line in stdout.splitlines():
1245 basename = os.path.basename(fname)
1248 os.path.basename(srcuri[i].split(';')[0]) == basename):
1257 basename = os.path.basename(filename)
1259 if os.path.basename(srcuri[i].split(';')[0]) == basename:
1267 dry_run_suffix = ' (dry-run)' if dry_run else ''
1269 for path in files:
1273 path = os.path.join(destpath, os.path.basename(path))
1275 if os.path.exists(path):
1277 logger.info('Removing file %s%s' % (path, dry_run_suffix))
1284 os.remove(path)
1287 os.rmdir(os.path.dirname(path))
1295 Returns three-tuple of dicts:
1296 1. updated - patches that already exist in SRCURI
1297 2. added - new patches that don't exist in SRCURI
1298 3 removed - patches that exist in SRCURI but not in exported patches
1300 absolute path to the existing file in recipe space (if any).
1306 seqpatch_re = re.compile('^([0-9]{4}-)?(.+)')
1308 existing_patches = dict((os.path.basename(path), path) for path in
1313 patch_pathspec = _git_exclude_path(srctree, 'oe-local-files')
1326 old_basename_splitext = os.path.splitext(old_basename)
1328 old_patch_noext = os.path.splitext(old_patch)[0]
1337 bb.utils.rename(os.path.join(destdir, new_patch),
1338 os.path.join(destdir, match_name))
1343 with open(os.path.join(destdir, match_name), 'r') as f:
1368 orig_config = os.path.join(srctree, '.config.baseline')
1369 new_config = os.path.join(srctree, '.config.new')
1370 if os.path.exists(orig_config) and os.path.exists(new_config):
1371 cmd = ['diff', '--new-line-format=%L', '--old-line-format=',
1372 '--unchanged-line-format=', orig_config, new_config]
1373 pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE,
1375 stdout, stderr = pipe.communicate()
1379 fobj.write(stdout)
1382 if os.path.exists(outfile):
1387 raise bb.process.ExecutionError(cmd, pipe.returncode, stdout, stderr)
1394 Returns three-tuple of dicts:
1395 1. updated - files that already exist in SRCURI
1396 2. added - new files files that don't exist in SRCURI
1397 3 removed - files that exist in SRCURI but not in exported files
1399 absolute path to the existing file in recipe space (if any).
1418 stdout, _ = bb.process.run('git rev-parse --abbrev-ref HEAD',
1420 branchname = stdout.rstrip()
1424 local_files_dir = os.path.join(srctreebase, 'oe-local-files')
1426 if 'oe-local-files' in git_files:
1429 tmp_index = os.path.join(srctree, '.git', 'index.tmp.devtool')
1430 tree = git_files['oe-local-files'][2]
1431 bb.process.run(['git', 'checkout', tree, '--', '.'], cwd=srctree,
1435 elif os.path.isdir(local_files_dir):
1438 bb.process.run(['cp', '-ax',
1439 os.path.join(local_files_dir, '.'), destdir])
1444 if bb.data.inherits_class('kernel-yocto', rd):
1445 fragment_fn = 'devtool-fragment.cfg'
1446 fragment_path = os.path.join(destdir, fragment_fn)
1448 if os.path.exists(fragment_path):
1451 # Copy fragment to local-files
1452 if os.path.isdir(local_files_dir):
1457 # Remove fragment from local-files
1458 if os.path.exists(os.path.join(local_files_dir, fragment_fn)):
1459 os.unlink(os.path.join(local_files_dir, fragment_fn))
1463 for frag_class, frag_name in [("cml1", "fragment.cfg"), ("ccmake", "site-file.cmake")]:
1465 srcpath = os.path.join(rd.getVar('WORKDIR'), frag_name)
1466 if os.path.exists(srcpath):
1472 if os.path.isdir(local_files_dir):
1479 workpath = os.path.join(local_files_dir, fname)
1494 fworkpath = os.path.join(workdir, fname)
1496 fpath = os.path.join(srctree, os.path.relpath(fworkpath, s))
1497 if os.path.exists(fpath):
1510 relpth = os.path.relpath(entry, recipedir)
1512 … # One (or zero) levels below only, so we don't put anything in machine-specific directories
1513 if os.path.isdir(entry):
1515 return os.path.join(recipedir, rd.getVar('BPN'))
1519 """Implement the 'srcrev' mode of update-recipe"""
1523 dry_run_suffix = ' (dry-run)' if dry_run_outdir else ''
1526 recipedir = os.path.basename(recipefile)
1531 stdout, _ = bb.process.run('git rev-parse HEAD', cwd=srctree)
1535 srcrev = stdout.strip()
1537 raise DevtoolError('Invalid hash returned by git: %s' % stdout)
1567 files = dict((os.path.join(local_files_dir, key), val) for
1574 logger.info('Creating bbappend (dry-run)')
1582 for basepath, path in upd_f.items():
1584 if os.path.isabs(basepath):
1587 _copy_file(basepath, path, dry_run_outdir=dry_run_outdir, base_outdir=recipedir)
1589 _move_file(os.path.join(local_files_dir, basepath), path,
1592 for basepath, path in new_f.items():
1594 _move_file(os.path.join(local_files_dir, basepath),
1595 os.path.join(files_dir, basepath),
1614 """Implement the 'patch' mode of update-recipe"""
1619 recipedir = os.path.dirname(recipefile)
1621 if not os.path.exists(append):
1625 relpatchdir = os.path.relpath(srctreebase, srctree)
1640 raise DevtoolError('Unable to find initial revision - please specify '
1641 'it with --initial-rev')
1648 dry_run_suffix = ' (dry-run)' if dry_run_outdir else ''
1663 logger.debug('Pre-filtering: update: %s, new: %s' % (dict(upd_p), dict(new_p)))
1677 files = OrderedDict((os.path.join(local_files_dir, key), val) for
1679 files.update(OrderedDict((os.path.join(patches_dir, key), val) for
1687 remaining = [srcuri_entry(os.path.basename(item)) for
1701 for basepath, path in upd_f.items():
1703 if os.path.isabs(basepath):
1706 _copy_file(basepath, path,
1709 _move_file(os.path.join(local_files_dir, basepath), path,
1712 for basepath, path in upd_p.items():
1713 patchfn = os.path.join(patches_dir, basepath)
1714 if os.path.dirname(path) + '/' == dl_dir:
1715 # This is a a downloaded patch file - we now need to
1718 path = os.path.join(files_dir, basepath)
1723 _move_file(patchfn, path,
1727 for basepath, path in new_f.items():
1729 _move_file(os.path.join(local_files_dir, basepath),
1730 os.path.join(files_dir, basepath),
1735 for basepath, path in new_p.items():
1737 _move_file(os.path.join(patches_dir, basepath),
1738 os.path.join(files_dir, basepath),
1748 logger.info('Updating recipe %s' % os.path.basename(recipefile))
1774 stdout, _ = bb.process.run('git rev-parse HEAD', cwd=srctree)
1775 head_rev = stdout.rstrip()
1776 stdout, _ = bb.process.run('git branch -r --contains %s' % head_rev,
1778 remote_brs = [branch.strip() for branch in stdout.splitlines()]
1793 stdout, _ = bb.process.run('git branch', cwd=srctree)
1795 for line in stdout.splitlines():
1811 …raise DevtoolError('Unable to determine main branch - please check out the main branch in source t…
1853 """Entry point for the devtool 'update-recipe' subcommand"""
1857 if not os.path.exists(args.append):
1860 if not os.path.exists(os.path.join(args.append, 'conf', 'layer.conf')):
1881 …logger.warning('Recipe file %s has been updated but is inside the workspace - you will need to mov…
1899 …logger.info('No recipes currently in your workspace - you can use "devtool modify" to work on an e…
1905 import oe.path
1910 layerconf_file = os.path.join(layerconf_path, 'conf', 'layer.conf')
1911 new_layerconf_file = os.path.join(layerconf_path, 'conf', '.layer.conf')
1939 if recipefile and os.path.exists(recipefile):
1942 … exec_build_env_command(config.init_path, basepath, 'bitbake -c clean %s' % ' '.join(targets))
1945 'wish, you may specify -n/--no-clean to '
1947 (e.command, e.stdout))
1953 if os.path.exists(appendfile):
1959 preservepath = os.path.join(config.workspace_path, 'attic', pn, pn)
1961 if os.path.exists(origdir):
1965 _move_file(os.path.join(origdir, fn),
1966 os.path.join(preservepath, fn))
1968 preservedir(os.path.join(root, dn))
1972 if recipefile and oe.path.is_path_parent(config.workspace_path, recipefile):
1974 preservedir(os.path.dirname(recipefile))
1976 preservedir(os.path.join(config.workspace_path, 'appends', pn))
1979 if os.path.isdir(srctreebase):
1982 logger.info('-r argument used on %s, removing source tree.'
1987 logger.info('Leaving source tree %s as-is; if you no '
2005 raise DevtoolError("Recipe cannot be specified if -a/--all is used")
2010 raise DevtoolError("Recipe must be specified, or specify -a/--all to "
2023 """Determine the base layer path for the specified layer name/path"""
2027 bn = os.path.basename(p)
2033 if layername.lower() in ['oe-core', 'openembedded-core']:
2037 return os.path.abspath(layername)
2039 return os.path.abspath(layer_paths[0])
2043 …logger.warning("Consider using path instead of base name to specify layer:\n\t\t%s" % '\n\t\t'.joi…
2044 return os.path.abspath(layer_paths[0])
2054 dry_run_suffix = ' (dry-run)' if args.dry_run else ''
2057 corebasedir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
2064 logger.warning('Source tree is not clean, continuing as requested by -f/--force')
2066 …e tree is not clean:\n\n%s\nEnsure you have committed your changes or use -f/--force if you are su…
2078 recipedir = os.path.dirname(recipefile)
2081 if not os.path.isdir(destlayerdir):
2084 if os.path.abspath(destlayerdir) == config.workspace_path:
2085 …raise DevtoolError('"%s" specifies the workspace layer - that is not a valid destination' % args.d…
2087 # If it's an upgrade, grab the original path
2107 origrelpath = os.path.relpath(origpath, origlayerpath)
2110 … layer path - check that %s specifies an actual layer and %s/conf/layer.conf specifies BBFILES. Yo…
2112 layerdirs = [os.path.abspath(layerdir) for layerdir in rd.getVar('BBLAYERS').split()]
2113 if not os.path.abspath(destlayerbasedir) in layerdirs:
2133 removed = [os.path.relpath(pth, recipedir) for pth in removed]
2138 fnp = os.path.join(origpath, fn)
2139 if fn in removed or not os.path.exists(os.path.join(recipedir, fn)):
2148 # Recipe file itself is in the workspace - need to move it and any
2154 srcpath = os.path.join(root, fn)
2155 relpth = os.path.relpath(os.path.dirname(srcpath), recipedir)
2156 destdir = os.path.abspath(os.path.join(destpath, relpth))
2157 destfp = os.path.join(destdir, fn)
2165 outf = os.path.join(root, fn)
2166 relf = os.path.relpath(outf, dry_run_outdir)
2167 logger.debug('dry-run: output file %s' % relf)
2170 # Need to match this up with the pre-upgrade recipe file
2173 … comparelist.append((os.path.abspath(os.path.join(origpath, origf)),
2175 … os.path.abspath(os.path.join(destpath, relf))))
2182 if os.path.exists(appendfile):
2190 recipedest = os.path.dirname(appendfile)
2192 recipedest = os.path.dirname(recipefile)
2193 destfp = os.path.join(recipedest, relf)
2194 if os.path.exists(destfp):
2219 logger.info('Resetting recipe (dry-run)')
2227 """Get the default srctree path"""
2230 return os.path.join(srctreeparent, 'sources', recipename)
2232 return os.path.join(srctreeparent, 'sources')
2241 …='Name for new recipe to add (just name - no version, path or extension). If not specified, will a…
2242 …parser_add.add_argument('srctree', nargs='?', help='Path to external source tree. If not specified…
2245 …group.add_argument('--same-dir', '-s', help='Build in same directory as source', action="store_tru…
2246 …group.add_argument('--no-same-dir', help='Force build in a separate build directory', action="stor…
2247 …parser_add.add_argument('--fetch', '-f', help='Fetch the specified URI and extract it to create th…
2248 …parser_add.add_argument('--npm-dev', help='For npm, also fetch devDependencies', action="store_tru…
2249 parser_add.add_argument('--version', '-V', help='Version to use within recipe (PV)')
2250 …parser_add.add_argument('--no-git', '-g', help='If fetching source, do not set up source tree as a…
2252 …group.add_argument('--srcrev', '-S', help='Source revision to fetch if fetching from an SCM such a…
2253 …group.add_argument('--autorev', '-a', help='When fetching from a git repository, set SRCREV in the…
2254 …parser_add.add_argument('--srcbranch', '-B', help='Branch in source repository if fetching from an…
2255 …parser_add.add_argument('--binary', '-b', help='Treat the source tree as something that should be …
2256 …parser_add.add_argument('--also-native', help='Also add native variant (i.e. support building reci…
2257 …parser_add.add_argument('--src-subdir', help='Specify subdirectory within source tree to use', met…
2258 …parser_add.add_argument('--mirrors', help='Enable PREMIRRORS and MIRRORS for source tree fetching …
2259 …parser_add.add_argument('--provides', '-p', help='Specify an alias for the item provided by the re…
2263 …on it; alternatively if you already have your own pre-prepared source tree you can specify -n/--no
2265 …ent('recipename', help='Name of existing recipe to edit (just name - no version, path or extension…
2266 …parser_modify.add_argument('srctree', nargs='?', help='Path to external source tree. If not specif…
2267 …parser_modify.add_argument('--wildcard', '-w', action="store_true", help='Use wildcard for unversi…
2269 …group.add_argument('--extract', '-x', action="store_true", help='Extract source for recipe (defaul…
2270 …group.add_argument('--no-extract', '-n', action="store_true", help='Do not extract source, expect …
2272 …group.add_argument('--same-dir', '-s', help='Build in same directory as source', action="store_tru…
2273 …group.add_argument('--no-same-dir', help='Force build in a separate build directory', action="stor…
2274 …r_modify.add_argument('--branch', '-b', default="devtool", help='Name for development branch to ch…
2275 …parser_modify.add_argument('--no-overrides', '-O', action="store_true", help='Do not create branch…
2276 …parser_modify.add_argument('--keep-temp', help='Keep temporary directory (for debugging)', action=…
2283 parser_extract.add_argument('srctree', help='Path to where to extract the source tree')
2284 …parser_extract.add_argument('--branch', '-b', default="devtool", help='Name for development branch…
2285 …parser_extract.add_argument('--no-overrides', '-O', action="store_true", help='Do not create branc…
2286 …parser_extract.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (fo…
2294 parser_sync.add_argument('srctree', help='Path to the source tree')
2295 …parser_sync.add_argument('--branch', '-b', default="devtool", help='Name for development branch to…
2296 …parser_sync.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for d…
2304 …parser_rename.add_argument('--version', '-V', help='Change the version (NOTE: this does not change…
2305--no-srctree', '-s', action='store_true', help='Do not rename the source tree directory (if the de…
2308 …parser_update_recipe = subparsers.add_parser('update-recipe', help='Apply changes from external so…
2310 group='working', order=-90)
2312 …parser_update_recipe.add_argument('--mode', '-m', choices=['patch', 'srcrev', 'auto'], default='au…
2313 … parser_update_recipe.add_argument('--initial-rev', help='Override starting revision for patches')
2314 …parser_update_recipe.add_argument('--append', '-a', help='Write changes to a bbappend in the speci…
2315 …parser_update_recipe.add_argument('--wildcard-version', '-w', help='In conjunction with -a/--appen…
2316 …parser_update_recipe.add_argument('--no-remove', '-n', action="store_true", help='Don\'t remove pa…
2317 …parser_update_recipe.add_argument('--no-overrides', '-O', action="store_true", help='Do not handle…
2318 …parser_update_recipe.add_argument('--dry-run', '-N', action="store_true", help='Dry-run (just repo…
2319 …parser_update_recipe.add_argument('--force-patch-refresh', action="store_true", help='Update patch…
2329 group='working', order=-100)
2331 …parser_reset.add_argument('--all', '-a', action="store_true", help='Reset all recipes (clear works…
2332 …parser_reset.add_argument('--no-clean', '-n', action="store_true", help='Don\'t clean the sysroot …
2333 …parser_reset.add_argument('--remove-work', '-r', action="store_true", help='Clean the sources dire…
2337 …t from your workspace. Roughly equivalent to an update-recipe followed by reset, except the update
2338 group='working', order=-100)
2340path to put recipe into. Can be the name of a layer configured in your bblayers.conf, the path to …
2341 …parser_finish.add_argument('--mode', '-m', choices=['patch', 'srcrev', 'auto'], default='auto', he…
2342 parser_finish.add_argument('--initial-rev', help='Override starting revision for patches')
2343 …parser_finish.add_argument('--force', '-f', action="store_true", help='Force continuing even if th…
2344 …parser_finish.add_argument('--remove-work', '-r', action="store_true", help='Clean the sources dir…
2345 …parser_finish.add_argument('--no-clean', '-n', action="store_true", help='Don\'t clean the sysroot…
2346 …parser_finish.add_argument('--no-overrides', '-O', action="store_true", help='Do not handle other …
2347 …parser_finish.add_argument('--dry-run', '-N', action="store_true", help='Dry-run (just report chan…
2348 …parser_finish.add_argument('--force-patch-refresh', action="store_true", help='Update patches in t…