summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/lib/devtool/__init__.py15
-rw-r--r--scripts/lib/devtool/standard.py18
2 files changed, 20 insertions, 13 deletions
diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py
index e617d60405..7f16e17935 100644
--- a/scripts/lib/devtool/__init__.py
+++ b/scripts/lib/devtool/__init__.py
@@ -22,6 +22,7 @@ import os
22import sys 22import sys
23import subprocess 23import subprocess
24import logging 24import logging
25import re
25 26
26logger = logging.getLogger('devtool') 27logger = logging.getLogger('devtool')
27 28
@@ -199,3 +200,17 @@ def setup_git_repo(repodir, version, devbranch, basetag='devtool-base'):
199 200
200 bb.process.run('git checkout -b %s' % devbranch, cwd=repodir) 201 bb.process.run('git checkout -b %s' % devbranch, cwd=repodir)
201 bb.process.run('git tag -f %s' % basetag, cwd=repodir) 202 bb.process.run('git tag -f %s' % basetag, cwd=repodir)
203
204def recipe_to_append(recipefile, config, wildcard=False):
205 """
206 Convert a recipe file to a bbappend file path within the workspace.
207 NOTE: if the bbappend already exists, you should be using
208 workspace[args.recipename]['bbappend'] instead of calling this
209 function.
210 """
211 appendname = os.path.splitext(os.path.basename(recipefile))[0]
212 if wildcard:
213 appendname = re.sub(r'_.*', '_%', appendname)
214 appendpath = os.path.join(config.workspace_path, 'appends')
215 appendfile = os.path.join(appendpath, appendname + '.bbappend')
216 return appendfile
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 57175a449a..0103d936b5 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -26,7 +26,7 @@ import argparse
26import scriptutils 26import scriptutils
27import errno 27import errno
28from collections import OrderedDict 28from collections import OrderedDict
29from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, use_external_build, setup_git_repo, DevtoolError 29from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, use_external_build, setup_git_repo, recipe_to_append, DevtoolError
30from devtool import parse_recipe 30from devtool import parse_recipe
31 31
32logger = logging.getLogger('devtool') 32logger = logging.getLogger('devtool')
@@ -64,10 +64,6 @@ def add(args, config, basepath, workspace):
64 raise DevtoolError("Specified source tree %s could not be found" % 64 raise DevtoolError("Specified source tree %s could not be found" %
65 srctree) 65 srctree)
66 66
67 appendpath = os.path.join(config.workspace_path, 'appends')
68 if not os.path.exists(appendpath):
69 os.makedirs(appendpath)
70
71 recipedir = os.path.join(config.workspace_path, 'recipes', args.recipename) 67 recipedir = os.path.join(config.workspace_path, 'recipes', args.recipename)
72 bb.utils.mkdirhier(recipedir) 68 bb.utils.mkdirhier(recipedir)
73 rfv = None 69 rfv = None
@@ -121,7 +117,8 @@ def add(args, config, basepath, workspace):
121 if not rd: 117 if not rd:
122 return 1 118 return 1
123 119
124 appendfile = os.path.join(appendpath, '%s.bbappend' % bp) 120 appendfile = recipe_to_append(recipefile, config)
121 bb.utils.mkdirhier(os.path.dirname(appendfile))
125 with open(appendfile, 'w') as f: 122 with open(appendfile, 'w') as f:
126 f.write('inherit externalsrc\n') 123 f.write('inherit externalsrc\n')
127 f.write('EXTERNALSRC = "%s"\n' % srctree) 124 f.write('EXTERNALSRC = "%s"\n' % srctree)
@@ -584,11 +581,7 @@ def modify(args, config, basepath, workspace):
584 pn) 581 pn)
585 582
586 recipefile = rd.getVar('FILE', True) 583 recipefile = rd.getVar('FILE', True)
587 appendname = os.path.splitext(os.path.basename(recipefile))[0] 584 appendfile = recipe_to_append(recipefile, config, args.wildcard)
588 if args.wildcard:
589 appendname = re.sub(r'_.*', '_%', appendname)
590 appendpath = os.path.join(config.workspace_path, 'appends')
591 appendfile = os.path.join(appendpath, appendname + '.bbappend')
592 if os.path.exists(appendfile): 585 if os.path.exists(appendfile):
593 raise DevtoolError("Another variant of recipe %s is already in your " 586 raise DevtoolError("Another variant of recipe %s is already in your "
594 "workspace (only one variant of a recipe can " 587 "workspace (only one variant of a recipe can "
@@ -632,8 +625,7 @@ def modify(args, config, basepath, workspace):
632 srcsubdir = os.path.relpath(s, workdir).split(os.sep, 1)[1] 625 srcsubdir = os.path.relpath(s, workdir).split(os.sep, 1)[1]
633 srctree = os.path.join(srctree, srcsubdir) 626 srctree = os.path.join(srctree, srcsubdir)
634 627
635 if not os.path.exists(appendpath): 628 bb.utils.mkdirhier(os.path.dirname(appendfile))
636 os.makedirs(appendpath)
637 with open(appendfile, 'w') as f: 629 with open(appendfile, 'w') as f:
638 f.write('FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n') 630 f.write('FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"\n')
639 # Local files can be modified/tracked in separate subdir under srctree 631 # Local files can be modified/tracked in separate subdir under srctree