summaryrefslogtreecommitdiff
path: root/process
blob: 9688cb85e7affe967d10ecb8beff2f41574a0041 (plain)
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
251
252
253
254
255
256
257
258
#!/bin/sh

set -e -x

# TODO.  Several variables are not properly quoted/escaped where they are
# passed to another shell.

project=$1
build_suffix=.build
case $project in
  binutils)
    branch=tschwinge/Paul_Desmond
    linux_host=kepler.SCHWINGE
    hurd_host=coulomb.SCHWINGE
    ;;
  gcc)
    branch=hurd/master
    linux_host=kepler.SCHWINGE
    hurd_host=coulomb.SCHWINGE
    ;;
  gdb)
    branch=tschwinge/Ferry_Tagscherer
    linux_host=kepler.SCHWINGE
    hurd_host=coulomb.SCHWINGE
    ;;
  glibc)
    branch=tschwinge/Roger_Whittaker
    #linux_host=kepler.SCHWINGE
    hurd_host=coulomb.SCHWINGE
    build_suffix=.build-gcc-4.6-486
    ;;
  *)
    echo >&2 "Don't know about project »$project«."
    exit 1
    ;;
esac
shift

step=$1
case $step in
  build | install | test)
    ;;
  '')
    # If there is no step specified, try a default set.
    "$0" "$project" build
    "$0" "$project" install
    "$0" "$project" test
    exit
    ;;
  *)
    echo >&2 "Don't know about step »$step«."
    exit 1
    ;;
esac
shift

action=$1
case $action in
  fetch | diff)
    ;;
  '')
    # If there is no action specified, try a default set.
    "$0" "$project" "$step" fetch
    "$0" "$project" "$step" diff
    exit
    ;;
  *)
    echo >&2 "Don't know about action »$action«."
    exit 1
    ;;
esac
shift

case $project:$action in
  binutils:fetch | gcc:fetch | gdb:fetch | glibc:fetch)
    host=$1
    case $host in
      coulomb.SCHWINGE)
        project_base=tmp/"$project"
        mount=/media/erich
        ;;
      kepler.SCHWINGE)
        project_base=tmp/source/"$project"
        mount=/media/data
        ;;
      '')
        # If there is no host specified, try a default set.
        : "${linux_host:?}"
        : "${hurd_host:?}"
        "$0" "$project" "$step" "$action" "$linux_host"
        "$0" "$project" "$step" "$action" "$hurd_host"
        exit
        ;;
      *)
        echo >&2 "Don't know about host »$host«."
        exit 1
        ;;
    esac
    shift

    [ $# = 0 ]

    : "${branch:?}"
    : "${build_suffix:?}"
    : "${host:?}"
    : "${mount:?}"
    : "${project_base:?}"
    # Log files.
    case $project:$step in
      binutils:build | binutils:install | binutils:test \
      | gcc:build | gcc:install | gcc:test \
      | gdb:build | gdb:install | gdb:test \
      | glibc:build | glibc:install | glibc:test)
        ssh \
          "$host" \
          'cd '"$project_base"'/ && \
          cat '"$branch$build_suffix"'/log_'"$step"'* \
            | sed -e "s%\('"$mount"'\)\?${PWD}%[...]%g"' \
          > toolchain/logs/"$project"/"$host"/log_"$step"
        ;;
      *)
        echo >&2 "Internal error."
        exit 1
        ;;
    esac
    # Detailed log files.
    case $project:$step in
      binutils:build | binutils:install \
      | gcc:build | gcc:install \
      | gdb:build | gdb:install \
      | glibc:build | glibc:install | glibc:test)
        :
        ;;
      binutils:test \
      | gcc:test \
      | gdb:test)
        # First, create a temporary directory, where the *.sum files are copied
        # into, and then individually filtered through sed.
        ssh \
          "$host" \
            'cd '"$project_base"'/ && \
            mkdir -p '"$branch$build_suffix"'.sums && \
            rsync \
              -vr --prune-empty-dirs --delete \
              --include=\*.sum --filter=hide,!\ \*/ \
              '"$branch$build_suffix"'/ \
              '"$branch$build_suffix"'.sums/ && \
            find '"$branch$build_suffix"'.sums/ -type f \
              -exec sed -e "s%\('"$mount"'\)\?${PWD}%[...]%g" -i \{\} \;'
        case $project in
          gcc)
            # Rename host-specific directory to a generic name.
            # This is probably not the most beautiful solution.
            case $host in
              "$linux_host")
                arch=i686-pc-linux-gnu
                ;;
              "$hurd_host")
                arch=i686-unknown-gnu0.3
                ;;
              *)
                echo >&2 "Internal error."
                exit 1
                ;;
            esac
            ssh \
              "$host" \
                'cd '"$project_base"'/'"$branch$build_suffix"'.sums/ && \
                if test -d '"$arch"'; then mv '"$arch"' [ARCH]; fi'
            ;;
          gdb)
            # Remove the summary file; we got the individual ones.
            ssh \
              "$host" \
                'cd '"$project_base"'/'"$branch$build_suffix"'.sums/ && \
                rm -f gdb/testsuite/gdb.sum'
            ;;
        esac
        rsync \
          -vr --delete \
          "$host":"$project_base"/"$branch$build_suffix".sums/ \
          toolchain/logs/"$project"/"$host"/"$step"/
        ;;
      *)
        echo >&2 "Internal error."
        exit 1
        ;;
    esac
    exit
    ;;
  binutils:diff | gcc:diff | gdb:diff)
    [ $# = 0 ]

    : "${linux_host:?}"
    : "${hurd_host:?}"
    case $project:$step in
      binutils:build | binutils:install | binutils:test \
      | gcc:build | gcc:install | gcc:test \
      | gdb:build | gdb:install | gdb:test)
        sed \
          -f toolchain/logs/"$project"/"$linux_host"/log_"$step".sed \
          < toolchain/logs/"$project"/"$linux_host"/log_"$step" \
          > toolchain/logs/"$project"/"$linux_host"/log_"$step"_
        sed \
          -f toolchain/logs/"$project"/"$hurd_host"/log_"$step".sed \
          < toolchain/logs/"$project"/"$hurd_host"/log_"$step" \
          > toolchain/logs/"$project"/"$hurd_host"/log_"$step"_
        r=0
        diff \
          -wu -F ^Running \
          toolchain/logs/"$project"/"$linux_host"/log_"$step"_ \
          toolchain/logs/"$project"/"$hurd_host"/log_"$step"_ \
          > toolchain/logs/"$project"/log_"$step".diff \
        || r=$?
        rm \
          -f \
          toolchain/logs/"$project"/"$linux_host"/log_"$step"_ \
          toolchain/logs/"$project"/"$hurd_host"/log_"$step"_
        [ "$r" = 0 ] || [ "$r" = 1 ]
        ;;
      *)
        echo >&2 "Internal error."
        exit 1
        ;;
    esac
    case $project:$step in
      binutils:build | binutils:install \
      | gcc:build | gcc:install \
      | gdb:build | gdb:install)
        :
        ;;
      binutils:test \
      | gcc:test\
      | gdb:test)
        r=0
        diff \
          -Nrwu -F ^Running \
          toolchain/logs/"$project"/"$linux_host"/"$step"/ \
          toolchain/logs/"$project"/"$hurd_host"/"$step"/ \
          > toolchain/logs/"$project"/"$step".diff \
        || r=$?
        [ "$r" = 0 ] || [ "$r" = 1 ]
        ;;
      *)
        echo >&2 "Internal error."
        exit 1
        ;;
    esac
    exit
    ;;
  *)
    echo >&2 "Internal error."
    exit 1
    ;;
esac

echo >&2 "Internal error."
exit 1