meta/conf/bitbake.conf: enable SRCPV support for AUTOREV

Message ID 20230412101721.682675-1-srinuvasan_a@mentor.com
State Superseded, archived
Headers show
Series meta/conf/bitbake.conf: enable SRCPV support for AUTOREV | expand

Commit Message

Srinuvasan Arjunan April 12, 2023, 10:17 a.m. UTC
From: Srinuvasan A <srinuvasan_a@mentor.com>

One of our downstream project recipe uses `SRCREV = "${AUTOREV}"` to get
the latest changes always, but this not works after bitbake 2 migration,
it throws the below error.

do_fetch: Fetcher failure: Recipe uses a floating tag/branch without a fixed SRCREV yet doesn't call bb.fetch2.get_srcrev() (use SRCPV in PV for OE).

Till now we don't have support for SRCPV in ISAR, hence add this support
as like OE.

Signed-off-by: Srinuvasan A <srinuvasan_a@mentor.com>
---
 meta/classes/base.bbclass | 2 ++
 meta/conf/bitbake.conf    | 4 ++++
 2 files changed, 6 insertions(+)

Comments

Jan Kiszka April 13, 2023, 7:02 a.m. UTC | #1
On 12.04.23 12:17, Srinuvasan Arjunan wrote:
> From: Srinuvasan A <srinuvasan_a@mentor.com>
> 
> One of our downstream project recipe uses `SRCREV = "${AUTOREV}"` to get
> the latest changes always, but this not works after bitbake 2 migration,
> it throws the below error.
> 
> do_fetch: Fetcher failure: Recipe uses a floating tag/branch without a fixed SRCREV yet doesn't call bb.fetch2.get_srcrev() (use SRCPV in PV for OE).
> 
> Till now we don't have support for SRCPV in ISAR, hence add this support
> as like OE.
> 
> Signed-off-by: Srinuvasan A <srinuvasan_a@mentor.com>
> ---
>  meta/classes/base.bbclass | 2 ++
>  meta/conf/bitbake.conf    | 4 ++++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
> index 53550ae..cc2b195 100644
> --- a/meta/classes/base.bbclass
> +++ b/meta/classes/base.bbclass
> @@ -120,6 +120,8 @@ root_cleandirs() {
>  python() {
>      import re
>  
> +    d.setVar("SRCPV", "${@bb.fetch2.get_srcrev(d)}")
> +

This is likely not correct. OE upstream checks if there is any SCM in
the SRC_URI entries and only then adds this. I've played with
unconditionally adding SRCPV (though via bitbake.conf), and I got errors.

Jan

>      for e in d.keys():
>          flags = d.getVarFlags(e)
>          if flags and flags.get('task'):
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index f421050..124bf49 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -36,6 +36,10 @@ PR = "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[2] or 'r0'}"
>  PROVIDES = ""
>  S = "${WORKDIR}/${P}"
>  AUTOREV = "${@bb.fetch2.get_autorev(d)}"
> +AUTOREV[vardepvalue] = "${SRCPV}"
> +# Set Dynamically in base.bbclass
> +# SRCPV = "${@bb.fetch2.get_srcrev(d)}"
> +SRCPV[vardepvalue] = "${SRCPV}"
>  SRC_URI = ""
>  STAMPS_DIR ?= "${TMPDIR}/stamps"
>  STAMP = "${STAMPS_DIR}/${DISTRO}-${DISTRO_ARCH}/${PN}/${PV}-${PR}"
Srinuvasan Arjunan April 13, 2023, 7:09 a.m. UTC | #2
On Thu, Apr 13, 2023 at 12:32 PM 'Jan Kiszka' via isar-users <
isar-users@googlegroups.com> wrote:

> On 12.04.23 12:17, Srinuvasan Arjunan wrote:
> > From: Srinuvasan A <srinuvasan_a@mentor.com>
> >
> > One of our downstream project recipe uses `SRCREV = "${AUTOREV}"` to get
> > the latest changes always, but this not works after bitbake 2 migration,
> > it throws the below error.
> >
> > do_fetch: Fetcher failure: Recipe uses a floating tag/branch without a
> fixed SRCREV yet doesn't call bb.fetch2.get_srcrev() (use SRCPV in PV for
> OE).
> >
> > Till now we don't have support for SRCPV in ISAR, hence add this support
> > as like OE.
> >
> > Signed-off-by: Srinuvasan A <srinuvasan_a@mentor.com>
> > ---
> >  meta/classes/base.bbclass | 2 ++
> >  meta/conf/bitbake.conf    | 4 ++++
> >  2 files changed, 6 insertions(+)
> >
> > diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
> > index 53550ae..cc2b195 100644
> > --- a/meta/classes/base.bbclass
> > +++ b/meta/classes/base.bbclass
> > @@ -120,6 +120,8 @@ root_cleandirs() {
> >  python() {
> >      import re
> >
> > +    d.setVar("SRCPV", "${@bb.fetch2.get_srcrev(d)}")
> > +
>
> This is likely not correct. OE upstream checks if there is any SCM in
> the SRC_URI entries and only then adds this. I've played with
> unconditionally adding SRCPV (though via bitbake.conf), and I got errors.
>
> Jan
>

    Sure jan, will check and send the next version.

>
> >      for e in d.keys():
> >          flags = d.getVarFlags(e)
> >          if flags and flags.get('task'):
> > diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> > index f421050..124bf49 100644
> > --- a/meta/conf/bitbake.conf
> > +++ b/meta/conf/bitbake.conf
> > @@ -36,6 +36,10 @@ PR = "${@bb.parse.vars_from_file(d.getVar('FILE',
> False),d)[2] or 'r0'}"
> >  PROVIDES = ""
> >  S = "${WORKDIR}/${P}"
> >  AUTOREV = "${@bb.fetch2.get_autorev(d)}"
> > +AUTOREV[vardepvalue] = "${SRCPV}"
> > +# Set Dynamically in base.bbclass
> > +# SRCPV = "${@bb.fetch2.get_srcrev(d)}"
> > +SRCPV[vardepvalue] = "${SRCPV}"
> >  SRC_URI = ""
> >  STAMPS_DIR ?= "${TMPDIR}/stamps"
> >  STAMP = "${STAMPS_DIR}/${DISTRO}-${DISTRO_ARCH}/${PN}/${PV}-${PR}"
>
> --
> Siemens AG, Technology
> Competence Center Embedded Linux
>
> --
> You received this message because you are subscribed to the Google Groups
> "isar-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to isar-users+unsubscribe@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/isar-users/1e8a8cb1-68e6-be14-0d42-13a8a5ff1dea%40siemens.com
> .
>

Patch

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 53550ae..cc2b195 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -120,6 +120,8 @@  root_cleandirs() {
 python() {
     import re
 
+    d.setVar("SRCPV", "${@bb.fetch2.get_srcrev(d)}")
+
     for e in d.keys():
         flags = d.getVarFlags(e)
         if flags and flags.get('task'):
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index f421050..124bf49 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -36,6 +36,10 @@  PR = "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[2] or 'r0'}"
 PROVIDES = ""
 S = "${WORKDIR}/${P}"
 AUTOREV = "${@bb.fetch2.get_autorev(d)}"
+AUTOREV[vardepvalue] = "${SRCPV}"
+# Set Dynamically in base.bbclass
+# SRCPV = "${@bb.fetch2.get_srcrev(d)}"
+SRCPV[vardepvalue] = "${SRCPV}"
 SRC_URI = ""
 STAMPS_DIR ?= "${TMPDIR}/stamps"
 STAMP = "${STAMPS_DIR}/${DISTRO}-${DISTRO_ARCH}/${PN}/${PV}-${PR}"