Commit Graph

250 Commits

Author SHA1 Message Date
Richard Purdie 78747cc912 sstate: Ensure native/cross recipes have relocation of HOSTTOOLS_DIR
The previous change to relocate HOSTTOOLS wasn't complete as some files,
particularly in gcc stashed build directories were not being correctly
relocated. This patch addresses the issue.

(From OE-Core rev: 21dd36cc12a033b012544c5d15a6f8afd84dabc9)

(From OE-Core rev: 64c2f8acd02e0e5dca234b36a2a7097c0c16f7c2)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-18 13:17:44 +01:00
Peter Kjellerstedt 1d57ca352f sstate.bbclass, staging.bbclass: Handle HOSTTOOLS_DIR when restoring state
Paths to host tools that have been copied to ${HOSTTOOLS_DIR} may end
up in the sstate cache. They thus need to be corrected when restoring
from the sstate cache.

(From OE-Core rev: f8671aecf05a286dd2b34b07bb5fbbe0c31e26d0)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-05-01 08:56:35 +01:00
Richard Purdie b5c383074a base-passwd/useradd: Various improvements to useradd with RSS
Currently there are multiple issues with useradd:

* If base-passwd rebuilds, it wipes out recipe specific user/group additions
  to sysroots and causes errors
* If recipe A adds a user and recipe B depends on A, it can't see any of the
  users/groups A adds.

This patch changes base-passwd so it always works as a postinst script
within the sysroot and copies in the master files, then runs any
postinst-useradd-* scripts afterwards to add additional user/groups.

The postinst-useradd-* scripts are tweaked so that if /etc/passwd doesn't exist
they just exit, knowning they'll be executed later. We also add a dummy entry to
the dummy passwd file from pseudo so we can avoid this too.

There is a problem where if recipe A adds a user and recipe B depends on A but
doesn't care about users, it may not have a dependency on the useradd/groupadd
tools which would therefore not be available in B's sysroot. We therefore also
tweak postinst-useradd-* scripts so that if the tools aren't present we simply
don't add users. If you need the users, you add a dependency on the tools in the
recipe and they'll be added.

We add postinst-* to SSTATE_SCAN_FILES since almost any postinst script of this
kind is going to need relocation help.

We also ensure that the postinst-useradd script is written into the sstate
object as the current script was only being added in a recipe local way.

Thanks to Peter Kjellerstedt <pkj@axis.com> and Patrick Ohly for some pieces
of this patch.

[Yocto #11124]

(From OE-Core rev: 1b5afaf437f7a1107d4edca8eeb668b9618a5488)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-14 09:47:08 +01:00
Ed Bartosh 4273422072 sstate.bbclass: check if mirror directory is writable
Commit 51edde6537 makes a wrong assumption
that SSTATE_MIRRORS have write permissions.

A mirror is by definition outside of it's user control. In my use case
it happens I does not have permissions to update the access time of the
dereferenced symbolic-link file.

Checked if file is writable before changing its atime.

Thanks to Paulo Neves for the patch.

[YOCTO #11307]

(From OE-Core rev: b8f26c011d5ed888d85fef040bd821400d54c8fe)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-13 10:54:10 +01:00
Richard Purdie 34313c4047 sstate: Skip glibc do_stash_locale and gcc do_gcc_stash_builddir tasks
We never need these tasks as dependencies of other sstate tasks since
they're only ever needed to build artefacts so we can always skip them
and save some time/space.

(From OE-Core rev: 246df3df4b7da4b75de0745938438124c2b1d4a5)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-04-10 23:00:43 +01:00
Richard Purdie 0cb6f85335 sstate: Ensure installation directory is empty before execution
When you enable the systemd DISTRO_FEATURE, opkg-native contains systemd units
which have a relocation fixme list. When systemd isn't in DISTRO_FEATURES, there
are no fixmes required. Unfortunately as sstate isn't cleaning up its installation
directory before use, if you install the systemd version, then install the
non-systemd version from sstate, it would leave behind the fixme file from the
systemd version and breakage results as it would try and fixup files which don't
exist.

The solution is to ensure the unpack/install directory is clean before use. It
does raise other questions about opkg-native, systemd and DISTRO_FEATURES but there
is an underlying sstate issue here too which would cause missing file failures.

(From OE-Core rev: d1d55041e38b12d40f896834b56475ea19a6047f)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-22 11:35:22 +00:00
Alexander Kanavin cf7e0baffa package_rpm.bbclass: make architecture-independent .rpm packages "noarch" instead of "all"
Too many places in dnf/rpm4 stack make that assumption; let's not fight against it.

(From OE-Core rev: 341810aff923ace6b1cc1e15e19383c4f8773b51)

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-14 14:42:17 +00:00
Ed Bartosh 51edde6537 sstate.bbclass: update .siginfo atime
.siginfo files are not being accessed from local or NFS-mounted
sstate mirrors when sstate package is installed, so their atime
is not updated. If sstate mirror is cleaned based on access time,
they get deleted, even though they are still being used.

Updated atime of .siginfo symlinks with 'touch -a'. This command
dereferences symlinks pointing to the local mirror and updates
atime of the .siginfo file on the mirror.

[YOCTO #10857]

(From OE-Core rev: fb1499a42756faeef025122bbde98bc14f4ae61e)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-10 14:50:10 +00:00
Mike Crowe 0b8d85a094 kernel, license, sstate, rootfs.py: Remove deploy directory README
It isn't clear that the README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt
file in the deploy directory warrants the complexity it brings elsewhere.
Let's just remove it entirely.

In particular, if two do_image_complete tasks run in parallel they risk
both trying to put their image into ${DEPLOY_DIR_IMAGE} at the same time.
Both will contain a README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt
file. In theory this should be safe because "cp -alf" will just cause one
to overwrite the other. Unfortunately, coreutils cp also has a race[1]
which means that if one copy creates the file at just the wrong point the
other will fail with:

 cp: cannot create hard link ‘..../tmp-glibc/deploy/images/pantera/README_-_DO_NOT_DELETE_FILES_IN_THIS_D.txt’ to
+‘..../tmp-glibc/work/rage_against-oe-linux-gnueabi/my-own-image/1.0-r0/deploy-my-own-image-complete/README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt’: File exists

[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25680

(From OE-Core rev: 71e9e88847d7000781642ea6187ebd8f40dfdcfe)

Signed-off-by: Mike Crowe <mac@mcrowe.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-03-01 11:17:45 +00:00
Richard Purdie bfd0a39bdf classes: Drop now unneeded update_data calls
Now that the datastore works dynamically we don't need the update_data calls
so we can just remove them. They're not actually done anything at all for
a while.

(From OE-Core rev: 8de0c5d3bd01919e2bf0394f9c485936d6098cec)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-15 09:29:55 -08:00
Richard Purdie 3eee8e99e1 sstate: Make absolute symlinks an error
The current relocation code is broken, at least in the native case. Fixing it
would mean trying pass in new data on sstate tasks about the relative positioning
of symlinks compared to the sstate relocation paths. Whilst we could do this,
right now I'm favouring making this an error and fixing the small number of
problematic recipes we have in OE-Core (3).

(From OE-Core rev: cf94de4ddee3e5072da8608c9151301fcec02cd0)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-09 10:52:03 +00:00
Richard Purdie 758f18167f sstate/staging: Batch log messages for performance
According to profile data, repeated calls to bb.debug and bb.note in
the extend_recipe_sysroot() codepath were accounting for 75% of the time
(1.5s) in calls from tasks like do_image_complete.

This batches up the log messages into one call into the logging system
which gives similar behaviour to disabling the logging but retains the
debug information.

Since setscene_depvalid is also called from bitbake's setscene code,
we have to be a little creative with the function parameters and leave
the other debug output mechanism in place. This should hopefully
speed up recipe specific sysroots.

(From OE-Core rev: 3b0af8dc0f796345d1f1ba77ea35bbd090a5feb3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-02-01 18:02:12 +00:00
Kristian Amlie 2313a77d84 sstate: Make SSTATE_SCAN_CMD vars configurable using weak defaults.
For this we move them out of the python section so they can be
overridden on a per-recipe basis.

The motivation for this change is that not all tool chains need the
path modifications provided by the command, and these will provide
alternative or empty commands. The Go compiler is such an example.

(From OE-Core rev: 7d2a2160336413736dd4640f5b84ba4d74bb00f5)

Signed-off-by: Kristian Amlie <kristian.amlie@mender.io>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-31 14:43:01 +00:00
Richard Purdie a90c8817a5 sstate: Allow sstate_clean_manifest to take a prefix
Manifest files containing the same duplicated prefix are wasteful on space
and ultimately this costs build time. Add support for manifest files with
common prefixes removed and use the prefix if the path isn't absolute.

(From OE-Core rev: 71e8c98238d627f9665faee9d7c226b9c07bd256)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-28 23:32:16 +00:00
Richard Purdie 6ab4c5033a classes/oeqa: Replace subprocess.check_call() with check_output()
If you use subprocess.check_output() the traceback will contain the output
when the command fails which is very useful for debugging. There is no
good reason not to use this everywhere.

(From OE-Core rev: ad750dd1cc9d789abe723daddd098ce41d8547f5)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-23 23:30:57 +00:00
Richard Purdie 9107d6ca14 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>
2017-01-23 12:05:17 +00:00
Richard Purdie efd120e714 sstate: Drop the depchain isPostDep() checks
The dependencies of do_package_write_* tasks are either going to be packaging
tools needed to build the packages, or, native tools needed at postinst
time. Now we've formalised this dependency pattern, drop the hardcoded
list and work based on the rule. The package creation tools are usually
the same tools needed at rootfs/postinst time anyway so the difference is
moot.

(From OE-Core rev: 8082c6aabf838a2cc5253d2bb1bd8867f2e1ba6a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-20 11:53:49 +00:00
Paul Eggleton e9d3b7dc75 Revert "classes/sstate: add a mode to error if sstate package unavailable"
It turns out that this check cannot work. We don't have the information
to know whether an sstate package is really needed at this point in the
execution, so we check the availability for things that we won't
actually end up needing later on. Thus we can't fail if some of these
aren't found or we'll get needless failures.

This check was intended to give earlier more accurate errors when sstate
artifacts failed to download, but that's not practical so we'll rely
solely on the task execution check that was added within the runqueue.

This reverts most of commit 9e711b54487c3141d7264b8cf0d74f9465020190 (we
still need to allow BB_SETSCENE_ENFORCE through from the external
environment since the eSDK relies upon that.)

(From OE-Core rev: ff29ac6901d04487312f554d9e62250a18729c6c)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-20 11:53:49 +00:00
Richard Purdie 38bcf14abc sstate: Fix EXTRA_STAGING_FIXMES handling
The code wasn't working properly, tweak so that it works as expected and
the grep expression includes the right patterns. Not sure this code has ever
worked prior to this.

(From OE-Core rev: 6a46a974611c5262efefc21a11adb736c0fb206a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-20 11:53:49 +00:00
Paul Eggleton 976373be12 classes/sstate: fix file conflict message
* Fix not decoding output from grep ("Matched in b'manifest...')
* Fix showing "Matched in b''" if no match (show "not matched to any
  task" instead)
* Drop the filtering out of .populate-sysroot from matched manifest
  names - it should have been .populate_sysroot so it doesn't work, and
  in any case the value of removing the task name is questionable given
  that we aren't removing it for any other task, and that the rest of
  the filename isn't only the task name, we might as well have the whole
  thing. At least then you can do a find on that exact name without
  wildcards and find it.
* Fix indenting of file list entries and indent "matched in" further
  underneath
* Minor punctuation fixes

(From OE-Core rev: 4675ce43496898fccbac738835d7e92b1cca648e)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-09 13:39:11 +00:00
Paul Eggleton 3d6c667e54 classes/sstate: handle filenames containing square brackets
If a recipe installs a file or directory whose name contains square
brackets [ ] that form a valid glob expression and that file then they
won't be correctly removed from the sysroot, because we pass each path
in the sstate manifest to our oe.path.remove() function which calls
glob.glob() on the path passed into it and the expression won't
actually match the original filename. Since we don't expect to put any
wildcarded expressions in the sstate manifests, and we already have a
try...except around this, we can actually use os.remove() here instead.

Similarly, when we pass existing file paths to "grep" looking through
the manifests, we don't want those paths to be treated as regexes - so
use grep's -F command line switch.

Fixes [YOCTO #10836].

(From OE-Core rev: fd8a57861024fc82e15a2a4ec8c20ed0ebb242f6)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-01-09 13:39:11 +00:00
Joshua Lock 3c59b1bf93 meta: remove True option to getVarFlag calls
getVarFlag() now defaults to expanding by default, thus remove the
True option from getVarFlag() calls with a regex search and
replace.

Search made with the following regex:
getVarFlag ?\(( ?[^,()]*, ?[^,()]*), True\)

(From OE-Core rev: 2dea9e490a98377010b3d4118d054814c317a735)

Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-16 10:23:23 +00:00
Joshua Lock c4e2c59088 meta: remove True option to getVar calls
getVar() now defaults to expanding by default, thus remove the True
option from getVar() calls with a regex search and replace.

Search made with the following regex: getVar ?\(( ?[^,()]*), True\)

(From OE-Core rev: 7c552996597faaee2fbee185b250c0ee30ea3b5f)

Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-12-16 10:23:23 +00:00
Richard Purdie f6b0c60664 sstate: Ensure we don't remove sigbasedata files
We don't remove sigdata files, we also shouldn't remove sigbasedata files
as this hinders debugging.

(From OE-Core rev: 1ebd85f8dfe45b92c0137547c05e013e340f9cec)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-11-04 12:50:55 +00:00
Aníbal Limón f205384495 classes/sstate.bbclass: Enable thread lock when checkstatus
The checkstatus function fires an event to notify bitbake UI about
the progress of the task, this function is implemented using ThreadPool
and is causing event lose when multiple threads tries to fire an event
(writes over socket/fd).

[YOCTO #10330]

(From OE-Core rev: 6e0bb9d141438c0051c32b0d3a247915b71ccb82)

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-10-05 10:10:11 +01:00
Ulf Magnusson 39f80cefcc sstate.bbclass: Use bb.fatal() instead of raising FuncFailed
This sets a good example and avoids unnecessarily contributing to
perceived complexity and cargo culting.

Motivating quote below:

< kergoth> the *original* intent was for the function/task to error via
           whatever appropriate means, bb.fatal, whatever, and
           funcfailed was what you'd catch if you were calling
           exec_func/exec_task. that is, it's what those functions
           raise, not what metadata functions should be raising
< kergoth> it didn't end up being used that way
< kergoth> but there's really never a reason to raise it yourself

FuncFailed.__init__ takes a 'name' argument rather than a 'msg'
argument, which also shows that the original purpose got lost.

(From OE-Core rev: 33611b69c221cf875eba1c7cb599c256825ae470)

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-10-04 16:29:04 +01:00
Richard Purdie 0573dceb7b sstate: Add postrm command support
There are some issues in sstate which can't be handled by file removal
alone. Currently there is no way to execute a command against sstate and
doing so is potentially problematic for things like dependencies. This
patch adds a mechanism where any "postrm" script is executed if its present
allowing some openjade/sgml issues to be resolved.

[YOCTO #8273]

(From OE-Core rev: 2268efd0cd3ddb40870c4c424d10444ba86d2849)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-16 15:24:02 +01:00
Max Krummenacher f5e2dafcb8 sstate.bbclass: normalize whitelisted paths
Without this a whitelisted path containing /../ breaks the test for a file
allowed to be provided by more than one recipe.

Noticed when local.conf contains:
DEPLOY_DIR = "${TOPDIR}/../deploy"

|ERROR: core-image-minimal-1.0-r0 do_image_complete: The recipe
| core-image-minimal is trying to install files into a shared area when those
| files already exist. Those files and their manifest location are:
| .../poky/deploy/images/qemux86/README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt
| Matched in b'manifest-qemux86-linux-yocto.deploy'

(From OE-Core rev: d82acf20541463b14a811788d28fb1db3539885b)

Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-14 22:22:11 +01:00
Richard Purdie bc31120ec6 sstate: Avoid duplicate README file errors for sdk under sstate control
(From OE-Core rev: 4bd3a90c8fb034b4d899d0560d75d81f56e27e0a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-04 00:07:29 +01:00
Ed Bartosh 180eebf976 sstate.bbclass: skip packaging if SSTATE_SKIP_CREATION is set
SSTATE_SKIP_CREATION variable will be used to skip creation of
sstate .tgz files. It makes sense for image creation tasks as
tarring images and keeping them in sstate would consume a lot of
disk space.

(From OE-Core rev: 7e821ccd221916ae8482b9113df2de704f4a99a4)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-09-03 23:45:53 +01:00
Paul Eggleton f84b01b289 meta-extsdk-toolchain: add meta-recipe to install toolchain into eSDK
Add a meta-recipe to bring the toolchain into the extensible SDK. This
was modelled on meta-ide-support but some adjustments were needed to the
dependency validation function in sstate.bbclass to ensure that all of
the toolchain gets installed into the sysroot. With this, after
installing a minimal eSDK you only need to run the following after
sourcing the environment setup script to get the toolchain:

  devtool sdk-install meta-extsdk-toolchain

Addresses [YOCTO #9257].

(From OE-Core rev: 8110806b1b5534ae830a4fdd1a5293c86a712d0b)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-26 08:56:31 +01:00
Ed Bartosh 6ac1f9038d sstate.bbclass: make PV to depend on PV variable value
Currently PV is defined in meta/conf/bitbake.conf as a python
expression: "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE',
False),d)[1] or '1.0'}". As FILE is whitelisted it causes PV to
not depend on it. This causes sstate code to not detect that
PV changes when recipe filename changes.

Making PV to explicitly depend on PV variable value overrides default
behaviour. Instead of depending on python expression bitbake depends
on evaluated value of PV variable, which should fix the above
mentioned issue.

[YOCTO #9806]

(From OE-Core rev: 918646ca803d56004fb0ab7c21e86cc9cb14513d)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-20 10:28:45 +01:00
Paul Eggleton 6677dd37ad classes/sstate: add a mode to error if sstate package unavailable
If BB_SETSCENE_ENFORCE is set to "1" and an sstate package fails to
download outside of the whitelist specified by
BB_SETSCENE_ENFORCE_WHITELIST, then fail immediately so you can tell
that the problem was caused by failing to restore the task from sstate.

Part of the implementation of [YOCTO #9367].

(From OE-Core rev: 9e711b54487c3141d7264b8cf0d74f9465020190)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-08 09:57:23 +01:00
Paul Eggleton e769dce794 classes/sstate: show progress during sstate object availability check
Show progress through bitbake's standard terminal UI when checking for
shared state object availability, since this can take some time if there
are a large number of tasks to be executed and/or the network connection
is slow.

Part of the implementation for [YOCTO #5853].

(From OE-Core rev: 1a064385d6921ec90b33c9064dafaab11a36267c)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-07-08 09:57:23 +01:00
Richard Purdie 297438e965 classes/lib: Convert to use python3 octal syntax
The syntax for octal values changed in python3, adapt to it.

(From OE-Core rev: 737a095fcde773a36e0fee1f27b74aaa88062386)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-06-02 08:24:00 +01:00
Randy Witt 1cdd9795dd sstate.bbclass: Don't create symlinks, download to the correct location
Previously the sstate was all downloaded to the same directory and then
symlinks were added in the directories that pointed to the siginfo and
sstate in the parent directory.

This change makes it so that now the files are just downloaded to the
correct location without the need for symlinks.

(From OE-Core rev: 55d25ed6b30ed7105d3b6421fbf2a03cea009a59)

Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-25 07:50:17 +01:00
Richard Purdie 7db0cc27d5 sstate: Ensure we sort the value used for SSTATETASKS for determinism
This avoids 'basehash changed' errors with python 3 but could break
build determinism in general.

(From OE-Core rev: 488f88fc12eea9788e5db1de354f0118e2c58878)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-05-17 14:43:28 +01:00
Randy Witt 7e902807cb sstatesig.py: Split single locked sigs check into multiple checks
Add the SIGGEN_LOCKEDSIGS_TASKSIG_CHECK and
SIGGEN_LOCKEDSIGS_SSTATE_EXISTS_CHECK variables to replace
SIGGEN_LOCKEDSIGS_CHECK_LEVEL.

SIGGEN_LOCKEDSIGS_TASKSIG_CHECK will no control whether there is a
warning or error if a task's hash in the locked signature file doesn't match
the computed hash from the current metadata.

SIGGEN_LOCKEDSIGS_SSTATE_EXISTS_CHECK will control whther there is a
warning or error if a task that supports sstate is in the locked
signature file, but no sstate exists for the task.

Previously you could only have warning/errors for both controlled by
SIGGEN_LOCKEDSIGS_CHECK_LEVEL. This was an issue in the extensible sdk,
because we know sstate won't exist for certain items in the reverse
dependencies list for tasks. However, we still want to error if task
signatures don't match.

[YOCTO #9195]

(From OE-Core rev: 0fe2a5e5ffd01e926d0f3d4c78ad9910296e2d1a)

Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-04-09 23:00:43 +01:00
Maxin B. John cbe33ecb15 useradd.bbclass: remove user/group created by the package in clean* task
At present, if a recipe is built which creates users/groups via
useradd.bbclass, those users/groups are not removed from sysroot
when the recipe/package is cleaned using clean/cleansstate/cleanall
or when a recipe is rebuild and 'unstaged' from the the sysroot.

The "userdel_sysroot_sstate()" provides that functionality.

[YOCTO #9262]

(From OE-Core rev: b5304ce438666a7418746f4ddd32703ae3188089)

Signed-off-by: Maxin B. John <maxin.john@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-04-06 22:57:25 +01:00
Richard Purdie ea53d1e4a9 sstate: Allow late expansion of NATIVELSBSTRING
uninative needs to adjust NATIVELSBSTRING fairly late in the
configuration parsing process but the sstate code encodes it into
variables. Since this string doesn't vary on a per recipe basis, we
defer its expansion until usage time.

(From OE-Core rev: fb680ab8b3cf7aba9b579403b1aeb96d30762320)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-07 11:55:37 +00:00
Richard Purdie 78b6109440 cml1/sstate: Fix missing getVar parameter
(From OE-Core rev: 84065e9b33e6d401e4e50436665838be2d0267ad)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-19 15:33:02 +00:00
Markus Lehtonen 4699483773 sstate.bbclass: use oe.gpg_sign for gpg signing
[YOCTO #9006]

(From OE-Core rev: a3916b29c8c3d0b1570c40c0ed3a1a15c43925bb)

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-19 01:01:25 +00:00
Ming Liu 14e93850be sstate: Add ca-certificates-native to postinst recipes list
(From OE-Core rev: a6426479f6348524a904ba28c16c1e3c8793cb08)

Signed-off-by: Ming Liu <peter.x.liu@external.atlascopco.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-16 09:04:23 +00:00
Richard Purdie ae2f3a309f sstate: Ensure populate_lic sstate objects are cleaned
do_cleansstate wasn't cleaning do_populate_lic sstate objects in the
native/cross case since the wildcard path entry wasn't being cleared
at the same time as the path extra prefix. Fix by clearing it at the
same time.

(From OE-Core rev: af72c507f5e20acf64b7431cee989af9908ef199)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-10 16:06:24 +00:00
Richard Purdie 9fd214d2e7 sstate: Fix SSTATE_SWSPEC only used by populate_lic tasks
This variable is only used by populate_lic tasks (gcc-source overrides it)
and refers to BPN. In recipes like gcc, where there are multiple variants,
it is resulting in sstate objects which encode PN (they install into a PN subdir)
but the sstate object reflects BPN. This leads to corruption between then and
eventually, warnings from image builds like:

WARNING: The license listed GPLv3 was not in the licenses collected for recipe gcc
WARNING: The license listed GPL-3.0-with-GCC-exception was not in the licenses collected for recipe gcc
WARNING: The license listed GPLv3 was not in the licenses collected for recipe gcc
WARNING: The license listed NCSA was not in the licenses collected for recipe gcc-sanitizers
WARNING: The license listed MIT was not in the licenses collected for recipe gcc-sanitizers
WARNING: The license listed GPL-3.0-with-GCC-exception was not in the licenses collected for recipe gcc
WARNING: The license listed GPLv3 was not in the licenses collected for recipe gcc
WARNING: The license listed NCSA was not in the licenses collected for recipe gcc-sanitizers

By referring to PN, as used by license.bbclass, this issue is resolved.

(From OE-Core rev: dd4a319efcfa1174ba0f48fd15cb446280c426e4)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-04 23:39:00 +00:00
Richard Purdie 5503a22ad0 sstate: Revert using -m option to tar in sstate
In http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=2d89cff42af2bb0049224bfaaebaa2b21966169f
we added a workaround for dealing with lack of time sync between build
machines and their users.

This has turned out to cause problems for people who rely on timestamps
being preserved in sstate output.

Since our autobuilders are all in time sync with ntp, revert the commit.

[YOCTO #8996]

(From OE-Core rev: 004a8bffdb501a99530dab2bc1c5f3d44b97b8f7)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-01 11:20:19 +00:00
Richard Purdie 2f1bcc1915 sstate: Add back packagedata on packagedata dependencies
(From OE-Core rev: 654f0eec426e882e50f688f6d097d992e34e5b40)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-30 11:37:04 +00:00
Richard Purdie 5410aff5a9 sstate: Improve handling of useradd dependencies
useradd has sstate [depends] for both do_package and do_populate_sysroot
yet the dependency validation code only covers do_package.

Add coverage of populate_sysroot, else the order inversion that [depends]
creates means unexpected installation of users of useradd.bbclass (e.g.
avahi do_populate_sysroot) in cases where it shouldn't be (e.g.
libnss-mdns -c packagedata).

The code needs to move above the other populate_sysroot intercept code
since there are specific cases we need to cover before that code.

The result of this change is more optimal installation of sstate objects
in common usage scenarios.

(From OE-Core rev: 21368b4a7934b3a199e61c1072416fd5c091e5ff)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-30 11:37:03 +00:00
Ross Burton 258676bfa7 sstate: display the sysroot name when cleaning for clarity
When cleaning old builds from the sysroots, also print the sysroot architecture.

(From OE-Core rev: 98a98a4bf71f74b5c27291ee9a2ac14006377e49)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-24 09:40:21 +00:00
Ross Burton 18357688e9 sstate: replace verbose manifest removal with a single count
If there are lots of changes between the previous build and the build about to
start bitbake will potentially print pages of:

  DEBUG: Stamp $BUILD/stamps/corei7-64-poky-linux/libdrm/2.4.66-r0 is not reachable, removing related manifests

Instead of spamming the console with this list, write the list of manifests only
to the debug log and simply write a count to the console.  This way the user
doesn't get spammed but still knows what is happening if bitbake appears to
stall with heavy I/O.

(From OE-Core rev: e777b541c76dad293d1c214e46c00f8f78fe0539)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-19 17:37:35 +00:00