2012-08-23 15:03:10 +00:00
|
|
|
# ex:ts=4:sw=4:sts=4:et
|
|
|
|
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
|
|
|
#
|
2014-01-05 14:58:09 +00:00
|
|
|
# This bbclass is used for creating archive for:
|
|
|
|
# 1) original (or unpacked) source: ARCHIVER_MODE[src] = "original"
|
|
|
|
# 2) patched source: ARCHIVER_MODE[src] = "patched" (default)
|
|
|
|
# 3) configured source: ARCHIVER_MODE[src] = "configured"
|
|
|
|
# 4) The patches between do_unpack and do_patch:
|
|
|
|
# ARCHIVER_MODE[diff] = "1"
|
|
|
|
# And you can set the one that you'd like to exclude from the diff:
|
|
|
|
# ARCHIVER_MODE[diff-exclude] ?= ".pc autom4te.cache patches"
|
|
|
|
# 5) The environment data, similar to 'bitbake -e recipe':
|
|
|
|
# ARCHIVER_MODE[dumpdata] = "1"
|
|
|
|
# 6) The recipe (.bb and .inc): ARCHIVER_MODE[recipe] = "1"
|
2014-03-24 05:39:26 +00:00
|
|
|
# 7) Whether output the .src.rpm package:
|
|
|
|
# ARCHIVER_MODE[srpm] = "1"
|
|
|
|
# 8) Filter the license, the recipe whose license in
|
|
|
|
# COPYLEFT_LICENSE_INCLUDE will be included, and in
|
|
|
|
# COPYLEFT_LICENSE_EXCLUDE will be excluded.
|
|
|
|
# COPYLEFT_LICENSE_INCLUDE = 'GPL* LGPL*'
|
|
|
|
# COPYLEFT_LICENSE_EXCLUDE = 'CLOSED Proprietary'
|
|
|
|
# 9) The recipe type that will be archived:
|
|
|
|
# COPYLEFT_RECIPE_TYPES = 'target'
|
2012-08-23 15:03:10 +00:00
|
|
|
#
|
2014-03-24 05:39:26 +00:00
|
|
|
|
|
|
|
# Don't filter the license by default
|
|
|
|
COPYLEFT_LICENSE_INCLUDE ?= ''
|
|
|
|
COPYLEFT_LICENSE_EXCLUDE ?= ''
|
|
|
|
# Create archive for all the recipe types
|
|
|
|
COPYLEFT_RECIPE_TYPES ?= 'target native nativesdk cross crosssdk cross-canadian'
|
|
|
|
inherit copyleft_filter
|
2012-03-26 10:49:26 +00:00
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
ARCHIVER_MODE[srpm] ?= "0"
|
|
|
|
ARCHIVER_MODE[src] ?= "patched"
|
|
|
|
ARCHIVER_MODE[diff] ?= "0"
|
|
|
|
ARCHIVER_MODE[diff-exclude] ?= ".pc autom4te.cache patches"
|
|
|
|
ARCHIVER_MODE[dumpdata] ?= "0"
|
|
|
|
ARCHIVER_MODE[recipe] ?= "0"
|
|
|
|
|
|
|
|
DEPLOY_DIR_SRC ?= "${DEPLOY_DIR}/sources"
|
|
|
|
ARCHIVER_TOPDIR ?= "${WORKDIR}/deploy-sources"
|
|
|
|
ARCHIVER_OUTDIR = "${ARCHIVER_TOPDIR}/${TARGET_SYS}/${PF}/"
|
|
|
|
ARCHIVER_WORKDIR = "${WORKDIR}/archiver-work/"
|
|
|
|
|
|
|
|
do_dumpdata[dirs] = "${ARCHIVER_OUTDIR}"
|
|
|
|
do_ar_recipe[dirs] = "${ARCHIVER_OUTDIR}"
|
|
|
|
do_ar_original[dirs] = "${ARCHIVER_OUTDIR} ${ARCHIVER_WORKDIR}"
|
2015-08-17 08:37:47 +00:00
|
|
|
do_deploy_archives[dirs] = "${WORKDIR}"
|
|
|
|
do_deploy_all_archives[dirs] = "${WORKDIR}"
|
2014-01-05 14:58:09 +00:00
|
|
|
|
|
|
|
# This is a convenience for the shell script to use it
|
2012-06-26 05:59:41 +00:00
|
|
|
|
|
|
|
|
2014-01-04 13:02:30 +00:00
|
|
|
python () {
|
|
|
|
pn = d.getVar('PN', True)
|
|
|
|
|
2015-06-09 12:46:48 +00:00
|
|
|
included, reason = copyleft_should_include(d)
|
|
|
|
if not included:
|
|
|
|
bb.debug(1, 'archiver: %s is excluded: %s' % (pn, reason))
|
|
|
|
return
|
|
|
|
else:
|
|
|
|
bb.debug(1, 'archiver: %s is included: %s' % (pn, reason))
|
2014-03-24 05:39:26 +00:00
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
ar_src = d.getVarFlag('ARCHIVER_MODE', 'src', True)
|
|
|
|
ar_dumpdata = d.getVarFlag('ARCHIVER_MODE', 'dumpdata', True)
|
|
|
|
ar_recipe = d.getVarFlag('ARCHIVER_MODE', 'recipe', True)
|
|
|
|
|
|
|
|
if ar_src == "original":
|
|
|
|
d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_ar_original' % pn)
|
|
|
|
elif ar_src == "patched":
|
|
|
|
d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_ar_patched' % pn)
|
|
|
|
elif ar_src == "configured":
|
|
|
|
# We can't use "addtask do_ar_configured after do_configure" since it
|
|
|
|
# will cause the deptask of do_populate_sysroot to run not matter what
|
|
|
|
# archives we need, so we add the depends here.
|
|
|
|
d.appendVarFlag('do_ar_configured', 'depends', ' %s:do_configure' % pn)
|
|
|
|
d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_ar_configured' % pn)
|
|
|
|
elif ar_src:
|
|
|
|
bb.fatal("Invalid ARCHIVER_MODE[src]: %s" % ar_src)
|
|
|
|
|
|
|
|
if ar_dumpdata == "1":
|
|
|
|
d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_dumpdata' % pn)
|
|
|
|
|
|
|
|
if ar_recipe == "1":
|
|
|
|
d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_ar_recipe' % pn)
|
|
|
|
|
|
|
|
# Output the srpm package
|
|
|
|
ar_srpm = d.getVarFlag('ARCHIVER_MODE', 'srpm', True)
|
|
|
|
if ar_srpm == "1":
|
|
|
|
if d.getVar('PACKAGES', True) != '' and d.getVar('IMAGE_PKGTYPE', True) == 'rpm':
|
|
|
|
d.appendVarFlag('do_deploy_archives', 'depends', ' %s:do_package_write_rpm' % pn)
|
|
|
|
if ar_dumpdata == "1":
|
|
|
|
d.appendVarFlag('do_package_write_rpm', 'depends', ' %s:do_dumpdata' % pn)
|
|
|
|
if ar_recipe == "1":
|
|
|
|
d.appendVarFlag('do_package_write_rpm', 'depends', ' %s:do_ar_recipe' % pn)
|
|
|
|
if ar_src == "original":
|
|
|
|
d.appendVarFlag('do_package_write_rpm', 'depends', ' %s:do_ar_original' % pn)
|
|
|
|
elif ar_src == "patched":
|
|
|
|
d.appendVarFlag('do_package_write_rpm', 'depends', ' %s:do_ar_patched' % pn)
|
|
|
|
elif ar_src == "configured":
|
|
|
|
d.appendVarFlag('do_package_write_rpm', 'depends', ' %s:do_ar_configured' % pn)
|
|
|
|
}
|
2014-01-04 13:02:30 +00:00
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
# Take all the sources for a recipe and puts them in WORKDIR/archiver-work/.
|
|
|
|
# Files in SRC_URI are copied directly, anything that's a directory
|
|
|
|
# (e.g. git repositories) is "unpacked" and then put into a tarball.
|
|
|
|
python do_ar_original() {
|
2014-01-04 13:02:30 +00:00
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
import shutil, tarfile, tempfile
|
2014-01-04 13:02:30 +00:00
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
if d.getVarFlag('ARCHIVER_MODE', 'src', True) != "original":
|
|
|
|
return
|
2014-01-04 13:02:30 +00:00
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
ar_outdir = d.getVar('ARCHIVER_OUTDIR', True)
|
|
|
|
bb.note('Archiving the original source...')
|
|
|
|
fetch = bb.fetch2.Fetch([], d)
|
|
|
|
for url in fetch.urls:
|
2014-08-20 08:15:00 +00:00
|
|
|
local = fetch.localpath(url).rstrip("/");
|
2014-01-05 14:58:09 +00:00
|
|
|
if os.path.isfile(local):
|
|
|
|
shutil.copy(local, ar_outdir)
|
|
|
|
elif os.path.isdir(local):
|
|
|
|
basename = os.path.basename(local)
|
|
|
|
|
|
|
|
tmpdir = tempfile.mkdtemp(dir=d.getVar('ARCHIVER_WORKDIR', True))
|
|
|
|
fetch.unpack(tmpdir, (url,))
|
|
|
|
|
|
|
|
os.chdir(tmpdir)
|
2014-10-16 20:53:03 +00:00
|
|
|
# We eliminate any AUTOINC+ in the revision.
|
2014-08-26 17:29:31 +00:00
|
|
|
try:
|
2014-10-16 20:53:03 +00:00
|
|
|
src_rev = bb.fetch2.get_srcrev(d).replace('AUTOINC+','')
|
2014-08-26 17:29:31 +00:00
|
|
|
except:
|
|
|
|
src_rev = 'NOREV'
|
|
|
|
tarname = os.path.join(ar_outdir, basename + '.' + src_rev + '.tar.gz')
|
2014-01-05 14:58:09 +00:00
|
|
|
tar = tarfile.open(tarname, 'w:gz')
|
|
|
|
tar.add('.')
|
|
|
|
tar.close()
|
2014-03-24 05:39:27 +00:00
|
|
|
|
|
|
|
# Emit patch series files for 'original'
|
|
|
|
bb.note('Writing patch series files...')
|
|
|
|
for patch in src_patches(d):
|
|
|
|
_, _, local, _, _, parm = bb.fetch.decodeurl(patch)
|
|
|
|
patchdir = parm.get('patchdir')
|
|
|
|
if patchdir:
|
|
|
|
series = os.path.join(ar_outdir, 'series.subdir.%s' % patchdir.replace('/', '_'))
|
|
|
|
else:
|
|
|
|
series = os.path.join(ar_outdir, 'series')
|
|
|
|
|
|
|
|
with open(series, 'a') as s:
|
|
|
|
s.write('%s -p%s\n' % (os.path.basename(local), parm['striplevel']))
|
2014-01-04 13:02:30 +00:00
|
|
|
}
|
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
python do_ar_patched() {
|
2012-06-26 05:59:41 +00:00
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
if d.getVarFlag('ARCHIVER_MODE', 'src', True) != 'patched':
|
|
|
|
return
|
2012-06-26 05:59:41 +00:00
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
# Get the ARCHIVER_OUTDIR before we reset the WORKDIR
|
|
|
|
ar_outdir = d.getVar('ARCHIVER_OUTDIR', True)
|
2016-03-22 14:04:01 +00:00
|
|
|
ar_workdir = d.getVar('ARCHIVER_WORKDIR', True)
|
2014-01-05 14:58:09 +00:00
|
|
|
bb.note('Archiving the patched source...')
|
2016-03-22 14:04:01 +00:00
|
|
|
d.setVar('WORKDIR', ar_workdir)
|
2015-09-23 21:36:07 +00:00
|
|
|
create_tarball(d, d.getVar('S', True), 'patched', ar_outdir)
|
2014-01-05 14:58:09 +00:00
|
|
|
}
|
2012-08-23 15:03:10 +00:00
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
python do_ar_configured() {
|
2012-08-23 15:03:10 +00:00
|
|
|
import shutil
|
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
ar_outdir = d.getVar('ARCHIVER_OUTDIR', True)
|
|
|
|
if d.getVarFlag('ARCHIVER_MODE', 'src', True) == 'configured':
|
|
|
|
bb.note('Archiving the configured source...')
|
|
|
|
# The libtool-native's do_configure will remove the
|
|
|
|
# ${STAGING_DATADIR}/aclocal/libtool.m4, so we can't re-run the
|
|
|
|
# do_configure, we archive the already configured ${S} to
|
|
|
|
# instead of.
|
|
|
|
if d.getVar('PN', True) != 'libtool-native':
|
|
|
|
# Change the WORKDIR to make do_configure run in another dir.
|
|
|
|
d.setVar('WORKDIR', d.getVar('ARCHIVER_WORKDIR', True))
|
|
|
|
if bb.data.inherits_class('kernel-yocto', d):
|
|
|
|
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', True)
|
|
|
|
for func in (prefuncs or '').split():
|
|
|
|
if func != "sysroot_cleansstate":
|
|
|
|
bb.build.exec_func(func, d)
|
|
|
|
bb.build.exec_func('do_configure', d)
|
|
|
|
postfuncs = d.getVarFlag('do_configure', 'postfuncs', True)
|
|
|
|
for func in (postfuncs or '').split():
|
|
|
|
if func != "do_qa_configure":
|
|
|
|
bb.build.exec_func(func, d)
|
|
|
|
srcdir = d.getVar('S', True)
|
|
|
|
builddir = d.getVar('B', True)
|
|
|
|
if srcdir != builddir:
|
|
|
|
if os.path.exists(builddir):
|
|
|
|
oe.path.copytree(builddir, os.path.join(srcdir, \
|
|
|
|
'build.%s.ar_configured' % d.getVar('PF', True)))
|
|
|
|
create_tarball(d, srcdir, 'configured', ar_outdir)
|
|
|
|
}
|
2012-03-26 10:49:26 +00:00
|
|
|
|
2015-09-23 21:36:07 +00:00
|
|
|
def create_tarball(d, srcdir, suffix, ar_outdir):
|
2012-08-23 15:08:22 +00:00
|
|
|
"""
|
2014-01-05 14:58:09 +00:00
|
|
|
create the tarball from srcdir
|
2012-08-23 15:08:22 +00:00
|
|
|
"""
|
2012-08-23 15:03:10 +00:00
|
|
|
import tarfile
|
|
|
|
|
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>
2015-10-06 23:05:09 +00:00
|
|
|
# Make sure we are only creating a single tarball for gcc sources
|
2015-11-09 22:40:50 +00:00
|
|
|
if (d.getVar('SRC_URI', True) == ""):
|
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>
2015-10-06 23:05:09 +00:00
|
|
|
return
|
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
bb.utils.mkdirhier(ar_outdir)
|
2015-09-23 21:36:07 +00:00
|
|
|
tarname = os.path.join(ar_outdir, '%s-%s.tar.gz' % \
|
2014-01-05 14:58:09 +00:00
|
|
|
(d.getVar('PF', True), suffix))
|
2012-03-26 10:49:26 +00:00
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
srcdir = srcdir.rstrip('/')
|
|
|
|
dirname = os.path.dirname(srcdir)
|
|
|
|
basename = os.path.basename(srcdir)
|
|
|
|
os.chdir(dirname)
|
|
|
|
bb.note('Creating %s' % tarname)
|
|
|
|
tar = tarfile.open(tarname, 'w:gz')
|
|
|
|
tar.add(basename)
|
|
|
|
tar.close()
|
2012-08-23 15:03:10 +00:00
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
# creating .diff.gz between source.orig and source
|
|
|
|
def create_diff_gz(d, src_orig, src, ar_outdir):
|
2012-08-23 15:03:10 +00:00
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
import subprocess
|
2012-08-23 15:03:10 +00:00
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
if not os.path.isdir(src) or not os.path.isdir(src_orig):
|
2012-08-23 15:03:10 +00:00
|
|
|
return
|
2012-03-26 10:49:26 +00:00
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
# The diff --exclude can't exclude the file with path, so we copy
|
|
|
|
# the patched source, and remove the files that we'd like to
|
|
|
|
# exclude.
|
|
|
|
src_patched = src + '.patched'
|
|
|
|
oe.path.copyhardlinktree(src, src_patched)
|
|
|
|
for i in d.getVarFlag('ARCHIVER_MODE', 'diff-exclude', True).split():
|
|
|
|
bb.utils.remove(os.path.join(src_orig, i), recurse=True)
|
|
|
|
bb.utils.remove(os.path.join(src_patched, i), recurse=True)
|
|
|
|
|
|
|
|
dirname = os.path.dirname(src)
|
|
|
|
basename = os.path.basename(src)
|
|
|
|
os.chdir(dirname)
|
|
|
|
out_file = os.path.join(ar_outdir, '%s-diff.gz' % d.getVar('PF', True))
|
|
|
|
diff_cmd = 'diff -Naur %s.orig %s.patched | gzip -c > %s' % (basename, basename, out_file)
|
|
|
|
subprocess.call(diff_cmd, shell=True)
|
|
|
|
bb.utils.remove(src_patched, recurse=True)
|
|
|
|
|
|
|
|
# Run do_unpack and do_patch
|
|
|
|
python do_unpack_and_patch() {
|
|
|
|
if d.getVarFlag('ARCHIVER_MODE', 'src', True) not in \
|
|
|
|
[ 'patched', 'configured'] and \
|
|
|
|
d.getVarFlag('ARCHIVER_MODE', 'diff', True) != '1':
|
|
|
|
return
|
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>
2015-10-06 23:05:09 +00:00
|
|
|
ar_outdir = d.getVar('ARCHIVER_OUTDIR', True)
|
2016-03-22 14:04:01 +00:00
|
|
|
ar_workdir = d.getVar('ARCHIVER_WORKDIR', True)
|
2014-06-16 03:22:57 +00:00
|
|
|
|
2015-11-09 22:40:50 +00:00
|
|
|
# The kernel class functions require it to be on work-shared, so we dont change WORKDIR
|
|
|
|
if not bb.data.inherits_class('kernel-yocto', d):
|
2016-03-22 14:04:01 +00:00
|
|
|
# Change the WORKDIR to make do_unpack do_patch run in another dir.
|
|
|
|
d.setVar('WORKDIR', ar_workdir)
|
2014-01-05 14:58:09 +00:00
|
|
|
|
2016-03-22 14:04:01 +00:00
|
|
|
# The changed 'WORKDIR' also caused 'B' changed, create dir 'B' for the
|
|
|
|
# possibly requiring of the following tasks (such as some recipes's
|
|
|
|
# do_patch required 'B' existed).
|
|
|
|
bb.utils.mkdirhier(d.getVar('B', True))
|
|
|
|
|
|
|
|
bb.build.exec_func('do_unpack', d)
|
2015-11-09 22:40:50 +00:00
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
# Save the original source for creating the patches
|
|
|
|
if d.getVarFlag('ARCHIVER_MODE', 'diff', True) == '1':
|
|
|
|
src = d.getVar('S', True).rstrip('/')
|
|
|
|
src_orig = '%s.orig' % src
|
|
|
|
oe.path.copytree(src, src_orig)
|
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>
2015-10-06 23:05:09 +00:00
|
|
|
|
2015-11-09 22:40:50 +00:00
|
|
|
# Make sure gcc and kernel sources are patched only once
|
|
|
|
if not ((d.getVar('SRC_URI', True) == "" or bb.data.inherits_class('kernel-yocto', d))):
|
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>
2015-10-06 23:05:09 +00:00
|
|
|
bb.build.exec_func('do_patch', d)
|
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
# Create the patches
|
|
|
|
if d.getVarFlag('ARCHIVER_MODE', 'diff', True) == '1':
|
|
|
|
bb.note('Creating diff gz...')
|
|
|
|
create_diff_gz(d, src_orig, src, ar_outdir)
|
|
|
|
bb.utils.remove(src_orig, recurse=True)
|
|
|
|
}
|
2012-08-23 15:03:10 +00:00
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
python do_ar_recipe () {
|
2012-08-23 15:08:22 +00:00
|
|
|
"""
|
2014-01-05 14:58:09 +00:00
|
|
|
archive the recipe, including .bb and .inc.
|
2012-08-23 15:08:22 +00:00
|
|
|
"""
|
2014-01-05 14:58:09 +00:00
|
|
|
import re
|
2013-02-20 13:50:22 +00:00
|
|
|
import shutil
|
2012-08-23 15:03:10 +00:00
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
require_re = re.compile( r"require\s+(.+)" )
|
|
|
|
include_re = re.compile( r"include\s+(.+)" )
|
|
|
|
bbfile = d.getVar('FILE', True)
|
|
|
|
outdir = os.path.join(d.getVar('WORKDIR', True), \
|
|
|
|
'%s-recipe' % d.getVar('PF', True))
|
|
|
|
bb.utils.mkdirhier(outdir)
|
|
|
|
shutil.copy(bbfile, outdir)
|
|
|
|
|
2015-11-13 08:21:46 +00:00
|
|
|
pn = d.getVar('PN', True)
|
|
|
|
bbappend_files = d.getVar('BBINCLUDED', True).split()
|
|
|
|
# If recipe name is aa, we need to match files like aa.bbappend and aa_1.1.bbappend
|
|
|
|
# Files like aa1.bbappend or aa1_1.1.bbappend must be excluded.
|
|
|
|
bbappend_re = re.compile( r".*/%s_[^/]*\.bbappend$" %pn)
|
|
|
|
bbappend_re1 = re.compile( r".*/%s\.bbappend$" %pn)
|
|
|
|
for file in bbappend_files:
|
|
|
|
if bbappend_re.match(file) or bbappend_re1.match(file):
|
|
|
|
shutil.copy(file, outdir)
|
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
dirname = os.path.dirname(bbfile)
|
|
|
|
bbpath = '%s:%s' % (dirname, d.getVar('BBPATH', True))
|
|
|
|
f = open(bbfile, 'r')
|
|
|
|
for line in f.readlines():
|
|
|
|
incfile = None
|
|
|
|
if require_re.match(line):
|
|
|
|
incfile = require_re.match(line).group(1)
|
|
|
|
elif include_re.match(line):
|
|
|
|
incfile = include_re.match(line).group(1)
|
|
|
|
if incfile:
|
|
|
|
incfile = bb.data.expand(incfile, d)
|
|
|
|
incfile = bb.utils.which(bbpath, incfile)
|
|
|
|
if incfile:
|
|
|
|
shutil.copy(incfile, outdir)
|
|
|
|
|
|
|
|
create_tarball(d, outdir, 'recipe', d.getVar('ARCHIVER_OUTDIR', True))
|
|
|
|
bb.utils.remove(outdir, recurse=True)
|
|
|
|
}
|
2012-03-26 10:49:26 +00:00
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
python do_dumpdata () {
|
2012-08-23 15:08:22 +00:00
|
|
|
"""
|
2014-01-05 14:58:09 +00:00
|
|
|
dump environment data to ${PF}-showdata.dump
|
2012-08-23 15:08:22 +00:00
|
|
|
"""
|
2012-08-23 15:03:10 +00:00
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
dumpfile = os.path.join(d.getVar('ARCHIVER_OUTDIR', True), \
|
|
|
|
'%s-showdata.dump' % d.getVar('PF', True))
|
|
|
|
bb.note('Dumping metadata into %s' % dumpfile)
|
2016-03-22 14:04:00 +00:00
|
|
|
with open(dumpfile, "w") as f:
|
|
|
|
# emit variables and shell functions
|
|
|
|
bb.data.emit_env(f, d, True)
|
|
|
|
# emit the metadata which isn't valid shell
|
|
|
|
for e in d.keys():
|
|
|
|
if d.getVarFlag(e, "python", False):
|
|
|
|
f.write("\npython %s () {\n%s}\n" % (e, d.getVar(e, False)))
|
2012-03-26 10:49:26 +00:00
|
|
|
}
|
2014-01-04 13:02:30 +00:00
|
|
|
|
2014-01-05 14:58:09 +00:00
|
|
|
SSTATETASKS += "do_deploy_archives"
|
|
|
|
do_deploy_archives () {
|
|
|
|
echo "Deploying source archive files ..."
|
2014-01-04 13:02:30 +00:00
|
|
|
}
|
2014-01-05 14:58:09 +00:00
|
|
|
python do_deploy_archives_setscene () {
|
2014-01-04 13:02:30 +00:00
|
|
|
sstate_setscene(d)
|
|
|
|
}
|
2014-01-05 14:58:09 +00:00
|
|
|
do_deploy_archives[sstate-inputdirs] = "${ARCHIVER_TOPDIR}"
|
|
|
|
do_deploy_archives[sstate-outputdirs] = "${DEPLOY_DIR_SRC}"
|
|
|
|
|
|
|
|
addtask do_ar_original after do_unpack
|
2015-11-09 22:40:50 +00:00
|
|
|
addtask do_unpack_and_patch after do_patch
|
2014-01-05 14:58:09 +00:00
|
|
|
addtask do_ar_patched after do_unpack_and_patch
|
|
|
|
addtask do_ar_configured after do_unpack_and_patch
|
|
|
|
addtask do_dumpdata
|
|
|
|
addtask do_ar_recipe
|
|
|
|
addtask do_deploy_archives before do_build
|
2015-07-09 08:35:26 +00:00
|
|
|
|
|
|
|
addtask do_deploy_all_archives after do_deploy_archives
|
|
|
|
do_deploy_all_archives[recrdeptask] = "do_deploy_archives"
|
|
|
|
do_deploy_all_archives[recideptask] = "do_${BB_DEFAULT_TASK}"
|
|
|
|
do_deploy_all_archives() {
|
|
|
|
:
|
|
|
|
}
|
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>
2015-10-06 23:05:09 +00:00
|
|
|
|
|
|
|
python () {
|
|
|
|
# Add tasks in the correct order, specifically for linux-yocto to avoid race condition
|
|
|
|
if bb.data.inherits_class('kernel-yocto', d):
|
|
|
|
bb.build.addtask('do_kernel_configme', 'do_configure', 'do_unpack_and_patch', d)
|
|
|
|
}
|