From 6e627fb873b7961633644e06ca18d8081e025e0f Mon Sep 17 00:00:00 2001 From: ZanzyTHEbar Date: Tue, 21 Mar 2023 13:32:18 +0000 Subject: [PATCH] fix: trying to fix error in release script - add quotes to dev_config version member - add stripping of quotes to customname.py - removed second for loop from shell script --- ESP/ini/dev_config.ini | 4 ++-- ESP/tools/customname.py | 15 ++++++++++--- repo-tools/scripts/prepareCMD.sh | 36 +++++++++++--------------------- 3 files changed, 26 insertions(+), 29 deletions(-) diff --git a/ESP/ini/dev_config.ini b/ESP/ini/dev_config.ini index 6f26778..22799d5 100644 --- a/ESP/ini/dev_config.ini +++ b/ESP/ini/dev_config.ini @@ -5,7 +5,7 @@ platform = espressif32 framework = arduino monitor_speed = 115200 -custom_firmware_version = 0.0.0 +custom_firmware_version="0.0.0" monitor_rts = 0 monitor_dtr = 0 monitor_filters = @@ -25,7 +25,7 @@ extra_scripts = pre:tools/customname.py post:tools/createzip.py build_flags = - -DVERSION=${this.custom_firmware_version} + '-DVERSION=${this.custom_firmware_version}' -DENABLE_ADHOC=${wifi.enableadhoc} -DADHOC_CHANNEL=${wifi.adhocchannel} -DWIFI_CHANNEL=${wifi.channel} diff --git a/ESP/tools/customname.py b/ESP/tools/customname.py index 4067b2e..965bc5a 100644 --- a/ESP/tools/customname.py +++ b/ESP/tools/customname.py @@ -116,16 +116,25 @@ def customName(project, version, commit, branch): ) ) """ + firm_version = env.GetProjectOption("custom_firmware_version") + + # strip quotes needed for shell escaping in the firmware version + + if firm_version is None: + firm_version = "0.0.0" + else: + firm_version = firm_version.replace('"', "") + firm_version = firm_version.replace("'", "") + env.Replace( PROGNAME="%s-%s-%s" % ( str(env["PIOENV"]), - env.GetProjectOption("custom_firmware_version"), + firm_version, s(defines.get("PIO_SRC_BRH")), ) ) - # detect if there is a forward slash in the PROGNAME and replace it with an underscore if "/" in env["PROGNAME"]: env.Replace(PROGNAME="%s" % (env["PROGNAME"].replace("/", "-"))) @@ -142,7 +151,7 @@ try: # Dump global construction environment (for debug purpose) # write env.Dump() to a file - #with open("env_dump.txt", "w") as f: + # with open("env_dump.txt", "w") as f: # f.write(env.Dump()) handleGit() diff --git a/repo-tools/scripts/prepareCMD.sh b/repo-tools/scripts/prepareCMD.sh index 9deed17..93ae8bf 100644 --- a/repo-tools/scripts/prepareCMD.sh +++ b/repo-tools/scripts/prepareCMD.sh @@ -68,38 +68,26 @@ printf "[prepareCMD.sh]: Mass renaming files in the ./build sub folders \n" #create an array of all the sub folders in the build folder buildPaths=($(ls ./build)) -printf "[prepareCMD.sh]: buildPaths: ${buildPaths[@]} \n" # loop through all the sub folders in the build folder for buildPath in "${buildPaths[@]}" do + printf "[prepareCMD.sh]: Build Path: ${buildPath} \n" # create a variable to hold the path to the sub folder buildPath="./build/${buildPath}" - # create a vari able to hold the path to the sub folder's files + # create a variable to hold the path to the sub folder's files buildPathFiles=($(ls ${buildPath})) - - # loop through all the files in the sub folder and rename them to the next release version - for buildPathFile in "${buildPathFiles[@]}" - do - # create a variable to hold the path to the file - buildPathFile="${buildPath}/${buildPathFile}" - - # rename the file to the next release version - # parse out the sub folder name and append it to the next release version - # this is to ensure that the file name is unique - - #create a variable that holds the current directory - currentDir=$(pwd) - - #parse out the parent folder name and store it in a variable - buildPathFileSubFolder=$(basename $(dirname ${buildPathFile})) - - # append the sub folder name to the next release version - nextReleaseVersion="${buildPathFileSubFolder}-v${nextReleaseVersion}-master" - - mv ${buildPathFile} ${buildPath}/${nextReleaseVersion}.zip - done + #create a variable that holds the current directory + currentDir=$(pwd) + + #parse out the parent folder name and store it in a variable + buildPathFileSubFolder=$(basename $(dirname ${buildPathFiles})) + + # append the sub folder name to the next release version + nextReleaseVersion="${buildPathFileSubFolder}-v${nextReleaseVersion}-master" + + mv ${buildPathFile} ${buildPath}/${nextReleaseVersion}.zip done printf "[prepareCMD.sh]: Done \n"