Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Jan 2017 18:36:23 +0000 (UTC)
From:      Sunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r431116 - in head/databases/py-leveldb: . files
Message-ID:  <201701101836.v0AIaNiT017899@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sunpoet
Date: Tue Jan 10 18:36:23 2017
New Revision: 431116
URL: https://svnweb.freebsd.org/changeset/ports/431116

Log:
  Use shared library from ports instead of bundled one
  
  - Add patch to remove max_cache which is not in official leveldb 1.19
  - Bump PORTREVISION for dependency and package change

Added:
  head/databases/py-leveldb/files/patch-leveldb_object.cc   (contents, props changed)
Modified:
  head/databases/py-leveldb/Makefile
  head/databases/py-leveldb/files/patch-setup.py

Modified: head/databases/py-leveldb/Makefile
==============================================================================
--- head/databases/py-leveldb/Makefile	Tue Jan 10 18:32:50 2017	(r431115)
+++ head/databases/py-leveldb/Makefile	Tue Jan 10 18:36:23 2017	(r431116)
@@ -3,6 +3,7 @@
 
 PORTNAME=	leveldb
 PORTVERSION=	0.20
+PORTREVISION=	1
 CATEGORIES=	databases python
 MASTER_SITES=	CHEESESHOP
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
@@ -12,10 +13,16 @@ COMMENT=	Thread-safe Python binding for 
 
 LICENSE=	BSD3CLAUSE
 
+LIB_DEPENDS=	libleveldb.so:databases/leveldb
+
 PORTSCOUT=	skipv:0.194
 
 USE_PYTHON=	autoplist concurrent distutils
-USES=		python
+USES=		localbase python
+
+post-patch:
+	@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|' ${WRKSRC}/${PYSETUP}
+	@${RM} -r ${WRKSRC}/leveldb/ ${WRKSRC}/snappy/
 
 post-install:
 	${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/leveldb.so

Added: head/databases/py-leveldb/files/patch-leveldb_object.cc
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/databases/py-leveldb/files/patch-leveldb_object.cc	Tue Jan 10 18:36:23 2017	(r431116)
@@ -0,0 +1,29 @@
+--- leveldb_object.cc.orig	2016-12-27 23:03:15 UTC
++++ leveldb_object.cc
+@@ -901,9 +901,8 @@ static int PyLevelDB_init(PyLevelDB* sel
+ 	int block_size = 4096;
+ 	int max_open_files = 1000;
+ 	int block_restart_interval = 16;
+-  int max_file_size = 2 << 20;
+ 	const char* kwargs[] = {"filename", "create_if_missing", "error_if_exists", "paranoid_checks", "write_buffer_size",
+-    "block_size", "max_open_files", "block_restart_interval", "block_cache_size", "max_file_size", "comparator", 0};
++    "block_size", "max_open_files", "block_restart_interval", "block_cache_size", "comparator", 0};
+ 
+ 	PyObject* comparator = 0;
+ 
+@@ -917,7 +916,6 @@ static int PyLevelDB_init(PyLevelDB* sel
+ 		&max_open_files,
+ 		&block_restart_interval,
+ 		&block_cache_size,
+-		&max_file_size,
+ 		&comparator))
+ 		return -1;
+ 
+@@ -963,7 +961,6 @@ static int PyLevelDB_init(PyLevelDB* sel
+ 	self->_options->block_restart_interval = block_restart_interval;
+ 	self->_options->compression = leveldb::kSnappyCompression;
+ 	self->_options->block_cache = self->_cache;
+-	self->_options->max_file_size = max_file_size;
+ 	self->_options->comparator = self->_comparator;
+ 	leveldb::Status status;
+ 

Modified: head/databases/py-leveldb/files/patch-setup.py
==============================================================================
--- head/databases/py-leveldb/files/patch-setup.py	Tue Jan 10 18:32:50 2017	(r431115)
+++ head/databases/py-leveldb/files/patch-setup.py	Tue Jan 10 18:36:23 2017	(r431116)
@@ -1,6 +1,23 @@
 --- setup.py.orig	2016-12-27 23:05:34 UTC
 +++ setup.py
-@@ -31,11 +31,11 @@ if system == 'Darwin':
+@@ -14,15 +14,11 @@ from setuptools import setup, Extension
+ 
+ system, node, release, version, machine, processor = platform.uname()
+ common_flags = [
+-    '-I./leveldb/include',
+-    '-I./leveldb',
+-    '-I./snappy',
++    '-I%%LOCALBASE%%/include',
+     '-I.',
+     '-fno-builtin-memcmp',
+     '-O2',
+     '-fPIC',
+-    '-DNDEBUG',
+-    '-DSNAPPY',
+ ]
+ 
+ if system == 'Darwin':
+@@ -31,11 +27,11 @@ if system == 'Darwin':
          '-DLEVELDB_PLATFORM_POSIX',
          '-Wno-error=unused-command-line-argument-hard-error-in-future',
      ]
@@ -14,3 +31,62 @@
          '-DLEVELDB_PLATFORM_POSIX',
      ]
  else:
+@@ -74,57 +70,11 @@ setup(
+     ext_modules = [
+         Extension('leveldb',
+             sources = [
+-                # snappy
+-                './snappy/snappy.cc',
+-                './snappy/snappy-stubs-internal.cc',
+-                './snappy/snappy-sinksource.cc',
+-                './snappy/snappy-c.cc',
+-
+-                #leveldb
+-                'leveldb/db/builder.cc',
+-                'leveldb/db/c.cc',
+-                'leveldb/db/db_impl.cc',
+-                'leveldb/db/db_iter.cc',
+-                'leveldb/db/dbformat.cc',
+-                'leveldb/db/filename.cc',
+-                'leveldb/db/log_reader.cc',
+-                'leveldb/db/log_writer.cc',
+-                'leveldb/db/memtable.cc',
+-                'leveldb/db/repair.cc',
+-                'leveldb/db/table_cache.cc',
+-                'leveldb/db/version_edit.cc',
+-                'leveldb/db/version_set.cc',
+-                'leveldb/db/write_batch.cc',
+-                'leveldb/table/block.cc',
+-                'leveldb/table/block_builder.cc',
+-                'leveldb/table/filter_block.cc',
+-                'leveldb/table/format.cc',
+-                'leveldb/table/iterator.cc',
+-                'leveldb/table/merger.cc',
+-                'leveldb/table/table.cc',
+-                'leveldb/table/table_builder.cc',
+-                'leveldb/table/two_level_iterator.cc',
+-                'leveldb/util/arena.cc',
+-                'leveldb/util/bloom.cc',
+-                'leveldb/util/cache.cc',
+-                'leveldb/util/coding.cc',
+-                'leveldb/util/comparator.cc',
+-                'leveldb/util/crc32c.cc',
+-                'leveldb/util/env.cc',
+-                'leveldb/util/env_posix.cc',
+-                'leveldb/util/filter_policy.cc',
+-                'leveldb/util/hash.cc',
+-                'leveldb/util/histogram.cc',
+-                'leveldb/util/logging.cc',
+-                'leveldb/util/options.cc',
+-                'leveldb/util/status.cc',
+-                'leveldb/port/port_posix.cc',
+-
+                 # python stuff
+                 'leveldb_ext.cc',
+                 'leveldb_object.cc',
+             ],
+-            libraries = ['stdc++'],
++            libraries = ['leveldb'],
+             extra_compile_args = extra_compile_args,
+         )
+     ]



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701101836.v0AIaNiT017899>