Gentoo Archives: gentoo-commits

From: Aric Belsito <lluixhi@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/musl:master commit in: sys-apps/pciutils/files/, sys-apps/pciutils/
Date: Mon, 02 Jul 2018 18:28:06
Message-Id: 1530556050.fc162ea0dc49426a8a3db756b8f0183435d20c1c.lluixhi@gentoo
1 commit: fc162ea0dc49426a8a3db756b8f0183435d20c1c
2 Author: Aric Belsito <lluixhi <AT> gmail <DOT> com>
3 AuthorDate: Mon Jul 2 18:27:30 2018 +0000
4 Commit: Aric Belsito <lluixhi <AT> gmail <DOT> com>
5 CommitDate: Mon Jul 2 18:27:30 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=fc162ea0
7
8 sys-apps/pciutils: add latest version
9
10 needs a patch for canonicalize_file_name
11
12 sys-apps/pciutils/Manifest | 1 +
13 sys-apps/pciutils/files/conf.d-pciparm | 28 +++++
14 sys-apps/pciutils/files/init.d-pciparm | 79 ++++++++++++++
15 .../pciutils/files/pciutils-3.1.9-static-pc.patch | 13 +++
16 .../pciutils/files/pciutils-3.6.0-realpath.patch | 12 ++
17 sys-apps/pciutils/metadata.xml | 13 +++
18 sys-apps/pciutils/pciutils-3.6.0.ebuild | 121 +++++++++++++++++++++
19 7 files changed, 267 insertions(+)
20
21 diff --git a/sys-apps/pciutils/Manifest b/sys-apps/pciutils/Manifest
22 new file mode 100644
23 index 0000000..7dc8d96
24 --- /dev/null
25 +++ b/sys-apps/pciutils/Manifest
26 @@ -0,0 +1 @@
27 +DIST pciutils-3.6.0.tar.gz 454912 BLAKE2B 1f37307ba21085d5f49dd908781ce34dff98a1e4d818158800a1fbdc1fc689e1b868ee9c762378a8cd28ab17cbaaf1e9255da94c44029bfa2f4a8b5d9fd4b273 SHA512 e59cb5685f1dee2673368c90fdf1f5b7689de9fa45f249ce472258f278288da7a81644c76d1ecb7cc857f8029d3d70c367fe62190caf55328143b51017cc5c6f
28
29 diff --git a/sys-apps/pciutils/files/conf.d-pciparm b/sys-apps/pciutils/files/conf.d-pciparm
30 new file mode 100644
31 index 0000000..f036b15
32 --- /dev/null
33 +++ b/sys-apps/pciutils/files/conf.d-pciparm
34 @@ -0,0 +1,28 @@
35 +# PCI tweaking article:
36 +# http://www.gentoo.org/doc/en/articles/hardware-stability-p2.xml
37 +#
38 +# Apply to all devices:
39 +# PCIPARM_ALL="...."
40 +# Cards also can be addressed by vid:pid or by bus:slot.func
41 +# (see setpci man page relative to -d and -s options)
42 +# PCIPARM_(BUS|VENDOR)_#="...."
43 +# Where # is sequentially numbered from zero.
44 +
45 +# Examples:
46 +# "open up" the PCI bus by allowing fairly long bursts
47 +# for all devices, increasing performance
48 +# (equivalent to: setpci -v -d *:* latency_timer=b0)
49 +#PCIPARM_ALL="latency_timer=b0"
50 +
51 +# maximize latency timers for network and audio,
52 +# allowing them to transmit more data per burst,
53 +# preventing buffer over/under-run conditions
54 +#PCIPARM_BUS_0="00:04.0 latency_timer=ff"
55 +#PCIPARM_BUS_1="01:04.0 latency_timer=ff"
56 +#PCIPARM_VENDOR_0="1057:3410 latency_timer=ff"
57 +
58 +# -v : whether to be verbose about changes
59 +# -D : dry-run, no commit
60 +# -f : do not warn if the change is already set
61 +# (see the setpci manpage for more advanced options)
62 +SETPCI_OPT="-f"
63
64 diff --git a/sys-apps/pciutils/files/init.d-pciparm b/sys-apps/pciutils/files/init.d-pciparm
65 new file mode 100644
66 index 0000000..734ca99
67 --- /dev/null
68 +++ b/sys-apps/pciutils/files/init.d-pciparm
69 @@ -0,0 +1,79 @@
70 +#!/sbin/openrc-run
71 +# Copyright 1999-2004 Gentoo Foundation
72 +# Distributed under the terms of the GNU General Public License v2
73 +
74 +depend() {
75 + before bootmisc hdparm
76 + after localmount
77 +}
78 +
79 +checkconfig() {
80 + if [ ! -f /etc/conf.d/pciparm ]; then
81 + ewarn "/etc/conf.d/pciparm does not exist, skipping"
82 + return 1
83 + fi
84 +
85 + if [ -z "${PCIPARM_ALL}" -a -z "${PCIPARM_BUS_0}" -a -z "${PCIPARM_VENDOR_0}" ]; then
86 + ewarn "None of PCIPARM_ALL, PCIPARM_BUS_* or PCIPARM_VENDOR_* set in /etc/conf.d/pciparm"
87 + return 1
88 + fi
89 +}
90 +
91 +do_setpci() {
92 + #ewarn "do_setpci: /usr/sbin/setpci $SETPCI_OPT $@"
93 + SWITCH=$1
94 + SPEC_ID=$2
95 + shift 2
96 + case "$SWITCH" in
97 + -d) DESC=vendor ;;
98 + -s) DESC=bus ;;
99 + *) eerror "Unknown setpci type: $SWITCH" ; return 1 ;;
100 + esac
101 +
102 + if [ -z "$SPEC_ID" ]; then
103 + eerror "Missing device specifier!"
104 + return 1
105 + fi
106 + if [ -z "$*" ]; then
107 + eerror "Missing configuration to set for ($DESC) $SPEC_ID!"
108 + return 1
109 + fi
110 +
111 + ebegin "Setting PCI params for ($DESC) $SPEC_ID to $@"
112 + /usr/sbin/setpci $SETPCI_OPT $SWITCH $SPEC_ID "$@"
113 + rc=$?
114 + eend $rc
115 + return $rc
116 +}
117 +
118 +do_setpci_array() {
119 + name=$1
120 + shift
121 + i=0
122 + while true; do
123 + eval opt="\$${name}_$i"
124 + # End of loop
125 + [ -z "${opt}" ] && break
126 + # Pass in all other parameters here, in case we want to use multiple
127 + # arguments later.
128 + do_setpci "$@" $opt #|| return 1
129 + i=$(($i+1))
130 + done
131 +}
132 +
133 +start() {
134 + if get_bootparam "nopciparm" ; then
135 + ewarn "Skipping pciparm init as requested in kernel cmdline"
136 + return 0
137 + fi
138 +
139 + checkconfig || return 1
140 +
141 + # We do not exit after any errors presently, because it might be a
142 + # stability-related fix after a failure.
143 + [ -n "$PCIPARM_ALL" ] && \
144 + do_setpci -d '*:*' $PCIPARM_ALL #|| return 1
145 +
146 + do_setpci_array PCIPARM_BUS -s #|| return 1
147 + do_setpci_array PCIPARM_VENDOR -d #|| return 1
148 +}
149
150 diff --git a/sys-apps/pciutils/files/pciutils-3.1.9-static-pc.patch b/sys-apps/pciutils/files/pciutils-3.1.9-static-pc.patch
151 new file mode 100644
152 index 0000000..9e63b7e
153 --- /dev/null
154 +++ b/sys-apps/pciutils/files/pciutils-3.1.9-static-pc.patch
155 @@ -0,0 +1,13 @@
156 +make sure all lib entries get into libs.private in the .pc file
157 +
158 +--- a/lib/Makefile
159 ++++ b/lib/Makefile
160 +@@ -61,7 +61,7 @@ $(PCILIBPC): libpci.pc.in
161 + -e 's,@LIBDIR@,$(LIBDIR),' \
162 + -e 's,@IDSDIR@,$(IDSDIR),' \
163 + -e 's,@VERSION@,$(VERSION),' \
164 +- -e 's,@LDLIBS@,$(LDLIBS),'
165 ++ -e 's,@LDLIBS@,$(LDLIBS) $(LIB_LDLIBS),'
166 +
167 + init.o: init.c $(INCL)
168 + access.o: access.c $(INCL)
169
170 diff --git a/sys-apps/pciutils/files/pciutils-3.6.0-realpath.patch b/sys-apps/pciutils/files/pciutils-3.6.0-realpath.patch
171 new file mode 100644
172 index 0000000..b8c64b7
173 --- /dev/null
174 +++ b/sys-apps/pciutils/files/pciutils-3.6.0-realpath.patch
175 @@ -0,0 +1,12 @@
176 +diff -Naur pciutils-3.6.0.orig/lib/sysfs.c pciutils-3.6.0/lib/sysfs.c
177 +--- pciutils-3.6.0.orig/lib/sysfs.c 2018-07-02 11:24:47.874595946 -0700
178 ++++ pciutils-3.6.0/lib/sysfs.c 2018-07-02 11:25:30.453595183 -0700
179 +@@ -133,7 +133,7 @@
180 + sysfs_obj_name(d, "", path);
181 + strcat(path, rel_path);
182 +
183 +- return canonicalize_file_name(path);
184 ++ return realpath(path, NULL);
185 + }
186 +
187 + static int
188
189 diff --git a/sys-apps/pciutils/metadata.xml b/sys-apps/pciutils/metadata.xml
190 new file mode 100644
191 index 0000000..739960f
192 --- /dev/null
193 +++ b/sys-apps/pciutils/metadata.xml
194 @@ -0,0 +1,13 @@
195 +<?xml version="1.0" encoding="UTF-8"?>
196 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
197 +<pkgmetadata>
198 +<maintainer type="project">
199 + <email>base-system@g.o</email>
200 + <name>Gentoo Base System</name>
201 +</maintainer>
202 +<use>
203 + <flag name="dns">Enable support for querying the central database of PCI IDs using DNS</flag>
204 + <flag name="kmod">Enable <pkg>sys-apps/kmod</pkg> support for the -k switch in lspci command</flag>
205 + <flag name="zlib">Support compressed pci.ids database</flag>
206 +</use>
207 +</pkgmetadata>
208
209 diff --git a/sys-apps/pciutils/pciutils-3.6.0.ebuild b/sys-apps/pciutils/pciutils-3.6.0.ebuild
210 new file mode 100644
211 index 0000000..5ef1a52
212 --- /dev/null
213 +++ b/sys-apps/pciutils/pciutils-3.6.0.ebuild
214 @@ -0,0 +1,121 @@
215 +# Copyright 1999-2018 Gentoo Foundation
216 +# Distributed under the terms of the GNU General Public License v2
217 +
218 +EAPI=6
219 +
220 +inherit multilib toolchain-funcs multilib-minimal flag-o-matic
221 +
222 +DESCRIPTION="Various utilities dealing with the PCI bus"
223 +HOMEPAGE="http://mj.ucw.cz/sw/pciutils/ https://git.kernel.org/?p=utils/pciutils/pciutils.git"
224 +SRC_URI="ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci/${P}.tar.gz"
225 +
226 +LICENSE="GPL-2"
227 +SLOT="0"
228 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux"
229 +IUSE="dns +kmod static-libs +udev zlib"
230 +
231 +# Have the sub-libs in RDEPEND with [static-libs] since, logically,
232 +# our libpci.a depends on libz.a/etc... at runtime.
233 +LIB_DEPEND="
234 + zlib? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+),${MULTILIB_USEDEP}] )
235 + udev? ( >=virtual/libudev-208[static-libs(+),${MULTILIB_USEDEP}] )
236 +"
237 +DEPEND="
238 + kmod? ( sys-apps/kmod )
239 + static-libs? ( ${LIB_DEPEND} )
240 + !static-libs? ( ${LIB_DEPEND//static-libs(+),} )
241 +"
242 +RDEPEND="
243 + ${DEPEND}
244 + sys-apps/hwids
245 +"
246 +DEPEND="
247 + ${DEPEND}
248 + kmod? ( virtual/pkgconfig )
249 +"
250 +
251 +PATCHES=(
252 + "${FILESDIR}"/${PN}-3.1.9-static-pc.patch
253 + "${FILESDIR}"/${PN}-3.6.0-realpath.patch
254 +)
255 +
256 +MULTILIB_WRAPPED_HEADERS=( /usr/include/pci/config.h )
257 +
258 +switch_config() {
259 + [[ $# -ne 2 ]] && return 1
260 + local opt=$1 val=$2
261 +
262 + sed "s@^\(${opt}=\).*\$@\1${val}@" -i Makefile || die
263 + return 0
264 +}
265 +
266 +src_prepare() {
267 + default
268 +
269 + if use static-libs ; then
270 + cp -pPR "${S}" "${S}.static" || die
271 + mv "${S}.static" "${S}/static" || die
272 + fi
273 +
274 + multilib_copy_sources
275 +}
276 +
277 +multilib_src_configure() {
278 + append-lfs-flags #471102
279 +}
280 +
281 +pemake() {
282 + emake \
283 + HOST="${CHOST}" \
284 + CROSS_COMPILE="${CHOST}-" \
285 + CC="$(tc-getCC)" \
286 + AR="$(tc-getAR)" \
287 + PKG_CONFIG="$(tc-getPKG_CONFIG)" \
288 + RANLIB="$(tc-getRANLIB)" \
289 + DNS=$(usex dns) \
290 + IDSDIR='$(SHAREDIR)/misc' \
291 + MANDIR='$(SHAREDIR)/man' \
292 + PREFIX="${EPREFIX}/usr" \
293 + SHARED="yes" \
294 + STRIP="" \
295 + ZLIB=$(usex zlib) \
296 + PCI_COMPRESSED_IDS=0 \
297 + PCI_IDS=pci.ids \
298 + LIBDIR="\${PREFIX}/$(get_libdir)" \
299 + LIBKMOD=$(multilib_native_usex kmod) \
300 + HWDB=$(usex udev) \
301 + "$@"
302 +}
303 +
304 +multilib_src_compile() {
305 + pemake OPT="${CFLAGS}" all
306 + if use static-libs ; then
307 + pemake \
308 + -C "${BUILD_DIR}/static" \
309 + OPT="${CFLAGS}" \
310 + SHARED="no" \
311 + lib/libpci.a
312 + fi
313 +}
314 +
315 +multilib_src_install() {
316 + pemake DESTDIR="${D}" install install-lib
317 + use static-libs && dolib.a "${BUILD_DIR}/static/lib/libpci.a"
318 +}
319 +
320 +multilib_src_install_all() {
321 + dodoc ChangeLog README TODO
322 +
323 + rm "${ED}"/usr/sbin/update-pciids "${ED}"/usr/share/misc/pci.ids \
324 + "${ED}"/usr/share/man/man8/update-pciids.8*
325 +
326 + newinitd "${FILESDIR}"/init.d-pciparm pciparm
327 + newconfd "${FILESDIR}"/conf.d-pciparm pciparm
328 +}
329 +
330 +pkg_postinst() {
331 + if [[ ${REPLACING_VERSIONS} ]] && [[ ${REPLACING_VERSIONS} < 3.2.0 ]]; then
332 + elog "The 'network-cron' USE flag is gone; if you want a more up-to-date"
333 + elog "pci.ids file, you should use sys-apps/hwids-99999999 (live ebuild)."
334 + fi
335 +}