blob: 05578bfea6a95fd287e9252fe577a669be222d5c (
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
|
# $NetBSD: post-build-conf,v 1.14 2007/03/06 10:57:11 rillig Exp $
#
# This file is included after the build.conf file by the "build" and
# "pre-build" scripts. It provides functions for printing, checking and
# exporting the configuration variables.
# Note: All functions whose names start with "pbc_" are considered private
# to this file. The "pbc" prefix is an abbreviation for "post-build-conf".
# usage: pbc_showvar varname
pbc_showvar() {
eval "pbc_isset=\${$1+set}"
case $pbc_isset in
"set") eval "fnv_val=\${$1-}"
printf " %-25s = %s\\n" "$1" "${fnv_val}"
;;
*) printf " %-25s (undefined)\\n" "$1"
;;
esac
}
# usage: pbc_section title varname...
pbc_section() {
printf "%s\\n" "$1"
shift
for pbc_var in "$@"; do
pbc_showvar "${pbc_var}"
done
printf "\\n"
}
# usage: show_config_vars
show_config_vars() {
pbc_section "System information" \
osrev BULK_BUILD_CONF USR_PKGSRC MAKECONF
pbc_section "Getting distfiles" \
PRUNEDISTFILES ftp_proxy http_proxy
pbc_section "Building the packages" \
PKGLIST NICE_LEVEL
pbc_section "Generating the report" \
ADMIN ADMINSIG \
REPORTS_URL REPORTS_DIR \
REPORT_BASEDIR REPORT_HTML_FILE REPORT_TXT_FILE
pbc_section "Uploading binary packages" \
UPDATE_VULNERABILITY_LIST PRUNEPACKAGES MKSUMS SIGN_AS \
RSYNC_DST RSYNC_OPTS
}
# usage: export_config_vars
export_config_vars() {
export osrev BULK_BUILD_CONF USR_PKGSRC
export PRUNEDISTFILES ftp_proxy http_proxy
export PKGLIST NICE_LEVEL ADMIN ADMINSIG
export UPDATE_VULNERABILITY_LIST PRUNEPACKAGES MKSUMS SIGN_AS
export RSYNC_DST RSYNC_OPTS
case ${MAKECONF+set} in
"set") export MAKECONF;;
esac
}
# usage: pbc_die error-message
pbc_die() {
exec 1>&2
printf "error: %s\\n" "$@"
printf " Please check your bulk build configuration file:\\n"
case ${BULK_BUILD_CONF+set} in
"set") printf " %s\\n" "${BULK_BUILD_CONF}"
esac
exit 1
}
# usage: pbc_checkyesno varname
pbc_checkyesno() {
eval "pbc_val=\${$1-}"
case $pbc_val in
[Yy][Ee][Ss]|[Nn][Oo]) ;;
*) pbc_die "$1 must be set to one of YES, yes, NO, no.";;
esac
}
# usage: pbc_checkpathname varname
pbc_checkpathname() {
eval "pbc_val=\${$1-}"
case $pbc_val in
/*) ;;
*) pbc_die "$1 must be an absolute pathname.";;
esac
}
# usage: pbc_checkbasename varname
pbc_checkbasename() {
eval "pbc_val=\${$1-}"
case $pbc_val in
*/*) pbc_die "$1 must not contain slashes.";;
esac
}
# usage: pbc_checkexistingfile varname
pbc_checkexistingfile() {
pbc_checkpathname "$1"
eval "pbc_val=\${$1-}"
test -f "${pbc_val}" \
|| pbc_die "$1 must be the name of an existing file."
}
# usage: pbc_checkexistingdir varname
pbc_checkexistingdir() {
pbc_checkpathname "$1"
eval "pbc_val=\${$1-}"
test -d "${pbc_val}" \
|| pbc_die "$1 must be the name of an existing directory."
}
# usage: pbc_checkurl varname
pbc_checkurl() {
eval "pbc_val=\${$1-}"
case $pbc_val in
file:///*|ftp://*|http://*)
;;
*) pbc_die "$1 is not a valid URL.";;
esac
}
# usage: pbc_checknonempty varname
pbc_checknonempty() {
eval "pbc_isset=\${$1+set}"
eval "pbc_val=\${$1-}"
case $pbc_isset in
"set") case $pbc_val in
"") pbc_die "$1 must be non-empty.";;
esac;;
*) pbc_die "$1 must be defined and non-empty.";;
esac
}
# usage: pbc_checkdefined varname
pbc_checkdefined() {
eval "pbc_val=\${$1+set}"
case $pbc_val in
"set") ;;
*) pbc_die "$1 must be defined.";;
esac
}
# usage: check_config_vars
check_config_vars() {
case ${FTP+set},${REPORTS_DIR+set} in
set,set)
pbc_die "FTP and REPORTS_DIR must not be set both.";;
esac
# section "System information"
pbc_checknonempty osrev
pbc_checkexistingfile BULK_BUILD_CONF
pbc_checkexistingdir USR_PKGSRC
case ${MAKECONF+set} in
"set") pbc_checkexistingfile MAKECONF;;
esac
# section "Getting distfiles"
case ${PRUNEDISTFILES+set} in
"set") pbc_checkyesno PRUNEDISTFILES
esac
# no checks for ftp_proxy
# no checks for http_proxy
# section "Building the packages"
# no checks for PKGLIST
# no checks for NICE_LEVEL
# section "Generating the report"
# no checks for ADMIN
# no checks for ADMINSIG
pbc_checkurl REPORTS_URL
pbc_checkpathname REPORTS_DIR
pbc_checkbasename REPORT_BASEDIR
pbc_checkbasename REPORT_HTML_FILE
pbc_checkbasename REPORT_TXT_FILE
# section "Uploading binary packages"
pbc_checkyesno UPDATE_VULNERABILITY_LIST
case ${PRUNEPACKAGES+set} in
"set") pbc_checkyesno PRUNEPACKAGES
esac
pbc_checkyesno MKSUMS
# no checks for SIGN_AS
# no checks for RSYNC_DST
# no checks for RSYNC_OPTS
}
|