scout-gear 7.1.0 → 7.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.vimproject +29 -0
- data/VERSION +1 -1
- data/bin/scout +5 -1
- data/lib/rbbt-scout.rb +5 -0
- data/lib/scout/concurrent_stream.rb +6 -2
- data/lib/scout/config.rb +168 -0
- data/lib/scout/exceptions.rb +4 -3
- data/lib/scout/indiferent_hash/options.rb +1 -0
- data/lib/scout/indiferent_hash.rb +4 -2
- data/lib/scout/log/color.rb +3 -1
- data/lib/scout/log/progress/report.rb +1 -0
- data/lib/scout/log/progress/util.rb +1 -1
- data/lib/scout/log/progress.rb +5 -3
- data/lib/scout/log.rb +3 -2
- data/lib/scout/misc/monitor.rb +3 -0
- data/lib/scout/misc/system.rb +15 -0
- data/lib/scout/misc.rb +1 -0
- data/lib/scout/named_array.rb +68 -0
- data/lib/scout/open/stream.rb +38 -7
- data/lib/scout/path/find.rb +27 -3
- data/lib/scout/path/util.rb +7 -4
- data/lib/scout/persist/serialize.rb +7 -14
- data/lib/scout/persist.rb +21 -1
- data/lib/scout/resource/produce.rb +7 -94
- data/lib/scout/resource/software.rb +176 -0
- data/lib/scout/tsv/dumper.rb +107 -0
- data/lib/scout/tsv/index.rb +49 -0
- data/lib/scout/tsv/parser.rb +203 -30
- data/lib/scout/tsv/path.rb +13 -0
- data/lib/scout/tsv/persist/adapter.rb +348 -0
- data/lib/scout/tsv/persist/tokyocabinet.rb +113 -0
- data/lib/scout/tsv/persist.rb +15 -0
- data/lib/scout/tsv/traverse.rb +48 -0
- data/lib/scout/tsv/util.rb +24 -0
- data/lib/scout/tsv.rb +16 -3
- data/lib/scout/work_queue/worker.rb +3 -3
- data/lib/scout/work_queue.rb +22 -7
- data/lib/scout/workflow/definition.rb +93 -4
- data/lib/scout/workflow/step/config.rb +18 -0
- data/lib/scout/workflow/step/dependencies.rb +40 -0
- data/lib/scout/workflow/step/file.rb +15 -0
- data/lib/scout/workflow/step/info.rb +31 -4
- data/lib/scout/workflow/step/provenance.rb +148 -0
- data/lib/scout/workflow/step.rb +68 -19
- data/lib/scout/workflow/task.rb +3 -2
- data/lib/scout/workflow/usage.rb +1 -1
- data/lib/scout/workflow.rb +11 -3
- data/lib/scout-gear.rb +1 -0
- data/lib/scout.rb +1 -0
- data/scout-gear.gemspec +34 -3
- data/scout_commands/find +1 -1
- data/scout_commands/workflow/task +16 -10
- data/share/software/install_helpers +523 -0
- data/test/scout/log/test_progress.rb +0 -2
- data/test/scout/misc/test_system.rb +21 -0
- data/test/scout/open/test_stream.rb +159 -0
- data/test/scout/path/test_find.rb +14 -7
- data/test/scout/resource/test_software.rb +24 -0
- data/test/scout/test_config.rb +66 -0
- data/test/scout/test_meta_extension.rb +10 -0
- data/test/scout/test_named_array.rb +19 -0
- data/test/scout/test_persist.rb +35 -0
- data/test/scout/test_tmpfile.rb +2 -2
- data/test/scout/test_tsv.rb +41 -1
- data/test/scout/test_work_queue.rb +40 -13
- data/test/scout/tsv/persist/test_adapter.rb +34 -0
- data/test/scout/tsv/persist/test_tokyocabinet.rb +92 -0
- data/test/scout/tsv/test_dumper.rb +44 -0
- data/test/scout/tsv/test_index.rb +64 -0
- data/test/scout/tsv/test_parser.rb +86 -0
- data/test/scout/tsv/test_persist.rb +36 -0
- data/test/scout/tsv/test_traverse.rb +9 -0
- data/test/scout/tsv/test_util.rb +0 -0
- data/test/scout/work_queue/test_worker.rb +3 -3
- data/test/scout/workflow/step/test_dependencies.rb +25 -0
- data/test/scout/workflow/step/test_info.rb +15 -17
- data/test/scout/workflow/step/test_load.rb +16 -18
- data/test/scout/workflow/step/test_provenance.rb +25 -0
- data/test/scout/workflow/test_step.rb +206 -10
- data/test/scout/workflow/test_task.rb +0 -3
- data/test/test_helper.rb +6 -0
- metadata +33 -2
@@ -0,0 +1,523 @@
|
|
1
|
+
#vim: ft=sh
|
2
|
+
|
3
|
+
[[ -z $SOFTWARE_DIR ]] && SOFTWARE_DIR="$HOME/software"
|
4
|
+
OPT_DIR="$SOFTWARE_DIR/opt"; [ -d $OPT_SRC_DIR ] || mkdir -p $OPT_SRC_DIR
|
5
|
+
OPT_BIN_DIR="$OPT_DIR/bin"; [ -d $OPT_BIN_DIR ] || mkdir -p $OPT_BIN_DIR
|
6
|
+
OPT_SRC_DIR="$SOFTWARE_DIR/src"; [ -d $OPT_SRC_DIR ] || mkdir -p $OPT_SRC_DIR
|
7
|
+
OPT_SCM_DIR="$SOFTWARE_DIR/scm"; [ -d $OPT_SCM_DIR ] || mkdir -p $OPT_SCM_DIR
|
8
|
+
OPT_JAR_DIR="$OPT_DIR/jars"; [ -d $OPT_JAR_DIR ] || mkdir -p $OPT_JAR_DIR
|
9
|
+
OPT_BUILD_DIR="$SOFTWARE_DIR/.build"; [ -d $OPT_BUILD_DIR ] || mkdir -p $OPT_BUILD_DIR
|
10
|
+
|
11
|
+
if (false && command -v realpath && realpath --help | grep relative) > /dev/null; then
|
12
|
+
function relative_path(){
|
13
|
+
local basedir=$1
|
14
|
+
local path=$2
|
15
|
+
echo $(realpath --relative-to="$basedir" "$path")
|
16
|
+
}
|
17
|
+
else
|
18
|
+
realpath(){
|
19
|
+
OURPWD=$PWD
|
20
|
+
cd "$(dirname "$1")"
|
21
|
+
LINK=$(readlink "$(basename "$1")")
|
22
|
+
while [ "$LINK" ]; do
|
23
|
+
cd "$(dirname "$LINK")" 2> /dev/null
|
24
|
+
LINK=$(readlink "$(basename "$1")")
|
25
|
+
done
|
26
|
+
REALPATH="$PWD/$(basename "$1")"
|
27
|
+
cd "$OURPWD"
|
28
|
+
echo "$REALPATH"
|
29
|
+
}
|
30
|
+
|
31
|
+
function relative_path(){
|
32
|
+
local basedir="$(realpath $1)"
|
33
|
+
local path="$(realpath "$2")"
|
34
|
+
local pre=""
|
35
|
+
while [[ ! $path = $basedir* ]]; do
|
36
|
+
pre=${pre}../
|
37
|
+
basedir=$(dirname $basedir)
|
38
|
+
done
|
39
|
+
echo ${pre}${path/$basedir\/} |tr -s '/' '/'
|
40
|
+
}
|
41
|
+
fi
|
42
|
+
|
43
|
+
function link(){
|
44
|
+
local source="$1"
|
45
|
+
local target="$2"
|
46
|
+
local rel_source=$(relative_path "$(dirname $target)" "$source")
|
47
|
+
|
48
|
+
[ -h "$target" ] && rm "$target"
|
49
|
+
echo ln -s "$rel_source" "$target" 1>&2
|
50
|
+
[ -h "$target" ] || ln -s "$rel_source" "$target"
|
51
|
+
}
|
52
|
+
|
53
|
+
function expand_path(){
|
54
|
+
name=$(basename $1)
|
55
|
+
dir=$(dirname $1)
|
56
|
+
|
57
|
+
echo "$(cd $dir && pwd)/$name"
|
58
|
+
}
|
59
|
+
|
60
|
+
function add2file(){
|
61
|
+
file=$1
|
62
|
+
line=$2
|
63
|
+
|
64
|
+
local rel=$(relative_path "$OPT_DIR" "$line")
|
65
|
+
grep "$rel" "$file" || echo "$rel" >> "$file"
|
66
|
+
}
|
67
|
+
|
68
|
+
#{{{ GET PKG OPT_BUILD_DIR
|
69
|
+
|
70
|
+
# From SRC
|
71
|
+
get_pkg(){
|
72
|
+
local name="$1"
|
73
|
+
local url="$2"
|
74
|
+
|
75
|
+
if [ ! -f "$OPT_SRC_DIR/$name.pkg" ]; then
|
76
|
+
wget "$url" -O "$OPT_SRC_DIR/$name.pkg" || wget "$url" -O "$OPT_SRC_DIR/$name.pkg" --no-check-certificate || (rm -f "$OPT_SRC_DIR/$name.pkg"; echo "Error downloading"; exit -1)
|
77
|
+
fi
|
78
|
+
}
|
79
|
+
|
80
|
+
uncompress_pkg(){
|
81
|
+
local name="$1"
|
82
|
+
local pkg="$OPT_SRC_DIR/$name.pkg"
|
83
|
+
|
84
|
+
local old_pwd="`expand_path $(pwd)`"
|
85
|
+
clean_build
|
86
|
+
|
87
|
+
mkdir -p "$OPT_BUILD_DIR"
|
88
|
+
cd "$OPT_BUILD_DIR"
|
89
|
+
|
90
|
+
(tar xvfz $pkg || tar xvfJ $pkg || tar xvfj $pkg || unzip $pkg || (echo "Error decompressing" & cd & exit -1 ) ) 2> /dev/null
|
91
|
+
|
92
|
+
cd "$old_pwd"
|
93
|
+
}
|
94
|
+
|
95
|
+
get_src(){
|
96
|
+
local name="$1"
|
97
|
+
local url="$2"
|
98
|
+
|
99
|
+
get_pkg "$name" "$url"
|
100
|
+
uncompress_pkg "$name"
|
101
|
+
}
|
102
|
+
|
103
|
+
# From SNV
|
104
|
+
get_svn(){
|
105
|
+
local name="$1"
|
106
|
+
local url="$2"
|
107
|
+
|
108
|
+
local old_pwd="`expand_path $(pwd)`"
|
109
|
+
|
110
|
+
cd $OPT_SCM_DIR
|
111
|
+
if [ -d "$name" ]; then
|
112
|
+
cd "$name"
|
113
|
+
svn update
|
114
|
+
else
|
115
|
+
echo svn checkout "$url" "$name"
|
116
|
+
svn checkout "$url" "$name"
|
117
|
+
fi
|
118
|
+
|
119
|
+
clean_build
|
120
|
+
|
121
|
+
cd $OPT_BUILD_DIR
|
122
|
+
link "$OPT_SCM_DIR/$name" "$name"
|
123
|
+
|
124
|
+
cd "$old_pwd"
|
125
|
+
|
126
|
+
}
|
127
|
+
|
128
|
+
# From GIT
|
129
|
+
get_git(){
|
130
|
+
local name="$1"
|
131
|
+
local url="$2"
|
132
|
+
|
133
|
+
if [[ "$url" == *" "* ]]; then
|
134
|
+
version="${url/* /}"
|
135
|
+
url="${url/ */}"
|
136
|
+
echo "Using version $version of repo $url"
|
137
|
+
else
|
138
|
+
version='none'
|
139
|
+
fi
|
140
|
+
|
141
|
+
local old_pwd="`expand_path $(pwd)`"
|
142
|
+
|
143
|
+
cd $OPT_SCM_DIR
|
144
|
+
if [ -d "$name" ]; then
|
145
|
+
cd "$name"
|
146
|
+
|
147
|
+
if [ ! "$NOWEB" == "true" -a $version == 'none' ]; then
|
148
|
+
git stash
|
149
|
+
git pull origin master
|
150
|
+
git rebase master
|
151
|
+
git stash apply
|
152
|
+
git submodule init
|
153
|
+
git submodule update
|
154
|
+
fi
|
155
|
+
else
|
156
|
+
if [ $version == 'none' ];then
|
157
|
+
git clone --recursive "$url" "$name"
|
158
|
+
else
|
159
|
+
git clone --recursive "$url" "$name" -b $version
|
160
|
+
fi
|
161
|
+
|
162
|
+
cd "$name"
|
163
|
+
git submodule init
|
164
|
+
git submodule update
|
165
|
+
fi
|
166
|
+
|
167
|
+
clean_build
|
168
|
+
|
169
|
+
cd $OPT_BUILD_DIR
|
170
|
+
link "$OPT_SCM_DIR/$name" "$name"
|
171
|
+
|
172
|
+
cd "$old_pwd"
|
173
|
+
}
|
174
|
+
|
175
|
+
|
176
|
+
#{{{ BUILD PKG in OPT_BUILD_DIR
|
177
|
+
|
178
|
+
clean_build(){
|
179
|
+
rm -Rf $OPT_BUILD_DIR/*
|
180
|
+
}
|
181
|
+
|
182
|
+
build_dir(){
|
183
|
+
echo $OPT_BUILD_DIR/$(ls $OPT_BUILD_DIR |head -n 1)
|
184
|
+
}
|
185
|
+
|
186
|
+
compile(){
|
187
|
+
local name=$1; shift
|
188
|
+
local extra="$@"
|
189
|
+
|
190
|
+
if [ -f bootstrap ]; then
|
191
|
+
./bootstrap
|
192
|
+
fi
|
193
|
+
|
194
|
+
if [ -f Makefile -o -f makefile ]; then
|
195
|
+
make -j 4 || exit -1
|
196
|
+
make install || echo "No install"
|
197
|
+
fi
|
198
|
+
|
199
|
+
[ -f build.xml ] && (ant || exit -1)
|
200
|
+
|
201
|
+
[ -f setup.rb ] && (ruby -Ilib/ setup.rb --prefix="$(opt_dir "$name")" $extra || exit -1)
|
202
|
+
|
203
|
+
[ -f install.rb ] && ruby -Ilib/ install.rb config --prefix="$(opt_dir "$name")" $extra && ruby -Ilib/ install.rb install
|
204
|
+
|
205
|
+
if [ -f setup.py ]; then
|
206
|
+
python setup.py build && python setup.py install --user || exit -1
|
207
|
+
clean_build
|
208
|
+
fi
|
209
|
+
}
|
210
|
+
|
211
|
+
prepare_make(){
|
212
|
+
local name=$1; shift
|
213
|
+
local extra="$@"
|
214
|
+
|
215
|
+
local old_pwd="`expand_path $(pwd)`"
|
216
|
+
|
217
|
+
cd "`build_dir`"
|
218
|
+
|
219
|
+
[ -f bootstrap ] && (./bootstrap || exit -1)
|
220
|
+
|
221
|
+
[ -d src -a ! -e CMakeLists.txt -a ! -e Makefile -a ! -e configure ] && cd src
|
222
|
+
|
223
|
+
[ -f bootstrap ] && (./bootstrap || exit -1)
|
224
|
+
|
225
|
+
if [ -f config/m4 ]; then
|
226
|
+
libtoolize --force
|
227
|
+
aclocal
|
228
|
+
autoheader
|
229
|
+
fi
|
230
|
+
|
231
|
+
if [ -f Makefile.am -a ! -f configure ]; then
|
232
|
+
autoreconf
|
233
|
+
fi
|
234
|
+
|
235
|
+
if [ -f aclocal.m4 ]; then
|
236
|
+
autoconf
|
237
|
+
fi
|
238
|
+
|
239
|
+
if [ -f autogen.sh ]; then
|
240
|
+
./autogen.sh
|
241
|
+
fi
|
242
|
+
|
243
|
+
if [ -f aclocal.m4 ]; then
|
244
|
+
autoreconf -i
|
245
|
+
autoconf
|
246
|
+
automake --add-missing
|
247
|
+
else
|
248
|
+
autoconf
|
249
|
+
automake --add-missing
|
250
|
+
fi
|
251
|
+
|
252
|
+
if [ -f config ]; then
|
253
|
+
ln -s config configure
|
254
|
+
fi
|
255
|
+
|
256
|
+
cd "$old_pwd"
|
257
|
+
}
|
258
|
+
|
259
|
+
build_make(){
|
260
|
+
local name=$1; shift
|
261
|
+
local extra="$@"
|
262
|
+
|
263
|
+
local old_pwd="`expand_path $(pwd)`"
|
264
|
+
cd "`build_dir`"
|
265
|
+
echo PWD: `pwd`
|
266
|
+
ls
|
267
|
+
|
268
|
+
|
269
|
+
[ -d src -a ! -e CMakeLists.txt -a ! -e Makefile -a ! -e configure ] && cd src
|
270
|
+
[ -d source -a ! -e CMakeLists.txt -a ! -e Makefile -a ! -e configure ] && cd source
|
271
|
+
|
272
|
+
echo "Building with configure $name"
|
273
|
+
if [ "x$extra" != "x" ]; then
|
274
|
+
echo "Extra params: $extra"
|
275
|
+
fi
|
276
|
+
|
277
|
+
if [ ! -f configure ]; then
|
278
|
+
prepare_make $name
|
279
|
+
fi
|
280
|
+
|
281
|
+
if [ -f configure ]; then
|
282
|
+
./configure --prefix="$(opt_dir "$name")" $extra
|
283
|
+
compile "$name" $extra
|
284
|
+
[ -d "$(opt_dir "$name")" ] || move_opt "$name"
|
285
|
+
setup "$name"
|
286
|
+
clean_build
|
287
|
+
else
|
288
|
+
compile "$name" $extra
|
289
|
+
move_opt "$name"
|
290
|
+
setup "$name"
|
291
|
+
clean_build
|
292
|
+
fi
|
293
|
+
|
294
|
+
cd "$old_pwd"
|
295
|
+
}
|
296
|
+
|
297
|
+
buid_cmake(){
|
298
|
+
local name=$1; shift
|
299
|
+
local extra="$@"
|
300
|
+
|
301
|
+
local old_pwd="`expand_path $(pwd)`"
|
302
|
+
cd "`build_dir`"
|
303
|
+
echo PWD: `pwd`
|
304
|
+
ls
|
305
|
+
|
306
|
+
|
307
|
+
[ -d src -a ! -e CMakeLists.txt -a ! -e Makefile -a ! -e configure ] && cd src
|
308
|
+
[ -d source -a ! -e CMakeLists.txt -a ! -e Makefile -a ! -e configure ] && cd source
|
309
|
+
|
310
|
+
echo "Building with cmake $name"
|
311
|
+
if [ "x$extra" != "x" ]; then
|
312
|
+
echo "Extra params: $extra"
|
313
|
+
fi
|
314
|
+
|
315
|
+
echo "Using cmake"
|
316
|
+
[ -d build ] || mkdir build
|
317
|
+
|
318
|
+
cd build
|
319
|
+
cmake -DMAKE_INSTALL_PREFIX=/ $extra ..
|
320
|
+
if [ ! -f Makefile -a -f ../configure ]; then
|
321
|
+
../configure --prefix="$(opt_dir "$name")" $extra
|
322
|
+
make -j 4
|
323
|
+
make install || (cd .. ; mv build "$(opt_dir "$name")")
|
324
|
+
else
|
325
|
+
make DESTDIR="$(opt_dir "$name")" -j 4 && make DESTDIR="$(opt_dir "$name")" install
|
326
|
+
fi
|
327
|
+
cd ..
|
328
|
+
|
329
|
+
if [ ! -d "$(opt_dir "$name")" ]; then
|
330
|
+
mkdir -p "$(opt_dir "$name")"
|
331
|
+
for subd in bin lib lib64 include pkgdir; do
|
332
|
+
[ -d $subd ] && mv $subd "$(opt_dir "$name")"/$subd
|
333
|
+
done
|
334
|
+
fi
|
335
|
+
|
336
|
+
setup "$name"
|
337
|
+
clean_build
|
338
|
+
|
339
|
+
cd "$old_pwd"
|
340
|
+
}
|
341
|
+
|
342
|
+
build(){
|
343
|
+
local name=$1; shift
|
344
|
+
local extra="$@"
|
345
|
+
|
346
|
+
echo "Building $name"
|
347
|
+
if [ "x$extra" != "x" ]; then
|
348
|
+
echo "Extra params: $extra"
|
349
|
+
fi
|
350
|
+
|
351
|
+
local old_pwd="`expand_path $(pwd)`"
|
352
|
+
cd "`build_dir`"
|
353
|
+
|
354
|
+
[ -d src -a ! -e CMakeLists.txt -a ! -e Makefile -a ! -e configure ] && cd src
|
355
|
+
|
356
|
+
if [ -f CMakeLists.txt ]; then
|
357
|
+
buid_cmake "$name" $extra
|
358
|
+
else
|
359
|
+
build_make "$name" $extra
|
360
|
+
fi
|
361
|
+
|
362
|
+
cd "$old_pwd"
|
363
|
+
}
|
364
|
+
|
365
|
+
#{{{ SETUP
|
366
|
+
|
367
|
+
is_versioned(){
|
368
|
+
local name="$1"
|
369
|
+
[[ $name =~ : ]]
|
370
|
+
}
|
371
|
+
|
372
|
+
opt_dir(){
|
373
|
+
local name="$1"
|
374
|
+
if is_versioned "$name"; then
|
375
|
+
local real_name=`echo $1 | sed 's/:.*//'`
|
376
|
+
local version=`echo $1 | sed 's/.*://'`
|
377
|
+
echo "$OPT_DIR/$real_name/$version"
|
378
|
+
else
|
379
|
+
echo "$OPT_DIR/$name"
|
380
|
+
fi
|
381
|
+
}
|
382
|
+
|
383
|
+
move_opt(){
|
384
|
+
local name="$1"
|
385
|
+
local pkg_dir=$(opt_dir "$name")
|
386
|
+
local source=$(build_dir)
|
387
|
+
|
388
|
+
mkdir -p $(dirname "$pkg_dir")
|
389
|
+
if [ -h "$source" ]; then
|
390
|
+
local real_source=$(realpath "$source")
|
391
|
+
echo link "$real_source" "$pkg_dir"
|
392
|
+
link "$real_source" "$pkg_dir"
|
393
|
+
else
|
394
|
+
mv "$source" "$pkg_dir"
|
395
|
+
fi
|
396
|
+
}
|
397
|
+
|
398
|
+
setup(){
|
399
|
+
local name="$1"
|
400
|
+
local pkg_dir="`opt_dir \"$name\"`"
|
401
|
+
|
402
|
+
if is_versioned "$name"; then
|
403
|
+
rm -f "$(dirname $pkg_dir)/current"
|
404
|
+
link "$pkg_dir" "$(dirname $pkg_dir)/current"
|
405
|
+
pkg_dir="$(dirname $pkg_dir)/current"
|
406
|
+
fi
|
407
|
+
|
408
|
+
if [ -d "$pkg_dir/bin/" -o -d "$pkg_dir/usr/local/bin/" ]; then
|
409
|
+
|
410
|
+
for exe in ` find "$pkg_dir/bin/" -maxdepth 1 -type f -executable`; do
|
411
|
+
exe=$(basename $exe)
|
412
|
+
rm -f "$OPT_DIR/bin/$exe"
|
413
|
+
link "$pkg_dir/bin/$exe" "$OPT_DIR/bin/$exe" 2>/dev/null
|
414
|
+
done
|
415
|
+
|
416
|
+
for exe in ` find "$pkg_dir/usr/local/bin/" -maxdepth 1 -type f -executable`; do
|
417
|
+
exe=$(basename $exe)
|
418
|
+
rm -f "$OPT_DIR/usr/local/bin/$exe"
|
419
|
+
link "$pkg_dir/usr/local/bin/$exe" "$OPT_DIR/bin/$exe" 2>/dev/null
|
420
|
+
done
|
421
|
+
|
422
|
+
|
423
|
+
else
|
424
|
+
local old_pwd="`expand_path $(pwd)`"
|
425
|
+
|
426
|
+
for exe in ` find "$pkg_dir/" "$pkg_dir/build" "$pkg_dir/source/" "$pkg_dir/src/" -maxdepth 1 -type f -executable`; do
|
427
|
+
orig=$exe
|
428
|
+
exe=$(basename $exe)
|
429
|
+
echo "EXE $exe"
|
430
|
+
rm -f "$OPT_DIR/bin/$exe"
|
431
|
+
link "$orig" "$OPT_DIR/bin/$exe" 2>/dev/null
|
432
|
+
done
|
433
|
+
fi
|
434
|
+
|
435
|
+
([ -d "$pkg_dir/include" ] && add2file "$OPT_DIR/.c-paths" "$pkg_dir/include")
|
436
|
+
([ -d "$pkg_dir/lib" ] && add2file "$OPT_DIR/.ld-paths" "$pkg_dir/lib")
|
437
|
+
([ -d "$pkg_dir/lib64" ] && add2file "$OPT_DIR/.ld-paths" "$pkg_dir/lib64")
|
438
|
+
([ -d "$pkg_dir/lib/pkgconfig" ] && add2file "$OPT_DIR/.pkgconfig-paths" "$pkg_dir/lib/pkgconfig")
|
439
|
+
echo $name setup
|
440
|
+
}
|
441
|
+
|
442
|
+
#{{{ HELPERS
|
443
|
+
|
444
|
+
prepare_pkg(){
|
445
|
+
local name="$1"
|
446
|
+
local url="$2"
|
447
|
+
shift;shift;
|
448
|
+
|
449
|
+
get_pkg "$name" "$url"
|
450
|
+
uncompress_pkg "$name"
|
451
|
+
}
|
452
|
+
|
453
|
+
install_src(){
|
454
|
+
local name="$1"
|
455
|
+
local url="$2"
|
456
|
+
shift;shift;
|
457
|
+
local extra="$@"
|
458
|
+
|
459
|
+
prepare_pkg "$name" "$url"
|
460
|
+
build "$name" "$extra"
|
461
|
+
}
|
462
|
+
|
463
|
+
install_svn(){
|
464
|
+
local name="$1"
|
465
|
+
local url="$2"
|
466
|
+
shift;shift;
|
467
|
+
local extra="$@"
|
468
|
+
|
469
|
+
get_svn "$name" "$url"
|
470
|
+
build "$name" $extra
|
471
|
+
}
|
472
|
+
|
473
|
+
custom_build(){
|
474
|
+
local name="$1"
|
475
|
+
shift;
|
476
|
+
local cmd="$@"
|
477
|
+
|
478
|
+
echo "Building $name"
|
479
|
+
|
480
|
+
local old_pwd="`expand_path $(pwd)`"
|
481
|
+
cd "`build_dir`"
|
482
|
+
echo `pwd`
|
483
|
+
ls
|
484
|
+
|
485
|
+
eval $cmd
|
486
|
+
|
487
|
+
move_opt "$name"
|
488
|
+
setup "$name"
|
489
|
+
clean_build
|
490
|
+
|
491
|
+
cd "$old_pwd"
|
492
|
+
}
|
493
|
+
|
494
|
+
install_git(){
|
495
|
+
local name="$1"
|
496
|
+
local url="$2"
|
497
|
+
shift;shift;
|
498
|
+
local extra="$@"
|
499
|
+
|
500
|
+
get_git "$name" "$url"
|
501
|
+
build "$name" $extra
|
502
|
+
}
|
503
|
+
|
504
|
+
install_jar(){
|
505
|
+
local name="$1"
|
506
|
+
local url="$2"
|
507
|
+
|
508
|
+
[ -d "$OPT_DIR/$name/" ] || mkdir -p "$OPT_DIR/$name/"
|
509
|
+
wget "$url" -O "$OPT_DIR/$name/$name.jar" || wget "$url" -O "$OPT_DIR/$name/$name.jar" --no-check-certificate || (rm "$OPT_DIR/$name/$name.jar"; exit -1)
|
510
|
+
link "$OPT_DIR/$name/$name.jar" "$OPT_JAR_DIR/$name.jar"
|
511
|
+
}
|
512
|
+
|
513
|
+
jar2bin(){
|
514
|
+
local name="$1";shift
|
515
|
+
local extra="$@"
|
516
|
+
|
517
|
+
echo "#!/bin/bash" > $OPT_DIR/bin/$name
|
518
|
+
echo "java $extra -jar '$OPT_JAR_DIR/$name.jar'" >> $OPT_DIR/bin/$name
|
519
|
+
|
520
|
+
chmod +x $OPT_DIR/bin/$name
|
521
|
+
}
|
522
|
+
|
523
|
+
# vim: ft=sh
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb')
|
2
|
+
require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1')
|
3
|
+
|
4
|
+
class TestMiscSystem < Test::Unit::TestCase
|
5
|
+
setup do
|
6
|
+
ENV.delete "TEST_VAR"
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_env_add
|
10
|
+
Misc.env_add "TEST_VAR", "test_value1"
|
11
|
+
Misc.env_add "TEST_VAR", "test_value2"
|
12
|
+
assert_equal "test_value2:test_value1", ENV["TEST_VAR"]
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_env_add_prepend
|
16
|
+
Misc.env_add "TEST_VAR", "test_value1", ":", false
|
17
|
+
Misc.env_add "TEST_VAR", "test_value2", ":", false
|
18
|
+
assert_equal "test_value1:test_value2", ENV["TEST_VAR"]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|