aboutsummaryrefslogtreecommitdiffstats
path: root/classes
AgeCommit message (Collapse)Author
2016-12-08meta-swupd: per-image swupd client configurationPatrick Ohly
The settings affecting the swupd client belong to the image, not the swupd client recipe. That way, different images can use different settings while sharing the same swupd client. Creating the bundles directory was broken in the swupd-client recipe and also not needed because swupd-image.bbclass does it, too. This will also allow implementing better update repo generation (incremental, supporting format changes, etc.) because now swupd-image.bbclass has access to the settings. The installed swupd client must match the format of the update repo for that OS_VERSION. To ensure that, swupd-image.bbclass now adds a dependency on a virtual "swupd-client-format<format number>" and suitable swupd client recipe(s) provide that. Distros then have two ways of choosing a swupd client version, should that ever be necessary: - first they need to override the per-image format default value - then set the preferred swupd client version, if there is more than one for that format TODO: installing the SSL pubkey into the image after a file change does not work. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-12-08meta-swupd: revise delta computationPatrick Ohly
This removes the storing of previous build information in sstate. It was conceptually questionable (sstate is a cache which does not need to be backed up, while the information about previous builds is crucial and must not get lost) and not working: - the -map.inc file wasn't actually included anywhere and thus the old build information wasn't getting restored - restoring all previous builds would have made building slower and slower as the number of previous builds grows - the old build information lacked the www/Manifest files that incremental updates need The replacement puts previous build information into the image deploy directory. That's tentative and also not fully working. The automatic selection of old versions to build deltas against also gets replaced with an explicit choice that has to be made by the user of meta-swupd. That's because in practice, incremental updates are more useful when prepared for the releases that actually run on the target device, like major milestones. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-12-08swupd-image.bbclass: automatically recreate swupd inputs after removing ↵Patrick Ohly
deploy/swupd During development it is useful to wipe out deploy/swupd. This simulates the "start from scratch" situation in the Ostro OS CI. Previously it was necessary to force-run do_stage_swupd_inputs and do_swupd_update after removing the directory, now this is fully automatic. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-12-08swupd-image.bbclass: remove special cases with SWUPD_IMAGE_PNPatrick Ohly
That PN is different in the base image and virtual images led to various places which had to distinguish between the two. We can simplify that by introducing a variable SWUPD_IMAGE_PN which always has the PN value of the base image. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-12-08swupd-image.bbclass: separate pseudo DB for do_swupd_updatePatrick Ohly
do_swupd_update itself unpacks the tar archives that swupd-server needs and therefore does no longer depend on sharing the pseudo database with the other tasks and virtual images. Using a separate pseudo DB speeds up "ostro-image-swupd:do_stage_swupd_inputs ostro-image-swupd:do_swupd_update ostro-image-swupd-dev" (two tasks which run in parallel because both depend on the same full rootfs and which used to share the same pseudo instance) from 25 to 16 minutes. The pseudo data directory is intentionally inside the deploy/swupd directory. There it can be deleted and re-created for testing swupd update generation with: rm -rf tmp*/deploy/swupd bitbake -f <image>:do_stage_swupd_inputs <image>:do_swupd_update Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-12-08fix meta-swupd: avoid splitting up mega rootfsPatrick Ohly
When creating bundle images, we need to know and copy also the entries that we exclude from processing by swupd-server. This could be done with a more complex syntax for the .content.txt files, but that would also make the swupd-server patches more complicated. Instead, an .extra-content.txt gets written alongside the .content.text and meta-swupd uses that when copying files into images. Due to the way how this is implemented, the .extra-content.txt of bundles also lists the files that were excluded from the bundle because they were already in the os-core. This may or may not be desirable. This change also includes some other improvements (consistent use of the helper method, sorting the content of the file lists). Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-12-08swupd-image.bbclass: make sstate-support optional and disabled by defaultPatrick Ohly
Storing the build rootfs in the sstate-cache has drawbacks: - it's questionable whether storing data that cannot be re-created really belongs into a cache which (by definition) should only contain data which may get lost - while it looks attractive to re-use an existing mechanism for sharing data across builds, it's not a complete solution because the map still needs to be carried across builds - using the sstate-cache mechanism adds additional, large copy operations on the critical path towards completing a build - the code isn't quite mature yet, sometimes do_stage_swupd_inputs_setscene fails: sstate_setscene(d) fails: No such file or directory: '.../tmp-glibc/work/qemux86-ostro-linux/ostro-image-swupd/1.0-r0/sstate-install-stage_swupd_inputs/92909520' -> '.../tmp-glibc/work/qemux86-ostro-linux/ostro-image-swupd/1.0-r0/swupd-image/92909520' It might be better to define an explicit "shared build directory" where the current image directory of a build can be stored for future use. In the meantime, disable the mechanism by default to speed up builds inside a CI system (like the one from Ostro) which is not prepared to use the mechanism anyway. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-12-08swupd input: compress with gzPatrick Ohly
Compression with xz is slowing down do_stage_swupd_inputs (on the critical path) by keeping one CPU 100% with xz. gzip compresses faster and (at least for now) on-disk usage matters less than speed. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-12-08meta-swupd: put compressed rootfs into sstatePatrick Ohly
do_stage_swupd_updates works with the entire full tree multiple times: copying into the staging area, packing it as sstate archive, copying to the swupd deploy directory. Copying directory trees is slow, in particular when running under pseudo, and do_stage_swupd_updates is on the critical path for completing a build. Therefore it should be as fast as possible. Storing the directory as compressed archive is faster: it cuts down the time for do_stage_swupd_updates from 11min in the Ostro CI to 6min. This is with xz as compression method, which is suitable for long-term archival (good compression) but a lot slower than gzip (https://www.rootusers.com/gzip-vs-bzip2-vs-xz-performance-comparison/). When favoring speed, using gzip may be better. The long-term goal (dream?) is to have swupd work directly with tar archives, in which case expanding the archive and pseudo could be avoided altogether. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-12-08swupd-image.bbclass: show swupd log outputPatrick Ohly
Include the log output of the swupd tools in the normal stdout/stderr logfile. That way errors are immediately visible when invoked from bitbake and in the Ostro OS CI (which only shows the bitbake output). Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-12-08meta-swupd: fix virtual image dependenciesPatrick Ohly
Sharing of pseudo databases was broken, leading to files with wrong attributes: ${IMAGE_BASENAME} is different among all virtual recipes and thus updating PSEUDO_LOCALSTATEDIR did not have the desired effect. Bundle recipes do not need to copy from anything (and thus they do not depend on the mega image do_image) and also do not need to share the pseudo database, because all that matters is the list of entries in their rootfs. Being very specific about the task dependencies allows more long-running image creation tasks to run in parallel. Distinguishing between the various virtual image recipes and the base image is a bit tricky. Therefore the "(virtual) swupd image recipes" (called so because they get created by swupdimage.bbclass) now unsets BUNDLE_NAME (thus removing the default "os-core" which is set in the base recipe) and the usage of PN, PN_BASE, and BUNDLE_NAME is explained in a comment. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-12-08meta-swupd: avoid splitting up mega rootfsPatrick Ohly
Creating individual bundle directories as input for swupd is a waste of resources and time, because swupd is just going to recreate the "full" tree anyway. With an improved swupd-server, we can just copy the full tree once and then define the content of each bundle with a text file. This replaces the "files-in-image" files. Those were used only by meta-swupd before. They were renamed because they not only list files, but also directories. "content" is a bit more neutral. Creating them is now done in pure Python and integrated with the SWUPD_FILE_BLACKLIST mechanism. That way, the content files are correct right away, which allows removing the post-processing code (for example, sanitise_file_list()). The special mode of obtaining bundle content from the package manager instead of a full rootfs gets dropped for now. If that mode can be shown to be noticably faster then full rootfs creation, then it can be re-added such that it also only produces a content file for the bundle. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-12-08swupd-server: update to 3.2.5 and use libarchive directlyPatrick Ohly
Using libarchive directly avoids one fork/exec per file in swupd-make-fullfiles, which improves performance. Several regressions in the new upstream version had to be fixed as part of the version update. The version got updated to make it easier to upstream the libarchive patch. The latest upstream version actually is 3.2.7, but that version introduces a format change. Updating to that will require further work and preparations. Luckily, the source code patches apply cleanly to 3.2.5 and 3.2.7. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-10-03swupd-image: prevent buildhistory failureJoshua Lock
When buildstats detects TaskSucceeded for a do_rootfs task it will try and determine the size of the rootfs using du, if the rootfs directory isn't present the call to du fails which triggers a bb.error. Since e587c50c2639989d02d282c7a91134d5934eb042 do_rootfs for swumpdimage based virtual images has been an empty function which simply returns as soon as it's invoked, as we populate the rootfs from the mega rootfs contents in do_image. Due to this the rootfs directory wasn't yet present at the time buildstats detects the TaskSucceeded and the subsequent call to du fails. Work around this by creating an empty rootfs directory during do_rootfs in swupdimage. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-09-12swupdimage.bbclass: ensure that do_rootfs gets executedPatrick Ohly
OE-core commit 6d969bacc718e changed do_rootfs so that it creates IMGDEPLOYDIR. That change broke the creation of additional swupd images, because setting do_rootfs to empty caused the entire task to be skipped, including the evaluation of the 'cleandirs' task attribute. It remains to be seen whether that's really the desired behavior (see https://bugzilla.yoctoproject.org/show_bug.cgi?id=10256), but as it is what it is right now, we need to avoid the situation by overwriting do_rootfs with non-empty code that doesn't do anything. That way, the directory gets created. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-08-12swupd-image: Fix files ownership if IMAGE_BASENAME is not defaultPiotr Figiel
In case IMAGE_BASENAME is set on image recipe level the files ownership on target rootfs is incorrect for recipes inheriting swupd-image.bbclass. Depending on the context swupd-image.bbclass used either PN (PN_BASE) or IMAGE_BASENAME when generating path to pseudo shared state directory. This seems correct only when IMAGE_BASENAME is not set as it defaults to PN. This patch resolves above problem. Addresses [YOCTO #10108]. Signed-off-by: Piotr Figiel <p.figiel@camlintechnologies.com> Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-08-10swupd-image: ensure pseudo is staged when requiredJoshua Lock
Ensure pseudo is available in the sysroot for all tasks which have the fakeroot flag by adding virtual/fakeroot-native:do_populate_sysroot to the depends of the tasks. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-07-26swupd-image: switch to OE-Core's image QA mechanismJoshua Lock
Drop and the swupd_sanity_check_image task and related SWUPD_IMAGE_SANITY_CHECKS variable in favour of the recently added OE-Core image QA mechanism. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-07-04Drop use of oe.path.check_output()Joshua Lock
This was a copy-and-paste of the check_output() method of the subprocess module in order to support Python versions prior to 2.7 -- we should just use the method from subprocess directly. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-23swupd-image: improve usability of fetching swupd inputs from sstateJoshua Lock
Improve the usability of fetching swupd inputs from sstate objects by writing all known OS_VERSION-->sstate object hash mappings to a variable assignment in an inc file. Utilising the ability to fetch swupd inputs for previous versions then becomes a simple case of including this file, i.e. in an auto.conf or local.conf. As the inc file is parsed during a build all known mappings, i.e. those loaded from the inc file and a new mapping generated by the current build, will be written to any newly generated inc file during a build. Preventing swupd inputs from OS_VERSIONS from being fetched and staged becomes a simple matter of editing the inc file to remove the no longer required maps. An expected workflow for building new OS_VERSIONS with a CI would be: * copy any existing inc file from previous builds to a conf dir such as ${BUILDDIR}/conf * edit the file to ensure only versions we care about are fetched * ensure that file is included/required by a conf file such as local.conf or auto.conf * build Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-23swupd-image: clean up do_swupd_update inter-task dependenciesJoshua Lock
The addtask line for do_swupd_update contained a task which is no longer defined by swupd-image.bbclass Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-22swupd-image: don't try and sstate stage inputs for derived imagesJoshua Lock
We don't run do_stage_swupd_inputs for derived images, resulting in no sstate object being genereted. Therefore we must also skip do_stage_swupd_inputs_setscene for derived images. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-22swupd-image: ensure SSTATE_MANFILEPREFIX is set for derived imagesJoshua Lock
Ensure the manifest files are written with a uniform filename pattern for all swupd-image derived images. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-13swupd-image: convert a warn to debug, this is now harmlessJoshua Lock
We now ensure the do_swupd_update task is run for the base image as a dependency of the do_swupd_update task for any derivative image. Therefore this message is now informative, rather than indicative of an issue. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-13swupd-image: remove redundant variable assignmentJoshua Lock
We already have a variable which lists all of the bundles for the image including os-core, make use of ALL_BUNDLES instead of assigning a new variable to use. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-13swupd-image: fetch and stage inputs for previous OS_VERSIONSJoshua Lock
This change aims to help support more complex OS development workflows where update artefacts: * may not be sequential * may have been generated on a separate system, or in a separate build directory With this change we now generate a file after the swupd inputs have been staged and an sstate object for the inputs created which maps the OS_VERSION of the build to the name of the sstate object. A new task will read in these 'map' files and try to ensure that the swupd inputs are available before do_swupd_update, first by checking for an sstate objects in SSTATE_DIR and when not present attempting to fetch the object from an sstate mirror, before unpacking the object into the swupd directory for processing. [YOCTO #9321] Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-03swupd-image: fix swupd_replace_hardlinks() for python3Joshua Lock
Dictionaries don't have an iteritems() method in Python 3, use the items() method instead. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-03swupd-image: include manifest files in the shared stateJoshua Lock
The manifest files are used for various things so we must be sure they are available, even if the swupd inputs were staged from a shared state. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-02swupdimage: ensure an update stream is generated when appropriateJoshua Lock
do_swupd_update is skipped for non-core images, however as users may choose to only build a composed os-core + bundles image ensure that the do_swupd_update task for all such images depends on the core do_swupd_update task of the core image. This ensures that the swupd update stream is generated for a new OS release when suitable (i.e. when an update stream doesn't already exist for that OS_VERSION). Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-02swupdimage: fix since the switch to lib/swupd moduleJoshua Lock
swupdimage was not ported when we moved the various helper methods out of swupd-image into the lib/swupd module -- this change rectifies that. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-01swupd-image: mechanism to prevent files entering swupd manifestsJoshua Lock
SWUPD_FILE_BLACKLIST allows a user to list files, with a path in the target rootfs, that they do not wish to be copied into the swupd state directory for processing. This mechanism can be used to prevent files being processed by swupd which should not be tracked in a manifest file and thus not processed by swupd-client. The primary use for this is to exclude files in /etc which are runtime modified (/etc/mtab) or generated at boot (/etc/machine-id) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-01swupd-image: support dummy bundlesJoshua Lock
swupd-client doesn't support bundles being removed from the server, if a bundle receipt still exists on the client but the manifest disapears from the server the client doesn't know how to handle it. Prevent a workaround for this by adding a SWUPD_EMPTY_BUNDLES variable which can be used to continue to provide a manifest entry for a bundle which is otherwise empty. With this workaround the client can update to the empty bundle, removing files that it used to provide (unless they are now provided by an alternative bundle). Note: this was implemented as a separate variable, rather than allowing SWUPD_BUNDLES to be defined without a corresponding BUNDLE_CONTENTS varflag as it is expected the latter is more likely to lead to unexpected results due to accidental misconfiguration. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-01swupd-image: remove redundant checkJoshua Lock
Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-01swupd-image: move various helper methods to lib/swupd moduleJoshua Lock
Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-01swupdimage: change dependency to do_stage_swupd_inputsJoshua Lock
Rather than depend on the base image having been created, instead depend on the swupd inputs having been staged, as this allows us to know that processing of bundle contents has finished. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-01swupd-image: copy only required files to the swupd rootfsJoshua Lock
When implementing cleaner input staging for swupd during #9599 most of the places where we copy the entire mega image contents and then prune unwanted items were removed. This commit removes the final user of copyxattrtree() and remove_unlisted_files_from_directory() by switching swupd_create_rootfs() to using the copyxattrfiles() method. [YOCTO #9325] Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-01swupd-image: fix staging of image-based bundle contentsJoshua Lock
When creating a list of files to copy from the mega-rootfs to stage the contents of a bundle which was determined via a delta between two images, ensure each component of a path is added to the list of files to copy. Otherwise we end up with directories automatically created with the default permissions which may not match the expected permissions. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-01swupd-image: clean up package-manager created bundle chrootsJoshua Lock
Before we generate the bundle contents manifest: * remove package manager artefacts, these never want to end up in a bundle as the final system isn't package-manager enabled. * remove any empty directories created by the package-manager to reduce noise in the bundle manifest. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-01swupd-image: change get_package_manager to match upstream proposalJoshua Lock
Mariano has proposed a similar get_package_manager method to OE-Core, make our local copy match the implementation proposed to OE-Core so that we can just switch to that when it lands. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-01swupd-image: correctly stage bundles where BUNDLE_FEATURES setJoshua Lock
When a bundle sets BUNDLE_FEATURES we can't be certain that there's a distinct mapping from the defined bundle contents to packages we can install into a bundle staging directory. To ensure the bundle contents are correctly staged we switch back to building virtual bundle images for bundles which set BUNDLE_FEATURES and copying only the contents of the built bundle which aren't present in the base image's rootfs as the bundle's swupd inputs. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-01swupd-image: sstate accelerate swupd input stagingJoshua Lock
Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-01swupd-image: improve how swupd inputs are stagedJoshua Lock
The previous process of creating images for each bundle which consisted of the base image plus the bundles contents is resource intensive, especially when a bundle consists of only a few files. Instead of creating bundle images and performing several copies of the entire mega-image rootfs, then pruning it down, we now make use of the package manager to stage the files for non os-core bundles and generate manifests based on the files installed by the package manager. Once the mega image has been built and post-processed the contents are re-copied from the mega rootfs to ensure that the final files in the bundle 'chroot' match the files that will be used to populate the image. This patch refactors all of the logic for deploying the required inputs for swupd (and the do_swupd_update task) into a single task, simplifying the task scheduling for swupd-image significantly. [YOCTO #9599] Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-06-01swupd-image: also write os-core to groups.ini fileJoshua Lock
Based on observation of Clear Linux's Mixer and the fact that swupd-server, since the addition of bundle includes in 3.20, segfaults when loading a manifest for a previous OS release that includes the os-core (the default behaviour since the addition of includes) we infer that it's previously expected and now required to include the os-core bundle in the groups.ini file. With this change generating updates beyond the first using swupd-server v3.x no longer causes swupd_create_update to segfault. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-05-04swupdbundle.class: fix image features of mega bundlePatrick Ohly
The looping checking the individual bundles used the wrong variable name and thus failed to gather all additional image features from the individual bundles. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-04-27swupdbundle.bbclass: support arbitrary bundle featuresPatrick Ohly
Choosing bundle features based on some (rather arbitrary) bundle name suffix does not scale. Currently it does not support ptest-pkgs and dbg-pkgs. Adding support for those via bundle name suffix would become rather awkward. So instead we now allow (and require!) that bundle features for a bundle named "foo" are set explicitly in BUNDLE_FEATURES[foo]. The corresponding content has to be in BUNDLE_CONTENTS[foo]. There's no sanity checking that features listed there are really suitable for a bundle. Features adding content (like ptest-pkgs, dbg-pkgs, dev-pkgs) are okay, features changing the os-core are not (like debug-tweaks). This cannot be checked automatically by meta-swupd because there is no definite list of acceptable features. This is an API change. Users of meta-swupd need to be adapted. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-04-26swupd-image: remove unrequired utilities from IMAGE_INSTALLkrogothJoshua Lock
Now that we are using libarchive and bsdtar it is not necessary to ensure the full versions of gzip, bzip2, tar and xz are included in all swupd using images. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-04-26swupd-image: ensure bsdiff-native is in the native sysrootJoshua Lock
When using swupd-server 3.x bsdiff native is required at runtime, ensure it is available in the native sysroot as a dependency of the do_swupd_update task. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-04-22swupd-image: weak assign default value for SWUPD_FORMATJoshua Lock
This makes it easier to override for consumers of the class. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-04-21swupd-image: set weak default for SWUPD_IMAGE_SANITY_CHECKSJoshua Lock
This makes it simpler for a consumer of the layer to override or append to the value (i.e. using += as is commonly done). Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-04-18swupdbundle: don't try and build bootimgJoshua Lock
We already unset IMAGE_FSTYPES to prevent any images being written for the transient bundle images. As a logical follow on from that change, and to prevent issues when trying to build for a MACHINE which supports live images (due to the automatic inference of live image support via build_live() in image.bbclass), delete the do_bootimg task for bundle images. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>