View | Details | Raw Unified | Return to bug 233782
Collapse All | Expand All

(-)b/devel/py-freebsd/Makefile (-14 / +8 lines)
Lines 2-14 Link Here
2
# $FreeBSD: head/devel/py-freebsd/Makefile 462307 2018-02-19 11:10:43Z antoine $
2
# $FreeBSD: head/devel/py-freebsd/Makefile 462307 2018-02-19 11:10:43Z antoine $
3
3
4
PORTNAME=	freebsd
4
PORTNAME=	freebsd
5
PORTVERSION=	0.9.3
5
PORTVERSION=	0.9.4
6
PORTREVISION=	8
7
CATEGORIES=	devel python
6
CATEGORIES=	devel python
8
MASTER_SITES=	LOCAL/perky \
9
		http://people.freebsd.org/~perky/distfiles/
10
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
7
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
11
DISTNAME=	py-freebsd-${PORTVERSION}
12
8
13
MAINTAINER=	python@FreeBSD.org
9
MAINTAINER=	python@FreeBSD.org
14
COMMENT=	Python interface to FreeBSD-specific system libraries
10
COMMENT=	Python interface to FreeBSD-specific system libraries
Lines 16-32 COMMENT= Python interface to FreeBSD-specific system libraries Link Here
16
LICENSE=	BSD2CLAUSE
12
LICENSE=	BSD2CLAUSE
17
LICENSE_FILE=	${WRKSRC}/COPYRIGHT
13
LICENSE_FILE=	${WRKSRC}/COPYRIGHT
18
14
19
USES=		python:2.7
15
USE_GITHUB=	yes
20
USE_PYTHON=	autoplist distutils
16
GH_ACCOUNT=	sobomax
21
17
GH_TAGNAME=	v${PORTVERSION}
22
.include <bsd.port.pre.mk>
18
GH_PROJECT=	py-${PORTNAME}
23
19
24
.if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1100002
20
USES=		python:2.7+
25
EXTRA_PATCHES+=	${FILESDIR}/freebsd11_patch-src__.const.def \
21
USE_PYTHON=	autoplist distutils
26
		${FILESDIR}/freebsd11_patch-src__netstat.c
27
.endif
28
22
29
post-install:
23
post-install:
30
	${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/freebsd.so
24
	${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/freebsd.so
31
25
32
.include <bsd.port.post.mk>
26
.include <bsd.port.mk>
(-)b/devel/py-freebsd/distinfo (-2 / +3 lines)
Lines 1-2 Link Here
1
SHA256 (py-freebsd-0.9.3.tar.gz) = 4792a5f9d124bd7634890dceeccd9995149176d4d36e17e882eadd4d23b46f92
1
TIMESTAMP = 1543888048
2
SIZE (py-freebsd-0.9.3.tar.gz) = 26995
2
SHA256 (sobomax-py-freebsd-0.9.4-v0.9.4_GH0.tar.gz) = 6086410a666e2df2bb6bd34e1e4e39a5f6d5c36fd5493a9738c8174774556849
3
SIZE (sobomax-py-freebsd-0.9.4-v0.9.4_GH0.tar.gz) = 27547
(-)a/devel/py-freebsd/files/freebsd11_patch-src__.const.def (-10 lines)
Removed Link Here
1
--- src/.const.def.orig	2005-12-09 03:40:56 UTC
2
+++ src/.const.def
3
@@ -69,7 +69,6 @@ SETDICT_INT(d, "IFF_BROADCAST", IFF_BROA
4
 SETDICT_INT(d, "IFF_DEBUG", IFF_DEBUG);
5
 SETDICT_INT(d, "IFF_LOOPBACK", IFF_LOOPBACK);
6
 SETDICT_INT(d, "IFF_POINTOPOINT", IFF_POINTOPOINT);
7
-SETDICT_INT(d, "IFF_SMART", IFF_SMART);
8
 SETDICT_INT(d, "IFF_RUNNING", IFF_RUNNING);
9
 SETDICT_INT(d, "IFF_NOARP", IFF_NOARP);
10
 SETDICT_INT(d, "IFF_PROMISC", IFF_PROMISC);
(-)a/devel/py-freebsd/files/freebsd11_patch-src__netstat.c (-10 lines)
Removed Link Here
1
--- src/netstat.c.orig	2005-05-08 06:55:00 UTC
2
+++ src/netstat.c
3
@@ -40,7 +40,6 @@ EXPCONST(int IFF_BROADCAST)
4
 EXPCONST(int IFF_DEBUG)
5
 EXPCONST(int IFF_LOOPBACK)
6
 EXPCONST(int IFF_POINTOPOINT)
7
-EXPCONST(int IFF_SMART)
8
 EXPCONST(int IFF_RUNNING)
9
 EXPCONST(int IFF_NOARP)
10
 EXPCONST(int IFF_PROMISC)
(-)a/devel/py-freebsd/files/patch-setup.py (-10 lines)
Removed Link Here
1
--- setup.py.orig	2005-12-09 03:39:16 UTC
2
+++ setup.py
3
@@ -52,6 +52,7 @@ setup(name = "py-freebsd",
4
             "freebsd",
5
             ["src/freebsdmodule.c"],
6
             libraries=libs,
7
+            library_dirs=['/lib', '/usr/lib'],
8
             depends=DEPENDS,
9
           )
10
       ],
(-)a/devel/py-freebsd/files/patch-src-jail.c (-45 lines)
Removed Link Here
1
--- src/jail.c.orig	2005-05-08 06:55:00 UTC
2
+++ src/jail.c
3
@@ -40,21 +40,37 @@ static PyObject *
4
 PyFB_jail(PyObject *self, PyObject *args)
5
 {
6
 	struct jail jp;
7
+	struct in_addr ia;
8
 	char *ipaddr;
9
+	int error;
10
 
11
 	if (!PyArg_ParseTuple(args, "sss:jail", &(jp.path),
12
 			      &(jp.hostname), &ipaddr))
13
 		return NULL;
14
 
15
-	jp.version   = 0;
16
-	jp.ip_number = inet_addr(ipaddr);
17
-
18
-	if (jp.ip_number == INADDR_NONE) {
19
+	ia.s_addr	= inet_addr(ipaddr);
20
+	if (ia.s_addr == INADDR_NONE) {
21
 		PyErr_SetString(PyExc_ValueError, "malformed internet address");
22
 		return NULL;
23
 	}
24
 
25
-	if (jail(&jp) == -1)
26
+	jp.version	= JAIL_API_VERSION;
27
+	jp.jailname	= NULL;
28
+	jp.ip4s		= 1;
29
+	jp.ip4		= malloc(jp.ip4s * sizeof(struct in_addr));
30
+	if (jp.ip4 == NULL) {
31
+		PyErr_SetString(PyExc_ValueError, "Cannot allocate memory");
32
+		return NULL;
33
+	}
34
+	jp.ip4->s_addr = ia.s_addr;
35
+	jp.ip6s		= 0;
36
+	jp.ip6		= NULL;
37
+
38
+	error = jail(&jp);
39
+
40
+	free(jp.ip4);
41
+
42
+	if (error == -1)
43
 		return OSERROR();
44
 
45
 	Py_RETURN_NONE;
(-)a/devel/py-freebsd/files/patch-src-netstat.c (-10 lines)
Removed Link Here
1
--- src/netstat.c.orig	2005-05-08 06:55:00 UTC
2
+++ src/netstat.c
3
@@ -243,7 +243,6 @@ PyFB_ifstats(PyObject *self)
4
 		Py_DECREF(t);
5
 		p_int(type);        p_int(physical);
6
 		p_int(addrlen);     p_int(hdrlen);
7
-		p_int(recvquota);   p_int(xmitquota);
8
 		p_long(mtu);        p_long(metric);
9
 		p_long(baudrate);   p_long(ipackets);
10
 		p_long(ierrors);    p_long(opackets);
(-)a/devel/py-freebsd/files/patch-src-process.c (-52 lines)
Removed Link Here
1
--- src/process.c.orig	2005-05-08 06:55:00 UTC
2
+++ src/process.c
3
@@ -51,10 +51,19 @@ static char PyFB_setprogname__doc__[] =
4
 static PyObject *
5
 PyFB_setprogname(PyObject *self, PyObject *args)
6
 {
7
-	char *progname;
8
+	const char	*progname;
9
+	static PyObject	*namestr = NULL;
10
 
11
 	if (!PyArg_ParseTuple(args, "s:setprogname", &progname))
12
 		return NULL;
13
+	/*
14
+	 * Setprogname(3) does not copy the string, it only stores the
15
+	 * string pointer. Make sure that the string object does not
16
+	 * get garbage collected and its memory reused!
17
+	 */
18
+	Py_XDECREF(namestr);	/* maybe free old progname */
19
+	PyArg_ParseTuple(args, "O", &namestr);
20
+	Py_INCREF(namestr);	/* keep new progname object */
21
 
22
 	setprogname(progname);
23
 	Py_RETURN_NONE;
24
@@ -64,16 +73,24 @@ PyFB_setprogname(PyObject *self, PyObjec
25
 static char PyFB_setproctitle__doc__[] =
26
 "setproctitle(title):\n"
27
 "The setproctitle() library routine sets the process title that\n"
28
-"appears on the ps(1) command.";
29
+"appears on the ps(1) command. The progname and a colon are\n"
30
+"prepended automatically. This behaviour is suppressed when the\n"
31
+"title starts with a dash (-) character. Calling with a None\n"
32
+"argument restores a default process title.";
33
 
34
 static PyObject *
35
 PyFB_setproctitle(PyObject *self, PyObject *args)
36
 {
37
-	char *newtitle;
38
+	const char *newtitle;
39
 
40
-	if (!PyArg_ParseTuple(args, "s:setproctitle", &newtitle))
41
+	if (!PyArg_ParseTuple(args, "z:setproctitle", &newtitle))
42
 		return NULL;
43
 
44
-	setproctitle(newtitle);
45
+	if (newtitle == NULL)
46
+		setproctitle(NULL);
47
+	else if (*newtitle == '-')
48
+		setproctitle("-%s", newtitle+1);
49
+	else
50
+		setproctitle("%s", newtitle);
51
 	Py_RETURN_NONE;
52
 }
(-)a/devel/py-freebsd/files/patch-src-sysctl.c (-38 lines)
Removed Link Here
1
--- src/sysctl.c.orig	2005-05-08 06:55:00 UTC
2
+++ src/sysctl.c
3
@@ -121,7 +121,7 @@ const size_t sysctl_type_sizes[CTLTYPE] 
4
 	0,			/* CTLTYPE_NODE */
5
 	sizeof(int),		/* CTLTYPE_INT */
6
 	0,			/* CTLTYPE_STRING */
7
-	sizeof(quad_t),		/* CTLTYPE_QUAD */
8
+	sizeof(quad_t),		/* CTLTYPE_S64 */
9
 	0,			/* CTLTYPE_OPAQUE */
10
 	sizeof(unsigned int),	/* CTLTYPE_UINT */
11
 	sizeof(long),		/* CTLTYPE_LONG */
12
@@ -329,7 +329,7 @@ PyFB_sysctl(PyObject *self, PyObject *ar
13
 	case CTLTYPE_UINT:
14
 	case CTLTYPE_LONG:
15
 	case CTLTYPE_ULONG:
16
-	case CTLTYPE_QUAD:
17
+	case CTLTYPE_S64:
18
 		if (!PyInt_Check(newobj) && !PyLong_Check(newobj)) {
19
 			PyErr_SetString(PyExc_TypeError,
20
 				"argument 2 must be integer for this node");
21
@@ -350,7 +350,7 @@ PyFB_sysctl(PyObject *self, PyObject *ar
22
 		case CTLTYPE_ULONG:
23
 			val.m_ulong = PyLong_AsUnsignedLong(newobj);
24
 			break;
25
-		case CTLTYPE_QUAD:
26
+		case CTLTYPE_S64:
27
 			val.m_quad = (quad_t)PyLong_AsLongLong(newobj);
28
 			break;
29
 		}
30
@@ -439,7 +439,7 @@ PyFB_sysctl(PyObject *self, PyObject *ar
31
 	case CTLTYPE_STRING:
32
 		ret = PyString_FromStringAndSize(oldp, oldlen - 1);
33
 		break;
34
-	case CTLTYPE_QUAD:
35
+	case CTLTYPE_S64:
36
 		assert(oldlen == sizeof(quad_t));
37
 		ret = PyLong_FromLongLong((long long)*(quad_t *)oldp);
38
 		break;

Return to bug 233782