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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Thu Nov 1 20:40:19 2012 UTC (17 months, 3 weeks ago) by williamh
Branch: MAIN
Changes since 1.2: +6 -2 lines
Tie the upgrade related messages to the correct versions for bug #440462.

(Portage version: 2.2.0_alpha142/cvs/Linux i686, signed Manifest commit with key 0x30C46538)

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-195.ebuild,v 1.2 2012/11/01 06:27:10 ssuominen Exp $
4
5 EAPI=4
6
7 KV_min=2.6.39
8
9 inherit autotools eutils linux-info
10
11 if [[ ${PV} = 9999* ]]
12 then
13 EGIT_REPO_URI="git://anongit.freedesktop.org/systemd/systemd"
14 inherit git-2
15 else
16 patchset=1
17 SRC_URI="http://www.freedesktop.org/software/systemd/systemd-${PV}.tar.xz"
18 if [[ -n "${patchset}" ]]
19 then
20 SRC_URI="${SRC_URI}
21 http://dev.gentoo.org/~williamh/dist/${P}-patches-${patchset}.tar.bz2"
22 fi
23 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
24 fi
25
26 DESCRIPTION="Linux dynamic and persistent device naming support (aka userspace devfs)"
27 HOMEPAGE="http://www.freedesktop.org/wiki/Software/systemd"
28
29 LICENSE="LGPL-2.1 MIT GPL-2"
30 SLOT="0"
31 IUSE="acl doc gudev hwdb introspection keymap +openrc selinux static-libs"
32
33 RESTRICT="test"
34
35 COMMON_DEPEND="acl? ( sys-apps/acl )
36 gudev? ( dev-libs/glib:2 )
37 introspection? ( >=dev-libs/gobject-introspection-1.31.1 )
38 selinux? ( sys-libs/libselinux )
39 >=sys-apps/kmod-5
40 >=sys-apps/util-linux-2.20
41 !<sys-libs/glibc-2.11"
42
43 DEPEND="${COMMON_DEPEND}
44 dev-util/gperf
45 >=dev-util/intltool-0.40.0
46 virtual/pkgconfig
47 virtual/os-headers
48 !<sys-kernel/linux-headers-${KV_min}
49 doc? ( dev-util/gtk-doc )"
50
51 if [[ ${PV} = 9999* ]]
52 then
53 DEPEND="${DEPEND}
54 app-text/docbook-xsl-stylesheets
55 dev-libs/libxslt"
56 fi
57
58 RDEPEND="${COMMON_DEPEND}
59 hwdb? ( sys-apps/hwids )
60 openrc? ( >=sys-fs/udev-init-scripts-16
61 !<sys-apps/openrc-0.9.9 )
62 !sys-apps/coldplug
63 !=sys-apps/systemd-188
64 !<sys-fs/lvm2-2.02.45
65 !sys-fs/device-mapper
66 !<sys-fs/udev-init-scripts-16
67 !<sys-kernel/dracut-017-r1
68 !<sys-kernel/genkernel-3.4.25"
69
70 S="${WORKDIR}/systemd-${PV}"
71
72 QA_MULTILIB_PATHS="usr/lib/systemd/systemd-udevd"
73
74 udev_check_KV()
75 {
76 if kernel_is lt ${KV_min//./ }
77 then
78 return 1
79 fi
80 return 0
81 }
82
83 check_default_rules()
84 {
85 # Make sure there are no sudden changes to upstream rules file
86 # (more for my own needs than anything else ...)
87 local udev_rules_md5=f742230cf0c2075adfba9e6b517c7095
88 MD5=$(md5sum < "${S}/rules/50-udev-default.rules")
89 MD5=${MD5/ -/}
90 if [[ ${MD5} != ${udev_rules_md5} ]]
91 then
92 eerror "50-udev-default.rules has been updated, please validate!"
93 eerror "md5sum: ${MD5}"
94 die "50-udev-default.rules has been updated, please validate!"
95 fi
96 }
97
98 pkg_setup()
99 {
100 # required kernel options
101 CONFIG_CHECK="~DEVTMPFS"
102 ERROR_DEVTMPFS="DEVTMPFS is not set in this kernel. Udev will not run."
103
104 linux-info_pkg_setup
105
106 if ! udev_check_KV
107 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
115 then
116 eerror
117 eerror "Your running kernel version (${KV_FULL}) is too old"
118 eerror "for this version of udev."
119 eerror "You must upgrade your kernel or downgrade udev."
120 fi
121 }
122
123 src_prepare()
124 {
125 # backport some patches
126 if [[ -n "${patchset}" ]]
127 then
128 EPATCH_SUFFIX=patch EPATCH_FORCE=yes epatch
129 fi
130
131 # change rules back to group uucp instead of dialout for now
132 sed -e 's/GROUP="dialout"/GROUP="uucp"/' \
133 -i rules/*.rules \
134 || die "failed to change group dialout to uucp"
135
136 if [[ ! -e configure ]]
137 then
138 if use doc
139 then
140 gtkdocize --docdir docs || die "gtkdocize failed"
141 else
142 echo 'EXTRA_DIST =' > docs/gtk-doc.make
143 fi
144 eautoreconf
145 else
146 check_default_rules
147 elibtoolize
148 fi
149 }
150
151 src_configure()
152 {
153 local econf_args
154
155 econf_args=(
156 ac_cv_search_cap_init=
157 ac_cv_header_sys_capability_h=yes
158 DBUS_CFLAGS=' '
159 DBUS_LIBS=' '
160 --docdir=/usr/share/doc/${PF}
161 --libdir=/usr/$(get_libdir)
162 --with-distro=gentoo
163 --with-firmware-path=/usr/lib/firmware/updates:/usr/lib/firmware:/lib/firmware/updates:/lib/firmware
164 --with-html-dir=/usr/share/doc/${PF}/html
165 --with-pci-ids-path=/usr/share/misc/pci.ids
166 --with-rootlibdir=/usr/$(get_libdir)
167 --with-rootprefix=/usr
168 --with-usb-ids-path=/usr/share/misc/usb.ids
169 --disable-audit
170 --disable-coredump
171 --disable-hostnamed
172 --disable-ima
173 --disable-libcryptsetup
174 --disable-localed
175 --disable-logind
176 --disable-nls
177 --disable-pam
178 --disable-quotacheck
179 --disable-readahead
180 --enable-split-usr
181 --disable-tcpwrap
182 --disable-timedated
183 --disable-xz
184 $(use_enable acl)
185 $(use_enable doc gtk-doc)
186 $(use_enable gudev)
187 $(use_enable introspection)
188 $(use_enable keymap)
189 $(use_enable selinux)
190 $(use_enable static-libs static)
191 )
192 econf "${econf_args[@]}"
193 }
194
195 src_compile()
196 {
197 echo 'BUILT_SOURCES: $(BUILT_SOURCES)' > "${T}"/Makefile.extra
198 emake -f Makefile -f "${T}"/Makefile.extra BUILT_SOURCES
199 local targets=(
200 systemd-udevd
201 udevadm
202 libudev.la
203 ata_id
204 cdrom_id
205 collect
206 scsi_id
207 v4l_id
208 accelerometer
209 mtd_probe
210 man/udev.7
211 man/udevadm.8
212 man/systemd-udevd.8
213 man/systemd-udevd.service.8
214 )
215 use keymap && targets+=( keymap )
216 use gudev && targets+=( libgudev-1.0.la )
217
218 emake "${targets[@]}"
219 if use doc
220 then
221 emake -C docs/libudev
222 use gudev && emake -C docs/gudev
223 fi
224 }
225
226 src_install()
227 {
228 local lib_LTLIBRARIES=libudev.la \
229 pkgconfiglib_DATA=src/libudev/libudev.pc
230
231 local targets=(
232 install-libLTLIBRARIES
233 install-includeHEADERS
234 install-libgudev_includeHEADERS
235 install-binPROGRAMS
236 install-rootlibexecPROGRAMS
237 install-udevlibexecPROGRAMS
238 install-dist_systemunitDATA
239 install-dist_udevconfDATA
240 install-dist_udevhomeSCRIPTS
241 install-dist_udevkeymapDATA
242 install-dist_udevkeymapforcerelDATA
243 install-dist_udevrulesDATA
244 install-girDATA
245 install-man7
246 install-man8
247 install-nodist_systemunitDATA
248 install-pkgconfiglibDATA
249 install-sharepkgconfigDATA
250 install-typelibsDATA
251 install-dist_docDATA
252 udev-confdirs
253 systemd-install-hook
254 )
255
256 if use gudev
257 then
258 lib_LTLIBRARIES+=" libgudev-1.0.la"
259 pkgconfiglib_DATA+=" src/gudev/gudev-1.0.pc"
260 fi
261
262 # add final values of variables:
263 targets+=(
264 rootlibexec_PROGRAMS=systemd-udevd
265 bin_PROGRAMS=udevadm
266 lib_LTLIBRARIES="${lib_LTLIBRARIES}"
267 MANPAGES="man/udev.7 man/udevadm.8 man/systemd-udevd.service.8"
268 MANPAGES_ALIAS="man/systemd-udevd.8"
269 dist_systemunit_DATA="units/systemd-udevd-control.socket \
270 units/systemd-udevd-kernel.socket"
271 nodist_systemunit_DATA="units/systemd-udevd.service \
272 units/systemd-udev-trigger.service \
273 units/systemd-udev-settle.service"
274 pkgconfiglib_DATA="${pkgconfiglib_DATA}"
275 )
276 emake DESTDIR="${D}" "${targets[@]}"
277 if use doc
278 then
279 emake -C docs/libudev DESTDIR="${D}" install
280 use gudev && emake -C docs/gudev DESTDIR="${D}" install
281 fi
282 dodoc TODO
283
284 prune_libtool_files --all
285 rm -f "${D}"/usr/lib/udev/rules.d/99-systemd.rules
286 rm -rf "${D}"/usr/share/doc/${PF}/LICENSE.*
287
288 # install gentoo-specific rules
289 insinto /usr/lib/udev/rules.d
290 doins "${FILESDIR}"/40-gentoo.rules
291
292 # install udevadm symlink
293 dosym ../usr/bin/udevadm /sbin/udevadm
294 }
295
296 pkg_preinst()
297 {
298 local htmldir
299 for htmldir in gudev libudev; do
300 if [[ -d ${ROOT}usr/share/gtk-doc/html/${htmldir} ]]
301 then
302 rm -rf "${ROOT}"usr/share/gtk-doc/html/${htmldir}
303 fi
304 if [[ -d ${D}/usr/share/doc/${PF}/html/${htmldir} ]]
305 then
306 dosym ../../doc/${PF}/html/${htmldir} \
307 /usr/share/gtk-doc/html/${htmldir}
308 fi
309 done
310 preserve_old_lib /$(get_libdir)/libudev.so.0
311 }
312
313 # This function determines if a directory is a mount point.
314 # It was lifted from dracut.
315 ismounted()
316 {
317 while read a m a; do
318 [[ $m = $1 ]] && return 0
319 done < "${ROOT}"/proc/mounts
320 return 1
321 }
322
323 pkg_postinst()
324 {
325 mkdir -p "${ROOT}"/run
326
327 # "losetup -f" is confused if there is an empty /dev/loop/, Bug #338766
328 # So try to remove it here (will only work if empty).
329 rmdir "${ROOT}"/dev/loop 2>/dev/null
330 if [[ -d ${ROOT}/dev/loop ]]
331 then
332 ewarn "Please make sure your remove /dev/loop,"
333 ewarn "else losetup may be confused when looking for unused devices."
334 fi
335
336 # people want reminders, I'll give them reminders. Odds are they will
337 # just ignore them anyway...
338
339 # 64-device-mapper.rules now gets installed by sys-fs/device-mapper
340 # remove it if user don't has sys-fs/device-mapper installed, 27 Jun 2007
341 if [[ -f ${ROOT}/etc/udev/rules.d/64-device-mapper.rules ]] &&
342 ! has_version sys-fs/device-mapper
343 then
344 rm -f "${ROOT}"/etc/udev/rules.d/64-device-mapper.rules
345 einfo "Removed unneeded file 64-device-mapper.rules"
346 fi
347
348 # http://bugs.gentoo.org/440462
349 if [[ ${REPLACING_VERSIONS} ]] && [[ ${REPLACING_VERSIONS} < 141 ]]; then
350 ewarn
351 ewarn "If you build an initramfs including udev, please make sure the"
352 ewarn "/usr/bin/udevadm binary gets included, Also, change your scripts to"
353 ewarn "use it, as it replaces the old udevinfo and udevtrigger helpers."
354
355 ewarn
356 ewarn "mount options for /dev are no longer set in /etc/udev/udev.conf."
357 ewarn "Instead, /etc/fstab should be used. This matches other mount points."
358 fi
359
360 if [[ ${REPLACING_VERSIONS} ]] && [[ ${REPLACING_VERSIONS} < 151 ]]; then
361 ewarn
362 ewarn "Rules for /dev/hd* devices have been removed."
363 ewarn "Please migrate to libata."
364 fi
365
366 if [[ ${REPLACING_VERSIONS} ]] && [[ ${REPLACING_VERSIONS} < 189 ]]; then
367 ewarn
368 ewarn "action_modeswitch has been removed by upstream."
369 ewarn "Please use sys-apps/usb_modeswitch."
370
371 if use acl; then
372 ewarn
373 ewarn "The udev-acl functionality has been moved."
374 ewarn "If you are not using systemd, this is handled by ConsoleKit."
375 ewarn "Otherwise, you need to make sure that systemd is emerged with"
376 ewarn "the acl use flag active."
377 fi
378
379 ewarn
380 ewarn "Upstream has removed the persistent-net and persistent-cd rules"
381 ewarn "generator. If you need persistent names for these devices,"
382 ewarn "place udev rules for them in ${ROOT}etc/udev/rules.d."
383 ewarn "Be aware that you cannot directly swap device names, so persistent"
384 ewarn "rules for network devices should be like the ones at the following"
385 ewarn "URL:"
386 ewarn "http://bugs.gentoo.org/show_bug.cgi?id=433746#c1"
387 fi
388
389 if ismounted /usr
390 then
391 ewarn
392 ewarn "Your system has /usr on a separate partition. This means"
393 ewarn "you will need to use an initramfs to pre-mount /usr before"
394 ewarn "udev runs."
395 ewarn "This must be set up before your next reboot, or you may"
396 ewarn "experience failures which are very difficult to troubleshoot."
397 ewarn "For a more detailed explanation, see the following URL:"
398 ewarn "http://www.freedesktop.org/wiki/Software/systemd/separate-usr-is-broken"
399 ewarn
400 ewarn "For more information on setting up an initramfs, see the"
401 ewarn "following URL:"
402 ewarn "http://www.gentoo.org/doc/en/initramfs-guide.xml"
403 fi
404
405 if [[ -d ${ROOT}lib/udev ]]
406 then
407 ewarn
408 ewarn "This version of udev moves the files which were installed in"
409 ewarn "/lib/udev to /usr/lib/udev. We include a backward compatibility"
410 ewarn "patch for gentoo to allow the rules in /lib/udev/rules.d to be"
411 ewarn "read; however, bugs should be filed against packages which are"
412 ewarn "installing things in /lib/udev so they can be fixed."
413 fi
414
415 ewarn
416 ewarn "You need to restart udev as soon as possible to make the upgrade go"
417 ewarn "into effect."
418 ewarn "The method you use to do this depends on your init system."
419
420 preserve_old_lib_notify /$(get_libdir)/libudev.so.0
421
422 elog
423 elog "For more information on udev on Gentoo, writing udev rules, and"
424 elog " fixing known issues visit:"
425 elog " http://www.gentoo.org/doc/en/udev-guide.xml"
426 }

  ViewVC Help
Powered by ViewVC 1.1.20