Hi Richard,

Am 30.03.2022 um 13:51 schrieb Richard Purdie:
On Wed, 2022-03-30 at 10:16 +0200, Stefan Herbrechtsmeier wrote:
From: Stefan Herbrechtsmeier <stefan.herbrechtsme...@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

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsme...@weidmueller.com>

---

  meta/conf/bitbake.conf | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 7705415a4f..d56cf811ba 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -232,7 +232,8 @@ ASSUME_PROVIDED = "\
  ##################################################################
PN = "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}"
-PV = "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or '1.0'}"
+BPV = "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[1] or '1.0'}"
+PV = "${BPV}"
  PR = "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[2] or 'r0'}"
  PE = ""
  PF = "${PN}-${EXTENDPE}${PV}-${PR}"

I'm not really seeing a compelling use case for what is a fairly core change,
you've not really said why we need changes and what the big win is for users.

binutils_2.32.bb:
  require binutils-${PV}.inc
binutils-2.32.inc:
  PV = "2.32.0"
  CVE_VERSION = "2.32"

cdrtools-native_3.01.bb:
  PV = "3.01a31+really3.01"
  REALPV = "3.01"
  S = "${WORKDIR}/${BPN}-${REALPV}"

gcc-cross_8.3.bb:
  require recipes-devtools/gcc/gcc-${PV}.inc
gcc-8.3.inc:
  PV = "8.3.0"

gdk-pixbuf_2.38.0.bb:
  MAJ_VER = "${@oe.utils.trim_version("${PV}", 2)}"

util-linux.inc:
  MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:2])}"

Does the binutils and gcc-cross trick works inside a bbappend? The other examples could benefit from a variable.

I'm also quite worried that this behaves quite differently to BPN. "base" in the
case of PN means strip off prefixes and suffixes yet here, BPV doesn't actually
strip anything off PV, you're just expected to set it differently yourself as
the user. The different usage semantics will likely confuse people and that
confusion isn't worth it IMO.

BPV = "${@oe.utils.trim_version("${PV}", 3)}"

This would make it inline with the BPN but disallow the usage of the variable inside the PV itself.

Until now I don't know the oe.utils.trim_version function.

Regards
  Stefan
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#163789): 
https://lists.openembedded.org/g/openembedded-core/message/163789
Mute This Topic: https://lists.openembedded.org/mt/90127138/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to