[PATCH] meta/conf/bitbake.conf: enable SRCPV support for AUTOREV

275 views
Skip to first unread message

Srinuvasan Arjunan

unread,
Apr 12, 2023, 6:17:50 AM4/12/23
to isar-...@googlegroups.com, jan.k...@siemens.com, Srinuvasan A
From: Srinuvasan A <srinuv...@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 <srinuv...@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)}")
+
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}"
--
2.34.1

Jan Kiszka

unread,
Apr 13, 2023, 3:02:37 AM4/13/23
to Srinuvasan Arjunan, isar-...@googlegroups.com
On 12.04.23 12:17, Srinuvasan Arjunan wrote:
> From: Srinuvasan A <srinuv...@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 <srinuv...@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}"

--
Siemens AG, Technology
Competence Center Embedded Linux

Srinuvasan Arjunan

unread,
Apr 13, 2023, 3:09:21 AM4/13/23
to Jan Kiszka, Srinuvasan Arjunan, isar-...@googlegroups.com
    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+...@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.

Srinuvasan Arjunan

unread,
Apr 14, 2023, 4:58:14 AM4/14/23
to isar-...@googlegroups.com, jan.k...@siemens.com, Srinuvasan A
From: Srinuvasan A <srinuv...@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 <srinuv...@mentor.com>
---
meta/classes/base.bbclass | 4 ++++
meta/conf/bitbake.conf | 4 ++++
2 files changed, 8 insertions(+)

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 53550ae..819f8a2 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -120,6 +120,10 @@ root_cleandirs() {
python() {
import re

+ srcuri = d.getVar('SRC_URI')
+ if srcuri:
+ 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}"
--
2.34.1

Jan Kiszka

unread,
Apr 14, 2023, 5:00:12 AM4/14/23
to Srinuvasan Arjunan, isar-...@googlegroups.com
On 14.04.23 10:57, Srinuvasan Arjunan wrote:
> From: Srinuvasan A <srinuv...@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 <srinuv...@mentor.com>
> ---
> meta/classes/base.bbclass | 4 ++++
> meta/conf/bitbake.conf | 4 ++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
> index 53550ae..819f8a2 100644
> --- a/meta/classes/base.bbclass
> +++ b/meta/classes/base.bbclass
> @@ -120,6 +120,10 @@ root_cleandirs() {
> python() {
> import re
>
> + srcuri = d.getVar('SRC_URI')
> + if srcuri:
> + d.setVar("SRCPV", "${@bb.fetch2.get_srcrev(d)}")
> +

Still not the logic that OE uses - why?

Jan

Srinuvasan Arjunan

unread,
Apr 14, 2023, 5:12:25 AM4/14/23
to Jan Kiszka, Srinuvasan Arjunan, isar-...@googlegroups.com
  I thought it would be enable when SRC_URI contains any SCM
  They have a logic like get the uri and validating the uri.scheme against with many SCM , and set the needsrcrev variable if needed
  f.e : git
 
if uri.scheme in ("git", "gitsm"):
            needsrcrev = True

 Would we need to check like this?

--
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+...@googlegroups.com.

Jan Kiszka

unread,
Apr 14, 2023, 5:17:03 AM4/14/23
to Srinuvasan Arjunan, Srinuvasan Arjunan, isar-...@googlegroups.com
On 14.04.23 11:12, Srinuvasan Arjunan wrote:
>
>
> On Fri, Apr 14, 2023 at 2:30 PM 'Jan Kiszka' via isar-users
> <isar-...@googlegroups.com <mailto:isar-...@googlegroups.com>> wrote:
>
> On 14.04.23 10:57, Srinuvasan Arjunan wrote:
> > From: Srinuvasan A <srinuv...@mentor.com
> <mailto:srinuv...@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 <srinuv...@mentor.com
> <mailto:srinuv...@mentor.com>>
> > ---
> >  meta/classes/base.bbclass | 4 ++++
> >  meta/conf/bitbake.conf    | 4 ++++
> >  2 files changed, 8 insertions(+)
> >
> > diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
> > index 53550ae..819f8a2 100644
> > --- a/meta/classes/base.bbclass
> > +++ b/meta/classes/base.bbclass
> > @@ -120,6 +120,10 @@ root_cleandirs() {
> >  python() {
> >      import re
> > 
> > +    srcuri = d.getVar('SRC_URI')
> > +    if srcuri:
> > +        d.setVar("SRCPV", "${@bb.fetch2.get_srcrev(d)}")
> > +
>
> Still not the logic that OE uses - why?
>
> Jan
>
>  
>   I thought it would be enable when SRC_URI contains any SCM
>   They have a logic like get the uri and validating the uri.scheme
> against with many SCM , and set the needsrcrev variable if needed
>   f.e : git
>  
> if uri.scheme in ("git", "gitsm"):
>             needsrcrev = True
>
>
>  Would we need to check like this?
>

Counter question: Does your solution also work if SRC_URI is only
containing "file://"?

Jan

Srinuvasan Arjunan

unread,
Apr 17, 2023, 9:28:16 AM4/17/23
to isar-...@googlegroups.com, jan.k...@siemens.com, Srinuvasan A
From: Srinuvasan A <srinuv...@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 <srinuv...@mentor.com>
---
meta/classes/base.bbclass | 26 ++++++++++++++++++++++++++
meta/conf/bitbake.conf | 4 ++++
2 files changed, 30 insertions(+)

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 53550ae..f631483 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -120,6 +120,32 @@ root_cleandirs() {
python() {
import re

+ needsrcrev = False
+ srcuri = d.getVar('SRC_URI')
+ for uri_string in srcuri.split():
+ uri = bb.fetch.URI(uri_string)
+ # Svn packages should DEPEND on subversion-native
+ if uri.scheme == "svn":
+ needsrcrev = True
+
+ # Git packages should DEPEND on git-native
+ elif uri.scheme in ("git", "gitsm"):
+ needsrcrev = True
+
+ # Mercurial packages should DEPEND on mercurial-native
+ elif uri.scheme == "hg":
+ needsrcrev = True
+
+ # Perforce packages support SRCREV = "${AUTOREV}"
+ elif uri.scheme == "p4":
+ needsrcrev = True
+
+ elif uri.scheme == "repo":
+ needsrcrev = True
+
+ if needsrcrev:
+ d.setVar("SRCPV", "${@bb.fetch2.get_srcrev(d)}")
+

Jan Kiszka

unread,
Apr 17, 2023, 10:10:12 AM4/17/23
to Srinuvasan Arjunan, isar-...@googlegroups.com
Make sure to always version your patches!
The comments is not fully accurate for Isar (we are not building such
tools natively). Same below.
Except for the comments, this looks good to me now.

Just wondering if we could somehow stress this path in Isar upstream as
well - though that should not block this fix for AUTOREV.

Srinuvasan Arjunan

unread,
Apr 18, 2023, 2:26:12 AM4/18/23
to Jan Kiszka, Srinuvasan Arjunan, isar-...@googlegroups.com
    Stress this path meant, this one you are saying 
    # Also check downloadfilename as the URL path might not be useful for sniffing
    path = uri.params.get("downloadfilename", uri.path) 

Jan

--
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+...@googlegroups.com.

Uladzimir Bely

unread,
Apr 18, 2023, 3:06:43 AM4/18/23
to Srinuvasan Arjunan, isar-...@googlegroups.com, Jan Kiszka
If comments below are to be removed, it would be probably better to collapse all the stuff to

if uri.scheme in ("svn", "git", "gitsm", "hg", "p4", "repo"):
needsrcrev = True

Srinuvasan Arjunan

unread,
Apr 18, 2023, 10:40:56 PM4/18/23
to isar-...@googlegroups.com, jan.k...@siemens.com, ub...@ilbers.de, Srinuvasan A
From: Srinuvasan A <srinuv...@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 <srinuv...@mentor.com>
---
meta/classes/base.bbclass | 10 ++++++++++
meta/conf/bitbake.conf | 4 ++++
2 files changed, 14 insertions(+)

diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 53550ae..17bebe9 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -120,6 +120,16 @@ root_cleandirs() {
python() {
import re

+ needsrcrev = False
+ srcuri = d.getVar('SRC_URI')
+ for uri_string in srcuri.split():
+ uri = bb.fetch.URI(uri_string)
+ if uri.scheme in ("svn", "git", "gitsm", "hg", "p4", "repo"):
+ needsrcrev = True
+
+ if needsrcrev:
+ 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}"
--
2.34.1

Jan Kiszka

unread,
Apr 19, 2023, 9:43:24 AM4/19/23
to Srinuvasan Arjunan, isar-...@googlegroups.com, ub...@ilbers.de
Looks good to me.

Thanks,

Anton Mikanovich

unread,
May 8, 2023, 1:57:37 PM5/8/23
to Srinuvasan Arjunan, isar-...@googlegroups.com, jan.k...@siemens.com, ub...@ilbers.de
19/04/2023 05:40, Srinuvasan Arjunan wrote:
> From: Srinuvasan A <srinuv...@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 <srinuv...@mentor.com>

Applied to next, thanks.

Reply all
Reply to author
Forward
0 new messages