summaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/recipetool')
-rw-r--r--scripts/lib/recipetool/append.py22
-rw-r--r--scripts/lib/recipetool/create.py24
-rw-r--r--scripts/lib/recipetool/create_buildsys_python.py4
-rw-r--r--scripts/lib/recipetool/create_kernel.py4
-rw-r--r--scripts/lib/recipetool/create_npm.py6
-rw-r--r--scripts/lib/recipetool/newappend.py2
6 files changed, 31 insertions, 31 deletions
diff --git a/scripts/lib/recipetool/append.py b/scripts/lib/recipetool/append.py
index 3e85a0cb0f..def4f9027c 100644
--- a/scripts/lib/recipetool/append.py
+++ b/scripts/lib/recipetool/append.py
@@ -48,7 +48,7 @@ def find_target_file(targetpath, d, pkglist=None):
48 """Find the recipe installing the specified target path, optionally limited to a select list of packages""" 48 """Find the recipe installing the specified target path, optionally limited to a select list of packages"""
49 import json 49 import json
50 50
51 pkgdata_dir = d.getVar('PKGDATA_DIR', True) 51 pkgdata_dir = d.getVar('PKGDATA_DIR')
52 52
53 # The mix between /etc and ${sysconfdir} here may look odd, but it is just 53 # The mix between /etc and ${sysconfdir} here may look odd, but it is just
54 # being consistent with usage elsewhere 54 # being consistent with usage elsewhere
@@ -110,8 +110,8 @@ def determine_file_source(targetpath, rd):
110 import oe.recipeutils 110 import oe.recipeutils
111 111
112 # See if it's in do_install for the recipe 112 # See if it's in do_install for the recipe
113 workdir = rd.getVar('WORKDIR', True) 113 workdir = rd.getVar('WORKDIR')
114 src_uri = rd.getVar('SRC_URI', True) 114 src_uri = rd.getVar('SRC_URI')
115 srcfile = '' 115 srcfile = ''
116 modpatches = [] 116 modpatches = []
117 elements = check_do_install(rd, targetpath) 117 elements = check_do_install(rd, targetpath)
@@ -190,7 +190,7 @@ def get_source_path(cmdelements):
190 190
191def get_func_deps(func, d): 191def get_func_deps(func, d):
192 """Find the function dependencies of a shell function""" 192 """Find the function dependencies of a shell function"""
193 deps = bb.codeparser.ShellParser(func, logger).parse_shell(d.getVar(func, True)) 193 deps = bb.codeparser.ShellParser(func, logger).parse_shell(d.getVar(func))
194 deps |= set((d.getVarFlag(func, "vardeps", True) or "").split()) 194 deps |= set((d.getVarFlag(func, "vardeps", True) or "").split())
195 funcdeps = [] 195 funcdeps = []
196 for dep in deps: 196 for dep in deps:
@@ -200,12 +200,12 @@ def get_func_deps(func, d):
200 200
201def check_do_install(rd, targetpath): 201def check_do_install(rd, targetpath):
202 """Look at do_install for a command that installs/copies the specified target path""" 202 """Look at do_install for a command that installs/copies the specified target path"""
203 instpath = os.path.abspath(os.path.join(rd.getVar('D', True), targetpath.lstrip('/'))) 203 instpath = os.path.abspath(os.path.join(rd.getVar('D'), targetpath.lstrip('/')))
204 do_install = rd.getVar('do_install', True) 204 do_install = rd.getVar('do_install')
205 # Handle where do_install calls other functions (somewhat crudely, but good enough for this purpose) 205 # Handle where do_install calls other functions (somewhat crudely, but good enough for this purpose)
206 deps = get_func_deps('do_install', rd) 206 deps = get_func_deps('do_install', rd)
207 for dep in deps: 207 for dep in deps:
208 do_install = do_install.replace(dep, rd.getVar(dep, True)) 208 do_install = do_install.replace(dep, rd.getVar(dep))
209 209
210 # Look backwards through do_install as we want to catch where a later line (perhaps 210 # Look backwards through do_install as we want to catch where a later line (perhaps
211 # from a bbappend) is writing over the top 211 # from a bbappend) is writing over the top
@@ -322,12 +322,12 @@ def appendfile(args):
322def appendsrc(args, files, rd, extralines=None): 322def appendsrc(args, files, rd, extralines=None):
323 import oe.recipeutils 323 import oe.recipeutils
324 324
325 srcdir = rd.getVar('S', True) 325 srcdir = rd.getVar('S')
326 workdir = rd.getVar('WORKDIR', True) 326 workdir = rd.getVar('WORKDIR')
327 327
328 import bb.fetch 328 import bb.fetch
329 simplified = {} 329 simplified = {}
330 src_uri = rd.getVar('SRC_URI', True).split() 330 src_uri = rd.getVar('SRC_URI').split()
331 for uri in src_uri: 331 for uri in src_uri:
332 if uri.endswith(';'): 332 if uri.endswith(';'):
333 uri = uri[:-1] 333 uri = uri[:-1]
@@ -340,7 +340,7 @@ def appendsrc(args, files, rd, extralines=None):
340 for newfile, srcfile in files.items(): 340 for newfile, srcfile in files.items():
341 src_destdir = os.path.dirname(srcfile) 341 src_destdir = os.path.dirname(srcfile)
342 if not args.use_workdir: 342 if not args.use_workdir:
343 if rd.getVar('S', True) == rd.getVar('STAGING_KERNEL_DIR', True): 343 if rd.getVar('S') == rd.getVar('STAGING_KERNEL_DIR'):
344 srcdir = os.path.join(workdir, 'git') 344 srcdir = os.path.join(workdir, 'git')
345 if not bb.data.inherits_class('kernel-yocto', rd): 345 if not bb.data.inherits_class('kernel-yocto', rd):
346 logger.warn('S == STAGING_KERNEL_DIR and non-kernel-yocto, unable to determine path to srcdir, defaulting to ${WORKDIR}/git') 346 logger.warn('S == STAGING_KERNEL_DIR and non-kernel-yocto, unable to determine path to srcdir, defaulting to ${WORKDIR}/git')
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index ab265318e5..0801223582 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -68,8 +68,8 @@ class RecipeHandler(object):
68 return 68 return
69 # First build up library->package mapping 69 # First build up library->package mapping
70 shlib_providers = oe.package.read_shlib_providers(d) 70 shlib_providers = oe.package.read_shlib_providers(d)
71 libdir = d.getVar('libdir', True) 71 libdir = d.getVar('libdir')
72 base_libdir = d.getVar('base_libdir', True) 72 base_libdir = d.getVar('base_libdir')
73 libpaths = list(set([base_libdir, libdir])) 73 libpaths = list(set([base_libdir, libdir]))
74 libname_re = re.compile('^lib(.+)\.so.*$') 74 libname_re = re.compile('^lib(.+)\.so.*$')
75 pkglibmap = {} 75 pkglibmap = {}
@@ -85,7 +85,7 @@ class RecipeHandler(object):
85 logger.debug('unable to extract library name from %s' % lib) 85 logger.debug('unable to extract library name from %s' % lib)
86 86
87 # Now turn it into a library->recipe mapping 87 # Now turn it into a library->recipe mapping
88 pkgdata_dir = d.getVar('PKGDATA_DIR', True) 88 pkgdata_dir = d.getVar('PKGDATA_DIR')
89 for libname, pkg in pkglibmap.items(): 89 for libname, pkg in pkglibmap.items():
90 try: 90 try:
91 with open(os.path.join(pkgdata_dir, 'runtime', pkg)) as f: 91 with open(os.path.join(pkgdata_dir, 'runtime', pkg)) as f:
@@ -109,9 +109,9 @@ class RecipeHandler(object):
109 '''Build up development file->recipe mapping''' 109 '''Build up development file->recipe mapping'''
110 if RecipeHandler.recipeheadermap: 110 if RecipeHandler.recipeheadermap:
111 return 111 return
112 pkgdata_dir = d.getVar('PKGDATA_DIR', True) 112 pkgdata_dir = d.getVar('PKGDATA_DIR')
113 includedir = d.getVar('includedir', True) 113 includedir = d.getVar('includedir')
114 cmakedir = os.path.join(d.getVar('libdir', True), 'cmake') 114 cmakedir = os.path.join(d.getVar('libdir'), 'cmake')
115 for pkg in glob.glob(os.path.join(pkgdata_dir, 'runtime', '*-dev')): 115 for pkg in glob.glob(os.path.join(pkgdata_dir, 'runtime', '*-dev')):
116 with open(os.path.join(pkgdata_dir, 'runtime', pkg)) as f: 116 with open(os.path.join(pkgdata_dir, 'runtime', pkg)) as f:
117 pn = None 117 pn = None
@@ -140,9 +140,9 @@ class RecipeHandler(object):
140 '''Build up native binary->recipe mapping''' 140 '''Build up native binary->recipe mapping'''
141 if RecipeHandler.recipebinmap: 141 if RecipeHandler.recipebinmap:
142 return 142 return
143 sstate_manifests = d.getVar('SSTATE_MANIFESTS', True) 143 sstate_manifests = d.getVar('SSTATE_MANIFESTS')
144 staging_bindir_native = d.getVar('STAGING_BINDIR_NATIVE', True) 144 staging_bindir_native = d.getVar('STAGING_BINDIR_NATIVE')
145 build_arch = d.getVar('BUILD_ARCH', True) 145 build_arch = d.getVar('BUILD_ARCH')
146 fileprefix = 'manifest-%s-' % build_arch 146 fileprefix = 'manifest-%s-' % build_arch
147 for fn in glob.glob(os.path.join(sstate_manifests, '%s*-native.populate_sysroot' % fileprefix)): 147 for fn in glob.glob(os.path.join(sstate_manifests, '%s*-native.populate_sysroot' % fileprefix)):
148 with open(fn, 'r') as f: 148 with open(fn, 'r') as f:
@@ -837,7 +837,7 @@ def get_license_md5sums(d, static_only=False):
837 md5sums = {} 837 md5sums = {}
838 if not static_only: 838 if not static_only:
839 # Gather md5sums of license files in common license dir 839 # Gather md5sums of license files in common license dir
840 commonlicdir = d.getVar('COMMON_LICENSE_DIR', True) 840 commonlicdir = d.getVar('COMMON_LICENSE_DIR')
841 for fn in os.listdir(commonlicdir): 841 for fn in os.listdir(commonlicdir):
842 md5value = bb.utils.md5_file(os.path.join(commonlicdir, fn)) 842 md5value = bb.utils.md5_file(os.path.join(commonlicdir, fn))
843 md5sums[md5value] = fn 843 md5sums[md5value] = fn
@@ -1007,7 +1007,7 @@ def split_pkg_licenses(licvalues, packages, outlines, fallback_licenses=None, pn
1007 return outlicenses 1007 return outlicenses
1008 1008
1009def read_pkgconfig_provides(d): 1009def read_pkgconfig_provides(d):
1010 pkgdatadir = d.getVar('PKGDATA_DIR', True) 1010 pkgdatadir = d.getVar('PKGDATA_DIR')
1011 pkgmap = {} 1011 pkgmap = {}
1012 for fn in glob.glob(os.path.join(pkgdatadir, 'shlibs2', '*.pclist')): 1012 for fn in glob.glob(os.path.join(pkgdatadir, 'shlibs2', '*.pclist')):
1013 with open(fn, 'r') as f: 1013 with open(fn, 'r') as f:
@@ -1117,7 +1117,7 @@ def convert_rpm_xml(xmlfile):
1117 1117
1118 1118
1119def check_npm(d, debugonly=False): 1119def check_npm(d, debugonly=False):
1120 if not os.path.exists(os.path.join(d.getVar('STAGING_BINDIR_NATIVE', True), 'npm')): 1120 if not os.path.exists(os.path.join(d.getVar('STAGING_BINDIR_NATIVE'), 'npm')):
1121 log_error_cond('npm required to process specified source, but npm is not available - you need to build nodejs-native first', debugonly) 1121 log_error_cond('npm required to process specified source, but npm is not available - you need to build nodejs-native first', debugonly)
1122 sys.exit(14) 1122 sys.exit(14)
1123 1123
diff --git a/scripts/lib/recipetool/create_buildsys_python.py b/scripts/lib/recipetool/create_buildsys_python.py
index 82a2be1224..ec5449bee9 100644
--- a/scripts/lib/recipetool/create_buildsys_python.py
+++ b/scripts/lib/recipetool/create_buildsys_python.py
@@ -532,11 +532,11 @@ class PythonRecipeHandler(RecipeHandler):
532 532
533 def parse_pkgdata_for_python_packages(self): 533 def parse_pkgdata_for_python_packages(self):
534 suffixes = [t[0] for t in imp.get_suffixes()] 534 suffixes = [t[0] for t in imp.get_suffixes()]
535 pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR', True) 535 pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR')
536 536
537 ldata = tinfoil.config_data.createCopy() 537 ldata = tinfoil.config_data.createCopy()
538 bb.parse.handle('classes/python-dir.bbclass', ldata, True) 538 bb.parse.handle('classes/python-dir.bbclass', ldata, True)
539 python_sitedir = ldata.getVar('PYTHON_SITEPACKAGES_DIR', True) 539 python_sitedir = ldata.getVar('PYTHON_SITEPACKAGES_DIR')
540 540
541 dynload_dir = os.path.join(os.path.dirname(python_sitedir), 'lib-dynload') 541 dynload_dir = os.path.join(os.path.dirname(python_sitedir), 'lib-dynload')
542 python_dirs = [python_sitedir + os.sep, 542 python_dirs = [python_sitedir + os.sep,
diff --git a/scripts/lib/recipetool/create_kernel.py b/scripts/lib/recipetool/create_kernel.py
index 7dac59fd03..ca4996c7ac 100644
--- a/scripts/lib/recipetool/create_kernel.py
+++ b/scripts/lib/recipetool/create_kernel.py
@@ -41,7 +41,7 @@ class KernelRecipeHandler(RecipeHandler):
41 handled.append('buildsystem') 41 handled.append('buildsystem')
42 del lines_after[:] 42 del lines_after[:]
43 del classes[:] 43 del classes[:]
44 template = os.path.join(tinfoil.config_data.getVar('COREBASE', True), 'meta-skeleton', 'recipes-kernel', 'linux', 'linux-yocto-custom.bb') 44 template = os.path.join(tinfoil.config_data.getVar('COREBASE'), 'meta-skeleton', 'recipes-kernel', 'linux', 'linux-yocto-custom.bb')
45 def handle_var(varname, origvalue, op, newlines): 45 def handle_var(varname, origvalue, op, newlines):
46 if varname in ['SRCREV', 'SRCREV_machine']: 46 if varname in ['SRCREV', 'SRCREV_machine']:
47 while newlines[-1].startswith('#'): 47 while newlines[-1].startswith('#'):
@@ -85,7 +85,7 @@ class KernelRecipeHandler(RecipeHandler):
85 elif varname == 'COMPATIBLE_MACHINE': 85 elif varname == 'COMPATIBLE_MACHINE':
86 while newlines[-1].startswith('#'): 86 while newlines[-1].startswith('#'):
87 del newlines[-1] 87 del newlines[-1]
88 machine = tinfoil.config_data.getVar('MACHINE', True) 88 machine = tinfoil.config_data.getVar('MACHINE')
89 return machine, op, 0, True 89 return machine, op, 0, True
90 return origvalue, op, 0, True 90 return origvalue, op, 0, True
91 with open(template, 'r') as f: 91 with open(template, 'r') as f:
diff --git a/scripts/lib/recipetool/create_npm.py b/scripts/lib/recipetool/create_npm.py
index 7bb844cb0c..888aa2b00a 100644
--- a/scripts/lib/recipetool/create_npm.py
+++ b/scripts/lib/recipetool/create_npm.py
@@ -49,7 +49,7 @@ class NpmRecipeHandler(RecipeHandler):
49 49
50 def _shrinkwrap(self, srctree, localfilesdir, extravalues, lines_before): 50 def _shrinkwrap(self, srctree, localfilesdir, extravalues, lines_before):
51 try: 51 try:
52 runenv = dict(os.environ, PATH=tinfoil.config_data.getVar('PATH', True)) 52 runenv = dict(os.environ, PATH=tinfoil.config_data.getVar('PATH'))
53 bb.process.run('npm shrinkwrap', cwd=srctree, stderr=subprocess.STDOUT, env=runenv, shell=True) 53 bb.process.run('npm shrinkwrap', cwd=srctree, stderr=subprocess.STDOUT, env=runenv, shell=True)
54 except bb.process.ExecutionError as e: 54 except bb.process.ExecutionError as e:
55 logger.warn('npm shrinkwrap failed:\n%s' % e.stdout) 55 logger.warn('npm shrinkwrap failed:\n%s' % e.stdout)
@@ -62,7 +62,7 @@ class NpmRecipeHandler(RecipeHandler):
62 lines_before.append('NPM_SHRINKWRAP := "${THISDIR}/${PN}/npm-shrinkwrap.json"') 62 lines_before.append('NPM_SHRINKWRAP := "${THISDIR}/${PN}/npm-shrinkwrap.json"')
63 63
64 def _lockdown(self, srctree, localfilesdir, extravalues, lines_before): 64 def _lockdown(self, srctree, localfilesdir, extravalues, lines_before):
65 runenv = dict(os.environ, PATH=tinfoil.config_data.getVar('PATH', True)) 65 runenv = dict(os.environ, PATH=tinfoil.config_data.getVar('PATH'))
66 if not NpmRecipeHandler.lockdownpath: 66 if not NpmRecipeHandler.lockdownpath:
67 NpmRecipeHandler.lockdownpath = tempfile.mkdtemp('recipetool-npm-lockdown') 67 NpmRecipeHandler.lockdownpath = tempfile.mkdtemp('recipetool-npm-lockdown')
68 bb.process.run('npm install lockdown --prefix %s' % NpmRecipeHandler.lockdownpath, 68 bb.process.run('npm install lockdown --prefix %s' % NpmRecipeHandler.lockdownpath,
@@ -257,7 +257,7 @@ class NpmRecipeHandler(RecipeHandler):
257 if version != '*' and not '/' in version: 257 if version != '*' and not '/' in version:
258 pkgfullname += "@'%s'" % version 258 pkgfullname += "@'%s'" % version
259 logger.debug(2, "Calling getdeps on %s" % pkg) 259 logger.debug(2, "Calling getdeps on %s" % pkg)
260 runenv = dict(os.environ, PATH=d.getVar('PATH', True)) 260 runenv = dict(os.environ, PATH=d.getVar('PATH'))
261 fetchcmd = "npm view %s --json" % pkgfullname 261 fetchcmd = "npm view %s --json" % pkgfullname
262 output, _ = bb.process.run(fetchcmd, stderr=subprocess.STDOUT, env=runenv, shell=True) 262 output, _ = bb.process.run(fetchcmd, stderr=subprocess.STDOUT, env=runenv, shell=True)
263 data = self._parse_view(output) 263 data = self._parse_view(output)
diff --git a/scripts/lib/recipetool/newappend.py b/scripts/lib/recipetool/newappend.py
index 376084035f..0b63759d8c 100644
--- a/scripts/lib/recipetool/newappend.py
+++ b/scripts/lib/recipetool/newappend.py
@@ -60,7 +60,7 @@ def newappend(args):
60 if not path_ok: 60 if not path_ok:
61 logger.warn('Unable to determine correct subdirectory path for bbappend file - check that what %s adds to BBFILES also matches .bbappend files. Using %s for now, but until you fix this the bbappend will not be applied.', os.path.join(args.destlayer, 'conf', 'layer.conf'), os.path.dirname(append_path)) 61 logger.warn('Unable to determine correct subdirectory path for bbappend file - check that what %s adds to BBFILES also matches .bbappend files. Using %s for now, but until you fix this the bbappend will not be applied.', os.path.join(args.destlayer, 'conf', 'layer.conf'), os.path.dirname(append_path))
62 62
63 layerdirs = [os.path.abspath(layerdir) for layerdir in rd.getVar('BBLAYERS', True).split()] 63 layerdirs = [os.path.abspath(layerdir) for layerdir in rd.getVar('BBLAYERS').split()]
64 if not os.path.abspath(args.destlayer) in layerdirs: 64 if not os.path.abspath(args.destlayer) in layerdirs:
65 logger.warn('Specified layer is not currently enabled in bblayers.conf, you will need to add it before this bbappend will be active') 65 logger.warn('Specified layer is not currently enabled in bblayers.conf, you will need to add it before this bbappend will be active')
66 66