* [cip-dev] [isar-cip-core][PATCH] classes/image_uuid: Generate new uuid if a new package is added
@ 2020-09-18 8:04 Quirin Gylstorff
2020-09-18 12:21 ` Jan Kiszka
0 siblings, 1 reply; 5+ messages in thread
From: Quirin Gylstorff @ 2020-09-18 8:04 UTC (permalink / raw)
To: cip-dev, Jan.Kiszka; +Cc: Quirin Gylstorff
[-- Attachment #1: Type: text/plain, Size: 1812 bytes --]
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
BB_BASEHASH only includes the task itself and its metadata.
Dependencies are not taken into account when this hash is
generated which means updating a package will not generate a new
UUID.
BB_TASKHASH takes the changes into account.
Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
classes/image_uuid.bbclass | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/classes/image_uuid.bbclass b/classes/image_uuid.bbclass
index d5337b8..873abc5 100644
--- a/classes/image_uuid.bbclass
+++ b/classes/image_uuid.bbclass
@@ -9,23 +9,23 @@
# SPDX-License-Identifier: MIT
#
-def generate_image_uuid(d):
- import uuid
+IMAGE_UUID ?= "random"
- base_hash = d.getVar("BB_BASEHASH_task-do_rootfs_install", True)
- if base_hash is None:
- return None
- return str(uuid.UUID(base_hash[:32], version=4))
-
-IMAGE_UUID ?= "${@generate_image_uuid(d)}"
+IMAGE_UUID_NAMESPACE = "6090f47e-b068-475c-b125-7be7c24cdd4e"
do_generate_image_uuid[vardeps] += "IMAGE_UUID"
do_generate_image_uuid[depends] = "buildchroot-target:do_build"
+IMAGER_INSTALL += "uuid-runtime"
do_generate_image_uuid() {
+ image_do_mounts
+ if [ "${IMAGE_UUID}" != "random" ]; then
+ IMAGE_UUID_FINAL="${IMAGE_UUID}"
+ else
+ IMAGE_UUID_FINAL="$(sudo -E chroot ${BUILDCHROOT_DIR} uuidgen -s -n "${IMAGE_UUID_NAMESPACE}" -N "${BB_TASKHASH}")"
+ fi
sudo sed -i '/^IMAGE_UUID=.*/d' '${IMAGE_ROOTFS}/etc/os-release'
- echo "IMAGE_UUID=\"${IMAGE_UUID}\"" | \
+ echo "IMAGE_UUID=\"${IMAGE_UUID_FINAL}\"" | \
sudo tee -a '${IMAGE_ROOTFS}/etc/os-release'
- image_do_mounts
# update initramfs to add uuid
sudo chroot '${IMAGE_ROOTFS}' update-initramfs -u
--
2.20.1
[-- Attachment #2: Type: text/plain, Size: 420 bytes --]
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#5462): https://lists.cip-project.org/g/cip-dev/message/5462
Mute This Topic: https://lists.cip-project.org/mt/76926695/4520388
Group Owner: cip-dev+owner@lists.cip-project.org
Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129055/727948398/xyzzy [cip-dev@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [cip-dev] [isar-cip-core][PATCH] classes/image_uuid: Generate new uuid if a new package is added
2020-09-18 8:04 [cip-dev] [isar-cip-core][PATCH] classes/image_uuid: Generate new uuid if a new package is added Quirin Gylstorff
@ 2020-09-18 12:21 ` Jan Kiszka
2020-11-25 8:44 ` [cip-dev] [isar-cip-core][PATCH v2] " Quirin Gylstorff
2020-11-25 9:02 ` [cip-dev] [isar-cip-core][PATCH] " Quirin Gylstorff
0 siblings, 2 replies; 5+ messages in thread
From: Jan Kiszka @ 2020-09-18 12:21 UTC (permalink / raw)
To: Q. Gylstorff, cip-dev
[-- Attachment #1: Type: text/plain, Size: 2697 bytes --]
On 18.09.20 10:04, Q. Gylstorff wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>
> BB_BASEHASH only includes the task itself and its metadata.
> Dependencies are not taken into account when this hash is
> generated which means updating a package will not generate a new
> UUID.
>
> BB_TASKHASH takes the changes into account.
>
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
> classes/image_uuid.bbclass | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/classes/image_uuid.bbclass b/classes/image_uuid.bbclass
> index d5337b8..873abc5 100644
> --- a/classes/image_uuid.bbclass
> +++ b/classes/image_uuid.bbclass
> @@ -9,23 +9,23 @@
> # SPDX-License-Identifier: MIT
> #
>
> -def generate_image_uuid(d):
> - import uuid
> +IMAGE_UUID ?= "random"
Why not using an undefined or empty IMAGE_UUID as "generate me one"
indication?
>
> - base_hash = d.getVar("BB_BASEHASH_task-do_rootfs_install", True)
> - if base_hash is None:
> - return None
> - return str(uuid.UUID(base_hash[:32], version=4))
> -
> -IMAGE_UUID ?= "${@generate_image_uuid(d)}"
> +IMAGE_UUID_NAMESPACE = "6090f47e-b068-475c-b125-7be7c24cdd4e"
Is that namespace random, or does that have specific meaning?
>
> do_generate_image_uuid[vardeps] += "IMAGE_UUID"
> do_generate_image_uuid[depends] = "buildchroot-target:do_build"
> +IMAGER_INSTALL += "uuid-runtime"
Please separate variable for job definitions be a blank line. Also the
job specifications above should be visually separated from the code
below that way. IOW:
IMAGER_INSTALL += "uuid-runtime"
do_generate_image_uuid[vardeps] += "IMAGE_UUID"
do_generate_image_uuid[depends] = "buildchroot-target:do_build"
do_generate_image_uuid() {
> do_generate_image_uuid() {
> + image_do_mounts
> + if [ "${IMAGE_UUID}" != "random" ]; then
> + IMAGE_UUID_FINAL="${IMAGE_UUID}"
> + else
> + IMAGE_UUID_FINAL="$(sudo -E chroot ${BUILDCHROOT_DIR} uuidgen -s -n "${IMAGE_UUID_NAMESPACE}" -N "${BB_TASKHASH}")"
Why do we need to switch to uuidgen from the buildchroot, rather than
using python's uuid?
And what ensures that uuidgen is available there?
> + fi
> sudo sed -i '/^IMAGE_UUID=.*/d' '${IMAGE_ROOTFS}/etc/os-release'
> - echo "IMAGE_UUID=\"${IMAGE_UUID}\"" | \
> + echo "IMAGE_UUID=\"${IMAGE_UUID_FINAL}\"" | \
> sudo tee -a '${IMAGE_ROOTFS}/etc/os-release'
> - image_do_mounts
>
> # update initramfs to add uuid
> sudo chroot '${IMAGE_ROOTFS}' update-initramfs -u
>
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
[-- Attachment #2: Type: text/plain, Size: 420 bytes --]
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#5463): https://lists.cip-project.org/g/cip-dev/message/5463
Mute This Topic: https://lists.cip-project.org/mt/76926695/4520388
Group Owner: cip-dev+owner@lists.cip-project.org
Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129055/727948398/xyzzy [cip-dev@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 5+ messages in thread
* [cip-dev] [isar-cip-core][PATCH v2] classes/image_uuid: Generate new uuid if a new package is added
2020-09-18 12:21 ` Jan Kiszka
@ 2020-11-25 8:44 ` Quirin Gylstorff
2020-11-26 7:28 ` Jan Kiszka
2020-11-25 9:02 ` [cip-dev] [isar-cip-core][PATCH] " Quirin Gylstorff
1 sibling, 1 reply; 5+ messages in thread
From: Quirin Gylstorff @ 2020-11-25 8:44 UTC (permalink / raw)
To: cip-dev, Jan.Kiszka; +Cc: Quirin Gylstorff
[-- Attachment #1: Type: text/plain, Size: 902 bytes --]
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
BB_BASEHASH only includes the task itself and its metadata.
Dependencies are not taken into account when this hash is
generated which means updating a package will not generate a new
UUID.
BB_TASKHASH takes the changes into account.
Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
classes/image_uuid.bbclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/classes/image_uuid.bbclass b/classes/image_uuid.bbclass
index d5337b8..2813ed9 100644
--- a/classes/image_uuid.bbclass
+++ b/classes/image_uuid.bbclass
@@ -12,7 +12,7 @@
def generate_image_uuid(d):
import uuid
- base_hash = d.getVar("BB_BASEHASH_task-do_rootfs_install", True)
+ base_hash = d.getVar("BB_TASKHASH", True)
if base_hash is None:
return None
return str(uuid.UUID(base_hash[:32], version=4))
--
2.20.1
[-- Attachment #2: Type: text/plain, Size: 420 bytes --]
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#5871): https://lists.cip-project.org/g/cip-dev/message/5871
Mute This Topic: https://lists.cip-project.org/mt/78496128/4520388
Group Owner: cip-dev+owner@lists.cip-project.org
Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129055/727948398/xyzzy [cip-dev@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [cip-dev] [isar-cip-core][PATCH] classes/image_uuid: Generate new uuid if a new package is added
2020-09-18 12:21 ` Jan Kiszka
2020-11-25 8:44 ` [cip-dev] [isar-cip-core][PATCH v2] " Quirin Gylstorff
@ 2020-11-25 9:02 ` Quirin Gylstorff
1 sibling, 0 replies; 5+ messages in thread
From: Quirin Gylstorff @ 2020-11-25 9:02 UTC (permalink / raw)
To: Jan Kiszka, cip-dev
[-- Attachment #1: Type: text/plain, Size: 3147 bytes --]
On 9/18/20 2:21 PM, Jan Kiszka wrote:
> On 18.09.20 10:04, Q. Gylstorff wrote:
>> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>>
>> BB_BASEHASH only includes the task itself and its metadata.
>> Dependencies are not taken into account when this hash is
>> generated which means updating a package will not generate a new
>> UUID.
>>
>> BB_TASKHASH takes the changes into account.
>>
>> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>> ---
>> classes/image_uuid.bbclass | 20 ++++++++++----------
>> 1 file changed, 10 insertions(+), 10 deletions(-)
>>
>> diff --git a/classes/image_uuid.bbclass b/classes/image_uuid.bbclass
>> index d5337b8..873abc5 100644
>> --- a/classes/image_uuid.bbclass
>> +++ b/classes/image_uuid.bbclass
>> @@ -9,23 +9,23 @@
>> # SPDX-License-Identifier: MIT
>> #
>> -def generate_image_uuid(d):
>> - import uuid
>> +IMAGE_UUID ?= "random"
>
> Why not using an undefined or empty IMAGE_UUID as "generate me one"
> indication?
I will try to use the previous version after testing it has the same
effect as this patch.
>
>> - base_hash = d.getVar("BB_BASEHASH_task-do_rootfs_install", True)
>> - if base_hash is None:
>> - return None
>> - return str(uuid.UUID(base_hash[:32], version=4))
>> -
>> -IMAGE_UUID ?= "${@generate_image_uuid(d)}"
>> +IMAGE_UUID_NAMESPACE = "6090f47e-b068-475c-b125-7be7c24cdd4e"
>
> Is that namespace random, or does that have specific meaning?
The namespace is random.
>
>> do_generate_image_uuid[vardeps] += "IMAGE_UUID"
>> do_generate_image_uuid[depends] = "buildchroot-target:do_build"
>> +IMAGER_INSTALL += "uuid-runtime"
>
> Please separate variable for job definitions be a blank line. Also the
> job specifications above should be visually separated from the code
> below that way. IOW:
>
> IMAGER_INSTALL += "uuid-runtime"
>
> do_generate_image_uuid[vardeps] += "IMAGE_UUID"
> do_generate_image_uuid[depends] = "buildchroot-target:do_build"
>
> do_generate_image_uuid() {
>
Replace with a sipmler version in v2.
>> do_generate_image_uuid() {
>> + image_do_mounts
>> + if [ "${IMAGE_UUID}" != "random" ]; then
>> + IMAGE_UUID_FINAL="${IMAGE_UUID}"
>> + else
>> + IMAGE_UUID_FINAL="$(sudo -E chroot ${BUILDCHROOT_DIR} uuidgen
>> -s -n "${IMAGE_UUID_NAMESPACE}" -N "${BB_TASKHASH}")"
>
> Why do we need to switch to uuidgen from the buildchroot, rather than
> using python's uuid?
>
> And what ensures that uuidgen is available there?
I switch back to python to avoid unnecassary package installations.
See v2.
>
>> + fi
>> sudo sed -i '/^IMAGE_UUID=.*/d' '${IMAGE_ROOTFS}/etc/os-release'
>> - echo "IMAGE_UUID=\"${IMAGE_UUID}\"" | \
>> + echo "IMAGE_UUID=\"${IMAGE_UUID_FINAL}\"" | \
>> sudo tee -a '${IMAGE_ROOTFS}/etc/os-release'
>> - image_do_mounts
>> # update initramfs to add uuid
>> sudo chroot '${IMAGE_ROOTFS}' update-initramfs -u
>>
>
> Jan
>
Quirin
[-- Attachment #2: Type: text/plain, Size: 420 bytes --]
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#5877): https://lists.cip-project.org/g/cip-dev/message/5877
Mute This Topic: https://lists.cip-project.org/mt/76926695/4520388
Group Owner: cip-dev+owner@lists.cip-project.org
Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129055/727948398/xyzzy [cip-dev@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [cip-dev] [isar-cip-core][PATCH v2] classes/image_uuid: Generate new uuid if a new package is added
2020-11-25 8:44 ` [cip-dev] [isar-cip-core][PATCH v2] " Quirin Gylstorff
@ 2020-11-26 7:28 ` Jan Kiszka
0 siblings, 0 replies; 5+ messages in thread
From: Jan Kiszka @ 2020-11-26 7:28 UTC (permalink / raw)
To: Q. Gylstorff, cip-dev
[-- Attachment #1: Type: text/plain, Size: 1079 bytes --]
On 25.11.20 09:44, Q. Gylstorff wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
>
> BB_BASEHASH only includes the task itself and its metadata.
> Dependencies are not taken into account when this hash is
> generated which means updating a package will not generate a new
> UUID.
>
> BB_TASKHASH takes the changes into account.
>
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
> classes/image_uuid.bbclass | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/classes/image_uuid.bbclass b/classes/image_uuid.bbclass
> index d5337b8..2813ed9 100644
> --- a/classes/image_uuid.bbclass
> +++ b/classes/image_uuid.bbclass
> @@ -12,7 +12,7 @@
> def generate_image_uuid(d):
> import uuid
>
> - base_hash = d.getVar("BB_BASEHASH_task-do_rootfs_install", True)
> + base_hash = d.getVar("BB_TASKHASH", True)
> if base_hash is None:
> return None
> return str(uuid.UUID(base_hash[:32], version=4))
>
Thanks, applied.
Jan
--
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
[-- Attachment #2: Type: text/plain, Size: 420 bytes --]
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#5881): https://lists.cip-project.org/g/cip-dev/message/5881
Mute This Topic: https://lists.cip-project.org/mt/78496128/4520388
Group Owner: cip-dev+owner@lists.cip-project.org
Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129055/727948398/xyzzy [cip-dev@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-11-26 7:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18 8:04 [cip-dev] [isar-cip-core][PATCH] classes/image_uuid: Generate new uuid if a new package is added Quirin Gylstorff
2020-09-18 12:21 ` Jan Kiszka
2020-11-25 8:44 ` [cip-dev] [isar-cip-core][PATCH v2] " Quirin Gylstorff
2020-11-26 7:28 ` Jan Kiszka
2020-11-25 9:02 ` [cip-dev] [isar-cip-core][PATCH] " Quirin Gylstorff
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).