config / .fgfs / fgaddon /
Newer Older
448 lines | 16.783kb
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

            
21
aircrafts=$(mktemp --dry-run /dev/shm/Aircraft-XXXXXXXXX)
22
aircraft=$(mktemp --dry-run /dev/shm/aircraft-XXXXXXX)
23
setxml=$(mktemp --dry-run /dev/shm/setxml-XXXXXXXX)
24
in_ram_database=$(mktemp --dry-run /dev/shm/XXXXXXX)
25

            
26

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

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

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

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

            
65
function trap_exit () {
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
66
    trapped_rc=$?
67
    trap '' INT
68
    rm -f $aircrafts $aircraft $setxml
69
    if test ! -e $in_ram_database; then
70
        exit
71
    fi
72
    test $trapped_rc -ne 0 && register_state
many improvements
Sébastien MARQUE authored on 2020-09-02
73
    echo "updating installation status"
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
74
    for ac in $(sqlite_request 'select printf("%i:%s/%s", aircrafts.id, aircrafts.name, setxml.file)
75
                                from aircrafts inner join setxml
76
                                where aircrafts.id = setxml.variantof and setxml.installed != 0;'); do
many improvements
Sébastien MARQUE authored on 2020-09-02
77
        ac_path=${ac#*:}
many improvement
Sébastien MARQUE authored on 2020-09-08
78
        if test ! -e $fgaddon_path/$ac_path-set.xml; then
79
            sqlite_request "update setxml set installed = 0 where file = '${ac_path#*/}' and variantof = ${ac%:*}"
80
        fi
81
    done
82
    for ac in $fgaddon_path/*/*-set.xml; do
83
        ac=${ac/$fgaddon_path}
84
        sx=${ac##*/}
85
        ac=${ac%/*}
86
        if test -d $fgaddon_path/$ac/.svn; then
87
            install_type=1
88
        elif test -d $fgaddon_path/$ac/.git; then
89
            install_type=2
90
        else
91
            install_type=3
92
        fi
93
        sqlite_request "update setxml set installed = $install_type
94
                        where exists (
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
95
                            select 1
96
                            from aircrafts
97
                            where name = '${ac/\/}' and setxml.variantof = id
many improvement
Sébastien MARQUE authored on 2020-09-08
98
                        )"
many improvements
Sébastien MARQUE authored on 2020-09-02
99
    done
improve output for missing a...
Sébastien MARQUE authored on 2020-09-23
100
    missing_setxml=$(sqlite_request "select printf(' - %s', name) from aircrafts 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
#                    property+=/${TAG%% *}
200
#                    if test "${TAG: -1}" = '/'; then
201
#                        _TAG=${TAG:0:-1}
202
#                        test "${_TAG#* }" != "${_TAG}" && eval "${_TAG#* }"
203
#                        property=${property%/*}
204
#                    fi;;
205
            esac
206

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

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

            
small stuff
Sébastien MARQUE authored on 2020-09-27
238
#            if test -n "$_TAG"; then
239
#                # _TAG non-null means xml props ends with /
240
#                # need to go back of last property
241
#                property=${property/%\/${_TAG%% *}}
242
#                unset _TAG
243
#            fi
many improvement
Sébastien MARQUE authored on 2020-09-08
244

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

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

            
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
257
        known=$(sqlite_request "select variantof from setxml where file is '$sx'")
258
        if test -n "$known"; then
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
259
            for col in ${!data[@]}; do
260
                dbvalue=$(sqlite_request "select '$col'
261
                                          from setxml
262
                                          where file is '$sx' and variantof = $known")
263
                if test "$dbvalue" != "${data[$col]}" -a -n "${data[$col]}"; then
264
                    sqlite_request "update setxml
265
                                    set '$col' = '${data[$col]//\'/\'\'}'
266
                                    where file is '$sx' and variantof = $known"
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
267
                fi
268
            done
269
        else
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
270
            values="'$sx', $id, "
271
            for col in ${!data[@]}; do
272
                values+="'${data[$col]//\'/\'\'}', "
273
            done
274
            values+=0
275
            sqlite_request "insert into setxml values ($values)"
276
        fi
277
        test -n "$ac_save" && ac=$ac_save
278
        unset setxmlmodified[${ac:1}/$sx]
279
    done
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
280
    unset revindex[$ac]
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
281
}
282

            
283
function apply_revision () {
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
284
    for ac in "${!revindex[@]}"; do
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
285
        update_database
286
        if test -d $fgaddon_path/${ac:1}/.svn \
287
        && test "$(svn info --show-item=url $fgaddon_path/${ac:1})" != "$fgaddon_svn/${ac:1}" \
288
        || test -d $fgaddon_path/${ac:1} -a ! -d $fgaddon_path/${ac:1}/.svn; then
289
            echo "INFO: local ${ac:1} installed out from repo" >&2
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
290
        fi
291
    done
292
}
293

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

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

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

            
304
if test -e $database; then
305
    cp $database $in_ram_database
306
    sql_cols=$(sqlite_request "pragma table_info(setxml)" | awk -F'|' '{printf("%s %s ", $2, $3)}')
307
    script_cols="file text variantof integer "
308
    for col in ${!data[@]}; do
309
        script_cols+="$col ${data["$col"]} "
310
    done
311
    script_cols+="installed integer " # last space is important
312
    if test "$sql_cols" != "$script_cols"; then
313
        echo "ALERT: datbase version mismatch !"
314
        exit 1
315
    fi
316
    if sqlite_request '.tables' | grep -q 'recover_' && test -z "$1"; then
317
        echo "recovering from previous saved state"
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
318
        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
319
                                       revkey, revision,
320
                                       revkey, revauthor,
321
                                       revkey, revdate)
322
                               from recover_rev")
323
        eval $(sqlite_request "select printf('setxmlmodified[%s]=1;', sx)
324
                               from recover_setxmlmodified")
325
        sqlite_request "drop table recover_rev"
326
        sqlite_request "drop table recover_setxmlmodified"
327
        apply_revision
328
        exit
329
    fi
330
fi
331

            
332
sqlite_request "create table if not exists aircrafts (
333
                    id integer primary key,
334
                    name text,
335
                    revision integer,
336
                    date integer,
337
                    author text)"
ajout de gestion de bdd pour...
Sébastien MARQUE authored on 2020-08-24
338

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

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

            
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
347
# for debugging purpose
348
if test -n "$2"; then
349
    ac=_${1%/*}
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
350
    revindex[$ac]=1
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
351
    revdate[$ac]=0
352
    revauthor[$ac]=foobar
353
    setxmlmodified[${ac:1}/${1#*/}]=1
354
    set -x
355
    update_database
356
    set +x
357
    exit
358
elif test -n "$1"; then
359
    ac=_${1%/*}
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
360
    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
361
                                            name, revision,
362
                                            name, date,
363
                                            name, author)
364
                           from aircrafts
365
                           where name = '${ac:1}'")
366
    setxmlmodified[${ac:1}/${1#*/}]=1
fix variable name conflict
Sébastien MARQUE authored on 2020-09-23
367
    if test -z "${revindex[$ac]}"; then
ré-écriture complète
Sébastien MARQUE authored on 2020-09-20
368
        echo "aircraft ${ac:1} not found"
369
        rm $in_ram_database
370
        exit
371
    fi
372
    update_database
373
    exit
374
fi
375

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

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

            
382
echo parsing history
383

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