22
33ROOT=$( cd " $( dirname " $0 " ) /../.." && pwd)
44
5- # This function compare new version with current version of a depdendency and exit
6- # the script if the versions are the same
5+ # This function compare new version with current version of a depdendency and
6+ # exit the script if the versions are the same
77#
8- # $1 is the package name e.g. 'acorn', 'ada', 'base64' etc. See that file
9- # for a complete list of package name
8+ # $1 is the package name e.g. 'acorn', 'ada', 'base64' etc. See the file
9+ # doc/contributing/maintaining/maintaining-dependencies.md for a complete list
10+ # of package name
1011# $2 is the new version.
1112compare_dependency_version () {
12- package_name=" $1 "
13- new_version=" $2 "
14- current_version=" $3 "
15- echo " Comparing $new_version with $current_version "
16- if [ " $new_version " = " $current_version " ]; then
17- echo " Skipped because $package_name is on the latest version."
18- exit 0
19- fi
13+ package_name=" $1 "
14+ new_version=" $2 "
15+ current_version=" $3 "
16+ echo " Comparing $new_version with $current_version "
17+ if [ " $new_version " = " $current_version " ]; then
18+ echo " Skipped because $package_name is on the latest version."
19+ exit 0
20+ fi
2021}
2122
2223# This function inform to commit the new version of a maintained dependency
2324# and print the last line of the script "NEW_VERSION=$NEW_VERSION" as we need
2425# to add it to $GITHUB_ENV variable.
2526#
26- # $1 is the package name e.g. 'acorn', 'ada', 'base64' etc. See that file
27- # for a complete list of package name
27+ # $1 is the package name e.g. 'acorn', 'ada', 'base64' etc. See the file
28+ # doc/contributing/maintaining/maintaining-dependencies.md for a complete list
29+ # of package name
2830# $2 is the new version.
2931finalize_version_update () {
30- package_name=" $1 "
31- new_version=" $2 "
32- echo " All done!"
33- echo " "
34- echo " Please git add $package_name , commit the new version:"
35- echo " "
36- echo " $ git add -A deps/$package_name "
37- echo " $ git add doc/contributing/maintaining/maintaining-dependencies.md"
38- echo " $ git commit -m \" deps: update $package_name to $new_version \" "
39- echo " "
32+ package_name=" $1 "
33+ new_version=" $2 "
34+ echo " All done!"
35+ echo " "
36+ echo " Please git add $package_name , commit the new version:"
37+ echo " "
38+ echo " $ git add -A deps/$package_name "
39+ echo " $ git add doc/contributing/maintaining/maintaining-dependencies.md"
40+ echo " $ git commit -m \" deps: update $package_name to $new_version \" "
41+ echo " "
4042
41- # The last line of the script should always print the new version,
42- # as we need to add it to $GITHUB_ENV variable.
43- echo " NEW_VERSION=$new_version "
43+ # The last line of the script should always print the new version,
44+ # as we need to add it to $GITHUB_ENV variable.
45+ echo " NEW_VERSION=$new_version "
4446}
4547
4648# This function update the version of a maintained dependency in
@@ -50,12 +52,12 @@ finalize_version_update() {
5052# for a complete list of package name
5153# $2 is the new version.
5254update_dependency_version () {
53- package_name=" $1 "
54- new_version=" $2 "
55- deps_file_path=" $ROOT /doc/contributing/maintaining/maintaining-dependencies.md"
56- # Remove version dots for anchor markdown
57- version_no_dots=$( echo " $new_version " | sed -e ' s/\.//g' )
58- perl -i -pe ' s|^\* \[' " $package_name " ' .*|* [' " $package_name " ' ' " $new_version " ' ][]|' " $deps_file_path "
59- perl -i -pe ' s|^\[' " $package_name " ' .*\]: #' " $package_name " ' .*|[' " $package_name " ' ' " $new_version " ' ]: #' " $package_name " ' -' " $version_no_dots " ' |' " $deps_file_path "
60- perl -i -pe ' s|^### ' " $package_name " ' .*|### ' " $package_name " ' ' " $new_version " ' |' " $deps_file_path "
55+ package_name=" $1 "
56+ new_version=" $2 "
57+ deps_file_path=" $ROOT /doc/contributing/maintaining/maintaining-dependencies.md"
58+ # Remove version dots for anchor markdown
59+ version_no_dots=$( echo " $new_version " | sed -e ' s/\.//g' )
60+ perl -i -pe ' s|^\* \[' " $package_name " ' .*|* [' " $package_name " ' ' " $new_version " ' ][]|' " $deps_file_path "
61+ perl -i -pe ' s|^\[' " $package_name " ' .*\]: #' " $package_name " ' .*|[' " $package_name " ' ' " $new_version " ' ]: #' " $package_name " ' -' " $version_no_dots " ' |' " $deps_file_path "
62+ perl -i -pe ' s|^### ' " $package_name " ' .*|### ' " $package_name " ' ' " $new_version " ' |' " $deps_file_path "
6163}
0 commit comments