Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Luca Ceresoli <luca.ceresoli@bootlin.com>
To: "Richard Purdie" <richard.purdie@linuxfoundation.org>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCH 1/5] classes/buildcfg: Move git/layer revision code into new OE module buildcfg
Date: Fri, 10 Jun 2022 16:14:08 +0200	[thread overview]
Message-ID: <20220610161408.34a3a6a4@booty> (raw)
In-Reply-To: <20220609113732.43566-1-richard.purdie@linuxfoundation.org>

Hello Richard,

On Thu,  9 Jun 2022 12:37:28 +0100
"Richard Purdie" <richard.purdie@linuxfoundation.org> wrote:

> There is a load of duplicated git/layer/revision code which makes
> most sesne as a python library, not bbclass code. Start to refactor as such.

s/sesne/sense/

> 
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>  meta/classes/base.bbclass            |  9 +++---
>  meta/classes/buildhistory.bbclass    |  4 +--
>  meta/classes/image-buildinfo.bbclass |  4 +--
>  meta/classes/metadata_scm.bbclass    | 43 ++--------------------------
>  meta/lib/oe/buildcfg.py              | 40 ++++++++++++++++++++++++++
>  5 files changed, 51 insertions(+), 49 deletions(-)
>  create mode 100644 meta/lib/oe/buildcfg.py
> 
> diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
> index bdb3ac33c67..f59e95fef06 100644
> --- a/meta/classes/base.bbclass
> +++ b/meta/classes/base.bbclass
> @@ -7,12 +7,11 @@ inherit staging
>  inherit mirrors
>  inherit utils
>  inherit utility-tasks
> -inherit metadata_scm
>  inherit logging
>  
>  OE_EXTRA_IMPORTS ?= ""
>  
> -OE_IMPORTS += "os sys time oe.path oe.utils oe.types oe.package oe.packagegroup oe.sstatesig oe.lsb oe.cachedpath oe.license oe.qa oe.reproducible oe.rust ${OE_EXTRA_IMPORTS}"
> +OE_IMPORTS += "os sys time oe.path oe.utils oe.types oe.package oe.packagegroup oe.sstatesig oe.lsb oe.cachedpath oe.license oe.qa oe.reproducible oe.rust oe.buildcfg ${OE_EXTRA_IMPORTS}"
>  OE_IMPORTS[type] = "list"
>  
>  PACKAGECONFIG_CONFARGS ??= ""
> @@ -35,6 +34,8 @@ def oe_import(d):
>  # We need the oe module name space early (before INHERITs get added)
>  OE_IMPORTED := "${@oe_import(d)}"
>  
> +inherit metadata_scm
> +
>  def lsb_distro_identifier(d):
>      adjust = d.getVar('LSB_DISTRO_ADJUST')
>      adjust_func = None
> @@ -219,8 +220,8 @@ def get_source_date_epoch_value(d):
>  def get_layers_branch_rev(d):
>      layers = (d.getVar("BBLAYERS") or "").split()
>      layers_branch_rev = ["%-20s = \"%s:%s\"" % (os.path.basename(i), \
> -        base_get_metadata_git_branch(i, None).strip(), \
> -        base_get_metadata_git_revision(i, None)) \
> +        oe.buildcfg.get_metadata_git_branch(i, None).strip(), \
> +        oe.buildcfg.get_metadata_git_revision(i, None)) \
>              for i in layers]
>      i = len(layers_branch_rev)-1
>      p1 = layers_branch_rev[i].find("=")
> diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
> index 4345ffc6939..f2493b3765a 100644
> --- a/meta/classes/buildhistory.bbclass
> +++ b/meta/classes/buildhistory.bbclass
> @@ -761,8 +761,8 @@ def buildhistory_get_metadata_revs(d):
>      # We want an easily machine-readable format here, so get_layers_branch_rev isn't quite what we want
>      layers = (d.getVar("BBLAYERS") or "").split()
>      medadata_revs = ["%-17s = %s:%s%s" % (os.path.basename(i), \
> -        base_get_metadata_git_branch(i, None).strip(), \
> -        base_get_metadata_git_revision(i, None), \
> +        oe.buildcfg.get_metadata_git_branch(i, None).strip(), \
> +        oe.buildcfg.get_metadata_git_revision(i, None), \
>          buildhistory_get_modified(i)) \
>              for i in layers]
>      return '\n'.join(medadata_revs)
> diff --git a/meta/classes/image-buildinfo.bbclass b/meta/classes/image-buildinfo.bbclass
> index 94c585d4cd9..25ca8d8fe6b 100644
> --- a/meta/classes/image-buildinfo.bbclass
> +++ b/meta/classes/image-buildinfo.bbclass
> @@ -46,8 +46,8 @@ def get_layer_git_status(path):
>  def get_layer_revs(d):
>      layers = (d.getVar("BBLAYERS") or "").split()
>      medadata_revs = ["%-17s = %s:%s %s" % (os.path.basename(i), \
> -        base_get_metadata_git_branch(i, None).strip(), \
> -        base_get_metadata_git_revision(i, None), \
> +        oe.buildcfg.get_metadata_git_branch(i, None).strip(), \
> +        oe.buildcfg.get_metadata_git_revision(i, None), \
>          get_layer_git_status(i)) \
>              for i in layers]
>      return '\n'.join(medadata_revs)
> diff --git a/meta/classes/metadata_scm.bbclass b/meta/classes/metadata_scm.bbclass
> index 47cb969b8d8..f646b3159a4 100644
> --- a/meta/classes/metadata_scm.bbclass
> +++ b/meta/classes/metadata_scm.bbclass
> @@ -1,44 +1,5 @@
> -def base_detect_revision(d):
> -    path = base_get_scmbasepath(d)
> -    return base_get_metadata_git_revision(path, d)
>  
> -def base_detect_branch(d):
> -    path = base_get_scmbasepath(d)
> -    return base_get_metadata_git_branch(path, d)

This causes failures because there still a user of base_detect_branch()
in meta/classes/report-error.bbclass

NameError: name 'base_detect_branch' is not defined

https://autobuilder.yoctoproject.org/typhoon/#/builders/113/builds/2527/steps/13/logs/stdio

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


  parent reply	other threads:[~2022-06-10 14:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09 11:37 [PATCH 1/5] classes/buildcfg: Move git/layer revision code into new OE module buildcfg Richard Purdie
2022-06-09 11:37 ` [PATCH 2/5] lib/buildcfg: Share common clean/dirty layer function Richard Purdie
2022-06-09 11:37 ` [PATCH 3/5] buildcfg: Drop unused svn revision function Richard Purdie
2022-06-09 11:37 ` [PATCH 4/5] base/buildhistory/image-buildinfo: Use common buildcfg function Richard Purdie
2022-06-09 11:37 ` [PATCH 5/5] image-buildinfo: Improve and extend to SDK coverage too Richard Purdie
2022-06-10 14:14 ` Luca Ceresoli [this message]
2022-06-10 16:21   ` [OE-core] [PATCH 1/5] classes/buildcfg: Move git/layer revision code into new OE module buildcfg Richard Purdie

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=20220610161408.34a3a6a4@booty \
    --to=luca.ceresoli@bootlin.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.org \
    /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