forked from ucla-pls/jbx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjbx
More file actions
executable file
·67 lines (60 loc) · 1.78 KB
/
jbx
File metadata and controls
executable file
·67 lines (60 loc) · 1.78 KB
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
#!/bin/sh
# This is a helper tool for running results, benchmarks and so on using nix.
# All final commands used will be printed for further reference
# Author: Christian Kalhauge (kalhauge@cs.ucla.edu)
# The first argument is the command.
function evaln() {
nix-instantiate --eval --json -E "$1"
}
function attr() {
if [[ -z "$1" ]]; then
echo "(import ./. {})"
else
echo "(import ./. {}).$1"
fi
}
function attrs() {
pointer=`attr $@`
evaln "builtins.attrNames $pointer" | sed -e "s/\[\(.*\)\]/\1/" \
-e 's/,/ /g' \
-e 's/"\([^"]*\)"/\1/g'
}
cmd=$1; shift
case $cmd in
"build" ) python2.7 helpers/jbx-build.py $@ ;;
"run" ) python2.7 helpers/jbx-run.py $@ ;;
"petablox" ) python2.7 helpers/jbx-petablox.py $@ ;;
"get" )
# Gets the results from the results.
if [ "$#" -gt 0 ]; then
analysis=$1; shift
names=""
while [ "$#" -gt 0 ]; do
case $1 in
"--list" ) shift
attrs "results.${analysis}.byName"
exit 0
;;
*)
names="$names $1"; shift
;;
esac
done
echo "building: $names"
if [ -z "$names" ]; then
nix-build -A "results.${analysis}.all"
else
nixcmd="nix-build"
for name in $names; do
nixcmd="$nixcmd -A results.${analysis}.byName.${name}"
done
eval "$nixcmd"
fi
else
# list available analyses
echo "No analysis given, choose from:"
attrs results
exit 0
fi
;;
esac