Bug 189131 - [PATCH] databases/py-bsddb3: Fails to build with Python 3.x
Summary: [PATCH] databases/py-bsddb3: Fails to build with Python 3.x
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Some People
Assignee: John Marino
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-30 09:50 UTC by Volodymyr Kostyrko
Modified: 2014-09-20 17:12 UTC (History)
3 users (show)

See Also:


Attachments
file.diff (1.23 KB, patch)
2014-04-30 09:50 UTC, Volodymyr Kostyrko
no flags Details | Diff
bsddb3.patch (1.93 KB, patch)
2014-09-04 08:50 UTC, Volodymyr Kostyrko
koobs: maintainer-approval-
Details | Diff
py-bsddb3-6.1.0 (2.21 KB, patch)
2014-09-06 11:19 UTC, Muhammad Moinur Rahman
bofh: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Volodymyr Kostyrko 2014-04-30 09:50:00 UTC
When building for python3.x the port can't correctly point to valid db.h header. Fix is copied from python2.x patch.

Fix: Patch attached with submission follows:
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2014-04-30 09:50:04 UTC
Responsible Changed
From-To: freebsd-ports-bugs->freebsd-python

freebsd-python@ wants this port PRs (via the GNATS Auto Assign Tool)
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2014-04-30 09:50:05 UTC
Maintainer of databases/py-bsddb3,

Please note that PR ports/189131 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/189131

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 3 Edwin Groothuis freebsd_committer freebsd_triage 2014-04-30 09:50:06 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 4 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2014-04-30 13:16:43 UTC
>Submitter-Id:	current-users
>Originator:	Muhammad Moinur Rahman
>Organization:	
>Confidential:	no
>Synopsis:	Re: ports/189131: databases/py-bsddb3 - fails to build with python3.x
>Severity:	non-critical
>Priority:	low
>Category:	ports
>Class:		change-request
>Release:	FreeBSD 11.0-CURRENT amd64
>Environment:
System: FreeBSD bofh.1asiacom.net 11.0-CURRENT FreeBSD 11.0-CURRENT #1 r263870: Fri Mar 28 16:37:49 BDT
>Description:
- Fixed Building in 3.X
- Added OPTIONS to chose between 2.X and 3.X
- OPTIONS default to build for 3.X as database/py-bsddb exists for 2.X

Generated with FreeBSD Port Tools 1.02 (mode: change, diff: ports)
>How-To-Repeat:
>Fix:

--- py-bsddb3-6.0.1.patch begins here ---
diff -ruN /usr/ports//databases/py-bsddb3/Makefile ./Makefile
--- /usr/ports//databases/py-bsddb3/Makefile	2014-04-28 21:07:11.000000000 +0600
+++ ./Makefile	2014-04-30 18:14:10.681435022 +0600
@@ -3,6 +3,7 @@
 
 PORTNAME=	bsddb3
 PORTVERSION=	6.0.1
+PORTREVISION=	1
 CATEGORIES=	databases python
 MASTER_SITES=	CHEESESHOP
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
@@ -12,11 +13,17 @@
 
 LICENSE=	BSD3CLAUSE
 
-USE_BDB=	43+
-USE_PYTHON=		yes
 USE_PYDISTUTILS=	yes
 PYDISTUTILS_AUTOPLIST=	yes
 
+OPTIONS_SINGLE=	PYTHON
+OPTIONS_SINGLE_PYTHON=	PYTHON2 PYTHON3
+OPTIONS_DEFAULT=	PYTHON3
+PYTHON2_DESC=	Build with Python 2.X version
+PYTHON3_DESC=	Build with Python 3.X version
+PYTHON2_USE=	BDB=43+ PYTHON=2.7
+PYTHON3_USE=	BDB=48+ PYTHON=3
+
 PYDISTUTILS_CONFIGUREARGS=--libs="-l${BDB_LIB_NAME}" --berkeley-db=${LOCALBASE}
 PYDISTUTILS_BUILDARGS=	--libs="-l${BDB_LIB_NAME}" --berkeley-db=${LOCALBASE}
 PYDISTUTILS_INSTALLARGS=-c -O1 --prefix=${PREFIX} --berkeley-db=${LOCALBASE}
@@ -27,7 +34,8 @@
 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
-	${REINPLACE_CMD} 's,%%BDB_INCLUDE_DIR%%,${BDB_INCLUDE_DIR},' ${WRKSRC}/setup2.py
+	${REINPLACE_CMD} 's,%%BDB_INCLUDE_DIR%%,${BDB_INCLUDE_DIR},' ${WRKSRC}/setup2.py ${WRKSRC}/setup3.py
+	${REINPLACE_CMD} 's,METH_VARARGS||METH_KEYWORDS,METH_VARARGS|METH_KEYWORDS,' ${WRKSRC}/Modules/_bsddb.c
 
 post-install:
 	@${MKDIR} ${STAGEDIR}${DOCSDIR}
diff -ruN /usr/ports//databases/py-bsddb3/files/patch-setup3.py ./files/patch-setup3.py
--- /usr/ports//databases/py-bsddb3/files/patch-setup3.py	2014-01-22 23:40:44.000000000 +0600
+++ ./files/patch-setup3.py	2014-04-30 17:57:15.055501410 +0600
@@ -1,6 +1,6 @@
 --- setup3.py.orig	2011-03-15 16:10:41.000000000 +0800
 +++ setup3.py	2011-03-15 16:12:40.000000000 +0800
-@@ -53,10 +53,7 @@
+@@ -86,10 +86,7 @@
              category=DeprecationWarning)
  
  
@@ -12,7 +12,7 @@
  
  from distutils.dep_util import newer
  import distutils.ccompiler
-@@ -247,8 +244,8 @@
+@@ -292,8 +289,8 @@
          incdir = os.path.join(BERKELEYDB_DIR, 'include')
      if not libdir:
          libdir = os.path.join(BERKELEYDB_DIR, 'lib')
@@ -23,3 +23,12 @@
      else:
          if debug: print("LIBS already contains '-ldb' not adding our own", "'-l"+dblib+"'")
          libname = []
+@@ -332,7 +329,7 @@
+ 
+     # read db.h to figure out what version of Berkeley DB this is
+     ver = None
+-    db_h_lines = open(os.path.join(incdir, 'db.h'), 'r').readlines()
++    db_h_lines = open('%%BDB_INCLUDE_DIR%%/db.h', 'r').readlines()
+     db_ver_re = re.compile(
+         r'^#define\s+DB_VERSION_STRING\s.*Berkeley DB (\d+\.\d+).*')
+     db_ver2 = db_ver
--- py-bsddb3-6.0.1.patch ends here ---
Comment 5 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2014-04-30 13:32:17 UTC
For Committer's reference for the updated patch:
http://pdr.s.ubze.ro/bulk/latest-per-pkg/py27-bsddb3/6.0.1_1/
http://pdr.s.ubze.ro/bulk/latest-per-pkg/py33-bsddb3/6.0.1_1/


On Wed, Apr 30, 2014 at 2:50 PM, Edwin Groothuis <edwin@freebsd.org> wrote:

> Maintainer of databases/py-bsddb3,
>
> Please note that PR ports/189131 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/189131
>
> --
> Edwin Groothuis via the GNATS Auto Assign Tool
> edwin@FreeBSD.org
>
Comment 6 Carlo Strub freebsd_committer freebsd_triage 2014-08-31 17:30:37 UTC
back to pool
Comment 7 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2014-08-31 18:21:30 UTC
I think this has been fixed while I have submitted my last patch for update 192988. This should be closed. 
(In reply to Carlo Strub from comment #6)
> back to pool
Comment 8 Volodymyr Kostyrko 2014-09-04 08:49:45 UTC
This is not fixed yet. I still can't build it for python3.x.

===>   py33-bsddb3-6.1.0 depends on package: py33-setuptools33>0 - found
===>   py33-bsddb3-6.1.0 depends on file: /usr/local/bin/python3.3 - found
===>   py33-bsddb3-6.1.0 depends on shared library: libdb-4.8.so - found (/usr/local/lib/db48/libdb-4.8.so.0.0.0)
===>  Configuring for py33-bsddb3-6.1.0
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "setup.py", line 42, in <module>
    import setup3
  File "./setup3.py", line 336, in <module>
    f = open(os.path.join(incdir, 'db.h'), 'r')
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/include/db.h'
*** Error code 1

I attached updated patch. https://redports.org/buildarchive/20140904084501-28683/
Comment 9 Volodymyr Kostyrko 2014-09-04 08:50:38 UTC
Created attachment 146769 [details]
bsddb3.patch
Comment 10 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2014-09-06 11:19:18 UTC
Created attachment 146920 [details]
py-bsddb3-6.1.0

It seems like you have hardcoded db-4.8 version which is not a good idea, additionally currently the default version seems to be 5. So I have modified it a bit.

Poudriere logs:
http://pdr.s.ubze.ro/bulk/latest-per-pkg/py33-bsddb3/6.1.0/

For testing purpose I have used USES=python:3
Comment 11 Kubilay Kocak freebsd_committer freebsd_triage 2014-09-06 11:31:06 UTC
Comment on attachment 146769 [details]
bsddb3.patch

At the present moment we have a patch with no flags submitted by original reporter, and a follow up patch with maintainer_approval.

Clarity required by rejecting one or the other.
Comment 12 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2014-09-06 11:45:56 UTC
As the maintainer I have checked the patch reported by the reportee. Unfortunately that patch doesn't workout for default version of db that is 5 as he has replaced something in setup3.py with a hardcoded version of db-4.8. I have replaced it with BDB_LIB_VER. Hence I cannot approve his patch. And I cannot make it obsolete too.

(In reply to Kubilay Kocak from comment #11)
> Comment on attachment 146769 [details]
> bsddb3.patch
> 
> At the present moment we have a patch with no flags submitted by original
> reporter, and a follow up patch with maintainer_approval.
> 
> Clarity required by rejecting one or the other.
Comment 13 Kubilay Kocak freebsd_committer freebsd_triage 2014-09-06 11:48:45 UTC
I've added the maintainer_approval requestee to yourself, can you try to set it to value '-' please
Comment 14 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2014-09-06 11:52:45 UTC
Noops. I don't even see the drop down button. In fact there is no "edit details" link beside the title of the patch. But so far I believe there was this option enabled for me as I have done it on others patch.
Comment 15 John Marino freebsd_committer freebsd_triage 2014-09-20 15:24:06 UTC
Maintainer has rejected the patch.
For now, I'm moving it back to "open".
Does this PR need to be rejected (closed) outright?
Comment 16 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2014-09-20 15:28:18 UTC
I have rejected the original one. Couldn't mark it obsolete. But have submitted another which works perfectly.
(In reply to John Marino from comment #15)
> Maintainer has rejected the patch.
> For now, I'm moving it back to "open".
> Does this PR need to be rejected (closed) outright?
Comment 17 John Marino freebsd_committer freebsd_triage 2014-09-20 15:32:31 UTC
more trying the reinvent the working wheel badly I see.
Comment 18 John Marino freebsd_committer freebsd_triage 2014-09-20 15:33:13 UTC
(that was not a reference to the new patch, but the attempt to avoid obsoleting the old patch)
Comment 19 commit-hook freebsd_committer freebsd_triage 2014-09-20 17:11:35 UTC
A commit references this bug:

Author: marino
Date: Sat Sep 20 17:10:36 UTC 2014
New revision: 368665
URL: http://svnweb.freebsd.org/changeset/ports/368665

Log:
  databases/py-bsddb3: Fix build with python 3.x

  PR:		189131
  Reported by:	arcade (b1t.name)
  Fixed by:	maintainer (Muhammad Rahman)

Changes:
  head/databases/py-bsddb3/Makefile
  head/databases/py-bsddb3/files/patch-setup3.py
Comment 20 John Marino freebsd_committer freebsd_triage 2014-09-20 17:12:04 UTC
Thanks!