summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorAlejandro Hernandez <alejandro.hernandez@linux.intel.com>2015-10-06 23:05:09 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-10-21 22:59:27 +0100
commit92b26ad9383690e749dd4ed4b16f142ead44eba9 (patch)
tree0751c84da51e8c482735dcc3e01d5b3db599f39c /meta/classes
parent2d008033c540f07c12e025c342f7474e09e1c615 (diff)
downloadpoky-92b26ad9383690e749dd4ed4b16f142ead44eba9.tar.gz
archiver.bbclass: Fixes and improves archiver class for kernel and gcc packages
gcc packages use a shared source directory, this causes an issue since the archiver will try to patch the same source several times (one for each gcc package), producing an error, the archiver class used stamp-base to check this, nonetheless our gcc packages no longer use stamp-base, they use gcc-shared instead, which is what broke this functionality. This patch adds a check to see whether or not the source should be patched, avoiding patching the source when it shouldn't. Also, we dont need to create multiple identical tarballs for all gcc packages, this patch fixes this and creates a single source tarball for gcc. When requesting patched sources, a race condition is created for linux-yocto tasks, unpack_and_patch is executed along with kernel_configme, which most of the time causes errors during configure, since kernel_configme task is specific to the kernel, simply modifying the tasks order by creating a dependency to kernel_configme was impossible, causing errors on all other packages that didnt use kernel_configme, this is fixed by creating a special case for the kernel, adding tasks with correct dependencies, avoiding the race condition and behaving the way it should for all other packages as well. [YOCTO #8378] (From OE-Core rev: aecaa0e8739db1c228a6db78225a717d9f348a5b) Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/archiver.bbclass27
1 files changed, 20 insertions, 7 deletions
diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
index eec8024db7..41a552c76b 100644
--- a/meta/classes/archiver.bbclass
+++ b/meta/classes/archiver.bbclass
@@ -157,7 +157,7 @@ python do_ar_patched() {
157 # Get the ARCHIVER_OUTDIR before we reset the WORKDIR 157 # Get the ARCHIVER_OUTDIR before we reset the WORKDIR
158 ar_outdir = d.getVar('ARCHIVER_OUTDIR', True) 158 ar_outdir = d.getVar('ARCHIVER_OUTDIR', True)
159 bb.note('Archiving the patched source...') 159 bb.note('Archiving the patched source...')
160 d.setVar('WORKDIR', d.getVar('ARCHIVER_WORKDIR', True)) 160 d.setVar('WORKDIR', ar_outdir)
161 create_tarball(d, d.getVar('S', True), 'patched', ar_outdir) 161 create_tarball(d, d.getVar('S', True), 'patched', ar_outdir)
162} 162}
163 163
@@ -202,6 +202,10 @@ def create_tarball(d, srcdir, suffix, ar_outdir):
202 """ 202 """
203 import tarfile 203 import tarfile
204 204
205 # Make sure we are only creating a single tarball for gcc sources
206 if d.getVar('SRC_URI', True) == "" and 'gcc' in d.getVar('PN', True):
207 return
208
205 bb.utils.mkdirhier(ar_outdir) 209 bb.utils.mkdirhier(ar_outdir)
206 tarname = os.path.join(ar_outdir, '%s-%s.tar.gz' % \ 210 tarname = os.path.join(ar_outdir, '%s-%s.tar.gz' % \
207 (d.getVar('PF', True), suffix)) 211 (d.getVar('PF', True), suffix))
@@ -246,11 +250,9 @@ python do_unpack_and_patch() {
246 [ 'patched', 'configured'] and \ 250 [ 'patched', 'configured'] and \
247 d.getVarFlag('ARCHIVER_MODE', 'diff', True) != '1': 251 d.getVarFlag('ARCHIVER_MODE', 'diff', True) != '1':
248 return 252 return
249
250 ar_outdir = d.getVar('ARCHIVER_OUTDIR', True)
251
252 # Change the WORKDIR to make do_unpack do_patch run in another dir. 253 # Change the WORKDIR to make do_unpack do_patch run in another dir.
253 d.setVar('WORKDIR', d.getVar('ARCHIVER_WORKDIR', True)) 254 ar_outdir = d.getVar('ARCHIVER_OUTDIR', True)
255 d.setVar('WORKDIR', ar_outdir)
254 256
255 # The changed 'WORKDIR' also casued 'B' changed, create dir 'B' for the 257 # The changed 'WORKDIR' also casued 'B' changed, create dir 'B' for the
256 # possibly requiring of the following tasks (such as some recipes's 258 # possibly requiring of the following tasks (such as some recipes's
@@ -270,7 +272,11 @@ python do_unpack_and_patch() {
270 src = d.getVar('S', True).rstrip('/') 272 src = d.getVar('S', True).rstrip('/')
271 src_orig = '%s.orig' % src 273 src_orig = '%s.orig' % src
272 oe.path.copytree(src, src_orig) 274 oe.path.copytree(src, src_orig)
273 bb.build.exec_func('do_patch', d) 275
276 # Make sure gcc sources are patched only once
277 if not ((d.getVar('SRC_URI', True) == "" and 'gcc' in d.getVar('PN', True))):
278 bb.build.exec_func('do_patch', d)
279
274 # Create the patches 280 # Create the patches
275 if d.getVarFlag('ARCHIVER_MODE', 'diff', True) == '1': 281 if d.getVarFlag('ARCHIVER_MODE', 'diff', True) == '1':
276 bb.note('Creating diff gz...') 282 bb.note('Creating diff gz...')
@@ -341,7 +347,6 @@ do_deploy_archives[sstate-inputdirs] = "${ARCHIVER_TOPDIR}"
341do_deploy_archives[sstate-outputdirs] = "${DEPLOY_DIR_SRC}" 347do_deploy_archives[sstate-outputdirs] = "${DEPLOY_DIR_SRC}"
342 348
343addtask do_ar_original after do_unpack 349addtask do_ar_original after do_unpack
344addtask do_unpack_and_patch after do_patch
345addtask do_ar_patched after do_unpack_and_patch 350addtask do_ar_patched after do_unpack_and_patch
346addtask do_ar_configured after do_unpack_and_patch 351addtask do_ar_configured after do_unpack_and_patch
347addtask do_dumpdata 352addtask do_dumpdata
@@ -354,3 +359,11 @@ do_deploy_all_archives[recideptask] = "do_${BB_DEFAULT_TASK}"
354do_deploy_all_archives() { 359do_deploy_all_archives() {
355 : 360 :
356} 361}
362
363python () {
364 # Add tasks in the correct order, specifically for linux-yocto to avoid race condition
365 if bb.data.inherits_class('kernel-yocto', d):
366 bb.build.addtask('do_kernel_configme', 'do_configure', 'do_unpack_and_patch', d)
367 else:
368 bb.build.addtask('do_unpack_and_patch', None, 'do_patch', d)
369}