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
This commit is contained in:
ZanzyTHEbar 2023-03-21 13:32:18 +00:00
parent aee0719ee5
commit 6e627fb873
3 changed files with 26 additions and 29 deletions

View File

@ -5,7 +5,7 @@
platform = espressif32 platform = espressif32
framework = arduino framework = arduino
monitor_speed = 115200 monitor_speed = 115200
custom_firmware_version = 0.0.0 custom_firmware_version="0.0.0"
monitor_rts = 0 monitor_rts = 0
monitor_dtr = 0 monitor_dtr = 0
monitor_filters = monitor_filters =
@ -25,7 +25,7 @@ extra_scripts =
pre:tools/customname.py pre:tools/customname.py
post:tools/createzip.py post:tools/createzip.py
build_flags = build_flags =
-DVERSION=${this.custom_firmware_version} '-DVERSION=${this.custom_firmware_version}'
-DENABLE_ADHOC=${wifi.enableadhoc} -DENABLE_ADHOC=${wifi.enableadhoc}
-DADHOC_CHANNEL=${wifi.adhocchannel} -DADHOC_CHANNEL=${wifi.adhocchannel}
-DWIFI_CHANNEL=${wifi.channel} -DWIFI_CHANNEL=${wifi.channel}

View File

@ -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( env.Replace(
PROGNAME="%s-%s-%s" PROGNAME="%s-%s-%s"
% ( % (
str(env["PIOENV"]), str(env["PIOENV"]),
env.GetProjectOption("custom_firmware_version"), firm_version,
s(defines.get("PIO_SRC_BRH")), s(defines.get("PIO_SRC_BRH")),
) )
) )
# detect if there is a forward slash in the PROGNAME and replace it with an underscore # detect if there is a forward slash in the PROGNAME and replace it with an underscore
if "/" in env["PROGNAME"]: if "/" in env["PROGNAME"]:
env.Replace(PROGNAME="%s" % (env["PROGNAME"].replace("/", "-"))) env.Replace(PROGNAME="%s" % (env["PROGNAME"].replace("/", "-")))
@ -142,7 +151,7 @@ try:
# Dump global construction environment (for debug purpose) # Dump global construction environment (for debug purpose)
# write env.Dump() to a file # 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()) # f.write(env.Dump())
handleGit() handleGit()

View File

@ -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 #create an array of all the sub folders in the build folder
buildPaths=($(ls ./build)) buildPaths=($(ls ./build))
printf "[prepareCMD.sh]: buildPaths: ${buildPaths[@]} \n"
# loop through all the sub folders in the build folder # loop through all the sub folders in the build folder
for buildPath in "${buildPaths[@]}" for buildPath in "${buildPaths[@]}"
do do
printf "[prepareCMD.sh]: Build Path: ${buildPath} \n"
# create a variable to hold the path to the sub folder # create a variable to hold the path to the sub folder
buildPath="./build/${buildPath}" 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})) buildPathFiles=($(ls ${buildPath}))
#create a variable that holds the current directory
# loop through all the files in the sub folder and rename them to the next release version currentDir=$(pwd)
for buildPathFile in "${buildPathFiles[@]}"
do #parse out the parent folder name and store it in a variable
# create a variable to hold the path to the file buildPathFileSubFolder=$(basename $(dirname ${buildPathFiles}))
buildPathFile="${buildPath}/${buildPathFile}"
# append the sub folder name to the next release version
# rename the file to the next release version nextReleaseVersion="${buildPathFileSubFolder}-v${nextReleaseVersion}-master"
# parse out the sub folder name and append it to the next release version
# this is to ensure that the file name is unique mv ${buildPathFile} ${buildPath}/${nextReleaseVersion}.zip
#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
done done
printf "[prepareCMD.sh]: Done \n" printf "[prepareCMD.sh]: Done \n"