-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommit_protos.bash
executable file
·63 lines (49 loc) · 1.49 KB
/
commit_protos.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# Run this in rocker --home --user
set -e
set -x
mkdir -p results
protos=$(find ${ROS_DISTRO}/install/*/include/* -name '*.proto')
current_branch=$(git branch --show-current)
target_branch=${ROS_DISTRO}_generated
git branch -D ${target_branch} || true
git checkout --orphan ${target_branch}
# Set git config if unset
git config user.name || git config user.name "Automatic Update"
git config user.email || git config user.email "[email protected]"
for proto in $protos; do
echo "Proto is at"
echo $proto
package=$(echo $proto | cut -d/ -f 3)
proto_type=$(echo $proto | cut -d/ -f 7)
echo $package
result_dir=results/${ROS_DISTRO}/${package}/${proto_type}
mkdir -p $result_dir
cp $proto $result_dir
done
package_dirs=$(colcon list -p)
for pd in $package_dirs; do
license_file=$pd/LICENSE
echo Trying License file: $license_file
if ! [ -f $license_file ] ; then
license_file=$(dirname $pd)/LICENSE
fi
if ! [ -f $license_file ] ; then
echo NO license file at $license_file either, continuing
continue
fi
package=$(basename $pd)
result_dir=results/${ROS_DISTRO}/${package}/
if [ -d $result_dir ] ; then
cp $license_file $result_dir
fi
done
echo "Git adding results directory"
git add results -f
if ! git diff --cached --exit-code
then
git commit -m"Updating protos for distro ${ROS_DISTRO} in branch ${target_branch}"
else
echo "Nothing to commit, skipping commit and push"
fi
git checkout ${current_branch}