From d0b34dec9709ef34bced21cd4cacb6ee81e11a45 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Mon, 20 Jan 2020 01:22:36 +0800 Subject: [PATCH] Fix the minor issue found in configure.sh, sethost.sh and testbuild.sh 1.The unused variable 2.The duplicated setting 3.The typo error Change-Id: I8c129cce78d3e88856f1edcbc2c702c433daa61f Signed-off-by: Xiang Xiao --- tools/configure.c | 18 ++++++++---------- tools/configure.sh | 7 ++++--- tools/sethost.sh | 7 ------- tools/testbuild.sh | 6 ++---- 4 files changed, 14 insertions(+), 24 deletions(-) diff --git a/tools/configure.c b/tools/configure.c index d4101b0474..b37f4cda5f 100644 --- a/tools/configure.c +++ b/tools/configure.c @@ -174,11 +174,13 @@ static const char *g_optfiles[] = static void show_usage(const char *progname, int exitcode) { - fprintf(stderr, "\nUSAGE: %s [-d] [-b] [-f] [-l|m|c|u|g|n] [-a ] :\n", progname); + fprintf(stderr, "\nUSAGE: %s [-d] [-s] [-b] [-f] [-l|m|c|u|g|n] [-a ] :\n", progname); fprintf(stderr, "\nUSAGE: %s [-h]\n", progname); fprintf(stderr, "\nWhere:\n"); fprintf(stderr, " -d:\n"); fprintf(stderr, " Enables debug output\n"); + fprintf(stderr, " -s:\n"); + fprintf(stderr, " Skip the .config/Make.defs existence check\n"); fprintf(stderr, " -b:\n"); #ifdef CONFIG_WINDOWS_NATIVE fprintf(stderr, " Informs the tool that it should use Windows style paths like C:\\Program Files\n"); @@ -197,13 +199,10 @@ static void show_usage(const char *progname, int exitcode) fprintf(stderr, " instead of Windows style paths like C:\\Program Files are used. POSIX\n"); fprintf(stderr, " style paths are used by default.\n"); #endif - fprintf(stderr, " -s:\n"); - fprintf(stderr, " Skip the .config/Make.defs existence check\n"); fprintf(stderr, " [-l|m|c|u|g|n]\n"); fprintf(stderr, " Selects the host environment.\n"); fprintf(stderr, " -l Selects the Linux (l) host environment.\n"); fprintf(stderr, " -m Selects the macOS (m) host environment.\n"); - fprintf(stderr, " [-c|u|g|n] selects the Windows host and a Windows host environment:\n"); fprintf(stderr, " -c Selects the Windows host and Cygwin (c) environment.\n"); fprintf(stderr, " -u Selects the Windows host and Ubuntu under Windows 10 (u) environment.\n"); fprintf(stderr, " -g Selects the Windows host and the MinGW/MSYS environment.\n"); @@ -325,7 +324,7 @@ static void parse_args(int argc, char **argv) if (optind >= argc) { - fprintf(stderr, "ERROR: Missing %c\n", g_delim); + fprintf(stderr, "ERROR: Missing :\n"); show_usage(argv[0], EXIT_FAILURE); } @@ -899,7 +898,7 @@ static void check_appdir(void) /* Try ../apps-xx.yy where xx.yy is the version string */ - snprintf(tmp, 16, ".%capps-%s", g_delim, g_verstring); + snprintf(tmp, 16, "..%capps-%s", g_delim, g_verstring); debug("check_appdir: Try appdir=%s\n", tmp); if (verify_appdir(tmp)) { @@ -1151,7 +1150,7 @@ static void copy_optional(void) { char *optsrc = strdup(g_buffer); - snprintf(g_buffer, BUFFER_SIZE, "%s%c.config", g_topdir, g_delim); + snprintf(g_buffer, BUFFER_SIZE, "%s%c%s", g_topdir, g_delim, g_optfiles[i]); debug("copy_optional: Copying from %s to %s\n", optsrc, g_buffer); copy_file(optsrc, g_buffer, 0644); @@ -1232,7 +1231,7 @@ static void set_host(const char *destconfig) case HOST_MACOS: { - printf(" Select the Linux host\n"); + printf(" Select the macOS host\n"); disable_feature(destconfig, "CONFIG_HOST_LINUX"); disable_feature(destconfig, "CONFIG_HOST_WINDOWS"); @@ -1255,7 +1254,6 @@ static void set_host(const char *destconfig) disable_feature(destconfig, "CONFIG_HOST_LINUX"); disable_feature(destconfig, "CONFIG_HOST_MACOS"); - disable_feature(destconfig, "CONFIG_WINDOWS_MSYS"); disable_feature(destconfig, "CONFIG_WINDOWS_OTHER"); enable_feature(destconfig, "CONFIG_SIM_X8664_MICROSOFT"); @@ -1272,7 +1270,7 @@ static void set_host(const char *destconfig) break; case WINDOWS_MSYS: - printf(" Select Ubuntu for Windows 10 host\n"); + printf(" Select Windows/MSYS host\n"); disable_feature(destconfig, "CONFIG_WINDOWS_CYGWIN"); enable_feature(destconfig, "CONFIG_WINDOWS_MSYS"); disable_feature(destconfig, "CONFIG_WINDOWS_UBUNTU"); diff --git a/tools/configure.sh b/tools/configure.sh index 1194b763d6..943c2d0f69 100755 --- a/tools/configure.sh +++ b/tools/configure.sh @@ -40,7 +40,8 @@ USAGE=" USAGE: ${0} [-d] [-s] [-l|m|c|u|g|n] [-a ] : Where: - -s Skip the .config/Make.defs existence check + -d enables script debug output + -s skip the .config/Make.defs existence check -l selects the Linux (l) host environment. -m selects the macOS (m) host environment. -c selects the Windows host and Cygwin (c) environment. @@ -49,10 +50,10 @@ Where: -n selects the Windows host and Windows native (n) environment. Default: Use host setup in the defconfig file Default Windows: Cygwin + -a is the path to the apps/ directory, relative to the nuttx + directory is the name of the board in the boards directory configs/ is the name of the board configuration sub-directory - is the path to the apps/ directory, relative to the nuttx - directory " diff --git a/tools/sethost.sh b/tools/sethost.sh index a9187c9cb3..8ee5580c4d 100755 --- a/tools/sethost.sh +++ b/tools/sethost.sh @@ -32,8 +32,6 @@ # POSSIBILITY OF SUCH DAMAGE. # -WD=$PWD - progname=$0 host=linux wenv=cygwin @@ -203,10 +201,6 @@ if [ "X$host" == "Xlinux" -o "X$host" == "Xmacos" ]; then kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_UBUNTU kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_MSYS kconfig-tweak --file $nuttx/.config --disable CONFIG_WINDOWS_OTHER - - kconfig-tweak --file $nuttx/.config --enable CONFIG_SIM_X8664_SYSTEMV - kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_X8664_MICROSOFT - kconfig-tweak --file $nuttx/.config --disable CONFIG_SIM_M32 else echo " Select CONFIG_HOST_WINDOWS=y" @@ -256,7 +250,6 @@ else fi fi -kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_MACOS kconfig-tweak --file $nuttx/.config --disable CONFIG_HOST_OTHER echo " Refreshing..." diff --git a/tools/testbuild.sh b/tools/testbuild.sh index 803494b781..9ffa7ed366 100755 --- a/tools/testbuild.sh +++ b/tools/testbuild.sh @@ -34,8 +34,6 @@ WD=$PWD nuttx=$WD/../nuttx -TOOLSDIR=$nuttx/tools -UNLINK=$TOOLSDIR/unlink.sh progname=$0 host=linux @@ -49,7 +47,7 @@ unset JOPTION function showusage { echo "" - echo "USAGE: $progname [-w|l] [-c|u|n] [-s] [-d] [-x] [-j ] [-a ] [-t " + echo "USAGE: $progname [-w|l] [-c|u|n] [-s] [-d] [-x] [-j ] [-a ] [-t ] " echo " $progname -h" echo "" echo "Where:" @@ -263,7 +261,7 @@ function dotest { # Perform the build test for each entry in the test list file if [ ! -d $APPSDIR ]; then - export "ERROR: No directory found at $APPSDIR" + echo "ERROR: No directory found at $APPSDIR" exit 1 fi