config / .fgfs / fgaddon /
Newer Older
435 lines | 16.337kb
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
1
#!/bin/bash
2

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
3
set -e
4

            
5
declare -A data=(
6
        [/sim/description]=text
7
        [/sim/long-description]=text
8
        [/sim/author]=text
9
        [/sim/flight-model]=text
10
        [/sim/type]=text
11
        [/sim/model/path]=text
12
)
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
13
fgaddon_svn=https://svn.code.sf.net/p/flightgear/fgaddon/trunk/Aircraft
many improvement
Sébastien MARQUE authored on 2020-09-08
14
fgaddon_path=$HOME/.fgfs/flightgear-fgaddon/Aircraft
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
15
database=${DB:-$0.db}
16
#locale=fr
17

            
18
test -r "$0.conf" && source $0.conf && echo config red
19

            
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
20
aircrafts=$(mktemp --dry-run /dev/shm/Aircraft-XXXXXXXXX)
21
aircraft=$(mktemp --dry-run /dev/shm/aircraft-XXXXXXX)
22
setxml=$(mktemp --dry-run /dev/shm/setxml-XXXXXXXX)
23
in_ram_database=$(mktemp --dry-run /dev/shm/XXXXXXX)
24

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
25
function xmlgetnext () {
26
    local IFS='>'
27
    read -d '<' TAG VALUE
28
    # by design, the first TAG/VALUE pair is empty
29
    # to avoid infinite loops at end of file parsing we return an error
30
    # the next time we find an empty TAG
31
    if test -z "$TAG"; then
32
        test ${xmlgetnext_firstentry:-1} -eq 1 && xmlgetnext_firstentry=0 || return 1;
33
    fi
34
    # process $TAG only if necessary
35
    local _TAG=$(printf '%q' $TAG)
36
    if test ${_TAG:0:1} = '$'; then
37
        TAG=$(tr '\n' ' ' <<< $TAG | sed 's/  */ /g; s/ *$//')
38
    fi
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
39
}
40

            
keep journal of sqlite reque...
Sébastien MARQUE authored on 2020-10-19
41
rm -f /dev/shm/sqlite_request
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
42
function sqlite_request () {
keep journal of sqlite reque...
Sébastien MARQUE authored on 2020-10-19
43
    local delimiter=';'
44
    test ${1:0:1} == '.' && delimiter=''
45
    echo "${1}${delimiter}" >> /dev/shm/sqlite_request
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
46
    if ! sqlite3 "$in_ram_database" <<< "$1"; then
47
        register_state
48
    fi
49
}
50

            
51
function xmlremovecomments () {
52
    sed -ri 's/<(!--|script>)/\n&/;s/(<\/script|--)>/&\n/' $setxml
53
    sed -ri '/<(script>|!--).*(<\/script|--)>/d;/<(script>|!--)/,/(<\/script|--)>/d' $setxml
small stuff
Sébastien MARQUE authored on 2020-09-27
54
    sed -i 's/\xef\xbb\xbf//' $setxml # removes BOM
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
55
}
56

            
57
function trap_break () {
58
    trap '' INT
59
    echo "stop requested"
60
    register_state
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
61
}
62

            
63
function trap_exit () {
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
64
    trapped_rc=$?
65
    trap '' INT
66
    rm -f $aircrafts $aircraft $setxml
67
    if test ! -e $in_ram_database; then
68
        exit
69
    fi
70
    test $trapped_rc -ne 0 && register_state
many improvements
Sébastien MARQUE authored on 2020-09-02
71
    echo "updating installation status"
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
72
    for ac in $(sqlite_request 'select printf("%i:%s/%s", aircrafts.id, aircrafts.name, setxml.file)
73
                                from aircrafts inner join setxml
74
                                where aircrafts.id = setxml.variantof and setxml.installed != 0;'); do
many improvements
Sébastien MARQUE authored on 2020-09-02
75
        ac_path=${ac#*:}
many improvement
Sébastien MARQUE authored on 2020-09-08
76
        if test ! -e $fgaddon_path/$ac_path-set.xml; then
77
            sqlite_request "update setxml set installed = 0 where file = '${ac_path#*/}' and variantof = ${ac%:*}"
78
        fi
79
    done
80
    for ac in $fgaddon_path/*/*-set.xml; do
81
        ac=${ac/$fgaddon_path}
82
        sx=${ac##*/}
83
        ac=${ac%/*}
84
        if test -d $fgaddon_path/$ac/.svn; then
85
            install_type=1
86
        elif test -d $fgaddon_path/$ac/.git; then
87
            install_type=2
88
        else
89
            install_type=3
90
        fi
91
        sqlite_request "update setxml set installed = $install_type
92
                        where exists (
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
93
                            select 1
94
                            from aircrafts
95
                            where name = '${ac/\/}' and setxml.variantof = id
many improvement
Sébastien MARQUE authored on 2020-09-08
96
                        )"
many improvements
Sébastien MARQUE authored on 2020-09-02
97
    done
cosmetics
Sébastien MARQUE authored on 2020-10-19
98
    local missing_setxml=$(sqlite_request "select printf(' - %s', name)
99
                                     from aircrafts
100
                                     where id not in (select variantof from setxml)")
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
101
    if test -n "$missing_setxml"; then
improve output for missing a...
Sébastien MARQUE authored on 2020-09-23
102
        echo -e "missing setxml config for :\n$missing_setxml"
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
103
    fi
list missing models
Sébastien MARQUE authored on 2020-10-19
104
    local missing_model=$(sqlite_request 'select count(setxml.file)
105
                                          from aircrafts inner join setxml
106
                                          where aircrafts.id = setxml.variantof and setxml.`/sim/model/path` = ""')
107
    if test $missing_model -gt 0; then
108
        echo "$missing_model aircrafts without /sim/model/path information"
109
        if test $missing_model -le 10; then
110
            echo "aircrafts without /sim/model/path information:"
111
            sqlite_request 'select printf(" - %s/%s", aircrafts.name, setxml.file)
112
                            from aircrafts inner join setxml
113
                            where aircrafts.id = setxml.variantof and setxml.`/sim/model/path` = ""'
114
        fi
115
    fi
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
116
    if test -r "$database" && md5sum $in_ram_database | sed "s,$in_ram_database,$database," | md5sum --status -c -; then
117
        rm -f $in_ram_database
many improvements
Sébastien MARQUE authored on 2020-09-02
118
        echo "no changes in $database"
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
119
    elif test -w "$database"; then
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
120
        sqlite_request "vacuum"
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
121
        mv -f $in_ram_database "$database"
many improvements
Sébastien MARQUE authored on 2020-09-02
122
        echo "database $database updated"
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
123
    elif ! test -e "$database"; then
124
        mv $in_ram_database "$database"
many improvements
Sébastien MARQUE authored on 2020-09-02
125
        echo "database $database created"
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
126
    else
127
        rm -f $in_ram_database
many improvements
Sébastien MARQUE authored on 2020-09-02
128
        echo "nothing can be done with $database !"
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
129
    fi
130
}
131

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
132
function register_state () {
133
    sqlite_request "drop table if exists recover_rev"
134
    sqlite_request "create table recover_rev (
135
                        revkey text,
136
                        revision integer,
137
                        revauthor text,
138
                        revdate integer
139
                    )"
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
140
    for revkey in ${!revindex[@]}; do
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
141
        sqlite_request "insert into recover_rev values (
142
                            '$revkey',
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
143
                            ${revindex[$revkey]:-0},
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
144
                            '${revauthor[$revkey]}',
145
                            ${revdate[$revkey]:-0}
146
                        )"
147
    done
148
    sqlite_request "drop table if exists recover_setxmlmodified"
149
    sqlite_request "create table if not exists recover_setxmlmodified (
150
                        sx text
151
                    )"
152
    for sx in ${!setxmlmodified[@]}; do
153
        sqlite_request "insert into recover_setxmlmodified values (
154
                            '$sx'
155
                        )"
156
    done
157
    exit
158
}
159

            
160
function update_database () {
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
161
    echo "[ ${#revindex[@]} ] ${ac:1}"
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
162

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
163
    dbupdate=$(sqlite_request "select revision from aircrafts where name is '${ac:1}'")
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
164
    if test -z "$dbupdate"; then
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
165
        sqlite_request "insert into aircrafts (name, revision, date, author)
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
166
                        values ('${ac:1}', ${revindex[$ac]}, ${revdate[$ac]}, '${revauthor[$ac]}')"
167
    elif test $dbupdate -lt ${revindex[$ac]}; then
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
168
        sqlite_request "update aircrafts set
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
169
                            revision = ${revindex[$ac]},
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
170
                            author   = '${revauthor[$ac]}',
171
                            date = ${revdate[$ac]}
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
172
                        where name is '${ac:1}'"
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
173
    fi
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
174
    id=$(sqlite_request "select id from aircrafts where name is '${ac:1}'")
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
175

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
176
    for sx in ${!setxmlmodified[@]}; do
177
        unset include include_rootpath
178
        [[ "$sx" =~ ^"${ac:1}/" ]] || continue
179
        for col in ${!data[@]}; do
180
            data[$col]=
181
        done
182
        sx=${sx#*/}
remove -set.xml from filenam...
Sébastien MARQUE authored on 2020-09-02
183
        echo " -> $sx"
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
184
        if ! svn export --quiet --force $fgaddon_svn/${ac:1}/$sx-set.xml $setxml; then
185
            register_state
186
        fi
187
        xmlremovecomments
188
        unset xmlgetnext_firstentry property
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
189
        while xmlgetnext; do
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
190
            case "${TAG:0:1}" in
191
                ''|'?'|'!')
192
                    continue;;
193
                /)
194
                    property=${property%/*};;
195
                *)
196
                    if test "${TAG: -1}" != '/'; then
197
                        property+=/${TAG%% *}
fix syntax mistake
Sébastien MARQUE authored on 2020-09-21
198
                    fi;;
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
199
            esac
200

            
201
            if [[ "$TAG" =~ ^"PropertyList include=" ]]; then
202
                include_rootpath=${include%/*}
203
                test $include = $include_rootpath && unset include_rootpath
204
                eval $(echo ${TAG#* })
205
                [[ "$include" =~ ^Aircraft/Generic/ ]] && unset include include_rootpath && continue
206
                if [[ "$include" =~ ^'../' ]]; then
207
                    if test -n "$include_rootpath"; then
208
                        if [[ "$include_rootpath" =~ '/' ]]; then
209
                            include_rootpath=${include_rootpath%/*}
210
                        else
211
                            unset include_rootpath
212
                        fi
213
                    else
214
                        ac_save=$ac
215
                        unset ac
216
                    fi
217
                    include=${include/\.\.\/}
218
                fi
219
                if ! svn cat $fgaddon_svn/${ac:1}/${include_rootpath:+$include_rootpath/}$include >> $setxml; then
220
                    register_state
221
                fi
222
                xmlremovecomments
223
            fi
224

            
225
            if [[ "$property" = /PropertyList@($data_pattern) ]]; then
fix overriding descs with in...
Sébastien MARQUE authored on 2020-09-27
226
                if test -z "${data[${property/\/PropertyList}]}"; then
227
                    eval "data[${property/\/PropertyList}]=\"${VALUE//\"/\\\"}\""
228
                    data[${property/\/PropertyList}]=$(tr '\n' ' ' <<< ${data[${property/\/PropertyList}]} | sed -r 's/^\s*//;s/\s+/ /g;s/\s*$//')
229
                fi
many improvement
Sébastien MARQUE authored on 2020-09-08
230
            fi
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
231

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
232
            # continue parsing (while loop) until everything's found
233
            for col in ${!data[@]}; do
234
                test -z "${data[$col]}" && continue 2
235
            done
236
            break # everything's found
237
        done < $setxml
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
238

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
239
        if eval "test -z \"$data_test_null\""; then
240
            echo "WARNING: no info found, skipping"
241
            continue
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
242
        fi
243

            
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
244
        known=$(sqlite_request "select variantof from setxml where file is '$sx'")
245
        if test -n "$known"; then
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
246
            for col in ${!data[@]}; do
247
                dbvalue=$(sqlite_request "select '$col'
248
                                          from setxml
249
                                          where file is '$sx' and variantof = $known")
250
                if test "$dbvalue" != "${data[$col]}" -a -n "${data[$col]}"; then
251
                    sqlite_request "update setxml
252
                                    set '$col' = '${data[$col]//\'/\'\'}'
253
                                    where file is '$sx' and variantof = $known"
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
254
                fi
255
            done
256
        else
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
257
            values="'$sx', $id, "
258
            for col in ${!data[@]}; do
259
                values+="'${data[$col]//\'/\'\'}', "
260
            done
261
            values+=0
262
            sqlite_request "insert into setxml values ($values)"
263
        fi
264
        test -n "$ac_save" && ac=$ac_save
265
        unset setxmlmodified[${ac:1}/$sx]
266
    done
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
267
    unset revindex[$ac]
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
268
}
269

            
270
function apply_revision () {
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
271
    for ac in "${!revindex[@]}"; do
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
272
        update_database
273
        if test -d $fgaddon_path/${ac:1}/.svn \
274
        && test "$(svn info --show-item=url $fgaddon_path/${ac:1})" != "$fgaddon_svn/${ac:1}" \
275
        || test -d $fgaddon_path/${ac:1} -a ! -d $fgaddon_path/${ac:1}/.svn; then
276
            echo "INFO: local ${ac:1} installed out from repo" >&2
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
277
        fi
278
    done
279
}
280

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
281
trap trap_break INT
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
282
trap trap_exit EXIT
283

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
284
stty -echoctl
285

            
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
286
declare -A revindex revauthor revdate setxmlmodified files revpath
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
287
data_pattern=$(printf "%s|" ${!data[@]})
288
data_pattern=${data_pattern:0:-1}
289
data_test_null=$(printf '${data[%s]}' ${!data[@]})
290

            
291
if test -e $database; then
292
    cp $database $in_ram_database
293
    sql_cols=$(sqlite_request "pragma table_info(setxml)" | awk -F'|' '{printf("%s %s ", $2, $3)}')
294
    script_cols="file text variantof integer "
295
    for col in ${!data[@]}; do
296
        script_cols+="$col ${data["$col"]} "
297
    done
298
    script_cols+="installed integer " # last space is important
299
    if test "$sql_cols" != "$script_cols"; then
300
        echo "ALERT: datbase version mismatch !"
301
        exit 1
302
    fi
303
    if sqlite_request '.tables' | grep -q 'recover_' && test -z "$1"; then
304
        echo "recovering from previous saved state"
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
305
        eval $(sqlite_request "select printf('revindex[%s]=%u;revauthor[%s]=%s;revdate[%s]=%u;',
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
306
                                       revkey, revision,
307
                                       revkey, revauthor,
308
                                       revkey, revdate)
309
                               from recover_rev")
310
        eval $(sqlite_request "select printf('setxmlmodified[%s]=1;', sx)
311
                               from recover_setxmlmodified")
312
        sqlite_request "drop table recover_rev"
313
        sqlite_request "drop table recover_setxmlmodified"
314
        apply_revision
315
        exit
316
    fi
317
fi
318

            
319
sqlite_request "create table if not exists aircrafts (
cosmetics
Sébastien MARQUE authored on 2020-10-19
320
                    id       integer primary key,
321
                    name     text,
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
322
                    revision integer,
cosmetics
Sébastien MARQUE authored on 2020-10-19
323
                    date     integer,
324
                    author   text)"
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
325

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
326
sqlite_request "create table if not exists setxml (
327
                    file text,
328
                    variantof integer,
329
                    $(for col in ${!data[@]}; do printf "'%s' %s, " $col ${data[$col]}; done)
330
                    installed integer)"
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
331

            
search for next revision
Sébastien MARQUE authored on 2020-10-19
332
latest_revision=$(( $(sqlite_request "select max(revision) from aircrafts") + 1 ))
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
333

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
334
# for debugging purpose
335
if test -n "$2"; then
336
    ac=_${1%/*}
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
337
    revindex[$ac]=1
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
338
    revdate[$ac]=0
339
    revauthor[$ac]=foobar
340
    setxmlmodified[${ac:1}/${1#*/}]=1
341
    set -x
342
    update_database
343
    set +x
344
    exit
345
elif test -n "$1"; then
346
    ac=_${1%/*}
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
347
    eval $(sqlite_request "select printf('revindex[_%s]=%s;revdate[_%s]=%i;revauthor[_%s]=%s;',
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
348
                                            name, revision,
349
                                            name, date,
350
                                            name, author)
351
                           from aircrafts
352
                           where name = '${ac:1}'")
353
    setxmlmodified[${ac:1}/${1#*/}]=1
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
354
    if test -z "${revindex[$ac]}"; then
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
355
        echo "aircraft ${ac:1} not found"
356
        rm $in_ram_database
357
        exit
358
    fi
359
    update_database
360
    exit
361
fi
362

            
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
363
echo "downloading FGADDON history from revision ${latest_revision:-0}"
364
svn log --revision ${latest_revision:-0}:HEAD --xml --verbose $fgaddon_svn > $aircrafts
365

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
366
total=$(grep -c '<logentry' $aircrafts)
367
progress=0
368

            
369
echo parsing history
370

            
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
371
while xmlgetnext; do
372
    case "$TAG" in
373
        'logentry revision='*)
374
            eval $(echo ${TAG#* })
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
375
            for action in ${!revpath[@]}; do
376
                unset revpath[$action]
377
            done
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
378
        ;;
379
        'author')
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
380
            revauthor=${VALUE//\'/\'\'}
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
381
        ;;
382
        'date')
383
            revdate=$(date +%s -d "$VALUE")
384
        ;;
385
        'path '*)
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
386
            TAG=${TAG#* }
387
            TAG=${TAG// /;}
388
            TAG=${TAG//-/_}
389
            eval $(echo ${TAG// /;})
390
            path=(${VALUE//\// })
391
            if test $kind = 'file' -a ${#path[@]} -gt 3; then
392
                revpath[$action]+="$VALUE "
393
            elif test $kind = 'dir' -a ${#path[@]} -eq 3 -a $action = 'D'; then
394
                files[_${path[2]}]=0
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
395
                unset revindex[_${path[2]}] revauthor[_${path[2]}] revdate[_${path[2]}]
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
396
                for sx in ${!setxmlmodified[@]}; do
397
                    [[ "$sx" =~ "${path[2]}/" ]] && unset setxmlmodified[$sx]
398
                done
399
            fi
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
400
        ;;
401
        '/logentry')
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
402
            for item in ${revpath[D]}; do
403
                path=(${item//\// })
manage aircraft deletion
Sébastien MARQUE authored on 2020-09-23
404
                if [[ "${path[3]}" =~ "-set.xml" ]]; then
405
                    unset setxmlmodified[${path[2]}/${path[3]/-set.xml}]
406
                    sqlite_request "delete from setxml where file = '${path[3]/-set.xml}'"
407
                fi
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
408
                files[_${path[2]}]=$(( --files[_${path[2]}] ))
409
                if test ${files[_${path[2]}]} -le 0; then
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
410
                    unset revindex[_${path[2]}] revauthor[_${path[2]}] revdate[_${path[2]}]
manage aircraft deletion
Sébastien MARQUE authored on 2020-09-23
411
                    sqlite_request "delete from aircrafts where name = '${path[2]}'"
many improvement
Sébastien MARQUE authored on 2020-09-08
412
                fi
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
413
            done
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
414
            for action in A M R; do
415
                for item in ${revpath[$action]}; do
416
                    path=(${item//\// })
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
417
                    revindex[_${path[2]}]=$revision
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
418
                    revauthor[_${path[2]}]=$revauthor
419
                    revdate[_${path[2]}]=$revdate
420
                    [[ "${path[3]}" =~ "-set.xml" ]] && setxmlmodified[${path[2]}/${path[3]/-set.xml}]=1
421
                    test $action = 'A' && files[_${path[2]}]=$(( ++files[_${path[2]}] ))
422
                done
423
            done
424
            newprogress=$((++logentry * 100 / $total))
425
            if test $(( $newprogress - $progress )) -ge ${progress_granularity:-1}; then
426
                progress=$newprogress
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
427
                echo "$progress% (${#revindex[@]})"
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
428
            fi
429
        ;;
430
        '/log')
431
            apply_revision
complete rewrite (use svn in...
Sébastien MARQUE authored on 2020-09-07
432
            break
433
        ;;
434
    esac
435
done < $aircrafts