Bug 172090

Summary: [PATCH] databases/py-hiredis: Build and link against system/port hiredis.so (not WRKSRC/vendor)
Product: Ports & Packages Reporter: koobs <koobs.freebsd>
Component: Individual Port(s)Assignee: Ruslan Makhmatkhanov <rm>
Status: Closed FIXED    
Severity: Affects Only Me CC: gd
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
py27-hiredis-0.1.1.patch none

Description koobs 2012-09-26 13:30:16 UTC
The upstream distfile for this port bundles the hiredis source files in WRKSRC/vendor and doesnt actually build or link against the LIB_DEPENDS declared in the Makefile. 

This PR patches setup.py to link against hiredis.so as installed by the databases/hiredis port.

The approach is:

- Remove the 'lib' section in setup.py that builds hiredis.so
- Point include_dirs to ${LOCALBASE} instead of WRKSRC/vendor
- Add library_dirs to 'ext' section to point it to where hiredis.so lives

While I'm here: whitespace alignment

====[QA]====

portlint: looks fine.
porttest: clean
redports: https://redports.org/buildarchive/20120925120310-64334/

confirm linking:

<snip>databases/py-hiredis/work/hiredis-0.1.1/build/lib.freebsd-9.0-RELEASE-p3-amd64-2.7/hiredis] ldd ./hiredis.so
./hiredis.so:
        libhiredis.so.0.10 => /usr/local/lib/libhiredis.so.0.10 (0x801203000)
        libc.so.7 => /lib/libc.so.7 (0x80084a000)
============

Added file(s):
- files/patch-setup.py

Port maintainer (gd@rambler-co.ru) is cc'd.

Generated with FreeBSD Port Tools 0.99_6 (mode: change, diff: ports)
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2012-09-26 13:30:25 UTC
Maintainer of databases/py-hiredis,

Please note that PR ports/172090 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/172090

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2012-09-26 13:30:29 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 3 Denis Generalov 2012-09-26 13:41:06 UTC
On Wed, 26 Sep 2012 12:30:25 UT
Edwin Groothuis <edwin@FreeBSD.org> wrote:

> Maintainer of databases/py-hiredis,
> 
> Please note that PR ports/172090 has just been submitted.
> 
> If it contains a patch for an upgrade, an enhancement or a bug fix
> you agree on, reply to this email stating that you approve the patch
> and a committer will take care of it.
> 
> The full text of the PR can be found at:
>     http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/172090
> 
> -- 
> Edwin Groothuis via the GNATS Auto Assign Tool
> edwin@FreeBSD.org

Looks good for me.

-- 
Denis Generalov <gd@rambler-co.ru>
Comment 4 Ruslan Makhmatkhanov freebsd_committer freebsd_triage 2012-09-26 15:35:27 UTC
Responsible Changed
From-To: freebsd-ports-bugs->rm

I will take it.
Comment 5 dfilter service freebsd_committer freebsd_triage 2012-09-29 20:53:26 UTC
Author: rm
Date: Sat Sep 29 19:53:11 2012
New Revision: 305050
URL: http://svn.freebsd.org/changeset/ports/305050

Log:
  - make it build against system hiredis, instead of bundled one
  - bump PORTREVISION because of dependency change
  
  while here:
  - trim Makefile header
  - tab -> space change in pkg-descr:WWW
  
  PR:		172090
  Submitted by:	Kubilay Kocak <koobs.freebsd at gmail dot com>
  Approved by:	Denis Generalov <gd at rambler-co dot ru> (maintainer)

Added:
  head/databases/py-hiredis/files/
  head/databases/py-hiredis/files/patch-setup.py   (contents, props changed)
Modified:
  head/databases/py-hiredis/Makefile
  head/databases/py-hiredis/pkg-descr

Modified: head/databases/py-hiredis/Makefile
==============================================================================
--- head/databases/py-hiredis/Makefile	Sat Sep 29 19:23:40 2012	(r305049)
+++ head/databases/py-hiredis/Makefile	Sat Sep 29 19:53:11 2012	(r305050)
@@ -1,12 +1,9 @@
-# New ports collection makefile for:	py-hiredis
-# Date created:		2012-06-01
-# Whom:			Denis Generalov <gd@rambler-co.ru>
-#
+# Created by: Denis Generalov <gd@rambler-co.ru>
 # $FreeBSD$
-#
 
 PORTNAME=	hiredis
 PORTVERSION=	0.1.1
+PORTREVISION=	1
 CATEGORIES=	databases python
 MASTER_SITES=	CHEESESHOP
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
@@ -30,4 +27,7 @@ PLIST_FILES=	%%PYTHON_SITELIBDIR%%/hired
 		%%PYTHON_SITELIBDIR%%/hiredis/version.pyo
 PLIST_DIRS=	%%PYTHON_SITELIBDIR%%/hiredis
 
+post-patch:
+	@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|' ${WRKSRC}/${PYSETUP}
+
 .include <bsd.port.mk>

Added: head/databases/py-hiredis/files/patch-setup.py
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/databases/py-hiredis/files/patch-setup.py	Sat Sep 29 19:53:11 2012	(r305050)
@@ -0,0 +1,26 @@
+--- ./setup.py.orig	2012-04-18 04:54:11.000000000 +1000
++++ ./setup.py	2012-09-25 21:54:06.000000000 +1000
+@@ -20,13 +20,10 @@
+         if self.distribution.has_ext_modules():
+           self.run_command('build_ext')
+ 
+-lib = ("hiredis", {
+-  "sources": ["vendor/hiredis/%s.c" % src for src in ("hiredis", "net", "sds")],
+-  "include_dirs": ["vendor/hiredis"]})
+-
+ ext = Extension("hiredis.hiredis",
+   sources=glob.glob("src/*.c"),
+-  include_dirs=["src", "vendor"],
++  include_dirs=["src", "%%LOCALBASE%%/include"],
++  library_dirs=["%%LOCALBASE%%/lib"],
+   libraries=["hiredis"])
+ 
+ setup(
+@@ -39,7 +36,6 @@
+   keywords=["Redis"],
+   license="BSD",
+   packages=["hiredis"],
+-  libraries=[lib],
+   ext_modules=[ext],
+ 
+   # Override "install_lib" command

Modified: head/databases/py-hiredis/pkg-descr
==============================================================================
--- head/databases/py-hiredis/pkg-descr	Sat Sep 29 19:23:40 2012	(r305049)
+++ head/databases/py-hiredis/pkg-descr	Sat Sep 29 19:53:11 2012	(r305050)
@@ -1,3 +1,3 @@
 Python extension that wraps hiredis.
 
-WWW:	https://github.com/pietern/hiredis-py
+WWW: https://github.com/pietern/hiredis-py
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 6 Ruslan Makhmatkhanov freebsd_committer freebsd_triage 2012-09-29 20:53:35 UTC
State Changed
From-To: feedback->closed

Committed, thank you!