summaryrefslogtreecommitdiff
path: root/net-fs
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2010-04-20 09:33:40 +0000
committerMike Frysinger <vapier@gentoo.org>2010-04-20 09:33:40 +0000
commitc8501b1696c75499f265608eb34df7b1824c4219 (patch)
tree4a951ac84aa49f61326946e6567e5e3670e940aa /net-fs
parentstable x86, bug 314025 (diff)
downloadgentoo-2-c8501b1696c75499f265608eb34df7b1824c4219.tar.gz
gentoo-2-c8501b1696c75499f265608eb34df7b1824c4219.tar.bz2
gentoo-2-c8501b1696c75499f265608eb34df7b1824c4219.zip
Make libcap support optional via USE=caps #314777.
(Portage version: 2.2_rc67/cvs/Linux x86_64)
Diffstat (limited to 'net-fs')
-rw-r--r--net-fs/nfs-utils/ChangeLog8
-rw-r--r--net-fs/nfs-utils/files/nfs-utils-1.2.2-optional-libcap.patch79
-rw-r--r--net-fs/nfs-utils/nfs-utils-1.2.2-r1.ebuild113
3 files changed, 199 insertions, 1 deletions
diff --git a/net-fs/nfs-utils/ChangeLog b/net-fs/nfs-utils/ChangeLog
index ace8311d3698..4ee670c45643 100644
--- a/net-fs/nfs-utils/ChangeLog
+++ b/net-fs/nfs-utils/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for net-fs/nfs-utils
# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/ChangeLog,v 1.166 2010/04/20 08:24:36 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/ChangeLog,v 1.167 2010/04/20 09:33:39 vapier Exp $
+
+*nfs-utils-1.2.2-r1 (20 Apr 2010)
+
+ 20 Apr 2010; Mike Frysinger <vapier@gentoo.org>
+ +nfs-utils-1.2.2-r1.ebuild, +files/nfs-utils-1.2.2-optional-libcap.patch:
+ Make libcap support optional via USE=caps #314777.
20 Apr 2010; Mike Frysinger <vapier@gentoo.org> nfs-utils-1.2.2.ebuild:
Disable tests since they require no rpc.statd to be running on the system
diff --git a/net-fs/nfs-utils/files/nfs-utils-1.2.2-optional-libcap.patch b/net-fs/nfs-utils/files/nfs-utils-1.2.2-optional-libcap.patch
new file mode 100644
index 000000000000..eb8ce44d595c
--- /dev/null
+++ b/net-fs/nfs-utils/files/nfs-utils-1.2.2-optional-libcap.patch
@@ -0,0 +1,79 @@
+From 655f6933b5db66c560098d039e3c91812399beca Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Tue, 20 Apr 2010 04:45:35 -0400
+Subject: [PATCH] make capabilities support optional
+
+The new code using libcap is quite minor, so rather than always reqiure
+libcap support, make it a normal --enable type flag. Current default
+behavior is retained -- if libcap is found, it is enabled, else it is
+disabled like every nfs-utils version in the past.
+
+URL: https://bugs.gentoo.org/314777
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ aclocal/libcap.m4 | 18 +++++++++++++-----
+ support/nsm/file.c | 4 ++++
+ 2 files changed, 17 insertions(+), 5 deletions(-)
+
+diff --git a/aclocal/libcap.m4 b/aclocal/libcap.m4
+index eabe507..68a624c 100644
+--- a/aclocal/libcap.m4
++++ b/aclocal/libcap.m4
+@@ -5,11 +5,19 @@ AC_DEFUN([AC_LIBCAP], [
+ dnl look for prctl
+ AC_CHECK_FUNC([prctl], , )
+
+- dnl look for the library; do not add to LIBS if found
+- AC_CHECK_LIB([cap], [cap_get_proc], [LIBCAP=-lcap], ,)
+- AC_SUBST(LIBCAP)
++ AC_ARG_ENABLE([caps],
++ [AS_HELP_STRING([--disable-caps], [Disable capabilities support])])
++
++ LIBCAP=
++
++ if test "x$enable_caps" != "xno" ; then
++ dnl look for the library; do not add to LIBS if found
++ AC_CHECK_LIB([cap], [cap_get_proc], [LIBCAP=-lcap], ,)
+
+- AC_CHECK_HEADERS([sys/capability.h], ,
+- [AC_MSG_ERROR([libcap headers not found.])])
++ AC_CHECK_HEADERS([sys/capability.h], ,
++ [test "x$enable_caps" = "xyes" && AC_MSG_ERROR([libcap headers not found.])])
++ fi
++
++ AC_SUBST(LIBCAP)
+
+ ])dnl
+diff --git a/support/nsm/file.c b/support/nsm/file.c
+index d469219..f4baeb9 100644
+--- a/support/nsm/file.c
++++ b/support/nsm/file.c
+@@ -67,7 +67,9 @@
+ #endif
+
+ #include <sys/types.h>
++#ifdef HAVE_SYS_CAPABILITY_H
+ #include <sys/capability.h>
++#endif
+ #include <sys/prctl.h>
+ #include <sys/stat.h>
+
+@@ -347,6 +349,7 @@ nsm_is_default_parentdir(void)
+ static _Bool
+ nsm_clear_capabilities(void)
+ {
++#ifdef HAVE_SYS_CAPABILITY_H
+ cap_t caps;
+
+ caps = cap_from_text("cap_net_bind_service=ep");
+@@ -362,6 +365,7 @@ nsm_clear_capabilities(void)
+ }
+
+ (void)cap_free(caps);
++#endif
+ return true;
+ }
+
+--
+1.7.0.2
+
diff --git a/net-fs/nfs-utils/nfs-utils-1.2.2-r1.ebuild b/net-fs/nfs-utils/nfs-utils-1.2.2-r1.ebuild
new file mode 100644
index 000000000000..47d83e24c338
--- /dev/null
+++ b/net-fs/nfs-utils/nfs-utils-1.2.2-r1.ebuild
@@ -0,0 +1,113 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/nfs-utils-1.2.2-r1.ebuild,v 1.1 2010/04/20 09:33:39 vapier Exp $
+
+EAPI="2"
+
+inherit eutils flag-o-matic multilib autotools
+
+DESCRIPTION="NFS client and server daemons"
+HOMEPAGE="http://linux-nfs.org/"
+SRC_URI="mirror://sourceforge/nfs/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="caps ipv6 kerberos +nfsv3 +nfsv4 tcpd elibc_glibc"
+RESTRICT="tests" #315573
+
+# kth-krb doesn't provide the right include
+# files, and nfs-utils doesn't build against heimdal either,
+# so don't depend on virtual/krb.
+# (04 Feb 2005 agriffis)
+DEPEND_COMMON="tcpd? ( sys-apps/tcp-wrappers )
+ caps? ( sys-libs/libcap )
+ sys-libs/e2fsprogs-libs
+ net-nds/rpcbind
+ net-libs/libtirpc
+ nfsv4? (
+ >=dev-libs/libevent-1.0b
+ >=net-libs/libnfsidmap-0.21-r1
+ kerberos? (
+ net-libs/librpcsecgss
+ net-libs/libgssglue
+ net-libs/libtirpc[kerberos]
+ app-crypt/mit-krb5
+ )
+ )"
+RDEPEND="${DEPEND_COMMON} !net-nds/portmap"
+# util-linux dep is to prevent man-page collision
+DEPEND="${DEPEND_COMMON}
+ >=sys-apps/util-linux-2.12r-r7"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-1.1.4-mtab-sym.patch
+ epatch "${FILESDIR}"/${PN}-1.1.4-no-exec.patch
+ epatch "${FILESDIR}"/${PN}-1.2.2-optional-libcap.patch #314777
+ chmod a+x tests/t0001-statd-basic-mon-unmon.sh || die
+ eautoreconf
+}
+
+src_configure() {
+ econf \
+ --with-statedir=/var/lib/nfs \
+ --enable-tirpc \
+ $(use_with tcpd tcp-wrappers) \
+ $(use_enable nfsv3) \
+ $(use_enable nfsv4) \
+ $(use_enable ipv6) \
+ $(use_enable caps) \
+ $(use nfsv4 && use_enable kerberos gss || echo "--disable-gss")
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die
+
+ # Don't overwrite existing xtab/etab, install the original
+ # versions somewhere safe... more info in pkg_postinst
+ dodir /usr/lib/nfs
+ keepdir /var/lib/nfs/{sm,sm.bak}
+ mv "${D}"/var/lib/nfs/* "${D}"/usr/lib/nfs
+ keepdir /var/lib/nfs
+
+ # Install some client-side binaries in /sbin
+ dodir /sbin
+ mv "${D}"/usr/sbin/rpc.statd "${D}"/sbin/ || die
+
+ dodoc ChangeLog README
+ docinto linux-nfs ; dodoc linux-nfs/*
+
+ insinto /etc
+ doins "${FILESDIR}"/exports
+
+ local f list="" opt_need=""
+ if use nfsv4 ; then
+ opt_need="rpc.idmapd"
+ list="${list} rpc.idmapd rpc.pipefs"
+ use kerberos && list="${list} rpc.gssd rpc.svcgssd"
+ fi
+ for f in nfs nfsmount rpc.statd ${list} ; do
+ newinitd "${FILESDIR}"/${f}.initd ${f} || die "doinitd ${f}"
+ done
+ newconfd "${FILESDIR}"/nfs.confd nfs
+ dosed "/^NFS_NEEDED_SERVICES=/s:=.*:=\"${opt_need}\":" /etc/conf.d/nfs #234132
+
+ # uClibc doesn't provide rpcgen like glibc, so lets steal it from nfs-utils
+ if ! use elibc_glibc ; then
+ dobin tools/rpcgen/rpcgen || die "rpcgen"
+ newdoc tools/rpcgen/README README.rpcgen
+ fi
+}
+
+pkg_postinst() {
+ # Install default xtab and friends if there's none existing.
+ # In src_install we put them in /usr/lib/nfs for safe-keeping, but
+ # the daemons actually use the files in /var/lib/nfs. This fixes
+ # bug 30486
+ local f
+ for f in "${ROOT}"/usr/$(get_libdir)/nfs/*; do
+ [[ -e ${ROOT}/var/lib/nfs/${f##*/} ]] && continue
+ einfo "Copying default ${f##*/} from /usr/$(get_libdir)/nfs to /var/lib/nfs"
+ cp -pPR "${f}" "${ROOT}"/var/lib/nfs/
+ done
+}