summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-12-07 13:54:35 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-23 12:05:17 +0000
commit9107d6ca144ac1f6169830dee25dae2dad775333 (patch)
treeec2f5662f8cea5a380ce1a86e249d08e1d0ca14f /meta
parent45df694a9f472ac2f684aadac4d864c3dfdc48a7 (diff)
downloadpoky-9107d6ca144ac1f6169830dee25dae2dad775333.tar.gz
Switch to Recipe Specific Sysroots
This patch is comparatively large and invasive. It does only do one thing, switching the system to build using recipe specific sysroots and where changes could be isolated from it, that has been done. With the current single sysroot approach, its possible for software to find things which aren't in their dependencies. This leads to a determinism problem and is a growing issue in several of the market segments where OE makes sense. The way to solve this problem for OE is to have seperate sysroots for each recipe and these will only contain the dependencies for that recipe. Its worth noting that this is not task specific sysroots and that OE's dependencies do vary enormously by task. This did result in some implementation challenges. There is nothing stopping the implementation of task specific sysroots at some later point based on this work but that as deemed a bridge too far right now. Implementation details: * Rather than installing the sysroot artefacts into a combined sysroots, they are now placed in TMPDIR/sysroot-components/PACKAGE_ARCH/PN. * WORKDIR/recipe-sysroot and WORKDIR/recipe-sysroot-native are built by hardlinking in files from the sysroot-component trees. These new directories are known as RECIPE_SYSROOT and RECIPE_SYSROOT_NATIVE. * This construction is primarily done by a new do_prepare_recipe_sysroot task which runs before do_configure and consists of a call to the extend_recipe_sysroot function. * Other tasks need things in the sysroot before/after this, e.g. do_patch needs quilt-native and do_package_write_deb needs dpkg-native. The code therefore inspects the dependencies for each task and adds extend_recipe_sysroot as a prefunc if it has populate_sysroot dependencies. * We have to do a search/replace 'fixme' operation on the files installed into the sysroot to change hardcoded paths into the correct ones. We create a fixmepath file in the component directory which lists the files which need this operation. * Some files have "postinstall" commands which need to run against them, e.g. gdk-pixbuf each time a new loader is added. These are handled by adding files in bindir with the name prefixed by "postinst-" and are run in each sysroot as its created if they're present. This did mean most sstate postinstalls have to be rewritten but there shouldn't be many of them. * Since a recipe can have multiple tasks and these tasks can run against each other at the same time we have to have a lock when we perform write operations against the sysroot. We also have to maintain manifests of what we install against a task checksum of the dependency. If the checksum changes, we remove its files and then add the new ones. * The autotools logic for filtering the view of m4 files is no longer needed (and was the model for the way extend_recipe_sysroot works). * For autotools, we used to build a combined m4 macros directory which had both the native and target m4 files. We can no longer do this so we use the target sysroot as the default and add the native sysroot as an extra backup include path. If we don't do this, we'd have to build target pkg-config before we could built anything using pkg-config for example (ditto gettext). Such dependencies would be painful so we haven't required that. * PKDDATA_DIR was moved out the sysroot and works as before using sstate to build a hybrid copy for each machine. The paths therefore changed, the behaviour did not. * The ccache class had to be reworked to function with rss. * The TCBOOTSTRAP sysroot for compiler bootstrap is no longer needed but the -initial data does have to be filtered out from the main recipe sysroots. Putting "-initial" in a normal recipe name therefore remains a bad idea. * The logic in insane needed tweaks to deal with the new path layout, as did the debug source file extraction code in package.bbclass. * The logic in sstate.bbclass had to be rewritten since it previously only performed search and replace on extracted sstate and we now need this to happen even if the compiled path was "correct". This in theory could cause a mild performance issue but since the sysroot data was the main data that needed this and we'd have to do it there regardless with rss, I've opted just to change the way the class for everything. The built output used to build the sstate output is now retained and installed rather than deleted. * The search and replace logic used in sstate objects also seemed weak/incorrect and didn't hold up against testing. This has been rewritten too. There are some assumptions made about paths, we save the 'proper' search and replace operations to fixmepath.cmd but then ignore this. What is here works but is a little hardcoded and an area for future improvement. * In order to work with eSDK we need a way to build something that looks like the old style sysroot. "bitbake build-sysroots" will construct such a sysroot based on everything in the components directory that matches the current MACHINE. It will allow transition of external tools and can built target or native variants or both. It also supports a clean task. I'd suggest not relying on this for anything other than transitional purposes though. To see XXX in that sysroot, you'd have to have built that in a previous bitbake invocation. * pseudo is run out of its components directory. This is fine as its statically linked. * The hacks for wayland to see allarch dependencies in the multilib case are no longer needed and can be dropped. * wic needed more extensive changes to work with rss and the fixes are in a separate commit series * Various oe-selftest tweaks were needed since tests did assume the location to binaries and the combined sysroot in several cases. * Most missing dependencies this work found have been sent out as separate patches as they were found but a few tweaks are still included here. * A late addition is that extend_recipe_sysroot became multilib aware and able to populate multilib sysroots. I had hoped not to have to add that complexity but the meta-environment recipe forced my hand. That implementation can probably be neater but this is on the list of things to cleanup later at this point. In summary, the impact people will likely see after this change: * Recipes may fail with missing dependencies, particularly native tools like gettext-native, glib-2.0-native and libxml2.0-native. Some hosts have these installed and will mask these errors * Any recipe/class using SSTATEPOSTINSTFUNCS will need that code rewriting into a postinst * There was a separate patch series dealing with roots postinst native dependency issues. Any postinst which expects native tools at rootfs time will need to mark that dependency with PACKAGE_WRITE_DEPS. There could well be other issues. This has been tested repeatedly against our autobuilders and oe-selftest and issues found have been fixed. We believe at least OE-Core is in good shape but that doesn't mean we've found all the issues. Also, the logging is a bit chatty at the moment. It does help if something goes wrong and goes to the task logfiles, not the console so I've intentionally left this like that for now. We can turn it down easily enough in due course. (From OE-Core rev: 809746f56df4b91af014bf6a3f28997d6698ac78) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/autotools.bbclass128
-rw-r--r--meta/classes/base.bbclass2
-rw-r--r--meta/classes/ccache.bbclass3
-rw-r--r--meta/classes/cross-canadian.bbclass5
-rw-r--r--meta/classes/cross.bbclass2
-rw-r--r--meta/classes/crosssdk.bbclass1
-rw-r--r--meta/classes/gobject-introspection.bbclass2
-rw-r--r--meta/classes/image.bbclass6
-rw-r--r--meta/classes/insane.bbclass3
-rw-r--r--meta/classes/module.bbclass2
-rw-r--r--meta/classes/native.bbclass2
-rw-r--r--meta/classes/nativesdk.bbclass4
-rw-r--r--meta/classes/package.bbclass3
-rw-r--r--meta/classes/pixbufcache.bbclass21
-rw-r--r--meta/classes/populate_sdk_ext.bbclass2
-rw-r--r--meta/classes/siteconfig.bbclass2
-rw-r--r--meta/classes/sstate.bbclass126
-rw-r--r--meta/classes/staging.bbclass349
-rw-r--r--meta/classes/toolchain-scripts.bbclass1
-rw-r--r--meta/classes/uninative.bbclass3
-rw-r--r--meta/classes/useradd.bbclass34
-rw-r--r--meta/conf/bitbake.conf22
-rw-r--r--meta/conf/multilib.conf12
-rw-r--r--meta/files/ext-sdk-prepare.py2
-rw-r--r--meta/lib/oeqa/selftest/buildoptions.py3
-rw-r--r--meta/lib/oeqa/selftest/layerappend.py3
-rw-r--r--meta/lib/oeqa/selftest/liboe.py5
-rw-r--r--meta/lib/oeqa/selftest/signing.py2
-rw-r--r--meta/recipes-core/base-passwd/base-passwd_3.5.29.bb29
-rw-r--r--meta/recipes-core/glibc/glibc-initial.inc19
-rw-r--r--meta/recipes-core/glibc/glibc.inc2
-rw-r--r--meta/recipes-core/meta/build-sysroots.bb38
-rw-r--r--meta/recipes-core/meta/meta-environment-extsdk.bb4
-rw-r--r--meta/recipes-core/meta/meta-extsdk-toolchain.bb2
-rw-r--r--meta/recipes-core/meta/meta-world-pkgdata.bb2
-rw-r--r--meta/recipes-core/musl/musl.inc1
-rw-r--r--meta/recipes-devtools/docbook-xml/docbook-xml-dtd4_4.5.bb19
-rw-r--r--meta/recipes-devtools/docbook-xml/docbook-xsl-stylesheets_1.79.1.bb19
-rw-r--r--meta/recipes-devtools/gcc/gcc-cross-initial.inc5
-rw-r--r--meta/recipes-devtools/gcc/libgcc-initial.inc2
-rw-r--r--meta/recipes-devtools/guile/guile_2.0.13.bb4
-rw-r--r--meta/recipes-devtools/libtool/libtool_2.4.6.bb2
-rw-r--r--meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb2
-rw-r--r--meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.36.1.bb9
-rw-r--r--meta/recipes-gnome/gobject-introspection/gobject-introspection_1.50.0.bb15
-rw-r--r--meta/recipes-gnome/gtk+/gtk+3.inc2
-rw-r--r--meta/recipes-graphics/libsdl2/libsdl2_2.0.5.bb3
-rw-r--r--meta/recipes-graphics/wayland/weston_1.11.1.bb4
-rw-r--r--meta/recipes-graphics/xorg-xserver/xserver-xorg.inc3
-rw-r--r--meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb1
-rw-r--r--meta/recipes-multimedia/alsa/alsa-tools_1.1.0.bb2
-rw-r--r--meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.2.bb4
52 files changed, 610 insertions, 333 deletions
diff --git a/meta/classes/autotools.bbclass b/meta/classes/autotools.bbclass
index c43531b050..3741d09706 100644
--- a/meta/classes/autotools.bbclass
+++ b/meta/classes/autotools.bbclass
@@ -131,129 +131,15 @@ EXTRACONFFUNCS ??= ""
131 131
132EXTRA_OECONF_append = " ${PACKAGECONFIG_CONFARGS}" 132EXTRA_OECONF_append = " ${PACKAGECONFIG_CONFARGS}"
133 133
134do_configure[prefuncs] += "autotools_preconfigure autotools_copy_aclocals ${EXTRACONFFUNCS}" 134do_configure[prefuncs] += "autotools_preconfigure autotools_aclocals ${EXTRACONFFUNCS}"
135do_configure[postfuncs] += "autotools_postconfigure" 135do_configure[postfuncs] += "autotools_postconfigure"
136 136
137ACLOCALDIR = "${WORKDIR}/aclocal-copy" 137ACLOCALDIR = "${STAGING_DATADIR}/aclocal"
138 138ACLOCALEXTRAPATH = ""
139python autotools_copy_aclocals () { 139ACLOCALEXTRAPATH_class-target = " -I ${STAGING_DATADIR_NATIVE}/aclocal/"
140 import copy 140ACLOCALEXTRAPATH_class-nativesdk = " -I ${STAGING_DATADIR_NATIVE}/aclocal/"
141
142 s = d.getVar("AUTOTOOLS_SCRIPT_PATH")
143 if not os.path.exists(s + "/configure.in") and not os.path.exists(s + "/configure.ac"):
144 if not d.getVar("AUTOTOOLS_COPYACLOCAL", False):
145 return
146
147 taskdepdata = d.getVar("BB_TASKDEPDATA", False)
148 #bb.warn(str(taskdepdata))
149 pn = d.getVar("PN")
150 aclocaldir = d.getVar("ACLOCALDIR")
151 oe.path.remove(aclocaldir)
152 bb.utils.mkdirhier(aclocaldir)
153 start = None
154 configuredeps = []
155 # Detect bitbake -b usage
156 # Everything but quilt-native would have dependencies
157 nodeps = (pn != "quilt-native")
158
159 for dep in taskdepdata:
160 data = taskdepdata[dep]
161 if data[1] == "do_configure" and data[0] == pn:
162 start = dep
163 if not nodeps and start:
164 break
165 if nodeps and data[0] != pn:
166 nodeps = False
167 if start is None:
168 bb.fatal("Couldn't find ourself in BB_TASKDEPDATA?")
169
170 # We need to figure out which m4 files we need to expose to this do_configure task.
171 # This needs to match what would get restored from sstate, which is controlled
172 # ultimately by calls from bitbake to setscene_depvalid().
173 # That function expects a setscene dependency tree. We build a dependency tree
174 # condensed to do_populate_sysroot -> do_populate_sysroot dependencies, similar to
175 # that used by setscene tasks. We can then call into setscene_depvalid() and decide
176 # which dependencies we can "see" and should expose the m4 files for.
177 setscenedeps = copy.deepcopy(taskdepdata)
178
179 start = set([start])
180
181 # Create collapsed do_populate_sysroot -> do_populate_sysroot tree
182 for dep in taskdepdata:
183 data = setscenedeps[dep]
184 if data[1] != "do_populate_sysroot":
185 for dep2 in setscenedeps:
186 data2 = setscenedeps[dep2]
187 if dep in data2[3]:
188 data2[3].update(setscenedeps[dep][3])
189 data2[3].remove(dep)
190 if dep in start:
191 start.update(setscenedeps[dep][3])
192 start.remove(dep)
193 del setscenedeps[dep]
194
195 # Remove circular references
196 for dep in setscenedeps:
197 if dep in setscenedeps[dep][3]:
198 setscenedeps[dep][3].remove(dep)
199
200 # Direct dependencies should be present and can be depended upon
201 for dep in start:
202 configuredeps.append(setscenedeps[dep][0])
203
204 # Call into setscene_depvalid for each sub-dependency and only copy m4 files
205 # for ones that would be restored from sstate.
206 done = list(start)
207 next = list(start)
208 while next:
209 new = []
210 for dep in next:
211 data = setscenedeps[dep]
212 for datadep in data[3]:
213 if datadep in done:
214 continue
215 taskdeps = {}
216 taskdeps[dep] = setscenedeps[dep][:2]
217 taskdeps[datadep] = setscenedeps[datadep][:2]
218 retval = setscene_depvalid(datadep, taskdeps, [], d)
219 if retval:
220 bb.note("Skipping setscene dependency %s for m4 macro copying" % datadep)
221 continue
222 done.append(datadep)
223 new.append(datadep)
224 configuredeps.append(setscenedeps[datadep][0])
225 next = new
226
227 cp = []
228 if nodeps:
229 bb.warn("autotools: Unable to find task dependencies, -b being used? Pulling in all m4 files")
230 for l in [d.expand("${STAGING_DATADIR_NATIVE}/aclocal/"), d.expand("${STAGING_DATADIR}/aclocal/")]:
231 cp.extend(os.path.join(l, f) for f in os.listdir(l))
232
233 for c in configuredeps:
234 if c.endswith("-native"):
235 manifest = d.expand("${SSTATE_MANIFESTS}/manifest-${BUILD_ARCH}-%s.populate_sysroot" % c)
236 elif c.startswith("nativesdk-"):
237 manifest = d.expand("${SSTATE_MANIFESTS}/manifest-${SDK_ARCH}_${SDK_OS}-%s.populate_sysroot" % c)
238 elif "-cross-" in c or "-crosssdk" in c:
239 continue
240 else:
241 manifest = d.expand("${SSTATE_MANIFESTS}/manifest-${MACHINE}-%s.populate_sysroot" % c)
242 try:
243 f = open(manifest, "r")
244 for l in f:
245 if "/aclocal/" in l and l.strip().endswith(".m4"):
246 cp.append(l.strip())
247 elif "config_site.d/" in l:
248 cp.append(l.strip())
249 except:
250 bb.warn("%s not found" % manifest)
251
252 for c in cp:
253 t = os.path.join(aclocaldir, os.path.basename(c))
254 if not os.path.exists(t):
255 os.symlink(c, t)
256 141
142python autotools_aclocals () {
257 # Refresh variable with cache files 143 # Refresh variable with cache files
258 d.setVar("CONFIG_SITE", siteinfo_get_files(d, aclocalcache=True)) 144 d.setVar("CONFIG_SITE", siteinfo_get_files(d, aclocalcache=True))
259} 145}
@@ -279,6 +165,7 @@ autotools_do_configure() {
279 if [ -e ${AUTOTOOLS_SCRIPT_PATH}/configure.in -o -e ${AUTOTOOLS_SCRIPT_PATH}/configure.ac ]; then 165 if [ -e ${AUTOTOOLS_SCRIPT_PATH}/configure.in -o -e ${AUTOTOOLS_SCRIPT_PATH}/configure.ac ]; then
280 olddir=`pwd` 166 olddir=`pwd`
281 cd ${AUTOTOOLS_SCRIPT_PATH} 167 cd ${AUTOTOOLS_SCRIPT_PATH}
168 mkdir -p ${ACLOCALDIR}
282 ACLOCAL="aclocal --system-acdir=${ACLOCALDIR}/" 169 ACLOCAL="aclocal --system-acdir=${ACLOCALDIR}/"
283 if [ x"${acpaths}" = xdefault ]; then 170 if [ x"${acpaths}" = xdefault ]; then
284 acpaths= 171 acpaths=
@@ -289,6 +176,7 @@ autotools_do_configure() {
289 else 176 else
290 acpaths="${acpaths}" 177 acpaths="${acpaths}"
291 fi 178 fi
179 acpaths="$acpaths ${ACLOCALEXTRAPATH}"
292 AUTOV=`automake --version | sed -e '1{s/.* //;s/\.[0-9]\+$//};q'` 180 AUTOV=`automake --version | sed -e '1{s/.* //;s/\.[0-9]\+$//};q'`
293 automake --version 181 automake --version
294 echo "AUTOV is $AUTOV" 182 echo "AUTOV is $AUTOV"
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 2765ebf61b..965518c733 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -284,7 +284,7 @@ CLEANBROKEN = "0"
284 284
285addtask configure after do_patch 285addtask configure after do_patch
286do_configure[dirs] = "${B}" 286do_configure[dirs] = "${B}"
287do_configure[deptask] = "do_populate_sysroot" 287do_prepare_recipe_sysroot[deptask] = "do_populate_sysroot"
288base_do_configure() { 288base_do_configure() {
289 if [ -n "${CONFIGURESTAMPFILE}" -a -e "${CONFIGURESTAMPFILE}" ]; then 289 if [ -n "${CONFIGURESTAMPFILE}" -a -e "${CONFIGURESTAMPFILE}" ]; then
290 if [ "`cat ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" ]; then 290 if [ "`cat ${CONFIGURESTAMPFILE}`" != "${BB_TASKHASH}" ]; then
diff --git a/meta/classes/ccache.bbclass b/meta/classes/ccache.bbclass
index 93fcacaf1a..76c8828619 100644
--- a/meta/classes/ccache.bbclass
+++ b/meta/classes/ccache.bbclass
@@ -2,5 +2,8 @@ CCACHE = "${@bb.utils.which(d.getVar('PATH'), 'ccache') and 'ccache '}"
2export CCACHE_DIR ?= "${TMPDIR}/ccache/${MULTIMACH_HOST_SYS}/${PN}" 2export CCACHE_DIR ?= "${TMPDIR}/ccache/${MULTIMACH_HOST_SYS}/${PN}"
3CCACHE_DISABLE[unexport] = "1" 3CCACHE_DISABLE[unexport] = "1"
4 4
5DEPENDS_append_class-target = " ccache-native"
6DEPENDS[vardepvalueexclude] = " ccache-native"
7
5do_configure[dirs] =+ "${CCACHE_DIR}" 8do_configure[dirs] =+ "${CCACHE_DIR}"
6do_kernel_configme[dirs] =+ "${CCACHE_DIR}" 9do_kernel_configme[dirs] =+ "${CCACHE_DIR}"
diff --git a/meta/classes/cross-canadian.bbclass b/meta/classes/cross-canadian.bbclass
index 64db1134f5..3120f46a14 100644
--- a/meta/classes/cross-canadian.bbclass
+++ b/meta/classes/cross-canadian.bbclass
@@ -100,9 +100,9 @@ MULTIMACH_TARGET_SYS = "${PACKAGE_ARCH}${HOST_VENDOR}-${HOST_OS}"
100 100
101INHIBIT_DEFAULT_DEPS = "1" 101INHIBIT_DEFAULT_DEPS = "1"
102 102
103STAGING_DIR_HOST = "${STAGING_DIR}/${HOST_ARCH}-${SDKPKGSUFFIX}${HOST_VENDOR}-${HOST_OS}" 103STAGING_DIR_HOST = "${RECIPE_SYSROOT}"
104 104
105TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR}/${HOST_ARCH}-${SDKPKGSUFFIX}${HOST_VENDOR}-${HOST_OS}" 105TOOLCHAIN_OPTIONS = " --sysroot=${RECIPE_SYSROOT}"
106 106
107PATH_append = ":${TMPDIR}/sysroots/${HOST_ARCH}/${bindir_cross}" 107PATH_append = ":${TMPDIR}/sysroots/${HOST_ARCH}/${bindir_cross}"
108PKGHIST_DIR = "${TMPDIR}/pkghistory/${HOST_ARCH}-${SDKPKGSUFFIX}${HOST_VENDOR}-${HOST_OS}/" 108PKGHIST_DIR = "${TMPDIR}/pkghistory/${HOST_ARCH}-${SDKPKGSUFFIX}${HOST_VENDOR}-${HOST_OS}/"
@@ -169,6 +169,7 @@ USE_NLS = "${SDKUSE_NLS}"
169# and not any particular tune that is enabled. 169# and not any particular tune that is enabled.
170TARGET_ARCH[vardepsexclude] = "TUNE_ARCH" 170TARGET_ARCH[vardepsexclude] = "TUNE_ARCH"
171 171
172PKGDATA_DIR = "${TMPDIR}/pkgdata/${SDK_SYS}"
172# If MLPREFIX is set by multilib code, shlibs 173# If MLPREFIX is set by multilib code, shlibs
173# points to the wrong place so force it 174# points to the wrong place so force it
174SHLIBSDIRS = "${PKGDATA_DIR}/nativesdk-shlibs2" 175SHLIBSDIRS = "${PKGDATA_DIR}/nativesdk-shlibs2"
diff --git a/meta/classes/cross.bbclass b/meta/classes/cross.bbclass
index 01b09337ae..d125f10d01 100644
--- a/meta/classes/cross.bbclass
+++ b/meta/classes/cross.bbclass
@@ -19,7 +19,7 @@ HOST_AS_ARCH = "${BUILD_AS_ARCH}"
19 19
20export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir} /lib /lib64 /usr/lib /usr/lib64" 20export lt_cv_sys_lib_dlsearch_path_spec = "${libdir} ${base_libdir} /lib /lib64 /usr/lib /usr/lib64"
21 21
22STAGING_DIR_HOST = "${STAGING_DIR}/${HOST_ARCH}${HOST_VENDOR}-${HOST_OS}" 22STAGING_DIR_HOST = "${RECIPE_SYSROOT_NATIVE}"
23 23
24PACKAGE_ARCH = "${BUILD_ARCH}" 24PACKAGE_ARCH = "${BUILD_ARCH}"
25 25
diff --git a/meta/classes/crosssdk.bbclass b/meta/classes/crosssdk.bbclass
index eaf2beb94d..c5c29ea3da 100644
--- a/meta/classes/crosssdk.bbclass
+++ b/meta/classes/crosssdk.bbclass
@@ -8,7 +8,6 @@ python () {
8 d.setVar('TUNE_PKGARCH', d.getVar('SDK_ARCH')) 8 d.setVar('TUNE_PKGARCH', d.getVar('SDK_ARCH'))
9} 9}
10 10
11STAGING_DIR_TARGET = "${STAGING_DIR}/${SDK_ARCH}-${SDKPKGSUFFIX}${SDK_VENDOR}-${SDK_OS}"
12STAGING_BINDIR_TOOLCHAIN = "${STAGING_DIR_NATIVE}${bindir_native}/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}" 11STAGING_BINDIR_TOOLCHAIN = "${STAGING_DIR_NATIVE}${bindir_native}/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}"
13 12
14TARGET_ARCH = "${SDK_ARCH}" 13TARGET_ARCH = "${SDK_ARCH}"
diff --git a/meta/classes/gobject-introspection.bbclass b/meta/classes/gobject-introspection.bbclass
index 37389cbc8b..b6160b88b6 100644
--- a/meta/classes/gobject-introspection.bbclass
+++ b/meta/classes/gobject-introspection.bbclass
@@ -17,7 +17,7 @@ UNKNOWN_CONFIGURE_WHITELIST_append = " --enable-introspection --disable-introspe
17 17
18# Generating introspection data depends on a combination of native and target 18# Generating introspection data depends on a combination of native and target
19# introspection tools, and qemu to run the target tools. 19# introspection tools, and qemu to run the target tools.
20DEPENDS_append_class-target = " gobject-introspection gobject-introspection-native qemu-native" 20DEPENDS_append_class-target = " gobject-introspection gobject-introspection-native qemu-native prelink-native"
21 21
22# Even though introspection is disabled on -native, gobject-introspection package is still 22# Even though introspection is disabled on -native, gobject-introspection package is still
23# needed for m4 macros. 23# needed for m4 macros.
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 6b0864913b..5fc7385d79 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -13,7 +13,7 @@ inherit gzipnative
13 13
14LICENSE = "MIT" 14LICENSE = "MIT"
15PACKAGES = "" 15PACKAGES = ""
16DEPENDS += "${MLPREFIX}qemuwrapper-cross ${MLPREFIX}depmodwrapper-cross" 16DEPENDS += "${MLPREFIX}qemuwrapper-cross depmodwrapper-cross"
17RDEPENDS += "${PACKAGE_INSTALL} ${LINGUAS_INSTALL}" 17RDEPENDS += "${PACKAGE_INSTALL} ${LINGUAS_INSTALL}"
18RRECOMMENDS += "${PACKAGE_INSTALL_ATTEMPTONLY}" 18RRECOMMENDS += "${PACKAGE_INSTALL_ATTEMPTONLY}"
19 19
@@ -164,7 +164,7 @@ python () {
164 deps = "" 164 deps = ""
165 for dep in (d.getVar('EXTRA_IMAGEDEPENDS') or "").split(): 165 for dep in (d.getVar('EXTRA_IMAGEDEPENDS') or "").split():
166 deps += " %s:do_populate_sysroot" % dep 166 deps += " %s:do_populate_sysroot" % dep
167 d.appendVarFlag('do_build', 'depends', deps) 167 d.appendVarFlag('do_image_complete', 'depends', deps)
168 168
169 #process IMAGE_FEATURES, we must do this before runtime_mapping_rename 169 #process IMAGE_FEATURES, we must do this before runtime_mapping_rename
170 #Check for replaces image features 170 #Check for replaces image features
@@ -274,7 +274,7 @@ fakeroot python do_rootfs () {
274do_rootfs[dirs] = "${TOPDIR}" 274do_rootfs[dirs] = "${TOPDIR}"
275do_rootfs[cleandirs] += "${S} ${IMGDEPLOYDIR}" 275do_rootfs[cleandirs] += "${S} ${IMGDEPLOYDIR}"
276do_rootfs[umask] = "022" 276do_rootfs[umask] = "022"
277addtask rootfs before do_build 277addtask rootfs before do_build after do_prepare_recipe_sysroot
278 278
279fakeroot python do_image () { 279fakeroot python do_image () {
280 from oe.utils import execute_pre_post_process 280 from oe.utils import execute_pre_post_process
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index 7332e45453..3cf86c12c3 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -827,6 +827,7 @@ def package_qa_check_staged(path,d):
827 sane = True 827 sane = True
828 tmpdir = d.getVar('TMPDIR') 828 tmpdir = d.getVar('TMPDIR')
829 workdir = os.path.join(tmpdir, "work") 829 workdir = os.path.join(tmpdir, "work")
830 recipesysroot = d.getVar("RECIPE_SYSROOT")
830 831
831 if bb.data.inherits_class("native", d) or bb.data.inherits_class("cross", d): 832 if bb.data.inherits_class("native", d) or bb.data.inherits_class("cross", d):
832 pkgconfigcheck = workdir 833 pkgconfigcheck = workdir
@@ -842,12 +843,14 @@ def package_qa_check_staged(path,d):
842 if file.endswith(".la"): 843 if file.endswith(".la"):
843 with open(path) as f: 844 with open(path) as f:
844 file_content = f.read() 845 file_content = f.read()
846 file_content = file_content.replace(recipesysroot, "")
845 if workdir in file_content: 847 if workdir in file_content:
846 error_msg = "%s failed sanity test (workdir) in path %s" % (file,root) 848 error_msg = "%s failed sanity test (workdir) in path %s" % (file,root)
847 sane = package_qa_handle_error("la", error_msg, d) 849 sane = package_qa_handle_error("la", error_msg, d)
848 elif file.endswith(".pc"): 850 elif file.endswith(".pc"):
849 with open(path) as f: 851 with open(path) as f:
850 file_content = f.read() 852 file_content = f.read()
853 file_content = file_content.replace(recipesysroot, "")
851 if pkgconfigcheck in file_content: 854 if pkgconfigcheck in file_content:
852 error_msg = "%s failed sanity test (tmpdir) in path %s" % (file,root) 855 error_msg = "%s failed sanity test (tmpdir) in path %s" % (file,root)
853 sane = package_qa_handle_error("pkgconfig", error_msg, d) 856 sane = package_qa_handle_error("pkgconfig", error_msg, d)
diff --git a/meta/classes/module.bbclass b/meta/classes/module.bbclass
index 58470474cc..a5888736f2 100644
--- a/meta/classes/module.bbclass
+++ b/meta/classes/module.bbclass
@@ -1,6 +1,6 @@
1inherit module-base kernel-module-split 1inherit module-base kernel-module-split
2 2
3addtask make_scripts after do_patch before do_compile 3addtask make_scripts after do_prepare_recipe_sysroot before do_compile
4do_make_scripts[lockfiles] = "${TMPDIR}/kernel-scripts.lock" 4do_make_scripts[lockfiles] = "${TMPDIR}/kernel-scripts.lock"
5do_make_scripts[depends] += "virtual/kernel:do_shared_workdir" 5do_make_scripts[depends] += "virtual/kernel:do_shared_workdir"
6 6
diff --git a/meta/classes/native.bbclass b/meta/classes/native.bbclass
index 5592e1d1c1..4d4aaadc02 100644
--- a/meta/classes/native.bbclass
+++ b/meta/classes/native.bbclass
@@ -95,7 +95,7 @@ libdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
95libexecdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}" 95libexecdir .= "${NATIVE_PACKAGE_PATH_SUFFIX}"
96 96
97do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_NATIVE}/" 97do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_NATIVE}/"
98do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_NATIVE}/" 98do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR}-components/${PACKAGE_ARCH}/${PN}"
99 99
100# Since we actually install these into situ there is no staging prefix 100# Since we actually install these into situ there is no staging prefix
101STAGING_DIR_HOST = "" 101STAGING_DIR_HOST = ""
diff --git a/meta/classes/nativesdk.bbclass b/meta/classes/nativesdk.bbclass
index 2ac8fd82ed..a97f5a7114 100644
--- a/meta/classes/nativesdk.bbclass
+++ b/meta/classes/nativesdk.bbclass
@@ -25,9 +25,7 @@ PACKAGE_ARCHS = "${SDK_PACKAGE_ARCHS}"
25DEPENDS_append = " chrpath-replacement-native" 25DEPENDS_append = " chrpath-replacement-native"
26EXTRANATIVEPATH += "chrpath-native" 26EXTRANATIVEPATH += "chrpath-native"
27 27
28STAGING_DIR_HOST = "${STAGING_DIR}/${MULTIMACH_HOST_SYS}" 28PKGDATA_DIR = "${TMPDIR}/pkgdata/${SDK_SYS}"
29STAGING_DIR_TARGET = "${STAGING_DIR}/${MULTIMACH_TARGET_SYS}"
30PKGDATA_DIR = "${STAGING_DIR_HOST}/pkgdata"
31 29
32HOST_ARCH = "${SDK_ARCH}" 30HOST_ARCH = "${SDK_ARCH}"
33HOST_VENDOR = "${SDK_VENDOR}" 31HOST_VENDOR = "${SDK_VENDOR}"
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 0068a50258..ac2d71cfa4 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -414,7 +414,8 @@ def copydebugsources(debugsrcdir, d):
414 bb.utils.mkdirhier(basepath) 414 bb.utils.mkdirhier(basepath)
415 cpath.updatecache(basepath) 415 cpath.updatecache(basepath)
416 416
417 processdebugsrc = "LC_ALL=C ; sort -z -u '%s' | egrep -v -z '(<internal>|<built-in>)$' | " 417 # Ignore files from the recipe sysroots (target and native)
418 processdebugsrc = "LC_ALL=C ; sort -z -u '%s' | egrep -v -z '((<internal>|<built-in>)$|/.*recipe-sysroot.*/)' | "
418 # We need to ignore files that are not actually ours 419 # We need to ignore files that are not actually ours
419 # we do this by only paying attention to items from this package 420 # we do this by only paying attention to items from this package
420 processdebugsrc += "fgrep -zw '%s' | " 421 processdebugsrc += "fgrep -zw '%s' | "
diff --git a/meta/classes/pixbufcache.bbclass b/meta/classes/pixbufcache.bbclass
index 633a8757ed..aa9815cc6f 100644
--- a/meta/classes/pixbufcache.bbclass
+++ b/meta/classes/pixbufcache.bbclass
@@ -48,24 +48,17 @@ python populate_packages_append() {
48} 48}
49 49
50gdkpixbuf_complete() { 50gdkpixbuf_complete() {
51 GDK_PIXBUF_FATAL_LOADER=1 ${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache || exit 1 51GDK_PIXBUF_FATAL_LOADER=1 ${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache || exit 1
52} 52}
53 53
54#
55# Add an sstate postinst hook to update the cache for native packages.
56# An error exit during populate_sysroot_setscene allows bitbake to
57# try to recover by re-building the package.
58#
59DEPENDS_append_class-native = " gdk-pixbuf-native" 54DEPENDS_append_class-native = " gdk-pixbuf-native"
60SSTATEPOSTINSTFUNCS_append_class-native = " pixbufcache_sstate_postinst" 55SYSROOT_PREPROCESS_FUNCS_append_class-native = " pixbufcache_sstate_postinst"
61 56
62# See base.bbclass for the other half of this 57# See base.bbclass for the other half of this
63pixbufcache_sstate_postinst() { 58pixbufcache_sstate_postinst() {
64 if [ "${BB_CURRENTTASK}" = "populate_sysroot" ]; then 59 mkdir -p ${SYSROOT_DESTDIR}${bindir}
65 ${gdkpixbuf_complete} 60 dest=${SYSROOT_DESTDIR}${bindir}/postinst-useradd-${PN}
66 elif [ "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]; then 61 echo '#!/bin/sh' > $dest
67 if [ -x ${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders ]; then 62 echo "${gdkpixbuf_complete}" >> $dest
68 echo "${gdkpixbuf_complete}" >> ${STAGING_DIR}/sstatecompletions 63 chmod 0755 $dest
69 fi
70 fi
71} 64}
diff --git a/meta/classes/populate_sdk_ext.bbclass b/meta/classes/populate_sdk_ext.bbclass
index 7c9666c162..39e0c83fe4 100644
--- a/meta/classes/populate_sdk_ext.bbclass
+++ b/meta/classes/populate_sdk_ext.bbclass
@@ -404,7 +404,7 @@ python copy_buildsystem () {
404 404
405 if sdk_include_toolchain: 405 if sdk_include_toolchain:
406 lockedsigs_base = d.getVar('WORKDIR') + '/locked-sigs-base2.inc' 406 lockedsigs_base = d.getVar('WORKDIR') + '/locked-sigs-base2.inc'
407 lockedsigs_toolchain = d.getVar('STAGING_DIR_HOST') + '/locked-sigs/locked-sigs-extsdk-toolchain.inc' 407 lockedsigs_toolchain = d.expand("${STAGING_DIR}/${TUNE_PKGARCH}/meta-extsdk-toolchain/locked-sigs/locked-sigs-extsdk-toolchain.inc")
408 shutil.move(lockedsigs_pruned, lockedsigs_base) 408 shutil.move(lockedsigs_pruned, lockedsigs_base)
409 oe.copy_buildsystem.merge_lockedsigs([], 409 oe.copy_buildsystem.merge_lockedsigs([],
410 lockedsigs_base, 410 lockedsigs_base,
diff --git a/meta/classes/siteconfig.bbclass b/meta/classes/siteconfig.bbclass
index 9d51a0266a..bb491d2994 100644
--- a/meta/classes/siteconfig.bbclass
+++ b/meta/classes/siteconfig.bbclass
@@ -5,9 +5,9 @@ python siteconfig_do_siteconfig () {
5 if not os.path.isdir(os.path.join(d.getVar('FILE_DIRNAME'), 'site_config')): 5 if not os.path.isdir(os.path.join(d.getVar('FILE_DIRNAME'), 'site_config')):
6 bb.debug(1, "No site_config directory, skipping do_siteconfig") 6 bb.debug(1, "No site_config directory, skipping do_siteconfig")
7 return 7 return
8 sstate_install(shared_state, d)
8 bb.build.exec_func('do_siteconfig_gencache', d) 9 bb.build.exec_func('do_siteconfig_gencache', d)
9 sstate_clean(shared_state, d) 10 sstate_clean(shared_state, d)
10 sstate_install(shared_state, d)
11} 11}
12 12
13EXTRASITECONFIG ?= "" 13EXTRASITECONFIG ?= ""
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index f1faf4848e..a767a0203b 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -97,7 +97,7 @@ python () {
97 # These classes encode staging paths into their scripts data so can only be 97 # These classes encode staging paths into their scripts data so can only be
98 # reused if we manipulate the paths 98 # reused if we manipulate the paths
99 if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d) or bb.data.inherits_class('sdk', d) or bb.data.inherits_class('crosssdk', d): 99 if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross', d) or bb.data.inherits_class('sdk', d) or bb.data.inherits_class('crosssdk', d):
100 scan_cmd = "grep -Irl ${STAGING_DIR} ${SSTATE_BUILDDIR}" 100 scan_cmd = "grep -Irl -e ${RECIPE_SYSROOT} -e ${RECIPE_SYSROOT_NATIVE} ${SSTATE_BUILDDIR}"
101 d.setVar('SSTATE_SCAN_CMD', scan_cmd) 101 d.setVar('SSTATE_SCAN_CMD', scan_cmd)
102 102
103 unique_tasks = sorted(set((d.getVar('SSTATETASKS') or "").split())) 103 unique_tasks = sorted(set((d.getVar('SSTATETASKS') or "").split()))
@@ -131,6 +131,7 @@ def sstate_state_fromvars(d, task = None):
131 lockfiles = (d.getVarFlag("do_" + task, 'sstate-lockfile') or "").split() 131 lockfiles = (d.getVarFlag("do_" + task, 'sstate-lockfile') or "").split()
132 lockfilesshared = (d.getVarFlag("do_" + task, 'sstate-lockfile-shared') or "").split() 132 lockfilesshared = (d.getVarFlag("do_" + task, 'sstate-lockfile-shared') or "").split()
133 interceptfuncs = (d.getVarFlag("do_" + task, 'sstate-interceptfuncs') or "").split() 133 interceptfuncs = (d.getVarFlag("do_" + task, 'sstate-interceptfuncs') or "").split()
134 fixmedir = d.getVarFlag("do_" + task, 'sstate-fixmedir') or ""
134 if not task or len(inputs) != len(outputs): 135 if not task or len(inputs) != len(outputs):
135 bb.fatal("sstate variables not setup correctly?!") 136 bb.fatal("sstate variables not setup correctly?!")
136 137
@@ -146,6 +147,7 @@ def sstate_state_fromvars(d, task = None):
146 ss['lockfiles-shared'] = lockfilesshared 147 ss['lockfiles-shared'] = lockfilesshared
147 ss['plaindirs'] = plaindirs 148 ss['plaindirs'] = plaindirs
148 ss['interceptfuncs'] = interceptfuncs 149 ss['interceptfuncs'] = interceptfuncs
150 ss['fixmedir'] = fixmedir
149 return ss 151 return ss
150 152
151def sstate_add(ss, source, dest, d): 153def sstate_add(ss, source, dest, d):
@@ -195,6 +197,9 @@ def sstate_install(ss, d):
195 srcdir = os.path.join(walkroot, dir) 197 srcdir = os.path.join(walkroot, dir)
196 dstdir = srcdir.replace(state[1], state[2]) 198 dstdir = srcdir.replace(state[1], state[2])
197 #bb.debug(2, "Staging %s to %s" % (srcdir, dstdir)) 199 #bb.debug(2, "Staging %s to %s" % (srcdir, dstdir))
200 if os.path.islink(srcdir):
201 sharedfiles.append(dstdir)
202 continue
198 if not dstdir.endswith("/"): 203 if not dstdir.endswith("/"):
199 dstdir = dstdir + "/" 204 dstdir = dstdir + "/"
200 shareddirs.append(dstdir) 205 shareddirs.append(dstdir)
@@ -203,7 +208,7 @@ def sstate_install(ss, d):
203 whitelist = (d.getVar("SSTATE_DUPWHITELIST") or "").split() 208 whitelist = (d.getVar("SSTATE_DUPWHITELIST") or "").split()
204 match = [] 209 match = []
205 for f in sharedfiles: 210 for f in sharedfiles:
206 if os.path.exists(f): 211 if os.path.exists(f) and not os.path.islink(f):
207 f = os.path.normpath(f) 212 f = os.path.normpath(f)
208 realmatch = True 213 realmatch = True
209 for w in whitelist: 214 for w in whitelist:
@@ -244,6 +249,10 @@ def sstate_install(ss, d):
244 (d.getVar('PN'), "\n ".join(match))) 249 (d.getVar('PN'), "\n ".join(match)))
245 bb.fatal("If the above message is too much, the simpler version is you're advised to wipe out tmp and rebuild (reusing sstate is fine). That will likely fix things in most (but not all) cases.") 250 bb.fatal("If the above message is too much, the simpler version is you're advised to wipe out tmp and rebuild (reusing sstate is fine). That will likely fix things in most (but not all) cases.")
246 251
252 if ss['fixmedir'] and os.path.exists(ss['fixmedir'] + "/fixmepath.cmd"):
253 sharedfiles.append(ss['fixmedir'] + "/fixmepath.cmd")
254 sharedfiles.append(ss['fixmedir'] + "/fixmepath")
255
247 # Write out the manifest 256 # Write out the manifest
248 f = open(manifest, "w") 257 f = open(manifest, "w")
249 for file in sharedfiles: 258 for file in sharedfiles:
@@ -288,17 +297,8 @@ sstate_install[vardepsexclude] += "SSTATE_DUPWHITELIST STATE_MANMACH SSTATE_MANF
288sstate_install[vardeps] += "${SSTATEPOSTINSTFUNCS}" 297sstate_install[vardeps] += "${SSTATEPOSTINSTFUNCS}"
289 298
290def sstate_installpkg(ss, d): 299def sstate_installpkg(ss, d):
291 import oe.path
292 import subprocess
293 from oe.gpg_sign import get_signer 300 from oe.gpg_sign import get_signer
294 301
295 def prepdir(dir):
296 # remove dir if it exists, ensure any parent directories do exist
297 if os.path.exists(dir):
298 oe.path.remove(dir)
299 bb.utils.mkdirhier(dir)
300 oe.path.remove(dir)
301
302 sstateinst = d.expand("${WORKDIR}/sstate-install-%s/" % ss['task']) 302 sstateinst = d.expand("${WORKDIR}/sstate-install-%s/" % ss['task'])
303 sstatefetch = d.getVar('SSTATE_PKGNAME') + '_' + ss['task'] + ".tgz" 303 sstatefetch = d.getVar('SSTATE_PKGNAME') + '_' + ss['task'] + ".tgz"
304 sstatepkg = d.getVar('SSTATE_PKG') + '_' + ss['task'] + ".tgz" 304 sstatepkg = d.getVar('SSTATE_PKG') + '_' + ss['task'] + ".tgz"
@@ -320,11 +320,36 @@ def sstate_installpkg(ss, d):
320 if not signer.verify(sstatepkg + '.sig'): 320 if not signer.verify(sstatepkg + '.sig'):
321 bb.warn("Cannot verify signature on sstate package %s" % sstatepkg) 321 bb.warn("Cannot verify signature on sstate package %s" % sstatepkg)
322 322
323 for f in (d.getVar('SSTATEPREINSTFUNCS') or '').split() + ['sstate_unpack_package'] + (d.getVar('SSTATEPOSTUNPACKFUNCS') or '').split(): 323 sstateinst = d.getVar("SSTATE_INSTDIR")
324 d.setVar('SSTATE_FIXMEDIR', ss['fixmedir'])
325
326 for f in (d.getVar('SSTATEPREINSTFUNCS') or '').split() + ['sstate_unpack_package']:
324 # All hooks should run in the SSTATE_INSTDIR 327 # All hooks should run in the SSTATE_INSTDIR
325 bb.build.exec_func(f, d, (sstateinst,)) 328 bb.build.exec_func(f, d, (sstateinst,))
326 329
330 return sstate_installpkgdir(ss, d)
331
332def sstate_installpkgdir(ss, d):
333 import oe.path
334 import subprocess
335
336 sstateinst = d.getVar("SSTATE_INSTDIR")
337 d.setVar('SSTATE_FIXMEDIR', ss['fixmedir'])
338
339 for f in (d.getVar('SSTATEPOSTUNPACKFUNCS') or '').split():
340 # All hooks should run in the SSTATE_INSTDIR
341 bb.build.exec_func(f, d, (sstateinst,))
342
343 def prepdir(dir):
344 # remove dir if it exists, ensure any parent directories do exist
345 if os.path.exists(dir):
346 oe.path.remove(dir)
347 bb.utils.mkdirhier(dir)
348 oe.path.remove(dir)
349
327 for state in ss['dirs']: 350 for state in ss['dirs']:
351 if d.getVar('SSTATE_SKIP_CREATION') == '1':
352 continue
328 prepdir(state[1]) 353 prepdir(state[1])
329 os.rename(sstateinst + state[0], state[1]) 354 os.rename(sstateinst + state[0], state[1])
330 sstate_install(ss, d) 355 sstate_install(ss, d)
@@ -347,18 +372,18 @@ python sstate_hardcode_path_unpack () {
347 import subprocess 372 import subprocess
348 373
349 sstateinst = d.getVar('SSTATE_INSTDIR') 374 sstateinst = d.getVar('SSTATE_INSTDIR')
350 fixmefn = sstateinst + "fixmepath" 375 sstatefixmedir = d.getVar('SSTATE_FIXMEDIR')
376 fixmefn = sstateinst + "fixmepath"
351 if os.path.isfile(fixmefn): 377 if os.path.isfile(fixmefn):
352 staging = d.getVar('STAGING_DIR') 378 staging_target = d.getVar('RECIPE_SYSROOT')
353 staging_target = d.getVar('STAGING_DIR_TARGET') 379 staging_host = d.getVar('RECIPE_SYSROOT_NATIVE')
354 staging_host = d.getVar('STAGING_DIR_HOST') 380
355 381 if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross-canadian', d):
356 if bb.data.inherits_class('native', d) or bb.data.inherits_class('nativesdk', d) or bb.data.inherits_class('crosssdk', d) or bb.data.inherits_class('cross-canadian', d):
357 sstate_sed_cmd = "sed -i -e 's:FIXMESTAGINGDIR:%s:g'" % (staging)
358 elif bb.data.inherits_class('cross', d):
359 sstate_sed_cmd = "sed -i -e 's:FIXMESTAGINGDIRTARGET:%s:g; s:FIXMESTAGINGDIR:%s:g'" % (staging_target, staging)
360 else:
361 sstate_sed_cmd = "sed -i -e 's:FIXMESTAGINGDIRHOST:%s:g'" % (staging_host) 382 sstate_sed_cmd = "sed -i -e 's:FIXMESTAGINGDIRHOST:%s:g'" % (staging_host)
383 elif bb.data.inherits_class('cross', d) or bb.data.inherits_class('crosssdk', d):
384 sstate_sed_cmd = "sed -i -e 's:FIXMESTAGINGDIRTARGET:%s:g; s:FIXMESTAGINGDIRHOST:%s:g'" % (staging_target, staging_host)
385 else:
386 sstate_sed_cmd = "sed -i -e 's:FIXMESTAGINGDIRTARGET:%s:g'" % (staging_target)
362 387
363 extra_staging_fixmes = d.getVar('EXTRA_STAGING_FIXMES') or '' 388 extra_staging_fixmes = d.getVar('EXTRA_STAGING_FIXMES') or ''
364 for fixmevar in extra_staging_fixmes.split(): 389 for fixmevar in extra_staging_fixmes.split():
@@ -368,6 +393,18 @@ python sstate_hardcode_path_unpack () {
368 # Add sstateinst to each filename in fixmepath, use xargs to efficiently call sed 393 # Add sstateinst to each filename in fixmepath, use xargs to efficiently call sed
369 sstate_hardcode_cmd = "sed -e 's:^:%s:g' %s | xargs %s" % (sstateinst, fixmefn, sstate_sed_cmd) 394 sstate_hardcode_cmd = "sed -e 's:^:%s:g' %s | xargs %s" % (sstateinst, fixmefn, sstate_sed_cmd)
370 395
396 # Defer do_populate_sysroot relocation command
397 if sstatefixmedir:
398 bb.utils.mkdirhier(sstatefixmedir)
399 with open(sstatefixmedir + "/fixmepath.cmd", "w") as f:
400 sstate_hardcode_cmd = sstate_hardcode_cmd.replace(fixmefn, sstatefixmedir + "/fixmepath")
401 sstate_hardcode_cmd = sstate_hardcode_cmd.replace(sstateinst, "FIXMEFINALSSTATEINST")
402 sstate_hardcode_cmd = sstate_hardcode_cmd.replace(staging_host, "FIXMEFINALSSTATEHOST")
403 sstate_hardcode_cmd = sstate_hardcode_cmd.replace(staging_target, "FIXMEFINALSSTATETARGET")
404 f.write(sstate_hardcode_cmd)
405 bb.utils.copyfile(fixmefn, sstatefixmedir + "/fixmepath")
406 return
407
371 bb.note("Replacing fixme paths in sstate package: %s" % (sstate_hardcode_cmd)) 408 bb.note("Replacing fixme paths in sstate package: %s" % (sstate_hardcode_cmd))
372 subprocess.call(sstate_hardcode_cmd, shell=True) 409 subprocess.call(sstate_hardcode_cmd, shell=True)
373 410
@@ -499,20 +536,19 @@ python sstate_hardcode_path () {
499 # Note: the logic in this function needs to match the reverse logic 536 # Note: the logic in this function needs to match the reverse logic
500 # in sstate_installpkg(ss, d) 537 # in sstate_installpkg(ss, d)
501 538
502 staging = d.getVar('STAGING_DIR') 539 staging_target = d.getVar('RECIPE_SYSROOT')
503 staging_target = d.getVar('STAGING_DIR_TARGET') 540 staging_host = d.getVar('RECIPE_SYSROOT_NATIVE')
504 staging_host = d.getVar('STAGING_DIR_HOST')
505 sstate_builddir = d.getVar('SSTATE_BUILDDIR') 541 sstate_builddir = d.getVar('SSTATE_BUILDDIR')
506 542
507 if bb.data.inherits_class('native', d) or bb.data.inherits_class('nativesdk', d) or bb.data.inherits_class('crosssdk', d) or bb.data.inherits_class('cross-canadian', d): 543 if bb.data.inherits_class('native', d) or bb.data.inherits_class('cross-canadian', d):
508 sstate_grep_cmd = "grep -l -e '%s'" % (staging)
509 sstate_sed_cmd = "sed -i -e 's:%s:FIXMESTAGINGDIR:g'" % (staging)
510 elif bb.data.inherits_class('cross', d):
511 sstate_grep_cmd = "grep -l -e '%s' -e '%s'" % (staging_target, staging)
512 sstate_sed_cmd = "sed -i -e 's:%s:FIXMESTAGINGDIRTARGET:g; s:%s:FIXMESTAGINGDIR:g'" % (staging_target, staging)
513 else:
514 sstate_grep_cmd = "grep -l -e '%s'" % (staging_host) 544 sstate_grep_cmd = "grep -l -e '%s'" % (staging_host)
515 sstate_sed_cmd = "sed -i -e 's:%s:FIXMESTAGINGDIRHOST:g'" % (staging_host) 545 sstate_sed_cmd = "sed -i -e 's:%s:FIXMESTAGINGDIRHOST:g'" % (staging_host)
546 elif bb.data.inherits_class('cross', d) or bb.data.inherits_class('crosssdk', d):
547 sstate_grep_cmd = "grep -l -e '%s' -e '%s'" % (staging_target, staging_host)
548 sstate_sed_cmd = "sed -i -e 's:%s:FIXMESTAGINGDIRTARGET:g; s:%s:FIXMESTAGINGDIRHOST:g'" % (staging_target, staging_host)
549 else:
550 sstate_grep_cmd = "grep -l -e '%s'" % (staging_target)
551 sstate_sed_cmd = "sed -i -e 's:%s:FIXMESTAGINGDIRTARGET:g'" % (staging_target)
516 552
517 extra_staging_fixmes = d.getVar('EXTRA_STAGING_FIXMES') or '' 553 extra_staging_fixmes = d.getVar('EXTRA_STAGING_FIXMES') or ''
518 for fixmevar in extra_staging_fixmes.split(): 554 for fixmevar in extra_staging_fixmes.split():
@@ -537,14 +573,14 @@ python sstate_hardcode_path () {
537 sstate_hardcode_cmd = "%s | xargs %s | %s | xargs %s %s" % (sstate_scan_cmd, sstate_grep_cmd, sstate_filelist_cmd, xargs_no_empty_run_cmd, sstate_sed_cmd) 573 sstate_hardcode_cmd = "%s | xargs %s | %s | xargs %s %s" % (sstate_scan_cmd, sstate_grep_cmd, sstate_filelist_cmd, xargs_no_empty_run_cmd, sstate_sed_cmd)
538 574
539 bb.note("Removing hardcoded paths from sstate package: '%s'" % (sstate_hardcode_cmd)) 575 bb.note("Removing hardcoded paths from sstate package: '%s'" % (sstate_hardcode_cmd))
540 subprocess.call(sstate_hardcode_cmd, shell=True) 576 subprocess.check_call(sstate_hardcode_cmd, shell=True, cwd=sstate_builddir)
541 577
542 # If the fixmefn is empty, remove it.. 578 # If the fixmefn is empty, remove it..
543 if os.stat(fixmefn).st_size == 0: 579 if os.stat(fixmefn).st_size == 0:
544 os.remove(fixmefn) 580 os.remove(fixmefn)
545 else: 581 else:
546 bb.note("Replacing absolute paths in fixmepath file: '%s'" % (sstate_filelist_relative_cmd)) 582 bb.note("Replacing absolute paths in fixmepath file: '%s'" % (sstate_filelist_relative_cmd))
547 subprocess.call(sstate_filelist_relative_cmd, shell=True) 583 subprocess.check_call(sstate_filelist_relative_cmd, shell=True)
548} 584}
549 585
550def sstate_package(ss, d): 586def sstate_package(ss, d):
@@ -560,6 +596,8 @@ def sstate_package(ss, d):
560 if not link.startswith(tmpdir): 596 if not link.startswith(tmpdir):
561 return 597 return
562 598
599 #base = os.path.relpath(link, os.path.dirname(path))
600
563 depth = outputpath.rpartition(tmpdir)[2].count('/') 601 depth = outputpath.rpartition(tmpdir)[2].count('/')
564 base = link.partition(tmpdir)[2].strip() 602 base = link.partition(tmpdir)[2].strip()
565 while depth > 1: 603 while depth > 1:
@@ -594,14 +632,14 @@ def sstate_package(ss, d):
594 dstpath = srcpath.replace(state[1], state[2]) 632 dstpath = srcpath.replace(state[1], state[2])
595 make_relative_symlink(srcpath, dstpath, d) 633 make_relative_symlink(srcpath, dstpath, d)
596 bb.debug(2, "Preparing tree %s for packaging at %s" % (state[1], sstatebuild + state[0])) 634 bb.debug(2, "Preparing tree %s for packaging at %s" % (state[1], sstatebuild + state[0]))
597 oe.path.copyhardlinktree(state[1], sstatebuild + state[0]) 635 os.rename(state[1], sstatebuild + state[0])
598 636
599 workdir = d.getVar('WORKDIR') 637 workdir = d.getVar('WORKDIR')
600 for plain in ss['plaindirs']: 638 for plain in ss['plaindirs']:
601 pdir = plain.replace(workdir, sstatebuild) 639 pdir = plain.replace(workdir, sstatebuild)
602 bb.utils.mkdirhier(plain) 640 bb.utils.mkdirhier(plain)
603 bb.utils.mkdirhier(pdir) 641 bb.utils.mkdirhier(pdir)
604 oe.path.copyhardlinktree(plain, pdir) 642 os.rename(plain, pdir)
605 643
606 d.setVar('SSTATE_BUILDDIR', sstatebuild) 644 d.setVar('SSTATE_BUILDDIR', sstatebuild)
607 d.setVar('SSTATE_PKG', sstatepkg) 645 d.setVar('SSTATE_PKG', sstatepkg)
@@ -614,6 +652,8 @@ def sstate_package(ss, d):
614 652
615 bb.siggen.dump_this_task(sstatepkg + ".siginfo", d) 653 bb.siggen.dump_this_task(sstatepkg + ".siginfo", d)
616 654
655 d.setVar('SSTATE_INSTDIR', sstatebuild)
656
617 return 657 return
618 658
619def pstaging_fetch(sstatefetch, sstatepkg, d): 659def pstaging_fetch(sstatefetch, sstatepkg, d):
@@ -672,14 +712,21 @@ sstate_task_prefunc[dirs] = "${WORKDIR}"
672python sstate_task_postfunc () { 712python sstate_task_postfunc () {
673 shared_state = sstate_state_fromvars(d) 713 shared_state = sstate_state_fromvars(d)
674 714
675 sstate_install(shared_state, d)
676 for intercept in shared_state['interceptfuncs']: 715 for intercept in shared_state['interceptfuncs']:
677 bb.build.exec_func(intercept, d, (d.getVar("WORKDIR"),)) 716 bb.build.exec_func(intercept, d, (d.getVar("WORKDIR"),))
717
678 omask = os.umask(0o002) 718 omask = os.umask(0o002)
679 if omask != 0o002: 719 if omask != 0o002:
680 bb.note("Using umask 0o002 (not %0o) for sstate packaging" % omask) 720 bb.note("Using umask 0o002 (not %0o) for sstate packaging" % omask)
681 sstate_package(shared_state, d) 721 sstate_package(shared_state, d)
682 os.umask(omask) 722 os.umask(omask)
723
724 sstateinst = d.getVar("SSTATE_INSTDIR")
725 d.setVar('SSTATE_FIXMEDIR', shared_state['fixmedir'])
726
727 sstate_installpkgdir(shared_state, d)
728
729 bb.utils.remove(d.getVar("SSTATE_BUILDDIR"), recurse=True)
683} 730}
684sstate_task_postfunc[dirs] = "${WORKDIR}" 731sstate_task_postfunc[dirs] = "${WORKDIR}"
685 732
@@ -704,9 +751,6 @@ sstate_create_package () {
704 fi 751 fi
705 chmod 0664 $TFILE 752 chmod 0664 $TFILE
706 mv -f $TFILE ${SSTATE_PKG} 753 mv -f $TFILE ${SSTATE_PKG}
707
708 cd ${WORKDIR}
709 rm -rf ${SSTATE_BUILDDIR}
710} 754}
711 755
712python sstate_sign_package () { 756python sstate_sign_package () {
@@ -877,7 +921,7 @@ def setscene_depvalid(task, taskdependees, notneeded, d):
877 bb.debug(2, "Considering setscene task: %s" % (str(taskdependees[task]))) 921 bb.debug(2, "Considering setscene task: %s" % (str(taskdependees[task])))
878 922
879 def isNativeCross(x): 923 def isNativeCross(x):
880 return x.endswith("-native") or "-cross-" in x or "-crosssdk" in x 924 return x.endswith("-native") or "-cross-" in x or "-crosssdk" in x or x.endswith("-cross")
881 925
882 # We only need to trigger populate_lic through direct dependencies 926 # We only need to trigger populate_lic through direct dependencies
883 if taskdependees[task][1] == "do_populate_lic": 927 if taskdependees[task][1] == "do_populate_lic":
diff --git a/meta/classes/staging.bbclass b/meta/classes/staging.bbclass
index 2512ae6f5d..1a4668e5d3 100644
--- a/meta/classes/staging.bbclass
+++ b/meta/classes/staging.bbclass
@@ -235,12 +235,357 @@ do_populate_sysroot[depends] += "${POPULATESYSROOTDEPS}"
235SSTATETASKS += "do_populate_sysroot" 235SSTATETASKS += "do_populate_sysroot"
236do_populate_sysroot[cleandirs] = "${SYSROOT_DESTDIR}" 236do_populate_sysroot[cleandirs] = "${SYSROOT_DESTDIR}"
237do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}" 237do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}"
238do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_HOST}/" 238do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR}-components/${PACKAGE_ARCH}/${PN}"
239do_populate_sysroot[stamp-extra-info] = "${MACHINE}" 239do_populate_sysroot[sstate-fixmedir] = "${STAGING_DIR}-components/${PACKAGE_ARCH}/${PN}"
240 240
241python do_populate_sysroot_setscene () { 241python do_populate_sysroot_setscene () {
242 sstate_setscene(d) 242 sstate_setscene(d)
243} 243}
244addtask do_populate_sysroot_setscene 244addtask do_populate_sysroot_setscene
245 245
246def staging_copyfile(c, target, fixme, postinsts, stagingdir):
247 import errno
248
249 if c.endswith("/fixmepath"):
250 fixme.append(c)
251 return None
252 if c.endswith("/fixmepath.cmd"):
253 return None
254 #bb.warn(c)
255 dest = c.replace(stagingdir, "")
256 dest = target + "/" + "/".join(dest.split("/")[3:])
257 bb.utils.mkdirhier(os.path.dirname(dest))
258 if "/usr/bin/postinst-" in c:
259 postinsts.append(dest)
260 if os.path.islink(c):
261 linkto = os.readlink(c)
262 if os.path.lexists(dest):
263 if os.readlink(dest) == linkto:
264 return dest
265 bb.fatal("Link %s already exists to a different location?" % dest)
266 os.symlink(linkto, dest)
267 #bb.warn(c)
268 else:
269 try:
270 os.link(c, dest)
271 except OSError as err:
272 if err.errno == errno.EXDEV:
273 bb.utils.copyfile(c, dest)
274 else:
275 raise
276 return dest
277
278def staging_copydir(c, target, stagingdir):
279 dest = c.replace(stagingdir, "")
280 dest = target + "/" + "/".join(dest.split("/")[3:])
281 bb.utils.mkdirhier(dest)
282
283def staging_processfixme(fixme, target, recipesysroot, recipesysrootnative, d):
284 import subprocess
285
286 if not fixme:
287 return
288 cmd = "sed -e 's:^[^/]*/:%s/:g' %s | xargs sed -i -e 's:FIXMESTAGINGDIRTARGET:%s:g; s:FIXMESTAGINGDIRHOST:%s:g'" % (target, " ".join(fixme), recipesysroot, recipesysrootnative)
289 for fixmevar in ['PKGDATA_DIR']:
290 fixme_path = d.getVar(fixmevar)
291 cmd += " -e 's:FIXME_%s:%s:g'" % (fixmevar, fixme_path)
292 bb.note(cmd)
293 subprocess.check_call(cmd, shell=True)
294
295
296def staging_populate_sysroot_dir(targetsysroot, nativesysroot, native, d):
297 import glob
298 import subprocess
299
300 fixme = []
301 postinsts = []
302 stagingdir = d.getVar("STAGING_DIR")
303 if native:
304 pkgarchs = ['${BUILD_ARCH}', '${BUILD_ARCH}_*']
305 targetdir = nativesysroot
306 else:
307 pkgarchs = ['${MACHINE_ARCH}', '${TUNE_PKGARCH}', 'allarch']
308 targetdir = targetsysroot
309
310 bb.utils.mkdirhier(targetdir)
311 for pkgarch in pkgarchs:
312 for manifest in glob.glob(d.expand("${SSTATE_MANIFESTS}/manifest-%s-*.populate_sysroot" % pkgarch)):
313 if manifest.endswith("-initial.populate_sysroot"):
314 # skip glibc-initial and libgcc-initial due to file overlap
315 continue
316 tmanifest = targetdir + "/" + os.path.basename(manifest)
317 if os.path.exists(tmanifest):
318 continue
319 try:
320 os.link(manifest, tmanifest)
321 except OSError as err:
322 if err.errno == errno.EXDEV:
323 bb.utils.copyfile(manifest, tmanifest)
324 else:
325 raise
326 with open(manifest, "r") as f:
327 for l in f:
328 l = l.strip()
329 if l.endswith("/"):
330 staging_copydir(l, targetdir, stagingdir)
331 continue
332 staging_copyfile(l, targetdir, fixme, postinsts, stagingdir)
333
334 staging_processfixme(fixme, targetdir, targetsysroot, nativesysroot, d)
335 for p in postinsts:
336 subprocess.check_call(p, shell=True)
337
338#
339# Manifests here are complicated. The main sysroot area has the unpacked sstate
340# which us unrelocated and tracked by the main sstate manifests. Each recipe
341# specific sysroot has manifests for each dependency that is installed there.
342# The task hash is used to tell whether the data needs to be reinstalled. We
343# use a symlink to point to the currently installed hash. There is also a
344# "complete" stamp file which is used to mark if installation completed. If
345# something fails (e.g. a postinst), this won't get written and we would
346# remove and reinstall the dependency. This also means partially installed
347# dependencies should get cleaned up correctly.
348#
349
350python extend_recipe_sysroot() {
351 import copy
352 import subprocess
353
354 taskdepdata = d.getVar("BB_TASKDEPDATA", False)
355 mytaskname = d.getVar("BB_RUNTASK")
356 #bb.warn(str(taskdepdata))
357 pn = d.getVar("PN")
358
359 if mytaskname.endswith("_setscene"):
360 mytaskname = mytaskname.replace("_setscene", "")
361
362 start = None
363 configuredeps = []
364 for dep in taskdepdata:
365 data = taskdepdata[dep]
366 if data[1] == mytaskname and data[0] == pn:
367 start = dep
368 break
369 if start is None:
370 bb.fatal("Couldn't find ourself in BB_TASKDEPDATA?")
371
372 # We need to figure out which sysroot files we need to expose to this task.
373 # This needs to match what would get restored from sstate, which is controlled
374 # ultimately by calls from bitbake to setscene_depvalid().
375 # That function expects a setscene dependency tree. We build a dependency tree
376 # condensed to inter-sstate task dependencies, similar to that used by setscene
377 # tasks. We can then call into setscene_depvalid() and decide
378 # which dependencies we can "see" and should expose in the recipe specific sysroot.
379 setscenedeps = copy.deepcopy(taskdepdata)
380
381 start = set([start])
382
383 sstatetasks = d.getVar("SSTATETASKS").split()
384
385 def print_dep_tree(deptree):
386 data = ""
387 for dep in deptree:
388 deps = " " + "\n ".join(deptree[dep][3]) + "\n"
389 data = "%s:\n %s\n %s\n%s %s\n %s\n" % (deptree[dep][0], deptree[dep][1], deptree[dep][2], deps, deptree[dep][4], deptree[dep][5])
390 return data
391
392 #bb.note("Full dep tree is:\n%s" % print_dep_tree(taskdepdata))
393
394 #bb.note(" start2 is %s" % str(start))
395
396 # If start is an sstate task (like do_package) we need to add in its direct dependencies
397 # else the code below won't recurse into them.
398 for dep in set(start):
399 for dep2 in setscenedeps[dep][3]:
400 start.add(dep2)
401 start.remove(dep)
402
403 #bb.note(" start3 is %s" % str(start))
404
405 # Create collapsed do_populate_sysroot -> do_populate_sysroot tree
406 for dep in taskdepdata:
407 data = setscenedeps[dep]
408 if data[1] not in sstatetasks:
409 for dep2 in setscenedeps:
410 data2 = setscenedeps[dep2]
411 if dep in data2[3]:
412 data2[3].update(setscenedeps[dep][3])
413 data2[3].remove(dep)
414 if dep in start:
415 start.update(setscenedeps[dep][3])
416 start.remove(dep)
417 del setscenedeps[dep]
418
419 # Remove circular references
420 for dep in setscenedeps:
421 if dep in setscenedeps[dep][3]:
422 setscenedeps[dep][3].remove(dep)
423
424 #bb.note("Computed dep tree is:\n%s" % print_dep_tree(setscenedeps))
425 #bb.note(" start is %s" % str(start))
426
427 # Direct dependencies should be present and can be depended upon
428 for dep in set(start):
429 if setscenedeps[dep][1] == "do_populate_sysroot":
430 if dep not in configuredeps:
431 configuredeps.append(dep)
432 bb.note("Direct dependencies are %s" % str(configuredeps))
433 #bb.note(" or %s" % str(start))
434
435 # Call into setscene_depvalid for each sub-dependency and only copy sysroot files
436 # for ones that would be restored from sstate.
437 done = list(start)
438 next = list(start)
439 while next:
440 new = []
441 for dep in next:
442 data = setscenedeps[dep]
443 for datadep in data[3]:
444 if datadep in done:
445 continue
446 taskdeps = {}
447 taskdeps[dep] = setscenedeps[dep][:2]
448 taskdeps[datadep] = setscenedeps[datadep][:2]
449 retval = setscene_depvalid(datadep, taskdeps, [], d)
450 if retval:
451 bb.note("Skipping setscene dependency %s for installation into the sysroot" % datadep)
452 continue
453 done.append(datadep)
454 new.append(datadep)
455 if datadep not in configuredeps and setscenedeps[datadep][1] == "do_populate_sysroot":
456 configuredeps.append(datadep)
457 bb.note("Adding dependency on %s" % setscenedeps[datadep][0])
458 else:
459 bb.note("Following dependency on %s" % setscenedeps[datadep][0])
460 next = new
461
462 stagingdir = d.getVar("STAGING_DIR")
463 recipesysroot = d.getVar("RECIPE_SYSROOT")
464 recipesysrootnative = d.getVar("RECIPE_SYSROOT_NATIVE")
465 current_variant = d.getVar("BBEXTENDVARIANT")
466
467 # Detect bitbake -b usage
468 nodeps = d.getVar("BB_LIMITEDDEPS") or False
469 if nodeps:
470 lock = bb.utils.lockfile(recipesysroot + "/sysroot.lock")
471 staging_populate_sysroot_dir(recipesysroot, recipesysrootnative, True, d)
472 staging_populate_sysroot_dir(recipesysroot, recipesysrootnative, False, d)
473 bb.utils.unlockfile(lock)
474
475 depdir = recipesysrootnative + "/installeddeps"
476 bb.utils.mkdirhier(depdir)
477
478 lock = bb.utils.lockfile(recipesysroot + "/sysroot.lock")
479
480 fixme = {}
481 fixme[''] = []
482 fixme['native'] = []
483 postinsts = []
484 multilibs = {}
485
486 for dep in configuredeps:
487 c = setscenedeps[dep][0]
488 taskhash = setscenedeps[dep][5]
489 taskmanifest = depdir + "/" + c + "." + taskhash
490 if mytaskname in ["do_sdk_depends", "do_populate_sdk_ext"] and c.endswith("-initial"):
491 bb.note("Skipping initial setscene dependency %s for installation into the sysroot" % c)
492 continue
493 if os.path.exists(depdir + "/" + c):
494 lnk = os.readlink(depdir + "/" + c)
495 if lnk == c + "." + taskhash and os.path.exists(depdir + "/" + c + ".complete"):
496 bb.note("%s exists in sysroot, skipping" % c)
497 continue
498 else:
499 bb.note("%s exists in sysroot, but is stale (%s vs. %s), removing." % (c, lnk, c + "." + taskhash))
500 sstate_clean_manifest(depdir + "/" + lnk, d)
501 os.unlink(depdir + "/" + c)
502 elif os.path.lexists(depdir + "/" + c):
503 os.unlink(depdir + "/" + c)
504
505 os.symlink(c + "." + taskhash, depdir + "/" + c)
506
507 d2 = d
508 destsysroot = recipesysroot
509 variant = ''
510 if setscenedeps[dep][2].startswith("virtual:multilib"):
511 variant = setscenedeps[dep][2].split(":")[2]
512 if variant != current_variant:
513 if variant not in multilibs:
514 multilibs[variant] = get_multilib_datastore(variant, d)
515 d2 = multilibs[variant]
516 destsysroot = d2.getVar("RECIPE_SYSROOT")
517
518 native = False
519 if c.endswith("-native"):
520 manifest = d2.expand("${SSTATE_MANIFESTS}/manifest-${BUILD_ARCH}-%s.populate_sysroot" % c)
521 native = True
522 elif c.startswith("nativesdk-"):
523 manifest = d2.expand("${SSTATE_MANIFESTS}/manifest-${SDK_ARCH}_${SDK_OS}-%s.populate_sysroot" % c)
524 elif "-cross-" in c:
525 manifest = d2.expand("${SSTATE_MANIFESTS}/manifest-${BUILD_ARCH}_${TARGET_ARCH}-%s.populate_sysroot" % c)
526 native = True
527 elif "-crosssdk" in c:
528 manifest = d2.expand("${SSTATE_MANIFESTS}/manifest-${BUILD_ARCH}_${SDK_ARCH}_${SDK_OS}-%s.populate_sysroot" % c)
529 native = True
530 else:
531 manifest = d2.expand("${SSTATE_MANIFESTS}/manifest-${MACHINE_ARCH}-%s.populate_sysroot" % c)
532 if not os.path.exists(manifest):
533 manifest = d2.expand("${SSTATE_MANIFESTS}/manifest-${TUNE_PKGARCH}-%s.populate_sysroot" % c)
534 if not os.path.exists(manifest):
535 manifest = d2.expand("${SSTATE_MANIFESTS}/manifest-allarch-%s.populate_sysroot" % c)
536 if not os.path.exists(manifest):
537 bb.warn("Manifest %s not found?" % manifest)
538 else:
539 with open(manifest, "r") as f, open(taskmanifest, 'w') as m:
540 for l in f:
541 l = l.strip()
542 if l.endswith("/"):
543 if native:
544 dest = staging_copydir(l, recipesysrootnative, stagingdir)
545 else:
546 dest = staging_copydir(l, destsysroot, stagingdir)
547 continue
548 if native:
549 dest = staging_copyfile(l, recipesysrootnative, fixme['native'], postinsts, stagingdir)
550 else:
551 dest = staging_copyfile(l, destsysroot, fixme[''], postinsts, stagingdir)
552 if dest:
553 m.write(dest + "\n")
554
555 for f in fixme:
556 if f == '':
557 staging_processfixme(fixme[f], recipesysroot, recipesysroot, recipesysrootnative, d)
558 elif f == 'native':
559 staging_processfixme(fixme[f], recipesysrootnative, recipesysroot, recipesysrootnative, d)
560 else:
561 staging_processfixme(fixme[f], multilibs[f].getVar("RECIPE_SYSROOT"), recipesysroot, recipesysrootnative, d)
562
563 for p in postinsts:
564 subprocess.check_call(p, shell=True)
565
566 for dep in configuredeps:
567 c = setscenedeps[dep][0]
568 open(depdir + "/" + c + ".complete", "w").close()
569
570 bb.utils.unlockfile(lock)
571}
572extend_recipe_sysroot[vardepsexclude] += "MACHINE SDK_ARCH BUILD_ARCH SDK_OS BB_TASKDEPDATA"
573
574python do_prepare_recipe_sysroot () {
575 bb.build.exec_func("extend_recipe_sysroot", d)
576}
577addtask do_prepare_recipe_sysroot before do_configure after do_fetch
578
579# Clean out the recipe specific sysroots before do_fetch
580do_fetch[cleandirs] += "${RECIPE_SYSROOT} ${RECIPE_SYSROOT_NATIVE}"
581
582python staging_taskhandler() {
583 bbtasks = e.tasklist
584 for task in bbtasks:
585 deps = d.getVarFlag(task, "depends")
586 if deps and "populate_sysroot" in deps:
587 d.appendVarFlag(task, "prefuncs", " extend_recipe_sysroot")
588}
589staging_taskhandler[eventmask] = "bb.event.RecipeTaskPreProcess"
590addhandler staging_taskhandler
246 591
diff --git a/meta/classes/toolchain-scripts.bbclass b/meta/classes/toolchain-scripts.bbclass
index 44b4e24255..7b68d20a15 100644
--- a/meta/classes/toolchain-scripts.bbclass
+++ b/meta/classes/toolchain-scripts.bbclass
@@ -108,6 +108,7 @@ EOF
108TOOLCHAIN_CONFIGSITE_NOCACHE = "${@siteinfo_get_files(d)}" 108TOOLCHAIN_CONFIGSITE_NOCACHE = "${@siteinfo_get_files(d)}"
109TOOLCHAIN_CONFIGSITE_SYSROOTCACHE = "${STAGING_DIR}/${MLPREFIX}${MACHINE}/${target_datadir}/${TARGET_SYS}_config_site.d" 109TOOLCHAIN_CONFIGSITE_SYSROOTCACHE = "${STAGING_DIR}/${MLPREFIX}${MACHINE}/${target_datadir}/${TARGET_SYS}_config_site.d"
110TOOLCHAIN_NEED_CONFIGSITE_CACHE ??= "virtual/${MLPREFIX}libc ncurses" 110TOOLCHAIN_NEED_CONFIGSITE_CACHE ??= "virtual/${MLPREFIX}libc ncurses"
111DEPENDS += "${TOOLCHAIN_NEED_CONFIGSITE_CACHE}"
111 112
112#This function create a site config file 113#This function create a site config file
113toolchain_create_sdk_siteconfig () { 114toolchain_create_sdk_siteconfig () {
diff --git a/meta/classes/uninative.bbclass b/meta/classes/uninative.bbclass
index 54f63afad1..ba7ca63b8f 100644
--- a/meta/classes/uninative.bbclass
+++ b/meta/classes/uninative.bbclass
@@ -91,7 +91,8 @@ def enable_uninative(d):
91 bb.debug(2, "Enabling uninative") 91 bb.debug(2, "Enabling uninative")
92 d.setVar("NATIVELSBSTRING", "universal%s" % oe.utils.host_gcc_version(d)) 92 d.setVar("NATIVELSBSTRING", "universal%s" % oe.utils.host_gcc_version(d))
93 d.appendVar("SSTATEPOSTUNPACKFUNCS", " uninative_changeinterp") 93 d.appendVar("SSTATEPOSTUNPACKFUNCS", " uninative_changeinterp")
94 d.prependVar("PATH", "${UNINATIVE_STAGING_DIR}-uninative/${BUILD_ARCH}-linux${bindir_native}:") 94 d.setVarFlag("SSTATEPOSTUNPACKFUNCS", "vardepvalueexclude", " uninative_changeinterp")
95 d.prependVar("PATH", "${STAGING_DIR}-uninative/${BUILD_ARCH}-linux${bindir_native}:")
95 96
96python uninative_changeinterp () { 97python uninative_changeinterp () {
97 import subprocess 98 import subprocess
diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass
index 82f4d52758..326c04d0b1 100644
--- a/meta/classes/useradd.bbclass
+++ b/meta/classes/useradd.bbclass
@@ -3,7 +3,7 @@ inherit useradd_base
3# base-passwd-cross provides the default passwd and group files in the 3# base-passwd-cross provides the default passwd and group files in the
4# target sysroot, and shadow -native and -sysroot provide the utilities 4# target sysroot, and shadow -native and -sysroot provide the utilities
5# and support files needed to add and modify user and group accounts 5# and support files needed to add and modify user and group accounts
6DEPENDS_append_class-target = " base-files shadow-native shadow-sysroot shadow" 6DEPENDS_append_class-target = " base-files shadow-native shadow-sysroot shadow base-passwd"
7PACKAGE_WRITE_DEPS += "shadow-native" 7PACKAGE_WRITE_DEPS += "shadow-native"
8 8
9# This preinstall function can be run in four different contexts: 9# This preinstall function can be run in four different contexts:
@@ -97,13 +97,13 @@ fi
97} 97}
98 98
99useradd_sysroot () { 99useradd_sysroot () {
100 # Pseudo may (do_install) or may not (do_populate_sysroot_setscene) be running 100 # Pseudo may (do_prepare_recipe_sysroot) or may not (do_populate_sysroot_setscene) be running
101 # at this point so we're explicit about the environment so pseudo can load if 101 # at this point so we're explicit about the environment so pseudo can load if
102 # not already present. 102 # not already present.
103 export PSEUDO="${FAKEROOTENV} PSEUDO_LOCALSTATEDIR=${STAGING_DIR_TARGET}${localstatedir}/pseudo ${STAGING_DIR_NATIVE}${bindir_native}/pseudo" 103 export PSEUDO="${FAKEROOTENV} PSEUDO_LOCALSTATEDIR=${STAGING_DIR_TARGET}${localstatedir}/pseudo ${PSEUDO_SYSROOT}${bindir_native}/pseudo"
104 104
105 # Explicitly set $D since it isn't set to anything 105 # Explicitly set $D since it isn't set to anything
106 # before do_install 106 # before do_prepare_recipe_sysroot
107 D=${STAGING_DIR_TARGET} 107 D=${STAGING_DIR_TARGET}
108 108
109 # Add groups and users defined for all recipe packages 109 # Add groups and users defined for all recipe packages
@@ -117,17 +117,25 @@ useradd_sysroot () {
117 useradd_preinst 117 useradd_preinst
118} 118}
119 119
120useradd_sysroot_sstate () { 120python useradd_sysroot_sstate () {
121 if [ "${BB_CURRENTTASK}" = "package_setscene" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ] 121 task = d.getVar("BB_CURRENTTASK")
122 then 122 if task == "package_setscene":
123 useradd_sysroot 123 bb.build.exec_func("useradd_sysroot", d)
124 fi 124 elif task == "prepare_recipe_sysroot":
125 scriptfile = d.expand("${RECIPE_SYSROOT}${bindir}/postinst-useradd-${PN}")
126 bb.utils.mkdirhier(os.path.dirname(scriptfile))
127 with open(scriptfile, 'w') as script:
128 script.write("#!/bin/sh\n")
129 bb.data.emit_func("useradd_sysroot", script, d)
130 script.write("useradd_sysroot\n")
131 os.chmod(scriptfile, 0o755)
132 bb.build.exec_func("useradd_sysroot", d)
125} 133}
126 134
127userdel_sysroot_sstate () { 135userdel_sysroot_sstate () {
128if test "x${STAGING_DIR_TARGET}" != "x"; then 136if test "x${STAGING_DIR_TARGET}" != "x"; then
129 if [ "${BB_CURRENTTASK}" = "clean" ]; then 137 if [ "${BB_CURRENTTASK}" = "clean" ]; then
130 export PSEUDO="${FAKEROOTENV} PSEUDO_LOCALSTATEDIR=${STAGING_DIR_TARGET}${localstatedir}/pseudo ${STAGING_DIR_NATIVE}${bindir_native}/pseudo" 138 export PSEUDO="${FAKEROOTENV} PSEUDO_LOCALSTATEDIR=${STAGING_DIR_TARGET}${localstatedir}/pseudo ${PSEUDO_SYSROOT}${bindir_native}/pseudo"
131 OPT="--root ${STAGING_DIR_TARGET}" 139 OPT="--root ${STAGING_DIR_TARGET}"
132 140
133 # Remove groups and users defined for package 141 # Remove groups and users defined for package
@@ -154,10 +162,10 @@ if test "x${STAGING_DIR_TARGET}" != "x"; then
154fi 162fi
155} 163}
156 164
157SSTATECLEANFUNCS_append_class-target = " userdel_sysroot_sstate" 165#SSTATECLEANFUNCS_append_class-target = " userdel_sysroot_sstate"
158 166
159do_install[prefuncs] += "${SYSROOTFUNC}" 167do_prepare_recipe_sysroot[postfuncs] += "${SYSROOTFUNC}"
160SYSROOTFUNC_class-target = "useradd_sysroot" 168SYSROOTFUNC_class-target = "useradd_sysroot_sstate"
161SYSROOTFUNC = "" 169SYSROOTFUNC = ""
162 170
163SSTATEPREINSTFUNCS_append_class-target = " useradd_sysroot_sstate" 171SSTATEPREINSTFUNCS_append_class-target = " useradd_sysroot_sstate"
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index c8516a800d..ee8bd8b06b 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -352,8 +352,10 @@ S = "${WORKDIR}/${BP}"
352B = "${S}" 352B = "${S}"
353 353
354STAGING_DIR = "${TMPDIR}/sysroots" 354STAGING_DIR = "${TMPDIR}/sysroots"
355RECIPE_SYSROOT = "${WORKDIR}/recipe-sysroot"
356RECIPE_SYSROOT_NATIVE = "${WORKDIR}/recipe-sysroot-native"
355 357
356STAGING_DIR_NATIVE = "${STAGING_DIR}/${BUILD_SYS}" 358STAGING_DIR_NATIVE = "${RECIPE_SYSROOT_NATIVE}"
357STAGING_BINDIR_NATIVE = "${STAGING_DIR_NATIVE}${bindir_native}" 359STAGING_BINDIR_NATIVE = "${STAGING_DIR_NATIVE}${bindir_native}"
358STAGING_BINDIR_CROSS = "${STAGING_BINDIR}/crossscripts" 360STAGING_BINDIR_CROSS = "${STAGING_BINDIR}/crossscripts"
359STAGING_BINDIR_TOOLCHAIN = "${STAGING_DIR_NATIVE}${bindir_native}/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}" 361STAGING_BINDIR_TOOLCHAIN = "${STAGING_DIR_NATIVE}${bindir_native}/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}"
@@ -365,7 +367,7 @@ STAGING_INCDIR_NATIVE = "${STAGING_DIR_NATIVE}${includedir_native}"
365STAGING_ETCDIR_NATIVE = "${STAGING_DIR_NATIVE}${sysconfdir_native}" 367STAGING_ETCDIR_NATIVE = "${STAGING_DIR_NATIVE}${sysconfdir_native}"
366STAGING_DATADIR_NATIVE = "${STAGING_DIR_NATIVE}${datadir_native}" 368STAGING_DATADIR_NATIVE = "${STAGING_DIR_NATIVE}${datadir_native}"
367 369
368STAGING_DIR_HOST = "${STAGING_DIR}/${MACHINE}" 370STAGING_DIR_HOST = "${RECIPE_SYSROOT}"
369STAGING_BINDIR = "${STAGING_DIR_HOST}${bindir}" 371STAGING_BINDIR = "${STAGING_DIR_HOST}${bindir}"
370STAGING_LIBDIR = "${STAGING_DIR_HOST}${libdir}" 372STAGING_LIBDIR = "${STAGING_DIR_HOST}${libdir}"
371STAGING_LIBEXECDIR = "${STAGING_DIR_HOST}${libexecdir}" 373STAGING_LIBEXECDIR = "${STAGING_DIR_HOST}${libexecdir}"
@@ -376,8 +378,7 @@ STAGING_EXECPREFIXDIR = "${STAGING_DIR_HOST}${exec_prefix}"
376STAGING_LOADER_DIR = "${STAGING_DIR_HOST}/loader" 378STAGING_LOADER_DIR = "${STAGING_DIR_HOST}/loader"
377STAGING_FIRMWARE_DIR = "${STAGING_DIR_HOST}/firmware" 379STAGING_FIRMWARE_DIR = "${STAGING_DIR_HOST}/firmware"
378 380
379STAGING_DIR_TARGET = "${STAGING_DIR}/${MACHINE}" 381STAGING_DIR_TARGET = "${RECIPE_SYSROOT}"
380STAGING_DIR_TCBOOTSTRAP = "${STAGING_DIR_TARGET}-tcbootstrap"
381 382
382# Setting DEPLOY_DIR outside of TMPDIR is helpful, when you are using 383# Setting DEPLOY_DIR outside of TMPDIR is helpful, when you are using
383# packaged staging and/or multimachine. 384# packaged staging and/or multimachine.
@@ -389,7 +390,7 @@ DEPLOY_DIR_DEB = "${DEPLOY_DIR}/deb"
389DEPLOY_DIR_IMAGE ?= "${DEPLOY_DIR}/images/${MACHINE}" 390DEPLOY_DIR_IMAGE ?= "${DEPLOY_DIR}/images/${MACHINE}"
390DEPLOY_DIR_TOOLS = "${DEPLOY_DIR}/tools" 391DEPLOY_DIR_TOOLS = "${DEPLOY_DIR}/tools"
391 392
392PKGDATA_DIR = "${STAGING_DIR_HOST}/pkgdata" 393PKGDATA_DIR = "${TMPDIR}/pkgdata/${MACHINE}"
393 394
394################################################################## 395##################################################################
395# SDK variables. 396# SDK variables.
@@ -630,14 +631,15 @@ SRC_URI = ""
630 631
631# Use pseudo as the fakeroot implementation 632# Use pseudo as the fakeroot implementation
632PSEUDO_LOCALSTATEDIR ?= "${WORKDIR}/pseudo/" 633PSEUDO_LOCALSTATEDIR ?= "${WORKDIR}/pseudo/"
633PSEUDO_PASSWD ?= "${STAGING_DIR_TARGET}:${STAGING_DIR_NATIVE}" 634PSEUDO_PASSWD ?= "${STAGING_DIR_TARGET}:${PSEUDO_SYSROOT}"
635PSEUDO_SYSROOT = "${STAGING_DIR}-components/${BUILD_ARCH}/pseudo-native"
634export PSEUDO_DISABLED = "1" 636export PSEUDO_DISABLED = "1"
635#export PSEUDO_PREFIX = "${STAGING_DIR_NATIVE}${prefix_native}" 637#export PSEUDO_PREFIX = "${STAGING_DIR_NATIVE}${prefix_native}"
636#export PSEUDO_BINDIR = "${STAGING_DIR_NATIVE}${bindir_native}" 638#export PSEUDO_BINDIR = "${STAGING_DIR_NATIVE}${bindir_native}"
637#export PSEUDO_LIBDIR = "${STAGING_DIR_NATIVE}$PSEUDOBINDIR/../lib/pseudo/lib 639#export PSEUDO_LIBDIR = "${STAGING_DIR_NATIVE}$PSEUDOBINDIR/../lib/pseudo/lib
638FAKEROOTBASEENV = "PSEUDO_BINDIR=${STAGING_BINDIR_NATIVE} PSEUDO_LIBDIR=${STAGING_BINDIR_NATIVE}/../lib/pseudo/lib PSEUDO_PREFIX=${STAGING_BINDIR_NATIVE}/../../ PSEUDO_DISABLED=1" 640FAKEROOTBASEENV = "PSEUDO_BINDIR=${PSEUDO_SYSROOT}${bindir_native} PSEUDO_LIBDIR=${PSEUDO_SYSROOT}${prefix_native}/lib/pseudo/lib PSEUDO_PREFIX=${PSEUDO_SYSROOT}${prefix_native} PSEUDO_DISABLED=1"
639FAKEROOTCMD = "${STAGING_BINDIR_NATIVE}/pseudo" 641FAKEROOTCMD = "${PSEUDO_SYSROOT}${bindir_native}/pseudo"
640FAKEROOTENV = "PSEUDO_PREFIX=${STAGING_DIR_NATIVE}${prefix_native} PSEUDO_LOCALSTATEDIR=${PSEUDO_LOCALSTATEDIR} PSEUDO_PASSWD=${PSEUDO_PASSWD} PSEUDO_NOSYMLINKEXP=1 PSEUDO_DISABLED=0" 642FAKEROOTENV = "PSEUDO_PREFIX=${PSEUDO_SYSROOT}${prefix_native} PSEUDO_LOCALSTATEDIR=${PSEUDO_LOCALSTATEDIR} PSEUDO_PASSWD=${PSEUDO_PASSWD} PSEUDO_NOSYMLINKEXP=1 PSEUDO_DISABLED=0"
641FAKEROOTNOENV = "PSEUDO_UNLOAD=1" 643FAKEROOTNOENV = "PSEUDO_UNLOAD=1"
642FAKEROOTDIRS = "${PSEUDO_LOCALSTATEDIR}" 644FAKEROOTDIRS = "${PSEUDO_LOCALSTATEDIR}"
643PREFERRED_PROVIDER_virtual/fakeroot-native ?= "pseudo-native" 645PREFERRED_PROVIDER_virtual/fakeroot-native ?= "pseudo-native"
@@ -811,7 +813,7 @@ BB_HASHBASE_WHITELIST ?= "TMPDIR FILE PATH PWD BB_TASKHASH BBPATH BBSERVER DL_DI
811 PRSERV_DUMPDIR PRSERV_DUMPFILE PRSERV_LOCKDOWN PARALLEL_MAKE \ 813 PRSERV_DUMPDIR PRSERV_DUMPFILE PRSERV_LOCKDOWN PARALLEL_MAKE \
812 CCACHE_DIR EXTERNAL_TOOLCHAIN CCACHE CCACHE_DISABLE LICENSE_PATH SDKPKGSUFFIX \ 814 CCACHE_DIR EXTERNAL_TOOLCHAIN CCACHE CCACHE_DISABLE LICENSE_PATH SDKPKGSUFFIX \
813 WARN_QA ERROR_QA WORKDIR STAMPCLEAN PKGDATA_DIR BUILD_ARCH SSTATE_PKGARCH \ 815 WARN_QA ERROR_QA WORKDIR STAMPCLEAN PKGDATA_DIR BUILD_ARCH SSTATE_PKGARCH \
814 BB_WORKERCONTEXT" 816 BB_WORKERCONTEXT BB_LIMITEDDEPS"
815BB_HASHCONFIG_WHITELIST ?= "${BB_HASHBASE_WHITELIST} DATE TIME SSH_AGENT_PID \ 817BB_HASHCONFIG_WHITELIST ?= "${BB_HASHBASE_WHITELIST} DATE TIME SSH_AGENT_PID \
816 SSH_AUTH_SOCK PSEUDO_BUILD BB_ENV_EXTRAWHITE DISABLE_SANITY_CHECKS \ 818 SSH_AUTH_SOCK PSEUDO_BUILD BB_ENV_EXTRAWHITE DISABLE_SANITY_CHECKS \
817 PARALLEL_MAKE BB_NUMBER_THREADS BB_ORIGENV BB_INVALIDCONF BBINCLUDED \ 819 PARALLEL_MAKE BB_NUMBER_THREADS BB_ORIGENV BB_INVALIDCONF BBINCLUDED \
diff --git a/meta/conf/multilib.conf b/meta/conf/multilib.conf
index 4dc0543507..e74dec81a8 100644
--- a/meta/conf/multilib.conf
+++ b/meta/conf/multilib.conf
@@ -6,9 +6,9 @@ MULTILIB_SAVE_VARNAME = "DEFAULTTUNE TARGET_ARCH TARGET_SYS TARGET_VENDOR"
6 6
7MULTILIBS ??= "multilib:lib32" 7MULTILIBS ??= "multilib:lib32"
8 8
9STAGING_DIR_HOST = "${STAGING_DIR}/${MLPREFIX}${MACHINE}" 9STAGING_DIR_HOST = "${WORKDIR}/${MLPREFIX}recipe-sysroot"
10STAGING_DIR_TARGET = "${STAGING_DIR}/${MLPREFIX}${MACHINE}" 10STAGING_DIR_TARGET = "${WORKDIR}/${MLPREFIX}recipe-sysroot"
11PKGDATA_DIR = "${STAGING_DIR}/${MACHINE}/pkgdata" 11RECIPE_SYSROOT = "${WORKDIR}/${MLPREFIX}recipe-sysroot"
12 12
13INHERIT += "multilib_global" 13INHERIT += "multilib_global"
14 14
@@ -23,6 +23,6 @@ OPKG_ARGS_append = " --force-maintainer --force-overwrite"
23# find an allarch pkgconfig file will fail as the PKG_CONFIG_PATH only looks 23# find an allarch pkgconfig file will fail as the PKG_CONFIG_PATH only looks
24# inside the multilib sysroot. Fix this by explicitly adding the MACHINE's 24# inside the multilib sysroot. Fix this by explicitly adding the MACHINE's
25# architecture-independent pkgconfig location to PKG_CONFIG_PATH. 25# architecture-independent pkgconfig location to PKG_CONFIG_PATH.
26PKG_CONFIG_PATH .= ":${STAGING_DIR}/${MACHINE}${datadir}/pkgconfig" 26PKG_CONFIG_PATH .= ":${WORKDIR}/recipe-sysroot/${datadir}/pkgconfig"
27PKG_CONFIG_PATH[vardepsexclude] = "MACHINE datadir STAGING_DIR" 27PKG_CONFIG_PATH[vardepsexclude] = "datadir WORKDIR"
28PKG_CONFIG_PATH[vardepvalueexclude] = ":${STAGING_DIR}/${MACHINE}${datadir}/pkgconfig" 28PKG_CONFIG_PATH[vardepvalueexclude] = ":${WORKDIR}/recipe-sysroot/${datadir}/pkgconfig"
diff --git a/meta/files/ext-sdk-prepare.py b/meta/files/ext-sdk-prepare.py
index 78c1d16304..ef096394bb 100644
--- a/meta/files/ext-sdk-prepare.py
+++ b/meta/files/ext-sdk-prepare.py
@@ -53,6 +53,8 @@ def main():
53 logf.write('Preparing SDK for %s...\n' % ', '.join(sdk_targets)) 53 logf.write('Preparing SDK for %s...\n' % ', '.join(sdk_targets))
54 54
55 ret = run_command_interruptible('BB_SETSCENE_ENFORCE=1 bitbake --quiet %s' % ' '.join(sdk_targets)) 55 ret = run_command_interruptible('BB_SETSCENE_ENFORCE=1 bitbake --quiet %s' % ' '.join(sdk_targets))
56 if not ret:
57 ret = run_command_interruptible('bitbake build-sysroots')
56 lastlog = get_last_consolelog() 58 lastlog = get_last_consolelog()
57 if lastlog: 59 if lastlog:
58 with open(lastlog, 'r') as f: 60 with open(lastlog, 'r') as f:
diff --git a/meta/lib/oeqa/selftest/buildoptions.py b/meta/lib/oeqa/selftest/buildoptions.py
index 95fd2f01ec..d40eb007de 100644
--- a/meta/lib/oeqa/selftest/buildoptions.py
+++ b/meta/lib/oeqa/selftest/buildoptions.py
@@ -33,7 +33,8 @@ class ImageOptionsTests(oeSelfTest):
33 @testcase(286) 33 @testcase(286)
34 def test_ccache_tool(self): 34 def test_ccache_tool(self):
35 bitbake("ccache-native") 35 bitbake("ccache-native")
36 self.assertTrue(os.path.isfile(os.path.join(get_bb_var('STAGING_BINDIR_NATIVE', 'ccache-native'), "ccache")), msg = "No ccache found under %s" % str(get_bb_var('STAGING_BINDIR_NATIVE', 'ccache-native'))) 36 p = get_bb_var('SYSROOT_DESTDIR', 'ccache-native') + get_bb_var('bindir', 'ccache-native') + "/" + "ccache"
37 self.assertTrue(os.path.isfile(p), msg = "No ccache found (%s)" % p)
37 self.write_config('INHERIT += "ccache"') 38 self.write_config('INHERIT += "ccache"')
38 bitbake("m4 -c cleansstate") 39 bitbake("m4 -c cleansstate")
39 bitbake("m4 -c compile") 40 bitbake("m4 -c compile")
diff --git a/meta/lib/oeqa/selftest/layerappend.py b/meta/lib/oeqa/selftest/layerappend.py
index 4de5034a94..37bb32cd1d 100644
--- a/meta/lib/oeqa/selftest/layerappend.py
+++ b/meta/lib/oeqa/selftest/layerappend.py
@@ -55,7 +55,7 @@ SRC_URI_append += "file://appendtest.txt"
55 @testcase(1196) 55 @testcase(1196)
56 def test_layer_appends(self): 56 def test_layer_appends(self):
57 corebase = get_bb_var("COREBASE") 57 corebase = get_bb_var("COREBASE")
58 stagingdir = get_bb_var("STAGING_DIR_TARGET") 58
59 for l in ["0", "1", "2"]: 59 for l in ["0", "1", "2"]:
60 layer = os.path.join(corebase, "meta-layertest" + l) 60 layer = os.path.join(corebase, "meta-layertest" + l)
61 self.assertFalse(os.path.exists(layer)) 61 self.assertFalse(os.path.exists(layer))
@@ -83,6 +83,7 @@ SRC_URI_append += "file://appendtest.txt"
83 83
84 self.layerappend = "BBLAYERS += \"{0}/meta-layertest0 {0}/meta-layertest1 {0}/meta-layertest2\"".format(corebase) 84 self.layerappend = "BBLAYERS += \"{0}/meta-layertest0 {0}/meta-layertest1 {0}/meta-layertest2\"".format(corebase)
85 ftools.append_file(self.builddir + "/conf/bblayers.conf", self.layerappend) 85 ftools.append_file(self.builddir + "/conf/bblayers.conf", self.layerappend)
86 stagingdir = get_bb_var("SYSROOT_DESTDIR", "layerappendtest")
86 bitbake("layerappendtest") 87 bitbake("layerappendtest")
87 data = ftools.read_file(stagingdir + "/appendtest.txt") 88 data = ftools.read_file(stagingdir + "/appendtest.txt")
88 self.assertEqual(data, "Layer 2 test") 89 self.assertEqual(data, "Layer 2 test")
diff --git a/meta/lib/oeqa/selftest/liboe.py b/meta/lib/oeqa/selftest/liboe.py
index 35131eb240..cd12cd25b3 100644
--- a/meta/lib/oeqa/selftest/liboe.py
+++ b/meta/lib/oeqa/selftest/liboe.py
@@ -50,7 +50,10 @@ class LibOE(oeSelfTest):
50 50
51 # ensure we have setfattr available 51 # ensure we have setfattr available
52 bitbake("attr-native") 52 bitbake("attr-native")
53 bindir = get_bb_var('STAGING_BINDIR_NATIVE') 53
54 destdir = get_bb_var('SYSROOT_DESTDIR', 'attr-native')
55 bindir = get_bb_var('bindir', 'attr-native')
56 bindir = destdir + bindir
54 57
55 # create a file with xattr and copy it 58 # create a file with xattr and copy it
56 open(oe.path.join(src, testfilename), 'w+b').close() 59 open(oe.path.join(src, testfilename), 'w+b').close()
diff --git a/meta/lib/oeqa/selftest/signing.py b/meta/lib/oeqa/selftest/signing.py
index 4c12d6d940..70e8369876 100644
--- a/meta/lib/oeqa/selftest/signing.py
+++ b/meta/lib/oeqa/selftest/signing.py
@@ -66,7 +66,7 @@ class Signing(oeSelfTest):
66 pf = pkgdata['PN'] + "-" + pkgdata['PKGV'] + '-' + pkgdata['PKGR'] 66 pf = pkgdata['PN'] + "-" + pkgdata['PKGV'] + '-' + pkgdata['PKGR']
67 deploy_dir_rpm = get_bb_var('DEPLOY_DIR_RPM', test_recipe) 67 deploy_dir_rpm = get_bb_var('DEPLOY_DIR_RPM', test_recipe)
68 package_arch = get_bb_var('PACKAGE_ARCH', test_recipe).replace('-', '_') 68 package_arch = get_bb_var('PACKAGE_ARCH', test_recipe).replace('-', '_')
69 staging_bindir_native = get_bb_var('STAGING_BINDIR_NATIVE') 69 staging_bindir_native = get_bb_var('STAGING_BINDIR_NATIVE', test_recipe)
70 70
71 pkg_deploy = os.path.join(deploy_dir_rpm, package_arch, '.'.join((pf, package_arch, 'rpm'))) 71 pkg_deploy = os.path.join(deploy_dir_rpm, package_arch, '.'.join((pf, package_arch, 'rpm')))
72 72
diff --git a/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb b/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb
index 10457b2dec..e43bc0a007 100644
--- a/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb
+++ b/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb
@@ -23,8 +23,6 @@ UPSTREAM_CHECK_URI = "${DEBIAN_MIRROR}/main/b/base-passwd/"
23 23
24inherit autotools 24inherit autotools
25 25
26SSTATEPOSTINSTFUNCS += "base_passwd_sstate_postinst"
27
28do_install () { 26do_install () {
29 install -d -m 755 ${D}${sbindir} 27 install -d -m 755 ${D}${sbindir}
30 install -o root -g root -p -m 755 ${B}/update-passwd ${D}${sbindir}/ 28 install -o root -g root -p -m 755 ${B}/update-passwd ${D}${sbindir}/
@@ -45,23 +43,16 @@ do_install () {
45 install -p -m 644 ${S}/debian/copyright ${D}${docdir}/${BPN}/ 43 install -p -m 644 ${S}/debian/copyright ${D}${docdir}/${BPN}/
46} 44}
47 45
48base_passwd_sstate_postinst() { 46SYSROOT_DIRS += "${sysconfdir}"
49 if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ] 47SYSROOT_PREPROCESS_FUNCS += "base_passwd_tweaksysroot"
50 then 48
51 # Staging does not copy ${sysconfdir} files into the 49base_passwd_tweaksysroot () {
52 # target sysroot, so we need to do so manually. We 50 # Install passwd.master and group.master to sysconfdir
53 # put these files in the target sysroot so they can 51 install -d -m 755 ${SYSROOT_DESTDIR}${sysconfdir}
54 # be used by recipes which use custom user/group 52 for i in passwd group; do
55 # permissions. 53 install -p -m 644 ${SYSROOT_DESTDIR}${datadir}/base-passwd/$i.master \
56 # Install passwd.master and group.master to sysconfdir and mv 54 ${SYSROOT_DESTDIR}${sysconfdir}/$i
57 # them to make sure they are atomically install. 55 done
58 install -d -m 755 ${STAGING_DIR_TARGET}${sysconfdir}
59 for i in passwd group; do
60 install -p -m 644 ${STAGING_DIR_TARGET}${datadir}/base-passwd/$i.master \
61 ${STAGING_DIR_TARGET}${sysconfdir}/
62 mv ${STAGING_DIR_TARGET}${sysconfdir}/$i.master ${STAGING_DIR_TARGET}${sysconfdir}/$i
63 done
64 fi
65} 56}
66 57
67python populate_packages_prepend() { 58python populate_packages_prepend() {
diff --git a/meta/recipes-core/glibc/glibc-initial.inc b/meta/recipes-core/glibc/glibc-initial.inc
index 2e3bc8104a..7380bdbcac 100644
--- a/meta/recipes-core/glibc/glibc-initial.inc
+++ b/meta/recipes-core/glibc/glibc-initial.inc
@@ -6,7 +6,6 @@ PACKAGES_DYNAMIC = ""
6 6
7STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}" 7STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"
8STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}" 8STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}"
9TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
10 9
11do_configure () { 10do_configure () {
12 (cd ${S} && gnu-configize) || die "failure in running gnu-configize" 11 (cd ${S} && gnu-configize) || die "failure in running gnu-configize"
@@ -42,10 +41,6 @@ do_install () {
42 if [ -e ${B}/bits/stdio_lim.h ]; then 41 if [ -e ${B}/bits/stdio_lim.h ]; then
43 cp ${B}/bits/stdio_lim.h ${D}${includedir}/bits/ 42 cp ${B}/bits/stdio_lim.h ${D}${includedir}/bits/
44 fi 43 fi
45 # add links to linux-libc-headers: final glibc build need this.
46 for t in linux asm asm-generic; do
47 ln -s ${STAGING_DIR_TARGET}${includedir}/$t ${D}${includedir}/
48 done
49} 44}
50 45
51do_install_locale() { 46do_install_locale() {
@@ -56,20 +51,6 @@ do_siteconfig () {
56 : 51 :
57} 52}
58 53
59SSTATEPOSTINSTFUNCS += "glibcinitial_sstate_postinst"
60glibcinitial_sstate_postinst() {
61 if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]
62 then
63 # Recreate the symlinks to ensure they point to the correct location
64 for t in linux asm asm-generic; do
65 rm -f ${STAGING_DIR_TCBOOTSTRAP}${includedir}/$t
66 ln -s ${STAGING_DIR_TARGET}${includedir}/$t ${STAGING_DIR_TCBOOTSTRAP}${includedir}/
67 done
68 fi
69}
70
71do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_TCBOOTSTRAP}/"
72
73# We don't install any scripts so there is nothing to evacuate 54# We don't install any scripts so there is nothing to evacuate
74do_evacuate_scripts () { 55do_evacuate_scripts () {
75 : 56 :
diff --git a/meta/recipes-core/glibc/glibc.inc b/meta/recipes-core/glibc/glibc.inc
index 823e60e771..21bbdc2ad0 100644
--- a/meta/recipes-core/glibc/glibc.inc
+++ b/meta/recipes-core/glibc/glibc.inc
@@ -6,8 +6,6 @@ STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}"
6STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}" 6STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${SDK_SYS}"
7PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:" 7PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"
8 8
9TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
10
11python () { 9python () {
12 opt_effective = "-O" 10 opt_effective = "-O"
13 for opt in d.getVar('SELECTED_OPTIMIZATION').split(): 11 for opt in d.getVar('SELECTED_OPTIMIZATION').split():
diff --git a/meta/recipes-core/meta/build-sysroots.bb b/meta/recipes-core/meta/build-sysroots.bb
new file mode 100644
index 0000000000..7a712e2f38
--- /dev/null
+++ b/meta/recipes-core/meta/build-sysroots.bb
@@ -0,0 +1,38 @@
1INHIBIT_DEFAULT_DEPS = "1"
2LICENSE = "MIT"
3
4STANDALONE_SYSROOT = "${STAGING_DIR}/${MACHINE}"
5STANDALONE_SYSROOT_NATIVE = "${STAGING_DIR}/${BUILD_ARCH}"
6PACKAGE_ARCH = "${MACHINE_ARCH}"
7EXCLUDE_FROM_WORLD = "1"
8
9inherit nopackages
10deltask fetch
11deltask unpack
12deltask patch
13deltask prepare_recipe_sysroot
14deltask populate_lic
15deltask configure
16deltask compile
17deltask install
18deltask populate_sysroot
19
20python do_build_native_sysroot () {
21 targetsysroot = d.getVar("STANDALONE_SYSROOT")
22 nativesysroot = d.getVar("STANDALONE_SYSROOT_NATIVE")
23 staging_populate_sysroot_dir(targetsysroot, nativesysroot, True, d)
24}
25do_build_native_sysroot[cleandirs] = "${STANDALONE_SYSROOT_NATIVE}"
26do_build_native_sysroot[nostamp] = "1"
27addtask do_build_native_sysroot before do_build
28
29python do_build_target_sysroot () {
30 targetsysroot = d.getVar("STANDALONE_SYSROOT")
31 nativesysroot = d.getVar("STANDALONE_SYSROOT_NATIVE")
32 staging_populate_sysroot_dir(targetsysroot, nativesysroot, False, d)
33}
34do_build_target_sysroot[cleandirs] = "${STANDALONE_SYSROOT}"
35do_build_target_sysroot[nostamp] = "1"
36addtask do_build_target_sysroot before do_build
37
38do_clean[cleandirs] += "${STANDALONE_SYSROOT} ${STANDALONE_SYSROOT_NATIVE}"
diff --git a/meta/recipes-core/meta/meta-environment-extsdk.bb b/meta/recipes-core/meta/meta-environment-extsdk.bb
index 757afc154f..2076b56f25 100644
--- a/meta/recipes-core/meta/meta-environment-extsdk.bb
+++ b/meta/recipes-core/meta/meta-environment-extsdk.bb
@@ -5,8 +5,8 @@ require meta-environment.bb
5PN = "meta-environment-extsdk-${MACHINE}" 5PN = "meta-environment-extsdk-${MACHINE}"
6 6
7create_sdk_files_append() { 7create_sdk_files_append() {
8 local sysroot=${SDKPATH}/tmp/${@os.path.relpath(d.getVar('STAGING_DIR_TARGET'), d.getVar('TMPDIR'))} 8 local sysroot=${SDKPATH}/tmp/${@os.path.relpath(d.getVar('STAGING_DIR'), d.getVar('TMPDIR'))}/${MACHINE}
9 local sdkpathnative=${SDKPATH}/tmp/${@os.path.relpath(d.getVar('STAGING_DIR_NATIVE'), d.getVar('TMPDIR'))} 9 local sdkpathnative=${SDKPATH}/tmp/${@os.path.relpath(d.getVar('STAGING_DIR'), d.getVar('TMPDIR'))}/${BUILD_ARCH}
10 10
11 toolchain_create_sdk_env_script '' '' $sysroot '' ${bindir_native} ${prefix_native} $sdkpathnative 11 toolchain_create_sdk_env_script '' '' $sysroot '' ${bindir_native} ${prefix_native} $sdkpathnative
12} 12}
diff --git a/meta/recipes-core/meta/meta-extsdk-toolchain.bb b/meta/recipes-core/meta/meta-extsdk-toolchain.bb
index fc6d6de99a..0b8fcf08dc 100644
--- a/meta/recipes-core/meta/meta-extsdk-toolchain.bb
+++ b/meta/recipes-core/meta/meta-extsdk-toolchain.bb
@@ -15,7 +15,7 @@ LOCKED_SIGS_INDIR = "${D}/locked-sigs"
15addtask do_locked_sigs after do_populate_sysroot 15addtask do_locked_sigs after do_populate_sysroot
16SSTATETASKS += "do_locked_sigs" 16SSTATETASKS += "do_locked_sigs"
17do_locked_sigs[sstate-inputdirs] = "${LOCKED_SIGS_INDIR}" 17do_locked_sigs[sstate-inputdirs] = "${LOCKED_SIGS_INDIR}"
18do_locked_sigs[sstate-outputdirs] = "${STAGING_DIR_HOST}/locked-sigs" 18do_locked_sigs[sstate-outputdirs] = "${STAGING_DIR}/${PACKAGE_ARCH}/${PN}/locked-sigs"
19 19
20python do_locked_sigs() { 20python do_locked_sigs() {
21 import oe.copy_buildsystem 21 import oe.copy_buildsystem
diff --git a/meta/recipes-core/meta/meta-world-pkgdata.bb b/meta/recipes-core/meta/meta-world-pkgdata.bb
index 0ce378ea2b..617f96a33e 100644
--- a/meta/recipes-core/meta/meta-world-pkgdata.bb
+++ b/meta/recipes-core/meta/meta-world-pkgdata.bb
@@ -32,7 +32,7 @@ do_configure[noexec] = "1"
32do_compile[noexec] = "1" 32do_compile[noexec] = "1"
33do_install[noexec] = "1" 33do_install[noexec] = "1"
34 34
35do_configure[deptask] = "" 35do_prepare_recipe_sysroot[deptask] = ""
36 36
37WORLD_PKGDATA_EXCLUDE ?= "" 37WORLD_PKGDATA_EXCLUDE ?= ""
38 38
diff --git a/meta/recipes-core/musl/musl.inc b/meta/recipes-core/musl/musl.inc
index 7ed931c6da..56c9d7fe17 100644
--- a/meta/recipes-core/musl/musl.inc
+++ b/meta/recipes-core/musl/musl.inc
@@ -12,7 +12,6 @@ SECTION = "libs"
12LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=7928b7ad32ceda04932478e330e52f7f" 12LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=7928b7ad32ceda04932478e330e52f7f"
13 13
14PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:" 14PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:"
15TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}"
16 15
17INHIBIT_DEFAULT_DEPS = "1" 16INHIBIT_DEFAULT_DEPS = "1"
18 17
diff --git a/meta/recipes-devtools/docbook-xml/docbook-xml-dtd4_4.5.bb b/meta/recipes-devtools/docbook-xml/docbook-xml-dtd4_4.5.bb
index 2f13dba52c..05a04d8df5 100644
--- a/meta/recipes-devtools/docbook-xml/docbook-xml-dtd4_4.5.bb
+++ b/meta/recipes-devtools/docbook-xml/docbook-xml-dtd4_4.5.bb
@@ -27,9 +27,6 @@ S="${WORKDIR}/docbook-xml-4.5.c31424"
27inherit allarch 27inherit allarch
28BBCLASSEXTEND = "native" 28BBCLASSEXTEND = "native"
29 29
30SSTATEPOSTINSTFUNCS_append_class-native = " docbook_xml_dtd_sstate_postinst"
31SYSROOT_PREPROCESS_FUNCS_append_class-native = " docbook_xml_dtd_sysroot_preprocess"
32
33do_configre (){ 30do_configre (){
34 : 31 :
35} 32}
@@ -49,18 +46,10 @@ do_install () {
49 install -m 755 ${WORKDIR}/docbook-xml.xml ${D}${sysconfdir}/xml/docbook-xml.xml 46 install -m 755 ${WORKDIR}/docbook-xml.xml ${D}${sysconfdir}/xml/docbook-xml.xml
50} 47}
51 48
52docbook_xml_dtd_sstate_postinst () { 49do_install_append_class-native () {
53 if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ] 50 # Ensure that the catalog file sgml-docbook.cat is properly
54 then 51 # updated when the package is installed from sstate cache.
55 # Ensure that the catalog file sgml-docbook.cat is properly 52 sed -i -e "s|file://.*/usr/share/xml|file://${datadir}/xml|g" ${D}${sysconfdir}/xml/docbook-xml.xml
56 # updated when the package is installed from sstate cache.
57 sed -i -e "s|file://.*/usr/share/xml|file://${datadir}/xml|g" ${SYSROOT_DESTDIR}${sysconfdir}/xml/docbook-xml.xml
58 fi
59}
60
61docbook_xml_dtd_sysroot_preprocess () {
62 # Update the hardcode dir in docbook-xml.xml
63 sed -i -e "s|file:///usr/share/xml|file://${datadir}/xml|g" ${SYSROOT_DESTDIR}${sysconfdir}/xml/docbook-xml.xml
64} 53}
65 54
66FILES_${PN} = "${datadir}/* ${sysconfdir}/xml/docbook-xml.xml" 55FILES_${PN} = "${datadir}/* ${sysconfdir}/xml/docbook-xml.xml"
diff --git a/meta/recipes-devtools/docbook-xml/docbook-xsl-stylesheets_1.79.1.bb b/meta/recipes-devtools/docbook-xml/docbook-xsl-stylesheets_1.79.1.bb
index aa03a82a2a..07d32ce979 100644
--- a/meta/recipes-devtools/docbook-xml/docbook-xsl-stylesheets_1.79.1.bb
+++ b/meta/recipes-devtools/docbook-xml/docbook-xsl-stylesheets_1.79.1.bb
@@ -20,9 +20,6 @@ S = "${WORKDIR}/docbook-xsl-${PV}"
20inherit allarch 20inherit allarch
21BBCLASSEXTEND = "native" 21BBCLASSEXTEND = "native"
22 22
23SSTATEPOSTINSTFUNCS_append_class-native = " docbook_xsl_stylesheets_sstate_postinst"
24SYSROOT_PREPROCESS_FUNCS_append_class-native = " docbook_xsl_stylesheets_sysroot_preprocess"
25
26do_configure (){ 23do_configure (){
27 : 24 :
28} 25}
@@ -55,18 +52,10 @@ do_install () {
55 52
56} 53}
57 54
58docbook_xsl_stylesheets_sstate_postinst () { 55do_install_append_class-native () {
59 if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ] 56 # Ensure that the catalog file sgml-docbook.cat is properly
60 then 57 # updated when the package is installed from sstate cache.
61 # Ensure that the catalog file sgml-docbook.cat is properly 58 sed -i -e "s|file://.*/usr/share/xml|file://${datadir}/xml|g" ${D}${sysconfdir}/xml/docbook-xsl.xml
62 # updated when the package is installed from sstate cache.
63 sed -i -e "s|file://.*/usr/share/xml|file://${datadir}/xml|g" ${SYSROOT_DESTDIR}${sysconfdir}/xml/docbook-xsl.xml
64 fi
65}
66
67docbook_xsl_stylesheets_sysroot_preprocess () {
68 # Update the hardcode dir in docbook-xml.xml
69 sed -i -e "s|file:///usr/share/xml|file://${datadir}/xml|g" ${SYSROOT_DESTDIR}${sysconfdir}/xml/docbook-xsl.xml
70} 59}
71 60
72RDEPENDS_${PN} += "perl" 61RDEPENDS_${PN} += "perl"
diff --git a/meta/recipes-devtools/gcc/gcc-cross-initial.inc b/meta/recipes-devtools/gcc/gcc-cross-initial.inc
index dcf22710ae..d47f42e4c3 100644
--- a/meta/recipes-devtools/gcc/gcc-cross-initial.inc
+++ b/meta/recipes-devtools/gcc/gcc-cross-initial.inc
@@ -47,6 +47,7 @@ do_configure_prepend () {
47do_compile () { 47do_compile () {
48 oe_runmake all-gcc configure-target-libgcc 48 oe_runmake all-gcc configure-target-libgcc
49} 49}
50
50do_install () { 51do_install () {
51 ( cd ${B}/${TARGET_SYS}/libgcc; oe_runmake 'DESTDIR=${D}' install-unwind_h ) 52 ( cd ${B}/${TARGET_SYS}/libgcc; oe_runmake 'DESTDIR=${D}' install-unwind_h )
52 oe_runmake 'DESTDIR=${D}' install-gcc 53 oe_runmake 'DESTDIR=${D}' install-gcc
@@ -94,7 +95,7 @@ sysroot_stage_all() {
94 mv ${SYSROOT_DESTDIR}${target_libdir}/* ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_libdir}/ || true 95 mv ${SYSROOT_DESTDIR}${target_libdir}/* ${SYSROOT_DESTDIR}${STAGING_DIR_TARGET}${target_libdir}/ || true
95} 96}
96 97
97do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_HOST}/ ${SYSROOT_DESTDIR}/${STAGING_DIR_TARGET}/${target_base_libdir}/" 98do_populate_sysroot[sstate-inputdirs] = "${SYSROOT_DESTDIR}/${STAGING_DIR_HOST}/"
98do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_HOST}/ ${STAGING_DIR_TCBOOTSTRAP}/${target_base_libdir}/" 99do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR}-components/${PACKAGE_ARCH}/${PN}"
99 100
100inherit nopackages 101inherit nopackages
diff --git a/meta/recipes-devtools/gcc/libgcc-initial.inc b/meta/recipes-devtools/gcc/libgcc-initial.inc
index 687a8a0b09..aa32185ec0 100644
--- a/meta/recipes-devtools/gcc/libgcc-initial.inc
+++ b/meta/recipes-devtools/gcc/libgcc-initial.inc
@@ -14,6 +14,4 @@ EXTRA_OECONF += "--disable-shared"
14 14
15LIBGCCBUILDTREENAME = "gcc-build-internal-initial-" 15LIBGCCBUILDTREENAME = "gcc-build-internal-initial-"
16 16
17do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_TCBOOTSTRAP}/"
18
19inherit nopackages 17inherit nopackages
diff --git a/meta/recipes-devtools/guile/guile_2.0.13.bb b/meta/recipes-devtools/guile/guile_2.0.13.bb
index dd38b47993..c29e752859 100644
--- a/meta/recipes-devtools/guile/guile_2.0.13.bb
+++ b/meta/recipes-devtools/guile/guile_2.0.13.bb
@@ -108,10 +108,12 @@ guile_cross_config() {
108# auto-compile into the prefix even if it can write there, so touch them here as 108# auto-compile into the prefix even if it can write there, so touch them here as
109# sysroot is managed. 109# sysroot is managed.
110SSTATEPOSTINSTFUNCS += "guile_sstate_postinst" 110SSTATEPOSTINSTFUNCS += "guile_sstate_postinst"
111GUILESSTATEDIR = "${STAGING_DIR}-components/${TUNE_PKGARCH}/${PN}/${libdir}/guile/2.0/ccache"
112GUILESSTATEDIR_class-native = "${STAGING_DIR}-components/${BUILD_ARCH}/${PN}/${libdir_native}/guile/2.0/ccache"
111guile_sstate_postinst() { 113guile_sstate_postinst() {
112 if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ] 114 if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ]
113 then 115 then
114 find ${STAGING_DIR_TARGET}/${libdir}/guile/2.0/ccache -type f | xargs touch 116 find ${GUILESSTATEDIR} -type f | xargs touch
115 fi 117 fi
116} 118}
117 119
diff --git a/meta/recipes-devtools/libtool/libtool_2.4.6.bb b/meta/recipes-devtools/libtool/libtool_2.4.6.bb
index 8858f6eef8..06abb05584 100644
--- a/meta/recipes-devtools/libtool/libtool_2.4.6.bb
+++ b/meta/recipes-devtools/libtool/libtool_2.4.6.bb
@@ -11,6 +11,8 @@ SYSROOT_DIRS_BLACKLIST += " \
11 ${datadir}/libtool/build-aux \ 11 ${datadir}/libtool/build-aux \
12" 12"
13 13
14ACLOCALEXTRAPATH_class-target = ""
15
14do_install_append () { 16do_install_append () {
15 sed -e 's@--sysroot=${STAGING_DIR_HOST}@@g' \ 17 sed -e 's@--sysroot=${STAGING_DIR_HOST}@@g' \
16 -e 's@${STAGING_DIR_HOST}@@g' \ 18 -e 's@${STAGING_DIR_HOST}@@g' \
diff --git a/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb b/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb
index 881942ed80..b86400bd27 100644
--- a/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb
+++ b/meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb
@@ -3,6 +3,8 @@ LICENSE = "MIT"
3 3
4S = "${WORKDIR}" 4S = "${WORKDIR}"
5 5
6DEPENDS += "qemu-native"
7
6inherit qemu 8inherit qemu
7 9
8do_install () { 10do_install () {
diff --git a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.36.1.bb b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.36.1.bb
index cb589bb82d..98e5090bc8 100644
--- a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.36.1.bb
+++ b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.36.1.bb
@@ -93,12 +93,3 @@ do_install_append_class-native() {
93 GDK_PIXBUF_MODULEDIR=${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/${LIBV}/loaders 93 GDK_PIXBUF_MODULEDIR=${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/${LIBV}/loaders
94} 94}
95BBCLASSEXTEND = "native" 95BBCLASSEXTEND = "native"
96
97SSTATEPREINSTFUNCS_append_class-native = " gdkpixbuf_sstate_preinst"
98SYSROOT_PREPROCESS_FUNCS_append_class-native = " gdkpixbuf_sstate_preinst"
99
100gdkpixbuf_sstate_preinst() {
101 if [ "${BB_CURRENTTASK}" = "populate_sysroot" ]; then
102 rm -rf ${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/${LIBV}/*
103 fi
104}
diff --git a/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.50.0.bb b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.50.0.bb
index 0c29a3b377..15c8c00f0a 100644
--- a/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.50.0.bb
+++ b/meta/recipes-gnome/gobject-introspection/gobject-introspection_1.50.0.bb
@@ -34,7 +34,7 @@ DEPENDS_append = " libffi zlib glib-2.0 python3 flex-native bison-native"
34# (standard ldd doesn't work when cross-compiling). 34# (standard ldd doesn't work when cross-compiling).
35DEPENDS_class-target_append = " gobject-introspection-native qemu-native prelink-native" 35DEPENDS_class-target_append = " gobject-introspection-native qemu-native prelink-native"
36 36
37SSTATE_SCAN_FILES += "g-ir-scanner-qemuwrapper g-ir-scanner-wrapper g-ir-compiler-wrapper g-ir-scanner-lddwrapper Gio-2.0.gir" 37SSTATE_SCAN_FILES += "g-ir-scanner-qemuwrapper g-ir-scanner-wrapper g-ir-compiler-wrapper g-ir-scanner-lddwrapper Gio-2.0.gir postinst-ldsoconf-${PN}"
38 38
39do_configure_prepend_class-native() { 39do_configure_prepend_class-native() {
40 # Tweak the native python scripts so that they don't refer to the 40 # Tweak the native python scripts so that they don't refer to the
@@ -166,8 +166,13 @@ python gobject_introspection_preconfigure () {
166 oe.utils.write_ld_so_conf(d) 166 oe.utils.write_ld_so_conf(d)
167} 167}
168 168
169SSTATEPOSTINSTFUNCS += "gobject_introspection_postinst" 169SYSROOT_PREPROCESS_FUNCS_append = " gi_ldsoconf_sysroot_preprocess"
170python gobject_introspection_postinst () { 170gi_ldsoconf_sysroot_preprocess () {
171 if d.getVar("BB_CURRENTTASK").startswith("populate_sysroot"): 171 mkdir -p ${SYSROOT_DESTDIR}${bindir}
172 oe.utils.write_ld_so_conf(d) 172 dest=${SYSROOT_DESTDIR}${bindir}/postinst-ldsoconf-${PN}
173 echo "#!/bin/sh" > $dest
174 echo "echo mkdir -p ${STAGING_DIR_TARGET}${sysconfdir} > ${STAGING_DIR_TARGET}${sysconfdir}/ld.so.conf" >> $dest
175 echo "echo ${base_libdir} >> ${STAGING_DIR_TARGET}${sysconfdir}/ld.so.conf" >> $dest
176 echo "echo ${libdir} >> ${STAGING_DIR_TARGET}${sysconfdir}/ld.so.conf" >> $dest
177 chmod 755 $dest
173} 178}
diff --git a/meta/recipes-gnome/gtk+/gtk+3.inc b/meta/recipes-gnome/gtk+/gtk+3.inc
index 6499ea6c8d..9c104e28c0 100644
--- a/meta/recipes-gnome/gtk+/gtk+3.inc
+++ b/meta/recipes-gnome/gtk+/gtk+3.inc
@@ -31,7 +31,7 @@ EXTRA_OECONF += " \
31 --enable-modules \ 31 --enable-modules \
32 --disable-cups \ 32 --disable-cups \
33 --disable-colord \ 33 --disable-colord \
34 WAYLAND_PROTOCOLS_SYSROOT_DIR=${STAGING_DIR}/${MACHINE} \ 34 WAYLAND_PROTOCOLS_SYSROOT_DIR=${RECIPE_SYSROOT} \
35 ${@bb.utils.contains("DISTRO_FEATURES", "x11", "", "--disable-gtk-doc", d)} \ 35 ${@bb.utils.contains("DISTRO_FEATURES", "x11", "", "--disable-gtk-doc", d)} \
36 " 36 "
37EXTRA_OECONF[vardepsexclude] = "MACHINE" 37EXTRA_OECONF[vardepsexclude] = "MACHINE"
diff --git a/meta/recipes-graphics/libsdl2/libsdl2_2.0.5.bb b/meta/recipes-graphics/libsdl2/libsdl2_2.0.5.bb
index 44842f8a01..0d9a12993f 100644
--- a/meta/recipes-graphics/libsdl2/libsdl2_2.0.5.bb
+++ b/meta/recipes-graphics/libsdl2/libsdl2_2.0.5.bb
@@ -34,8 +34,7 @@ EXTRA_OECONF = "--disable-oss --disable-esd --disable-arts \
34 --enable-pthreads \ 34 --enable-pthreads \
35 --enable-sdl-dlopen \ 35 --enable-sdl-dlopen \
36 --disable-rpath \ 36 --disable-rpath \
37 WAYLAND_PROTOCOLS_SYSROOT_DIR=${STAGING_DIR}/${MACHINE}" 37 WAYLAND_PROTOCOLS_SYSROOT_DIR=${RECIPE_SYSROOT}"
38EXTRA_OECONF[vardepsexclude] = "MACHINE"
39 38
40# opengl packageconfig factored out to make it easy for distros 39# opengl packageconfig factored out to make it easy for distros
41# and BSP layers to pick either (desktop) opengl, gles2, or no GL 40# and BSP layers to pick either (desktop) opengl, gles2, or no GL
diff --git a/meta/recipes-graphics/wayland/weston_1.11.1.bb b/meta/recipes-graphics/wayland/weston_1.11.1.bb
index 7e75cf7a0d..2736cc1c87 100644
--- a/meta/recipes-graphics/wayland/weston_1.11.1.bb
+++ b/meta/recipes-graphics/wayland/weston_1.11.1.bb
@@ -28,10 +28,8 @@ DEPENDS += "wayland wayland-protocols libinput virtual/egl pango wayland-native"
28EXTRA_OECONF = "--enable-setuid-install \ 28EXTRA_OECONF = "--enable-setuid-install \
29 --disable-rpi-compositor \ 29 --disable-rpi-compositor \
30 --disable-rdp-compositor \ 30 --disable-rdp-compositor \
31 WAYLAND_PROTOCOLS_SYSROOT_DIR=${STAGING_DIR}/${MACHINE} \ 31 WAYLAND_PROTOCOLS_SYSROOT_DIR=${RECIPE_SYSROOT} \
32 " 32 "
33EXTRA_OECONF[vardepsexclude] = "MACHINE"
34
35EXTRA_OECONF_append_qemux86 = "\ 33EXTRA_OECONF_append_qemux86 = "\
36 WESTON_NATIVE_BACKEND=fbdev-backend.so \ 34 WESTON_NATIVE_BACKEND=fbdev-backend.so \
37 " 35 "
diff --git a/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc b/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc
index 6a13380c98..216ae64fc2 100644
--- a/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc
+++ b/meta/recipes-graphics/xorg-xserver/xserver-xorg.inc
@@ -117,9 +117,8 @@ EXTRA_OECONF += "--with-fop=no \
117 --sysconfdir=/etc/X11 \ 117 --sysconfdir=/etc/X11 \
118 --localstatedir=/var \ 118 --localstatedir=/var \
119 --with-xkb-output=/var/lib/xkb \ 119 --with-xkb-output=/var/lib/xkb \
120 WAYLAND_PROTOCOLS_SYSROOT_DIR=${STAGING_DIR}/${MACHINE} \ 120 WAYLAND_PROTOCOLS_SYSROOT_DIR=${RECIPE_SYSROOT} \
121" 121"
122EXTRA_OECONF[vardepsexclude] = "MACHINE"
123 122
124PACKAGECONFIG ??= "dri2 udev ${XORG_CRYPTO} \ 123PACKAGECONFIG ??= "dri2 udev ${XORG_CRYPTO} \
125 ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'dri glx', '', d)} \ 124 ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'dri glx', '', d)} \
diff --git a/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb b/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb
index e617bde12b..aa2805b035 100644
--- a/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb
+++ b/meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb
@@ -9,6 +9,7 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
9 9
10# We need the following for the sstate code to process the wrapper 10# We need the following for the sstate code to process the wrapper
11SSTATE_SCAN_FILES += "depmodwrapper" 11SSTATE_SCAN_FILES += "depmodwrapper"
12EXTRA_STAGING_FIXMES = "PKGDATA_DIR"
12 13
13do_install() { 14do_install() {
14 install -d ${D}${bindir_crossscripts}/ 15 install -d ${D}${bindir_crossscripts}/
diff --git a/meta/recipes-multimedia/alsa/alsa-tools_1.1.0.bb b/meta/recipes-multimedia/alsa/alsa-tools_1.1.0.bb
index 8d4a146580..a4f35ce7e9 100644
--- a/meta/recipes-multimedia/alsa/alsa-tools_1.1.0.bb
+++ b/meta/recipes-multimedia/alsa/alsa-tools_1.1.0.bb
@@ -34,7 +34,7 @@ AUTOTOOLS_COPYACLOCAL = "1"
34do_compile_prepend () { 34do_compile_prepend () {
35 #Automake dir is not correctly detected in cross compilation case 35 #Automake dir is not correctly detected in cross compilation case
36 export AUTOMAKE_DIR="$(automake --print-libdir)" 36 export AUTOMAKE_DIR="$(automake --print-libdir)"
37 export ACLOCAL_FLAGS="--system-acdir=${ACLOCALDIR}/" 37 export ACLOCAL_FLAGS="--system-acdir=${ACLOCALDIR}/ ${ACLOCALEXTRAPATH}"
38 38
39 cp ${WORKDIR}/gitcompile_hdajacksensetest ${S}/hdajacksensetest/gitcompile 39 cp ${WORKDIR}/gitcompile_hdajacksensetest ${S}/hdajacksensetest/gitcompile
40} 40}
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.2.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.2.bb
index f487b09cb2..c469acafd3 100644
--- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.2.bb
+++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.2.bb
@@ -24,5 +24,5 @@ SRC_URI[sha256sum] = "0795ca9303a99cc7e44dda0e6e18524de02b39892e4b68eaba488f7b9d
24 24
25S = "${WORKDIR}/gst-plugins-bad-${PV}" 25S = "${WORKDIR}/gst-plugins-bad-${PV}"
26 26
27EXTRA_OECONF += "WAYLAND_PROTOCOLS_SYSROOT_DIR=${STAGING_DIR}/${MACHINE}" 27EXTRA_OECONF += "WAYLAND_PROTOCOLS_SYSROOT_DIR=${RECIPE_SYSROOT}"
28EXTRA_OECONF[vardepsexclude] = "MACHINE" 28