-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.updchk
126 lines (120 loc) · 2.93 KB
/
.updchk
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
#!/bin/mksh
# -*- mode: sh -*-
#-
# © 2020, 2022, 2024 mirabilos Ⓕ MirBSD
export LC_ALL=C POSIXLY_CORRECT=1
unset LANGUAGE
mydir=$(realpath "$0/..")
cd "$mydir" || exit 255
PATH="$mydir/mksh:$PATH" . assockit.ksh
[[ $1 != /* || ! -d $1 ]] || cd "$1" || exit 255
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
git grep -F '$Mir''OS: '
else
grep -Fr '$Mir''OS: ' # GNUism
fi |&
while IFS= read -pr line; do
fn=${line%%:*}
line=${line#*:}
line=${line#*'$Mir''OS: '}
if [[ $line != +([! ]),v\ +([0-9.])?('+'+([! ]))\ +([0-9/])\ +([0-9:])\ +([! ])\ +([! ])\ *(\\)\$* ]]; then
print -ru2 -- "D: mismatch($fn) ${line@Q}"
continue
fi
sn=${line%%,v *}
sn=${sn//'/Attic/'/'/'}
line=${line#* }
sv=${line%% *}
asso_setnull df "$fn" "$sn" "$sv"
asso_setnull sf "$sn" "$fn" "$sv"
done
asso_loadk sf
cvs -Rqd "${CVSROOT:-/cvs}" rlog -h "${asso_y[@]}" | \
grep -e '^RCS file: ' -e '^head: ' |&
while IFS= read -pr line; do
if [[ $line != 'RCS file: '*,v ]]; then
print -ru2 -- "W: bad server line ${line@Q}"
continue
fi
sf=${line##RCS file: /*([!/])cvs/}
sf=${sf%,v}
sf=${sf//'/Attic/'/'/'}
if ! IFS= read -pr line; then
print -ru2 -- "D: no head for source ${sf@Q}"
break
fi
if [[ $line != 'head: '* ]]; then
print -ru2 -- "W: no head for source ${sf@Q}: ${line@Q}"
continue
fi
line=${line#head: }
if ! asso_isset sf "$sf"; then
print -ru2 -- "D: no entry for source ${sf@Q}"
continue
fi
asso_sets "$line" sr "$sf"
done
rf=
rs=
asso_loadk df
for df in "${asso_y[@]}"; do
asso_loadk df "$df"
for sf in "${asso_y[@]}"; do
if ! sv=$(asso_getv sr "$sf"); then
print -ru2 "W: no source for df=${df@Q} sf=${sf@Q}"
sv=-
fi
asso_loadk df "$df" "$sf"
for dv in "${asso_y[@]}"; do
[[ -n $1 ]] || case ${df}${sf}${dv}${sv} {
(ksh/prompt-tgsrc/bin/mksh/dot.mkshrc*)
continue ;;
(mksh/@(base64|hash-*|hd|more|pushd-popd-dirs|strip-comments)src/bin/mksh/dot.mkshrc*)
continue ;;
(mksh/hex*src/bin/mksh/check.t*)
continue ;;
(mksh/sysadmin/gencert.sh*1.135)
continue ;;
(mksh/@(sysadmin/@(mvndebri.sh|vcs2deb)|teckids/mk/common|website.shar)*)
continue ;;
(mksh/uhr-preR41contrib/hosted/tg/uhr1.5*)
continue ;;
}
case ${df}${sf}${dv}${sv} {
(*src/usr.bin/wtf/chkdb1.61.7)
# r1.7 is Dead
continue ;;
(*contrib/hosted/tg/L3651.21.3)
# r1.3 is Dead
continue ;;
(*contrib/hosted/tg/bin2print1.11.2)
# r1.2 is Dead
continue ;;
}
if [[ ${dv%%'+'*} = "$sv" ]]; then
rf+="${df}${sf}${dv}${sv}ok"$'\n'
else
rf+="${df}${sf}${dv}${sv}NU"$'\n'
rs+="${sf}${df}${sv}${dv}"$'\n'
fi
done
done
done
print
if [[ -n $rf ]]; then
print -nr -- "$rf" | sort -u | {
print dstfilesrcfiledstvsrcvst
cat
} | column -ts
else
print W: no RCS IDs found
fi
print
if [[ -n $rs ]]; then
print -nr -- "$rs" | sort -u | {
print srcfiledstfilesrcvdstv
cat
} | column -ts
else
print I: nothing to update
fi