Gentoo Archives: gentoo-commits

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