multilib.conf: Use BASELIB to set baselib, not hardcode the value

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
package: Rename splitfile functions to something more descriptive

The splitfile and splitfile2 function names are confusing and the comments
are also misleading, hard to understand or plain incorrect. This tries to
improve things.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
package.bbclass: Improve kernel module handling

Currently the kernel module handling consists of several special cases
and has its own path walking. This refactors the code to handle them in
a more standardised way which is also a bit more efficient.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
package.bbclass: Add a shortcut exit from the mkdir function

The mkdir function iterates over strings with many different operations,
even if ultimately the target already exists. This adds a check to the start
of the function so we don't waste time when the target already exists.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
package.bbclass: Check FILES once, not once per loop iteration

There is no need to check FILES in each loop iteration, we can just check it once
at the start when we read the variable.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
package.bbclass: Avoid copying the datastore for FILES handling

There is no real point in adjusting overrides and creating a copy of the datastore,
just to access a single variable. We can do this just as easily with a slightly
more complicated getVar call. This improves performance.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
package.bbclass: Move PKG handling code to emit_pkgdata

We only use the PKG variable in emit_pkgdata so we might as well move the
fallback code there, allowing restructuring of other parts of the metadata.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
package.bbclass: Split out package_fixsymlinks function

The symlink handling code doesn't need to being part of populate_packages
and is logically separate so split it out into a separate function,
package_fixsymlinks.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
package.bbclass: Tweak PACKAGEFUNCS

Move package_rename_hook call into PACKAGEFUNCS and also move package_get_auto_pr
to a more appropriate execution point, grouping package metadata handling
functions together.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
package.bbclass: Improve package_fixsymlinks

Improve package_fixsymlinks so we don't handle RDEPENDS for every single package
in PACKAGES.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
package: Create global package file list and use throughout PACKAGEFUNCS

Currently we do a signficant amount of tree traversal in many different places
which in inefficient. We can assume that the files don't change and cache the
file list which gives an efficiency improvement which this patch does using
a global variable.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
package.bbclass: Use expanded RDEPENDS in read_shlibdeps

We may as well expand the RDEPENDS when reading and writing as this function does.
if we don't do this, we could accidentally duplicate data and it also turns out
to be much less efficient.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>