diff options
author | Patrick Vacek <patrickvacek@gmail.com> | 2019-02-21 16:27:44 +0100 |
---|---|---|
committer | Patrick Vacek <patrickvacek@gmail.com> | 2019-02-21 16:32:49 +0100 |
commit | 202a8c70ba8cdcfb39cf8e2b19a08b5f8850a0f9 (patch) | |
tree | 8bde863e6893fc9c36a84dd18f3152758a95d8fb | |
parent | 3b9b75140ea58f546829cb3cf1b234e5b650de77 (diff) | |
download | meta-updater-202a8c70ba8cdcfb39cf8e2b19a08b5f8850a0f9.tar.gz |
image_types_ostree: Add a unique ref to fix simultaneous bitbaking.fix/OTA-2211/simultaneous-bitbaking
To enable simultaneous bitbaking of two images with the same branch name, create
a new ref in the OSTree repo using the basename of the image.
As @OYTIS has pointed out, this probably won't solve every problem that might
come up with simultaneous bitbaking, such as if the two images use different
bootloaders. However, it does solve the immediate problem that comes up with our
primary-image + secondary-image example.
Signed-off-by: Patrick Vacek <patrickvacek@gmail.com>
-rw-r--r-- | classes/image_types_ostree.bbclass | 12 | ||||
-rw-r--r-- | classes/image_types_ota.bbclass | 2 |
2 files changed, 11 insertions, 3 deletions
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 29da78e..41327e1 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass | |||
@@ -148,6 +148,13 @@ IMAGE_CMD_ostreecommit () { | |||
148 | if [ "${OSTREE_UPDATE_SUMMARY}" = "1" ]; then | 148 | if [ "${OSTREE_UPDATE_SUMMARY}" = "1" ]; then |
149 | ostree --repo=${OSTREE_REPO} summary -u | 149 | ostree --repo=${OSTREE_REPO} summary -u |
150 | fi | 150 | fi |
151 | |||
152 | # To enable simultaneous bitbaking of two images with the same branch name, | ||
153 | # create a new ref in the repo using the basename of the image. (This first | ||
154 | # requires deleting it if it already exists.) Fixes OTA-2211. | ||
155 | ostree --repo=${OSTREE_REPO} refs --delete ${OSTREE_BRANCHNAME}-${IMAGE_BASENAME} | ||
156 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) | ||
157 | ostree --repo=${OSTREE_REPO} refs --create=${OSTREE_BRANCHNAME}-${IMAGE_BASENAME} ${ostree_target_hash} | ||
151 | } | 158 | } |
152 | 159 | ||
153 | IMAGE_TYPEDEP_ostreepush = "ostreecommit" | 160 | IMAGE_TYPEDEP_ostreepush = "ostreecommit" |
@@ -190,7 +197,7 @@ IMAGE_CMD_garagesign () { | |||
190 | --home-dir ${GARAGE_SIGN_REPO} \ | 197 | --home-dir ${GARAGE_SIGN_REPO} \ |
191 | --credentials ${SOTA_PACKED_CREDENTIALS} | 198 | --credentials ${SOTA_PACKED_CREDENTIALS} |
192 | 199 | ||
193 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) | 200 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}-${IMAGE_BASENAME}) |
194 | 201 | ||
195 | # Use OSTree target hash as version if none was provided by the user | 202 | # Use OSTree target hash as version if none was provided by the user |
196 | target_version=${ostree_target_hash} | 203 | target_version=${ostree_target_hash} |
@@ -243,7 +250,8 @@ IMAGE_CMD_garagecheck () { | |||
243 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then | 250 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then |
244 | # if credentials are issued by a server that doesn't support offline signing, exit silently | 251 | # if credentials are issued by a server that doesn't support offline signing, exit silently |
245 | unzip -p ${SOTA_PACKED_CREDENTIALS} root.json targets.pub targets.sec tufrepo.url 2>&1 >/dev/null || exit 0 | 252 | unzip -p ${SOTA_PACKED_CREDENTIALS} root.json targets.pub targets.sec tufrepo.url 2>&1 >/dev/null || exit 0 |
246 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) | 253 | |
254 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}-${IMAGE_BASENAME}) | ||
247 | 255 | ||
248 | garage-check --ref=${ostree_target_hash} \ | 256 | garage-check --ref=${ostree_target_hash} \ |
249 | --credentials=${SOTA_PACKED_CREDENTIALS} \ | 257 | --credentials=${SOTA_PACKED_CREDENTIALS} \ |
diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass index a31cbd1..12375ec 100644 --- a/classes/image_types_ota.bbclass +++ b/classes/image_types_ota.bbclass | |||
@@ -59,7 +59,7 @@ IMAGE_CMD_ota () { | |||
59 | bbfatal "Invalid bootloader: ${OSTREE_BOOTLOADER}" | 59 | bbfatal "Invalid bootloader: ${OSTREE_BOOTLOADER}" |
60 | fi | 60 | fi |
61 | 61 | ||
62 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) | 62 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}-${IMAGE_BASENAME}) |
63 | 63 | ||
64 | ostree --repo=${OTA_SYSROOT}/ostree/repo pull-local --remote=${OSTREE_OSNAME} ${OSTREE_REPO} ${ostree_target_hash} | 64 | ostree --repo=${OTA_SYSROOT}/ostree/repo pull-local --remote=${OSTREE_OSNAME} ${OSTREE_REPO} ${ostree_target_hash} |
65 | kargs_list="" | 65 | kargs_list="" |