public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier-oss@weidmueller.com>
To: Khem Raj <raj.khem@gmail.com>
Cc: Patches and discussions about the oe-core layer
	<openembedded-core@lists.openembedded.org>,
	Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Subject: Re: [OE-core] [RFC PATCH] bitbake.conf: Add base package version (BPV) variable
Date: Thu, 31 Mar 2022 09:15:55 +0200	[thread overview]
Message-ID: <ecb92f84-a4fa-31d6-de14-a48f5eff91dd@weidmueller.com> (raw)
In-Reply-To: <CAMKF1soT09dWVxf0idTF5O-u5wWMuVGAxcrC+Z1wJYkoJ1NtDQ@mail.gmail.com>

Am 30.03.2022 um 19:32 schrieb Khem Raj:
> On Wed, Mar 30, 2022 at 1:16 AM Stefan Herbrechtsmeier
> <stefan.herbrechtsmeier-oss@weidmueller.com> wrote:
>>
>> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>>
>> Add a base package version (BPV) variable and use it as default for the
>> package version (PV) variable. The BPV variable contains the base
>> package version of the recipe read from the recipe filename.
>>
>> The base package version variable supports an expansion of the version
>> from the recipe filename without the need of an immediate variable
>> expansion:
>>      PV = "${BPV}+git${SRCPV}"
>>
>> It allows the inclusion of include files inside a recipe file with the
>> same version in the recipe and include filename even if the package
>> version is different to the base package version in the filename:
>>      require linux-yocto-${BPV}.inc
>>
> 
> how many such usecase do we have ?

4x require binutils-${PV}.inc
9x require recipes-devtools/gcc/gcc-${PV}.inc
6x require go-${PV}.inc
4x require libtool-${PV}.inc
2x require m4-${PV}.inc
1x require boost-${PV}.inc

Thereby binutils and gcc set the real PV inside the .inc file.

> seems to be quite errorprone too.

The current use cases in oe core is much more error-prone because they 
use ${PV} and set the PV inside the .inc file. This means a second .inc 
file must use the new PV. Furthermore, if somebody in oe-core add a `PV 
.= "+git${SRCPV}"` it breaks includes in other layers.

A MAIN_VERSION (MAJOR.MINOR) and a BPV (MAJOR.MINOR.PATCH) would make 
the use case explicit:

require binutils-${MAIN_VERSION}.inc
require recipes-devtools/gcc/gcc-${MAIN_VERSION}.inc
require go-${BPV}.inc
require libtool-${BPV}.inc
require m4-${BPV}.inc
require boost-${BPV}.inc


At the moment oe-core have recipe specific names and code for the same 
value:

MAJOR.MINOR.PATCH:
MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:2])}"
CMAKE_MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:2])}"

MAJOR.MINOR:
WESTON_MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:1])}"
SHRT_VER = 
"${@d.getVar('PV').split('.')[0]}.${@d.getVar('PV').split('.')[1]}"
VIMDIR = 
"vim${@d.getVar('PV').split('.')[0]}${@d.getVar('PV').split('.')[1]}"
SHRT_VER = "${@oe.utils.trim_version("${PV}", 2)}"
NAMEVER = "${@oe.utils.trim_version("${PV}", 2)}"
SHRT_VER = "${@oe.utils.trim_version("${PV}", 2)}"
MAJ_VER = "${@oe.utils.trim_version("${PV}", 2)}"
MAJ_VER = "${@oe.utils.trim_version("${PV}", 2)}"
MAJ_VER = "${@oe.utils.trim_version("${PV}", 2)}"

MAJOR:
MAJ_VER = "${@oe.utils.trim_version("${PV}", 2).split('.')[0]}"
ICU_MAJOR_VER = "${@d.getVar('PV').split('.')[0]}"

MINOR:
MIN_VER = "${@oe.utils.trim_version("${PV}", 2).split('.')[1]}"


Sometimes the same name is used for different values:

MAJOR_VERSION = "${@oe.utils.trim_version("${PV}", 1)}"
WESTON_MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:1])}"
MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:2])}"

Maybe the bitbake.conf isn't the ride place but I think a common name 
for the base / short version (MAJOR.MINOR), base package version 
(MAJOR.MINOR.PATCH) and major, minor and patch would be helpful.



      reply	other threads:[~2022-03-31  7:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-30  8:16 [RFC PATCH] bitbake.conf: Add base package version (BPV) variable Stefan Herbrechtsmeier
2022-03-30  8:41 ` [OE-core] " Alexander Kanavin
2022-03-30  8:41   ` Alexander Kanavin
2022-03-30 11:42   ` Stefan Herbrechtsmeier
2022-03-30 11:46     ` Alexander Kanavin
2022-03-30 11:51 ` Richard Purdie
2022-03-30 16:23   ` Stefan Herbrechtsmeier
2022-03-30 17:32 ` Khem Raj
2022-03-31  7:15   ` Stefan Herbrechtsmeier [this message]

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=ecb92f84-a4fa-31d6-de14-a48f5eff91dd@weidmueller.com \
    --to=stefan.herbrechtsmeier-oss@weidmueller.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=raj.khem@gmail.com \
    --cc=stefan.herbrechtsmeier@weidmueller.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