File: fixcontrol

package info (click to toggle)
pcp 7.1.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 252,748 kB
  • sloc: ansic: 1,483,656; sh: 182,366; xml: 160,462; cpp: 83,813; python: 24,980; perl: 18,327; yacc: 6,877; lex: 2,864; makefile: 2,738; awk: 165; fortran: 60; java: 52
file content (475 lines) | stat: -rwxr-xr-x 12,604 bytes parent folder | download
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
#!/bin/sh
#
# generate control preamble from PCP-parameterized control stanza
# file ($1)
#
tmp=/var/tmp/fixcontrol-$$
sts=0
trap "rm -f $tmp.*; exit \$sts" 0 1 2 3 15

if [ $# -ne 1 ]
then
    echo >&2 "Usage: fixcontrol input-control-file"
    sts=1
    exit
fi

# set debug=true to save the sed script
#
debug=false

# The convention in our control files is that in the Build-Depends,
# Depends, Suggests, etc lines we use <tab> for the continutation
# and <space> for the continution in the Description stanza.
# A line that begins with 2 or more spaces is a potential problem
# when we need <tab> to strip empty lines after ?{foo}
# substitutions.
#
awk <"$1" >$tmp.tmp '
/^  /	{ print "'"$1"':" NR ": Error: line begins with 2 or more spaces" }'
if [ -s $tmp.tmp ]
then
    cat >&2 $tmp.tmp
    sts=1
    exit
fi

# dh-python not always available ... this is not checked for in configure
# so have to base it on the platform type and version
#
rm -f $tmp.no
if [ -f /etc/os-release ]
then
    NAME=`sed -n -e 's/"//'g -e '/^NAME=/s/NAME=//p' </etc/os-release`
    if [ "$NAME" = "Debian GNU/Linux" ]
    then
	VERSION_ID=`sed -n -e 's/"//'g -e '/^VERSION_ID=/s/VERSION_ID=//p' </etc/os-release`
	case "$VERSION_ID"
	in
	    7)
		touch $tmp.no
		;;
	esac
    elif [ "$NAME" = "Ubuntu" ]
    then
	VERSION_ID=`sed -n -e 's/"//'g -e '/^VERSION_ID=/s/VERSION_ID=//p' </etc/os-release`
	case "$VERSION_ID"
	in
	    12.04|12.10|13.04)
		touch $tmp.no
		;;
	esac
    fi
elif [ -f /etc/debian_version ]
then
    VERSION_ID=`cat /etc/debian_version`
    case "$VERSION_ID"
    in
	6.*)
	    touch $tmp.no
	    ;;
    esac
fi
if [ -f $tmp.no ]
then
    echo 's/\?\{dh-python}(, *|$)//' >>$tmp.sed
else
    echo 's/\?\{dh-python}(, *|$)/dh-python\\1/' >>$tmp.sed
fi

# for some others we rely on what configure has discovered
#
if [ ! -f ../src/include/builddefs ]
then
    echo "fixcontrol: Botch: ../src/include/builddefs does not exist"
    exit 1
fi

eval `grep -E '^(ENABLE_|PMDA_|HAVE_|QT_)' ../src/include/builddefs | sed -e 's/ //g'`

if $PMDA_PERFEVENT
then
    echo 's/\?\{libpfm4-dev}(, *|$)/libpfm4-dev\\1/' >>$tmp.sed
else
    echo 's/\?\{libpfm4-dev}(, *|$)//' >>$tmp.sed
fi

if $PMDA_INFINIBAND
then
    echo 's/\?\{libibverbs-dev}(, *|$)/libibverbs-dev\\1/' >>$tmp.sed
    echo 's/\?\{libibumad-dev}(, *|$)/libibumad-dev\\1/' >>$tmp.sed
    echo 's/\?\{libibmad-dev}(, *|$)/libibmad-dev\\1/' >>$tmp.sed
else
    echo 's/\?\{libibverbs-dev}(, *|$)//' >>$tmp.sed
    echo 's/\?\{libibumad-dev}(, *|$)//' >>$tmp.sed
    echo 's/\?\{libibmad-dev}(, *|$)//' >>$tmp.sed
fi

if $PMDA_BCC
then
    echo 's/\?\{python-bpfcc}(, *|$)/python3-bpfcc [amd64 arm64 armhf s390x ppc64]\\1/' >>$tmp.sed
else
    echo 's/\?\{python-bpfcc}(, *|$)//' >>$tmp.sed
fi

if $PMDA_BPFTRACE
then
    echo 's/\?\{bpftrace}(, *|$)/bpftrace (>= 0.9.2) [amd64 arm64]\\1/' >>$tmp.sed
else
    echo 's/\?\{bpftrace}(, *|$)//' >>$tmp.sed
fi

if $PMDA_BPF
then
    echo 's/\?\{clang}(, *|$)/clang\\1/' >>$tmp.sed
    echo 's/\?\{llvm}(, *|$)/llvm\\1/' >>$tmp.sed
else
    echo 's/\?\{clang}(, *|$)//' >>$tmp.sed
    echo 's/\?\{llvm}(, *|$)//' >>$tmp.sed
fi

if $PMDA_POSTGRESQL
then
    if $ENABLE_PYTHON3
    then
	echo 's/\?\{python-psycopg2}(, *|$)/python3-psycopg2\\1/' >>$tmp.sed
    else
	echo 's/\?\{python-psycopg2}(, *|$)/python-psycopg2\\1/' >>$tmp.sed
    fi
else
    echo 's/\?\{python-psycopg2}(, *|$)//' >>$tmp.sed
fi

if $ENABLE_SYSTEMD
then
    # this is a pain ...
    # /usr/share/pkgconfig/systemd.pc is the file configure needs
    # but that's in different packages for different platforms try
    # and suss out the package, but if that fails simply omit any
    # related package from the Build-Depends: clause
    #
    if [ -f /usr/share/pkgconfig/systemd.pc ]
    then
	pkg=`dpkg-query -S /usr/share/pkgconfig/systemd.pc 2>/dev/null | sed -e 's/: .*//'`
	if [ -n "$pkg" ]
	then
	    echo 's/\?\{systemd-pkgconfig}(, *|$)/'"$pkg"'\\1/' >>$tmp.sed
	else
	    echo 's/\?\{systemd-pkgconfig}(, *|$)//' >>$tmp.sed
	fi
    else
	echo 's/\?\{systemd-pkgconfig}(, *|$)//' >>$tmp.sed
    fi
else
    echo 's/\?\{systemd-pkgconfig}(, *|$)//' >>$tmp.sed
fi

# PMDA_SYSTEMD is only true if we have libsystemd ...
# Note: that the HAVE_SYSTEMD_SD_DAEMON_H macro that is used to
# guard the use of libsystemd from libpcp is not available here, but
# the semantics of HAVE_SYSTEMD_SD_DAEMON_H and PMDA_SYSTEMD are
# close enough to being the same!
#
if $PMDA_SYSTEMD
then
    echo 's/\?\{libsystemd-dev}(, *|$)/libsystemd-dev\\1/' >>$tmp.sed
else
    echo 's/\?\{libsystemd-dev}(, *|$)//' >>$tmp.sed
fi


if $ENABLE_PYTHON3
then
    echo 's/\?\{python}(, *|$)/python3\\1/' >>$tmp.sed
    echo 's/\?\{python-all}(, *|$)/python3-all\\1/' >>$tmp.sed
    echo 's/\?\{python-dev}(, *|$)/python3-dev\\1/' >>$tmp.sed
    echo 's/\?\{python-pcp}(, *|$)/python3-pcp\\1/' >>$tmp.sed
else
    echo 's/\?\{python}(, *|$)//' >>$tmp.sed
    echo 's/\?\{python-all}(, *|$)//' >>$tmp.sed
    echo 's/\?\{python-dev}(, *|$)//' >>$tmp.sed
    echo 's/\?\{python-pcp}(, *|$)//' >>$tmp.sed
fi

if $HAVE_PYTHON_OPENPYXL
then
    echo 's/\?\{python-openpyxl}(, *|$)/python3-openpyxl\\1/' >>$tmp.sed
else
    echo 's/\?\{python-openpyxl}(, *|$)//' >>$tmp.sed
fi

if $HAVE_PYTHON_REQUESTS
then
    echo 's/\?\{python-requests}(, *|$)/python3-requests\\1/' >>$tmp.sed
else
    echo 's/\?\{python-requests}(, *|$)//' >>$tmp.sed
fi

if $ENABLE_LZMA
then
    echo 's/\?\{liblzma-dev}(, *|$)/liblzma-dev\\1/' >>$tmp.sed
else
    echo 's/\?\{liblzma-dev}(, *|$)//' >>$tmp.sed
fi

if [ "$QT_VERSION" -ge 5 ]
then
    echo 's/\?\{qt-dev}(, *|$)/qtbase5-dev, qtbase5-dev-tools, libqt5svg5-dev, qtchooser\\1/' >>$tmp.sed
elif [ "$QT_VERSION" -ge 4 ]
then
    echo 's/\?\{qt-dev}(, *|$)/libqt4-dev, qt4-qmake\\1/' >>$tmp.sed
else
    echo 's/\?\{qt-dev}(, *|$)//' >>$tmp.sed
fi

if $HAVE_OPENSSL
then
    echo 's/\?\{libssl-dev}(, *|$)/libssl-dev\\1/' >>$tmp.sed
else
    echo 's/\?\{libssl-dev}(, *|$)//' >>$tmp.sed
fi

if $HAVE_LIBUV
then
    echo 's/\?\{libuv1-dev}(, *|$)/libuv1-dev\\1/' >>$tmp.sed
else
    echo 's/\?\{libuv1-dev}(, *|$)//' >>$tmp.sed
fi

if $HAVE_LIBINIH
then
    echo 's/\?\{libinih-dev}(, *|$)/libinih-dev\\1/' >>$tmp.sed
else
    echo 's/\?\{libinih-dev}(, *|$)//' >>$tmp.sed
fi

if $HAVE_PERL
then
    echo 's/\?\{(perl [^}]*)}(, *|$)/\\1\\2/' >>$tmp.sed
    echo 's/\?\{libclass-dbi-perl}(, *|$)/libclass-dbi-perl\\1/' >>$tmp.sed
    echo 's/\?\{libdbd-mysql-perl}(, *|$)/libdbd-mysql-perl\\1/' >>$tmp.sed
    echo 's/\?\{libextutils-autoinstall-perl}(, *|$)/libextutils-autoinstall-perl\\1/' >>$tmp.sed
    echo 's/\?\{libxml-tokeparser-perl}(, *|$)/libxml-tokeparser-perl\\1/' >>$tmp.sed
    echo 's/\?\{libjson-perl}(, *|$)/libjson-perl\\1/' >>$tmp.sed
    echo 's/\?\{libwww-perl}(, *|$)/libwww-perl\\1/' >>$tmp.sed
    echo 's/\?\{libnet-snmp-perl}(, *|$)/libnet-snmp-perl\\1/' >>$tmp.sed
else
    echo 's/\?\{perl [^}]*}(, *|$)//' >>$tmp.sed
    echo 's/\?\{libclass-dbi-perl}(, *|$)//' >>$tmp.sed
    echo 's/\?\{libdbd-mysql-perl}(, *|$)//' >>$tmp.sed
    echo 's/\?\{libextutils-autoinstall-perl}(, *|$)//' >>$tmp.sed
    echo 's/\?\{libxml-tokeparser-perl}(, *|$)//' >>$tmp.sed
    echo 's/\?\{libjson-perl}(, *|$)//' >>$tmp.sed
    echo 's/\?\{libwww-perl}(, *|$)//' >>$tmp.sed
    echo 's/\?\{libnet-snmp-perl}(, *|$)//' >>$tmp.sed
    echo '/^Recommends: libpcp-pmda-perl/d' >>$tmp.sed
    echo '/^Suggests: pcp-gui, libpcp-import-perl, /s/libpcp-import-perl, //' >>$tmp.sed
fi

# build needs postfix for postfix PMDA (closes: #929368)
#
if $PMDA_POSTFIX
then
    echo 's/\?\{postfix}(, *|$)/postfix\\1/' >>$tmp.sed
else
    echo 's/\?\{postfix}(, *|$)//' >>$tmp.sed
fi

# build needs libxml-libxml-perl and libfile-slurp-perl for bind2 PMDA (closes: #929376)
#
if $PMDA_BIND2
then
    echo 's/\?\{libxml-libxml-perl}(, *|$)/libxml-libxml-perl\\1/' >>$tmp.sed
    echo 's/\?\{libfile-slurp-perl}(, *|$)/libfile-slurp-perl\\1/' >>$tmp.sed
else
    echo 's/\?\{libxml-libxml-perl}(, *|$)//' >>$tmp.sed
    echo 's/\?\{libfile-slurp-perl}(, *|$)//' >>$tmp.sed
fi

# build needs libyaml-libyaml-perl and libjson-perl for nutcracker PMDA (closes: #929377)
# - libjson-perl done above for $HAVE_PERL
#
if $PMDA_NUTCRACKER
then
    echo 's/\?\{libyaml-libyaml-perl}(, *|$)/libyaml-libyaml-perl\\1/' >>$tmp.sed
else
    echo 's/\?\{libyaml-libyaml-perl}(, *|$)//' >>$tmp.sed
fi

# build needs libjson-perl for activemq PMDA
#
if $PMDA_ACTIVEMQ
then
    echo 's/\?\{libjson-perl}(, *|$)/libjson-perl\\1/' >>$tmp.sed
else
    echo 's/\?\{libjson-perl}(, *|$)//' >>$tmp.sed
fi

# build needs python3-rtslib-fb for lio PMDA (closes: #929378)
#
if $PMDA_LIO
then
    echo 's/\?\{python-rtslib-fb}(, *|$)/python3-rtslib-fb\\1/' >>$tmp.sed
else
    echo 's/\?\{python-rtslib-fb}(, *|$)//' >>$tmp.sed
fi

# build needs python3-libvirt and python3-lxml for libvirt PMDA (closes: #929379)
#
if $PMDA_LIBVIRT
then
    echo 's/\?\{python-libvirt}(, *|$)/python3-libvirt\\1/' >>$tmp.sed
    echo 's/\?\{python-lxml}(, *|$)/python3-lxml\\1/' >>$tmp.sed
else
    echo 's/\?\{python-libvirt}(, *|$)//' >>$tmp.sed
    echo 's/\?\{python-lxml}(, *|$)//' >>$tmp.sed
fi

# build needs libdrm-dev for amdgpu PMDA
#
if $PMDA_AMDGPU
then
    echo 's/\?\{libdrm-dev}(, *|$)/libdrm-dev\\1/' >>$tmp.sed
else
    echo 's/\?\{libdrm-dev}(, *|$)//' >>$tmp.sed
fi

# build needs python3-pymongo for mongodb PMDA
#
if $PMDA_MONGODB
then
    echo 's/\?\{python-pymongo}(, *|$)/python3-pymongo\\1/' >>$tmp.sed
else
    echo 's/\?\{python-pymongo}(, *|$)//' >>$tmp.sed
fi

# build needs python3-urllib3 for elasticsearch PMDA
#
if $PMDA_ELASTICSEARCH
then
    echo 's/\?\{python-urllib3}(, *|$)/python3-urllib3\\1/' >>$tmp.sed
else
    echo 's/\?\{python-urllib3}(, *|$)//' >>$tmp.sed
fi

# build needs libdbi-perl and libdbd-mysql-perl for mysql and
# oracle PMDA
# -libdbd-mysql-perl done above for $HAVE_PERL
#
if $PMDA_MYSQL || $PMDA_ORACLE
then
    echo 's/\?\{libdbi-perl}(, *|$)/libdbi-perl\\1/' >>$tmp.sed
else
    echo 's/\?\{libdbi-perl}(, *|$)//' >>$tmp.sed
fi

# build needs python3-pyodbc for mssql PMDA
#
if $PMDA_MSSQL
then
    echo 's/\?\{python-pyodbc}(, *|$)/python3-pyodbc\\1/' >>$tmp.sed
else
    echo 's/\?\{python-pyodbc}(, *|$)//' >>$tmp.sed
fi

# build needs python3-requests and OrderedDict module (from libpython
# that will be there) for openmetrics PMDA
# - python3-requests done above for $HAVE_PYTHON_REQUESTS
#
if $PMDA_OPENMETRICS
then
    :
fi

# build needs libnet-snmp-perl for snmp PMDA
# - libnet-snmp-perl done above for $HAVE_PERL
#
if $PMDA_SNMP
then
    :
fi

# these PMDAs are optional in the build, but have no additional
# Build-Depends: requirements (added here for completeness)
#
if $PMDA_GFS2 || $PMDA_NGINX || $PMDA_RESCTRL
then
    :
fi

# these PMDAs are optional in the build but NEVER build for
# Debian-based platforms, so nothing to add in Build-Depends:
#
if $PMDA_STATSD
then
    :
fi

# build needs libsystemd-dev for systemd PMDA (closes: #929372)
#
if $PMDA_SYSTEMD
then
    echo 's/\?\{libsystemd-dev}(, *|$)/libsystemd-dev\\1/' >>$tmp.sed
else
    echo 's/\?\{libsystemd-dev}(, *|$)//' >>$tmp.sed
fi

# add perl-xs-dev to Build-Depends for trixie or later (closes: #1102849)
#
rm -f $tmp.yes
if [ -f /etc/os-release ]
then
    NAME=`sed -n -e 's/"//'g -e '/^NAME=/s/NAME=//p' </etc/os-release`
    if [ "$NAME" = "Debian GNU/Linux" ]
    then
	VERSION_ID=`sed -n -e 's/"//'g -e '/^VERSION_ID=/s/VERSION_ID=//p' </etc/os-release`
	# trixie is 13
	#
	[ "$VERSION_ID" -ge 13 ] && touch $tmp.yes
    elif [ "$NAME" = "Ubuntu" ]
    then
	VERSION_ID=`sed -n -e 's/"//'g -e '/^VERSION_ID=/s/VERSION_ID=//p' </etc/os-release`
	# Ubuntu 24.04 is trixie-based
	#
	[ `echo $VERSION_ID | sed -e 's/\.//'` -ge 2404 ] && touch $tmp.yes
    fi
elif [ -f /etc/debian_version ]
then
    VERSION_ID=`cat /etc/debian_version`
    [ "$VERSION_ID" -ge 13 ] && touch $tmp.yes
fi
if [ -f $tmp.yes ]
then
    echo 's/\?\{perl-xs-dev}(, *|$)/perl-xs-dev\\1/' >>$tmp.sed
else
    echo 's/\?\{perl-xs-dev}(, *|$)//' >>$tmp.sed
fi

echo '/^	$/d' >>$tmp.sed
sed -E -f $tmp.sed <"$1" >$tmp.out
diff -u "$1" $tmp.out >&2
cat $tmp.out
if $debug
then
    echo >&2 "Debug: sed saved to tmp.sed"
    rm -f tmp.sed
    mv $tmp.sed tmp.sed
fi

# add transitional packages for (incorrect) Ubuntu package renaming
#
if [ -f /etc/os-release ]
then
    NAME=`sed -n -e 's/"//'g -e '/^NAME=/s/NAME=//p' </etc/os-release`
    if [ "$NAME" = "Ubuntu" ]
    then
	if grep -q 'Package: libpcp3t64' control 2>/dev/null
	then
	    # but do it only once and already done apparenty
	    #
	    :
	else
	    cat control.ubuntu
	fi
    fi
fi