| Message ID | 20250912204559.10360-2-reatmon@ti.com |
|---|---|
| State | New |
| Headers | show |
| Series | [1/3] bitbake-setup: Tweak user inputs | expand |
On Fri, 12 Sept 2025 at 22:46, Ryan Eatmon via lists.openembedded.org <reatmon=ti.com@lists.openembedded.org> wrote: > > When extracting the config name from from the filename, just splitting > on . does not allow for . in the config name. For example: > > coresdk-11.01.08-config.json -> coresdk-11 > > when it should be: > > coresdk-11.01.08-config.json -> coresdk-11.01.08-config > > os.path.splitext() already does this logic correctly, so use that > instead. The files are explicitly expected to end with .conf.json. Otherwise the tool could potentially pick up unrelated json files in registries. There's probably a missing check for that condition somewhere? Alex
On 9/15/2025 4:51 AM, Alexander Kanavin wrote: > On Fri, 12 Sept 2025 at 22:46, Ryan Eatmon via lists.openembedded.org > <reatmon=ti.com@lists.openembedded.org> wrote: >> >> When extracting the config name from from the filename, just splitting >> on . does not allow for . in the config name. For example: >> >> coresdk-11.01.08-config.json -> coresdk-11 >> >> when it should be: >> >> coresdk-11.01.08-config.json -> coresdk-11.01.08-config >> >> os.path.splitext() already does this logic correctly, so use that >> instead. > > The files are explicitly expected to end with .conf.json. Otherwise > the tool could potentially pick up unrelated json files in registries. > There's probably a missing check for that condition somewhere? I'll update my code then to remove the .conf.json only then and send a v2. > Alex
On Mon, 15 Sept 2025 at 13:50, Ryan Eatmon <reatmon@ti.com> wrote: > > The files are explicitly expected to end with .conf.json. Otherwise > > the tool could potentially pick up unrelated json files in registries. > > There's probably a missing check for that condition somewhere? > > I'll update my code then to remove the .conf.json only then and send a v2. Thanks, I've already fixed this locally. Files with . in them should work now. def get_config_name(config): - return os.path.basename(config).split('.')[0] + suffix = '.conf.json' + config_file = os.path.basename(config) + if config_file.endswith(suffix): + return config_file[:-len(suffix)] + else: + raise Exception("Config file {} does not end with {}".format(config, suffix)) Alex
diff --git a/bin/bitbake-setup b/bin/bitbake-setup index 36103f1e8..342251bd5 100755 --- a/bin/bitbake-setup +++ b/bin/bitbake-setup @@ -50,7 +50,7 @@ def save_bb_cache(): bb.fetch2.fetcher_parse_done() def get_config_name(config): - return os.path.basename(config).split('.')[0] + return os.path.splitext(os.path.basename(config))[0] def write_config(config, config_dir): with open(os.path.join(config_dir, "config-upstream.json"),'w') as s:
When extracting the config name from from the filename, just splitting on . does not allow for . in the config name. For example: coresdk-11.01.08-config.json -> coresdk-11 when it should be: coresdk-11.01.08-config.json -> coresdk-11.01.08-config os.path.splitext() already does this logic correctly, so use that instead. Signed-off-by: Ryan Eatmon <reatmon@ti.com> --- bin/bitbake-setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)