Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/dahdi-tools/, net-misc/dahdi-tools/files/
Date: Thu, 30 Jun 2022 21:47:41
Message-Id: 1656625602.927a9ab6f7f379ad727928be6d7174cd62cce398.sam@gentoo
1 commit: 927a9ab6f7f379ad727928be6d7174cd62cce398
2 Author: Jaco Kroon <jaco <AT> uls <DOT> co <DOT> za>
3 AuthorDate: Wed Jun 15 13:06:51 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Thu Jun 30 21:46:42 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=927a9ab6
7
8 net-misc/dahdi-tools: revbump to fix bugs.
9
10 No major changes.
11
12 Biggest was to add T1 support into dahdi-autoconf.
13
14 Closes: https://bugs.gentoo.org/841428
15 Closes: https://bugs.gentoo.org/852779
16 Closes: https://bugs.gentoo.org/852785
17 Package-Manager: Portage-3.0.30, Repoman-3.0.3
18 Signed-off-by: Jaco Kroon <jaco <AT> uls.co.za>
19 Closes: https://github.com/gentoo/gentoo/pull/25852
20 Signed-off-by: Sam James <sam <AT> gentoo.org>
21
22 net-misc/dahdi-tools/dahdi-tools-3.1.0-r3.ebuild | 70 ++++++
23 .../dahdi-tools/files/dahdi-autoconf.init-3.1.0-r3 | 271 +++++++++++++++++++++
24 2 files changed, 341 insertions(+)
25
26 diff --git a/net-misc/dahdi-tools/dahdi-tools-3.1.0-r3.ebuild b/net-misc/dahdi-tools/dahdi-tools-3.1.0-r3.ebuild
27 new file mode 100644
28 index 000000000000..4cdea940512c
29 --- /dev/null
30 +++ b/net-misc/dahdi-tools/dahdi-tools-3.1.0-r3.ebuild
31 @@ -0,0 +1,70 @@
32 +# Copyright 1999-2022 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=7
36 +
37 +inherit autotools bash-completion-r1 perl-functions udev
38 +
39 +DESCRIPTION="Userspace tools to configure the kernel modules from net-misc/dahdi"
40 +HOMEPAGE="https://www.asterisk.org"
41 +SRC_URI="https://downloads.asterisk.org/pub/telephony/${PN}/releases/${P}.tar.gz"
42 +
43 +LICENSE="LGPL-2.1"
44 +SLOT="0"
45 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86"
46 +IUSE="ppp"
47 +PATCHES=(
48 + "${FILESDIR}/dahdi-nondigium-blacklist.patch"
49 + "${FILESDIR}/dahdi-tools-3.1.0-parallel-make-no-config.patch"
50 + "${FILESDIR}/dahdi-tools-3.1.0-fno-common.patch"
51 + "${FILESDIR}/dahdi-tools-3.1.0-execinfo.patch"
52 + "${FILESDIR}/dahdi-tools-3.1.0-cplusplusexternc.patch"
53 +)
54 +
55 +DEPEND="dev-libs/newt
56 + net-misc/dahdi
57 + sys-kernel/linux-headers
58 + virtual/libusb:0
59 + ppp? ( net-dialup/ppp:= )"
60 +RDEPEND="${DEPEND}
61 + dev-lang/perl:=
62 + dev-perl/CGI"
63 +BDEPEND="dev-lang/perl
64 + sys-apps/file"
65 +
66 +src_prepare() {
67 + default
68 + eautoreconf
69 +}
70 +
71 +src_configure() {
72 + econf $(use_with ppp) --with-perllib="$(perl_get_vendorlib)"
73 + sed -re 's/ -Werror($|[[:space:]])//' -i xpp/oct612x/Makefile.in || die "sed to eliminate -Werror failed."
74 + sed -re '/[[:space:]]*-Werror[[:space:]]*\\$/ d' -i xpp/xtalk/Makefile || die "sed to eliminate -Werror failed."
75 +}
76 +
77 +src_install() {
78 + local bashcompdir="$(get_bashcompdir)"
79 + local bashcmd bashcmdtarget
80 +
81 + emake DESTDIR="${ED}" bashcompdir="${bashcompdir}" udevrulesdir="$(get_udevdir)/rules.d" install
82 + emake DESTDIR="${ED}" install-config
83 +
84 + dosbin patgen pattest patlooptest hdlcstress hdlctest hdlcgen hdlcverify timertest
85 +
86 + # install init scripts
87 + newinitd "${FILESDIR}"/dahdi.init2 dahdi
88 + newinitd "${FILESDIR}"/dahdi-autoconf.init-3.1.0-r3 dahdi-autoconf
89 + newconfd "${FILESDIR}"/dahdi-autoconf.conf2 dahdi-autoconf
90 +
91 + bashcomp_alias dahdi $(sed -nre 's/^complete -F .* //p' "${ED}${bashcompdir}/dahdi" ||
92 + die "Error parsing dahdi bash completion file for commands")
93 +
94 + rm "${ED}"/usr/$(get_libdir)/libtonezone.a || die "Unable to remove static libs from install."
95 + # Delete *if* the libtool file exists, bug #778380
96 + find "${ED}" -name '*.la' -delete || die
97 +}
98 +
99 +pkg_postinst() {
100 + udev_reload
101 +}
102
103 diff --git a/net-misc/dahdi-tools/files/dahdi-autoconf.init-3.1.0-r3 b/net-misc/dahdi-tools/files/dahdi-autoconf.init-3.1.0-r3
104 new file mode 100644
105 index 000000000000..3841aca8d18a
106 --- /dev/null
107 +++ b/net-misc/dahdi-tools/files/dahdi-autoconf.init-3.1.0-r3
108 @@ -0,0 +1,271 @@
109 +#!/sbin/openrc-run
110 +# Copyright 1999-2011 Ultimate Linux Solutions CC
111 +# Distributed under the terms of the GNU General Public License v2
112 +
113 +depend() {
114 + before dahdi
115 +}
116 +
117 +dahdi_load_modules() {
118 + local hwlist loc status mod mod_vname pciid desc
119 +
120 + hwlist=$(/usr/sbin/dahdi_hardware)
121 +
122 + if [ -z "${hwlist}" ]; then
123 + einfo "No digium hardware found."
124 + ebegin "Loading module dahdi_dummy"
125 + /sbin/modprobe dahdi_dummy
126 + eend $?
127 + return
128 + fi
129 +
130 + echo "${hwlist}" | while read loc mod pciid desc; do
131 + status="${mod:${#mod}-1:1}"
132 + mod="${mod%[+-]}"
133 + mod_vname="mod_${mod}"
134 +
135 + einfo "Found $desc at $loc (module: $mod)"
136 +
137 + if [ "${status}" = "-" -a "${!mod_vname-notloaded}" = "notloaded" ]; then
138 + ebegin "Loading module $mod"
139 + /sbin/modprobe $mod
140 + eend
141 +
142 + [ $? -eq 0 ] && eval "$mod_vname=loaded"
143 + fi
144 + done
145 +}
146 +
147 +dahdi_module_unload() {
148 + local mod=$1 s
149 + [ -d /sys/module/${mod} ] || return 0
150 +
151 + for s in $(find /sys/module/${mod}/holders -type l); do
152 + dahdi_module_unload $(basename $s)
153 + done
154 +
155 + ebegin "Removing dahdi module: $mod"
156 + /sbin/rmmod $mod
157 + eend $?
158 +}
159 +
160 +dahdi_gen_fxo_config() {
161 + local port=$1
162 +
163 + echo "fxs${DAHDI_FXO_SIGNALLING-ks}=${port}"
164 + [ "${DAHDI_FXO_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${port}"
165 +}
166 +
167 +dahdi_gen_fxs_config() {
168 + local port=$1
169 +
170 + echo "fxo${DAHDI_FXO_SIGNALLING-ks}=${port}"
171 + [ "${DAHDI_FXS_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${port}"
172 +}
173 +
174 +dahdi_gen_bri_te_config() {
175 + span=$1
176 + port=$2
177 + basechan=$3
178 +
179 + echo "span=${span},${port},0,${DAHDI_BRI_FRAMING-CSS},${DAHDI_BRI_CODING-AMI}"
180 + echo "bchan=${basechan}-$(( basechan + 1 ))"
181 + echo "hardhdlc=$(( basechan + 2 ))"
182 + [ "${DAHDI_BRI_TE_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${basechan}-$(( basechan + 1 ))"
183 +}
184 +
185 +dahdi_gen_bri_nt_config() {
186 + span=$1
187 + port=$2
188 + basechan=$3
189 +
190 + echo "span=${span},0,0,${DAHDI_BRI_FRAMING-CSS},${DAHDI_BRI_CODING-AMI}"
191 + echo "bchan=${basechan}-$(( basechan + 1 ))"
192 + echo "hardhdlc=$(( basechan + 2 ))"
193 + [ "${DAHDI_BRI_NT_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${basechan}-$(( basechan + 1 ))"
194 +}
195 +
196 +dahdi_gen_e1_cpe_config() {
197 + span=$1
198 + port=$2
199 + basechan=$3
200 +
201 + echo "span=${span},${port},0,${DAHDI_E1_FRAMING-CCS},${DAHDI_E1_CODING-HDB3,CRC4}"
202 + bchans="${basechan}-$(( basechan + 14 )),$(( basechan + 16 ))-$(( basechan + 30 ))"
203 + echo "bchan=${bchans}"
204 + echo "dchan=$(( basechan + 15 ))"
205 + [ "${DAHDI_E1_CPE_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${bchans}"
206 +}
207 +
208 +dahdi_gen_e1_net_config() {
209 + span=$1
210 + port=$2
211 + basechan=$3
212 +
213 + echo "span=${span},0,0,${DAHDI_E1_FRAMING-CCS},${DAHDI_E1_CODING-HDB3,CRC4}"
214 + bchans="${basechan}-$(( basechan + 14 )),$(( basechan + 16 ))-$(( basechan + 30 ))"
215 + echo "bchan=${bchans}"
216 + echo "dchan=$(( basechan + 15 ))"
217 + [ "${DAHDI_E1_NET_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${bchans}"
218 +}
219 +
220 +dahdi_gen_t1_cpe_config() {
221 + span=$1
222 + port=$2
223 + basechan=$3
224 +
225 + echo "span=${span},${port},0,${DAHDI_T1_FRAMING-ESF},${DAHDI_T1_CODING-B8ZS}"
226 + bchans="${basechan}-$(( basechan + 22 ))"
227 + echo "bchan=${bchans}"
228 + echo "dchan=$(( basechan + 23 ))"
229 + [ "${DAHDI_T1_CPE_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${bchans}"
230 +}
231 +
232 +dahdi_gen_t1_net_config() {
233 + span=$1
234 + port=$2
235 + basechan=$3
236 +
237 + echo "span=${span},0,0,${DAHDI_T1_FRAMING-ESF},${DAHDI_T1_CODING-B8ZS}"
238 + bchans="${basechan}-$(( basechan + 22 ))"
239 + echo "bchan=${bchans}"
240 + echo "dchan=$(( basechan + 23 ))"
241 + [ "${DAHDI_T1_NET_ECHOCAN-yes}" = yes ] && echo "echocanceller=${DAHDI_ECHOCAN-mg2},${bchans}"
242 +}
243 +
244 +dahdi_conf_span() {
245 + local span=$1
246 + local type=$2
247 + local desc=$3
248 + local port=$4
249 + local basechan=$5
250 + local vname="PRI_SPAN_${span}_NET"
251 + local cfunc="dahdi_gen_"
252 +
253 + # Analog we need to deal with on a port-by-port basis.
254 + [ "${type}" = "analog" ] && return 0
255 +
256 + echo ""
257 + echo "# ${desc}"
258 +
259 + case "${type}" in
260 + digital-TE)
261 + cfunc+="bri_te"
262 + ;;
263 + digital-NT)
264 + cfunc+="bri_nt"
265 + ;;
266 + digital-[TE]1)
267 + cfunc+="$(echo "${type##*-}" | tr 'TE' 'te')"
268 + # Use CPE by default. Unfortunately there is no easy
269 + # way to detect CPE vs NET as far as I know and specifying
270 + # in a config that you want NET mode seems the sanest way.
271 + if yesno "${vname}"; then
272 + cfunc+="_net"
273 + else
274 + cfunc+="_cpe"
275 + fi
276 + ;;
277 + *)
278 + echo "# Don't know how to configure this (type=${type})."
279 + echo "# Please file a bug on bugs.gentoo.org and add jaco@××××××.za as CC."
280 + return 1
281 + ;;
282 + esac
283 +
284 + "${cfunc}_config" "${span}" "${port}" "${basechan}"
285 +}
286 +
287 +dahdi_gen_config() {
288 + local type manufacturer devicetype basechan aport atype
289 + local span=
290 + local tfile="$(mktemp)"
291 + local sfile="$(mktemp)"
292 + local plocation=""
293 + local isdnport=0
294 +
295 + /usr/sbin/dahdi_scan > "${sfile}"
296 + exec 3<"${sfile}"
297 + exec 4>"${tfile}"
298 +
299 + echo "# Automatically dahdi-autoconf generated file ($(date))." >&4
300 + echo "# This file WILL get regenerated whenever you restart dahdi-autoconf." >&4
301 +
302 + while read LINE <&3; do
303 + case "$LINE" in
304 + \[*\])
305 + if [ -n "${span}" ]; then
306 + ebegin "Configuring ${manufacturer} ${devicetype} (${name})"
307 + dahdi_conf_span "${span}" "${type}" "${manufacturer} ${devicetype} (${name})" "${isdnport}" "${basechan}" >&4
308 + eend $?
309 + fi
310 + span="${LINE%?}"
311 + span="${span#?}"
312 + ;;
313 + type=*|manufacturer=*|devicetype=*|basechan=*|name=*)
314 + eval "${LINE%%=*}='${LINE#*=}'"
315 + ;;
316 + location=*)
317 + eval "${LINE%%=*}='${LINE#*=}'"
318 + if [ "${location}" = "${plocation}" ]; then
319 + isdnport=$(( isdnport + 1 ))
320 + else
321 + plocation="${location}"
322 + isdnport=1
323 + fi
324 + ;;
325 + port=*)
326 + # For analog cards only.
327 + aport="${LINE#*=}"; aport="${aport%,*}"
328 + atype="${LINE#*,}"
329 + if [ "${aport}" -eq "${basechan}" ]; then
330 + echo "" >&4
331 + echo "# ${manufacturer} ${devicetype} (${name})" >&4
332 + fi
333 + case "${atype}" in
334 + FXO)
335 + dahdi_gen_fxo_config $aport >&4
336 + ;;
337 + FXS)
338 + dahdi_gen_fxs_config $aport >&4
339 + ;;
340 + esac
341 + ;;
342 + esac
343 + done
344 +
345 + if [ -n "${span}" ]; then
346 + ebegin "Configuring ${manufacturer} ${devicetype} (${name})"
347 + dahdi_conf_span "${span}" "${type}" "${manufacturer} ${devicetype} (${name})" "${isdnport}" "${basechan}" >&4
348 + eend $?
349 + fi
350 +
351 + echo "" >&4
352 + echo "loadzone = ${DAHDI_ZONE}" >&4
353 + echo "defaultzone = ${DAHDI_ZONE}" >&4
354 + echo "## END OF AUTOCONFIGURED FILE ##" >&4
355 +
356 + exec 3<&-
357 + exec 4<&-
358 +
359 + rm -f "${sfile}"
360 + [ -r /etc/dahdi/system.conf ] && mv /etc/dahdi/system.conf /etc/dahdi/system.conf.bck
361 + mv "${tfile}" /etc/dahdi/system.conf
362 +}
363 +
364 +start() {
365 + dahdi_load_modules
366 +
367 + if [ ! -r /dev/dahdi/ctl ]; then
368 + eerror "No DAHDI compatible cards detected."
369 + return 1
370 + fi
371 +
372 + ebegin "Generating DAHDI Configuration"
373 + dahdi_gen_config
374 + eend $?
375 +}
376 +
377 +stop() {
378 + dahdi_module_unload dahdi
379 +}