Gentoo Archives: gentoo-commits

From: Matt Thode <prometheanfire@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-power/nut/
Date: Fri, 08 Dec 2017 22:34:25
Message-Id: 1512772445.5946428c15a6940b0c2a11568c944753fab199c5.prometheanfire@gentoo
1 commit: 5946428c15a6940b0c2a11568c944753fab199c5
2 Author: Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
3 AuthorDate: Fri Dec 8 22:32:53 2017 +0000
4 Commit: Matt Thode <prometheanfire <AT> gentoo <DOT> org>
5 CommitDate: Fri Dec 8 22:34:05 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5946428c
7
8 sys-power/nut: fix missing dep for nut-scanner
9
10 Package-Manager: Portage-2.3.14, Repoman-2.3.6
11
12 sys-power/nut/Manifest | 2 +-
13 sys-power/nut/nut-2.7.4-r1.ebuild | 270 ++++++++++++++++++++++++++++++++++++++
14 2 files changed, 271 insertions(+), 1 deletion(-)
15
16 diff --git a/sys-power/nut/Manifest b/sys-power/nut/Manifest
17 index 104a2ea4747..eff76750888 100644
18 --- a/sys-power/nut/Manifest
19 +++ b/sys-power/nut/Manifest
20 @@ -1,4 +1,4 @@
21 DIST nut-2.6.5.tar.gz 2038832 SHA256 618df71cf1ca6e3700d1d3c282773a2dec85f9f20324c0d3234c824e97feb93f SHA512 f1c76e6280057dc558d53451e7de2bdc7f37a0f175b1c52c27e7dcb83deeb78f6885007ad188a7a3a19e411eba87e03eb2246310bd7a5a5bb6fa3ad2bebd49d8 WHIRLPOOL 2b189f77d18d26303c60f2c084796075b0a50b8aa9cbefc3ba9a83f037450ffc3ecdb289367435e784a6bbe8569f768a97130a1ccdf123e53f13e0cf8813fb9a
22 DIST nut-2.7.2.tar.gz 2223307 SHA256 4d5365359b059d96dfcb77458f361a114d26c84f1297ffcd0c6c166f7200376d SHA512 7d6b44e8f2d03544d9825274f4f3039911e335eb51620ded3dc08d51aeb096281c2ec848831815c54eecd4f2a25bdb1e6e5f479422e5291f03c3055da7ba52e6 WHIRLPOOL 6e7c45ef09fc2e86f0b79787043a9bf9954b5ef57fb16f9d453734680ff947abd8fb6665c5da4dac09850f5ab6a414039aa067803ecdeb2efd8537b8909f1ff9
23 -DIST nut-2.7.3.tar.gz 2317478 SHA256 ff44d95d06a51559a0a018eef7f8d17911c1002b6352a7d7580ff75acb12126b SHA512 3dd978712dc0fabe7e194dbf6d7bb442c456aa4d45bfc63ede8a3acae23c66811cbcf2705b55a6739129b5f120e6f5865bcb9d19eb9080507a85e2624d5663d6 WHIRLPOOL d9fe0c6545808a7daa25c45bd4f43fba1071cec0fd668d66b7926b6cd7af55e0d8c937bcdbb41e693f977c960c4e2ea95ff40d35b5f68695da5a7d1fc8da7265
24 +DIST nut-2.7.3.tar.gz 2317478 BLAKE2B 1a795e1c545894e14c5b0d3ac49a82d399af1c3e82cda60d74f855609dcc71f4970c087be5759ee5d25e6c756b6dd2b4a8d80ee28c0f84feb358a1df08648dab SHA512 3dd978712dc0fabe7e194dbf6d7bb442c456aa4d45bfc63ede8a3acae23c66811cbcf2705b55a6739129b5f120e6f5865bcb9d19eb9080507a85e2624d5663d6
25 DIST nut-2.7.4.tar.gz 2509831 SHA256 980e82918c52d364605c0703a5dcf01f74ad2ef06e3d365949e43b7d406d25a7 SHA512 320c4aff85d8a370c5eff77d33924fdfc3caf6a250620693cdd5bf3336b3a80d8a207488eee841bcf8b72fbad68fda4c074e63b99c56e7886716fc934122d11a WHIRLPOOL 79b2ad8d2bc1211ba67bb24fec77b61e93b62d3854d5fd908083ff061bcc247abbda8dbf27259d1c38fb6fbeeaf8db65c620b8b3fc4029f14c03b12855925178
26
27 diff --git a/sys-power/nut/nut-2.7.4-r1.ebuild b/sys-power/nut/nut-2.7.4-r1.ebuild
28 new file mode 100644
29 index 00000000000..b12e97c160e
30 --- /dev/null
31 +++ b/sys-power/nut/nut-2.7.4-r1.ebuild
32 @@ -0,0 +1,270 @@
33 +# Copyright 1999-2017 Gentoo Foundation
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=5
37 +inherit autotools bash-completion-r1 eutils fixheadtails multilib user systemd flag-o-matic toolchain-funcs
38 +
39 +MY_P=${P/_/-}
40 +
41 +DESCRIPTION="Network-UPS Tools"
42 +HOMEPAGE="http://www.networkupstools.org/"
43 +# Nut mirrors are presently broken
44 +SRC_URI="http://random.networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz
45 + http://www.networkupstools.org/source/${PV%.*}/${MY_P}.tar.gz"
46 +
47 +LICENSE="GPL-2"
48 +SLOT="0"
49 +KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~x86-fbsd"
50 +
51 +IUSE="cgi ipmi snmp +usb selinux ssl tcpd xml zeroconf"
52 +CDEPEND="
53 + cgi? ( >=media-libs/gd-2[png] )
54 + snmp? ( net-analyzer/net-snmp )
55 + usb? ( virtual/libusb:0 )
56 + ssl? ( >=dev-libs/openssl-1 )
57 + tcpd? ( sys-apps/tcp-wrappers )
58 + xml? ( >=net-libs/neon-0.25.0 )
59 + ipmi? ( sys-libs/freeipmi )
60 + zeroconf? ( net-dns/avahi )
61 + dev-libs/libltdl
62 + virtual/udev"
63 +DEPEND="$CDEPEND
64 + >=sys-apps/sed-4
65 + virtual/pkgconfig"
66 +RDEPEND="${CDEPEND}
67 + selinux? ( sec-policy/selinux-nut )
68 +"
69 +
70 +S=${WORKDIR}/${MY_P}
71 +
72 +# Bug #480664 requested UPS_DRIVERS_IUSE for more flexibility in building this package
73 +SERIAL_DRIVERLIST="al175 bcmxcp belkin belkinunv bestfcom bestfortress bestuferrups bestups dummy-ups etapro everups gamatronic genericups isbmex liebert liebert-esp2 masterguard metasys oldmge-shut mge-utalk microdowell mge-shut oneac optiups powercom rhino safenet solis tripplite tripplitesu upscode2 victronups powerpanel blazer_ser clone clone-outlet ivtscd apcsmart apcsmart-old apcupsd-ups riello_ser nutdrv_qx"
74 +SNMP_DRIVERLIST="snmp-ups"
75 +USB_LIBUSB_DRIVERLIST="usbhid-ups bcmxcp_usb tripplite_usb blazer_usb richcomm_usb riello_usb nutdrv_qx"
76 +USB_DRIVERLIST=${USB_LIBUSB_DRIVERLIST}
77 +#HAL_DRIVERLIST="usbhid-ups bcmxcp_usb tripplite_usb blazer_usb riello_usb nutdrv_qx"
78 +NEONXML_DRIVERLIST="netxml-ups"
79 +IPMI_DRIVERLIST="nut-ipmipsu"
80 +# Now we build from it:
81 +for name in ${SERIAL_DRIVERLIST} ; do
82 + IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} +ups_drivers_${name}"
83 +done
84 +for name in ${USB_DRIVERLIST} ; do
85 + IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} +ups_drivers_${name}"
86 + REQUIRED_USE="${REQUIRED_USE} ups_drivers_${name}? ( usb )"
87 +done
88 +for name in ${NEONXML_DRIVERLIST}; do
89 + IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} ups_drivers_${name}"
90 + REQUIRED_USE="${REQUIRED_USE} ups_drivers_${name}? ( xml )"
91 +done
92 +for name in ${SNMP_DRIVERLIST} ; do
93 + IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} ups_drivers_${name}"
94 + REQUIRED_USE="${REQUIRED_USE} ups_drivers_${name}? ( snmp )"
95 +done
96 +for name in ${IPMI_DRIVERLIST} ; do
97 + IUSE_UPS_DRIVERS="${IUSE_UPS_DRIVERS} ups_drivers_${name}"
98 + REQUIRED_USE="${REQUIRED_USE} ups_drivers_${name}? ( ipmi )"
99 +done
100 +IUSE="${IUSE} ${IUSE_UPS_DRIVERS}"
101 +
102 +# public files should be 644 root:root
103 +NUT_PUBLIC_FILES="/etc/nut/{ups,upssched}.conf"
104 +# private files should be 640 root:nut - readable by nut, writeable by root,
105 +NUT_PRIVATE_FILES="/etc/nut/{upsd.conf,upsd.users,upsmon.conf}"
106 +# public files should be 644 root:root, only installed if USE=cgi
107 +NUT_CGI_FILES="/etc/nut/{{hosts,upsset}.conf,upsstats{,-single}.html}"
108 +
109 +pkg_setup() {
110 + enewgroup nut 84
111 + enewuser nut 84 -1 /var/lib/nut nut,uucp
112 + # As of udev-104, NUT must be in uucp and NOT in tty.
113 + gpasswd -d nut tty 2>/dev/null
114 + gpasswd -a nut uucp 2>/dev/null
115 + # in some cases on old systems it wasn't in the nut group either!
116 + gpasswd -a nut nut 2>/dev/null
117 + warningmsg ewarn
118 +}
119 +
120 +src_prepare() {
121 + #ht_fix_file configure.in
122 +
123 + epatch "${FILESDIR}/nut-2.7.2/nut-2.7.2-no-libdummy.patch"
124 + epatch "${FILESDIR}"/${PN}-2.6.2-lowspeed-buffer-size.patch
125 + #epatch "${FILESDIR}"/${PN}-2.6.3-CVE-2012-2944.patch
126 + #epatch "${FILESDIR}"/${PN}-2.6.5-freeipmi_fru.patch
127 + #epatch "${FILESDIR}"/${PN}-2.7.1-fix-scanning.patch
128 + epatch "${FILESDIR}"/${PN}-2.7.1-snmpusb-order.patch
129 +
130 + sed -e "s:GD_LIBS.*=.*-L/usr/X11R6/lib \(.*\) -lXpm -lX11:GD_LIBS=\"\1:" \
131 + -e '/systemdsystemunitdir=.*echo.*sed.*libdir/s,^,#,g' \
132 + -i configure.ac || die
133 +
134 + sed -e "s:52.nut-usbups.rules:70-nut-usbups.rules:" \
135 + -i scripts/udev/Makefile.am || die
136 +
137 + rm -f ltmain.sh m4/lt* m4/libtool.m4
138 +
139 + sed -i \
140 + -e 's:@LIBSSL_LDFLAGS@:@LIBSSL_LIBS@:' \
141 + lib/libupsclient{.pc,-config}.in || die #361685
142 +
143 + eautoreconf
144 +}
145 +
146 +src_configure() {
147 + local myconf
148 + append-flags -fno-lto
149 + tc-export CC
150 + tc-export CXX
151 + tc-export AR
152 +
153 + local UPS_DRIVERS=""
154 + for u in $USE ; do
155 + u2=${u#ups_drivers_}
156 + [[ "${u}" != "${u2}" ]] && UPS_DRIVERS="${UPS_DRIVERS} ${u2}"
157 + done
158 + UPS_DRIVERS="${UPS_DRIVERS# }" UPS_DRIVERS="${UPS_DRIVERS% }"
159 + myconf="${myconf} --with-drivers=${UPS_DRIVERS// /,}"
160 +
161 + use cgi && myconf="${myconf} --with-cgipath=/usr/share/nut/cgi"
162 +
163 + # TODO: USE flag for sys-power/powerman
164 + econf \
165 + --sysconfdir=/etc/nut \
166 + --datarootdir=/usr/share/nut \
167 + --datadir=/usr/share/nut \
168 + --disable-static \
169 + --with-statepath=/var/lib/nut \
170 + --with-drvpath=/$(get_libdir)/nut \
171 + --with-htmlpath=/usr/share/nut/html \
172 + --with-user=nut \
173 + --with-group=nut \
174 + --with-logfacility=LOG_DAEMON \
175 + --with-dev \
176 + --with-serial \
177 + --without-powerman \
178 + $(use_with cgi) \
179 + $(use_with ipmi) \
180 + $(use_with ipmi freeipmi) \
181 + $(use_with snmp) \
182 + $(use_with ssl) \
183 + $(use_with tcpd wrap) \
184 + $(use_with usb) \
185 + $(use_with xml neon) \
186 + $(use_with zeroconf avahi) \
187 + $(systemd_with_unitdir) \
188 + ${myconf}
189 +}
190 +
191 +src_install() {
192 + emake DESTDIR="${D}" install || die
193 +
194 + find "${D}" -name '*.la' -exec rm -f {} +
195 +
196 + dodir /sbin
197 + dosym /usr/sbin/upsdrvctl /sbin/upsdrvctl
198 +
199 + if use cgi; then
200 + elog "CGI monitoring scripts are installed in /usr/share/nut/cgi."
201 + elog "copy them to your web server's ScriptPath to activate (this is a"
202 + elog "change from the old location)."
203 + elog "If you use lighttpd, see lighttpd_nut.conf in the documentation."
204 + fi
205 +
206 + # this must be done after all of the install phases
207 + for i in "${D}"/etc/nut/*.sample ; do
208 + mv "${i}" "${i/.sample/}"
209 + done
210 +
211 + dodoc AUTHORS ChangeLog docs/*.txt MAINTAINERS NEWS README TODO UPGRADING || die
212 +
213 + newdoc lib/README README.lib || die
214 + newdoc "${FILESDIR}"/lighttpd_nut.conf-2.2.0 lighttpd_nut.conf || die
215 +
216 + docinto cables
217 + dodoc docs/cables/* || die
218 +
219 + newinitd "${FILESDIR}"/nut-2.6.5-init.d-upsd upsd || die
220 + newinitd "${FILESDIR}"/nut-2.2.2-init.d-upsdrv upsdrv || die
221 + newinitd "${FILESDIR}"/nut-2.6.5-init.d-upsmon upsmon || die
222 + newinitd "${FILESDIR}"/nut-2.6.5-init.d-upslog upslog || die
223 + newinitd "${FILESDIR}"/nut.powerfail.initd nut.powerfail || die
224 +
225 + keepdir /var/lib/nut
226 +
227 + einfo "Setting up permissions on files and directories"
228 + fperms 0700 /var/lib/nut
229 + fowners nut:nut /var/lib/nut
230 +
231 + # Do not remove eval here, because the variables contain shell expansions.
232 + eval fperms 0640 ${NUT_PRIVATE_FILES}
233 + eval fowners root:nut ${NUT_PRIVATE_FILES}
234 +
235 + # Do not remove eval here, because the variables contain shell expansions.
236 + eval fperms 0644 ${NUT_PUBLIC_FILES}
237 + eval fowners root:root ${NUT_PUBLIC_FILES}
238 +
239 + # Do not remove eval here, because the variables contain shell expansions.
240 + if use cgi; then
241 + eval fperms 0644 ${NUT_CGI_FILES}
242 + eval fowners root:root ${NUT_CGI_FILES}
243 + fi
244 +
245 + # this is installed for 2.4 and fbsd guys
246 + if ! has_version virtual/udev; then
247 + einfo "Installing non-udev hotplug support"
248 + insinto /etc/hotplug/usb
249 + insopts -m 755
250 + doins scripts/hotplug/nut-usbups.hotplug
251 + fi
252 +
253 + dobashcomp "${S}"/scripts/misc/nut.bash_completion
254 +}
255 +
256 +pkg_postinst() {
257 + # this is to ensure that everybody that installed old versions still has
258 + # correct permissions
259 +
260 + chown nut:nut "${ROOT}"/var/lib/nut 2>/dev/null
261 + chmod 0700 "${ROOT}"/var/lib/nut 2>/dev/null
262 +
263 + # Do not remove eval here, because the variables contain shell expansions.
264 + eval chown root:nut "${ROOT}"${NUT_PRIVATE_FILES} 2>/dev/null
265 + eval chmod 0640 "${ROOT}"${NUT_PRIVATE_FILES} 2>/dev/null
266 +
267 + # Do not remove eval here, because the variables contain shell expansions.
268 + eval chown root:root "${ROOT}"${NUT_PUBLIC_FILES} 2>/dev/null
269 + eval chmod 0644 "${ROOT}"${NUT_PUBLIC_FILES} 2>/dev/null
270 +
271 + # Do not remove eval here, because the variables contain shell expansions.
272 + if use cgi; then
273 + eval chown root:root "${ROOT}"${NUT_CGI_FILES} 2>/dev/null
274 + eval chmod 0644 "${ROOT}"${NUT_CGI_FILES} 2>/dev/null
275 + fi
276 +
277 + warningmsg elog
278 +}
279 +
280 +warningmsg() {
281 + msgfunc="$1"
282 + [ -z "$msgfunc" ] && die "msgfunc not specified in call to warningmsg!"
283 + ${msgfunc} "Please note that NUT now runs under the 'nut' user."
284 + ${msgfunc} "NUT is in the uucp group for access to RS-232 UPS."
285 + ${msgfunc} "However if you use a USB UPS you may need to look at the udev or"
286 + ${msgfunc} "hotplug rules that are installed, and alter them suitably."
287 + ${msgfunc} ''
288 + ${msgfunc} "You are strongly advised to read the UPGRADING file provided by upstream."
289 + ${msgfunc} ''
290 + ${msgfunc} "Please note that upsdrv is NOT automatically started by upsd anymore."
291 + ${msgfunc} "If you have multiple UPS units, you can use their NUT names to"
292 + ${msgfunc} "have a service per UPS:"
293 + ${msgfunc} "ln -s /etc/init.d/upsdrv /etc/init.d/upsdrv.\$UPSNAME"
294 + ${msgfunc} ''
295 + ${msgfunc} 'If you want apcupsd to power off your UPS when it'
296 + ${msgfunc} 'shuts down your system in a power failure, you must'
297 + ${msgfunc} 'add nut.powerfail to your shutdown runlevel:'
298 + ${msgfunc} ''
299 + ${msgfunc} 'rc-update add nut.powerfail shutdown'
300 + ${msgfunc} ''
301 +
302 +}