From 2ef8b7428d4a4bdf4c5db86236cb9bed1bcd19b4 Mon Sep 17 00:00:00 2001 From: ZanzyTHEbar Date: Tue, 21 Mar 2023 14:28:23 +0000 Subject: [PATCH] fix: prepareCMD rename zip files before release --- ESP/ini/dev_config.ini | 3 +-- ESP/src/main.cpp | 15 ++++++++--- repo-tools/scripts/prepareCMD.sh | 44 +++++--------------------------- 3 files changed, 19 insertions(+), 43 deletions(-) diff --git a/ESP/ini/dev_config.ini b/ESP/ini/dev_config.ini index b6fa883..b4556c1 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=1.0.4 +custom_firmware_version = 1.0.4 monitor_rts = 0 monitor_dtr = 0 monitor_filters = @@ -25,7 +25,6 @@ extra_scripts = pre:tools/customname.py post:tools/createzip.py build_flags = - '-DVERSION=${this.custom_firmware_version}' -DENABLE_ADHOC=${wifi.enableadhoc} -DADHOC_CHANNEL=${wifi.adhocchannel} -DWIFI_CHANNEL=${wifi.channel} diff --git a/ESP/src/main.cpp b/ESP/src/main.cpp index 93e88db..98048f2 100644 --- a/ESP/src/main.cpp +++ b/ESP/src/main.cpp @@ -24,15 +24,24 @@ ProjectConfig deviceConfig("openiris", MDNS_HOSTNAME); #if ENABLE_OTA OTA ota(&deviceConfig); -#endif // ENABLE_OTA +#endif // ENABLE_OTA LEDManager ledManager(33, &ledStateManager); #ifndef SIM_ENABLED CameraHandler cameraHandler(&deviceConfig, &ledStateManager); #endif // SIM_ENABLED -WiFiHandler wifiHandler(&deviceConfig, &wifiStateManager, &ledStateManager, WIFI_SSID, WIFI_PASSWORD, WIFI_CHANNEL); -APIServer apiServer(CONTROL_SERVER_PORT, &deviceConfig, &cameraHandler, &wifiStateManager, "/control"); +WiFiHandler wifiHandler(&deviceConfig, + &wifiStateManager, + &ledStateManager, + WIFI_SSID, + WIFI_PASSWORD, + WIFI_CHANNEL); +APIServer apiServer(CONTROL_SERVER_PORT, + &deviceConfig, + &cameraHandler, + &wifiStateManager, + "/control"); MDNSHandler mdnsHandler(&mdnsStateManager, &deviceConfig); #ifndef SIM_ENABLED diff --git a/repo-tools/scripts/prepareCMD.sh b/repo-tools/scripts/prepareCMD.sh index da7fad9..392a8c6 100644 --- a/repo-tools/scripts/prepareCMD.sh +++ b/repo-tools/scripts/prepareCMD.sh @@ -1,9 +1,5 @@ #!/bin/bash -# create a vairable to hold a passed in argument -# this argument is the next release version -# this is passed in from the .releaserc file - sudo apt-get install -y jq nextReleaseVersion=$1 @@ -34,13 +30,8 @@ if [[ $nextReleaseVersion =~ [a-zA-Z] ]]; then fi fi -# print the next release version - printf "[prepareCMD.sh]: Next version: ${nextReleaseVersion}\n" - -# This script is used to execute the prepareCMD.sh script on the remote host printf "[prepareCMD.sh]: Executing prepareCMD.sh on remote host \n" - printf "[prepareCMD.sh]: Updating the version in the library.json file \n" # make a temp file @@ -52,43 +43,20 @@ printf "[prepareCMD.sh]: Done, moving on to next files \n" sed -i -e "/^\[env\]/,/^\[.*\]/ s|^\(custom_firmware_version[ \t]*=[ \t]*\).*$|\1$nextReleaseVersion|" "./ESP/ini/dev_config.ini" -#pip3 install yq -# -#export PATH="~/.local/bin:$PATH" -#source ~/.bashrc -# -#tmp=$(mktemp) -#tomlq -t --arg version "$nextReleaseVersion" '.env.custom_firmware_version |= $version' ./ESP/ini/dev_config.ini > "$tmp" && mv "$tmp" ./ESP/ini/dev_config.ini -f - -printf "[prepareCMD.sh]: Done, continuing with release. \n" - -# mass rename files in the ./build sub folders +printf "[prepareCMD.sh]: Updating the version in the dev_config.ini file \n" 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)) - # 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 variable to hold the path to the sub folder's files - buildPathFiles=($(ls ${buildPath})) - #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 + fileToRename=$(ls ./build/${buildPath}) + newFileName=$(echo $fileToRename | sed "s/v[0-9]*\.[0-9]*\.[0-9]*/v${nextReleaseVersion}/g") + printf "[prepareCMD.sh]: Renaming file: ${fileToRename} to ${newFileName} \n" + mv ./build/${buildPath}/${fileToRename} ./build/${buildPath}/${newFileName} done -printf "[prepareCMD.sh]: Done \n" +printf "[prepareCMD.sh]: Done, continuing with release. \n"