File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88# Example:
99# ./ros2_ws_same_versions_lint --src="./workspace/src"
1010help () {
11- usage=" $( basename " $0 " ) --src=<SRC> [ --help ]
11+ usage=" $( basename " $0 " ) --src=<SRC> [--regex=<REGEX>] [ --help ]
1212
1313Check all ROS packages in the workspace have the same version
1414
1515Arguments:
1616--help Show this help text
1717--src Source folder of all ros packages (mandatory)
18+ --regex Package name need to match a regex (optional, Default=\" .*\" )
1819"
1920 echo " ${usage} "
2021}
@@ -26,6 +27,10 @@ case $i in
2627 SRC=" ${i#* =} "
2728 shift # past argument=value
2829 ;;
30+ --regex=* )
31+ REGEX=" ${i#* =} "
32+ shift # past argument=value
33+ ;;
2934 --help)
3035 HELP=YES
3136 shift # past argument with no value
@@ -47,6 +52,10 @@ if [ -z "${SRC}" ]; then
4752 exit 1
4853fi
4954
55+ if [ -z " ${REGEX} " ]; then
56+ REGEX=" .*"
57+ fi
58+
5059# Will throw an error if not installed
5160if ! command -v xmllint & > /dev/null
5261then
5665
5766# Checking package.xml
5867
59- result=$( find " ${SRC} " -name package.xml -exec xmllint --xpath ' package/version/text()' {} \; | tr ' \n' ' ' )
60-
68+ result=$( find " ${SRC} " -maxdepth 2 -regextype egrep -regex " .*${REGEX} /package.xml" -exec xmllint --xpath ' package/version/text()' {} \; | tr ' \n' ' ' )
6169array=()
6270IFS=' , ' read -r -a array <<< " ${result}"
6371
You can’t perform that action at this time.
0 commit comments