Bug 161167 - security/botan configure does not work with python 3.1
Summary: security/botan configure does not work with python 3.1
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: Michael Scheidell
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-30 18:00 UTC by Jeremy C. Reed
Modified: 2011-12-03 18:40 UTC (History)
0 users

See Also:


Attachments
patch-configure.py (7.56 KB, TEXT/PLAIN; charset=US-ASCII)
2011-10-24 22:29 UTC, Jeremy C. Reed
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy C. Reed 2011-09-30 18:00:19 UTC
ports/security/botan/Makefile has:
USE_PYTHON_BUILD= yes

If it uses python 3.1 it will fail. This is a known problem and is documented in the botan docs included in the tarball:

``Botan's build is controlled by configure.py, which is a Python
script. Python 2.4 or later is required (but if you want to use the
incompatible Python 3, you must first run the 2to3 script on
it).''

(I didn't check using 2to3 lately but last time I tried it failed.)

So I changed the port's Makefile to use:

USE_PYTHON_BUILD=       2.4-2.7

But if use defined in make.conf PYTHON_VERSION=3.1 then it fails with: ===>  botan-1.8.11 needs Python 2.7 at most. But you specified 3.1.

So I attempted to use bsd.port.pre.mk and check PYTHON_VERSION is 3.1 to reset to PYTHON_VERSION_DEFAULT (if that isn't 3.1 either else 2.7) but didn't figure it out yet. Maybe that is an option.

Also if 2.6 is installed if seems to want to install 2.7. I can't figure out how to get it to use 2.6 which is good enough.

I also changed the post-patch so it uses correct python interpreter.

post-patch:
        ${REINPLACE_CMD} -e "s|#!/usr/bin/env python|#!${PYTHON_CMD}|" \
                        ${WRKSRC}/configure.py
.if defined(NOPORTDOCS)
        ${REINPLACE_CMD} -e '/$$(MKDIR_INSTALL) $$(DOCDIR)/d' \
                        -e '/$$(INSTALL_CMD_DATA) $$$$i $$(DOCDIR); /d' \
                        ${WRKSRC}/src/build-data/makefile/unix_shr.in
.endif

Fix: 

Make it use python 2.4-2.7. Or patch the configure.py script to be portable for python 3.1 also.
How-To-Repeat: Use python3.1 and attempt to install botan from ports.
Comment 1 Jeremy C. Reed 2011-10-24 22:29:19 UTC
Please upgrade to 1.8.13.

From the upstream changelog:

* 1.8.13, 2011-07-02
 - A race in Algorithm_Factory that could cause crashes in multithreaded
   code has been fixed.

* 1.8.12, 2011-06-20
 - If EMSA3(Raw) was used for more than one signature, it would produce
   incorrect output.
 - Fix the --enable-debug option to configure.py
 - Improve OS detection on Cygwin
 - Fix compilation under Sun Studio 12 on Solaris
 - Fix a memory leak in the constructors of DataSource_Stream and
   DataSink_Stream which would occur if opening the file failed. PR 144


In addition the attachment (patch-configure.py) provides a patch from 
the mtn-based botan repo for some python portabilities plus I ran 
2to3-3.1. The upstream change history also says:

|   Fix matching of CPU submodels. Because we search arches in basically
|   random order, a regex match could match things unexpectedly. In
|   particular, --cpu=s390x would canonicalize to s390 because it was 
hit
|   first. To fix, first search for an exact match through all arches
|   including submodels. Then, if we failed, try matching via regex.

(That may be in 1.8.14.)

If you don't use this patch as-is, please confirm that your patch works 
with both python 2.6 and python 3.1. Thank you.

--- ../botan.orig/Makefile	2011-10-24 20:00:42.000000000 +0000
+++ Makefile	2011-10-24 20:06:18.000000000 +0000
@@ -7,7 +7,7 @@
 #
 
 PORTNAME=	botan
-PORTVERSION=	1.8.11
+PORTVERSION=	1.8.13
 CATEGORIES=	security
 MASTER_SITES=	http://files.randombit.net/botan/v1.8/
 DISTNAME=	Botan-${PORTVERSION}
@@ -57,8 +57,10 @@
 CONFIGURE_ARGS+=--with-tr1-implementation=none
 .endif
 
-.if defined(NOPORTDOCS)
 post-patch:
+	${REINPLACE_CMD} -e "s|#!/usr/bin/env python|#!${PYTHON_CMD}|" \
+			${WRKSRC}/configure.py
+.if defined(NOPORTDOCS)
 	${REINPLACE_CMD} -e '/$$(MKDIR_INSTALL) $$(DOCDIR)/d' \
 			-e '/$$(INSTALL_CMD_DATA) $$$$i $$(DOCDIR); /d' \
 			${WRKSRC}/src/build-data/makefile/unix_shr.in
--- ../botan.orig/distinfo	2011-10-24 20:01:30.000000000 +0000
+++ distinfo	2011-10-24 19:32:40.000000000 +0000
@@ -1,2 +1,2 @@
-SHA256 (Botan-1.8.11.tbz) = c3b60a2c3dfcbe7b21626e8459e5134d3cbabe45b6d94f454860b99798739ba4
-SIZE (Botan-1.8.11.tbz) = 2808114
+SHA256 (Botan-1.8.13.tbz) = 5593ce257d753c305ecf6f4d16e2f516f647bd6494f823fe9766a816ac439dba
+SIZE (Botan-1.8.13.tbz) = 2811686
Comment 2 Michael Scheidell freebsd_committer freebsd_triage 2011-12-02 01:57:00 UTC
State Changed
From-To: open->feedback

I'll take it. 
Jeremy: 
The patch got trashed when you uploaded it. 
Can you resend it? or email it to me directly? 


Comment 3 Michael Scheidell freebsd_committer freebsd_triage 2011-12-02 01:57:00 UTC
Responsible Changed
From-To: freebsd-ports-bugs->scheidell

i'll take it 
Jeremy: 
The patch submitted to pr got trashed.  Can you resend it or 
email it directly to me?
Comment 4 Michael Scheidell freebsd_committer freebsd_triage 2011-12-03 18:36:17 UTC
State Changed
From-To: feedback->closed

Committed, thanks
Comment 5 dfilter service freebsd_committer freebsd_triage 2011-12-03 18:39:41 UTC
scheidell    2011-12-03 18:39:29 UTC

  FreeBSD ports repository

  Modified files:
    security/botan       Makefile distinfo 
  Added files:
    security/botan/files patch-configure.py 
  Log:
  - upgrade to 1.8.13
  - race condition could cause crashes
  - upgrade to 1.8.12
  - fixed memory leak (botan pr 144)
  - added patch from upstream in repo for python portability issues
  
  PR:     161167
  Submitted by:   jreed@isc.org
  Approved by:    maintainer (timeout), gabor (mentor)
  Feature safe:   yes
  
  Revision  Changes    Path
  1.56      +4 -2      ports/security/botan/Makefile
  1.36      +2 -2      ports/security/botan/distinfo
  1.1       +201 -0    ports/security/botan/files/patch-configure.py (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"