diff options
Diffstat (limited to 'sys-fs')
-rw-r--r-- | sys-fs/eudev/ChangeLog | 7 | ||||
-rw-r--r-- | sys-fs/eudev/eudev-1.7.ebuild | 265 | ||||
-rw-r--r-- | sys-fs/eudev/eudev-1.8.ebuild | 273 | ||||
-rw-r--r-- | sys-fs/eudev/files/eudev-fix-typo-util.c.patch | 28 | ||||
-rw-r--r-- | sys-fs/eudev/files/eudev-hwdb-offset-root.patch | 212 |
5 files changed, 6 insertions, 779 deletions
diff --git a/sys-fs/eudev/ChangeLog b/sys-fs/eudev/ChangeLog index be9560337e1c..1cdf150165aa 100644 --- a/sys-fs/eudev/ChangeLog +++ b/sys-fs/eudev/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for sys-fs/eudev # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/eudev/ChangeLog,v 1.127 2014/07/19 17:34:03 jer Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-fs/eudev/ChangeLog,v 1.128 2014/07/25 12:04:22 blueness Exp $ + + 25 Jul 2014; Anthony G. Basile <blueness@gentoo.org> -eudev-1.7.ebuild, + -eudev-1.8.ebuild, -files/eudev-fix-typo-util.c.patch, + -files/eudev-hwdb-offset-root.patch: + Remove older unstable versions 19 Jul 2014; Jeroen Roovers <jer@gentoo.org> eudev-1.9-r1.ebuild: Stable for HPPA (bug #516524). diff --git a/sys-fs/eudev/eudev-1.7.ebuild b/sys-fs/eudev/eudev-1.7.ebuild deleted file mode 100644 index 92a1c256f001..000000000000 --- a/sys-fs/eudev/eudev-1.7.ebuild +++ /dev/null @@ -1,265 +0,0 @@ -# Copyright 1999-2014 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/eudev/eudev-1.7.ebuild,v 1.3 2014/06/24 22:17:02 mgorny Exp $ - -EAPI="5" - -KV_min=2.6.39 - -inherit autotools eutils multilib linux-info multilib-minimal - -if [[ ${PV} = 9999* ]]; then - EGIT_REPO_URI="git://github.com/gentoo/eudev.git" - inherit git-2 -else - SRC_URI="http://dev.gentoo.org/~blueness/${PN}/${P}.tar.gz" - KEYWORDS="~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~x86" -fi - -DESCRIPTION="Linux dynamic and persistent device naming support (aka userspace devfs)" -HOMEPAGE="https://github.com/gentoo/eudev" - -LICENSE="LGPL-2.1 MIT GPL-2" -SLOT="0" -IUSE="doc gudev +hwdb kmod introspection +keymap +modutils +openrc +rule-generator selinux static-libs test" - -COMMON_DEPEND=">=sys-apps/util-linux-2.20 - gudev? ( >=dev-libs/glib-2.34.3:2[${MULTILIB_USEDEP}] ) - introspection? ( >=dev-libs/gobject-introspection-1.31.1 ) - kmod? ( >=sys-apps/kmod-16 ) - selinux? ( >=sys-libs/libselinux-2.1.9 ) - !<sys-libs/glibc-2.11 - !sys-apps/gentoo-systemd-integration - !sys-apps/systemd - abi_x86_32? ( - !<=app-emulation/emul-linux-x86-baselibs-20130224-r7 - !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] - )" -DEPEND="${COMMON_DEPEND} - keymap? ( dev-util/gperf ) - virtual/os-headers - virtual/pkgconfig - >=sys-devel/make-3.82-r4 - >=sys-kernel/linux-headers-${KV_min} - doc? ( >=dev-util/gtk-doc-1.18 ) - app-text/docbook-xml-dtd:4.2 - app-text/docbook-xml-dtd:4.5 - app-text/docbook-xsl-stylesheets - dev-libs/libxslt - >=dev-util/intltool-0.50 - test? ( app-text/tree dev-lang/perl )" - -RDEPEND="${COMMON_DEPEND} - !<sys-fs/lvm2-2.02.103 - !<sec-policy/selinux-base-2.20120725-r10 - !sys-fs/udev - !sys-apps/systemd" - -PDEPEND="hwdb? ( >=sys-apps/hwids-20140304[udev] ) - keymap? ( >=sys-apps/hwids-20140304[udev] ) - openrc? ( >=sys-fs/udev-init-scripts-26 )" - -REQUIRED_USE="keymap? ( hwdb )" - -# The multilib-build.eclass doesn't handle situation where the installed headers -# are different in ABIs. In this case, we install libgudev headers in native -# ABI but not for non-native ABI. -multilib_check_headers() { :; } - -pkg_pretend() { - if ! use rule-generator; then - ewarn - ewarn "As of 2013-01-29, ${P} provides the new interface renaming functionality," - ewarn "as described in the URL below:" - ewarn "http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames" - ewarn - ewarn "This functionality is enabled BY DEFAULT because eudev has no means of synchronizing" - ewarn "between the default or user-modified choice of sys-fs/udev. If you wish to disable" - ewarn "this new iface naming, please be sure that /etc/udev/rules.d/80-net-name-slot.rules" - ewarn "exists:" - ewarn "\ttouch /etc/udev/rules.d/80-net-name-slot.rules" - ewarn - ewarn "We are working on a better solution for the next beta release." - ewarn - fi -} - -pkg_setup() { - CONFIG_CHECK="~BLK_DEV_BSG ~DEVTMPFS ~!IDE ~INOTIFY_USER ~!SYSFS_DEPRECATED ~!SYSFS_DEPRECATED_V2 ~SIGNALFD ~EPOLL ~FHANDLE ~NET" - linux-info_pkg_setup - get_running_version - - # These are required kernel options, but we don't error out on them - # because you can build under one kernel and run under another. - if kernel_is lt ${KV_min//./ }; then - ewarn - ewarn "Your current running kernel version ${KV_FULL} is too old to run ${P}." - ewarn "Make sure to run udev under kernel version ${KV_min} or above." - ewarn - fi -} - -src_prepare() { - # change rules back to group uucp instead of dialout for now - sed -e 's/GROUP="dialout"/GROUP="uucp"/' -i rules/*.rules \ - || die "failed to change group dialout to uucp" - - epatch_user - - if [[ ! -e configure ]]; then - if use doc; then - gtkdocize --docdir docs || die "gtkdocize failed" - else - echo 'EXTRA_DIST =' > docs/gtk-doc.make - fi - eautoreconf - else - elibtoolize - fi -} - -multilib_src_configure() { - tc-export CC #463846 - export cc_cv_CFLAGS__flto=no #502950 - - # Keep sorted by ./configure --help and only pass --disable flags - # when *required* to avoid external deps or unnecessary compile - local econf_args - econf_args=( - ac_cv_search_cap_init= - ac_cv_header_sys_capability_h=yes - DBUS_CFLAGS=' ' - DBUS_LIBS=' ' - --with-rootprefix= - --docdir=/usr/share/doc/${PF} - --libdir=/usr/$(get_libdir) - --with-firmware-path="${EPREFIX}usr/lib/firmware/updates:${EPREFIX}usr/lib/firmware:${EPREFIX}lib/firmware/updates:${EPREFIX}lib/firmware" - --with-html-dir="/usr/share/doc/${PF}/html" - --enable-split-usr - --exec-prefix=/ - - $(use_enable gudev) - ) - - # Only build libudev for non-native_abi, and only install it to libdir, - # that means all options only apply to native_abi - if multilib_is_native_abi; then - econf_args+=( - --with-rootlibdir=/$(get_libdir) - $(use_enable doc gtk-doc) - $(use_enable introspection) - $(use_enable keymap) - $(use_enable kmod libkmod) - $(usex kmod --enable-modules $(use_enable modutils modules)) - $(use_enable static-libs static) - $(use_enable selinux) - $(use_enable rule-generator) - ) - else econf_args+=( - $(echo --disable-{gtk-doc,introspection,keymap,libkmod,modules,static,selinux,rule-generator}) - ) - fi - ECONF_SOURCE="${S}" econf "${econf_args[@]}" -} - -multilib_src_compile() { - if multilib_is_native_abi; then - emake - else - emake -C src/libudev - use gudev && emake -C src/gudev - fi -} - -multilib_src_install() { - if multilib_is_native_abi; then - emake DESTDIR="${D}" install - else - emake -C src/libudev DESTDIR="${D}" install - use gudev && emake -C src/gudev DESTDIR="${D}" install - fi -} - -multilib_src_test() { - # make sandbox get out of the way - # these are safe because there is a fake root filesystem put in place, - # but sandbox seems to evaluate the paths of the test i/o instead of the - # paths of the actual i/o that results. - # also only test for native abi - if multilib_is_native_abi; then - addread /sys - addwrite /dev - addwrite /run - default_src_test - fi -} - -multilib_src_install_all() { - prune_libtool_files --all - rm -rf "${ED}"/usr/share/doc/${PF}/LICENSE.* - - use rule-generator && use openrc && doinitd "${FILESDIR}"/udev-postmount - - # drop distributed hwdb files, they override sys-apps/hwids - rm -f "${ED}"/etc/udev/hwdb.d/*.hwdb - - insinto /lib/udev/rules.d - doins "${FILESDIR}"/40-gentoo.rules -} - -pkg_preinst() { - local htmldir - for htmldir in gudev libudev; do - if [[ -d ${EROOT}usr/share/gtk-doc/html/${htmldir} ]]; then - rm -rf "${EROOT}"usr/share/gtk-doc/html/${htmldir} - fi - if [[ -d ${ED}/usr/share/doc/${PF}/html/${htmldir} ]]; then - dosym ../../doc/${PF}/html/${htmldir} \ - /usr/share/gtk-doc/html/${htmldir} - fi - done -} - -pkg_postinst() { - mkdir -p "${EROOT}"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 "${EROOT}"dev/loop 2>/dev/null - if [[ -d ${EROOT}dev/loop ]]; then - ewarn "Please make sure your remove /dev/loop," - ewarn "else losetup may be confused when looking for unused devices." - fi - - if use hwdb && has_version 'sys-apps/hwids[udev]'; then - udevadm hwdb --update --root="${ROOT%/}" - - # http://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda - # reload database after it has be rebuilt, but only if we are not upgrading - # also pass if we are -9999 since who knows what hwdb related changes there might be - if [[ ${REPLACING_VERSIONS%-r*} == ${PV} || -z ${REPLACING_VERSIONS} ]] && \ - [[ ${ROOT%/} == "" ]] && [[ ${PV} != "9999" ]]; then - udevadm control --reload - fi - fi - - ewarn - ewarn "You need to restart eudev as soon as possible to make the" - ewarn "upgrade go into effect:" - ewarn "\t/etc/init.d/udev --nodeps restart" - - if use rule-generator && use openrc && \ - [[ -x $(type -P rc-update) ]] && rc-update show | grep udev-postmount | grep -qsv 'boot\|default\|sysinit'; then - ewarn - ewarn "Please add the udev-postmount init script to your default runlevel" - ewarn "to ensure the legacy rule-generator functionality works as reliably" - ewarn "as possible." - ewarn "\trc-update add udev-postmount default" - fi - - elog - elog "For more information on eudev on Gentoo, writing udev rules, and" - elog "fixing known issues visit:" - elog " http://www.gentoo.org/doc/en/udev-guide.xml" - elog -} diff --git a/sys-fs/eudev/eudev-1.8.ebuild b/sys-fs/eudev/eudev-1.8.ebuild deleted file mode 100644 index 5b3c7edbc1ea..000000000000 --- a/sys-fs/eudev/eudev-1.8.ebuild +++ /dev/null @@ -1,273 +0,0 @@ -# Copyright 1999-2014 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/eudev/eudev-1.8.ebuild,v 1.3 2014/06/27 20:39:40 blueness Exp $ - -EAPI="5" - -KV_min=2.6.39 - -inherit autotools eutils multilib linux-info multilib-minimal - -if [[ ${PV} = 9999* ]]; then - EGIT_REPO_URI="git://github.com/gentoo/eudev.git" - inherit git-2 -else - SRC_URI="http://dev.gentoo.org/~blueness/${PN}/${P}.tar.gz" - KEYWORDS="~amd64 ~arm ~hppa ~mips ~ppc ~ppc64 ~x86" -fi - -DESCRIPTION="Linux dynamic and persistent device naming support (aka userspace devfs)" -HOMEPAGE="https://github.com/gentoo/eudev" - -LICENSE="LGPL-2.1 MIT GPL-2" -SLOT="0" -IUSE="doc gudev +hwdb +kmod introspection +keymap +modutils +openrc +rule-generator selinux static-libs test" - -COMMON_DEPEND=">=sys-apps/util-linux-2.20 - gudev? ( >=dev-libs/glib-2.34.3:2[${MULTILIB_USEDEP}] ) - introspection? ( >=dev-libs/gobject-introspection-1.31.1 ) - kmod? ( >=sys-apps/kmod-16 ) - selinux? ( >=sys-libs/libselinux-2.1.9 ) - !<sys-libs/glibc-2.11 - !sys-apps/gentoo-systemd-integration - !sys-apps/systemd - abi_x86_32? ( - !<=app-emulation/emul-linux-x86-baselibs-20130224-r7 - !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] - )" -DEPEND="${COMMON_DEPEND} - keymap? ( dev-util/gperf ) - virtual/os-headers - virtual/pkgconfig - >=sys-devel/make-3.82-r4 - >=sys-kernel/linux-headers-${KV_min} - doc? ( >=dev-util/gtk-doc-1.18 ) - app-text/docbook-xml-dtd:4.2 - app-text/docbook-xml-dtd:4.5 - app-text/docbook-xsl-stylesheets - dev-libs/libxslt - >=dev-util/intltool-0.50 - test? ( app-text/tree dev-lang/perl )" - -RDEPEND="${COMMON_DEPEND} - !<sys-fs/lvm2-2.02.103 - !<sec-policy/selinux-base-2.20120725-r10 - !sys-fs/udev - !sys-apps/systemd" - -PDEPEND="hwdb? ( >=sys-apps/hwids-20140304[udev] ) - keymap? ( >=sys-apps/hwids-20140304[udev] ) - openrc? ( >=sys-fs/udev-init-scripts-26 )" - -REQUIRED_USE="keymap? ( hwdb )" - -# The multilib-build.eclass doesn't handle situation where the installed headers -# are different in ABIs. In this case, we install libgudev headers in native -# ABI but not for non-native ABI. -multilib_check_headers() { :; } - -pkg_pretend() { - if ! use rule-generator; then - ewarn - ewarn "As of 2013-01-29, ${P} provides the new interface renaming functionality," - ewarn "as described in the URL below:" - ewarn "http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames" - ewarn - ewarn "This functionality is enabled BY DEFAULT because eudev has no means of synchronizing" - ewarn "between the default or user-modified choice of sys-fs/udev. If you wish to disable" - ewarn "this new iface naming, please be sure that /etc/udev/rules.d/80-net-name-slot.rules" - ewarn "exists:" - ewarn "\ttouch /etc/udev/rules.d/80-net-name-slot.rules" - ewarn - ewarn "We are working on a better solution for the next beta release." - ewarn - fi -} - -pkg_setup() { - CONFIG_CHECK="~BLK_DEV_BSG ~DEVTMPFS ~!IDE ~INOTIFY_USER ~!SYSFS_DEPRECATED ~!SYSFS_DEPRECATED_V2 ~SIGNALFD ~EPOLL ~FHANDLE ~NET" - linux-info_pkg_setup - get_running_version - - # These are required kernel options, but we don't error out on them - # because you can build under one kernel and run under another. - if kernel_is lt ${KV_min//./ }; then - ewarn - ewarn "Your current running kernel version ${KV_FULL} is too old to run ${P}." - ewarn "Make sure to run udev under kernel version ${KV_min} or above." - ewarn - fi -} - -src_prepare() { - # change rules back to group uucp instead of dialout for now - sed -e 's/GROUP="dialout"/GROUP="uucp"/' -i rules/*.rules \ - || die "failed to change group dialout to uucp" - - epatch_user - - if [[ ! -e configure ]]; then - if use doc; then - gtkdocize --docdir docs || die "gtkdocize failed" - else - echo 'EXTRA_DIST =' > docs/gtk-doc.make - fi - eautoreconf - else - elibtoolize - fi -} - -multilib_src_configure() { - tc-export CC #463846 - export cc_cv_CFLAGS__flto=no #502950 - - # Keep sorted by ./configure --help and only pass --disable flags - # when *required* to avoid external deps or unnecessary compile - local econf_args - econf_args=( - ac_cv_search_cap_init= - ac_cv_header_sys_capability_h=yes - DBUS_CFLAGS=' ' - DBUS_LIBS=' ' - --with-rootprefix= - --docdir=/usr/share/doc/${PF} - --libdir=/usr/$(get_libdir) - --with-firmware-path="${EPREFIX}usr/lib/firmware/updates:${EPREFIX}usr/lib/firmware:${EPREFIX}lib/firmware/updates:${EPREFIX}lib/firmware" - --with-html-dir="/usr/share/doc/${PF}/html" - --enable-split-usr - --exec-prefix=/ - - $(use_enable gudev) - ) - - # Only build libudev for non-native_abi, and only install it to libdir, - # that means all options only apply to native_abi - if multilib_is_native_abi; then - econf_args+=( - --with-rootlibdir=/$(get_libdir) - $(use_enable doc gtk-doc) - $(use_enable introspection) - $(use_enable keymap) - $(use_enable kmod libkmod) - $(usex kmod --enable-modules $(use_enable modutils modules)) - $(use_enable static-libs static) - $(use_enable selinux) - $(use_enable rule-generator) - ) - else - econf_args+=( - --disable-static - --disable-gtk-doc - --disable-introspection - --disable-keymap - --disable-libkmod - --disable-modules - --disable-selinux - --disable-rule-generator - ) - fi - ECONF_SOURCE="${S}" econf "${econf_args[@]}" -} - -multilib_src_compile() { - if multilib_is_native_abi; then - emake - else - emake -C src/libudev - use gudev && emake -C src/gudev - fi -} - -multilib_src_install() { - if multilib_is_native_abi; then - emake DESTDIR="${D}" install - else - emake -C src/libudev DESTDIR="${D}" install - use gudev && emake -C src/gudev DESTDIR="${D}" install - fi -} - -multilib_src_test() { - # make sandbox get out of the way - # these are safe because there is a fake root filesystem put in place, - # but sandbox seems to evaluate the paths of the test i/o instead of the - # paths of the actual i/o that results. - # also only test for native abi - if multilib_is_native_abi; then - addread /sys - addwrite /dev - addwrite /run - default_src_test - fi -} - -multilib_src_install_all() { - prune_libtool_files --all - rm -rf "${ED}"/usr/share/doc/${PF}/LICENSE.* - - use rule-generator && use openrc && doinitd "${FILESDIR}"/udev-postmount - - # drop distributed hwdb files, they override sys-apps/hwids - rm -f "${ED}"/etc/udev/hwdb.d/*.hwdb - - insinto /lib/udev/rules.d - doins "${FILESDIR}"/40-gentoo.rules -} - -pkg_preinst() { - local htmldir - for htmldir in gudev libudev; do - if [[ -d ${EROOT}usr/share/gtk-doc/html/${htmldir} ]]; then - rm -rf "${EROOT}"usr/share/gtk-doc/html/${htmldir} - fi - if [[ -d ${ED}/usr/share/doc/${PF}/html/${htmldir} ]]; then - dosym ../../doc/${PF}/html/${htmldir} \ - /usr/share/gtk-doc/html/${htmldir} - fi - done -} - -pkg_postinst() { - mkdir -p "${EROOT}"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 "${EROOT}"dev/loop 2>/dev/null - if [[ -d ${EROOT}dev/loop ]]; then - ewarn "Please make sure your remove /dev/loop," - ewarn "else losetup may be confused when looking for unused devices." - fi - - if use hwdb && has_version 'sys-apps/hwids[udev]'; then - udevadm hwdb --update --root="${ROOT%/}" - - # http://cgit.freedesktop.org/systemd/systemd/commit/?id=1fab57c209035f7e66198343074e9cee06718bda - # reload database after it has be rebuilt, but only if we are not upgrading - # also pass if we are -9999 since who knows what hwdb related changes there might be - if [[ ${REPLACING_VERSIONS%-r*} == ${PV} || -z ${REPLACING_VERSIONS} ]] && \ - [[ ${ROOT%/} == "" ]] && [[ ${PV} != "9999" ]]; then - udevadm control --reload - fi - fi - - ewarn - ewarn "You need to restart eudev as soon as possible to make the" - ewarn "upgrade go into effect:" - ewarn "\t/etc/init.d/udev --nodeps restart" - - if use rule-generator && use openrc && \ - [[ -x $(type -P rc-update) ]] && rc-update show | grep udev-postmount | grep -qsv 'boot\|default\|sysinit'; then - ewarn - ewarn "Please add the udev-postmount init script to your default runlevel" - ewarn "to ensure the legacy rule-generator functionality works as reliably" - ewarn "as possible." - ewarn "\trc-update add udev-postmount default" - fi - - elog - elog "For more information on eudev on Gentoo, writing udev rules, and" - elog "fixing known issues visit:" - elog " http://www.gentoo.org/doc/en/udev-guide.xml" - elog -} diff --git a/sys-fs/eudev/files/eudev-fix-typo-util.c.patch b/sys-fs/eudev/files/eudev-fix-typo-util.c.patch deleted file mode 100644 index 371471e17733..000000000000 --- a/sys-fs/eudev/files/eudev-fix-typo-util.c.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 82f60023e3d4b33624c85a149915b411b504e426 Mon Sep 17 00:00:00 2001 -From: "Anthony G. Basile" <blueness@gentoo.org> -Date: Wed, 23 Jan 2013 20:16:57 -0500 -Subject: [PATCH] src/libudev/util.c: fix typo introduce at commit 1ebf647 - -The first argument of fcntl should be 'fd', the file descriptor. - -Signed-off-by: Anthony G. Basile <blueness@gentoo.org> ---- - src/libudev/util.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/libudev/util.c b/src/libudev/util.c -index 1d57a01..d3982b9 100644 ---- a/src/libudev/util.c -+++ b/src/libudev/util.c -@@ -4586,7 +4586,7 @@ int fopen_temporary(const char *path, FILE **_f, char **_temp_path) { - fd = mkostemp(t, O_WRONLY|O_CLOEXEC); - #else - fd = mkstemp(t); -- fcntl(t, F_SETFD, FD_CLOEXEC); -+ fcntl(fd, F_SETFD, FD_CLOEXEC); - #endif - if (fd < 0) { - free(t); --- -1.7.12.4 - diff --git a/sys-fs/eudev/files/eudev-hwdb-offset-root.patch b/sys-fs/eudev/files/eudev-hwdb-offset-root.patch deleted file mode 100644 index 40ba471d031f..000000000000 --- a/sys-fs/eudev/files/eudev-hwdb-offset-root.patch +++ /dev/null @@ -1,212 +0,0 @@ -From 96da532526fec9bbfc9f53f2c5819520b971710c Mon Sep 17 00:00:00 2001 -From: Luca Barbato <lu_zero@gentoo.org> -Date: Thu, 7 Feb 2013 13:53:28 +0100 -Subject: [PATCH] udevadm: support updating hwdb from an offset root - -Introduce `--root` option to make users run udevadm on rootfs not -mounted as / - -Ease the life of distribution packagers. ---- - src/libudev/conf-files.c | 34 ++++++++++++++++++++++++++++------ - src/libudev/conf-files.h | 10 ++++++++-- - src/udev/udev-rules.c | 2 +- - src/udev/udevadm-hwdb.c | 32 +++++++++++++++++++++++++------- - 4 files changed, 62 insertions(+), 16 deletions(-) - -diff --git a/src/libudev/conf-files.c b/src/libudev/conf-files.c -index 34b8629..8e8edd0 100644 ---- a/src/libudev/conf-files.c -+++ b/src/libudev/conf-files.c -@@ -37,11 +37,27 @@ - #include "hashmap.h" - #include "conf-files.h" - --static int files_add(Hashmap *h, const char *path, const char *suffix) { -+static int files_add(Hashmap *h, -+ const char *prefix, -+ const char *path, -+ const char *suffix) { - DIR *dir; - int r = 0; - -- dir = opendir(path); -+ if (prefix) { -+ char *p = NULL; -+ -+ if (asprintf(&p, "%s/%s", prefix, path) < 0) { -+ r = -ENOMEM; -+ goto finish; -+ } -+ -+ dir = opendir(p); -+ free(p); -+ } else { -+ dir = opendir(path); -+ } -+ - if (!dir) { - if (errno == ENOENT) - return 0; -@@ -90,7 +106,10 @@ static int base_cmp(const void *a, const void *b) { - return strcmp(path_get_file_name(s1), path_get_file_name(s2)); - } - --int conf_files_list_strv(char ***strv, const char *suffix, const char **dirs) { -+int conf_files_list_strv(char ***strv, -+ const char *prefix, -+ const char *suffix, -+ const char **dirs) { - Hashmap *fh = NULL; - char **files = NULL; - const char **p; -@@ -105,7 +124,7 @@ int conf_files_list_strv(char ***strv, const char *suffix, const char **dirs) { - } - - STRV_FOREACH(p, dirs) { -- r = files_add(fh, *p, suffix); -+ r = files_add(fh, prefix, *p, suffix); - if (r < 0) - log_warning("Failed to search for files in %s: %s", - *p, strerror(-r)); -@@ -126,7 +145,10 @@ finish: - return r; - } - --int conf_files_list(char ***strv, const char *suffix, const char *dir, ...) { -+int conf_files_list(char ***strv, -+ const char *prefix, -+ const char *suffix, -+ const char *dir, ...) { - char **dirs = NULL; - va_list ap; - int r; -@@ -145,7 +167,7 @@ int conf_files_list(char ***strv, const char *suffix, const char *dir, ...) { - } - strv_uniq(dirs); - -- r = conf_files_list_strv(strv, suffix, (const char **)dirs); -+ r = conf_files_list_strv(strv, prefix, suffix, (const char **)dirs); - - finish: - strv_free(dirs); -diff --git a/src/libudev/conf-files.h b/src/libudev/conf-files.h -index f37ee1f..c2c59dc 100644 ---- a/src/libudev/conf-files.h -+++ b/src/libudev/conf-files.h -@@ -25,7 +25,13 @@ - - #include "macro.h" - --int conf_files_list(char ***strv, const char *suffix, const char *dir, ...); --int conf_files_list_strv(char ***strv, const char *suffix, const char **dirs); -+int conf_files_list(char ***strv, -+ const char *prefix, -+ const char *suffix, -+ const char *dir, ...); -+int conf_files_list_strv(char ***strv, -+ const char *prefix, -+ const char *suffix, -+ const char **dirs); - - #endif -diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c -index ab75521..0fcad5d 100644 ---- a/src/udev/udev-rules.c -+++ b/src/udev/udev-rules.c -@@ -1639,7 +1639,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) - return udev_rules_unref(rules); - udev_rules_check_timestamp(rules); - -- r = conf_files_list_strv(&files, ".rules", (const char **)rules->dirs); -+ r = conf_files_list_strv(&files, NULL, ".rules", (const char **)rules->dirs); - if (r < 0) { - log_error("failed to enumerate rules files: %s\n", strerror(-r)); - return udev_rules_unref(rules); -diff --git a/src/udev/udevadm-hwdb.c b/src/udev/udevadm-hwdb.c -index 279e925..917d1e0 100644 ---- a/src/udev/udevadm-hwdb.c -+++ b/src/udev/udevadm-hwdb.c -@@ -474,7 +474,7 @@ static int import_file(struct trie *trie, const char *filename) { - } - - static void help(void) { -- printf("Usage: udevadm hwdb [--create] [--help]\n" -+ printf("Usage: udevadm hwdb [--create] [--help] [--root <root_path>]\n" - " --update update the hardware database\n" - " --test <modalias> query database and print result\n" - " --help\n\n"); -@@ -483,11 +483,13 @@ static void help(void) { - static int adm_hwdb(struct udev *udev, int argc, char *argv[]) { - static const struct option options[] = { - { "update", no_argument, NULL, 'u' }, -+ { "root", required_argument, NULL, 'r' }, - { "test", required_argument, NULL, 't' }, - { "help", no_argument, NULL, 'h' }, - {} - }; -- const char *test = NULL; -+ const char *test = NULL, *root_path = NULL; -+ char *udev_hwdb_path = UDEV_HWDB_BIN; - bool update = false; - struct trie *trie = NULL; - int err; -@@ -496,7 +498,7 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) { - for (;;) { - int option; - -- option = getopt_long(argc, argv, "ut:h", options, NULL); -+ option = getopt_long(argc, argv, "ut:r:h", options, NULL); - if (option == -1) - break; - -@@ -507,6 +509,9 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) { - case 't': - test = optarg; - break; -+ case 'r': -+ root_path = optarg; -+ break; - case 'h': - help(); - return EXIT_SUCCESS; -@@ -542,7 +547,7 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) { - } - trie->nodes_count++; - -- err = conf_files_list_strv(&files, ".hwdb", (const char **)conf_file_dirs); -+ err = conf_files_list_strv(&files, root_path, ".hwdb", (const char **)conf_file_dirs); - if (err < 0) { - log_error("failed to enumerate hwdb files: %s\n", strerror(-err)); - rc = EXIT_FAILURE; -@@ -570,11 +575,24 @@ static int adm_hwdb(struct udev *udev, int argc, char *argv[]) { - log_debug("strings dedup'ed: %8zu bytes (%8zu)\n", - trie->strings->dedup_len, trie->strings->dedup_count); - -- mkdir_parents(UDEV_HWDB_BIN, 0755); -- err = trie_store(trie, UDEV_HWDB_BIN); -+ if (root_path) { -+ if (asprintf(&udev_hwdb_path, -+ "%s/%s", root_path, udev_hwdb_path) < 0) { -+ rc = EXIT_FAILURE; -+ goto out; -+ } -+ } -+ -+ mkdir_parents(udev_hwdb_path, 0755); -+ err = trie_store(trie, udev_hwdb_path); -+ -+ if (root_path) { -+ free(udev_hwdb_path); -+ } -+ - if (err < 0) { - log_error("Failure writing hardware database '%s': %s", -- UDEV_HWDB_BIN, strerror(-err)); -+ udev_hwdb_path, strerror(-err)); - rc = EXIT_FAILURE; - } - } --- -1.8.0.2 - |