| Message ID | 20251030141904.69494-1-JPEWhacker@gmail.com |
|---|---|
| State | New |
| Headers | show |
| Series | [bitbake-devel,RFC] cookerdata: Include "originating" recipe data when parsing | expand |
> -----Original Message----- > From: bitbake-devel@lists.openembedded.org <bitbake-devel@lists.openembedded.org> On Behalf Of Joshua Watt via lists.openembedded.org > Sent: den 30 oktober 2025 15:19 > To: bitbake-devel@lists.openembedded.org > Cc: Joshua Watt <JPEWhacker@gmail.com> > Subject: [bitbake-devel][RFC] cookerdata: Include "originating" recipe data when parsing > > Parse out PN, PV, and PR from the "originating" recipe (the .bb file > being parsed) and provide them at parse time. This allows .bbappends, > .inc, etc. files to know what recipe is currently being parsed. > > Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> > --- > lib/bb/cookerdata.py | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/lib/bb/cookerdata.py b/lib/bb/cookerdata.py > index 65c153a5b..8abf5e56e 100644 > --- a/lib/bb/cookerdata.py > +++ b/lib/bb/cookerdata.py > @@ -504,6 +504,12 @@ class CookerDataBuilder(object): > bb_data.setVar("__BBMULTICONFIG", mc) > bb_data.setVar("FILE_LAYERNAME", layername) > > + pn, pv, pr = bb.parse.vars_from_file(bbfile, bb_data) > + > + bb_data.setVar("ORIG_PN", pn or "defaultpkgname") > + bb_data.setVar("ORIG_PV", pv or "1.0") > + bb_data.setVar("ORIG_PR", pr or "r0") > + > bbfile_loc = os.path.abspath(os.path.dirname(bbfile)) > bb.parse.cached_mtime_noerror(bbfile_loc) > > -- > 2.51.1 You want to include PE as well. //Peter
On Thu, Oct 30, 2025 at 11:09 AM Peter Kjellerstedt <peter.kjellerstedt@axis.com> wrote: > > > -----Original Message----- > > From: bitbake-devel@lists.openembedded.org <bitbake-devel@lists.openembedded.org> On Behalf Of Joshua Watt via lists.openembedded.org > > Sent: den 30 oktober 2025 15:19 > > To: bitbake-devel@lists.openembedded.org > > Cc: Joshua Watt <JPEWhacker@gmail.com> > > Subject: [bitbake-devel][RFC] cookerdata: Include "originating" recipe data when parsing > > > > Parse out PN, PV, and PR from the "originating" recipe (the .bb file > > being parsed) and provide them at parse time. This allows .bbappends, > > .inc, etc. files to know what recipe is currently being parsed. > > > > Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> > > --- > > lib/bb/cookerdata.py | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/lib/bb/cookerdata.py b/lib/bb/cookerdata.py > > index 65c153a5b..8abf5e56e 100644 > > --- a/lib/bb/cookerdata.py > > +++ b/lib/bb/cookerdata.py > > @@ -504,6 +504,12 @@ class CookerDataBuilder(object): > > bb_data.setVar("__BBMULTICONFIG", mc) > > bb_data.setVar("FILE_LAYERNAME", layername) > > > > + pn, pv, pr = bb.parse.vars_from_file(bbfile, bb_data) > > + > > + bb_data.setVar("ORIG_PN", pn or "defaultpkgname") > > + bb_data.setVar("ORIG_PV", pv or "1.0") > > + bb_data.setVar("ORIG_PR", pr or "r0") > > + > > bbfile_loc = os.path.abspath(os.path.dirname(bbfile)) > > bb.parse.cached_mtime_noerror(bbfile_loc) > > > > -- > > 2.51.1 > > You want to include PE as well. Ya. The other option would just be to do: bb_data.setVar("ORIG_BBFILE", bbfile) And let users parse it out for themselves if necessary. > > //Peter >
diff --git a/lib/bb/cookerdata.py b/lib/bb/cookerdata.py index 65c153a5b..8abf5e56e 100644 --- a/lib/bb/cookerdata.py +++ b/lib/bb/cookerdata.py @@ -504,6 +504,12 @@ class CookerDataBuilder(object): bb_data.setVar("__BBMULTICONFIG", mc) bb_data.setVar("FILE_LAYERNAME", layername) + pn, pv, pr = bb.parse.vars_from_file(bbfile, bb_data) + + bb_data.setVar("ORIG_PN", pn or "defaultpkgname") + bb_data.setVar("ORIG_PV", pv or "1.0") + bb_data.setVar("ORIG_PR", pr or "r0") + bbfile_loc = os.path.abspath(os.path.dirname(bbfile)) bb.parse.cached_mtime_noerror(bbfile_loc)
Parse out PN, PV, and PR from the "originating" recipe (the .bb file being parsed) and provide them at parse time. This allows .bbappends, .inc, etc. files to know what recipe is currently being parsed. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> --- lib/bb/cookerdata.py | 6 ++++++ 1 file changed, 6 insertions(+)