forked from omniosorg/omnios-extra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest
executable file
·192 lines (169 loc) · 3.73 KB
/
test
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
#!/bin/ksh -e
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
# Copyright 2021 OmniOS Community Edition (OmniOSce) Association.
__SCRIPTDIR="${0%/*}"
cd $__SCRIPTDIR/..
[ ! -d build -o ! -x build/buildctl ] && echo "Cannot find directory" && exit 1
err=0
problem()
{
echo "********** $*"
err=1
}
pver()
{
grep "^$1=" $build | cut -d= -f2
}
typeset -A targets
add_target()
{
typeset pkg=$1
typeset build=$2
typeset dir="`dirname $build`"
if [[ $build = *.sh ]]; then
ver="`grep ^VER= $build | sed '
1 {
s/VER=//
s/ .*//
q
}'`"
case $pkg:$ver in
ooce/network/openvpn-auth-ldap:*)
ver="`grep '^AUTHLDAPVER=' $build | cut -d= -f2`"
;;
ooce/runtime/expect:*)
ver="`grep '^EXPECTVER=' $build | cut -d= -f2`"
;;
*/cyrus-imapd:*)
targets["ooce/library/libical"]=`pver ICALVER`
;;
*/zadm:*)
targets["ooce/application/novnc"]=`pver NOVNCVER`
;;
esac
targets[$pkg]=$ver
elif [[ $build = *.p5m ]]; then
egrep -q 'pkg.obsolete.*true' $build && return
egrep -q 'pkg.renamed.*true' $build && return
# No manifests of interest currently
#echo "P5M:`grep pkg.fmri $build`"
:
else
echo "Unknown target type"
exit 1
fi
}
extract_manifest_name()
{
nawk '/^set name=pkg.fmri/ {print $3}' $1 | sed -e '
s/value=//
s:.*//[^/]*/::g
s/@.*//
'
}
add_manifests()
{
for manifest in `find build -name \*.p5m`; do
for PKG in `extract_manifest_name $manifest`; do
add_target $PKG $manifest
done
done
}
extract_pkgs()
{
sed -nE '
/##IGNORE##/d
/\<PKG=[^[:space:]]+[[:space:]]*(#.*)?$/ {
s/.*PKG=/PKG=/
s/[[:space:]]+#.+//
s/=/ /g
p
}' $1 | nawk '$1 == "PKG" { print $2 }'
}
add_buildscripts()
{
for build in `find build -name build\*.sh`; do
for PKG in `extract_pkgs $build`; do
add_target $PKG $build
done
done
}
add_targets()
{
echo "Finding build components..."
add_manifests
add_buildscripts
}
print_targets()
{
for i in "${!targets[@]}"; do
printf "%-40s %s\n" $i ${targets[$i]#*/}
done
}
check_packages_md()
{
echo "Checking doc/packages.md..."
nawk -F '|' < doc/packages.md '
/\// {
gsub(/ */, "")
print $2, $3
}
' | while read pkg ver; do
# Skip some packages, tweak others
case $pkg in
shell/bash-patchlvl) continue ;;
shell/bash) continue ;;
*/virtualbox-5) continue ;;
esac
if [ -n "${targets[$pkg]}" ]; then
if [ "${targets[$pkg]}" != "$ver" ]; then
problem "$pkg - packages.md=$ver,"\
"build=${targets[$pkg]}"
fi
else
problem "Unknown package $pkg in packages.md"
fi
done
}
check_constraints()
{
comp="$1"
while read pkg ver; do
# Skip some packages, tweak others
[ -n "${targets[$pkg]}" ] && bver=${targets[$pkg]} || bver=
case $pkg in
# placeholder for skipping/tweaking packages
# */kvm) continue ;;
# */ntp) bver=${bver/p/.} ;;
esac
obver="$bver"
if [ -n "$bver" ]; then
[ "$bver" = "$ver" ] && continue
# Try with s/00/0
[ "${bver//00/0}" = "$ver" ] && continue
# Strip final components in turn and check for
# a match.
while [[ $bver = *.* ]]; do
bver=${bver%.*}
[ "$bver" = "$ver" ] && continue 2
[ "${bver//00/0}" = "$ver" ] && continue 2
done
problem "$pkg - $comp=$ver, build=$obver"
else
[ $comp = entire ] \
|| problem "Unknown package $pkg in $comp"
fi
done
}
add_targets
#print_targets
check_packages_md
exit $err