ports/155971: [PATCH] databases/sqlite3: always enable EXTENSIONS

Pan Tsu inyaoo at gmail.com
Tue Mar 29 05:50:30 UTC 2011


Matthias Andree <mandree at FreeBSD.org> writes:

[...]
> How about the attached patch to www/firefox?  It performs this check in
> pre-everything (in case sqlite3 is already installed) and again in
> pre-build (if it got installed in the 'make depends' stage).

Why are you trying to fix only firefox? Every user of py-sqlite3 is affected.

  $ python -c 'import sqlite3'
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "LOCALBASE/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
      from dbapi2 import *
    File "LOCALBASE/lib/python2.7/sqlite3/dbapi2.py", line 27, in <module>
      from _sqlite3 import *
  ImportError: LOCALBASE/lib/python2.7/site-packages/_sqlite3.so: Undefined symbol "sqlite3_load_extension"

Most are run dependency, so they fail during run, e.g.

  $ flexget
  FATAL: Unable to use SQLite. Are you running Python 2.5.x or 2.6.x ?
  Python should normally have SQLite support built in.
  If you're running correct version of Python then it is not equipped with SQLite.
  Try installing `pysqlite` and / or if you have compiled python yourself, recompile it with SQLite support.

  # runs fine but the Library doesn't work
  $ comix
  ! Could neither find pysqlite2 nor sqlite3.
  load: 0.18  cmd: python 39505 [select] 1.55r 0.17u 0.06s 1% 42872k

but some are not, e.g.

  $ make install
  [...]
  gmake[4]: Entering directory `/usr/ports/chinese/ibus-pinyin/work/ibus-pinyin-1.3.8/data/db/android'
  gmake[4]: Nothing to be done for `install-exec-am'.
    GEN    android.db
  Traceback (most recent call last):
    File "./create_db.py", line 2, in <module>
      import sqlite3
    File "LOCALBASE/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
      from dbapi2 import *
    File "LOCALBASE/lib/python2.7/sqlite3/dbapi2.py", line 27, in <module>
      from _sqlite3 import *
  ImportError: LOCALBASE/lib/python2.7/site-packages/_sqlite3.so: Undefined symbol "sqlite3_load_extension"
  test -z "PREFIX/share/ibus-pinyin/db" || ../../.././install-sh -c -d "PREFIX/share/ibus-pinyin/db"
   install   -m 444 ./android.db 'PREFIX/share/ibus-pinyin/db'
  install: ./android.db: No such file or directory
  gmake[4]: *** [install-main_dbDATA] Error 71

As for slave port, if you make py-sqlite3 depend on PKGNAMESUFFIX
(or absence) via RUN_DEPENDS it'd guarantee that the port always works
even if PLIST is identical.

  $ cd py-sqlite3; make install
  [...]
  ===>  sqlite3-3.7.5_1 conflicts with installed package(s):
        sqlite3-noext-3.7.5_1

  # to resolve conflict
  $ cd sqlite3-noext; make deinstall
  $ cd sqlite3; make install
  $ cd py-sqlite3; make install

Any dependent ports would fail to build/install because py-sqlite3
dependency cannot be satisfied.

--- a.diff begins here ---
Index: UPDATING
===================================================================
RCS file: /a/.cvsup/ports/UPDATING,v
retrieving revision 1.1047
diff -u -p -r1.1047 UPDATING
--- UPDATING	25 Mar 2011 10:33:31 -0000	1.1047
+++ UPDATING	29 Mar 2011 05:05:29 -0000
@@ -5,6 +5,13 @@ they are unavoidable.
 You should get into the habit of checking this file for changes each time
 you update your ports collection, before attempting any port upgrades.
 
+XXXXXXXX:
+  AFFECTS: databases/sqlite3
+  AUTHOR: none@
+
+  EXTENSION was enabled unconditionally. For sqlite3 without its support
+  refer to databases/sqlite3-noext port.
+
 20110324:
   AFFECTS: users of KDE SC 4
   AUTHOR: kde at FreeBSD.org
Index: databases/Makefile
===================================================================
RCS file: /a/.cvsup/ports/databases/Makefile,v
retrieving revision 1.964
diff -u -p -r1.964 Makefile
--- databases/Makefile	21 Mar 2011 20:41:48 -0000	1.964
+++ databases/Makefile	29 Mar 2011 03:07:56 -0000
@@ -785,6 +785,7 @@
     SUBDIR += sqlite-ext-mobigroup
     SUBDIR += sqlite2
     SUBDIR += sqlite3
+    SUBDIR += sqlite3-noext
     SUBDIR += sqlite34
     SUBDIR += sqliteman
     SUBDIR += sqlitemanager
Index: databases/sqlite3/Makefile
===================================================================
RCS file: /a/.cvsup/ports/databases/sqlite3/Makefile,v
retrieving revision 1.55
diff -u -p -r1.55 Makefile
--- databases/sqlite3/Makefile	4 Mar 2011 14:00:56 -0000	1.55
+++ databases/sqlite3/Makefile	29 Mar 2011 05:06:29 -0000
@@ -7,6 +7,7 @@
 
 PORTNAME=	sqlite3
 PORTVERSION=	3.7.5
+PORTREVISION?=	1
 CATEGORIES=	databases
 MASTER_SITES=	http://www.sqlite.org/ http://www2.sqlite.org/
 DISTNAME=	sqlite-src-3070500
@@ -19,7 +20,7 @@ LICENSE_NAME=	Public Domain
 LICENSE_PERMS=	${_LICENSE_PERMS_DEFAULT}
 LICENSE_TEXT=	Description of the license can be obtained from the following URL: http://www.sqlite.org/copyright.html
 
-CONFLICTS=	sqlite34-[0-9]*
+CONFLICTS+=	sqlite34-[0-9]*
 
 USE_ZIP=	YES
 USE_GMAKE=	YES
@@ -50,7 +53,6 @@ OPTIONS=	\
 		SECURE_DELETE	"Overwrite deleted information with zeros" on \
 		UNLOCK_NOTIFY	"Enable notification on unlocking"	on \
 		THREADSAFE	"Build thread-safe library"		on \
-		EXTENSION	"Allow loadable extensions"		on \
 		TCLWRAPPER	"Enable TCL wrapper"			off \
 
 .include <bsd.port.options.mk>
@@ -178,10 +180,13 @@ CONFIGURE_ARGS+=	--enable-threadsafe
 CONFIGURE_ARGS+=	--disable-threadsafe
 .endif
 
-.if !defined(WITHOUT_EXTENSION)
+.if ${SLAVE_PORT} == "no"
 CONFIGURE_ARGS+=	--enable-load-extension
+CONFLICTS+=		sqlite3-noext-[0-9]*
 .else
+. if defined(WITHOUT_EXTENSION)
 CONFIGURE_ARGS+=	--disable-load-extension
+. endif
 .endif
 
 CONFIGURE_ENV+=		CPPFLAGS="-I. -I./src ${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
Index: databases/sqlite3-noext/Makefile
===================================================================
RCS file: databases/sqlite3-noext/Makefile
diff -N databases/sqlite3-noext/Makefile
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ databases/sqlite3-noext/Makefile	29 Mar 2011 05:23:20 -0000
@@ -0,0 +1,19 @@
+# Ports collection makefile for:	sqlite3-noext
+# Date created:				29 Mar 2011
+# Whom:					none
+#
+# $FreeBSD$
+#
+
+PKGNAMESUFFIX=	-noext
+
+WITHOUT_EXTENSION= yes
+CONFLICTS=	sqlite3-[0-9]*
+LATEST_LINK=	sqlite3-noext
+
+# force default options
+#_OPTIONS_OK=	yes
+
+MASTERDIR=	${.CURDIR}/../../databases/sqlite3
+
+.include "${MASTERDIR}/Makefile"
Index: databases/py-sqlite3/Makefile
===================================================================
RCS file: /a/.cvsup/ports/databases/py-sqlite3/Makefile,v
retrieving revision 1.8
diff -u -p -r1.8 Makefile
--- databases/py-sqlite3/Makefile	28 Oct 2010 21:00:08 -0000	1.8
+++ databases/py-sqlite3/Makefile	29 Mar 2011 05:11:27 -0000
@@ -7,7 +7,7 @@
 
 PORTNAME=	sqlite3
 PORTVERSION=	${PYTHON_PORTVERSION}
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	databases python
 MASTER_SITES=	${PYTHON_MASTER_SITES}
 MASTER_SITE_SUBDIR=	${PYTHON_MASTER_SITE_SUBDIR}
@@ -18,6 +18,7 @@ MAINTAINER=	python at FreeBSD.org
 COMMENT=	Standard Python binding to the SQLite3 library
 
 LIB_DEPENDS=	sqlite3.8:${PORTSDIR}/databases/sqlite3
+RUN_DEPENDS=	sqlite3>=0:${PORTSDIR}/databases/sqlite3
 
 PLIST_FILES=	lib/%%PYTHON_VERSION%%/site-packages/_sqlite3.so
 DIST_SUBDIR=	python
--- a.diff ends here ---


More information about the freebsd-python mailing list