[Buildroot] [PATCH v2 1/1] utils/genrandconfig: make default toolchain_csv path absolute

James Hilliard james.hilliard1 at gmail.com
Wed Feb 15 21:15:31 UTC 2023


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 make the default toolchain_csv path absolute.

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>
---
Changes v1 -> v2:
  - set default path as absolute
---
 utils/genrandconfig | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/utils/genrandconfig b/utils/genrandconfig
index b3576f8a51..3552b83694 100755
--- a/utils/genrandconfig
+++ b/utils/genrandconfig
@@ -801,7 +801,9 @@ if __name__ == '__main__':
                                 dest="toolchains_csv",
                                 help="Generate random toolchain configuration",
                                 action='store_false')
-    parser.set_defaults(toolchains_csv="support/config-fragments/autobuild/toolchain-configs.csv")
+    buildroot_abs = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+    parser.set_defaults(toolchains_csv=os.path.join(buildroot_abs,
+                        "support/config-fragments/autobuild/toolchain-configs.csv"))
 
     args = parser.parse_args()
 
-- 
2.34.1




More information about the buildroot mailing list