-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathProjectXML
executable file
·137 lines (121 loc) · 5.45 KB
/
ProjectXML
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/bin/sh
usage() {
cat << EOF
Quick regenerator of zproject templates as used by 42ity ecosystem workflow,
including removal of CMake recipes we do not use in our common components
(see --kill-cmake|--keep-cmake for definitive behavior).
After the job is done, it verifies the recipes by running autogen, and then
starts "git difftool" and "git status" so you can revise the templated changes
The "gsl" tool should be installed (from zeromq repo, not older imatix one).
By default uses the currently checked-out workspace under FTY dispatcher repo
if present, or the system installation if used as a standalone script; also
can use another (-d) or even update the system installation (see -r vs. -q)
if your "sudo" setup permits that; and to use the current system installation
of zproject pass the -d " " option. You can pre-export a ZPROJECT_SRC value
in your shell profile, to use some custom path or the system installation.
To update a Jenkinsfile (not overwritten by default) use -J
To update a .travis.yml (not overwritten by default) use -T
To update git/IDE/clang configs (not overwritten by default) use -G
Update all files above with -A
(C) 2015-2018 by Eaton
EOF
}
[ -s project.xml ] || { echo "FATAL: Your current directory must be the root of a component managed by zproject (project.xml not found in `pwd`)" >&2; exit 1; }
export PATH=/usr/local/bin:$PATH
### Note : you can set your default preference in a shell profile
#ZPROJECT_REMAKE=yes
#ZPROJECT_SRC="$HOME/zeromq/zproject"
[ -n "$ZPROJECT_REMAKE" ] || ZPROJECT_REMAKE=no
[ -n "$ZPROJECT_SRC" ] || { [ -d "`dirname $0`/zproject" ] && ZPROJECT_SRC="`dirname $0`/zproject" ; }
[ -n "$ZPROJECT_UPDATE_TRAVIS_FILE" ] || ZPROJECT_UPDATE_TRAVIS_FILE=no
[ -n "$ZPROJECT_UPDATE_JENKINSFILE" ] || ZPROJECT_UPDATE_JENKINSFILE=no
[ -n "$ZPROJECT_UPDATE_HELPER_FILE" ] || ZPROJECT_UPDATE_HELPER_FILE=no
[ -n "$ZPROJECT_UPDATE_SELFTEST_FILE" ] || ZPROJECT_UPDATE_SELFTEST_FILE=no
[ -n "$ZPROJECT_REMOVE_CMAKE" ] || ZPROJECT_REMOVE_CMAKE=auto
while [ $# -gt 0 ]; do
case "$1" in
-h|-help|--help) usage; exit 0 ;;
-q) ZPROJECT_REMAKE=no ;;
-r) ZPROJECT_REMAKE=yes ;;
-d) ZPROJECT_SRC="$2"; shift ;;
--auto-cmake) ZPROJECT_REMOVE_CMAKE=auto ;;
--keep-cmake) ZPROJECT_REMOVE_CMAKE=no ;;
--kill-cmake) ZPROJECT_REMOVE_CMAKE=yes ;;
-J) ZPROJECT_UPDATE_JENKINSFILE=yes ;;
-T) ZPROJECT_UPDATE_TRAVIS_FILE=yes ;;
-G) ZPROJECT_UPDATE_HELPER_FILE=yes ;;
-S) ZPROJECT_UPDATE_SELFTEST_FILE=yes ;;
-A) ZPROJECT_UPDATE_JENKINSFILE=yes ; ZPROJECT_UPDATE_TRAVIS_FILE=yes ; ZPROJECT_UPDATE_HELPER_FILE=yes ; ZPROJECT_UPDATE_SELFTEST_FILE=yes ;;
*) echo "Unknown param: '$1'" >&2 ; exit 1 ;;
esac
shift
done
[ "$ZPROJECT_UPDATE_TRAVIS_FILE" = no ] || rm -f .travis.yml
[ "$ZPROJECT_UPDATE_JENKINSFILE" = no ] || rm -f Jenkinsfile
[ "$ZPROJECT_UPDATE_HELPER_FILE" = no ] || rm -f .gitignore .gitattributes .editorconfig .clang-format
# Visibility of selftest functions had changed over time:
[ "$ZPROJECT_UPDATE_SELFTEST_FILE" = no ] || rm -f src/selftest.h
if [ -n "$ZPROJECT_SRC" ] && [ "$ZPROJECT_SRC" != " " ]; then
if [ ! -d "$ZPROJECT_SRC" ]; then
echo "FATAL: ZPROJECT_SRC='$ZPROJECT_SRC' was not found. Use an empty argument -d '' to use the system installation" >&2
exit 1
fi
if [ "$ZPROJECT_REMAKE" = yes ]; then
echo "NOTE: Updating system installation of zproject from custom sources at $ZPROJECT_SRC"
( cd "$ZPROJECT_SRC" && make || exit
sudo make install || exit ) || exit
else
echo "NOTE: Using custom sources of zproject from $ZPROJECT_SRC"
[ -s "$ZPROJECT_SRC/zproject.gsl" ] || { echo "FATAL: No zproject.gsl in '$ZPROJECT_SRC' directory (-d must point to a zproject source dir)!" >&2 ; exit 1; }
PATH="$ZPROJECT_SRC:$PATH"
export PATH
fi
else
echo "NOTE: Using system installation of zproject"
fi
gsl project.xml || exit
[ "$ZPROJECT_REMOVE_CMAKE" = auto ] && \
case "`pwd`" in
# */etn-mass-management*) ZPROJECT_REMOVE_CMAKE=no ;;
*/fty-*|*/etn-*|/ipm-*)
echo "REMOVING CMAKE files from fty-* sources by default"
ZPROJECT_REMOVE_CMAKE=yes ;;
*) ZPROJECT_REMOVE_CMAKE=no ;;
esac
if [ "$ZPROJECT_REMOVE_CMAKE" = yes ]; then
echo "REMOVING CMAKE files from `pwd` zproject..."
rm -f CMake* *.cmake || true
rm -rf builds/cmake || true
if ! egrep -q "(Remove CMake|CMake in general)" .gitignore ; then
echo "GitIgnoring CMAKE files from `pwd` zproject..."
sed -i '3s/^/### Note: General ignorance of CMake files has been added in gitignore; take care upon regens\n\n/' .gitignore
# Primarily, try to fit the ignorance near other CMake rules as we do elsewhere
CMAKE_PATCH='diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -93,4 +74,9 @@
Testing/
+# CMake in general
+builds/cmake/
+CMake*
+*.cmake
+
# Repositories downloaded by CI integration scripts
tmp-deps/
'
if echo "$CMAKE_PATCH" | gpatch --dry-run --quiet 2>/dev/null >/dev/null ; then
echo "GITIGNORE CMAKE files via GNU patching near other CMake rules..."
echo "$CMAKE_PATCH" | gpatch && rm -f .gitignore.orig
else
# Append the data somewhere at least
echo "GITIGNORE CMAKE files via appending to end of file..."
cat >> .gitignore << EOF
# CMake in general
builds/cmake/
CMake*
*.cmake
EOF
fi
fi
fi
./autogen.sh && git difftool -y && git status