summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-01-23 00:59:48 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-24 09:40:32 +0000
commitd3a4f72896aaea7374bd8915cfe3adaaecc55a2d (patch)
tree0bd76cd1c224afe941bed4b0bb88551647cd7cb7
parenta9dfcedd21a5fe212d237633f40e2efcdfb34690 (diff)
downloadpoky-d3a4f72896aaea7374bd8915cfe3adaaecc55a2d.tar.gz
classes/populate_sdk_ext: add option to bring in pkgdata for world
Add a variable SDK_INCLUDE_PKGDATA which you can set to "1" to include pkgdata for all recipes in the world target. There are a couple of uses for this: 1) If you use "devtool add" to add a recipe that builds something which depends on anything in world, the dependency can then be correctly mapped to the recipe providing it and that recipe can be added to DEPENDS, since we have the pkg-config and shared library dependency data within pkgdata. 2) You'll be able to search for these recipes and any files they package for the target with "devtool search" since that also uses pkgdata This of course assumes you've tailored world through EXCLUDE_FROM_WORLD to only include recipes you'd want built in your distro, but I think that's a reasonable assumption; failing that there is a WORLD_PKGDATA_EXCLUDE variable that you can set to exclude any recipes you don't want. Note that this patch relies on functionality implemented in a recent BitBake patch and will not work without it. Implements [YOCTO #8600]. (From OE-Core rev: 67149ea097d6fab7496b43e85a40853f40bd527e) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/populate_sdk_ext.bbclass24
-rw-r--r--meta/lib/oe/copy_buildsystem.py58
-rw-r--r--meta/recipes-core/meta/meta-world-pkgdata.bb50
-rw-r--r--scripts/lib/devtool/sdk.py6
4 files changed, 131 insertions, 7 deletions
diff --git a/meta/classes/populate_sdk_ext.bbclass b/meta/classes/populate_sdk_ext.bbclass
index e5e55b3606..ebb57bba6b 100644
--- a/meta/classes/populate_sdk_ext.bbclass
+++ b/meta/classes/populate_sdk_ext.bbclass
@@ -24,6 +24,7 @@ SDK_INHERIT_BLACKLIST ?= "buildhistory icecc"
24SDK_UPDATE_URL ?= "" 24SDK_UPDATE_URL ?= ""
25 25
26SDK_TARGETS ?= "${PN}" 26SDK_TARGETS ?= "${PN}"
27SDK_INSTALL_TARGETS = "${SDK_TARGETS} ${@'meta-world-pkgdata:do_allpackagedata' if d.getVar('SDK_INCLUDE_PKGDATA', True) == '1' else ''}"
27OE_INIT_ENV_SCRIPT ?= "oe-init-build-env" 28OE_INIT_ENV_SCRIPT ?= "oe-init-build-env"
28 29
29# The files from COREBASE that you want preserved in the COREBASE copied 30# The files from COREBASE that you want preserved in the COREBASE copied
@@ -45,6 +46,7 @@ SDK_TITLE_task-populate-sdk-ext = "${@d.getVar('DISTRO_NAME', True) or d.getVar(
45 46
46python copy_buildsystem () { 47python copy_buildsystem () {
47 import re 48 import re
49 import shutil
48 import oe.copy_buildsystem 50 import oe.copy_buildsystem
49 51
50 oe_init_env_script = d.getVar('OE_INIT_ENV_SCRIPT', True) 52 oe_init_env_script = d.getVar('OE_INIT_ENV_SCRIPT', True)
@@ -91,6 +93,7 @@ python copy_buildsystem () {
91 config.set('General', 'core_meta_subdir', core_meta_subdir) 93 config.set('General', 'core_meta_subdir', core_meta_subdir)
92 config.add_section('SDK') 94 config.add_section('SDK')
93 config.set('SDK', 'sdk_targets', d.getVar('SDK_TARGETS', True)) 95 config.set('SDK', 'sdk_targets', d.getVar('SDK_TARGETS', True))
96 config.set('SDK', 'sdk_update_targets', d.getVar('SDK_INSTALL_TARGETS', True))
94 updateurl = d.getVar('SDK_UPDATE_URL', True) 97 updateurl = d.getVar('SDK_UPDATE_URL', True)
95 if updateurl: 98 if updateurl:
96 config.set('SDK', 'updateserver', updateurl) 99 config.set('SDK', 'updateserver', updateurl)
@@ -199,6 +202,22 @@ python copy_buildsystem () {
199 d.getVar('SSTATE_DIR', True), 202 d.getVar('SSTATE_DIR', True),
200 sstate_out, d, 203 sstate_out, d,
201 fixedlsbstring) 204 fixedlsbstring)
205
206 # Add packagedata if enabled
207 if d.getVar('SDK_INCLUDE_PKGDATA', True) == '1':
208 lockedsigs_base = d.getVar('WORKDIR', True) + '/locked-sigs-base.inc'
209 lockedsigs_copy = d.getVar('WORKDIR', True) + '/locked-sigs-copy.inc'
210 shutil.move(lockedsigs_pruned, lockedsigs_base)
211 oe.copy_buildsystem.merge_lockedsigs(['do_packagedata'],
212 lockedsigs_base,
213 d.getVar('STAGING_DIR_HOST', True) + '/world-pkgdata/locked-sigs-pkgdata.inc',
214 lockedsigs_pruned,
215 lockedsigs_copy)
216 oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_copy,
217 d.getVar('SSTATE_DIR', True),
218 sstate_out, d,
219 fixedlsbstring)
220
202 # We don't need sstate do_package files 221 # We don't need sstate do_package files
203 for root, dirs, files in os.walk(sstate_out): 222 for root, dirs, files in os.walk(sstate_out):
204 for name in files: 223 for name in files:
@@ -268,7 +287,7 @@ sdk_ext_postinst() {
268 # current working directory when first ran, nor will it set $1 when 287 # current working directory when first ran, nor will it set $1 when
269 # sourcing a script. That is why this has to look so ugly. 288 # sourcing a script. That is why this has to look so ugly.
270 LOGFILE="$target_sdk_dir/preparing_build_system.log" 289 LOGFILE="$target_sdk_dir/preparing_build_system.log"
271 sh -c ". buildtools/environment-setup* > $LOGFILE && cd $target_sdk_dir/`dirname ${oe_init_build_env_path}` && set $target_sdk_dir && . $target_sdk_dir/${oe_init_build_env_path} $target_sdk_dir >> $LOGFILE && python $target_sdk_dir/ext-sdk-prepare.py '${SDK_TARGETS}' >> $LOGFILE 2>&1" || { echo "ERROR: SDK preparation failed: see $LOGFILE"; echo "printf 'ERROR: this SDK was not fully installed and needs reinstalling\n'" >> $env_setup_script ; exit 1 ; } 290 sh -c ". buildtools/environment-setup* > $LOGFILE && cd $target_sdk_dir/`dirname ${oe_init_build_env_path}` && set $target_sdk_dir && . $target_sdk_dir/${oe_init_build_env_path} $target_sdk_dir >> $LOGFILE && python $target_sdk_dir/ext-sdk-prepare.py '${SDK_INSTALL_TARGETS}' >> $LOGFILE 2>&1" || { echo "ERROR: SDK preparation failed: see $LOGFILE"; echo "printf 'ERROR: this SDK was not fully installed and needs reinstalling\n'" >> $env_setup_script ; exit 1 ; }
272 fi 291 fi
273 echo done 292 echo done
274} 293}
@@ -314,7 +333,8 @@ def get_sdk_ext_rdepends(d):
314do_populate_sdk_ext[dirs] = "${@d.getVarFlag('do_populate_sdk', 'dirs', False)}" 333do_populate_sdk_ext[dirs] = "${@d.getVarFlag('do_populate_sdk', 'dirs', False)}"
315 334
316do_populate_sdk_ext[depends] = "${@d.getVarFlag('do_populate_sdk', 'depends', False)} \ 335do_populate_sdk_ext[depends] = "${@d.getVarFlag('do_populate_sdk', 'depends', False)} \
317 buildtools-tarball:do_populate_sdk uninative-tarball:do_populate_sdk" 336 buildtools-tarball:do_populate_sdk uninative-tarball:do_populate_sdk \
337 ${@'meta-world-pkgdata:do_collect_packagedata' if d.getVar('SDK_INCLUDE_PKGDATA', True) == '1' else ''}"
318 338
319do_populate_sdk_ext[rdepends] += "${@' '.join([x + ':do_build' for x in d.getVar('SDK_TARGETS', True).split()])}" 339do_populate_sdk_ext[rdepends] += "${@' '.join([x + ':do_build' for x in d.getVar('SDK_TARGETS', True).split()])}"
320 340
diff --git a/meta/lib/oe/copy_buildsystem.py b/meta/lib/oe/copy_buildsystem.py
index a5ca3df320..64755107d8 100644
--- a/meta/lib/oe/copy_buildsystem.py
+++ b/meta/lib/oe/copy_buildsystem.py
@@ -93,10 +93,64 @@ def prune_lockedsigs(excluded_tasks, excluded_targets, lockedsigs, pruned_output
93 invalue = True 93 invalue = True
94 f.write(line) 94 f.write(line)
95 95
96def merge_lockedsigs(copy_tasks, lockedsigs_main, lockedsigs_extra, merged_output, copy_output):
97 merged = {}
98 arch_order = []
99 with open(lockedsigs_main, 'r') as f:
100 invalue = None
101 for line in f:
102 if invalue:
103 if line.endswith('\\\n'):
104 merged[invalue].append(line)
105 else:
106 invalue = None
107 elif line.startswith('SIGGEN_LOCKEDSIGS_t-'):
108 invalue = line[18:].split('=', 1)[0].rstrip()
109 merged[invalue] = []
110 arch_order.append(invalue)
111
112 with open(lockedsigs_extra, 'r') as f:
113 invalue = None
114 tocopy = {}
115 for line in f:
116 if invalue:
117 if line.endswith('\\\n'):
118 if not line in merged[invalue]:
119 target, task = line.strip().split(':')[:2]
120 if task in copy_tasks:
121 tocopy[invalue].append(line)
122 merged[invalue].append(line)
123 else:
124 invalue = None
125 elif line.startswith('SIGGEN_LOCKEDSIGS_t-'):
126 invalue = line[18:].split('=', 1)[0].rstrip()
127 if not invalue in merged:
128 merged[invalue] = []
129 arch_order.append(invalue)
130 tocopy[invalue] = []
131
132 def write_sigs_file(fn, types, sigs):
133 fulltypes = []
134 bb.utils.mkdirhier(os.path.dirname(fn))
135 with open(fn, 'w') as f:
136 for typename in types:
137 lines = sigs[typename]
138 if lines:
139 f.write('SIGGEN_LOCKEDSIGS_%s = "\\\n' % typename)
140 for line in lines:
141 f.write(line)
142 f.write(' "\n')
143 fulltypes.append(typename)
144 f.write('SIGGEN_LOCKEDSIGS_TYPES = "%s"\n' % ' '.join(fulltypes))
145
146 write_sigs_file(copy_output, tocopy.keys(), tocopy)
147 write_sigs_file(merged_output, arch_order, merged)
148
96def create_locked_sstate_cache(lockedsigs, input_sstate_cache, output_sstate_cache, d, fixedlsbstring=""): 149def create_locked_sstate_cache(lockedsigs, input_sstate_cache, output_sstate_cache, d, fixedlsbstring=""):
97 bb.note('Generating sstate-cache...') 150 bb.note('Generating sstate-cache...')
98 151
99 bb.process.run("gen-lockedsig-cache %s %s %s" % (lockedsigs, input_sstate_cache, output_sstate_cache)) 152 bb.process.run("gen-lockedsig-cache %s %s %s" % (lockedsigs, input_sstate_cache, output_sstate_cache))
100 if fixedlsbstring: 153 if fixedlsbstring:
101 os.rename(output_sstate_cache + '/' + d.getVar('NATIVELSBSTRING', True), 154 nativedir = output_sstate_cache + '/' + d.getVar('NATIVELSBSTRING', True)
102 output_sstate_cache + '/' + fixedlsbstring) 155 if os.path.isdir(nativedir):
156 os.rename(nativedir, output_sstate_cache + '/' + fixedlsbstring)
diff --git a/meta/recipes-core/meta/meta-world-pkgdata.bb b/meta/recipes-core/meta/meta-world-pkgdata.bb
new file mode 100644
index 0000000000..48a9027215
--- /dev/null
+++ b/meta/recipes-core/meta/meta-world-pkgdata.bb
@@ -0,0 +1,50 @@
1SUMMARY = "Pulls in pkgdata for world"
2LICENSE = "MIT"
3INHIBIT_DEFAULT_DEPS = "1"
4
5addtask do_allpackagedata before do_build
6do_allpackagedata() {
7 :
8}
9do_allpackagedata[recrdeptask] = "do_packagedata do_allpackagedata"
10do_allpackagedata[noexec] = "1"
11
12WORLD_PKGDATADIR = "${D}/world-pkgdata"
13
14addtask do_collect_packagedata after do_allpackagedata
15SSTATETASKS += "do_collect_packagedata"
16do_collect_packagedata[sstate-inputdirs] = "${WORLD_PKGDATADIR}"
17do_collect_packagedata[sstate-outputdirs] = "${STAGING_DIR_HOST}/world-pkgdata"
18
19python do_collect_packagedata() {
20 import oe.copy_buildsystem
21 outdir = os.path.join(d.getVar('WORLD_PKGDATADIR', True))
22 bb.utils.mkdirhier(outdir)
23 sigfile = os.path.join(outdir, 'locked-sigs-pkgdata.inc')
24 oe.copy_buildsystem.generate_locked_sigs(sigfile, d)
25}
26
27do_fetch[noexec] = "1"
28do_unpack[noexec] = "1"
29do_patch[noexec] = "1"
30do_configure[noexec] = "1"
31do_compile[noexec] = "1"
32do_install[noexec] = "1"
33
34do_configure[deptask] = ""
35
36WORLD_PKGDATA_EXCLUDE ?= "adt-installer"
37
38python calculate_extra_depends() {
39 exclude = '${WORLD_PKGDATA_EXCLUDE}'.split()
40 for p in world_target:
41 if p == self_pn:
42 continue
43
44 if p in exclude:
45 continue
46
47 deps.append(p)
48}
49
50PACKAGES = ""
diff --git a/scripts/lib/devtool/sdk.py b/scripts/lib/devtool/sdk.py
index 0872df6bd1..68139aaf3c 100644
--- a/scripts/lib/devtool/sdk.py
+++ b/scripts/lib/devtool/sdk.py
@@ -175,12 +175,12 @@ def sdk_update(args, config, basepath, workspace):
175 175
176 if not args.skip_prepare: 176 if not args.skip_prepare:
177 # Run bitbake command for the whole SDK 177 # Run bitbake command for the whole SDK
178 sdk_targets = config.get('SDK', 'sdk_targets') 178 sdk_update_targets = config.get('SDK', 'sdk_update_targets', config.get('SDK', 'sdk_targets'))
179 logger.info("Preparing build system... (This may take some time.)") 179 logger.info("Preparing build system... (This may take some time.)")
180 try: 180 try:
181 exec_build_env_command(config.init_path, basepath, 'bitbake %s --setscene-only' % sdk_targets) 181 exec_build_env_command(config.init_path, basepath, 'bitbake %s --setscene-only' % sdk_update_targets)
182 except: 182 except:
183 logger.error('bitbake %s failed' % sdk_targets) 183 logger.error('bitbake %s failed' % sdk_update_targets)
184 return -1 184 return -1
185 return 0 185 return 0
186 186