/[gentoo-x86]/sys-fs/udev/udev-9999.ebuild
Gentoo

Contents of /sys-fs/udev/udev-9999.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.228 - (show annotations) (download)
Fri May 17 13:50:18 2013 UTC (5 days, 18 hours ago) by ssuominen
Branch: MAIN
CVS Tags: HEAD
Changes since 1.227: +52 -111 lines
revert

(Portage version: 2.2.0_alpha174/cvs/Linux x86_64, signed Manifest commit with key 4868F14D)

1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/udev-204.ebuild,v 1.2 2013/05/15 07:41:51 ssuominen Exp $
4
5 EAPI=5
6
7 # accept4() patch is only in non-live version
8 if [[ ${PV} = 9999* ]]; then
9 KV_min=2.6.39
10 else
11 KV_min=2.6.32
12 fi
13
14 inherit autotools eutils linux-info multilib toolchain-funcs versionator
15
16 if [[ ${PV} = 9999* ]]; then
17 EGIT_REPO_URI="git://anongit.freedesktop.org/systemd/systemd"
18 inherit git-2
19 else
20 patchset=
21 SRC_URI="http://www.freedesktop.org/software/systemd/systemd-${PV}.tar.xz"
22 if [[ -n "${patchset}" ]]; then
23 SRC_URI="${SRC_URI}
24 http://dev.gentoo.org/~ssuominen/${P}-patches-${patchset}.tar.xz
25 http://dev.gentoo.org/~williamh/dist/${P}-patches-${patchset}.tar.xz"
26 fi
27 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
28 fi
29
30 DESCRIPTION="Linux dynamic and persistent device naming support (aka userspace devfs)"
31 HOMEPAGE="http://www.freedesktop.org/wiki/Software/systemd"
32
33 LICENSE="LGPL-2.1 MIT GPL-2"
34 SLOT="0"
35 IUSE="acl doc +firmware-loader gudev hwdb introspection keymap +kmod +openrc selinux static-libs"
36
37 RESTRICT="test"
38
39 COMMON_DEPEND=">=sys-apps/util-linux-2.20
40 acl? ( sys-apps/acl )
41 gudev? ( >=dev-libs/glib-2 )
42 introspection? ( >=dev-libs/gobject-introspection-1.31.1 )
43 kmod? ( >=sys-apps/kmod-13 )
44 selinux? ( >=sys-libs/libselinux-2.1.9 )
45 !<sys-libs/glibc-2.11
46 !sys-apps/systemd"
47
48 DEPEND="${COMMON_DEPEND}
49 app-text/docbook-xsl-stylesheets
50 dev-libs/libxslt
51 >=sys-devel/make-3.82-r4
52 virtual/os-headers
53 virtual/pkgconfig
54 !<sys-kernel/linux-headers-${KV_min}
55 doc? ( >=dev-util/gtk-doc-1.18 )
56 keymap? ( dev-util/gperf )"
57
58 if [[ ${PV} = 9999* ]]; then
59 DEPEND="${DEPEND}
60 dev-util/gperf
61 >=dev-util/intltool-0.50"
62 fi
63
64 RDEPEND="${COMMON_DEPEND}
65 openrc? ( !<sys-apps/openrc-0.9.9 )
66 !sys-apps/coldplug
67 !<sys-fs/lvm2-2.02.97-r1
68 !sys-fs/device-mapper
69 !<sys-fs/udev-init-scripts-22
70 !<sys-kernel/dracut-017-r1
71 !<sys-kernel/genkernel-3.4.25
72 !<sec-policy/selinux-base-2.20120725-r10"
73
74 PDEPEND=">=virtual/udev-197-r1
75 hwdb? ( >=sys-apps/hwids-20130326.1[udev] )
76 openrc? ( >=sys-fs/udev-init-scripts-25 )"
77
78 S=${WORKDIR}/systemd-${PV}
79
80 #QA_MULTILIB_PATHS="lib/systemd/systemd-udevd"
81
82 udev_check_KV() {
83 if kernel_is lt ${KV_min//./ }; then
84 return 1
85 fi
86 return 0
87 }
88
89 check_default_rules() {
90 # Make sure there are no sudden changes to upstream rules file
91 # (more for my own needs than anything else ...)
92 local udev_rules_md5=7d3733faee4203fd7c75c3f3c0d55741
93 MD5=$(md5sum < "${S}"/rules/50-udev-default.rules)
94 MD5=${MD5/ -/}
95 if [[ ${MD5} != ${udev_rules_md5} ]]; then
96 eerror "50-udev-default.rules has been updated, please validate!"
97 eerror "md5sum: ${MD5}"
98 die "50-udev-default.rules has been updated, please validate!"
99 fi
100 }
101
102 pkg_setup() {
103 CONFIG_CHECK="~BLK_DEV_BSG ~DEVTMPFS ~!IDE ~INOTIFY_USER ~!SYSFS_DEPRECATED ~!SYSFS_DEPRECATED_V2 ~SIGNALFD ~EPOLL"
104
105 linux-info_pkg_setup
106
107 if ! udev_check_KV; then
108 eerror "Your kernel version (${KV_FULL}) is too old to run ${P}"
109 eerror "It must be at least ${KV_min}!"
110 fi
111
112 KV_FULL_SRC=${KV_FULL}
113 get_running_version
114 if ! udev_check_KV; then
115 eerror
116 eerror "Your running kernel version (${KV_FULL}) is too old"
117 eerror "for this version of udev."
118 eerror "You must upgrade your kernel or downgrade udev."
119 fi
120 }
121
122 src_prepare() {
123 if ! [[ ${PV} = 9999* ]]; then
124 # secure_getenv() disable for non-glibc systems wrt bug #443030
125 if ! [[ $(grep -r secure_getenv * | wc -l) -eq 19 ]]; then
126 eerror "The line count for secure_getenv() failed, see bug #443030"
127 die
128 fi
129
130 # gperf disable if keymaps are not requested wrt bug #452760
131 if ! [[ $(grep -i gperf Makefile.am | wc -l) -eq 27 ]]; then
132 eerror "The line count for gperf references failed, see bug 452760"
133 die
134 fi
135 fi
136
137 # backport some patches
138 if [[ -n "${patchset}" ]]; then
139 EPATCH_SUFFIX=patch EPATCH_FORCE=yes epatch
140 fi
141
142 # These are missing from upstream 50-udev-default.rules
143 cat <<-EOF > "${T}"/40-gentoo.rules
144 # Gentoo specific usb group
145 SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="usb"
146 # Keep this for Linux 2.6.32 kernels with accept4() support like .60 wrt #457868
147 SUBSYSTEM=="mem", KERNEL=="null|zero|full|random|urandom", MODE="0666"
148 EOF
149
150 # Remove requirements for gettext and intltool wrt bug #443028
151 if ! has_version dev-util/intltool && ! [[ ${PV} = 9999* ]]; then
152 sed -i \
153 -e '/INTLTOOL_APPLIED_VERSION=/s:=.*:=0.40.0:' \
154 -e '/XML::Parser perl module is required for intltool/s|^|:|' \
155 configure || die
156 eval export INTLTOOL_{EXTRACT,MERGE,UPDATE}=/bin/true
157 eval export {MSG{FMT,MERGE},XGETTEXT}=/bin/true
158 fi
159
160 # apply user patches
161 epatch_user
162
163 # compile with older versions of gcc #451110
164 version_is_at_least 4.6 $(gcc-version) || \
165 sed -i 's:static_assert:alsdjflkasjdfa:' src/shared/macro.h
166
167 # change rules back to group uucp instead of dialout for now wrt #454556
168 sed -e 's/GROUP="dialout"/GROUP="uucp"/' \
169 -i rules/*.rules \
170 || die "failed to change group dialout to uucp"
171
172 if [[ ! -e configure ]]; then
173 if use doc; then
174 gtkdocize --docdir docs || die "gtkdocize failed"
175 else
176 echo 'EXTRA_DIST =' > docs/gtk-doc.make
177 fi
178 eautoreconf
179 else
180 check_default_rules
181 elibtoolize
182 fi
183
184 if ! use elibc_glibc; then #443030
185 echo '#define secure_getenv(x) NULL' >> config.h.in
186 sed -i -e '/error.*secure_getenv/s:.*:#define secure_getenv(x) NULL:' src/shared/missing.h || die
187 fi
188
189 # link udevd(8) and systemd-udevd(8) manpages to systemd-udevd.service(8) manpage
190 echo '.so systemd-udevd.service.8' > "${T}"/udevd.8
191 echo '.so systemd-udevd.service.8' > "${T}"/systemd-udevd.8
192 }
193
194 src_configure() {
195 tc-export CC #463846
196 use keymap || export ac_cv_prog_ac_ct_GPERF=true #452760
197
198 local econf_args
199
200 econf_args=(
201 ac_cv_search_cap_init=
202 ac_cv_header_sys_capability_h=yes
203 DBUS_CFLAGS=' '
204 DBUS_LIBS=' '
205 --bindir=/bin
206 --docdir=/usr/share/doc/${PF}
207 --libdir=/usr/$(get_libdir)
208 --with-html-dir=/usr/share/doc/${PF}/html
209 --with-rootprefix=
210 --with-rootlibdir=/$(get_libdir)
211 --with-bashcompletiondir=/usr/share/bash-completion
212 --without-python
213 --disable-audit
214 --disable-coredump
215 --disable-hostnamed
216 --disable-ima
217 --disable-libcryptsetup
218 --disable-localed
219 --disable-logind
220 --disable-myhostname
221 --disable-nls
222 --disable-pam
223 --disable-quotacheck
224 --disable-readahead
225 --enable-split-usr
226 --disable-tcpwrap
227 --disable-timedated
228 --disable-xz
229 --disable-polkit
230 $(use_enable acl)
231 $(use_enable doc gtk-doc)
232 $(use_enable gudev)
233 $(use_enable keymap)
234 $(use_enable kmod)
235 $(use_enable selinux)
236 $(use_enable static-libs static)
237 )
238 if use introspection; then
239 econf_args+=(
240 --enable-introspection=$(usex introspection)
241 )
242 fi
243 if use firmware-loader; then
244 econf_args+=(
245 --with-firmware-path="/lib/firmware/updates:/lib/firmware"
246 )
247 fi
248 econf "${econf_args[@]}"
249 }
250
251 src_compile() {
252 echo 'BUILT_SOURCES: $(BUILT_SOURCES)' > "${T}"/Makefile.extra
253 emake -f Makefile -f "${T}"/Makefile.extra BUILT_SOURCES
254 local targets=(
255 libudev.la
256 systemd-udevd
257 udevadm
258 ata_id
259 cdrom_id
260 collect
261 scsi_id
262 v4l_id
263 accelerometer
264 mtd_probe
265 man/udev.7
266 man/udevadm.8
267 man/systemd-udevd.service.8
268 )
269 use keymap && targets+=( keymap )
270 use gudev && targets+=( libgudev-1.0.la )
271
272 emake "${targets[@]}"
273 if use doc; then
274 emake -C docs/libudev
275 use gudev && emake -C docs/gudev
276 fi
277 }
278
279 src_install() {
280 local lib_LTLIBRARIES="libudev.la" \
281 pkgconfiglib_DATA="src/libudev/libudev.pc"
282
283 local targets=(
284 install-libLTLIBRARIES
285 install-includeHEADERS
286 install-libgudev_includeHEADERS
287 install-binPROGRAMS
288 install-rootlibexecPROGRAMS
289 install-udevlibexecPROGRAMS
290 install-dist_udevconfDATA
291 install-dist_udevhomeSCRIPTS
292 install-dist_udevkeymapDATA
293 install-dist_udevkeymapforcerelDATA
294 install-dist_udevrulesDATA
295 install-girDATA
296 install-man7
297 install-man8
298 install-pkgconfiglibDATA
299 install-sharepkgconfigDATA
300 install-typelibsDATA
301 install-dist_docDATA
302 libudev-install-hook
303 install-directories-hook
304 install-dist_bashcompletionDATA
305 )
306
307 if use gudev; then
308 lib_LTLIBRARIES+=" libgudev-1.0.la"
309 pkgconfiglib_DATA+=" src/gudev/gudev-1.0.pc"
310 fi
311
312 # add final values of variables:
313 targets+=(
314 rootlibexec_PROGRAMS=systemd-udevd
315 bin_PROGRAMS=udevadm
316 lib_LTLIBRARIES="${lib_LTLIBRARIES}"
317 MANPAGES="man/udev.7 man/udevadm.8 \
318 man/systemd-udevd.service.8"
319 MANPAGES_ALIAS=""
320 pkgconfiglib_DATA="${pkgconfiglib_DATA}"
321 INSTALL_DIRS='$(sysconfdir)/udev/rules.d \
322 $(sysconfdir)/udev/hwdb.d'
323 dist_bashcompletion_DATA="shell-completion/bash/udevadm"
324 )
325 emake -j1 DESTDIR="${D}" "${targets[@]}"
326 if use doc; then
327 emake -C docs/libudev DESTDIR="${D}" install
328 use gudev && emake -C docs/gudev DESTDIR="${D}" install
329 fi
330 dodoc TODO
331
332 prune_libtool_files --all
333 rm -f \
334 "${D}"/lib/udev/rules.d/99-systemd.rules \
335 "${D}"/usr/share/doc/${PF}/LICENSE.*
336
337 # see src_prepare() for content of these files
338 insinto /lib/udev/rules.d
339 doins "${T}"/40-gentoo.rules
340 doman "${T}"/udevd.8
341 doman "${T}"/systemd-udevd.8
342
343 # install udevadm compatibility symlink
344 dosym {../bin,sbin}/udevadm
345
346 # install udevd to /sbin and remove empty and redudant directory
347 # /lib/systemd because systemd is installed to /usr wrt #462750
348 mv "${D}"/{lib/systemd/systemd-,sbin/}udevd || die
349 rm -r "${D}"/lib/systemd
350 }
351
352 pkg_preinst() {
353 local htmldir
354 for htmldir in gudev libudev; do
355 if [[ -d ${ROOT}usr/share/gtk-doc/html/${htmldir} ]]; then
356 rm -rf "${ROOT}"usr/share/gtk-doc/html/${htmldir}
357 fi
358 if [[ -d ${D}/usr/share/doc/${PF}/html/${htmldir} ]]; then
359 dosym ../../doc/${PF}/html/${htmldir} \
360 /usr/share/gtk-doc/html/${htmldir}
361 fi
362 done
363 preserve_old_lib /{,usr/}$(get_libdir)/libudev$(get_libname 0)
364 }
365
366 pkg_postinst() {
367 mkdir -p "${ROOT}"run
368
369 # "losetup -f" is confused if there is an empty /dev/loop/, Bug #338766
370 # So try to remove it here (will only work if empty).
371 rmdir "${ROOT}"dev/loop 2>/dev/null
372 if [[ -d ${ROOT}dev/loop ]]; then
373 ewarn "Please make sure your remove /dev/loop,"
374 ewarn "else losetup may be confused when looking for unused devices."
375 fi
376
377 # people want reminders, I'll give them reminders. Odds are they will
378 # just ignore them anyway...
379
380 # 64-device-mapper.rules is related to sys-fs/device-mapper which we block
381 # in favor of sys-fs/lvm2
382 old_dm_rules=${ROOT}etc/udev/rules.d/64-device-mapper.rules
383 if [[ -f ${old_dm_rules} ]]; then
384 rm -f "${old_dm_rules}"
385 einfo "Removed unneeded file ${old_dm_rules}"
386 fi
387
388 local fstab="${ROOT}"etc/fstab dev path fstype rest
389 while read -r dev path fstype rest; do
390 if [[ ${path} == /dev && ${fstype} != devtmpfs ]]; then
391 ewarn "You need to edit your /dev line in ${fstab} to have devtmpfs"
392 ewarn "filesystem. Otherwise udev won't be able to boot."
393 ewarn "See, http://bugs.gentoo.org/453186"
394 fi
395 done < "${fstab}"
396
397 if [[ -d ${ROOT}usr/lib/udev ]]; then
398 ewarn
399 ewarn "Please re-emerge all packages on your system which install"
400 ewarn "rules and helpers in /usr/lib/udev. They should now be in"
401 ewarn "/lib/udev."
402 ewarn
403 ewarn "One way to do this is to run the following command:"
404 ewarn "emerge -av1 \$(qfile -q -S -C /usr/lib/udev)"
405 ewarn "Note that qfile can be found in app-portage/portage-utils"
406 fi
407
408 local old_net_name="${ROOT}"etc/udev/rules.d/80-net-name-slot.rules
409 if [[ -f ${old_net_name} ]]; then
410 local old_net_sum=bebf4bd1b6b668e9ff34a3999aa6ff32
411 MD5=$(md5sum < "${old_net_name}")
412 MD5=${MD5/ -/}
413 if [[ ${MD5} == ${old_net_sum} ]]; then
414 ewarn "Removing unmodified file ${old_net_name} from old udev installation to enable"
415 ewarn "the new predictable network interface naming."
416 rm -f "${old_net_name}"
417 fi
418 fi
419
420 local old_cd_rules="${ROOT}"etc/udev/rules.d/70-persistent-cd.rules
421 local old_net_rules="${ROOT}"etc/udev/rules.d/70-persistent-net.rules
422 for old_rules in "${old_cd_rules}" "${old_net_rules}"; do
423 if [[ -f ${old_rules} ]]; then
424 ewarn
425 ewarn "File ${old_rules} is from old udev installation but if you still use it,"
426 ewarn "rename it to something else starting with 70- to silence this deprecation"
427 ewarn "warning."
428 fi
429 done
430
431 if has_version sys-apps/biosdevname; then
432 ewarn
433 ewarn "You have sys-apps/biosdevname installed which has been deprecated"
434 ewarn "in favor of the predictable network interface names."
435 fi
436
437 ewarn
438 ewarn "The new predictable network interface names are used by default, see:"
439 ewarn "http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames"
440 ewarn
441 ewarn "Example command to get the information for the new interface name before booting"
442 ewarn "(replace <ifname> with, for example, eth0):"
443 ewarn "# udevadm test-builtin net_id /sys/class/net/<ifname> 2> /dev/null"
444 ewarn
445 ewarn "You can use kernel commandline net.ifnames=0 to disable this feature."
446
447 ewarn
448 ewarn "You need to restart udev as soon as possible to make the upgrade go"
449 ewarn "into effect."
450 ewarn "The method you use to do this depends on your init system."
451
452 preserve_old_lib_notify /{,usr/}$(get_libdir)/libudev$(get_libname 0)
453
454 elog
455 elog "For more information on udev on Gentoo, upgrading, writing udev rules, and"
456 elog " fixing known issues visit:"
457 elog " http://wiki.gentoo.org/wiki/Udev/upgrade"
458 elog " http://www.gentoo.org/doc/en/udev-guide.xml"
459
460 # Update hwdb database in case the format is changed by udev version.
461 if use hwdb && has_version 'sys-apps/hwids[udev]'; then
462 udevadm hwdb --update --root="${ROOT%/}"
463 fi
464 }

  ViewVC Help
Powered by ViewVC 1.1.13