aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2016-03-31 14:38:01 +0200
committerJoshua Lock <joshua.g.lock@intel.com>2016-04-04 10:48:06 +0100
commit67940870ae02f58fae942b61b89aeae574a1a0d1 (patch)
treedb7b7515b2964a261b419d61829b3b3c681b8978
parentaa56d26091a61a5231e57833620a0c65ed8cb5b2 (diff)
downloadmeta-swupd-67940870ae02f58fae942b61b89aeae574a1a0d1.tar.gz
meta-swupd-67940870ae02f58fae942b61b89aeae574a1a0d1.tar.bz2
meta-swupd-67940870ae02f58fae942b61b89aeae574a1a0d1.zip
os-release: patch in OS_VERSION during rootfs creation
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>
-rw-r--r--classes/swupd-image.bbclass20
-rw-r--r--recipes-core/swupd-client/os-release.bbappend4
2 files changed, 20 insertions, 4 deletions
diff --git a/classes/swupd-image.bbclass b/classes/swupd-image.bbclass
index 006ca63..436ab2d 100644
--- a/classes/swupd-image.bbclass
+++ b/classes/swupd-image.bbclass
@@ -530,3 +530,23 @@ python swupd_replace_hardlinks () {
os.symlink(reltarget, path)
}
ROOTFS_POSTPROCESS_COMMAND += "swupd_replace_hardlinks; "
+
+# swupd-client checks VERSION_ID, which must match the OS_VERSION
+# used for generating swupd bundles in the current build.
+#
+# We patch this during image creation and exclude OS_VERSION from the
+# dependencies because doing it during the compilation of os-release.bb
+# would trigger a rebuild even if all that changed is the OS_VERSION.
+# It would also affect builds of images where swupd is not active. Both
+# is undesirable.
+#
+# If triggering a rebuild on each OS_VERSION change is desired,
+# then this can be achieved by influencing the os-release package
+# by setting in local.conf:
+# VERSION_ID = "${OS_VERSION}"
+
+swupd_patch_os_release () {
+ sed -i -e 's/^VERSION_ID *=.*/VERSION_ID="${OS_VERSION}"/' ${IMAGE_ROOTFS}/usr/lib/os-release
+}
+swupd_patch_os_release[vardepsexclude] = "OS_VERSION"
+ROOTFS_POSTPROCESS_COMMAND += "swupd_patch_os_release; "
diff --git a/recipes-core/swupd-client/os-release.bbappend b/recipes-core/swupd-client/os-release.bbappend
index 69cb7c5..f73f861 100644
--- a/recipes-core/swupd-client/os-release.bbappend
+++ b/recipes-core/swupd-client/os-release.bbappend
@@ -1,7 +1,3 @@
-# swupd-client checks VERSION_ID, which must match the OS_VERSION
-# used for generating swupd bundles in the current build.
-VERSION_ID = "${OS_VERSION}"
-
FILES_${PN}_append = " /usr/lib/os-release "
# As swupd-client doesn't update files in /etc move os-release's