--- /usr/portage/sys-fs/udev/udev-200.ebuild 2013-04-04 15:01:30.000000000 +0200 +++ udev-200.ebuild 2013-04-02 15:46:46.144568325 +0200 @@ -1,6 +1,6 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/udev-200.ebuild,v 1.15 2013/04/04 12:53:32 ssuominen Exp $ +# $Header: $ EAPI=5 @@ -11,20 +11,20 @@ KV_min=2.6.32 fi -inherit autotools eutils linux-info multilib toolchain-funcs versionator +inherit autotools eutils linux-info multilib systemd toolchain-funcs versionator flag-o-matic if [[ ${PV} = 9999* ]]; then EGIT_REPO_URI="git://anongit.freedesktop.org/systemd/systemd" inherit git-2 else - patchset=1 + patchset= #3 SRC_URI="http://www.freedesktop.org/software/systemd/systemd-${PV}.tar.xz" if [[ -n "${patchset}" ]]; then SRC_URI="${SRC_URI} http://dev.gentoo.org/~ssuominen/${P}-patches-${patchset}.tar.xz http://dev.gentoo.org/~williamh/dist/${P}-patches-${patchset}.tar.xz" fi - KEYWORDS="alpha amd64 arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 sh sparc x86" + KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86" fi DESCRIPTION="Linux dynamic and persistent device naming support (aka userspace devfs)" @@ -32,7 +32,7 @@ LICENSE="LGPL-2.1 MIT GPL-2" SLOT="0" -IUSE="acl doc +firmware-loader gudev hwdb introspection keymap +kmod +openrc selinux static-libs" +IUSE="acl doc firmware-loader gudev hwdb introspection keymap +kmod +openrc selinux static-libs logind" RESTRICT="test" @@ -43,11 +43,9 @@ kmod? ( >=sys-apps/kmod-12 ) selinux? ( >=sys-libs/libselinux-2.1.9 ) !=dev-util/intltool-0.50" fi @@ -76,8 +76,6 @@ S=${WORKDIR}/systemd-${PV} -#QA_MULTILIB_PATHS="lib/systemd/systemd-udevd" - udev_check_KV() { if kernel_is lt ${KV_min//./ }; then return 1 @@ -127,7 +125,7 @@ fi # gperf disable if keymaps are not requested wrt bug #452760 - if ! [[ $(grep -i gperf Makefile.am | wc -l) -eq 27 ]]; then + if ! [[ $(grep -i gperf Makefile.am | wc -l) -eq 27 ]]; then eerror "The line count for gperf references failed, see bug 452760" die fi @@ -140,7 +138,7 @@ # These are missing from upstream 50-udev-default.rules cat <<-EOF > "${T}"/40-gentoo.rules - # Gentoo specific usb group + # see src_prepare() for content of these files SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="usb" # Keep this for Linux 2.6.32 kernels with accept4() support like .60 wrt #457868 SUBSYSTEM=="mem", KERNEL=="null|zero|full|random|urandom", MODE="0666" @@ -163,12 +161,27 @@ version_is_at_least 4.6 $(gcc-version) || \ sed -i 's:static_assert:alsdjflkasjdfa:' src/shared/macro.h + find . -type f -name "*.[hc]" -exec sed -i.ori 's:/cgroup/systemd:/cgroup/daemon:g' {} + + find . -type f -name "*.[hc]" -exec sed -i.ori 's:/run/systemd:/var/run/systemd:g' {} + + find . -type f -name "*.[hc]" -exec sed -i.ori 's:name=systemd:name=daemon:g' {} + + find . -type f -name "*.[hc]" -exec sed -i.ori 's:systemd-udevd:udevd:g' {} + + find . -type f -name "*.[hc]" -exec sed -i.ori 's:/run/udev:/var/run/udev:g' {} + + #epatch "${FILESDIR}/${P}"-run-to-var.patch || die + + epatch "${FILESDIR}/${PN}"-198-logind.patch || die + epatch "${FILESDIR}/${PN}"-198-nosystemd-daemon-makefile.patch || die + # change rules back to group uucp instead of dialout for now wrt #454556 sed -e 's/GROUP="dialout"/GROUP="uucp"/' \ -i rules/*.rules \ || die "failed to change group dialout to uucp" - if [[ ! -e configure ]]; then + if ! use elibc_glibc; then #443030 + echo '#define secure_getenv(x) NULL' >> config.h.in + sed -i -e '/error.*secure_getenv/s:.*:#define secure_getenv(x) NULL:' src/shared/missing.h || die + fi + + if [ ! -e configure ]; then if use doc; then gtkdocize --docdir docs || die "gtkdocize failed" else @@ -178,33 +191,38 @@ else check_default_rules elibtoolize - fi - - if ! use elibc_glibc; then #443030 - echo '#define secure_getenv(x) NULL' >> config.h.in - sed -i -e '/error.*secure_getenv/s:.*:#define secure_getenv(x) NULL:' src/shared/missing.h || die + eautomake fi # link udevd(8) to systemd-udevd.service(8) manpage - echo '.so systemd-udevd.service.8' > "${T}"/udevd.8 + #echo '.so systemd-udevd.service.8' > "${T}"/udevd.8 } src_configure() { - tc-export CC #463846 use keymap || export ac_cv_path_GPERF=true #452760 + # alternative: systemd daemon NOPs when -DDISABLE_SYSTEMD is set + # also not for logind, but does not harm. + + append-cppflags -DDISABLE_SYSTEMD + local econf_args + use logind && CPPFLAGS="${CPPFLAGS} -DDISABLE_SD_DAEMON" econf_args=( - ac_cv_search_cap_init= - ac_cv_header_sys_capability_h=yes - DBUS_CFLAGS=' ' - DBUS_LIBS=' ' --bindir=/bin --docdir=/usr/share/doc/${PF} - --libdir=/usr/$(get_libdir) + --libdir=/$(get_libdir) + --libexecdir=/lib + --prefix=/ + --exec-prefix=/ + --includedir=/usr/include + --datarootdir=/usr/share + --localstatedir=/var + --with-dbuspolicydir=/usr/dbus-1/system.d + --libdir=/$(get_libdir) --with-html-dir=/usr/share/doc/${PF}/html - --with-rootprefix= + --with-rootprefix=/ --with-rootlibdir=/$(get_libdir) --with-bashcompletiondir=/usr/share/bash-completion --without-python @@ -214,7 +232,18 @@ --disable-ima --disable-libcryptsetup --disable-localed - --disable-logind + $(use_enable logind) + --disable-efi + --disable-chkconfig + --disable-xattr + --disable-gcrypt + --disable-qrencode + --disable-microhttpd + --disable-binfmt + --disable-vconsole + --disable-bootchart + --disable-randomseed + --enable-blkid --disable-myhostname --disable-nls --disable-pam @@ -224,6 +253,7 @@ --disable-tcpwrap --disable-timedated --disable-xz + --disable-silent-rules --disable-polkit $(use_enable acl) $(use_enable doc gtk-doc) @@ -233,30 +263,38 @@ $(use_enable selinux) $(use_enable static-libs static) ) + if use introspection; then econf_args+=( --enable-introspection=$(usex introspection) ) fi + if use firmware-loader; then econf_args+=( - --with-firmware-path="/lib/firmware/updates:/lib/firmware" + --with-firmware-path=/lib/firmware/updates:/lib/firmware + ) + fi + + if ! use logind; then + econf_args+=( + DBUS_CFLAGS=' ' + DBUS_LIBS=' ' + ac_cv_search_cap_init= + ac_cv_header_sys_capability_h=yes ) fi - econf "${econf_args[@]}" + econf "${econf_args[@]}" ${CPPFLAGS:+CPPFLAGS="${CPPFLAGS}"} } src_compile() { echo 'BUILT_SOURCES: $(BUILT_SOURCES)' > "${T}"/Makefile.extra emake -f Makefile -f "${T}"/Makefile.extra BUILT_SOURCES - local pretargets=( - libsystemd-shared.la - libudev-private.la - libudev.la - ) local targets=( + libudev-private.la systemd-udevd udevadm + libudev.la ata_id cdrom_id collect @@ -269,11 +307,18 @@ man/systemd-udevd.8 man/systemd-udevd.service.8 ) + if use logind; then + targets+=( + systemd-logind + loginctl + man/loginctl.1 + man/systemd-logind.8 + ) + fi use keymap && targets+=( keymap ) use gudev && targets+=( libgudev-1.0.la ) - emake "${pretargets[@]}" - emake "${targets[@]}" + emake udevlibexecdir=/$(get_libdir)/udev "${targets[@]}" if use doc; then emake -C docs/libudev use gudev && emake -C docs/gudev @@ -291,14 +336,17 @@ install-binPROGRAMS install-rootlibexecPROGRAMS install-udevlibexecPROGRAMS + install-dist_systemunitDATA install-dist_udevconfDATA install-dist_udevhomeSCRIPTS install-dist_udevkeymapDATA install-dist_udevkeymapforcerelDATA install-dist_udevrulesDATA install-girDATA + install-man3 install-man7 install-man8 + install-nodist_systemunitDATA install-pkgconfiglibDATA install-sharepkgconfigDATA install-typelibsDATA @@ -308,6 +356,19 @@ install-dist_bashcompletionDATA ) + if use logind; then + targets+=( + install-pkgincludeHEADERS + libsystemd-login-install-hook + install-man1 + install-man5 + install-nodist_udevrulesDATA + install-dist_dbuspolicyDATA + ) + pkgconfiglib_DATA+=" src/login/libsystemd-login.pc" + lib_LTLIBRARIES+=" libsystemd-login.la" + fi + if use gudev; then lib_LTLIBRARIES+=" libgudev-1.0.la" pkgconfiglib_DATA+=" src/gudev/gudev-1.0.pc" @@ -315,18 +376,35 @@ # add final values of variables: targets+=( + udevlibexecdir=/lib/udev rootlibexec_PROGRAMS=systemd-udevd bin_PROGRAMS=udevadm lib_LTLIBRARIES="${lib_LTLIBRARIES}" MANPAGES="man/udev.7 man/udevadm.8 \ man/systemd-udevd.service.8" MANPAGES_ALIAS="man/systemd-udevd.8" + dist_systemunit_DATA="units/systemd-udevd-control.socket \ + units/systemd-udevd-kernel.socket" + nodist_systemunit_DATA="units/systemd-udevd.service \ + units/systemd-udev-trigger.service \ + units/systemd-udev-settle.service" pkgconfiglib_DATA="${pkgconfiglib_DATA}" + systemunitdir="$(systemd_get_unitdir)" INSTALL_DIRS='$(sysconfdir)/udev/rules.d \ $(sysconfdir)/udev/hwdb.d' dist_bashcompletion_DATA="shell-completion/bash/udevadm" + ) + if use logind; then + targets+=( + dist_pkgsysconf_DATA+="src/login/logind.conf" + rootlibexec_PROGRAMS+="systemd-logind" + bin_PROGRAMS+="loginctl" + MANPAGES+="man/loginctl.1 man/logind.conf.5" + ) + fi emake -j1 DESTDIR="${D}" "${targets[@]}" + if use doc; then emake -C docs/libudev DESTDIR="${D}" install use gudev && emake -C docs/gudev DESTDIR="${D}" install @@ -338,18 +416,63 @@ "${D}"/lib/udev/rules.d/99-systemd.rules \ "${D}"/usr/share/doc/${PF}/LICENSE.* - # see src_prepare() for content of these files + # install gentoo-specific rules insinto /lib/udev/rules.d doins "${T}"/40-gentoo.rules - doman "${T}"/udevd.8 - # install udevadm compatibility symlink - dosym {../bin,sbin}/udevadm + dodir /usr/$(get_libdir) + mv ${D:-:}/$(get_libdir)/pkgconfig ${D}/usr/$(get_libdir) + + gen_usr_ldscript libudev.so + + dodir /sbin + + if [ -x ${D}/bin/udevadm ]; then + mv ${D}/bin/udevadm ${D}/sbin/udevadm + fi + # udevadm is now in /usr/bin. <--- I can't believe it !! + dosym /sbin/udevadm /bin/udevadm + + dodir /$(get_libdir)/udev + + # move udevd where it should be and remove unlogical /lib/systemd + mv "${ED}"/lib/systemd/systemd-udevd "${ED}"/sbin/udevd || die + rm -r "${ED}"/lib/systemd + rm -r "${ED}"/usr/lib/systemd + + # create symlinks for these utilities to /sbin + # where multipath-tools expect them to be (Bug #168588) + dosym /lib/udev/scsi_id /sbin/scsi_id + + dosym /var/run /run + mv ${D}/usr/share/man/man8/systemd-udevd.service.8 ${D}/usr/share/man/man8/udevd.8 - # install udevd to /sbin and remove empty and redudant directory - # /lib/systemd because systemd is installed to /usr wrt #462750 - mv "${D}"/{lib/systemd/systemd-,sbin/}udevd || die - rm -r "${D}"/lib/systemd + rm ${D}/usr/share/man/man8/systemd-udevd.8 + + local manuals + if use logind; then + manuals="man5/logind.conf.5 man1/loginctl.1" + fi + + local man + for man in man7/udevd.7 man8/udevd.8 man8/udevadm.8 ${manuals}; do + sed -i 's:\\fBsystem.*\\fR(1),::' ${D}/usr/share/man/${man} + sed -i 's:systemd-\([^\.]*\)\.service:\1:g' ${D}/usr/share/man/${man} + sed -i 's:systemd\\-::g' ${D}/usr/share/man/${man} + sed -i '/^\.TH/s:systemd:version:' ${D}/usr/share/man/${man} + done + + # see src_prepare() where this is created + #doman "${T}"/udevd.8 + + if use logind; then +# rm -f "${D}"/usr/dbus-1/system.d/org.freedesktop.systemd1.conf + exeinto /$(get_libdir)/udev + doexe ./.libs/systemd-logind + mv ${D}/$(get_libdir)/udev/systemd-logind ${D}/sbin/logind + insinto /etc/systemd + doins src/login/logind.conf + fi } pkg_preinst() { @@ -366,13 +489,22 @@ preserve_old_lib /{,usr/}$(get_libdir)/libudev$(get_libname 0) } +# This function determines if a directory is a mount point. +# It was lifted from dracut. +ismounted() { + while read a m a; do + [[ $m = $1 ]] && return 0 + done < "${ROOT}"/proc/mounts + return 1 +} + pkg_postinst() { - mkdir -p "${ROOT}"run + mkdir -p "${ROOT}"/run # "losetup -f" is confused if there is an empty /dev/loop/, Bug #338766 # So try to remove it here (will only work if empty). - rmdir "${ROOT}"dev/loop 2>/dev/null - if [[ -d ${ROOT}dev/loop ]]; then + rmdir "${ROOT}"/dev/loop 2>/dev/null + if [[ -d ${ROOT}/dev/loop ]]; then ewarn "Please make sure your remove /dev/loop," ewarn "else losetup may be confused when looking for unused devices." fi @@ -388,7 +520,25 @@ einfo "Removed unneeded file ${old_dm_rules}" fi - local fstab="${ROOT}"etc/fstab dev path fstype rest + if ismounted /usr; then + ewarn + ewarn "Your system has /usr on a separate partition. This means" + ewarn "you will need to use an initramfs to pre-mount /usr before" + ewarn "udev runs." + ewarn + ewarn "If this is not set up before your next reboot, udev may work;" + ewarn "However, you also may experience failures which are very" + ewarn "difficult to troubleshoot." + ewarn + ewarn "For a more detailed explanation, see the following URL:" + ewarn "http://www.freedesktop.org/wiki/Software/systemd/separate-usr-is-broken" + ewarn + ewarn "For more information on setting up an initramfs, see the" + ewarn "following URL:" + ewarn "http://www.gentoo.org/doc/en/initramfs-guide.xml" + fi + + local fstab="${ROOT}"/etc/fstab dev path fstype rest while read -r dev path fstype rest; do if [[ ${path} == /dev && ${fstype} != devtmpfs ]]; then ewarn "You need to edit your /dev line in ${fstab} to have devtmpfs" @@ -397,7 +547,7 @@ fi done < "${fstab}" - if [[ -d ${ROOT}usr/lib/udev ]]; then + if [[ -d ${ROOT}/usr/lib/udev ]]; then ewarn ewarn "Please re-emerge all packages on your system which install" ewarn "rules and helpers in /usr/lib/udev. They should now be in" @@ -408,7 +558,7 @@ ewarn "Note that qfile can be found in app-portage/portage-utils" fi - local old_net_name="${ROOT}"etc/udev/rules.d/80-net-name-slot.rules + local old_net_name="${ROOT}"/etc/udev/rules.d/80-net-name-slot.rules if [[ -f ${old_net_name} ]]; then local old_net_sum=bebf4bd1b6b668e9ff34a3999aa6ff32 MD5=$(md5sum < "${old_net_name}") @@ -420,8 +570,8 @@ fi fi - local old_cd_rules="${ROOT}"etc/udev/rules.d/70-persistent-cd.rules - local old_net_rules="${ROOT}"etc/udev/rules.d/70-persistent-net.rules + local old_cd_rules="${ROOT}"/etc/udev/rules.d/70-persistent-cd.rules + local old_net_rules="${ROOT}"/etc/udev/rules.d/70-persistent-net.rules for old_rules in "${old_cd_rules}" "${old_net_rules}"; do if [[ -f ${old_rules} ]]; then ewarn @@ -445,7 +595,7 @@ ewarn "(replace with, for example, eth0):" ewarn "# udevadm test-builtin net_id /sys/class/net/ 2> /dev/null" ewarn - ewarn "You can use kernel commandline net.ifnames=0 to disable this feature." + ewarn "You can use kernel command net.ifnames= to control this feature." ewarn ewarn "You need to restart udev as soon as possible to make the upgrade go" @@ -455,13 +605,13 @@ preserve_old_lib_notify /{,usr/}$(get_libdir)/libudev$(get_libname 0) elog - elog "For more information on udev on Gentoo, upgrading, writing udev rules, and" + elog "For more information on udev on Gentoo, writing udev rules, and" elog " fixing known issues visit:" - elog " http://wiki.gentoo.org/wiki/Udev/upgrade" elog " http://www.gentoo.org/doc/en/udev-guide.xml" - # Update hwdb database in case the format is changed by udev version. - if use hwdb && has_version 'sys-apps/hwids[udev]'; then + # Keep this here in case the database format changes so it gets updated + # when required. Despite that this file is owned by sys-apps/hwids. + if use hwdb && has_version sys-apps/hwids; then udevadm hwdb --update --root="${ROOT%/}" fi }