forked from JdeRobot/base
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclean_repository
executable file
·46 lines (37 loc) · 1.27 KB
/
clean_repository
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
#!/bin/sh
#
# Authors:
# mikel, rocapal, mmoya(mikel), varhub
# Signed by:
# varhub, fqez (2015.12.01)
delete=-delete
[ "$1" = "--dry-run" ] && delete='-print'
[ "$1" = "--verbose" ] && delete="-print $delete"
# Execution is only allowed from root directory
test -d src/stable && test -d src/testing
if [ $? -ne 0 ]
then
echo 'Execution is only allowed from root directory'>&2
exit 1
fi
# halt on fail
set -e
## Remove CMake generated files
# remove cmake_(un)?install.cmake files
find -type f -name cmake_install.cmake $delete
find -type f -name cmake_uninstall.cmake $delete
# remove whole CMake build directories (a.k.a CMakeFiles subtree)
find . -type d -name CMakeFiles $delete -o -path '*/CMakeFiles/*' $delete
# remove Makefile files
# whitelist!
find . -type f -name Makefile ! -path '*/doc/paper-autonomous_robots/Makefile' $delete
find . -type f -name 'Makefile-*' $delete
# remove CMakeCache.txt files
find -type f -name CMakeCache.txt $delete
## remove generated interface source files
# whitelist approach
find src/stable/interfaces/ ! -name '*.ice' ! -name 'CMakeLists.txt' ! -name '.keepme' -type f $delete
## remove generated libraries (*.so and *.a files)
find -type f -name '*\.so' $delete
find -type f -name '*\.so\.*' $delete
find -type f -name '*\.a' $delete