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

Contents of /sys-fs/udev/udev-171-r8.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Thu Nov 1 02:24:34 2012 UTC (2 years, 1 month ago) by ssuominen
Branch: MAIN
Changes since 1.2: +6 -7 lines
Update HOMEPAGE and SRC_URI from latest stable wrt #440408

(Portage version: 2.2.0_alpha135/cvs/Linux x86_64)

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/udev-171-r8.ebuild,v 1.2 2012/10/27 21:30:17 williamh Exp $
4
5 EAPI=4
6
7 KV_min=2.6.32
8 KV_reliable=2.6.32
9 PATCHSET=${P}-gentoo-patchset-v1
10 scriptversion=7.1
11 scriptname=udev-gentoo-scripts
12 [[ -n "${scriptversion}" ]] && scriptname="${scriptname}-${scriptversion}"
13
14 if [[ ${PV} == "9999" ]]
15 then
16 EGIT_REPO_URI="git://git.kernel.org/pub/scm/linux/hotplug/udev.git"
17 EGIT_BRANCH="master"
18 inherit autotools git-2
19 fi
20
21 inherit eutils flag-o-matic multilib toolchain-funcs linux-info systemd libtool
22
23 if [[ ${PV} != "9999" ]]
24 then
25 KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~x86-linux"
26 SRC_URI="mirror://gentoo/${P}.tar.bz2
27 test? ( mirror://gentoo/${PN}-171-testsys.tar.bz2 )
28 mirror://gentoo/${PN}-gentoo-legacy-patchset-1.tar.bz2"
29 if [[ -n "${PATCHSET}" ]]
30 then
31 SRC_URI="${SRC_URI} mirror://gentoo/${PATCHSET}.tar.bz2"
32 fi
33 fi
34 SRC_URI="${SRC_URI} mirror://gentoo/${scriptname}.tar.bz2"
35
36 DESCRIPTION="Linux dynamic and persistent device naming support (aka userspace devfs)"
37 HOMEPAGE="http://www.freedesktop.org/wiki/Software/systemd"
38
39 LICENSE="GPL-2"
40 SLOT="0"
41 IUSE="build selinux test debug +rule_generator hwdb gudev introspection
42 keymap floppy edd action_modeswitch extras"
43
44 COMMON_DEPEND="selinux? ( sys-libs/libselinux )
45 extras? ( dev-libs/glib:2
46 dev-libs/gobject-introspection
47 virtual/libusb:0 )
48 gudev? ( dev-libs/glib:2 )
49 introspection? ( dev-libs/gobject-introspection )
50 action_modeswitch? ( virtual/libusb:0 )
51 >=sys-apps/util-linux-2.16
52 !<sys-libs/glibc-2.11"
53
54 DEPEND="${COMMON_DEPEND}
55 keymap? ( dev-util/gperf )
56 extras? ( dev-util/gperf )
57 virtual/pkgconfig
58 virtual/os-headers
59 !<sys-kernel/linux-headers-2.6.34
60 test? ( app-text/tree )"
61
62 RDEPEND="${COMMON_DEPEND}
63 hwdb?
64 (
65 >=sys-apps/usbutils-0.82
66 || (
67 ( sys-apps/hwids >=sys-apps/pciutils-3.1.9-r2 )
68 >=sys-apps/pciutils-3.1.9-r1[-compress-db]
69 <sys-apps/pciutils-3.1.9-r1[-zlib]
70 )
71 )
72 extras?
73 (
74 >=sys-apps/usbutils-0.82
75 sys-apps/pciutils
76 )
77 !sys-apps/coldplug
78 !<sys-fs/lvm2-2.02.45
79 !sys-fs/device-mapper
80 >=sys-apps/baselayout-2"
81
82 if [[ ${PV} == "9999" ]]
83 then
84 # for documentation processing with xsltproc
85 DEPEND="${DEPEND}
86 app-text/docbook-xsl-stylesheets
87 app-text/docbook-xml-dtd
88 dev-util/gtk-doc"
89 fi
90
91 # required kernel options
92 CONFIG_CHECK="~INOTIFY_USER ~SIGNALFD ~!SYSFS_DEPRECATED ~!SYSFS_DEPRECATED_V2
93 ~!IDE ~BLK_DEV_BSG"
94
95 # Return values:
96 # 2 - reliable
97 # 1 - unreliable
98 # 0 - too old
99 udev_check_KV() {
100 local ok=0
101 if kernel_is -ge ${KV_reliable//./ }
102 then
103 ok=2
104 elif kernel_is -ge ${KV_min//./ }
105 then
106 ok=1
107 fi
108 return $ok
109 }
110
111 pkg_setup() {
112 linux-info_pkg_setup
113
114 # always print kernel version requirements
115 ewarn
116 ewarn "${P} does not support Linux kernel before version ${KV_min}!"
117 if [[ ${KV_min} != ${KV_reliable} ]]
118 then
119 ewarn "For a reliable udev, use at least kernel ${KV_reliable}"
120 fi
121
122 udev_check_KV
123 case "$?" in
124 2) einfo "Your kernel version (${KV_FULL}) is new enough to run ${P} reliably." ;;
125 1) ewarn "Your kernel version (${KV_FULL}) is new enough to run ${P},"
126 ewarn "but it may be unreliable in some cases."
127 ;;
128 0) eerror "Your kernel version (${KV_FULL}) is too old to run ${P}"
129 ;;
130 esac
131
132 KV_FULL_SRC=${KV_FULL}
133 get_running_version
134 udev_check_KV
135 if [[ "$?" = "0" ]]
136 then
137 eerror
138 eerror "udev cannot be restarted after emerging,"
139 eerror "as your running kernel version (${KV_FULL}) is too old."
140 eerror "You really need to use a newer kernel after a reboot!"
141 NO_RESTART=1
142 fi
143 }
144
145 src_unpack() {
146 unpack ${A}
147 if [[ ${PV} == "9999" ]]
148 then
149 git-2_src_unpack
150 fi
151 }
152
153 src_prepare() {
154 if use test && [[ -d "${WORKDIR}"/test/sys ]]
155 then
156 mv "${WORKDIR}"/test/sys "${S}"/test/
157 fi
158
159 # patches go here...
160
161 # backport some patches
162 if [[ -n "${PATCHSET}" ]]
163 then
164 EPATCH_SOURCE="${WORKDIR}/${PATCHSET}" EPATCH_SUFFIX="patch" \
165 EPATCH_FORCE="yes" epatch
166 fi
167
168 # change rules back to group uucp instead of dialout for now
169 sed -e 's/GROUP="dialout"/GROUP="uucp"/' \
170 -i rules/{rules.d,arch}/*.rules \
171 || die "failed to change group dialout to uucp"
172
173 if [[ ${PV} != 9999 ]]
174 then
175 # Make sure there is no sudden changes to upstream rules file
176 # (more for my own needs than anything else ...)
177 MD5=$(md5sum < "${S}/rules/rules.d/50-udev-default.rules")
178 MD5=${MD5/ -/}
179 if [[ ${MD5} != a9954d57e97aa0ad2e0ed53899d9559a ]]
180 then
181 eerror "50-udev-default.rules has been updated, please validate!"
182 eerror "md5sum: ${MD5}"
183 die "50-udev-default.rules has been updated, please validate!"
184 fi
185 fi
186
187 if [[ ${PV} == 9999 ]]
188 then
189 gtkdocize --copy || die "gtkdocize failed"
190 eautoreconf
191 else
192 elibtoolize
193 fi
194 }
195
196 use_extras() { use extras && echo "--enable-${2:-$1}" || use_enable "$@" ; }
197 src_configure() {
198 econf \
199 --prefix="${EPREFIX}/usr" \
200 --sysconfdir="${EPREFIX}/etc" \
201 --sbindir="${EPREFIX}/sbin" \
202 --libdir="${EPREFIX}/usr/$(get_libdir)" \
203 --with-rootlibdir="${EPREFIX}/$(get_libdir)" \
204 --libexecdir="${EPREFIX}/lib/udev" \
205 --enable-logging \
206 --enable-static \
207 $(use_with selinux) \
208 $(use_enable debug) \
209 $(use_extras rule_generator) \
210 $(use_extras hwdb) \
211 --with-pci-ids-path="${EPREFIX}/usr/share/misc/pci.ids" \
212 --with-usb-ids-path="${EPREFIX}/usr/share/misc/usb.ids" \
213 --disable-udev_acl \
214 $(use_extras gudev) \
215 $(use_extras introspection) \
216 $(use_extras keymap) \
217 $(use_extras floppy) \
218 $(use_extras edd) \
219 $(use_extras action_modeswitch) \
220 $(systemd_with_unitdir)
221 }
222
223 src_compile() {
224 filter-flags -fprefetch-loop-arrays
225
226 emake
227 }
228
229 src_install() {
230 into /
231 emake DESTDIR="${D}" install
232
233 exeinto /lib/udev
234 keepdir /lib/udev/state
235 keepdir /lib/udev/devices
236
237 # create symlinks for these utilities to /sbin
238 # where multipath-tools expect them to be (Bug #168588)
239 dosym "../lib/udev/scsi_id" /sbin/scsi_id
240
241 # Add gentoo stuff to udev.conf
242 echo "# If you need to change mount-options, do it in /etc/fstab" \
243 >> "${ED}"/etc/udev/udev.conf
244
245 # let the dir exist at least
246 keepdir /etc/udev/rules.d
247
248 # Now installing rules
249 cd "${S}"/rules
250 insinto /lib/udev/rules.d/
251
252 # support older kernels
253 doins misc/30-kernel-compat.rules
254
255 # Adding arch specific rules
256 if [[ -f arch/40-${ARCH}.rules ]]
257 then
258 doins "arch/40-${ARCH}.rules"
259 fi
260 cd "${S}"
261
262 insinto /etc/modprobe.d
263 newins "${WORKDIR}"/blacklist-146 blacklist.conf
264 newins "${WORKDIR}"/pnp-aliases pnp-aliases.conf
265
266 # documentation
267 dodoc ChangeLog README TODO
268
269 # keep doc in just one directory, Bug #281137
270 rm -rf "${ED}/usr/share/doc/${PN}"
271 if use keymap
272 then
273 dodoc extras/keymap/README.keymap.txt
274 fi
275
276 cd "${WORKDIR}/${scriptname}"
277 sed -i -e 's/2.6.34/2.6.32/' init.d/udev
278 doconfd conf.d/*
279 exeinto /lib/udev
280 doexe helpers/*
281 doexe "${WORKDIR}"/shell-compat-KV.sh
282 doinitd init.d/*
283 insinto /etc/modprobe.d
284 doins modprobe.d/*
285 insinto /lib/udev/rules.d
286 doins rules.d/*
287 }
288
289 src_test() {
290 local emake_cmd="${MAKE:-make} ${MAKEOPTS} ${EXTRA_EMAKE}"
291
292 cd "${S}"
293 einfo ">>> Test phase [udev:check]: ${CATEGORY}/${PF}"
294 has userpriv $FEATURES && einfo "Disable FEATURES userpriv to run the udev tests"
295 if ! $emake_cmd -j1 check
296 then
297 has test $FEATURES && die "udev: Make test failed. See above for details."
298 has test $FEATURES || eerror "udev: Make test failed. See above for details."
299 fi
300 }
301
302 pkg_preinst() {
303 # moving old files to support newer modprobe, 12 May 2009
304 local f dir=${EROOT}/etc/modprobe.d/
305 for f in pnp-aliases blacklist; do
306 if [[ -f $dir/$f && ! -f $dir/$f.conf ]]
307 then
308 elog "Moving $dir/$f to $f.conf"
309 mv -f "$dir/$f" "$dir/$f.conf"
310 fi
311 done
312
313 if [[ -d ${EROOT}/lib/udev-state ]]
314 then
315 mv -f "${EROOT}"/lib/udev-state/* "${ED}"/lib/udev/state/
316 rm -r "${EROOT}"/lib/udev-state
317 fi
318
319 if [[ -f ${EROOT}/etc/udev/udev.config &&
320 ! -f ${EROOT}/etc/udev/udev.rules ]]
321 then
322 mv -f "${EROOT}"/etc/udev/udev.config "${EROOT}"/etc/udev/udev.rules
323 fi
324
325 # delete the old udev.hotplug symlink if it is present
326 if [[ -h ${EROOT}/etc/hotplug.d/default/udev.hotplug ]]
327 then
328 rm -f "${EROOT}"/etc/hotplug.d/default/udev.hotplug
329 fi
330
331 # delete the old wait_for_sysfs.hotplug symlink if it is present
332 if [[ -h ${EROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug ]]
333 then
334 rm -f "${EROOT}"/etc/hotplug.d/default/05-wait_for_sysfs.hotplug
335 fi
336
337 # delete the old wait_for_sysfs.hotplug symlink if it is present
338 if [[ -h ${EROOT}/etc/hotplug.d/default/10-udev.hotplug ]]
339 then
340 rm -f "${EROOT}"/etc/hotplug.d/default/10-udev.hotplug
341 fi
342
343 has_version "=${CATEGORY}/${PN}-103-r3"
344 previous_equal_to_103_r3=$?
345
346 has_version "<${CATEGORY}/${PN}-104-r5"
347 previous_less_than_104_r5=$?
348
349 has_version "<${CATEGORY}/${PN}-106-r5"
350 previous_less_than_106_r5=$?
351
352 has_version "<${CATEGORY}/${PN}-113"
353 previous_less_than_113=$?
354 }
355
356 # 19 Nov 2008
357 fix_old_persistent_net_rules() {
358 local rules=${EROOT}/etc/udev/rules.d/70-persistent-net.rules
359 [[ -f ${rules} ]] || return
360
361 elog
362 elog "Updating persistent-net rules file"
363
364 # Change ATTRS to ATTR matches, Bug #246927
365 sed -i -e 's/ATTRS{/ATTR{/g' "${rules}"
366
367 # Add KERNEL matches if missing, Bug #246849
368 sed -ri \
369 -e '/KERNEL/ ! { s/NAME="(eth|wlan|ath)([0-9]+)"/KERNEL=="\1*", NAME="\1\2"/}' \
370 "${rules}"
371 }
372
373 # See Bug #129204 for a discussion about restarting udevd
374 restart_udevd() {
375 if [[ ${NO_RESTART} = "1" ]]
376 then
377 ewarn "Not restarting udevd, as your kernel is too old!"
378 return
379 fi
380
381 # need to merge to our system
382 [[ ${EROOT} = / ]] || return
383
384 # check if root of init-process is identical to ours (not in chroot)
385 [[ -r /proc/1/root && /proc/1/root/ -ef /proc/self/root/ ]] || return
386
387 # abort if there is no udevd running
388 [[ -n $(pidof udevd) ]] || return
389
390 # abort if no /dev/.udev exists
391 [[ -e /dev/.udev ]] || return
392
393 elog
394 elog "restarting udevd now."
395
396 killall -15 udevd &>/dev/null
397 sleep 1
398 killall -9 udevd &>/dev/null
399
400 /sbin/udevd --daemon
401 sleep 3
402 if [[ ! -n $(pidof udevd) ]]
403 then
404 eerror "FATAL: udev died, please check your kernel is"
405 eerror "new enough and configured correctly for ${P}."
406 eerror
407 eerror "Please have a look at this before rebooting."
408 eerror "If in doubt, please downgrade udev back to your old version"
409 fi
410 }
411
412 postinst_init_scripts() {
413 local enable_postmount=false
414
415 # FIXME: inconsistent handling of init-scripts here
416 # * udev is added to sysinit in openrc-ebuild
417 # * we add udev-postmount to default in here
418 #
419
420 # If we are building stages, add udev and udev-mount to the sysinit runlevel
421 # automatically.
422 if use build
423 then
424 if [[ -x "${EROOT}"/etc/init.d/udev \
425 && -d "${EROOT}"/etc/runlevels/sysinit ]]
426 then
427 ln -s "${EPREFIX}"/etc/init.d/udev "${EROOT}"/etc/runlevels/sysinit/udev
428 fi
429 if [[ -x "${ROOT}"/etc/init.d/udev-mount \
430 && -d "${ROOT}"/etc/runlevels/sysinit ]]
431 then
432 ln -s /etc/init.d/udev-mount \
433 "${ROOT}"/etc/runlevels/sysinit/udev-mount
434 fi
435 enable_postmount=true
436 fi
437
438 # Warn the user about adding the scripts to their sysinit runlevel
439 if [[ -e "${EROOT}"/etc/runlevels/sysinit ]]
440 then
441 if [[ ! -e "${EROOT}"/etc/runlevels/sysinit/udev ]]
442 then
443 ewarn
444 ewarn "You need to add udev to the sysinit runlevel."
445 ewarn "If you do not do this,"
446 ewarn "your system will not be able to boot!"
447 ewarn "Run this command:"
448 ewarn "\trc-update add udev sysinit"
449 fi
450 if [[ ! -e "${EROOT}"/etc/runlevels/sysinit/udev-mount ]]
451 then
452 ewarn
453 ewarn "You need to add udev-mount to the sysinit runlevel."
454 ewarn "If you do not do this,"
455 ewarn "your system will not be able to boot!"
456 ewarn "Run this command:"
457 ewarn "\trc-update add udev-mount sysinit"
458 fi
459 fi
460
461 # add udev-postmount to default runlevel instead of that ugly injecting
462 # like a hotplug event, 2009/10/15
463
464 # already enabled?
465 [[ -e "${EROOT}"/etc/runlevels/default/udev-postmount ]] && return
466
467 [[ -e "${EROOT}"/etc/runlevels/sysinit/udev ]] && enable_postmount=true
468 [[ "${EROOT}" = "/" && -d /dev/.udev/ ]] && enable_postmount=true
469
470 if $enable_postmount
471 then
472 local initd=udev-postmount
473
474 if [[ -e ${EROOT}/etc/init.d/${initd} ]] && \
475 [[ ! -e ${EROOT}/etc/runlevels/default/${initd} ]]
476 then
477 ln -snf "${EPREFIX}"/etc/init.d/${initd} "${EROOT}"/etc/runlevels/default/${initd}
478 elog "Auto-adding '${initd}' service to your default runlevel"
479 fi
480 else
481 elog "You should add the udev-postmount service to default runlevel."
482 elog "Run this to add it:"
483 elog "\trc-update add udev-postmount default"
484 fi
485 }
486
487 pkg_postinst() {
488 fix_old_persistent_net_rules
489
490 # "losetup -f" is confused if there is an empty /dev/loop/, Bug #338766
491 # So try to remove it here (will only work if empty).
492 rmdir "${EROOT}"/dev/loop 2>/dev/null
493 if [[ -d "${EROOT}"/dev/loop ]]
494 then
495 ewarn "Please make sure your remove /dev/loop,"
496 ewarn "else losetup may be confused when looking for unused devices."
497 fi
498
499 restart_udevd
500
501 postinst_init_scripts
502
503 # people want reminders, I'll give them reminders. Odds are they will
504 # just ignore them anyway...
505
506 # delete 40-scsi-hotplug.rules, it is integrated in 50-udev.rules, 19 Jan 2007
507 if [[ $previous_equal_to_103_r3 = 0 ]] &&
508 [[ -e ${EROOT}/etc/udev/rules.d/40-scsi-hotplug.rules ]]
509 then
510 ewarn "Deleting stray 40-scsi-hotplug.rules"
511 ewarn "installed by sys-fs/udev-103-r3"
512 rm -f "${EROOT}"/etc/udev/rules.d/40-scsi-hotplug.rules
513 fi
514
515 # Removing some device-nodes we thought we need some time ago, 25 Jan 2007
516 if [[ -d ${EROOT}/lib/udev/devices ]]
517 then
518 rm -f "${EROOT}"/lib/udev/devices/{null,zero,console,urandom}
519 fi
520
521 # Removing some old file, 29 Jan 2007
522 if [[ $previous_less_than_104_r5 = 0 ]]
523 then
524 rm -f "${EROOT}"/etc/dev.d/net/hotplug.dev
525 rmdir --ignore-fail-on-non-empty "${EROOT}"/etc/dev.d/net 2>/dev/null
526 fi
527
528 # 19 Mar 2007
529 if [[ $previous_less_than_106_r5 = 0 ]] &&
530 [[ -e ${EROOT}/etc/udev/rules.d/95-net.rules ]]
531 then
532 rm -f "${EROOT}"/etc/udev/rules.d/95-net.rules
533 fi
534
535 # Try to remove /etc/dev.d as that is obsolete, 23 Apr 2007
536 if [[ -d ${EROOT}/etc/dev.d ]]
537 then
538 rmdir --ignore-fail-on-non-empty "${EROOT}"/etc/dev.d/default "${EROOT}"/etc/dev.d 2>/dev/null
539 if [[ -d ${EROOT}/etc/dev.d ]]
540 then
541 ewarn "You still have the directory /etc/dev.d on your system."
542 ewarn "This is no longer used by udev and can be removed."
543 fi
544 fi
545
546 # 64-device-mapper.rules now gets installed by sys-fs/device-mapper
547 # remove it if user don't has sys-fs/device-mapper installed, 27 Jun 2007
548 if [[ $previous_less_than_113 = 0 ]] &&
549 [[ -f ${EROOT}/etc/udev/rules.d/64-device-mapper.rules ]] &&
550 ! has_version sys-fs/device-mapper
551 then
552 rm -f "${EROOT}"/etc/udev/rules.d/64-device-mapper.rules
553 einfo "Removed unneeded file 64-device-mapper.rules"
554 fi
555
556 # requested in Bug #225033:
557 elog
558 elog "persistent-net does assigning fixed names to network devices."
559 elog "If you have problems with the persistent-net rules,"
560 elog "just delete the rules file"
561 elog "\trm ${EROOT}etc/udev/rules.d/70-persistent-net.rules"
562 elog "and then reboot."
563 elog
564 elog "This may however number your devices in a different way than they are now."
565
566 ewarn
567 ewarn "If you build an initramfs including udev, then please"
568 ewarn "make sure that the /sbin/udevadm binary gets included,"
569 ewarn "and your scripts changed to use it,as it replaces the"
570 ewarn "old helper apps udevinfo, udevtrigger, ..."
571
572 ewarn
573 ewarn "mount options for directory /dev are no longer"
574 ewarn "set in /etc/udev/udev.conf, but in /etc/fstab"
575 ewarn "as for other directories."
576
577 ewarn
578 ewarn "If you use /dev/md/*, /dev/loop/* or /dev/rd/*,"
579 ewarn "then please migrate over to using the device names"
580 ewarn "/dev/md*, /dev/loop* and /dev/ram*."
581 ewarn "The devfs-compat rules have been removed."
582 ewarn "For reference see Bug #269359."
583
584 ewarn
585 ewarn "Rules for /dev/hd* devices have been removed"
586 ewarn "Please migrate to libata."
587
588 elog
589 elog "For more information on udev on Gentoo, writing udev rules, and"
590 elog " fixing known issues visit:"
591 elog " http://www.gentoo.org/doc/en/udev-guide.xml"
592 }

  ViewVC Help
Powered by ViewVC 1.1.20