summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Gerasimov <anton.gerasimov@here.com>2018-09-04 16:56:01 +0200
committerAnton Gerasimov <anton.gerasimov@here.com>2018-09-04 16:56:01 +0200
commit2db3eed2699c9e8b147926480a6b9fe00a36a4c6 (patch)
treedbe6a7abda40785b77435410da62c33cd9ea32d3
parenta2bb8a02a982e6fdbcd272af984da90807399be9 (diff)
downloadmeta-updater-2db3eed2699c9e8b147926480a6b9fe00a36a4c6.tar.gz
Provide example for setting UPTANE target version automaticallyfeat/targetversion
-rw-r--r--classes/image_types_ostree.bbclass4
-rw-r--r--classes/target_version_example.bbclass11
2 files changed, 14 insertions, 1 deletions
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass
index bc44e33..1ac848d 100644
--- a/classes/image_types_ostree.bbclass
+++ b/classes/image_types_ostree.bbclass
@@ -178,7 +178,7 @@ IMAGE_CMD_ostreepush () {
178} 178}
179 179
180IMAGE_TYPEDEP_garagesign = "ostreepush" 180IMAGE_TYPEDEP_garagesign = "ostreepush"
181do_image_garage_sign[depends] += "aktualizr-native:do_populate_sysroot" 181do_image_garagesign[depends] += "aktualizr-native:do_populate_sysroot"
182IMAGE_CMD_garagesign () { 182IMAGE_CMD_garagesign () {
183 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then 183 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then
184 # if credentials are issued by a server that doesn't support offline signing, exit silently 184 # if credentials are issued by a server that doesn't support offline signing, exit silently
@@ -204,6 +204,8 @@ IMAGE_CMD_garagesign () {
204 target_version=${ostree_target_hash} 204 target_version=${ostree_target_hash}
205 if [ -n "${GARAGE_TARGET_VERSION}" ]; then 205 if [ -n "${GARAGE_TARGET_VERSION}" ]; then
206 target_version=${GARAGE_TARGET_VERSION} 206 target_version=${GARAGE_TARGET_VERSION}
207 elif [ -e "${STAGING_DATADIR_NATIVE}/target_version" ]; then
208 target_version=$(cat "${STAGING_DATADIR_NATIVE}/target_version")
207 fi 209 fi
208 210
209 # Push may fail due to race condition when multiple build machines try to push simultaneously 211 # Push may fail due to race condition when multiple build machines try to push simultaneously
diff --git a/classes/target_version_example.bbclass b/classes/target_version_example.bbclass
new file mode 100644
index 0000000..5adf159
--- /dev/null
+++ b/classes/target_version_example.bbclass
@@ -0,0 +1,11 @@
1# Writes uses repo manifest version as a target version
2#
3
4HOSTTOOLS += " git "
5
6deploy_target_version () {
7 version=$(git --git-dir=${METADIR}/.repo/manifests/.git/ rev-parse HEAD)
8 echo -n ${version} > ${STAGING_DATADIR_NATIVE}/target_version
9}
10
11IMAGE_PREPROCESS_COMMAND += "deploy_target_version;"