From 49fefc9bf050d85c111b9ad95180cae442c06fdf Mon Sep 17 00:00:00 2001 From: Konstantin Pavlov Date: Thu, 16 Jun 2022 06:59:32 +0300 Subject: [PATCH] Straight and simple realization of recursive scripts --- gitignores/.gitignore_vivado | 2 ++ scripts/clean_quartus.bat | 62 ++++++++++++++++++++--------------- scripts/clean_recursively.bat | 2 +- scripts/clean_vivado.bat | 35 ++++++++++++-------- scripts/cp_recursively.bat | 31 ++++++++++++++++++ scripts/git_pull_subdirs.bat | 44 +++++++++++++++++++++++++ scripts/update_git_repos.sh | 10 +++--- 7 files changed, 139 insertions(+), 47 deletions(-) create mode 100644 scripts/cp_recursively.bat create mode 100644 scripts/git_pull_subdirs.bat diff --git a/gitignores/.gitignore_vivado b/gitignores/.gitignore_vivado index c8c58be..219e052 100755 --- a/gitignores/.gitignore_vivado +++ b/gitignores/.gitignore_vivado @@ -11,6 +11,7 @@ *.cache *.hw +*.ip_user_files *.runs *.sim .Xil @@ -18,4 +19,5 @@ *.jou *.log *.str +*.tmp diff --git a/scripts/clean_quartus.bat b/scripts/clean_quartus.bat index f9f81df..e0ffbea 100644 --- a/scripts/clean_quartus.bat +++ b/scripts/clean_quartus.bat @@ -7,38 +7,46 @@ rem ---------------------------------------------------------------------------- rem Use this file as a boilerplate for your custom clean script rem for Quartus projects -SET PROJ=test -rem Common junk files -del /s /q .\%PROJ%.qws -del /s /q .\c5_pin_model_dump.txt -del /s /q .\%PROJ%.ipregen.rpt -del /s /f /q .\.qsys_edit\* -rmdir /s /q .\.qsys_edit\ -del /s /q .\%PROJ%_assignment_defaults.qdf +for /R %%f in (*.qpf) do ( + echo "Project name is %%~nf" -rem Compilation databases -del /s /f /q .\db\* -rmdir /s /q .\db\ -del /s /f /q .\incremental_db\* -rmdir /s /q .\incremental_db\ -del /s /f /q .\greybox_tmp\* -rmdir /s /q .\greybox_tmp\ + rem Common junk files + del /s /q .\%%~nf.qws + del /s /q .\c5_pin_model_dump.txt + del /s /q .\%%~nf.ipregen.rpt + del /s /f /q .\.qsys_edit\* + rmdir /s /q .\.qsys_edit\ + del /s /q .\%%~nf_assignment_defaults.qdf -rem Output directory -del /s /f /q .\out\* -rmdir /s /q .\out\ + rem Compilation databases + del /s /f /q .\db\* + rmdir /s /q .\db\ + del /s /f /q .\incremental_db\* + rmdir /s /q .\incremental_db\ + del /s /f /q .\greybox_tmp\* + rmdir /s /q .\greybox_tmp\ -rem Design space explorer files -del /s /f /q .\dse\* -rmdir /s /q .\dse\ -del /s /q .\dse1_base.qpf -del /s /q .\dse1_base.qsf -del /s /q .\%PROJ%.dse.rpt -del /s /q .\%PROJ%.archive.rpt + rem Output directory + del /s /f /q .\out\* + rmdir /s /q .\out\ + del /s /f /q .\output\* + rmdir /s /q .\output\ + del /s /f /q .\OUTPUT\* + rmdir /s /q .\OUTPUT\ -rem Early power estimator files -del /s /q .\%PROJ%_early_pwr.csv + rem Design space explorer files + del /s /f /q .\dse\* + rmdir /s /q .\dse\ + del /s /q .\dse1_base.qpf + del /s /q .\dse1_base.qsf + del /s /q .\%%~nf.dse.rpt + del /s /q .\%%~nf.archive.rpt + + rem Early power estimator files + del /s /q .\%%~nf_early_pwr.csv + +) pause goto :eof diff --git a/scripts/clean_recursively.bat b/scripts/clean_recursively.bat index bfe2aa7..55d025b 100755 --- a/scripts/clean_recursively.bat +++ b/scripts/clean_recursively.bat @@ -21,7 +21,7 @@ echo INFO: The script may sometimes take a long time to complete for /R /d %%D in (*) do ( - echo %%~fD + rem echo %%~fD cd %%~fD if exist clean.bat @echo | call clean.bat diff --git a/scripts/clean_vivado.bat b/scripts/clean_vivado.bat index 387e676..ffd3750 100755 --- a/scripts/clean_vivado.bat +++ b/scripts/clean_vivado.bat @@ -9,26 +9,33 @@ rem Use this file as a boilerplate for your custom clean script rem for Vivado/Vitis projects -SET PROJ=test +for /R %%f in (*.xpr) do ( + echo "Project name is %%~nf" -del /s /f /q .\%PROJ%.cache\* -rmdir /s /q .\%PROJ%.cache\ + del /s /f /q .\%%~nf.cache\* + rmdir /s /q .\%%~nf.cache\ -del /s /f /q .\%PROJ%.hw\* -rmdir /s /q .\%PROJ%.hw\ + del /s /f /q .\%%~nf.hw\* + rmdir /s /q .\%%~nf.hw\ -rem del /s /f /q .\%PROJ%.runs\* -rem rmdir /s /q .\%PROJ%.runs\ + del /s /f /q .\%%~nf.ip_user_files\* + rmdir /s /q .\%%~nf.ip_user_files\ -del /s /f /q .\%PROJ%.sim\* -rmdir /s /q .\%PROJ%.sim\ + del /s /f /q .\%%~nf.runs\* + rmdir /s /q .\%%~nf.runs\ -del /s /f /q .\.Xil\* -rmdir /s /q .\.Xil\ + del /s /f /q .\%%~nf.sim\* + rmdir /s /q .\%%~nf.sim\ -del /s /f /q .\*.jou -del /s /f /q .\*.log -del /s /f /q .\*.str + del /s /f /q .\.Xil\* + rmdir /s /q .\.Xil\ + + del /s /f /q .\*.jou + del /s /f /q .\*.log + del /s /f /q .\*.str + del /s /f /q .\*.tmp + +) pause goto :eof diff --git a/scripts/cp_recursively.bat b/scripts/cp_recursively.bat new file mode 100644 index 0000000..301c892 --- /dev/null +++ b/scripts/cp_recursively.bat @@ -0,0 +1,31 @@ +@echo off +rem ------------------------------------------------------------------------------ +rem cp_recursively.bat +rem published as part of https://github.com/pConst/basic_verilog +rem Konstantin Pavlov, pavlovconst@gmail.com +rem ------------------------------------------------------------------------------ + +rem Use this script to walk through all subdirs and update files with +rem specific names to the latest version + + +echo INFO: ===================================================================== +echo INFO: cp_recursively.bat +echo INFO: The script may sometimes take a long time to complete + +for /R /d %%D in (*) do ( + + rem echo %%~fD + cd %%~fD + + if exist clean_recursively.bat cp -dv j:\basic_verilog\scripts\clean_recursively.bat .\clean_recursively.bat + + if exist clean_quartus.bat cp -dv j:\basic_verilog\scripts\clean_quartus.bat .\clean_quartus.bat + if exist clean_vivado.bat cp -dv j:\basic_verilog\scripts\clean_vivado.bat .\clean_vivado.bat + if exist clean_gowin.bat cp -dv j:\basic_verilog\scripts\clean_gowin.bat .\clean_gowin.bat + if exist clean_modelsim.bat cp -dv j:\basic_verilog\scripts\clean_modelsim.bat .\clean_modelsim.bat +) + +pause +goto :eof + diff --git a/scripts/git_pull_subdirs.bat b/scripts/git_pull_subdirs.bat new file mode 100644 index 0000000..6735f2a --- /dev/null +++ b/scripts/git_pull_subdirs.bat @@ -0,0 +1,44 @@ +@echo off +rem ---------------------------------------------------------------------------- +rem git_pull_subdirs.bat +rem published as part of https://github.com/pConst/basic_verilog +rem Konstantin Pavlov, pavlovconst@gmail.com +rem ---------------------------------------------------------------------------- + +rem Use this script to walk through all subdirs and perform git pull there + +rem =========================================================================== +rem !! CAUTION! All repos will be reset and all uncommitted changes lost !! +rem =========================================================================== + +echo INFO: ===================================================================== +echo INFO: git_pull_subdirs.bat +echo INFO: The script may sometimes take a long time to complete + +for /R /d %%D in (*) do ( + + rem echo %%~fD + cd %%~fD + + if exist .git ( + + rem Skip pulling submodules + if not exist ../.gitmodules ( + + echo: + echo %%~fD + rem git reset --hard + + rem git submodule init + rem git submodule update + rem git fetch --all + + rem git pull --recurse-submodules --all + git pull --all + ) + ) +) + +pause +goto :eof + diff --git a/scripts/update_git_repos.sh b/scripts/update_git_repos.sh index 4d9647f..742a81b 100755 --- a/scripts/update_git_repos.sh +++ b/scripts/update_git_repos.sh @@ -8,14 +8,14 @@ # =========================================================================== # !! CAUTION! All repos will be reset and all uncommitted changes lost !! # =========================================================================== +# +# see git_pull_subdirs.bat for mode convinient and clever script variant +# export GIT_DISCOVERY_ACROSS_FILESYSTEM=1 eval $(ssh-agent) ssh-add -find . -maxdepth 2 -type d -exec git -C {} reset --hard \; -find . -maxdepth 2 -type d -exec git -C {} submodule init \; -find . -maxdepth 2 -type d -exec git -C {} submodule update \; - -find . -maxdepth 2 -type d -exec echo {} ' ' \; -exec git -C {} pull \; +find . -type d -exec echo {} ' ' \; -exec git -C {} reset --hard \; +find . -type d -exec echo {} ' ' \; -exec git -C {} pull --recurse-submodules --all \;