File udev.spec of Package udev.import4648

#
# spec file for package udev
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           udev
Url:            http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html
Version:        166
Release:        6.<RELEASE7>
License:        LGPLv2.1+
Group:          System/Kernel
Summary:        A rule-based device node and kernel event manager
PreReq:         /bin/pidof /bin/rm /usr/bin/stat %insserv_prereq %fillup_prereq /usr/sbin/groupadd
Conflicts:      aaa_base < 11.2-57
Conflicts:      mkinitrd < 2.5.10-12
Conflicts:      util-linux < 2.16
Conflicts:      ConsoleKit < 0.4.1
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  libselinux-devel libsepol-devel
BuildRequires:  libusb-devel pciutils-ids usbutils
BuildRequires:  gperf libacl-devel pkg-config
BuildRequires:  glib2-devel gobject-introspection-devel
Source0:        ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/%{name}-%{version}.tar.bz2
Source1:        udev-rpmlintrc
Source2:        baselibs.conf
Source60:       boot.udev
Source61:       boot.udev_retry

Patch10:        udev-ata_id.patch

%description
Udev creates and removes device nodes in /dev for devices discovered or
removed from the system. It receives events via kernel netlink messages
and dispatches them according to rules in /lib/udev/rules.d/. Matching
rules may name a device node, create additional symlinks to the node,
call tools to initialize a device, or load needed kernel modules.

%package -n libudev0
License:        LGPLv2.1+
Summary:        Dynamic library to access udev device information
Group:          System/Libraries

%description -n libudev0
This package contains the dynamic library libudev, which provides
access to udev device information

%package -n libudev-devel
License:        LGPLv2.1+
Summary:        Development files for libudev
Group:          Development/Libraries/Other
Requires:       libudev0 = %{version}-%{release}

%description -n libudev-devel
This package contains the development files for the library libudev, a
dynamic library, which provides access to udev device information.

%package -n libgudev-1_0-0
License:        LGPLv2.1+
Summary:        GObject library, to access udev device information
Requires:       libudev0 = %{version}-%{release}
Group:          System/Libraries

%description -n libgudev-1_0-0
This package contains the GObject library libgudev, which provides
access to udev device information.

%package -n libgudev-1_0-devel
License:        LGPLv2.1+
Summary:        Devel package for libgudev
Group:          Development/Libraries/Other
Requires:       libgudev-1_0-0 = %{version}-%{release}
Requires:       libudev-devel = %{version}-%{release}
Requires:       glib2-devel

%description -n libgudev-1_0-devel
This is the devel package for the GObject library libgudev, which
provides GObject access to udev device information.

%prep
%setup -q
%patch10 -p1

%build
# prevent man pages from re-building (xmlto)
find . -name "*.[1-8]" -exec touch '{}' \;
export V=1
%configure \
  --sysconfdir=%{_sysconfdir} \
  --sbindir=/sbin \
  --with-rootlibdir=/%{_lib} \
  --libexecdir=/lib/udev \
  --docdir=%{_docdir}/udev \
  --with-selinux \
  --with-systemdsystemunitdir=/lib/systemd/system \
  CFLAGS="$RPM_OPT_FLAGS"
make %{?_smp_mflags}

%install
make DESTDIR=$RPM_BUILD_ROOT install
rm -f $RPM_BUILD_ROOT/%{_libdir}/libudev.la
rm -f $RPM_BUILD_ROOT/%{_libdir}/libgudev-1.0.la
cp -ax README $RPM_BUILD_ROOT%{_docdir}/udev
%ifarch ppc ppc64
cp rules/arch/40-ppc.rules $RPM_BUILD_ROOT/lib/udev/rules.d/
%endif
%ifarch ia64
cp rules/arch/40-ia64.rules $RPM_BUILD_ROOT/lib/udev/rules.d/
%endif
%ifarch s390 s390x
cp rules/arch/40-s390.rules $RPM_BUILD_ROOT/lib/udev/rules.d/
%endif
install -m755 -D %{S:60} $RPM_BUILD_ROOT/etc/init.d/boot.udev
install -m755 -D %{S:61} $RPM_BUILD_ROOT/etc/init.d/boot.udev_retry
# don't run/short-cut old sysv init script with different name
ln -s udev-retry.service %{buildroot}/lib/systemd/system/udev_retry.service

%pre
/usr/sbin/groupadd -r tape 2> /dev/null || :
# kill daemon if we are not in a chroot
if test -f /proc/1/exe -a -d /proc/1/root; then
	if test "$(stat -Lc '%%D-%%i' /)" = "$(stat -Lc '%%D-%%i' /proc/1/root)"; then
		if test -x /sbin/udevd; then
			kill $(pidof udevd) >/dev/null 2>&1 || :
		fi
	fi
fi

%post
%{fillup_and_insserv -Y boot.udev}
%{fillup_and_insserv -Y boot.udev_retry}
# add KERNEL name match to existing persistent net rules
sed -ri '/KERNEL/ ! { s/NAME="(eth|wlan|ath)([0-9]+)"/KERNEL=="\1*", NAME="\1\2"/}' \
    /etc/udev/rules.d/70-persistent-net.rules >/dev/null 2>&1 || :
# cleanup old stuff
rm -f /etc/sysconfig/udev
rm -f /etc/udev/rules.d/20-cdrom.rules
rm -f /etc/udev/rules.d/55-cdrom.rules
rm -f /etc/udev/rules.d/65-cdrom.rules
# convert old database files
/sbin/udevadm info --convert-db >/dev/null 2>&1 || :
# start daemon if we are not in a chroot
if test -f /proc/1/exe -a -d /proc/1/root; then
	if test "$(stat -Lc '%%D-%%i' /)" = "$(stat -Lc '%%D-%%i' /proc/1/root)"; then
		if test -x /sbin/udevd; then
			/sbin/udevd --daemon >/dev/null 2>&1 || :
		fi
	fi
fi

%postun
%insserv_cleanup

%post -n libudev0 -p /sbin/ldconfig

%postun -n libudev0 -p /sbin/ldconfig

%post -n libgudev-1_0-0 -p /sbin/ldconfig

%postun -n libgudev-1_0-0 -p /sbin/ldconfig

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
/sbin/udevd
/sbin/udevadm
%dir /lib/udev/
/lib/udev/*
%dir /lib/udev/keymaps
/lib/udev/keymaps/*
/lib/udev/keyboard-force-release.sh
%dir /lib/udev/rules.d/
/lib/udev/rules.d/*.rules
%{_sysconfdir}/init.d/boot.udev
%{_sysconfdir}/init.d/boot.udev_retry
%dir %{_sysconfdir}/udev/
%dir %{_sysconfdir}/udev/rules.d/
%config(noreplace) %{_sysconfdir}/udev/udev.conf
%dir %{_prefix}/lib/ConsoleKit
%dir %{_prefix}/lib/ConsoleKit/run-seat.d
%{_prefix}/lib/ConsoleKit/run-seat.d/udev-acl.ck
%{_mandir}/man?/*.[0-9]*
%{_datadir}/pkgconfig/udev.pc
%doc %{_docdir}/udev
%dir /lib/udev/devices/
%dir /lib/systemd/system
/lib/systemd/system/udev*.service
%dir /lib/systemd/system/basic.target.wants
/lib/systemd/system/basic.target.wants/udev*.service

%files -n libudev0
%defattr(-,root,root)
/%{_lib}/libudev.so.*

%files -n libudev-devel
%defattr(-,root,root)
%{_includedir}/libudev.h
%{_libdir}/libudev.so
%{_libdir}/pkgconfig/libudev.pc
%dir %{_datadir}/gtk-doc
%dir %{_datadir}/gtk-doc/html
%dir %{_datadir}/gtk-doc/html/libudev
%{_datadir}/gtk-doc/html/libudev/*

%files -n libgudev-1_0-0
%defattr(-,root,root)
/%{_lib}/libgudev-1.0.so.*
%{_libdir}/girepository-1.0/GUdev-1.0.typelib

%files -n libgudev-1_0-devel
%defattr(-,root,root)
%dir %{_includedir}/gudev-1.0
%dir %{_includedir}/gudev-1.0/gudev
%{_includedir}/gudev-1.0/gudev/*.h
%{_libdir}/libgudev-1.0.so
%{_libdir}/pkgconfig/gudev-1.0.pc
%dir %{_datadir}/gtk-doc
%dir %{_datadir}/gtk-doc/html
%dir %{_datadir}/gtk-doc/html/gudev
%{_datadir}/gtk-doc/html/gudev/*
%{_datadir}/gir-1.0/GUdev-1.0.gir

%changelog
openSUSE Build Service is sponsored by