Skip to contentSkip to conversation

cookerdata.py: check for existence of configuration files

PATCH In review Juro Bystricky 2 participants 5 messages Jan 12, 2017 – Jan 13, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cookerdata.py: check for existence of configuration files

Presently there is no check to verify the existence of configuration files as listed in BBMULTICONFIG. For example, BBMULTICONFIG = "foobar" in local.conf does not trigger an error when there is no conf/multiconfig/foobar.conf. The missing file is silently ignored.

This patch verifies the existence of config files and errors-out with the message:

ERROR: BBMULTICONFIG="foobar" but the configuration file './conf/multiconfig/foobar.conf' does not exist!

when the file does not exist.

[YOCTO#10917]

---
 bitbake/lib/bb/cookerdata.py | 6 ++++++
 1 file changed, 6 insertions(+)
bitbake/lib/bb/cookerdata.py +6 -0
index d9eab56..bb1e2c3 100644
@@ -289,6 +289,12 @@ class CookerDataBuilder(object):
 
             multiconfig = (self.data.getVar("BBMULTICONFIG") or "").split()
             for config in multiconfig:
+                if config != "":
+                    src = "./conf/multiconfig/" + config + ".conf"
+                    if not os.access(src, os.R_OK):
+                        parselog.critical("BBMULTICONFIG=\"%s\" but the configuration file '%s' does not exist! " % (self.data.getVar("BBMULTICONFIG"),src))
+                        sys.exit(1)
+
                 mcdata = self.parseConfigurationFiles(self.prefiles, self.postfiles, config)
                 bb.event.fire(bb.event.ConfigParsed(), mcdata)
                 self.mcdata[config] = mcdata
Signature · 1 line
2.7.4
#1 lore raw
Quoted 10 lines · Juro Bystricky

Presently there is no check to verify the existence of configuration files as listed in BBMULTICONFIG. For example, BBMULTICONFIG = "foobar" in local.conf
does not trigger an error when there is no conf/multiconfig/foobar.conf.
The missing file is silently ignored.

This patch verifies the existence of config files and errors-out with the message:

Quoted 6 lines

ERROR: BBMULTICONFIG="foobar" but the configuration file './conf/multiconfig/foobar.conf' does not exist!

when the file does not exist.

[YOCTO#10917]

Sorry but we can't do this. One reason for some of the recent changes was to move the handling of this to the metadata and out of bitbake. We've therefore now got:

include conf/multiconfig/${BB_CURRENT_MC}.conf

in bitbake.conf and the system looks for the file that way. The user is free to add other files in other paths and bitbake doesn't know/care about the directory layout.

If we really want to make this error, we'd need to add an empty conf/multiconfig/default.conf and then change this to a require instead of an include. Bitbake's standard error messages would then kick in.

Cheers,

Richard

#2 lore raw

I see your point. The route via a dummy default.conf would require having the folder conf/multiconfig present even for users not really interested in multiconfig. Not a show stopper, it would be just another file created by oe-init-build-env. (Another possibility is to have the error check as part of sanity checking)

Quoted 44 lines

-----Original Message-----
From: Richard Purdie [mailto:[email protected]]
Sent: Friday, January 13, 2017 2:55 AM
To: Bystricky, Juro <[email protected]>; bitbake- [email protected]
Cc: [email protected]
Subject: Re: [PATCH] cookerdata.py: check for existence of configuration files

Quoted 10 lines · Juro Bystricky

Presently there is no check to verify the existence of configuration files as listed in BBMULTICONFIG. For example, BBMULTICONFIG = "foobar" in local.conf
does not trigger an error when there is no conf/multiconfig/foobar.conf.
The missing file is silently ignored.

This patch verifies the existence of config files and errors-out with the message:

Quoted 6 lines

ERROR: BBMULTICONFIG="foobar" but the configuration file './conf/multiconfig/foobar.conf' does not exist!

when the file does not exist.

[YOCTO#10917]

Sorry but we can't do this. One reason for some of the recent changes was to move the handling of this to the metadata and out of bitbake. We've therefore now got:

include conf/multiconfig/${BB_CURRENT_MC}.conf

in bitbake.conf and the system looks for the file that way. The user is free to add other files in other paths and bitbake doesn't know/care about the directory layout.

If we really want to make this error, we'd need to add an empty conf/multiconfig/default.conf and then change this to a require instead of an include. Bitbake's standard error messages would then kick in.

Cheers,

Richard

#3 lore raw
Quoted 9 lines · Juro

I see your point. The route via a dummy default.conf would require having
the folder conf/multiconfig present even for users not really interested in
multiconfig. Not a show stopper, it would be just another file created by
oe-init-build-env. (Another possibility is to have the error check as part
of sanity checking)

We can put this in meta/conf/mulitconfig, it doesn't have to be in the build directory.

Cheers,

Richard

#4 lore raw

All right, I'll get on it then...

Quoted 26 lines

-----Original Message-----
From: Richard Purdie [mailto:[email protected]]
Sent: Friday, January 13, 2017 9:06 AM
To: Bystricky, Juro <[email protected]>; bitbake- [email protected]
Cc: [email protected]
Subject: Re: [PATCH] cookerdata.py: check for existence of configuration files

Quoted 9 lines · Juro

I see your point. The route via a dummy default.conf would require having
the folder conf/multiconfig present even for users not really interested in
multiconfig. Not a show stopper, it would be just another file created by
oe-init-build-env. (Another possibility is to have the error check as part
of sanity checking)

We can put this in meta/conf/mulitconfig, it doesn't have to be in the build directory.

Cheers,

Richard