forked from OpenRTM/OpenRTP-aist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_packages
executable file
·250 lines (229 loc) · 6.38 KB
/
check_packages
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
#!/bin/bash
#
# @file check_package
# @brief check script for OpenRTP eclipse packages
# @author Noriaki Ando <[email protected]>
#
#------------------------------
#
#
true ${WORK_DIR:=work_$$}
# target projects
PROJECTS="jp.go.aist.rtm.toolscommon.profiles
jp.go.aist.rtm.toolscommon.profiles.nl1
jp.go.aist.rtm.toolscommon
jp.go.aist.rtm.toolscommon.nl1
jp.go.aist.rtm.rtcbuilder
jp.go.aist.rtm.rtcbuilder.nl1
jp.go.aist.rtm.rtcbuilder.java
jp.go.aist.rtm.rtcbuilder.python
jp.go.aist.rtm.rtcbuilder.lua
jp.go.aist.rtm.repositoryView
jp.go.aist.rtm.repositoryView.nl1
jp.go.aist.rtm.nameserviceview
jp.go.aist.rtm.nameserviceview.nl1
jp.go.aist.rtm.systemeditor
jp.go.aist.rtm.systemeditor.nl1"
#------------------------------------------------------------
# get_version
#
# This function gets version number and project version string
# from version text file.
# ------------------------------------------------------------
get_version()
{
if test "x$VERSION" = "x" || test "x$PROJECT_VERSION" = "x" ; then
echo "Environment variable VERSION/PROJECT_VERSION is not set."
echo "Getting from ./version text."
if test ! -f version.txt ; then
echo "version.txt not found. Plugins should be built at first."
echo "Aborting."
exit 1
fi
. ./version.txt
fi
export VERSION
export PROJECT_VERSION
if test "x$DISTDIR" = "x" ; then
DISTDIR=openrtp-$VERSION
fi
if test "x$JARDIR" = "x" ; then
JARDIR=$JARDIR_DEFAULT
fi
}
#------------------------------------------------------------
# check_archive
#------------------------------------------------------------
check_archive()
{
rm -rf $WORK_DIR/eclipse
mkdir -p $WORK_DIR
zip=`echo $FILE_NAME | grep '[zZ][iI][pP]'`
tar=`echo $FILE_NAME | grep '[tT][aA][rR].[gG][zZ]'`
if test ! "x$zip" = "x" ; then
echo "Extracting zip file: $FILE_NAME ..."
unzip $FILE_NAME -d $WORK_DIR >/dev/null 2>&1 && return 0
echo "Failed to extract zip file: $FILE_NAME. Aborting..."
return 1
elif test ! "x$tar" = "x" ; then
echo "Extracting tar.gz file: $FILE_NAME ..."
tar xvzf $FILE_NAME -C $WORK_DIR >/dev/null 2>&1 && return 0
echo "Failed to extract tar.gz file: $FILE_NAME. Aborting..."
return 1
else
echo "Unknown file extention. Aborting..."
return 1
fi
return 1
}
check_dependent_plugins()
{
plugins="org.eclipse.emf_*.jar
org.eclipse.gef_*.jar
org.eclipse.xsd_*.jar
org.eclipse.emf.ecore.xcore_*.jar"
for p in $plugins ; do
tmp=`ls $WORK_DIR/eclipse/plugins/$p`
if test "x$tmp" = "x" ; then
echo "[ERROR] Plugin: $p does not exist. Aboring."
return 1
else
file_name=`basename $tmp`
echo "[OK] Plugin: $file_name exists."
fi
done
return 0
}
check_dependent_features()
{
features="org.eclipse.emf_*
org.eclipse.emf.ecore.xcore_*
org.eclipse.xsd_*
org.eclipse.gef_*"
for p in $features ; do
tmp=`ls -d $WORK_DIR/eclipse/features/$p`
if test "x$tmp" = "x" ; then
echo "[ERROR] Feature: $p does not exist. Aboring."
return 1
else
file_name=`basename $tmp`
echo "[OK] Feature: $file_name exists."
fi
done
return 0
}
check_openrtp_plugins()
{
is_ja=`echo $FILE_NAME | grep 'ja'`
for p in $PROJECTS ; do
jar_name="${p}_${PROJECT_VERSION}.jar"
is_nl=`echo $p | grep '.nl'`
if test "x$is_nl" != "x" -a "x$is_ja" = "x" ; then
continue
fi
if test ! -f $WORK_DIR/eclipse/plugins/$jar_name ; then
echo "[ERROR] Plugin file $jar_name does not exist."
return 1
else
echo "[OK] Plugin: $jar_name exists."
fi
done
return 0
}
check_openrtp_features()
{
is_ja=`echo $FILE_NAME | grep 'ja'`
if test "x$is_ja" = "x" ; then
features="jp.go.aist.rtm.rtcbuilder.feature_*
jp.go.aist.rtm.rtsystemeditor.feature_*"
else
features="jp.go.aist.rtm.rtcbuilder.feature_*
jp.go.aist.rtm.rtcbuilder.nl1.feature_*
jp.go.aist.rtm.rtsystemeditor.feature_*
jp.go.aist.rtm.rtsystemeditor.nl1.feature_*"
fi
for p in $features ; do
tmp=`ls -d $WORK_DIR/eclipse/features/$p`
if test "x$tmp" = "x" ; then
echo "[ERROR] Feature: $p does not exist."
return 1
else
file_name=`basename $tmp`
echo "[OK] Feature: $file_name exists."
fi
done
return 0
}
check_langpack()
{
is_ja=`echo $FILE_NAME | grep 'ja'`
if test "x$is_ja" = "x" ; then
# this is not Japanese eclipse package
return 0
fi
# checking pleiades
if test -d $WORK_DIR/eclipse/plugins/jp.sourceforge.mergedoc.pleiades; then
echo "[OK] Pleiades installed."
return 0
fi
# checking langpack
tmp=`ls $WORK_DIR/eclipse/plugins/*nl_ja*`
if test "x$tmp" != "x" ; then
echo "[OK] Lang pack installed."
return 0
fi
echo "[ERROR] No language package installed."
return 1
}
check_package()
{
FILE_NAME=$1
if check_archive && \
check_dependent_plugins && \
check_dependent_features && \
check_openrtp_plugins && \
check_openrtp_features && \
check_langpack ; then
OK_FILES="$OK_FILES $FILE_NAME"
else
BROKEN_FILES="$BROKEN_FILES $FILE_NAME"
fi
}
check_packages()
{
for f in $* ; do
check_package $f
done
echo ""
echo "------------------------------------------------------------"
echo " Correct Package"
echo "------------------------------------------------------------"
for f in $OK_FILES ; do
echo $f
done
echo ""
echo "------------------------------------------------------------"
echo " Broken Packages"
echo "------------------------------------------------------------"
for f in $BROKEN_FILES ; do
echo $f
done
}
#------------------------------
# main
#------------------------------
if test $# -eq 0 ; then
echo "Usage: $0 <OpenRTP eclipse packages>"
echo ""
echo "Example:"
echo " $ $0 packages/eclipse381*"
echo ""
exit 0
fi
get_version
check_packages $*
rm -rf $WORK_DIR
if test "x$BROKEN_FILES" != "x" ; then
exit 1
fi
exit 0