192b42cb3SPatrick Williams# 292b42cb3SPatrick Williams# Copyright OpenEmbedded Contributors 392b42cb3SPatrick Williams# 492b42cb3SPatrick Williams# SPDX-License-Identifier: MIT 592b42cb3SPatrick Williams# 692b42cb3SPatrick Williams 7eb8dc403SDave Cobbley# 8eb8dc403SDave Cobbley# This bbclass is used for creating archive for: 9eb8dc403SDave Cobbley# 1) original (or unpacked) source: ARCHIVER_MODE[src] = "original" 10eb8dc403SDave Cobbley# 2) patched source: ARCHIVER_MODE[src] = "patched" (default) 11eb8dc403SDave Cobbley# 3) configured source: ARCHIVER_MODE[src] = "configured" 127e0e3c0cSAndrew Geissler# 4) source mirror: ARCHIVER_MODE[src] = "mirror" 1382c905dcSAndrew Geissler# 5) The patches between do_unpack and do_patch: 14eb8dc403SDave Cobbley# ARCHIVER_MODE[diff] = "1" 15eb8dc403SDave Cobbley# And you can set the one that you'd like to exclude from the diff: 16eb8dc403SDave Cobbley# ARCHIVER_MODE[diff-exclude] ?= ".pc autom4te.cache patches" 1782c905dcSAndrew Geissler# 6) The environment data, similar to 'bitbake -e recipe': 18eb8dc403SDave Cobbley# ARCHIVER_MODE[dumpdata] = "1" 1982c905dcSAndrew Geissler# 7) The recipe (.bb and .inc): ARCHIVER_MODE[recipe] = "1" 2082c905dcSAndrew Geissler# 8) Whether output the .src.rpm package: 21eb8dc403SDave Cobbley# ARCHIVER_MODE[srpm] = "1" 2282c905dcSAndrew Geissler# 9) Filter the license, the recipe whose license in 23eb8dc403SDave Cobbley# COPYLEFT_LICENSE_INCLUDE will be included, and in 24eb8dc403SDave Cobbley# COPYLEFT_LICENSE_EXCLUDE will be excluded. 25eb8dc403SDave Cobbley# COPYLEFT_LICENSE_INCLUDE = 'GPL* LGPL*' 26eb8dc403SDave Cobbley# COPYLEFT_LICENSE_EXCLUDE = 'CLOSED Proprietary' 2782c905dcSAndrew Geissler# 10) The recipe type that will be archived: 28eb8dc403SDave Cobbley# COPYLEFT_RECIPE_TYPES = 'target' 2982c905dcSAndrew Geissler# 11) The source mirror mode: 3082c905dcSAndrew Geissler# ARCHIVER_MODE[mirror] = "split" (default): Sources are split into 3182c905dcSAndrew Geissler# per-recipe directories in a similar way to other archiver modes. 3282c905dcSAndrew Geissler# Post-processing may be required to produce a single mirror directory. 3382c905dcSAndrew Geissler# This does however allow inspection of duplicate sources and more 3482c905dcSAndrew Geissler# intelligent handling. 3582c905dcSAndrew Geissler# ARCHIVER_MODE[mirror] = "combined": All sources are placed into a single 3682c905dcSAndrew Geissler# directory suitable for direct use as a mirror. Duplicate sources are 3782c905dcSAndrew Geissler# ignored. 3882c905dcSAndrew Geissler# 12) Source mirror exclusions: 3982c905dcSAndrew Geissler# ARCHIVER_MIRROR_EXCLUDE is a list of prefixes to exclude from the mirror. 4082c905dcSAndrew Geissler# This may be used for sources which you are already publishing yourself 4182c905dcSAndrew Geissler# (e.g. if the URI starts with 'https://mysite.com/' and your mirror is 4282c905dcSAndrew Geissler# going to be published to the same site). It may also be used to exclude 4382c905dcSAndrew Geissler# local files (with the prefix 'file://') if these will be provided as part 4482c905dcSAndrew Geissler# of an archive of the layers themselves. 45eb8dc403SDave Cobbley# 46eb8dc403SDave Cobbley 47eb8dc403SDave Cobbley# Create archive for all the recipe types 48eb8dc403SDave CobbleyCOPYLEFT_RECIPE_TYPES ?= 'target native nativesdk cross crosssdk cross-canadian' 49eb8dc403SDave Cobbleyinherit copyleft_filter 50eb8dc403SDave Cobbley 51eb8dc403SDave CobbleyARCHIVER_MODE[srpm] ?= "0" 52eb8dc403SDave CobbleyARCHIVER_MODE[src] ?= "patched" 53eb8dc403SDave CobbleyARCHIVER_MODE[diff] ?= "0" 54eb8dc403SDave CobbleyARCHIVER_MODE[diff-exclude] ?= ".pc autom4te.cache patches" 55eb8dc403SDave CobbleyARCHIVER_MODE[dumpdata] ?= "0" 56eb8dc403SDave CobbleyARCHIVER_MODE[recipe] ?= "0" 5782c905dcSAndrew GeisslerARCHIVER_MODE[mirror] ?= "split" 58595f6308SAndrew GeisslerARCHIVER_MODE[compression] ?= "xz" 59eb8dc403SDave Cobbley 60eb8dc403SDave CobbleyDEPLOY_DIR_SRC ?= "${DEPLOY_DIR}/sources" 61f0343792SAndrew GeisslerARCHIVER_TOPDIR ?= "${WORKDIR}/archiver-sources" 62615f2f11SAndrew GeisslerARCHIVER_ARCH = "${TARGET_SYS}" 63615f2f11SAndrew GeisslerARCHIVER_OUTDIR = "${ARCHIVER_TOPDIR}/${ARCHIVER_ARCH}/${PF}/" 6419323693SBrad BishopARCHIVER_RPMTOPDIR ?= "${WORKDIR}/deploy-sources-rpm" 65615f2f11SAndrew GeisslerARCHIVER_RPMOUTDIR = "${ARCHIVER_RPMTOPDIR}/${ARCHIVER_ARCH}/${PF}/" 66eb8dc403SDave CobbleyARCHIVER_WORKDIR = "${WORKDIR}/archiver-work/" 67eb8dc403SDave Cobbley 6882c905dcSAndrew Geissler# When producing a combined mirror directory, allow duplicates for the case 6982c905dcSAndrew Geissler# where multiple recipes use the same SRC_URI. 7082c905dcSAndrew GeisslerARCHIVER_COMBINED_MIRRORDIR = "${ARCHIVER_TOPDIR}/mirror" 717e0e3c0cSAndrew GeisslerSSTATE_ALLOW_OVERLAP_FILES += "${DEPLOY_DIR_SRC}/mirror" 7219323693SBrad Bishop 73eb8dc403SDave Cobbleydo_dumpdata[dirs] = "${ARCHIVER_OUTDIR}" 74eb8dc403SDave Cobbleydo_ar_recipe[dirs] = "${ARCHIVER_OUTDIR}" 75eb8dc403SDave Cobbleydo_ar_original[dirs] = "${ARCHIVER_OUTDIR} ${ARCHIVER_WORKDIR}" 76eb8dc403SDave Cobbley 77eb8dc403SDave Cobbley# This is a convenience for the shell script to use it 78eb8dc403SDave Cobbley 79*e760df85SPatrick Williamsdef include_package(d, pn): 80*e760df85SPatrick Williams 81*e760df85SPatrick Williams included, reason = copyleft_should_include(d) 82*e760df85SPatrick Williams if not included: 83*e760df85SPatrick Williams bb.debug(1, 'archiver: %s is excluded: %s' % (pn, reason)) 84*e760df85SPatrick Williams return False 85*e760df85SPatrick Williams 86*e760df85SPatrick Williams else: 87*e760df85SPatrick Williams bb.debug(1, 'archiver: %s is included: %s' % (pn, reason)) 88*e760df85SPatrick Williams 89*e760df85SPatrick Williams # glibc-locale: do_fetch, do_unpack and do_patch tasks have been deleted, 90*e760df85SPatrick Williams # so avoid archiving source here. 91*e760df85SPatrick Williams if pn.startswith('glibc-locale'): 92*e760df85SPatrick Williams return False 93*e760df85SPatrick Williams 94*e760df85SPatrick Williams # We just archive gcc-source for all the gcc related recipes 95*e760df85SPatrick Williams if d.getVar('BPN') in ['gcc', 'libgcc'] \ 96*e760df85SPatrick Williams and not pn.startswith('gcc-source'): 97*e760df85SPatrick Williams bb.debug(1, 'archiver: %s is excluded, covered by gcc-source' % pn) 98*e760df85SPatrick Williams return False 99*e760df85SPatrick Williams 100*e760df85SPatrick Williams return True 101eb8dc403SDave Cobbley 102eb8dc403SDave Cobbleypython () { 103eb8dc403SDave Cobbley pn = d.getVar('PN') 104eb8dc403SDave Cobbley assume_provided = (d.getVar("ASSUME_PROVIDED") or "").split() 105eb8dc403SDave Cobbley if pn in assume_provided: 106eb8dc403SDave Cobbley for p in d.getVar("PROVIDES").split(): 107eb8dc403SDave Cobbley if p != pn: 108eb8dc403SDave Cobbley pn = p 109eb8dc403SDave Cobbley break 110eb8dc403SDave Cobbley 111*e760df85SPatrick Williams if not include_package(d, pn): 112eb8dc403SDave Cobbley return 113eb8dc403SDave Cobbley 114615f2f11SAndrew Geissler # TARGET_SYS in ARCHIVER_ARCH will break the stamp for gcc-source in multiconfig 115615f2f11SAndrew Geissler if pn.startswith('gcc-source'): 116615f2f11SAndrew Geissler d.setVar('ARCHIVER_ARCH', "allarch") 117615f2f11SAndrew Geissler 11879641f25SBrad Bishop def hasTask(task): 11979641f25SBrad Bishop return bool(d.getVarFlag(task, "task", False)) and not bool(d.getVarFlag(task, "noexec", False)) 12079641f25SBrad Bishop 121eb8dc403SDave Cobbley ar_src = d.getVarFlag('ARCHIVER_MODE', 'src') 122eb8dc403SDave Cobbley ar_dumpdata = d.getVarFlag('ARCHIVER_MODE', 'dumpdata') 123eb8dc403SDave Cobbley ar_recipe = d.getVarFlag('ARCHIVER_MODE', 'recipe') 124eb8dc403SDave Cobbley 125eb8dc403SDave Cobbley if ar_src == "original": 126eb8dc403SDave Cobbley d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_ar_original' % pn) 127eb8dc403SDave Cobbley # 'patched' and 'configured' invoke do_unpack_and_patch because 128eb8dc403SDave Cobbley # do_ar_patched resp. do_ar_configured depend on it, but for 'original' 129eb8dc403SDave Cobbley # we have to add it explicitly. 130eb8dc403SDave Cobbley if d.getVarFlag('ARCHIVER_MODE', 'diff') == '1': 131eb8dc403SDave Cobbley d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_unpack_and_patch' % pn) 132eb8dc403SDave Cobbley elif ar_src == "patched": 133eb8dc403SDave Cobbley d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_ar_patched' % pn) 134eb8dc403SDave Cobbley elif ar_src == "configured": 135eb8dc403SDave Cobbley # We can't use "addtask do_ar_configured after do_configure" since it 136c926e17cSAndrew Geissler # will cause the deptask of do_populate_sysroot to run no matter what 137eb8dc403SDave Cobbley # archives we need, so we add the depends here. 138eb8dc403SDave Cobbley 139eb8dc403SDave Cobbley # There is a corner case with "gcc-source-${PV}" recipes, they don't have 140eb8dc403SDave Cobbley # the "do_configure" task, so we need to use "do_preconfigure" 1411a4b7ee2SBrad Bishop if hasTask("do_preconfigure"): 142eb8dc403SDave Cobbley d.appendVarFlag('do_ar_configured', 'depends', ' %s:do_preconfigure' % pn) 1431a4b7ee2SBrad Bishop elif hasTask("do_configure"): 144eb8dc403SDave Cobbley d.appendVarFlag('do_ar_configured', 'depends', ' %s:do_configure' % pn) 145eb8dc403SDave Cobbley d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_ar_configured' % pn) 14682c905dcSAndrew Geissler elif ar_src == "mirror": 14782c905dcSAndrew Geissler d.appendVarFlag('do_deploy_archives', 'depends', '%s:do_ar_mirror' % pn) 148eb8dc403SDave Cobbley 149eb8dc403SDave Cobbley elif ar_src: 150eb8dc403SDave Cobbley bb.fatal("Invalid ARCHIVER_MODE[src]: %s" % ar_src) 151eb8dc403SDave Cobbley 152eb8dc403SDave Cobbley if ar_dumpdata == "1": 153eb8dc403SDave Cobbley d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_dumpdata' % pn) 154eb8dc403SDave Cobbley 155eb8dc403SDave Cobbley if ar_recipe == "1": 156eb8dc403SDave Cobbley d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_ar_recipe' % pn) 157eb8dc403SDave Cobbley 158eb8dc403SDave Cobbley # Output the SRPM package 159eb8dc403SDave Cobbley if d.getVarFlag('ARCHIVER_MODE', 'srpm') == "1" and d.getVar('PACKAGES'): 16079641f25SBrad Bishop if "package_rpm" not in d.getVar('PACKAGE_CLASSES'): 16179641f25SBrad Bishop bb.fatal("ARCHIVER_MODE[srpm] needs package_rpm in PACKAGE_CLASSES") 16279641f25SBrad Bishop 16379641f25SBrad Bishop # Some recipes do not have any packaging tasks 16479641f25SBrad Bishop if hasTask("do_package_write_rpm"): 165eb8dc403SDave Cobbley d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_package_write_rpm' % pn) 16619323693SBrad Bishop d.appendVarFlag('do_package_write_rpm', 'dirs', ' ${ARCHIVER_RPMTOPDIR}') 16719323693SBrad Bishop d.appendVarFlag('do_package_write_rpm', 'sstate-inputdirs', ' ${ARCHIVER_RPMTOPDIR}') 16819323693SBrad Bishop d.appendVarFlag('do_package_write_rpm', 'sstate-outputdirs', ' ${DEPLOY_DIR_SRC}') 169eb8dc403SDave Cobbley if ar_dumpdata == "1": 170eb8dc403SDave Cobbley d.appendVarFlag('do_package_write_rpm', 'depends', ' %s:do_dumpdata' % pn) 171eb8dc403SDave Cobbley if ar_recipe == "1": 172eb8dc403SDave Cobbley d.appendVarFlag('do_package_write_rpm', 'depends', ' %s:do_ar_recipe' % pn) 173eb8dc403SDave Cobbley if ar_src == "original": 174eb8dc403SDave Cobbley d.appendVarFlag('do_package_write_rpm', 'depends', ' %s:do_ar_original' % pn) 175eb8dc403SDave Cobbley elif ar_src == "patched": 176eb8dc403SDave Cobbley d.appendVarFlag('do_package_write_rpm', 'depends', ' %s:do_ar_patched' % pn) 177eb8dc403SDave Cobbley elif ar_src == "configured": 178eb8dc403SDave Cobbley d.appendVarFlag('do_package_write_rpm', 'depends', ' %s:do_ar_configured' % pn) 179eb8dc403SDave Cobbley} 180eb8dc403SDave Cobbley 181c926e17cSAndrew Geissler# Take all the sources for a recipe and put them in WORKDIR/archiver-work/. 182eb8dc403SDave Cobbley# Files in SRC_URI are copied directly, anything that's a directory 183eb8dc403SDave Cobbley# (e.g. git repositories) is "unpacked" and then put into a tarball. 184eb8dc403SDave Cobbleypython do_ar_original() { 185eb8dc403SDave Cobbley 186eb8dc403SDave Cobbley import shutil, tempfile 187eb8dc403SDave Cobbley 188eb8dc403SDave Cobbley if d.getVarFlag('ARCHIVER_MODE', 'src') != "original": 189eb8dc403SDave Cobbley return 190eb8dc403SDave Cobbley 191eb8dc403SDave Cobbley ar_outdir = d.getVar('ARCHIVER_OUTDIR') 192eb8dc403SDave Cobbley bb.note('Archiving the original source...') 193eb8dc403SDave Cobbley urls = d.getVar("SRC_URI").split() 194eb8dc403SDave Cobbley # destsuffix (git fetcher) and subdir (everything else) are allowed to be 195eb8dc403SDave Cobbley # absolute paths (for example, destsuffix=${S}/foobar). 196eb8dc403SDave Cobbley # That messes with unpacking inside our tmpdir below, because the fetchers 197eb8dc403SDave Cobbley # will then unpack in that directory and completely ignore the tmpdir. 198eb8dc403SDave Cobbley # That breaks parallel tasks relying on ${S}, like do_compile. 199eb8dc403SDave Cobbley # 200eb8dc403SDave Cobbley # To solve this, we remove these parameters from all URLs. 201eb8dc403SDave Cobbley # We do this even for relative paths because it makes the content of the 202eb8dc403SDave Cobbley # archives more useful (no extra paths that are only used during 203eb8dc403SDave Cobbley # compilation). 204eb8dc403SDave Cobbley for i, url in enumerate(urls): 205eb8dc403SDave Cobbley decoded = bb.fetch2.decodeurl(url) 206eb8dc403SDave Cobbley for param in ('destsuffix', 'subdir'): 207eb8dc403SDave Cobbley if param in decoded[5]: 208eb8dc403SDave Cobbley del decoded[5][param] 209eb8dc403SDave Cobbley encoded = bb.fetch2.encodeurl(decoded) 210eb8dc403SDave Cobbley urls[i] = encoded 2111e34c2d0SAndrew Geissler 2121e34c2d0SAndrew Geissler # Cleanup SRC_URI before call bb.fetch2.Fetch() since now SRC_URI is in the 2131e34c2d0SAndrew Geissler # variable "urls", otherwise there might be errors like: 2141e34c2d0SAndrew Geissler # The SRCREV_FORMAT variable must be set when multiple SCMs are used 2151e34c2d0SAndrew Geissler ld = bb.data.createCopy(d) 2161e34c2d0SAndrew Geissler ld.setVar('SRC_URI', '') 2171e34c2d0SAndrew Geissler fetch = bb.fetch2.Fetch(urls, ld) 218eb8dc403SDave Cobbley tarball_suffix = {} 219eb8dc403SDave Cobbley for url in fetch.urls: 220eb8dc403SDave Cobbley local = fetch.localpath(url).rstrip("/"); 221eb8dc403SDave Cobbley if os.path.isfile(local): 222eb8dc403SDave Cobbley shutil.copy(local, ar_outdir) 223eb8dc403SDave Cobbley elif os.path.isdir(local): 224eb8dc403SDave Cobbley tmpdir = tempfile.mkdtemp(dir=d.getVar('ARCHIVER_WORKDIR')) 225eb8dc403SDave Cobbley fetch.unpack(tmpdir, (url,)) 226eb8dc403SDave Cobbley # To handle recipes with more than one source, we add the "name" 227eb8dc403SDave Cobbley # URL parameter as suffix. We treat it as an error when 228eb8dc403SDave Cobbley # there's more than one URL without a name, or a name gets reused. 229eb8dc403SDave Cobbley # This is an additional safety net, in practice the name has 230eb8dc403SDave Cobbley # to be set when using the git fetcher, otherwise SRCREV cannot 231eb8dc403SDave Cobbley # be set separately for each URL. 232eb8dc403SDave Cobbley params = bb.fetch2.decodeurl(url)[5] 233eb8dc403SDave Cobbley type = bb.fetch2.decodeurl(url)[0] 234eb8dc403SDave Cobbley location = bb.fetch2.decodeurl(url)[2] 235eb8dc403SDave Cobbley name = params.get('name', '') 236eb8dc403SDave Cobbley if type.lower() == 'file': 237eb8dc403SDave Cobbley name_tmp = location.rstrip("*").rstrip("/") 238eb8dc403SDave Cobbley name = os.path.basename(name_tmp) 239eb8dc403SDave Cobbley else: 240eb8dc403SDave Cobbley if name in tarball_suffix: 241eb8dc403SDave Cobbley if not name: 242eb8dc403SDave Cobbley bb.fatal("Cannot determine archive names for original source because 'name' URL parameter is unset in more than one URL. Add it to at least one of these: %s %s" % (tarball_suffix[name], url)) 243eb8dc403SDave Cobbley else: 244eb8dc403SDave Cobbley bb.fatal("Cannot determine archive names for original source because 'name=' URL parameter '%s' is used twice. Make it unique in: %s %s" % (tarball_suffix[name], url)) 245eb8dc403SDave Cobbley tarball_suffix[name] = url 246eb8dc403SDave Cobbley create_tarball(d, tmpdir + '/.', name, ar_outdir) 247eb8dc403SDave Cobbley 248eb8dc403SDave Cobbley # Emit patch series files for 'original' 249eb8dc403SDave Cobbley bb.note('Writing patch series files...') 250eb8dc403SDave Cobbley for patch in src_patches(d): 251eb8dc403SDave Cobbley _, _, local, _, _, parm = bb.fetch.decodeurl(patch) 252eb8dc403SDave Cobbley patchdir = parm.get('patchdir') 253eb8dc403SDave Cobbley if patchdir: 254eb8dc403SDave Cobbley series = os.path.join(ar_outdir, 'series.subdir.%s' % patchdir.replace('/', '_')) 255eb8dc403SDave Cobbley else: 256eb8dc403SDave Cobbley series = os.path.join(ar_outdir, 'series') 257eb8dc403SDave Cobbley 258eb8dc403SDave Cobbley with open(series, 'a') as s: 259eb8dc403SDave Cobbley s.write('%s -p%s\n' % (os.path.basename(local), parm['striplevel'])) 260eb8dc403SDave Cobbley} 261eb8dc403SDave Cobbley 262eb8dc403SDave Cobbleypython do_ar_patched() { 263eb8dc403SDave Cobbley 264eb8dc403SDave Cobbley if d.getVarFlag('ARCHIVER_MODE', 'src') != 'patched': 265eb8dc403SDave Cobbley return 266eb8dc403SDave Cobbley 267eb8dc403SDave Cobbley # Get the ARCHIVER_OUTDIR before we reset the WORKDIR 268eb8dc403SDave Cobbley ar_outdir = d.getVar('ARCHIVER_OUTDIR') 269a34c030eSBrad Bishop if not is_work_shared(d): 270eb8dc403SDave Cobbley ar_workdir = d.getVar('ARCHIVER_WORKDIR') 271eb8dc403SDave Cobbley d.setVar('WORKDIR', ar_workdir) 272a34c030eSBrad Bishop bb.note('Archiving the patched source...') 273eb8dc403SDave Cobbley create_tarball(d, d.getVar('S'), 'patched', ar_outdir) 274eb8dc403SDave Cobbley} 275eb8dc403SDave Cobbley 276eb8dc403SDave Cobbleypython do_ar_configured() { 277eb8dc403SDave Cobbley import shutil 278eb8dc403SDave Cobbley 279eb8dc403SDave Cobbley # Forcibly expand the sysroot paths as we're about to change WORKDIR 280eb8dc403SDave Cobbley d.setVar('STAGING_DIR_HOST', d.getVar('STAGING_DIR_HOST')) 281eb8dc403SDave Cobbley d.setVar('STAGING_DIR_TARGET', d.getVar('STAGING_DIR_TARGET')) 282eb8dc403SDave Cobbley d.setVar('RECIPE_SYSROOT', d.getVar('RECIPE_SYSROOT')) 283eb8dc403SDave Cobbley d.setVar('RECIPE_SYSROOT_NATIVE', d.getVar('RECIPE_SYSROOT_NATIVE')) 284eb8dc403SDave Cobbley 285eb8dc403SDave Cobbley ar_outdir = d.getVar('ARCHIVER_OUTDIR') 286eb8dc403SDave Cobbley if d.getVarFlag('ARCHIVER_MODE', 'src') == 'configured': 287eb8dc403SDave Cobbley bb.note('Archiving the configured source...') 288eb8dc403SDave Cobbley pn = d.getVar('PN') 289eb8dc403SDave Cobbley # "gcc-source-${PV}" recipes don't have "do_configure" 290eb8dc403SDave Cobbley # task, so we need to run "do_preconfigure" instead 291eb8dc403SDave Cobbley if pn.startswith("gcc-source-"): 292eb8dc403SDave Cobbley d.setVar('WORKDIR', d.getVar('ARCHIVER_WORKDIR')) 293eb8dc403SDave Cobbley bb.build.exec_func('do_preconfigure', d) 294eb8dc403SDave Cobbley 295eb8dc403SDave Cobbley # The libtool-native's do_configure will remove the 296eb8dc403SDave Cobbley # ${STAGING_DATADIR}/aclocal/libtool.m4, so we can't re-run the 297eb8dc403SDave Cobbley # do_configure, we archive the already configured ${S} to 298eb8dc403SDave Cobbley # instead of. 299213cb269SPatrick Williams # The kernel class functions require it to be on work-shared, we 300213cb269SPatrick Williams # don't unpack, patch, configure again, just archive the already 301213cb269SPatrick Williams # configured ${S} 302213cb269SPatrick Williams elif not (pn == 'libtool-native' or is_work_shared(d)): 3031a4b7ee2SBrad Bishop def runTask(task): 3041a4b7ee2SBrad Bishop prefuncs = d.getVarFlag(task, 'prefuncs') or '' 3051a4b7ee2SBrad Bishop for func in prefuncs.split(): 306eb8dc403SDave Cobbley if func != "sysroot_cleansstate": 307eb8dc403SDave Cobbley bb.build.exec_func(func, d) 3081a4b7ee2SBrad Bishop bb.build.exec_func(task, d) 3091a4b7ee2SBrad Bishop postfuncs = d.getVarFlag(task, 'postfuncs') or '' 3101a4b7ee2SBrad Bishop for func in postfuncs.split(): 3111a4b7ee2SBrad Bishop if func != 'do_qa_configure': 312eb8dc403SDave Cobbley bb.build.exec_func(func, d) 3131a4b7ee2SBrad Bishop 3141a4b7ee2SBrad Bishop # Change the WORKDIR to make do_configure run in another dir. 3151a4b7ee2SBrad Bishop d.setVar('WORKDIR', d.getVar('ARCHIVER_WORKDIR')) 3161a4b7ee2SBrad Bishop 3171a4b7ee2SBrad Bishop preceeds = bb.build.preceedtask('do_configure', False, d) 3181a4b7ee2SBrad Bishop for task in preceeds: 3191a4b7ee2SBrad Bishop if task != 'do_patch' and task != 'do_prepare_recipe_sysroot': 3201a4b7ee2SBrad Bishop runTask(task) 3211a4b7ee2SBrad Bishop runTask('do_configure') 3221a4b7ee2SBrad Bishop 323eb8dc403SDave Cobbley srcdir = d.getVar('S') 324eb8dc403SDave Cobbley builddir = d.getVar('B') 325eb8dc403SDave Cobbley if srcdir != builddir: 326eb8dc403SDave Cobbley if os.path.exists(builddir): 327eb8dc403SDave Cobbley oe.path.copytree(builddir, os.path.join(srcdir, \ 328eb8dc403SDave Cobbley 'build.%s.ar_configured' % d.getVar('PF'))) 329eb8dc403SDave Cobbley create_tarball(d, srcdir, 'configured', ar_outdir) 330eb8dc403SDave Cobbley} 331eb8dc403SDave Cobbley 33282c905dcSAndrew Geisslerpython do_ar_mirror() { 33382c905dcSAndrew Geissler import subprocess 33482c905dcSAndrew Geissler 33582c905dcSAndrew Geissler src_uri = (d.getVar('SRC_URI') or '').split() 33682c905dcSAndrew Geissler if len(src_uri) == 0: 33782c905dcSAndrew Geissler return 33882c905dcSAndrew Geissler 33982c905dcSAndrew Geissler dl_dir = d.getVar('DL_DIR') 34082c905dcSAndrew Geissler mirror_exclusions = (d.getVar('ARCHIVER_MIRROR_EXCLUDE') or '').split() 34182c905dcSAndrew Geissler mirror_mode = d.getVarFlag('ARCHIVER_MODE', 'mirror') 34282c905dcSAndrew Geissler have_mirror_tarballs = d.getVar('BB_GENERATE_MIRROR_TARBALLS') 34382c905dcSAndrew Geissler 34482c905dcSAndrew Geissler if mirror_mode == 'combined': 34582c905dcSAndrew Geissler destdir = d.getVar('ARCHIVER_COMBINED_MIRRORDIR') 34682c905dcSAndrew Geissler elif mirror_mode == 'split': 34782c905dcSAndrew Geissler destdir = d.getVar('ARCHIVER_OUTDIR') 34882c905dcSAndrew Geissler else: 34982c905dcSAndrew Geissler bb.fatal('Invalid ARCHIVER_MODE[mirror]: %s' % (mirror_mode)) 35082c905dcSAndrew Geissler 35182c905dcSAndrew Geissler if not have_mirror_tarballs: 35282c905dcSAndrew Geissler bb.fatal('Using `ARCHIVER_MODE[src] = "mirror"` depends on setting `BB_GENERATE_MIRROR_TARBALLS = "1"`') 35382c905dcSAndrew Geissler 35482c905dcSAndrew Geissler def is_excluded(url): 35582c905dcSAndrew Geissler for prefix in mirror_exclusions: 35682c905dcSAndrew Geissler if url.startswith(prefix): 35782c905dcSAndrew Geissler return True 35882c905dcSAndrew Geissler return False 35982c905dcSAndrew Geissler 36082c905dcSAndrew Geissler bb.note('Archiving the source as a mirror...') 36182c905dcSAndrew Geissler 36282c905dcSAndrew Geissler bb.utils.mkdirhier(destdir) 36382c905dcSAndrew Geissler 36482c905dcSAndrew Geissler fetcher = bb.fetch2.Fetch(src_uri, d) 36582c905dcSAndrew Geissler 3665a43b434SAndrew Geissler for ud in fetcher.expanded_urldata(): 3675a43b434SAndrew Geissler if is_excluded(ud.url): 3685a43b434SAndrew Geissler bb.note('Skipping excluded url: %s' % (ud.url)) 36982c905dcSAndrew Geissler continue 37082c905dcSAndrew Geissler 3715a43b434SAndrew Geissler bb.note('Archiving url: %s' % (ud.url)) 37282c905dcSAndrew Geissler ud.setup_localpath(d) 37382c905dcSAndrew Geissler localpath = None 37482c905dcSAndrew Geissler 37582c905dcSAndrew Geissler # Check for mirror tarballs first. We will archive the first mirror 37682c905dcSAndrew Geissler # tarball that we find as it's assumed that we just need one. 37782c905dcSAndrew Geissler for mirror_fname in ud.mirrortarballs: 37882c905dcSAndrew Geissler mirror_path = os.path.join(dl_dir, mirror_fname) 37982c905dcSAndrew Geissler if os.path.exists(mirror_path): 38082c905dcSAndrew Geissler bb.note('Found mirror tarball: %s' % (mirror_path)) 38182c905dcSAndrew Geissler localpath = mirror_path 38282c905dcSAndrew Geissler break 38382c905dcSAndrew Geissler 38482c905dcSAndrew Geissler if len(ud.mirrortarballs) and not localpath: 38582c905dcSAndrew Geissler bb.warn('Mirror tarballs are listed for a source but none are present. ' \ 38682c905dcSAndrew Geissler 'Falling back to original download.\n' \ 3875a43b434SAndrew Geissler 'SRC_URI = %s' % (ud.url)) 38882c905dcSAndrew Geissler 38982c905dcSAndrew Geissler # Check original download 39082c905dcSAndrew Geissler if not localpath: 39182c905dcSAndrew Geissler bb.note('Using original download: %s' % (ud.localpath)) 39282c905dcSAndrew Geissler localpath = ud.localpath 39382c905dcSAndrew Geissler 39482c905dcSAndrew Geissler if not localpath or not os.path.exists(localpath): 39582c905dcSAndrew Geissler bb.fatal('Original download is missing for a source.\n' \ 3965a43b434SAndrew Geissler 'SRC_URI = %s' % (ud.url)) 39782c905dcSAndrew Geissler 39882c905dcSAndrew Geissler # We now have an appropriate localpath 39982c905dcSAndrew Geissler bb.note('Copying source mirror') 40082c905dcSAndrew Geissler cmd = 'cp -fpPRH %s %s' % (localpath, destdir) 40182c905dcSAndrew Geissler subprocess.check_call(cmd, shell=True) 40282c905dcSAndrew Geissler} 40382c905dcSAndrew Geissler 404c4ea075dSBrad Bishopdef exclude_useless_paths(tarinfo): 405c4ea075dSBrad Bishop if tarinfo.isdir(): 406c4ea075dSBrad Bishop if tarinfo.name.endswith('/temp') or tarinfo.name.endswith('/patches') or tarinfo.name.endswith('/.pc'): 407c4ea075dSBrad Bishop return None 408c4ea075dSBrad Bishop elif tarinfo.name == 'temp' or tarinfo.name == 'patches' or tarinfo.name == '.pc': 409c4ea075dSBrad Bishop return None 410c4ea075dSBrad Bishop return tarinfo 411c4ea075dSBrad Bishop 412eb8dc403SDave Cobbleydef create_tarball(d, srcdir, suffix, ar_outdir): 413eb8dc403SDave Cobbley """ 414eb8dc403SDave Cobbley create the tarball from srcdir 415eb8dc403SDave Cobbley """ 416eb8dc403SDave Cobbley import tarfile 417eb8dc403SDave Cobbley 418eb8dc403SDave Cobbley # Make sure we are only creating a single tarball for gcc sources 419eb8dc403SDave Cobbley if (d.getVar('SRC_URI') == ""): 420eb8dc403SDave Cobbley return 421eb8dc403SDave Cobbley 422eb8dc403SDave Cobbley # For the kernel archive, srcdir may just be a link to the 423eb8dc403SDave Cobbley # work-shared location. Use os.path.realpath to make sure 424eb8dc403SDave Cobbley # that we archive the actual directory and not just the link. 425eb8dc403SDave Cobbley srcdir = os.path.realpath(srcdir) 426eb8dc403SDave Cobbley 427eff27476SAndrew Geissler compression_method = d.getVarFlag('ARCHIVER_MODE', 'compression') 428eb8dc403SDave Cobbley bb.utils.mkdirhier(ar_outdir) 429eb8dc403SDave Cobbley if suffix: 430eff27476SAndrew Geissler filename = '%s-%s.tar.%s' % (d.getVar('PF'), suffix, compression_method) 431eb8dc403SDave Cobbley else: 432eff27476SAndrew Geissler filename = '%s.tar.%s' % (d.getVar('PF'), compression_method) 433eb8dc403SDave Cobbley tarname = os.path.join(ar_outdir, filename) 434eb8dc403SDave Cobbley 435eb8dc403SDave Cobbley bb.note('Creating %s' % tarname) 436eff27476SAndrew Geissler tar = tarfile.open(tarname, 'w:%s' % compression_method) 437c4ea075dSBrad Bishop tar.add(srcdir, arcname=os.path.basename(srcdir), filter=exclude_useless_paths) 438eb8dc403SDave Cobbley tar.close() 439eb8dc403SDave Cobbley 440eb8dc403SDave Cobbley# creating .diff.gz between source.orig and source 441eb8dc403SDave Cobbleydef create_diff_gz(d, src_orig, src, ar_outdir): 442eb8dc403SDave Cobbley 443eb8dc403SDave Cobbley import subprocess 444eb8dc403SDave Cobbley 445eb8dc403SDave Cobbley if not os.path.isdir(src) or not os.path.isdir(src_orig): 446eb8dc403SDave Cobbley return 447eb8dc403SDave Cobbley 448eb8dc403SDave Cobbley # The diff --exclude can't exclude the file with path, so we copy 449eb8dc403SDave Cobbley # the patched source, and remove the files that we'd like to 450eb8dc403SDave Cobbley # exclude. 451eb8dc403SDave Cobbley src_patched = src + '.patched' 452eb8dc403SDave Cobbley oe.path.copyhardlinktree(src, src_patched) 453eb8dc403SDave Cobbley for i in d.getVarFlag('ARCHIVER_MODE', 'diff-exclude').split(): 454eb8dc403SDave Cobbley bb.utils.remove(os.path.join(src_orig, i), recurse=True) 455eb8dc403SDave Cobbley bb.utils.remove(os.path.join(src_patched, i), recurse=True) 456eb8dc403SDave Cobbley 457eb8dc403SDave Cobbley dirname = os.path.dirname(src) 458eb8dc403SDave Cobbley basename = os.path.basename(src) 459eb8dc403SDave Cobbley bb.utils.mkdirhier(ar_outdir) 460eb8dc403SDave Cobbley cwd = os.getcwd() 461eb8dc403SDave Cobbley try: 462eb8dc403SDave Cobbley os.chdir(dirname) 463eb8dc403SDave Cobbley out_file = os.path.join(ar_outdir, '%s-diff.gz' % d.getVar('PF')) 464eb8dc403SDave Cobbley diff_cmd = 'diff -Naur %s.orig %s.patched | gzip -c > %s' % (basename, basename, out_file) 465eb8dc403SDave Cobbley subprocess.check_call(diff_cmd, shell=True) 466eb8dc403SDave Cobbley bb.utils.remove(src_patched, recurse=True) 467eb8dc403SDave Cobbley finally: 468eb8dc403SDave Cobbley os.chdir(cwd) 469eb8dc403SDave Cobbley 470eb8dc403SDave Cobbleydef is_work_shared(d): 471eb8dc403SDave Cobbley pn = d.getVar('PN') 47292b42cb3SPatrick Williams return pn.startswith('gcc-source') or \ 47392b42cb3SPatrick Williams bb.data.inherits_class('kernel', d) or \ 4742390b1b6SPatrick Williams (bb.data.inherits_class('kernelsrc', d) and d.expand("${TMPDIR}/work-shared") in d.getVar('S')) 475eb8dc403SDave Cobbley 476eb8dc403SDave Cobbley# Run do_unpack and do_patch 477eb8dc403SDave Cobbleypython do_unpack_and_patch() { 478eb8dc403SDave Cobbley if d.getVarFlag('ARCHIVER_MODE', 'src') not in \ 479eb8dc403SDave Cobbley [ 'patched', 'configured'] and \ 480eb8dc403SDave Cobbley d.getVarFlag('ARCHIVER_MODE', 'diff') != '1': 481eb8dc403SDave Cobbley return 482eb8dc403SDave Cobbley ar_outdir = d.getVar('ARCHIVER_OUTDIR') 483eb8dc403SDave Cobbley ar_workdir = d.getVar('ARCHIVER_WORKDIR') 484eb8dc403SDave Cobbley ar_sysroot_native = d.getVar('STAGING_DIR_NATIVE') 485eb8dc403SDave Cobbley pn = d.getVar('PN') 486eb8dc403SDave Cobbley 487c926e17cSAndrew Geissler # The kernel class functions require it to be on work-shared, so we don't change WORKDIR 488eb8dc403SDave Cobbley if not is_work_shared(d): 489eb8dc403SDave Cobbley # Change the WORKDIR to make do_unpack do_patch run in another dir. 490eb8dc403SDave Cobbley d.setVar('WORKDIR', ar_workdir) 491eb8dc403SDave Cobbley # Restore the original path to recipe's native sysroot (it's relative to WORKDIR). 492eb8dc403SDave Cobbley d.setVar('STAGING_DIR_NATIVE', ar_sysroot_native) 493eb8dc403SDave Cobbley 494eb8dc403SDave Cobbley # The changed 'WORKDIR' also caused 'B' changed, create dir 'B' for the 495eb8dc403SDave Cobbley # possibly requiring of the following tasks (such as some recipes's 496eb8dc403SDave Cobbley # do_patch required 'B' existed). 497eb8dc403SDave Cobbley bb.utils.mkdirhier(d.getVar('B')) 498eb8dc403SDave Cobbley 499eb8dc403SDave Cobbley bb.build.exec_func('do_unpack', d) 500eb8dc403SDave Cobbley 501eb8dc403SDave Cobbley # Save the original source for creating the patches 502eb8dc403SDave Cobbley if d.getVarFlag('ARCHIVER_MODE', 'diff') == '1': 503eb8dc403SDave Cobbley src = d.getVar('S').rstrip('/') 504eb8dc403SDave Cobbley src_orig = '%s.orig' % src 505eb8dc403SDave Cobbley oe.path.copytree(src, src_orig) 506eb8dc403SDave Cobbley 507213cb269SPatrick Williams if bb.data.inherits_class('dos2unix', d): 508213cb269SPatrick Williams bb.build.exec_func('do_convert_crlf_to_lf', d) 509213cb269SPatrick Williams 510eb8dc403SDave Cobbley # Make sure gcc and kernel sources are patched only once 511eb8dc403SDave Cobbley if not (d.getVar('SRC_URI') == "" or is_work_shared(d)): 512eb8dc403SDave Cobbley bb.build.exec_func('do_patch', d) 513eb8dc403SDave Cobbley 514eb8dc403SDave Cobbley # Create the patches 515eb8dc403SDave Cobbley if d.getVarFlag('ARCHIVER_MODE', 'diff') == '1': 516eb8dc403SDave Cobbley bb.note('Creating diff gz...') 517eb8dc403SDave Cobbley create_diff_gz(d, src_orig, src, ar_outdir) 518eb8dc403SDave Cobbley bb.utils.remove(src_orig, recurse=True) 519eb8dc403SDave Cobbley} 520eb8dc403SDave Cobbley 521eb8dc403SDave Cobbley# BBINCLUDED is special (excluded from basehash signature 522eb8dc403SDave Cobbley# calculation). Using it in a task signature can cause "basehash 523eb8dc403SDave Cobbley# changed" errors. 524eb8dc403SDave Cobbley# 525eb8dc403SDave Cobbley# Depending on BBINCLUDED also causes do_ar_recipe to run again 526eb8dc403SDave Cobbley# for unrelated changes, like adding or removing buildhistory.bbclass. 527eb8dc403SDave Cobbley# 528eb8dc403SDave Cobbley# For these reasons we ignore the dependency completely. The versioning 529eb8dc403SDave Cobbley# of the output file ensures that we create it each time the recipe 530eb8dc403SDave Cobbley# gets rebuilt, at least as long as a PR server is used. We also rely 531eb8dc403SDave Cobbley# on that mechanism to catch changes in the file content, because the 532c926e17cSAndrew Geissler# file content is not part of the task signature either. 533eb8dc403SDave Cobbleydo_ar_recipe[vardepsexclude] += "BBINCLUDED" 534eb8dc403SDave Cobbleypython do_ar_recipe () { 535eb8dc403SDave Cobbley """ 536eb8dc403SDave Cobbley archive the recipe, including .bb and .inc. 537eb8dc403SDave Cobbley """ 538eb8dc403SDave Cobbley import re 539eb8dc403SDave Cobbley import shutil 540eb8dc403SDave Cobbley 541eb8dc403SDave Cobbley require_re = re.compile( r"require\s+(.+)" ) 542eb8dc403SDave Cobbley include_re = re.compile( r"include\s+(.+)" ) 543eb8dc403SDave Cobbley bbfile = d.getVar('FILE') 544eb8dc403SDave Cobbley outdir = os.path.join(d.getVar('WORKDIR'), \ 545eb8dc403SDave Cobbley '%s-recipe' % d.getVar('PF')) 546eb8dc403SDave Cobbley bb.utils.mkdirhier(outdir) 547eb8dc403SDave Cobbley shutil.copy(bbfile, outdir) 548eb8dc403SDave Cobbley 549eb8dc403SDave Cobbley pn = d.getVar('PN') 550eb8dc403SDave Cobbley bbappend_files = d.getVar('BBINCLUDED').split() 551eb8dc403SDave Cobbley # If recipe name is aa, we need to match files like aa.bbappend and aa_1.1.bbappend 552eb8dc403SDave Cobbley # Files like aa1.bbappend or aa1_1.1.bbappend must be excluded. 553eb8dc403SDave Cobbley bbappend_re = re.compile( r".*/%s_[^/]*\.bbappend$" % re.escape(pn)) 554eb8dc403SDave Cobbley bbappend_re1 = re.compile( r".*/%s\.bbappend$" % re.escape(pn)) 555eb8dc403SDave Cobbley for file in bbappend_files: 556eb8dc403SDave Cobbley if bbappend_re.match(file) or bbappend_re1.match(file): 557eb8dc403SDave Cobbley shutil.copy(file, outdir) 558eb8dc403SDave Cobbley 559eb8dc403SDave Cobbley dirname = os.path.dirname(bbfile) 560eb8dc403SDave Cobbley bbpath = '%s:%s' % (dirname, d.getVar('BBPATH')) 561eb8dc403SDave Cobbley f = open(bbfile, 'r') 562eb8dc403SDave Cobbley for line in f.readlines(): 563eb8dc403SDave Cobbley incfile = None 564eb8dc403SDave Cobbley if require_re.match(line): 565eb8dc403SDave Cobbley incfile = require_re.match(line).group(1) 566eb8dc403SDave Cobbley elif include_re.match(line): 567eb8dc403SDave Cobbley incfile = include_re.match(line).group(1) 568eb8dc403SDave Cobbley if incfile: 569eb8dc403SDave Cobbley incfile = d.expand(incfile) 5701d80a2eaSBrad Bishop if incfile: 571eb8dc403SDave Cobbley incfile = bb.utils.which(bbpath, incfile) 572eb8dc403SDave Cobbley if incfile: 573eb8dc403SDave Cobbley shutil.copy(incfile, outdir) 574eb8dc403SDave Cobbley 575eb8dc403SDave Cobbley create_tarball(d, outdir, 'recipe', d.getVar('ARCHIVER_OUTDIR')) 576eb8dc403SDave Cobbley bb.utils.remove(outdir, recurse=True) 577eb8dc403SDave Cobbley} 578eb8dc403SDave Cobbley 579eb8dc403SDave Cobbleypython do_dumpdata () { 580eb8dc403SDave Cobbley """ 581eb8dc403SDave Cobbley dump environment data to ${PF}-showdata.dump 582eb8dc403SDave Cobbley """ 583eb8dc403SDave Cobbley 584eb8dc403SDave Cobbley dumpfile = os.path.join(d.getVar('ARCHIVER_OUTDIR'), \ 585eb8dc403SDave Cobbley '%s-showdata.dump' % d.getVar('PF')) 586eb8dc403SDave Cobbley bb.note('Dumping metadata into %s' % dumpfile) 587eb8dc403SDave Cobbley with open(dumpfile, "w") as f: 588eb8dc403SDave Cobbley # emit variables and shell functions 589eb8dc403SDave Cobbley bb.data.emit_env(f, d, True) 590eb8dc403SDave Cobbley # emit the metadata which isn't valid shell 591eb8dc403SDave Cobbley for e in d.keys(): 592eb8dc403SDave Cobbley if d.getVarFlag(e, "python", False): 593eb8dc403SDave Cobbley f.write("\npython %s () {\n%s}\n" % (e, d.getVar(e, False))) 594eb8dc403SDave Cobbley} 595eb8dc403SDave Cobbley 596eb8dc403SDave CobbleySSTATETASKS += "do_deploy_archives" 597eb8dc403SDave Cobbleydo_deploy_archives () { 59878b72798SAndrew Geissler bbnote "Deploying source archive files from ${ARCHIVER_TOPDIR} to ${DEPLOY_DIR_SRC}." 599eb8dc403SDave Cobbley} 600eb8dc403SDave Cobbleypython do_deploy_archives_setscene () { 601eb8dc403SDave Cobbley sstate_setscene(d) 602eb8dc403SDave Cobbley} 603eb8dc403SDave Cobbleydo_deploy_archives[dirs] = "${ARCHIVER_TOPDIR}" 604eb8dc403SDave Cobbleydo_deploy_archives[sstate-inputdirs] = "${ARCHIVER_TOPDIR}" 605eb8dc403SDave Cobbleydo_deploy_archives[sstate-outputdirs] = "${DEPLOY_DIR_SRC}" 606eb8dc403SDave Cobbleyaddtask do_deploy_archives_setscene 607eb8dc403SDave Cobbley 608eb8dc403SDave Cobbleyaddtask do_ar_original after do_unpack 609475cb72dSAndrew Geissleraddtask do_unpack_and_patch after do_patch do_preconfigure 610475cb72dSAndrew Geissleraddtask do_ar_patched after do_unpack_and_patch 611eb8dc403SDave Cobbleyaddtask do_ar_configured after do_unpack_and_patch 61282c905dcSAndrew Geissleraddtask do_ar_mirror after do_fetch 613eb8dc403SDave Cobbleyaddtask do_dumpdata 614eb8dc403SDave Cobbleyaddtask do_ar_recipe 6151e34c2d0SAndrew Geissleraddtask do_deploy_archives 6161e34c2d0SAndrew Geisslerdo_build[recrdeptask] += "do_deploy_archives" 617d1e89497SAndrew Geisslerdo_rootfs[recrdeptask] += "do_deploy_archives" 6181e34c2d0SAndrew Geisslerdo_populate_sdk[recrdeptask] += "do_deploy_archives" 619eb8dc403SDave Cobbley 620eb8dc403SDave Cobbleypython () { 621eb8dc403SDave Cobbley # Add tasks in the correct order, specifically for linux-yocto to avoid race condition. 622eb8dc403SDave Cobbley # sstatesig.py:sstate_rundepfilter has special support that excludes this dependency 623eb8dc403SDave Cobbley # so that do_kernel_configme does not need to run again when do_unpack_and_patch 624eb8dc403SDave Cobbley # gets added or removed (by adding or removing archiver.bbclass). 625eb8dc403SDave Cobbley if bb.data.inherits_class('kernel-yocto', d): 626eb8dc403SDave Cobbley bb.build.addtask('do_kernel_configme', 'do_configure', 'do_unpack_and_patch', d) 627eb8dc403SDave Cobbley} 628