summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-09-17 22:55:13 +0000
committerMike Frysinger <vapier@gentoo.org>2011-09-17 22:55:13 +0000
commit15e4832411438d1414ccfb5899f9355047ee07dd (patch)
treee713913dc3c323fda1cadeeb861a8cf1d78161af /sys-process/lsof
parentAdd support for varnish plugin and fix bug 380297 (diff)
downloadgentoo-2-15e4832411438d1414ccfb5899f9355047ee07dd.tar.gz
gentoo-2-15e4832411438d1414ccfb5899f9355047ee07dd.tar.bz2
gentoo-2-15e4832411438d1414ccfb5899f9355047ee07dd.zip
Clean up build logic by testing the compiler rather than poking around the filesystem. Support USE=ipv6. Support building with libtirpc rather than glibc and do so with USE=rpc #370833 by kabel.
(Portage version: 2.2.0_alpha58/cvs/Linux x86_64)
Diffstat (limited to 'sys-process/lsof')
-rw-r--r--sys-process/lsof/ChangeLog12
-rw-r--r--sys-process/lsof/files/lsof-4.84-rpc.patch282
-rw-r--r--sys-process/lsof/lsof-4.84-r1.ebuild77
-rw-r--r--sys-process/lsof/metadata.xml3
4 files changed, 372 insertions, 2 deletions
diff --git a/sys-process/lsof/ChangeLog b/sys-process/lsof/ChangeLog
index 222aff8d7f8c..dd59da50d69b 100644
--- a/sys-process/lsof/ChangeLog
+++ b/sys-process/lsof/ChangeLog
@@ -1,6 +1,14 @@
# ChangeLog for sys-process/lsof
-# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-process/lsof/ChangeLog,v 1.78 2010/08/29 18:12:39 armin76 Exp $
+# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sys-process/lsof/ChangeLog,v 1.79 2011/09/17 22:55:12 vapier Exp $
+
+*lsof-4.84-r1 (17 Sep 2011)
+
+ 17 Sep 2011; Mike Frysinger <vapier@gentoo.org> +lsof-4.84-r1.ebuild,
+ +files/lsof-4.84-rpc.patch, metadata.xml:
+ Clean up build logic by testing the compiler rather than poking around the
+ filesystem. Support USE=ipv6. Support building with libtirpc rather than
+ glibc and do so with USE=rpc #370833 by kabel.
29 Aug 2010; Raúl Porcel <armin76@gentoo.org> lsof-4.83.ebuild:
alpha/ia64/m68k/s390/sh/sparc stable wrt #331143
diff --git a/sys-process/lsof/files/lsof-4.84-rpc.patch b/sys-process/lsof/files/lsof-4.84-rpc.patch
new file mode 100644
index 000000000000..3dd3ce2005cf
--- /dev/null
+++ b/sys-process/lsof/files/lsof-4.84-rpc.patch
@@ -0,0 +1,282 @@
+--- lsof_4.84_src/Configure
++++ lsof_4.84_src/Configure
+@@ -2740,6 +2740,13 @@
+ LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
+ fi # }
+
++ # Test for rpc/rpc.h
++
++ if ! test -r ${LSOF_INCLUDE}/rpc/rpc.h # {
++ then
++ LSOF_CFGF="$LSOF_CFGF -DHASNOTRPC"
++ fi # }
++
+ # Test for SELinux support.
+
+ LSOF_TMP1=0
+--- lsof_4.84_src/dialects/linux/dlsof.h
++++ lsof_4.84_src/dialects/linux/dlsof.h
+@@ -56,8 +56,10 @@
+ #include <linux/tcp.h>
+ # endif /* defined(GLIBCV) || defined(__UCLIBC__) */
+
++# if !defined(HASNOTRPC)
+ #include <rpc/rpc.h>
+ #include <rpc/pmap_prot.h>
++# endif /* !defined(HASNOTRPC) */
+
+ #if defined(HASSELINUX)
+ #include <selinux/selinux.h>
+--- lsof_4.84_src/lsof.h
++++ lsof_4.84_src/lsof.h
+@@ -609,7 +609,9 @@
+ extern int Foffset;
+ extern int Fovhd;
+ extern int Fport;
++#if !defined(HASNOTRPC)
+ extern int FportMap;
++#endif /* !defined(HASNOTRPC) */
+ extern int Fpgid;
+ extern int Fppid;
+ extern int Fsize;
+--- lsof_4.84_src/main.c
++++ lsof_4.84_src/main.c
+@@ -154,7 +154,7 @@
+ * Create option mask.
+ */
+ (void) snpf(options, sizeof(options),
+- "?a%sbc:D:d:%sf:F:g:hi:%s%slL:%sMnNo:Op:Pr:%ss:S:tT:u:UvVwx:%s%s%s",
++ "?a%sbc:D:d:%sf:F:g:hi:%s%slL:%s%snNo:Op:Pr:%ss:S:tT:u:UvVwx:%s%s%s",
+
+ #if defined(HAS_AFS) && defined(HASAOPT)
+ "A:",
+@@ -186,6 +186,12 @@
+ "",
+ #endif /* defined(HASMOPT) || defined(HASMNTSUP) */
+
++#if !defined(HASNOTRPC)
++ "M",
++#else /* defined(HASNOTRPC) */
++ "",
++#endif /* defined(HASNOTRPC) */
++
+ #if defined(HASPPID)
+ "R",
+ #else /* !defined(HASPPID) */
+@@ -643,9 +649,11 @@
+ break;
+ #endif /* defined(HASMOPT) || defined(HASMNTSUP) */
+
++#if !defined(HASNOTRPC)
+ case 'M':
+ FportMap = (GOp == '+') ? 1 : 0;
+ break;
++#endif /* !defined(HASNOTRPC) */
+ case 'n':
+ Fhost = (GOp == '-') ? 0 : 1;
+ break;
+--- lsof_4.84_src/print.c
++++ lsof_4.84_src/print.c
+@@ -67,8 +67,11 @@
+ struct porttab *next;
+ };
+
+-
++#if defined(HASNOTRPC)
++static struct porttab **Pth[2] = { NULL, NULL };
++#else /* !defined(HASNOTRPC) */
+ static struct porttab **Pth[4] = { NULL, NULL, NULL, NULL };
++#endif /* !defined(HASNOTRPC) */
+ /* port hash buckets:
+ * Pth[0] for TCP service names
+ * Pth[1] for UDP service names
+@@ -78,12 +81,14 @@
+ #define HASHPORT(p) (((((int)(p)) * 31415) >> 3) & (PORTHASHBUCKETS - 1))
+
+
++#if !defined(HASNOTRPC)
+ _PROTOTYPE(static void fill_portmap,(void));
++_PROTOTYPE(static void update_portmap,(struct porttab *pt, char *pn));
++#endif /* !defined(HASNOTRPC) */
+ _PROTOTYPE(static void fill_porttab,(void));
+ _PROTOTYPE(static char *lkup_port,(int p, int pr, int src));
+ _PROTOTYPE(static char *lkup_svcnam,(int h, int p, int pr, int ss));
+ _PROTOTYPE(static int printinaddr,(void));
+-_PROTOTYPE(static void update_portmap,(struct porttab *pt, char *pn));
+
+
+ /*
+@@ -104,6 +109,7 @@
+ }
+
+
++#if !defined(HASNOTRPC)
+ /*
+ * fill_portmap() -- fill the RPC portmap program name table via a conversation
+ * with the portmapper
+@@ -267,6 +273,7 @@
+ }
+ clnt_destroy(c);
+ }
++#endif /* !defined(HASNOTRPC) */
+
+
+ /*
+@@ -468,8 +475,12 @@
+ * If the hash buckets haven't been allocated, do so.
+ */
+ if (!Pth[0]) {
++#if defined(HASNOTRPC)
++ for (h = 0; h < 2; h++) {
++#else /* !defined(HASNOTRPC) */
+ nh = FportMap ? 4 : 2;
+ for (h = 0; h < nh; h++) {
++#endif /* !defined(HASNOTRPC) */
+ if (!(Pth[h] = (struct porttab **)calloc(PORTHASHBUCKETS,
+ sizeof(struct porttab *))))
+ {
+@@ -483,6 +494,7 @@
+ }
+ }
+ }
++#if !defined(HASNOTRPC)
+ /*
+ * If we're looking up program names for portmapped ports, make sure the
+ * portmap table has been loaded.
+@@ -491,11 +503,13 @@
+ (void) fill_portmap();
+ pm++;
+ }
++#endif /* !defined(HASNOTRPC) */
+ /*
+ * Hash the port and see if its name has been cached. Look for a local
+ * port first in the portmap, if portmap searching is enabled.
+ */
+ h = HASHPORT(p);
++#if !defined(HASNOTRPC)
+ if (!src && FportMap) {
+ for (pt = Pth[pr+2][h]; pt; pt = pt->next) {
+ if (pt->port != p)
+@@ -511,6 +525,7 @@
+ return(pt->name);
+ }
+ }
++#endif /* !defined(HASNOTRPC) */
+ for (pt = Pth[pr][h]; pt; pt = pt->next) {
+ if (pt->port == p)
+ return(pt->name);
+@@ -1154,7 +1169,11 @@
+ * Process the port number.
+ */
+ if (Lf->li[i].p > 0) {
+- if (Fport || FportMap) {
++ if (Fport
++#if !defined(HASNOTRPC)
++ || FportMap
++#endif /* !defined(HASNOTRPC) */
++ ) {
+
+ /*
+ * If converting port numbers to service names, or looking
+@@ -1167,9 +1186,10 @@
+ * loopback address 127.0.0.1. (Test 2 may not always work
+ * -- e.g., on hosts with multiple interfaces.)
+ */
++#if !defined(HASNOTRPC)
+ if ((src = i) && FportMap) {
+
+-#if defined(HASIPv6)
++# if defined(HASIPv6)
+ if (Lf->li[0].af == AF_INET6) {
+ if (IN6_IS_ADDR_LOOPBACK(&Lf->li[i].ia.a6)
+ || IN6_ARE_ADDR_EQUAL(&Lf->li[0].ia.a6,
+@@ -1177,7 +1197,7 @@
+ )
+ src = 0;
+ } else
+-#endif /* defined(HASIPv6) */
++# endif /* defined(HASIPv6) */
+
+ if (Lf->li[0].af == AF_INET) {
+ if (Lf->li[i].ia.a4.s_addr == htonl(INADDR_LOOPBACK)
+@@ -1186,6 +1206,7 @@
+ src = 0;
+ }
+ }
++#endif /* !defined(HASNOTRPC) */
+ if (strcasecmp(Lf->iproto, "TCP") == 0)
+ port = lkup_port(Lf->li[i].p, 0, src);
+ else if (strcasecmp(Lf->iproto, "UDP") == 0)
+@@ -2748,6 +2769,7 @@
+ }
+
+
++#if !defined(HASNOTRPC)
+ /*
+ * update_portmap() - update a portmap entry with its port number or service
+ * name
+@@ -2780,3 +2802,4 @@
+ pt->nl = nl;
+ pt->ss = 1;
+ }
++#endif /* !defined(HASNOTRPC) */
+--- lsof_4.84_src/store.c
++++ lsof_4.84_src/store.c
+@@ -156,11 +156,13 @@
+ int Fovhd = 0; /* -O option status */
+ int Fport = 1; /* -P option status */
+
+-#if defined(HASPMAPENABLED)
++#if !defined(HASNOTRPC)
++# if defined(HASPMAPENABLED)
+ int FportMap = 1; /* +|-M option status */
+-#else /* !defined(HASPMAPENABLED) */
++# else /* !defined(HASPMAPENABLED) */
+ int FportMap = 0; /* +|-M option status */
+-#endif /* defined(HASPMAPENABLED) */
++# endif /* defined(HASPMAPENABLED) */
++#endif /* !defined(HASNOTRPC) */
+
+ int Fpgid = 0; /* -g option status */
+ int Fppid = 0; /* -R option status */
+--- lsof_4.84_src/usage.c
++++ lsof_4.84_src/usage.c
+@@ -453,8 +453,12 @@
+ );
+ #endif /* defined(HASMOPT) || defined(HASMNTSUP) */
+
++#if !defined(HASNOTRPC)
++ (void) fprintf(stderr, " [+|-M]");
++#endif /* !defined(HASNOTRPC) */
++
+ (void) fprintf(stderr,
+- " [+|-M] [-o [o]] [-p s]\n[+|-r [t]]%s [-S [t]] [-T [t]]",
++ " [-o [o]] [-p s]\n[+|-r [t]]%s [-S [t]] [-T [t]]",
+
+ #if defined(HASTCPUDPSTATE)
+ " [-s [p:s]]"
+@@ -690,16 +694,19 @@
+ # endif /* defined(HASMNTSUP) */
+ #endif /* defined(HASMOPT) || defined(HASMNTSUP) */
+
++#if !defined(HASNOTRPC)
+ (void) snpf(buf, sizeof(buf), "+|-M portMap registration (%s)",
+-
+-#if defined(HASPMAPENABLED)
++# if defined(HASPMAPENABLED)
+ "+"
+-#else /* !defined(HASPMAPENABLED) */
++# else /* !defined(HASPMAPENABLED) */
+ "-"
+-#endif /* defined(HASPMAPENABLED) */
+-
++# endif /* defined(HASPMAPENABLED) */
+ );
++#else /* defined(HASNOTRPC) */
++ buf[0] = '\0';
++#endif /* defined(HASNOTRPC) */
+ (void) fprintf(stderr, " %-36.36s", buf);
++
+ (void) snpf(buf, sizeof(buf), "-o o o 0t offset digits (%d)",
+ OFFDECDIG);
+ (void) fprintf(stderr, " %s\n", buf);
diff --git a/sys-process/lsof/lsof-4.84-r1.ebuild b/sys-process/lsof/lsof-4.84-r1.ebuild
new file mode 100644
index 000000000000..d9d9ea808c66
--- /dev/null
+++ b/sys-process/lsof/lsof-4.84-r1.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-process/lsof/lsof-4.84-r1.ebuild,v 1.1 2011/09/17 22:55:12 vapier Exp $
+
+EAPI="2"
+
+inherit flag-o-matic toolchain-funcs
+
+MY_P=${P/-/_}
+DESCRIPTION="Lists open files for running Unix processes"
+HOMEPAGE="ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/"
+SRC_URI="ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/${MY_P}.tar.bz2
+ ftp://vic.cc.purdue.edu/pub/tools/unix/lsof/${MY_P}.tar.bz2
+ ftp://ftp.cerias.purdue.edu/pub/tools/unix/sysutils/lsof/${MY_P}.tar.bz2"
+
+LICENSE="lsof"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
+IUSE="ipv6 rpc selinux static"
+
+RDEPEND="rpc? ( net-libs/libtirpc )
+ selinux? ( sys-libs/libselinux )"
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${MY_P}/${MY_P}_src
+
+src_unpack() {
+ unpack ${A}
+ cd ${MY_P}
+ unpack ./${MY_P}_src.tar
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-4.84-rpc.patch #370833
+ # convert `test -r header.h` into a compile test
+ sed -i -r \
+ -e 's:test -r \$\{LSOF_INCLUDE\}/([[:alnum:]/._]*):echo "#include <\1>" | ${LSOF_CC} ${LSOF_CFGF} -E - >/dev/null 2>\&1:' \
+ -e 's:grep (.*) \$\{LSOF_INCLUDE\}/([[:alnum:]/._]*):echo "#include <\2>" | ${LSOF_CC} ${LSOF_CFGF} -E -P -dD - 2>/dev/null | grep \1:' \
+ Configure || die
+}
+
+usex() { use $1 && echo ${2:-yes} || echo ${3:-no} ; }
+target() { usex kernel_FreeBSD freebsd linux ; }
+src_configure() {
+ use static && append-ldflags -static
+
+ append-cppflags $(usex rpc "$($(tc-getPKG_CONFIG) libtirpc --cflags)" -DHASNOTRPC)
+ append-cppflags $(usex ipv6 -{D,U}HASIPv6)
+
+ export LSOF_CFGL="${CFLAGS} ${LDFLAGS} \
+ $(use rpc && $(tc-getPKG_CONFIG) libtirpc --libs)"
+
+ # Set LSOF_INCLUDE to a dummy location so the script doesn't poke
+ # around in it and mix /usr/include paths with cross-compile/etc.
+ touch .neverInv
+ LINUX_HASSELINUX=$(usex selinux y n) \
+ LSOF_INCLUDE=${T} \
+ LSOF_CC=$(tc-getCC) \
+ LSOF_AR="$(tc-getAR) rc" \
+ LSOF_RANLIB=$(tc-getRANLIB) \
+ LSOF_CFGF="${CFLAGS} ${CPPFLAGS}" \
+ ./Configure -n $(target) || die
+}
+
+src_compile() {
+ emake DEBUG="" all || die
+}
+
+src_install() {
+ dobin lsof || die
+
+ insinto /usr/share/lsof/scripts
+ doins scripts/* || die
+
+ doman lsof.8 || die
+ dodoc 00*
+}
diff --git a/sys-process/lsof/metadata.xml b/sys-process/lsof/metadata.xml
index 96a2d586367d..49fb858fab9c 100644
--- a/sys-process/lsof/metadata.xml
+++ b/sys-process/lsof/metadata.xml
@@ -2,4 +2,7 @@
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<herd>base-system</herd>
+<use>
+ <flag name='rpc'>support looking up RPC service info</flag>
+</use>
</pkgmetadata>