diff mbox series

[09/14] image-artifact-names: add IMAGE_MACHINE_SUFFIX variable

Message ID 06c7db2b170b9cf47c803ea12c83b58f886074b2.1678709427.git.Martin.Jansa@gmail.com
State Accepted, archived
Commit 6e82c394e98d57a2fe73e547922477cd6b0620f9
Headers show
Series [01/14] git-submodule-test: disable upstream version check | expand

Commit Message

Martin Jansa March 13, 2023, 12:15 p.m. UTC
* to make it easier for projects to avoid default -${MACHINE} suffix if
  the ${MACHINE} named DEPLOY_DIR_IMAGE works better for them

* also use IMAGE_LINK_NAME in IMAGE_NAME to make it more clear
  that IMAGE_NAME is the same as IMAGE_LINK_NAME but with version
  suffix

* adding it as separate variable helps us to catch the cases
  where we didn't respect ${IMAGE_LINK_NAME} variable and just used
  the common default ${IMAGE_BASENAME}-${MACHINE}.

[YOCTO #12937]

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 meta/classes-recipe/image-artifact-names.bbclass  | 15 ++++++++++++---
 meta/classes-recipe/kernel-artifact-names.bbclass |  2 +-
 2 files changed, 13 insertions(+), 4 deletions(-)

Comments

Paul Eggleton April 18, 2023, 10:43 p.m. UTC | #1
Hi Martin

On Tuesday, 14 March 2023 01:15:36 NZST Martin Jansa wrote:
> * to make it easier for projects to avoid default -${MACHINE} suffix if
>   the ${MACHINE} named DEPLOY_DIR_IMAGE works better for them
> 
> * also use IMAGE_LINK_NAME in IMAGE_NAME to make it more clear
>   that IMAGE_NAME is the same as IMAGE_LINK_NAME but with version
>   suffix
> 
> * adding it as separate variable helps us to catch the cases
>   where we didn't respect ${IMAGE_LINK_NAME} variable and just used
>   the common default ${IMAGE_BASENAME}-${MACHINE}.
> 
> [YOCTO #12937]
> 
> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
> ---
>  meta/classes-recipe/image-artifact-names.bbclass  | 15 ++++++++++++---
>  meta/classes-recipe/kernel-artifact-names.bbclass |  2 +-
>  2 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/meta/classes-recipe/image-artifact-names.bbclass
> b/meta/classes-recipe/image-artifact-names.bbclass index
> 9dc25b6dde..ac2376d59a 100644
> --- a/meta/classes-recipe/image-artifact-names.bbclass
> +++ b/meta/classes-recipe/image-artifact-names.bbclass
> @@ -11,11 +11,20 @@
>  IMAGE_BASENAME ?= "${PN}"
>  IMAGE_VERSION_SUFFIX ?= "-${DATETIME}"
>  IMAGE_VERSION_SUFFIX[vardepsexclude] += "DATETIME SOURCE_DATE_EPOCH"
> -IMAGE_NAME ?= "${IMAGE_BASENAME}-${MACHINE}${IMAGE_VERSION_SUFFIX}"
> -IMAGE_LINK_NAME ?= "${IMAGE_BASENAME}-${MACHINE}"
> +IMAGE_NAME ?= "${IMAGE_LINK_NAME}${IMAGE_VERSION_SUFFIX}"
> +IMAGE_LINK_NAME ?= "${IMAGE_BASENAME}${IMAGE_MACHINE_SUFFIX}"

So there's a minor unfortunate side-effect of this in that you can no longer 
just set IMAGE_LINK_NAME = "" to drop the symlinks - a minority use case, but 
something I have used. Of course you can just re-set the value of IMAGE_NAME. 
I am making a note in the manual and migration guide.

Cheers
Paul
Martin Jansa May 11, 2023, 7:41 a.m. UTC | #2
Hi Paul,

I'm sorry about that, will make sure this is supported again in final state
with all [YOCTO #12937] changes where the *_NAME and *_LINK_NAME variables
are reversed:

-IMAGE_NAME ?= "${IMAGE_LINK_NAME}${IMAGE_VERSION_SUFFIX}"
-IMAGE_LINK_NAME ?=
"${IMAGE_BASENAME}${IMAGE_MACHINE_SUFFIX}${IMAGE_NAME_SUFFIX}"
+IMAGE_NAME ?=
"${IMAGE_BASENAME}${IMAGE_MACHINE_SUFFIX}${IMAGE_NAME_SUFFIX}"
+IMAGE_LINK_NAME ?= "${IMAGE_NAME}${IMAGE_VERSION_SUFFIX}"

and versioned hardlinks (instead of symlinks) *_LINK_NAME are created by
separate task. Which will respect *_LINK_NAME variables being set to empty
to disable creating them.

I've just added another commit to my [YOCTO #12937] staging branch
https://git.openembedded.org/openembedded-core-contrib/log/?h=jansa/artifacts
to respect empty *_LINK_NAME variables also for kernel artifacts.

Cheers,

On Wed, Apr 19, 2023 at 12:43 AM Paul Eggleton <
bluelightning@bluelightning.org> wrote:

> Hi Martin
>
> On Tuesday, 14 March 2023 01:15:36 NZST Martin Jansa wrote:
> > * to make it easier for projects to avoid default -${MACHINE} suffix if
> >   the ${MACHINE} named DEPLOY_DIR_IMAGE works better for them
> >
> > * also use IMAGE_LINK_NAME in IMAGE_NAME to make it more clear
> >   that IMAGE_NAME is the same as IMAGE_LINK_NAME but with version
> >   suffix
> >
> > * adding it as separate variable helps us to catch the cases
> >   where we didn't respect ${IMAGE_LINK_NAME} variable and just used
> >   the common default ${IMAGE_BASENAME}-${MACHINE}.
> >
> > [YOCTO #12937]
> >
> > Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
> > ---
> >  meta/classes-recipe/image-artifact-names.bbclass  | 15 ++++++++++++---
> >  meta/classes-recipe/kernel-artifact-names.bbclass |  2 +-
> >  2 files changed, 13 insertions(+), 4 deletions(-)
> >
> > diff --git a/meta/classes-recipe/image-artifact-names.bbclass
> > b/meta/classes-recipe/image-artifact-names.bbclass index
> > 9dc25b6dde..ac2376d59a 100644
> > --- a/meta/classes-recipe/image-artifact-names.bbclass
> > +++ b/meta/classes-recipe/image-artifact-names.bbclass
> > @@ -11,11 +11,20 @@
> >  IMAGE_BASENAME ?= "${PN}"
> >  IMAGE_VERSION_SUFFIX ?= "-${DATETIME}"
> >  IMAGE_VERSION_SUFFIX[vardepsexclude] += "DATETIME SOURCE_DATE_EPOCH"
> > -IMAGE_NAME ?= "${IMAGE_BASENAME}-${MACHINE}${IMAGE_VERSION_SUFFIX}"
> > -IMAGE_LINK_NAME ?= "${IMAGE_BASENAME}-${MACHINE}"
> > +IMAGE_NAME ?= "${IMAGE_LINK_NAME}${IMAGE_VERSION_SUFFIX}"
> > +IMAGE_LINK_NAME ?= "${IMAGE_BASENAME}${IMAGE_MACHINE_SUFFIX}"
>
> So there's a minor unfortunate side-effect of this in that you can no
> longer
> just set IMAGE_LINK_NAME = "" to drop the symlinks - a minority use case,
> but
> something I have used. Of course you can just re-set the value of
> IMAGE_NAME.
> I am making a note in the manual and migration guide.
>
> Cheers
> Paul
>
>
>
>
>
Martin Jansa Nov. 28, 2023, 10:41 a.m. UTC | #3
Hi Paul,

this was fixed in:
https://patchwork.yoctoproject.org/project/oe-core/list/?series=19541
please check it and share your opinion about these changes, otherwise it
won't get merged and https://bugzilla.yoctoproject.org/show_bug.cgi?id=12937
will be closed as "won't fix".

Cheers,

On Thu, May 11, 2023 at 9:41 AM Martin Jansa <martin.jansa@gmail.com> wrote:

> Hi Paul,
>
> I'm sorry about that, will make sure this is supported again in final
> state with all [YOCTO #12937] changes where the *_NAME and *_LINK_NAME
> variables are reversed:
>
> -IMAGE_NAME ?= "${IMAGE_LINK_NAME}${IMAGE_VERSION_SUFFIX}"
> -IMAGE_LINK_NAME ?=
> "${IMAGE_BASENAME}${IMAGE_MACHINE_SUFFIX}${IMAGE_NAME_SUFFIX}"
> +IMAGE_NAME ?=
> "${IMAGE_BASENAME}${IMAGE_MACHINE_SUFFIX}${IMAGE_NAME_SUFFIX}"
> +IMAGE_LINK_NAME ?= "${IMAGE_NAME}${IMAGE_VERSION_SUFFIX}"
>
> and versioned hardlinks (instead of symlinks) *_LINK_NAME are created by
> separate task. Which will respect *_LINK_NAME variables being set to empty
> to disable creating them.
>
> I've just added another commit to my [YOCTO #12937] staging branch
> https://git.openembedded.org/openembedded-core-contrib/log/?h=jansa/artifacts
> to respect empty *_LINK_NAME variables also for kernel artifacts.
>
> Cheers,
>
> On Wed, Apr 19, 2023 at 12:43 AM Paul Eggleton <
> bluelightning@bluelightning.org> wrote:
>
>> Hi Martin
>>
>> On Tuesday, 14 March 2023 01:15:36 NZST Martin Jansa wrote:
>> > * to make it easier for projects to avoid default -${MACHINE} suffix if
>> >   the ${MACHINE} named DEPLOY_DIR_IMAGE works better for them
>> >
>> > * also use IMAGE_LINK_NAME in IMAGE_NAME to make it more clear
>> >   that IMAGE_NAME is the same as IMAGE_LINK_NAME but with version
>> >   suffix
>> >
>> > * adding it as separate variable helps us to catch the cases
>> >   where we didn't respect ${IMAGE_LINK_NAME} variable and just used
>> >   the common default ${IMAGE_BASENAME}-${MACHINE}.
>> >
>> > [YOCTO #12937]
>> >
>> > Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
>> > ---
>> >  meta/classes-recipe/image-artifact-names.bbclass  | 15 ++++++++++++---
>> >  meta/classes-recipe/kernel-artifact-names.bbclass |  2 +-
>> >  2 files changed, 13 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/meta/classes-recipe/image-artifact-names.bbclass
>> > b/meta/classes-recipe/image-artifact-names.bbclass index
>> > 9dc25b6dde..ac2376d59a 100644
>> > --- a/meta/classes-recipe/image-artifact-names.bbclass
>> > +++ b/meta/classes-recipe/image-artifact-names.bbclass
>> > @@ -11,11 +11,20 @@
>> >  IMAGE_BASENAME ?= "${PN}"
>> >  IMAGE_VERSION_SUFFIX ?= "-${DATETIME}"
>> >  IMAGE_VERSION_SUFFIX[vardepsexclude] += "DATETIME SOURCE_DATE_EPOCH"
>> > -IMAGE_NAME ?= "${IMAGE_BASENAME}-${MACHINE}${IMAGE_VERSION_SUFFIX}"
>> > -IMAGE_LINK_NAME ?= "${IMAGE_BASENAME}-${MACHINE}"
>> > +IMAGE_NAME ?= "${IMAGE_LINK_NAME}${IMAGE_VERSION_SUFFIX}"
>> > +IMAGE_LINK_NAME ?= "${IMAGE_BASENAME}${IMAGE_MACHINE_SUFFIX}"
>>
>> So there's a minor unfortunate side-effect of this in that you can no
>> longer
>> just set IMAGE_LINK_NAME = "" to drop the symlinks - a minority use case,
>> but
>> something I have used. Of course you can just re-set the value of
>> IMAGE_NAME.
>> I am making a note in the manual and migration guide.
>>
>> Cheers
>> Paul
>>
>>
>>
>>
>>
diff mbox series

Patch

diff --git a/meta/classes-recipe/image-artifact-names.bbclass b/meta/classes-recipe/image-artifact-names.bbclass
index 9dc25b6dde..ac2376d59a 100644
--- a/meta/classes-recipe/image-artifact-names.bbclass
+++ b/meta/classes-recipe/image-artifact-names.bbclass
@@ -11,11 +11,20 @@ 
 IMAGE_BASENAME ?= "${PN}"
 IMAGE_VERSION_SUFFIX ?= "-${DATETIME}"
 IMAGE_VERSION_SUFFIX[vardepsexclude] += "DATETIME SOURCE_DATE_EPOCH"
-IMAGE_NAME ?= "${IMAGE_BASENAME}-${MACHINE}${IMAGE_VERSION_SUFFIX}"
-IMAGE_LINK_NAME ?= "${IMAGE_BASENAME}-${MACHINE}"
+IMAGE_NAME ?= "${IMAGE_LINK_NAME}${IMAGE_VERSION_SUFFIX}"
+IMAGE_LINK_NAME ?= "${IMAGE_BASENAME}${IMAGE_MACHINE_SUFFIX}"
 
 # This needs to stay in sync with IMAGE_LINK_NAME, but with INITRAMFS_IMAGE instead of IMAGE_BASENAME
-INITRAMFS_IMAGE_NAME ?= "${@['${INITRAMFS_IMAGE}-${MACHINE}', ''][d.getVar('INITRAMFS_IMAGE') == '']}"
+INITRAMFS_IMAGE_NAME ?= "${@['${INITRAMFS_IMAGE}${IMAGE_MACHINE_SUFFIX}', ''][d.getVar('INITRAMFS_IMAGE') == '']}"
+
+# The default DEPLOY_DIR_IMAGE is ${MACHINE} directory:
+# meta/conf/bitbake.conf:DEPLOY_DIR_IMAGE ?= "${DEPLOY_DIR}/images/${MACHINE}"
+# so many people find it unnecessary to include this suffix to every image
+# stored there, but other people often fetch various images for different
+# MACHINEs to the same downloads directory and then the suffix is very helpful
+# add separate variable for projects to decide which scheme works best for them
+# without understanding the IMAGE_NAME/IMAGE_LINK_NAME structure.
+IMAGE_MACHINE_SUFFIX ??= "-${MACHINE}"
 
 # IMAGE_NAME is the base name for everything produced when building images.
 # The actual image that contains the rootfs has an additional suffix (.rootfs
diff --git a/meta/classes-recipe/kernel-artifact-names.bbclass b/meta/classes-recipe/kernel-artifact-names.bbclass
index 311075c68d..1a7611a15e 100644
--- a/meta/classes-recipe/kernel-artifact-names.bbclass
+++ b/meta/classes-recipe/kernel-artifact-names.bbclass
@@ -12,7 +12,7 @@ 
 
 inherit image-artifact-names
 
-KERNEL_ARTIFACT_NAME ?= "${PKGE}-${PKGV}-${PKGR}-${MACHINE}${IMAGE_VERSION_SUFFIX}"
+KERNEL_ARTIFACT_NAME ?= "${PKGE}-${PKGV}-${PKGR}${IMAGE_MACHINE_SUFFIX}${IMAGE_VERSION_SUFFIX}"
 KERNEL_ARTIFACT_LINK_NAME ?= "${MACHINE}"
 KERNEL_ARTIFACT_BIN_EXT ?= ".bin"