1010import subprocess
1111
1212
13- COMMIT_BASE_URL = 'https://github.com/espressif/iperf-cmd/commit/'
13+ RELEASE_TAG_BASE_URL = 'https://github.com/espressif/iperf-cmd/releases/tag'
14+ IPERF_COMPONENT_URL = 'https://components.espressif.com/components/espressif/iperf'
1415PROJECT_ROOT = pathlib .Path (__file__ ).resolve ().parents [1 ]
1516CZ_OLD_TAG = os .environ ['CZ_PRE_CURRENT_TAG_VERSION' ]
1617CZ_NEW_TAG = os .environ ['CZ_PRE_NEW_TAG_VERSION' ]
@@ -36,7 +37,7 @@ def check_repo():
3637 '''Check current ref tag in repository
3738 '''
3839 subprocess .check_call (
39- ['git' , 'fetch' , '--prune' , '--prune-tags' ],
40+ ['git' , 'fetch' , '--prune' , '--prune-tags' , '--force' ],
4041 cwd = PROJECT_ROOT ,
4142 )
4243
@@ -54,7 +55,8 @@ def update_changelog():
5455 # Update ChangeLog
5556 for component in ['iperf' , 'iperf-cmd' ]:
5657 git_logs = subprocess .check_output (
57- ['git' , 'log' , f'{ CZ_OLD_TAG } ..HEAD' , f'{ component } ' ],
58+ # ignore merge commits
59+ ['git' , 'log' , '--no-merges' , f'{ CZ_OLD_TAG } ..HEAD' , f'{ component } ' ],
5860 cwd = PROJECT_ROOT ,
5961 ).decode ()
6062
@@ -64,11 +66,15 @@ def update_changelog():
6466 commit = COMMIT_PATTERN .match (commit_log ).group (0 )
6567 for match in CHANGELOG_PATTERN .finditer (commit_log ):
6668 if match .group (2 ):
67- _changelog = f'- { match .group (2 )} : { match .group (3 )} ([{ commit } ]({ COMMIT_BASE_URL } { commit } ))'
69+ _changelog = f'- { match .group (2 )} : { match .group (3 )} ([{ commit } ]({ RELEASE_TAG_BASE_URL } { commit } ))'
6870 else :
69- _changelog = f'- { match .group (3 )} ([{ commit } ]({ COMMIT_BASE_URL } { commit } ))'
71+ _changelog = f'- { match .group (3 )} ([{ commit } ]({ RELEASE_TAG_BASE_URL } { commit } ))'
7072 changelogs [CHANGELOG_SECTIONS [match .group (1 )]].append (_changelog )
7173
74+ if component == 'iperf-cmd' :
75+ _changelog = f'- update dependencies [espressif/iperf]({ IPERF_COMPONENT_URL } ) to { CZ_NEW_TAG } '
76+ changelogs ['Updates' ].append (_changelog )
77+
7278 # Update changelog file
7379 with open (str (PROJECT_ROOT / component / 'CHANGELOG.md' ), encoding = 'utf-8' ) as fr :
7480 changelog_data = fr .readlines ()
@@ -79,7 +85,7 @@ def update_changelog():
7985 changelog_data .insert (2 , f'### { key } \n \n ' + '\n ' .join (values ) + '\n \n ' )
8086 changed = True
8187 if changed :
82- changelog_data .insert (2 , f'## [{ CZ_NEW_TAG } ]({ COMMIT_BASE_URL } /{ CZ_NEW_TAG } )\n \n ' )
88+ changelog_data .insert (2 , f'## [{ CZ_NEW_TAG } ]({ RELEASE_TAG_BASE_URL } /{ CZ_NEW_TAG } )\n \n ' )
8389 with open (str (PROJECT_ROOT / component / 'CHANGELOG.md' ), 'w' , encoding = 'utf-8' ) as fw :
8490 fw .write ('' .join (changelog_data ))
8591
0 commit comments