[Buildroot] [git commit] genrandconfig: fix the case when outputdir is 'output'

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Tue Jul 25 20:50:20 UTC 2017

commit: https://git.buildroot.net/buildroot/commit/?id=1e70470545c348c21f521fa6b7b4cf707d989aad
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

When outputdir is 'output' (the default), genrandconfig didn't work
correctly because it expects the configfile in outputdir, while
Buildroot puts it in the buildroot directory.

Fix this by explicitly checking if outputdir == buildrootdir/output.
Because abspath is used for both paths, string comparison works

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout at mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
 utils/genrandconfig | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/utils/genrandconfig b/utils/genrandconfig
index eaca6cf..4ff7deb 100755
--- a/utils/genrandconfig
+++ b/utils/genrandconfig
@@ -354,7 +354,10 @@ def gen_config(args):
     # Write out the configuration file
     if not os.path.exists(args.outputdir):
-    configfile = os.path.join(args.outputdir, ".config")
+    if args.outputdir == os.path.abspath(os.path.join(args.buildrootdir, "output")):
+        configfile = os.path.join(args.buildrootdir, ".config")
+    else:
+        configfile = os.path.join(args.outputdir, ".config")
     with open(configfile, "w+") as configf:

More information about the buildroot mailing list