Skip to content

Commit 9ff28e6

Browse files
committed
ci(stm32variant): list directories change
to warn user about new directories and ones to remove. Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent d7462b1 commit 9ff28e6

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

CI/update/stm32variant.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2014,7 +2014,9 @@ def aggregate_dir():
20142014
out_family_path = root_dir / "variants" / mcu_family.name
20152015
# Get all mcu_dir
20162016
mcu_dirs = sorted(mcu_family.glob("*/"))
2017-
2017+
# Get original directory list of current serie STM32YYxx
2018+
mcu_out_dirs_ori = sorted(out_family_path.glob("*/"))
2019+
mcu_out_dirs_up = []
20182020
# Group mcu directories when only expressions and xml file name are different
20192021
while mcu_dirs:
20202022
# Pop first item
@@ -2076,8 +2078,38 @@ def aggregate_dir():
20762078
fname.unlink()
20772079
else:
20782080
fname.replace(out_path / fname.name)
2081+
# Append updated directory to the list of current serie STM32YYxx
2082+
mcu_out_dirs_up.append(out_path)
20792083
del group_mcu_dir[:]
20802084
del mcu_dir1_files_list[:]
2085+
mcu_out_dirs_up.sort()
2086+
new_dirs = set(mcu_out_dirs_up) - set(mcu_out_dirs_ori)
2087+
if new_dirs:
2088+
nb_new = len(new_dirs)
2089+
dir_str = "directories" if nb_new > 1 else "directory"
2090+
print(f"\nNew {dir_str} for {mcu_family.name}:\n")
2091+
for d in new_dirs:
2092+
print(f" - {d.name}")
2093+
print("\n --> Please, check if it is a new directory or a renamed one.")
2094+
old_dirs = set(mcu_out_dirs_ori) - set(mcu_out_dirs_up)
2095+
if old_dirs:
2096+
nb_old = len(old_dirs)
2097+
dir_str = "Directories" if nb_old > 1 else "Directory"
2098+
print(f"\n{dir_str} not updated for {mcu_family.name}:\n")
2099+
for d in old_dirs:
2100+
print(f" - {d.name}")
2101+
print(
2102+
"""
2103+
--> Please, check if it is due to directory name update (renamed), if true then:
2104+
- Move custom boards definition files, if any.
2105+
- Move linker script(s), if any.
2106+
- Copy 'SystemClock_Config(void)' function to the new generic clock config file.
2107+
--> Then remove it, update old path in boards.txt
2108+
(for custom board(s) as well as generic ones).
2109+
"""
2110+
)
2111+
del mcu_out_dirs_ori[:]
2112+
del mcu_out_dirs_up[:]
20812113

20822114

20832115
def default_cubemxdir():

0 commit comments

Comments
 (0)