[Buildroot] [PATCH 1/1] utils/genrandconfig: fix relative toolchain_csv paths
James Hilliard
james.hilliard1 at gmail.com
Wed Feb 15 21:18:02 UTC 2023
On Wed, Feb 15, 2023 at 1:48 PM Arnout Vandecappelle <arnout at mind.be> wrote:
>
>
>
> On 08/02/2023 01:53, James Hilliard wrote:
> > The default toolchain_csv path is a relative path to the buildroot
> > directory.
> >
> > If we run genrandconfig with a cwd that is not the buildroot directory
> > the default toolchain_csv path will be wrong.
> >
> > To fix this prepend the buildroot directory path to the toolchain_csv
> > path whenever the toolchain_csv path is not absolute.
>
> Well, a typical use case for running genrandconfig with a cwd that is not the
> buildroot directory could be from a br2-external, with a custom csv as argument.
> In that case, we actually *do* want the toolchains_csv to be interpreted
> relative to cwd rather than buildrootdir...
>
> Since people may already be relying on that behaviour, I think it would be
> better to fix it by just making the default one an absolute path, not anything
> passed explicitly through the commandline.
Changed the default to an absolute path in v2:
https://patchwork.ozlabs.org/project/buildroot/patch/20230215211531.331246-1-james.hilliard1@gmail.com/
>
> Regards,
> Arnout
>
> >
> > Fixes:
> > FileNotFoundError: [Errno 2] No such file or directory: 'support/config-fragments/autobuild/toolchain-configs.csv'
> >
> > Signed-off-by: James Hilliard <james.hilliard1 at gmail.com>
> > ---
> > utils/genrandconfig | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/utils/genrandconfig b/utils/genrandconfig
> > index b3576f8a51..b96f2ee6de 100755
> > --- a/utils/genrandconfig
> > +++ b/utils/genrandconfig
> > @@ -115,6 +115,9 @@ def get_toolchain_configs(toolchains_csv, buildrootdir):
> > toolchain configuration is itself an array of lines of the defconfig.
> > """
> >
> > + if not os.path.isabs(toolchains_csv):
> > + toolchains_csv = os.path.join(buildrootdir, toolchains_csv)
> > +
> > with open(toolchains_csv) as r:
> > # filter empty lines and comments
> > lines = [t for t in r.readlines() if len(t.strip()) > 0 and t[0] != '#']
More information about the buildroot
mailing list