archiver-dev bbclass: fix sstate issue

merged with latest upstream original class

BugzID: 57939

Signed-off-by: Ramon Moesching <ramon.moesching@netmodule.com>
This commit is contained in:
Ramon Moesching 2019-08-07 16:25:01 +02:00
parent 2fd3dd3d73
commit ec34bee968
1 changed files with 39 additions and 20 deletions

View File

@ -28,9 +28,6 @@
#11) Archives without .git/ repository #11) Archives without .git/ repository
# ARCHIVER_GITREPO_EXCLUDE = "1" # ARCHIVER_GITREPO_EXCLUDE = "1"
# Don't filter the license by default
COPYLEFT_LICENSE_INCLUDE ?= ''
COPYLEFT_LICENSE_EXCLUDE ?= ''
# Create archive for all the recipe types # Create archive for all the recipe types
COPYLEFT_RECIPE_TYPES ?= 'target native nativesdk cross crosssdk cross-canadian' COPYLEFT_RECIPE_TYPES ?= 'target native nativesdk cross crosssdk cross-canadian'
inherit copyleft_filter inherit copyleft_filter
@ -49,8 +46,11 @@ ARCHIVER_MASK[list] ?= ""
DEPLOY_DIR_SRC ?= "${DEPLOY_DIR}/sources" DEPLOY_DIR_SRC ?= "${DEPLOY_DIR}/sources"
ARCHIVER_TOPDIR ?= "${WORKDIR}/deploy-sources" ARCHIVER_TOPDIR ?= "${WORKDIR}/deploy-sources"
ARCHIVER_OUTDIR = "${ARCHIVER_TOPDIR}/${TARGET_SYS}/${PF}/" ARCHIVER_OUTDIR = "${ARCHIVER_TOPDIR}/${TARGET_SYS}/${PF}/"
ARCHIVER_RPMTOPDIR ?= "${WORKDIR}/deploy-sources-rpm"
ARCHIVER_RPMOUTDIR = "${ARCHIVER_RPMTOPDIR}/${TARGET_SYS}/${PF}/"
ARCHIVER_WORKDIR = "${WORKDIR}/archiver-work/" ARCHIVER_WORKDIR = "${WORKDIR}/archiver-work/"
do_dumpdata[dirs] = "${ARCHIVER_OUTDIR}" do_dumpdata[dirs] = "${ARCHIVER_OUTDIR}"
do_ar_recipe[dirs] = "${ARCHIVER_OUTDIR}" do_ar_recipe[dirs] = "${ARCHIVER_OUTDIR}"
do_ar_original[dirs] = "${ARCHIVER_OUTDIR} ${ARCHIVER_WORKDIR}" do_ar_original[dirs] = "${ARCHIVER_OUTDIR} ${ARCHIVER_WORKDIR}"
@ -58,6 +58,7 @@ do_deploy_archives[dirs] = "${WORKDIR}"
# This is a convenience for the shell script to use it # This is a convenience for the shell script to use it
python () { python () {
pn = d.getVar('PN') pn = d.getVar('PN')
@ -113,9 +114,12 @@ python () {
# There is a corner case with "gcc-source-${PV}" recipes, they don't have # There is a corner case with "gcc-source-${PV}" recipes, they don't have
# the "do_configure" task, so we need to use "do_preconfigure" # the "do_configure" task, so we need to use "do_preconfigure"
if pn.startswith("gcc-source-"): def hasTask(task):
return bool(d.getVarFlag(task, "task", False)) and not bool(d.getVarFlag(task, "noexec", False))
if hasTask("do_preconfigure"):
d.appendVarFlag('do_ar_configured', 'depends', ' %s:do_preconfigure' % pn) d.appendVarFlag('do_ar_configured', 'depends', ' %s:do_preconfigure' % pn)
else: elif hasTask("do_configure"):
d.appendVarFlag('do_ar_configured', 'depends', ' %s:do_configure' % pn) d.appendVarFlag('do_ar_configured', 'depends', ' %s:do_configure' % pn)
d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_ar_configured' % pn) d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_ar_configured' % pn)
@ -132,6 +136,9 @@ python () {
if d.getVarFlag('ARCHIVER_MODE', 'srpm') == "1" and d.getVar('PACKAGES'): if d.getVarFlag('ARCHIVER_MODE', 'srpm') == "1" and d.getVar('PACKAGES'):
if "package_rpm" in d.getVar('PACKAGE_CLASSES'): if "package_rpm" in d.getVar('PACKAGE_CLASSES'):
d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_package_write_rpm' % pn) d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_package_write_rpm' % pn)
d.appendVarFlag('do_package_write_rpm', 'dirs', ' ${ARCHIVER_RPMTOPDIR}')
d.appendVarFlag('do_package_write_rpm', 'sstate-inputdirs', ' ${ARCHIVER_RPMTOPDIR}')
d.appendVarFlag('do_package_write_rpm', 'sstate-outputdirs', ' ${DEPLOY_DIR_SRC}')
if ar_dumpdata == "1": if ar_dumpdata == "1":
d.appendVarFlag('do_package_write_rpm', 'depends', ' %s:do_dumpdata' % pn) d.appendVarFlag('do_package_write_rpm', 'depends', ' %s:do_dumpdata' % pn)
if ar_recipe == "1": if ar_recipe == "1":
@ -258,21 +265,26 @@ python do_ar_configured() {
# do_configure, we archive the already configured ${S} to # do_configure, we archive the already configured ${S} to
# instead of. # instead of.
elif pn != 'libtool-native': elif pn != 'libtool-native':
# Change the WORKDIR to make do_configure run in another dir. def runTask(task):
d.setVar('WORKDIR', d.getVar('ARCHIVER_WORKDIR')) prefuncs = d.getVarFlag(task, 'prefuncs') or ''
if bb.data.inherits_class('kernel-yocto', d): for func in prefuncs.split():
bb.build.exec_func('do_kernel_configme', d)
if bb.data.inherits_class('cmake', d):
bb.build.exec_func('do_generate_toolchain_file', d)
prefuncs = d.getVarFlag('do_configure', 'prefuncs')
for func in (prefuncs or '').split():
if func != "sysroot_cleansstate": if func != "sysroot_cleansstate":
bb.build.exec_func(func, d) bb.build.exec_func(func, d)
bb.build.exec_func('do_configure', d) bb.build.exec_func(task, d)
postfuncs = d.getVarFlag('do_configure', 'postfuncs') postfuncs = d.getVarFlag(task, 'postfuncs') or ''
for func in (postfuncs or '').split(): for func in postfuncs.split():
if func != "do_qa_configure": if func != 'do_qa_configure':
bb.build.exec_func(func, d) bb.build.exec_func(func, d)
# Change the WORKDIR to make do_configure run in another dir.
d.setVar('WORKDIR', d.getVar('ARCHIVER_WORKDIR'))
preceeds = bb.build.preceedtask('do_configure', False, d)
for task in preceeds:
if task != 'do_patch' and task != 'do_prepare_recipe_sysroot':
runTask(task)
runTask('do_configure')
srcdir = d.getVar('S') srcdir = d.getVar('S')
builddir = d.getVar('B') builddir = d.getVar('B')
if srcdir != builddir: if srcdir != builddir:
@ -282,6 +294,14 @@ python do_ar_configured() {
create_tarball(d, srcdir, 'configured', ar_outdir) create_tarball(d, srcdir, 'configured', ar_outdir)
} }
def exclude_useless_paths(tarinfo):
if tarinfo.isdir():
if tarinfo.name.endswith('/temp') or tarinfo.name.endswith('/patches') or tarinfo.name.endswith('/.pc'):
return None
elif tarinfo.name == 'temp' or tarinfo.name == 'patches' or tarinfo.name == '.pc':
return None
return tarinfo
def create_tarball(d, srcdir, suffix, ar_outdir): def create_tarball(d, srcdir, suffix, ar_outdir):
""" """
create the tarball from srcdir create the tarball from srcdir
@ -310,7 +330,7 @@ def create_tarball(d, srcdir, suffix, ar_outdir):
bb.note('Creating %s' % tarname) bb.note('Creating %s' % tarname)
tar = tarfile.open(tarname, 'w:gz') tar = tarfile.open(tarname, 'w:gz')
tar.add(srcdir, arcname=os.path.basename(srcdir)) tar.add(srcdir, arcname=os.path.basename(srcdir), filter=exclude_useless_paths)
tar.close() tar.close()
# creating .diff.gz between source.orig and source # creating .diff.gz between source.orig and source
@ -498,7 +518,6 @@ addtask do_dumpdata
addtask do_ar_recipe addtask do_ar_recipe
addtask do_deploy_archives before do_build addtask do_deploy_archives before do_build
python () { python () {
# Add tasks in the correct order, specifically for linux-yocto to avoid race condition. # Add tasks in the correct order, specifically for linux-yocto to avoid race condition.
# sstatesig.py:sstate_rundepfilter has special support that excludes this dependency # sstatesig.py:sstate_rundepfilter has special support that excludes this dependency