aboutsummaryrefslogtreecommitdiffstats
path: root/classes
AgeCommit message (Collapse)Author
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>
2016-04-18Revert "swupdbundle: disable image construction differently"Joshua Lock
This reverts commit a7dddfbfb8f45989856c93c6f82f46d8a96e6f0b. We can't completely disable the do_image task because we need to allow various tasks that run during image creation which affect the rootfs to run.
2016-04-14swupdbundle: disable image construction differentlyJoshua Lock
Mark do_image and do_bootimg as noexec tasks so that they don't run but their task dependency chain is preserved. This prevents an error in swupdbundle image building when an image for the target MACHINE would result in a live image being built. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-04-13swupd-image: also reserve the bundle name fullJoshua Lock
swupd generates and uses a Manifest.full which is a complete manifest of all files in all bundles of the OS. Therefore we should prevent users defining a bundle named 'full' as this would also generate a Manifest.full file and confuse future use of swupd. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-04-13swupd-image: implement image qa checksJoshua Lock
Implement a task which runs after image creation and executes the functions defined in SWUPD_IMAGE_SANITY_CHECKS to validate the constructed image. do_swupd_sanity_check_image() is influenced heavily by the sanity_check_conffiles method in OE-Core's sanity.bbclass. Include a single QA function to start with, disabled by default, which checks whether there are any dangling symlinks in the image — this check is based on code from the Ostro Project by Patrick Ohly. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-04-06swupd-image: make the swupd format number a variableJoshua Lock
The format version isn't static, and indeed will be bumped in the next swupd release. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-04-06swupd-image.bbclass: fix remove of symlinks to directoriesPatrick Ohly
remove_unlisted_files_from_directory() failed to remove unwanted symlinks to directories because it only looked at files, whereas Python lists symlinks to directories as directories. In Ostro OS, that affected for example /usr/lib/perl5 -> perl and was found when adding a QA check for dangling symlinks. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-04-06swupd-image.bbclass: always update rootfs of base imagePatrick Ohly
As a special optimization, updating the rootfs of the base image was skipped if actual image creation was disabled for the base image. However, there are reasons beyond image creation for updating the rootfs, for example to run QA checks on it. Therefore the change gets reverted and the code now only gets skipped for the virtual bundle recipes. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-04-04os-release: patch in OS_VERSION during rootfs creationPatrick Ohly
Changing os-release in a .bbappend is undesirable for two reasons: 1. it changes the content also for images which do not use swupd 2. it causes full rebuilds even when the only thing that changed is the OS_VERSION The latter may or may not be desired, so we should better leave that choice to the user, which is possible by setting VERSION_ID to OS_VERSION in local.conf. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-04-04swupd-image: make debugging function for long-running tasks changeableJoshua Lock
We had a request to print more of the debugging around long-running tasks to the console when using knotty using bbplain. This is undesirable as a default but this patch enables a user to opt-in to this behaviour by setting SWUPD_LOG_FN = "bbplain" producing output like: NOTE: Executing RunQueue Tasks jgl-image-swupd-1.0-r0 do_swupd_update: New OS_VERSION is 20 jgl-image-swupd-1.0-r0 do_swupd_update: Generating update from 0 to 20 jgl-image-swupd-1.0-r0 do_swupd_update: Generating fullfiles for 20 jgl-image-swupd-1.0-r0 do_swupd_update: Generating zero packs, this can take some time. jgl-image-swupd-1.0-r0 do_swupd_update: Generating zero pack for os-core jgl-image-swupd-1.0-r0 do_swupd_update: Generating zero pack for connman jgl-image-swupd-1.0-r0 do_swupd_update: Generating zero pack for server jgl-image-swupd-1.0-r0 do_swupd_update: Generating zero pack for developer NOTE: Tasks Summary: Attempted 2857 tasks of which 2582 didn't need to be rerun and all succeeded. NOTE: Writing buildhistory Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-03-30swupd-image.bbclass: remove assumption about OS version numberingPatrick Ohly
It is not guaranteed that OS versions always increment in steps of 10 and that deltas are desired for "current version - 10, -20, etc.". For example, previous versions might be 10, 20, and the current one 21 because it is a minor update. In such a case no delta packs would be generated because OS versions 11 and 1 do not exist. Ostro OS outside of the CI derives the OS version from datetime, which leads to high version numbers like 33014500. Counting down from that in steps of ten in shell under pseudo was surprisingly slow and unusable, running for minutes without even getting close to completion when it does not hit existing version numbers. So now the simplified approach is to generate delta packs for exactly the last SWUPD_N_DELTAPACK older versions, regardless what their numbering is. If a more sophisticated approach is needed, it can still be added later on, for example as part of YOCTO #9321. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-03-30swupdbundle.bbclass: support -dev bundlesPatrick Ohly
By convention, any bundle called "foobar-dev" is equal to the "foobar" bundle plus the "dev-pkgs" image feature, i.e. it has the same content as the base bundle plus the corresponding development files. Without this feature it is impossible to generate separate bundles for development files; the only option would be to put "dev-pkgs" into the shared image features, which would add development files also to the os-core and all bundles. Using this fixed naming convention was chosen over additional configuration options because a consistent naming automatically gets enforced and it was easier to implement than additional configuration options. A future optimization will be to declare a dependency of the -dev bundle on the base bundle and only provide the additional development files in the -dev bundle. Right now, the -dev bundle is simply a larger variant of the base bundle because all non-development files are present in both bundles. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-03-29bundle images: create .rootfs.manifestPatrick Ohly
Because we skip the normal do_rootfs, the file is not created. But several use cases depend on it, so now we create it based on the manifest files of the individual bundles which get copied into the image. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-03-29swupd-image: don't remove bundle image manifestsJoshua Lock
There are scenarios in which these are useful for use by other parts of this system, not least of all the next patch which uses them to compose a manifest for bundle-based images. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-03-24swupd-image: fix bundle image manifest removalJoshua Lock
The code in 5b48b103b9b940232cf65699db2adcab9c224124 fails to ever delete the manifest symlinks, which causes errors on builds beyond the first. The reason for this is that os.path.exists() on a broken symlink returns False. Fix this by trying to remove the manifest symlink first and then removing the linked to file. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
2016-03-23swupd-image: delete some detailed documentation commentsJoshua Lock
We now have HOWTO.md to describe usage of the layer in detail. Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>