From: Henning Schild <henning.schild@siemens.com>
To: "[ext] Q. Gylstorff" <Quirin.Gylstorff@siemens.com>
Cc: isar-users@googlegroups.com
Subject: Re: [PATCH v2] classes/image-postproc: Add image version
Date: Tue, 21 Apr 2020 20:57:10 +0200 [thread overview]
Message-ID: <20200421205710.6ed85a24@md1za8fc.ad001.siemens.net> (raw)
In-Reply-To: <20200421204939.0ddaa020@md1za8fc.ad001.siemens.net>
On Tue, 21 Apr 2020 20:49:39 +0200
"[ext] Henning Schild" <henning.schild@siemens.com> wrote:
> On Tue, 21 Apr 2020 17:01:34 +0200
> "[ext] Q. Gylstorff" <Quirin.Gylstorff@siemens.com> wrote:
>
> > From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> >
> > Add the image version as additional identifier to /etc/os-release.
> > This allows in a update scenario an easier identification of the
> > the currently used image.
> >
> > Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> > ---
> > meta/classes/image-postproc-extension.bbclass | 9 ++++++++-
> > 1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/meta/classes/image-postproc-extension.bbclass
> > b/meta/classes/image-postproc-extension.bbclass index
> > 7280202..1091fa4 100644 ---
> > a/meta/classes/image-postproc-extension.bbclass +++
> > b/meta/classes/image-postproc-extension.bbclass @@ -4,10 +4,12 @@
> > update_etc_os_release() {
> > OS_RELEASE_BUILD_ID=""
> > OS_RELEASE_VARIANT=""
> > + OS_RELEASE_VARIANT_VERSION=""
> > while true; do
> > case "$1" in
> > --build-id) OS_RELEASE_BUILD_ID=$2; shift ;;
> > --variant) OS_RELEASE_VARIANT=$2; shift ;;
> > + --version) OS_RELEASE_VARIANT_VERSION=$2; shift ;;
> > -*) bbfatal "$0: invalid option specified: $1" ;;
> > *) break ;;
> > esac
> > @@ -24,6 +26,11 @@ update_etc_os_release() {
> > echo "VARIANT=\"${OS_RELEASE_VARIANT}\"" | \
> > sudo tee -a '${IMAGE_ROOTFS}/etc/os-release'
> > fi
> > + if [ -n "${OS_RELEASE_VARIANT_VERSION}" ]; then
> > + sudo sed -i '/^ISAR_IMAGE_VERSION=.*/d'
> > '${IMAGE_ROOTFS}/etc/os-release'
> > + echo "VARIANT_VERSION=\"${PV}\"" | \
> > + sudo tee -a '${IMAGE_ROOTFS}/etc/os-release'
>
> Looking at
> https://www.freedesktop.org/software/systemd/man/os-release.html
>
> VARIANT_VERSION does not show up in the list of
> "The following OS identifications parameters may be set using
> os-release"
>
> So i would conclude we may not use it. I would suggest either finding
> a variable that we may use and debian does not use yet.
>
> Or the layer with the requirement looks at BUILD_ID and sets a custom
> ISAR_RELEASE_CMD to inject their clue.
> Here is an example where people decided to include the date of a build
>
> ISAR_RELEASE_CMD = "echo $(git -C ${LAYERDIR_isar-XXX} describe --long
> --dirty --always) $(date --utc --rfc-3339=seconds)"
In fact the string one would want to match is probably the full
BUILD_ID, if you append your own stuff and do substring matching you
might be looking at multiple BUILD_IDs that all claim to be the same
"version" because you are not bumping the version with every commit.
Henning
> Henning
>
> > + fi
> > }
> >
> > ROOTFS_POSTPROCESS_COMMAND =+ "image_postprocess_configure"
> > @@ -43,7 +50,7 @@ ROOTFS_POSTPROCESS_COMMAND =+
> > "image_postprocess_mark" image_postprocess_mark() {
> > BUILD_ID=$(get_build_id)
> > update_etc_os_release \
> > - --build-id "${BUILD_ID}" --variant "${DESCRIPTION}"
> > + --build-id "${BUILD_ID}" --variant "${DESCRIPTION}"
> > --version "${PV}" }
> >
> > ROOTFS_POSTPROCESS_COMMAND =+ "image_postprocess_machine_id"
>
next prev parent reply other threads:[~2020-04-21 18:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-14 14:46 [PATCH] classes/image_postprocessing: Add variant version to os_release Q. Gylstorff
2020-04-14 14:55 ` Jan Kiszka
2020-04-21 15:01 ` [PATCH v2] classes/image-postproc: Add image version Q. Gylstorff
2020-04-21 18:49 ` Henning Schild
2020-04-21 18:57 ` Henning Schild [this message]
2020-04-21 19:28 ` cedric_hombourger
2020-04-22 8:36 ` Gylstorff Quirin
2020-04-22 10:51 ` Henning Schild
2020-05-07 19:36 ` Baurzhan Ismagulov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200421205710.6ed85a24@md1za8fc.ad001.siemens.net \
--to=henning.schild@siemens.com \
--cc=Quirin.Gylstorff@siemens.com \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox