Bug 170443 - databases/py-bsddb3 installation fails with PYTHON_VERSION python3.2
Summary: databases/py-bsddb3 installation fails with PYTHON_VERSION python3.2
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Wen Heping
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-07 12:20 UTC by c.kworr
Modified: 2012-10-07 09:20 UTC (History)
0 users

See Also:


Attachments
bsddb3.diff.txt (2.41 KB, text/plain; charset=UTF-8)
2012-10-07 09:05 UTC, R.Mahmatkhanov
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description c.kworr 2012-08-07 12:20:01 UTC
# make PYTHON_VERSION=python3.2
.. # builds successfully
# make PYTHON_VERSION=python3.2 install
===>  Installing for py32-bsddb3-5.3.0
===>   py32-bsddb3-5.3.0 depends on file: /usr/local/bin/python3.2 - found
===>   py32-bsddb3-5.3.0 depends on shared library: db-5.3.0 - found
===>   Generating temporary packing list
===>  Checking if databases/py-bsddb3 already installed
Traceback (most recent call last):
  File "setup.py", line 7, in <module>
    import setup3
  File "/tmp/ports/usr/ports/databases/py-bsddb3/work/bsddb3-5.3.0/setup3.py", line 258, in <module>
    libname = [db-5.3]
NameError: name 'db' is not defined
*** [do-install] Error code 1

Stop in /usr/ports/databases/py-bsddb3.

Fix: 

The problem is in misquoted string at files/patch-setup3.py:22:

@@ -247,8 +244,8 @@
         incdir = os.path.join(BERKELEYDB_DIR, 'include')
     if not libdir:
         libdir = os.path.join(BERKELEYDB_DIR, 'lib')
-    if not '-ldb' in LIBS:
-        libname = [dblib]
+    if not '-l%%DBVERSION%%' in LIBS:
+        libname = [%%DBVERSION%%]
     else:
         if debug: print "LIBS already contains '-ldb' not adding our own", "'-l"+dblib+"'"
         libname = []

Here %%DBVERSION%% should appear quoted like in files/patch-setup2.py.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2012-08-07 12:20:18 UTC
Responsible Changed
From-To: freebsd-ports-bugs->wen

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 R.Mahmatkhanov 2012-10-07 09:05:43 UTC
Hi Wen,

this patch includes Volodymyr's fix to let it build with python3. I also 
added shims for python >= 3.2.0 (based on nivit's solution for 
devel/py-virtualenv) that fixes packaging list. Now this port builds 
fine on both python branches. Would you commit/approve?

-- 
Regards,
Ruslan

Tinderboxing kills... the drives.
Comment 3 dfilter service freebsd_committer freebsd_triage 2012-10-07 09:13:04 UTC
Author: rm
Date: Sun Oct  7 08:12:53 2012
New Revision: 305441
URL: http://svn.freebsd.org/changeset/ports/305441

Log:
  - fix build with python3 [1]
  - fix packaging list for python >= 3.2.0 (using nivit's solution for
    devel/py-virtualenv)
  
  PR:		170443
  Submitted by:	Volodymyr Kostyrko <c.kworr at gmail dot com> [1]
  Approved by:	wen (maintainer)

Added:
  head/databases/py-bsddb3/files/py3k-fix-pkg-plist.inc   (contents, props changed)
Modified:
  head/databases/py-bsddb3/Makefile
  head/databases/py-bsddb3/files/patch-setup3.py

Modified: head/databases/py-bsddb3/Makefile
==============================================================================
--- head/databases/py-bsddb3/Makefile	Sun Oct  7 08:01:14 2012	(r305440)
+++ head/databases/py-bsddb3/Makefile	Sun Oct  7 08:12:53 2012	(r305441)
@@ -1,9 +1,5 @@
-# New ports collection makefile for:	py-bsddb3
-# Date created:				22 March 2001
-# Whom:					Hye-Shik Chang <perky@python.or.kr>
-#
+# Created by: Hye-Shik Chang <perky@python.or.kr>
 # $FreeBSD$
-#
 
 PORTNAME=	bsddb3
 PORTVERSION=	5.3.0
@@ -24,6 +20,8 @@ PYDISTUTILS_INSTALLARGS=-c -O1 --prefix=
 PORTDOCS=	*
 DOCSDIR=	${PREFIX}/share/doc/py-${PORTNAME}
 
+.include <bsd.port.pre.mk>
+
 post-patch:
 	${REINPLACE_CMD} 's,%%DBVERSION%%,${BDB_LIB_NAME},g' ${WRKSRC}/setup2.py ${WRKSRC}/setup3.py
 	${REINPLACE_CMD} 's,<db\.h>,<${BDB_INCLUDE_DIR}/db.h>,' ${WRKSRC}/Modules/bsddb.h
@@ -34,4 +32,8 @@ post-install:
 	(cd ${WRKSRC}/docs && ${COPYTREE_SHARE} \* ${DOCSDIR})
 .endif
 
-.include <bsd.port.mk>
+.if ${PYTHON_REL} >= 320
+.include "${FILESDIR}/py3k-fix-pkg-plist.inc"
+.endif
+
+.include <bsd.port.post.mk>

Modified: head/databases/py-bsddb3/files/patch-setup3.py
==============================================================================
--- head/databases/py-bsddb3/files/patch-setup3.py	Sun Oct  7 08:01:14 2012	(r305440)
+++ head/databases/py-bsddb3/files/patch-setup3.py	Sun Oct  7 08:12:53 2012	(r305441)
@@ -19,7 +19,7 @@
 -    if not '-ldb' in LIBS:
 -        libname = [dblib]
 +    if not '-l%%DBVERSION%%' in LIBS:
-+        libname = [%%DBVERSION%%]
++        libname = ['%%DBVERSION%%']
      else:
          if debug: print("LIBS already contains '-ldb' not adding our own", "'-l"+dblib+"'")
          libname = []

Added: head/databases/py-bsddb3/files/py3k-fix-pkg-plist.inc
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/databases/py-bsddb3/files/py3k-fix-pkg-plist.inc	Sun Oct  7 08:12:53 2012	(r305441)
@@ -0,0 +1,14 @@
+# When Python version is 3.2+ we rewrite all the filenames
+# of TMPPLIST that end with .py[co], so that they conform
+# to PEP 3147 (see http://www.python.org/dev/peps/pep-3147/)
+PYMAGICTAG=	${PYTHON_CMD} -c 'import imp; print(imp.get_tag())'
+add-plist-post:
+	@${AWK} '\
+		/\.py[co]$$/ && !($$0 ~ "/" pc "/") {id = match($$0, /\/[^\/]+\.py[co]$$/); if (id != 0) {d = substr($$0, 1, RSTART - 1); dirs[d] = 1}; sub(/\.py[co]$$/,  "." mt "&"); sub(/[^\/]+\.py[co]$$/, pc "/&"); print; next} \
+		/^@dirrm / {d = substr($$0, 8); if (d in dirs) {print $$0 "/" pc}; print $$0; next} \
+		{print} \
+		END {if (sp in dirs) {print "@dirrm " sp "/" pc}} \
+		' \
+		pc="__pycache__" mt="$$(${PYMAGICTAG})" sp="${PYTHON_SITELIBDIR:S,${PYTHONBASE}/,,g}" \
+		${TMPPLIST} > ${TMPPLIST}.pyc_tmp
+	@${MV} ${TMPPLIST}.pyc_tmp ${TMPPLIST}
_______________________________________________
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 4 Ruslan Makhmatkhanov freebsd_committer freebsd_triage 2012-10-07 09:17:07 UTC
State Changed
From-To: open->closed

Committed, thank you!