Klemens Nanni writes: > On Sun, Dec 29, 2019 at 07:57:46PM -0800, Nam Nguyen wrote: >> Python 2 is used because python 3 is currently problematic, as >> reported by FreeBSD. https://github.com/arvidn/libtorrent/issues/4204 > Perhaps some other issue, I don't quite recall, but broken Python 3 > support is what halted my efforts earlier this year trying to update it. > > For now, I wasted enough time on this and have no plans to give it > another before upstream fully supports Python 3, sorry.
Here is a new diff updating libtorrent-rasterbar to 1.2.3 incorporating feedback from kn@ that: * Uses fix for devel/boost python 3 bindings https://marc.info/?l=openbsd-ports&m=157941202507663&w=2 * Stays with current build system and not cmake * Runs unit tests * SHARED_LIBS comment # 10.0.0. From `set (SOVERSION "10")' in CMakeLists.txt. The unit tests take 17 minutes to run, and they are run in parallel. This gives the impression that the test suite is frozen since you get no sense of progress until it is complete. The benefit of cmake would be that although the tests are run sequentially, it prints out progress. However, this is not compelling enough to switch to cmake, so I propose just saying on the current build system. (I had failed to give a reason for the move to cmake in my initial proposal.) In my initial proposal I noted that test_web_seed_http and test_url_seed were important unit tests. I managed to resolve test_url_seed with apatch to OpenBSD's devel/boost at boost/asio/detail/impl/socket_ops.ipp. I have not yet solved the web seed test. I will incorporate my work upstream with boost asio instead of carrying a patch. https://github.com/arvidn/libtorrent/issues/4211 > >> Testing >> ======= >> Feedback and tests are welcome because this is a major update. I tested >> it by downloading and seeding a linux ISO. I did not get to test a thin >> client / server setup for example. > qbittorrent is another consumer, did you test this as well? I tested qbittorrent, and it works. I will post the qbittorrent update shortly. I had rushed the initial port update without testing it. Feedback and tests are welcome. > > Port-wise looks good so far, but as per above I haven't tested any of > it; a few comments/nits inline. > >> -SHARED_LIBS += torrent-rasterbar 1.0 # 9.0.0 >> +SHARED_LIBS += torrent-rasterbar 2.0 # 9.0.0 > I think upstream's version got bumped to 10.0.0 or so, did you check? > >> -MODULES = lang/python >> +MODULES = devel/cmake \ >> + lang/python >> + >> +MODPY_SETUPTOOLS = Yes > Perhaps leave a comment about Python 3 being broken? > >> --- /dev/null 1 Jan 1970 00:00:00 -0000 >> +++ patches/patch-include_libtorrent_buffer_hpp 30 Dec 2019 02:32:22 >> -0000 >> @@ -0,0 +1,23 @@ >> +$OpenBSD$ > Please add a brief comment such that it appears in `make patch' > output. snip >> Index: patches/patch-test_setup_transfer_cpp >> =================================================================== >> RCS file: patches/patch-test_setup_transfer_cpp >> diff -N patches/patch-test_setup_transfer_cpp >> --- /dev/null 1 Jan 1970 00:00:00 -0000 >> +++ patches/patch-test_setup_transfer_cpp 30 Dec 2019 02:32:22 -0000 >> @@ -0,0 +1,14 @@ >> +$OpenBSD$ > Same here. > >> +Index: test/setup_transfer.cpp >> +--- test/setup_transfer.cpp.orig >> ++++ test/setup_transfer.cpp >> +@@ -604,7 +604,7 @@ std::string get_python() >> + if (sz == buf.size() - 1) return buf.data(); >> + } >> + #endif >> +- return "python"; >> ++ return "${MODPY_BIN}"; > Perhaps you can replace the entire patch and SUBST_CMD with below? > > pre-test: > ln -s ${MODPY_BIN} ${WRKDIR}/python Index: Makefile =================================================================== RCS file: /cvs/ports/net/libtorrent-rasterbar/Makefile,v retrieving revision 1.8 diff -u -p -r1.8 Makefile --- Makefile 12 Jul 2019 20:48:31 -0000 1.8 +++ Makefile 19 Jan 2020 06:24:04 -0000 @@ -2,10 +2,10 @@ COMMENT = C++ library implementing a BitTorrent client -MODPY_EGG_VERSION = 1.1.13 +MODPY_EGG_VERSION = 1.2.3 DISTNAME = libtorrent-rasterbar-${MODPY_EGG_VERSION} -SHARED_LIBS += torrent-rasterbar 1.0 # 9.0.0 +SHARED_LIBS += torrent-rasterbar 2.0 # 10.0.0 CATEGORIES = net devel @@ -14,13 +14,13 @@ HOMEPAGE = https://libtorrent.org/ # BSD3 PERMIT_PACKAGE = Yes -WANTLIB += boost_chrono-mt boost_python boost_random-mt boost_system-mt -WANTLIB += crypto m ssl +WANTLIB += boost_python3 boost_system-mt crypto m ssl WANTLIB += ${COMPILER_LIBCXX} ${MODPY_WANTLIB} MASTER_SITES = https://github.com/arvidn/libtorrent/releases/download/libtorrent-${MODPY_EGG_VERSION:S/./_/g}/ MODULES = lang/python +MODPY_VERSION = ${MODPY_DEFAULT_VERSION_3} BUILD_DEPENDS = devel/libtool @@ -32,12 +32,15 @@ COMPILER = base-clang ports-gcc CONFIGURE_STYLE = gnu CONFIGURE_ARGS = --enable-python-binding \ + --enable-tests \ --with-boost-system=boost_system-mt \ + --with-boost-python=boost_python3 \ --with-libiconv CONFIGURE_ENV += CPPFLAGS="-Wno-deprecated-declarations \ -Wno-macro-redefined \ -pthread" \ - PYTHON_CXXFLAGS="${PYTHON_CXXFLAGS} -std=gnu++14" + PYTHON_CXXFLAGS="${PYTHON_CXXFLAGS} -std=gnu++14" \ + PYTHON=${MODPY_DEFAULT_VERSION_3} MAKE_ENV = CC="${CC}" CXX="${CXX}" CXXFLAGS += -std=gnu++14 @@ -47,5 +50,8 @@ CONFIGURE_ARGS += --enable-debug pre-configure: sed -i 's,-Os,,g' ${WRKSRC}/configure + +pre-test: + ln -sf ${MODPY_BIN} ${WRKDIR}/bin/python .include <bsd.port.mk> Index: distinfo =================================================================== RCS file: /cvs/ports/net/libtorrent-rasterbar/distinfo,v retrieving revision 1.5 diff -u -p -r1.5 distinfo --- distinfo 30 Apr 2019 16:45:26 -0000 1.5 +++ distinfo 19 Jan 2020 06:24:04 -0000 @@ -1,2 +1,2 @@ -SHA256 (libtorrent-rasterbar-1.1.13.tar.gz) = MAQHGYWOPAZjR2TgwXeHOOtC7NC0XoFK+nRjKalI6tc= -SIZE (libtorrent-rasterbar-1.1.13.tar.gz) = 3896007 +SHA256 (libtorrent-rasterbar-1.2.3.tar.gz) = FYL9u9BEm8/k/64sy55b8Fd0WaMrslYE4BrMuEfaGi0= +SIZE (libtorrent-rasterbar-1.2.3.tar.gz) = 4145859 Index: patches/patch-bindings_python_setup_py =================================================================== RCS file: patches/patch-bindings_python_setup_py diff -N patches/patch-bindings_python_setup_py --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-bindings_python_setup_py 19 Jan 2020 06:24:04 -0000 @@ -0,0 +1,48 @@ +$OpenBSD$ + +Fix: https://github.com/arvidn/libtorrent/commit/2a15b25ab3774a45571dc5403f5e99d988d42765 +Build python 3 bindings + +Index: bindings/python/setup.py +--- bindings/python/setup.py.orig ++++ bindings/python/setup.py +@@ -160,22 +160,25 @@ else: + src_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "src")) + source_list = [os.path.join(src_dir, s) for s in os.listdir(src_dir) if s.endswith(".cpp")] + +- if extra_cmd: +- flags = flags_parser() ++ flags = flags_parser() ++ ext_extra = {} ++ ++ if ldflags: + # ldflags parsed first to ensure the correct library search path order +- extra_link = flags.parse(ldflags) +- extra_compile = flags.parse(extra_cmd) ++ ext_extra["extra_link_args"] = flags.parse(ldflags) + arch() + +- ext = [Extension( +- 'libtorrent', +- sources=sorted(source_list), +- language='c++', +- include_dirs=flags.include_dirs, +- library_dirs=flags.library_dirs, +- extra_link_args=extra_link + arch(), +- extra_compile_args=extra_compile + arch() + target_specific(), +- libraries=['torrent-rasterbar'] + flags.libraries) +- ] ++ if extra_cmd: ++ ext_extra["extra_compile_args"] = flags.parse(extra_cmd) + arch() + target_specific() ++ ++ ext = [Extension( ++ 'libtorrent', ++ sources=sorted(source_list), ++ language='c++', ++ include_dirs=flags.include_dirs, ++ library_dirs=flags.library_dirs, ++ libraries=['torrent-rasterbar'] + flags.libraries, ++ **ext_extra) ++ ] + + setup( + name='python-libtorrent', Index: patches/patch-include_libtorrent_buffer_hpp =================================================================== RCS file: patches/patch-include_libtorrent_buffer_hpp diff -N patches/patch-include_libtorrent_buffer_hpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-include_libtorrent_buffer_hpp 19 Jan 2020 06:24:04 -0000 @@ -0,0 +1,25 @@ +$OpenBSD$ + +malloc_usable_size and malloc_size are unavailable + +Index: include/libtorrent/buffer.hpp +--- include/libtorrent/buffer.hpp.orig ++++ include/libtorrent/buffer.hpp +@@ -50,7 +50,7 @@ POSSIBILITY OF SUCH DAMAGE. + #elif defined __FreeBSD__ + #include <malloc_np.h> + #elif defined TORRENT_BSD +-#include <malloc/malloc.h> ++#include <sys/malloc.h> + #endif + + namespace libtorrent { +@@ -89,8 +89,6 @@ class buffer (public) + m_size = static_cast<difference_type>(::malloc_usable_size(m_begin)); + #elif defined _MSC_VER + m_size = static_cast<difference_type>(::_msize(m_begin)); +-#elif defined TORRENT_BSD +- m_size = static_cast<difference_type>(::malloc_size(m_begin)); + #else + m_size = size; + #endif Index: patches/patch-include_libtorrent_config_hpp =================================================================== RCS file: /cvs/ports/net/libtorrent-rasterbar/patches/patch-include_libtorrent_config_hpp,v retrieving revision 1.2 diff -u -p -r1.2 patch-include_libtorrent_config_hpp --- patches/patch-include_libtorrent_config_hpp 30 Apr 2019 16:45:26 -0000 1.2 +++ patches/patch-include_libtorrent_config_hpp 19 Jan 2020 06:24:04 -0000 @@ -2,7 +2,7 @@ $OpenBSD: patch-include_libtorrent_confi Index: include/libtorrent/config.hpp --- include/libtorrent/config.hpp.orig +++ include/libtorrent/config.hpp -@@ -562,6 +562,10 @@ int snprintf(char* buf, int len, char const* fmt, ...) +@@ -411,6 +411,10 @@ POSSIBILITY OF SUCH DAMAGE. #define TORRENT_USE_UNC_PATHS 0 #endif Index: pkg/PLIST =================================================================== RCS file: /cvs/ports/net/libtorrent-rasterbar/pkg/PLIST,v retrieving revision 1.3 diff -u -p -r1.3 PLIST --- pkg/PLIST 30 Apr 2019 16:45:26 -0000 1.3 +++ pkg/PLIST 19 Jan 2020 06:24:04 -0000 @@ -1,4 +1,4 @@ -@comment $OpenBSD: PLIST,v 1.3 2019/04/30 16:45:26 tj Exp $ +@comment $OpenBSD: PLIST,v$ include/libtorrent/ include/libtorrent/ConvertUTF.h include/libtorrent/add_torrent_params.hpp @@ -6,27 +6,67 @@ include/libtorrent/address.hpp include/libtorrent/alert.hpp include/libtorrent/alert_manager.hpp include/libtorrent/alert_types.hpp -include/libtorrent/alloca.hpp include/libtorrent/announce_entry.hpp include/libtorrent/assert.hpp include/libtorrent/aux_/ -include/libtorrent/aux_/alert_manager_variadic_emplace.hpp +include/libtorrent/aux_/aligned_storage.hpp +include/libtorrent/aux_/aligned_union.hpp +include/libtorrent/aux_/alloca.hpp include/libtorrent/aux_/allocating_handler.hpp +include/libtorrent/aux_/array.hpp +include/libtorrent/aux_/bind_to_device.hpp +include/libtorrent/aux_/block_cache_reference.hpp include/libtorrent/aux_/byteswap.hpp +include/libtorrent/aux_/container_wrapper.hpp +include/libtorrent/aux_/cppint_import_export.hpp include/libtorrent/aux_/cpuid.hpp +include/libtorrent/aux_/deferred_handler.hpp +include/libtorrent/aux_/deprecated.hpp +include/libtorrent/aux_/deque.hpp +include/libtorrent/aux_/dev_random.hpp include/libtorrent/aux_/disable_warnings_pop.hpp include/libtorrent/aux_/disable_warnings_push.hpp +include/libtorrent/aux_/disk_job_fence.hpp include/libtorrent/aux_/escape_string.hpp +include/libtorrent/aux_/export.hpp +include/libtorrent/aux_/ffs.hpp include/libtorrent/aux_/file_progress.hpp +include/libtorrent/aux_/generate_peer_id.hpp +include/libtorrent/aux_/has_block.hpp +include/libtorrent/aux_/instantiate_connection.hpp +include/libtorrent/aux_/io.hpp +include/libtorrent/aux_/ip_notifier.hpp +include/libtorrent/aux_/listen_socket_handle.hpp +include/libtorrent/aux_/lsd.hpp include/libtorrent/aux_/merkle.hpp +include/libtorrent/aux_/noexcept_movable.hpp +include/libtorrent/aux_/numeric_cast.hpp include/libtorrent/aux_/openssl.hpp +include/libtorrent/aux_/path.hpp +include/libtorrent/aux_/portmap.hpp include/libtorrent/aux_/proxy_settings.hpp +include/libtorrent/aux_/range.hpp include/libtorrent/aux_/route.h +include/libtorrent/aux_/scope_end.hpp include/libtorrent/aux_/session_call.hpp include/libtorrent/aux_/session_impl.hpp include/libtorrent/aux_/session_interface.hpp include/libtorrent/aux_/session_settings.hpp +include/libtorrent/aux_/session_udp_sockets.hpp +include/libtorrent/aux_/set_socket_buffer.hpp +include/libtorrent/aux_/socket_type.hpp +include/libtorrent/aux_/storage_piece_set.hpp +include/libtorrent/aux_/storage_utils.hpp +include/libtorrent/aux_/string_ptr.hpp +include/libtorrent/aux_/suggest_piece.hpp +include/libtorrent/aux_/throw.hpp include/libtorrent/aux_/time.hpp +include/libtorrent/aux_/torrent_impl.hpp +include/libtorrent/aux_/unique_ptr.hpp +include/libtorrent/aux_/vector.hpp +include/libtorrent/aux_/win_crypto_provider.hpp +include/libtorrent/aux_/win_util.hpp +include/libtorrent/aux_/windows.hpp include/libtorrent/bandwidth_limit.hpp include/libtorrent/bandwidth_manager.hpp include/libtorrent/bandwidth_queue_entry.hpp @@ -39,7 +79,6 @@ include/libtorrent/bloom_filter.hpp include/libtorrent/broadcast_socket.hpp include/libtorrent/bt_peer_connection.hpp include/libtorrent/buffer.hpp -include/libtorrent/build_config.hpp include/libtorrent/chained_buffer.hpp include/libtorrent/choker.hpp include/libtorrent/close_reason.hpp @@ -54,18 +93,17 @@ include/libtorrent/disk_buffer_pool.hpp include/libtorrent/disk_interface.hpp include/libtorrent/disk_io_job.hpp include/libtorrent/disk_io_thread.hpp +include/libtorrent/disk_io_thread_pool.hpp include/libtorrent/disk_job_pool.hpp include/libtorrent/disk_observer.hpp +include/libtorrent/download_priority.hpp include/libtorrent/ed25519.hpp include/libtorrent/entry.hpp include/libtorrent/enum_net.hpp include/libtorrent/error.hpp include/libtorrent/error_code.hpp -include/libtorrent/export.hpp include/libtorrent/extensions/ include/libtorrent/extensions.hpp -include/libtorrent/extensions/lt_trackers.hpp -include/libtorrent/extensions/metadata_transfer.hpp include/libtorrent/extensions/smart_ban.hpp include/libtorrent/extensions/ut_metadata.hpp include/libtorrent/extensions/ut_pex.hpp @@ -73,9 +111,11 @@ include/libtorrent/file.hpp include/libtorrent/file_pool.hpp include/libtorrent/file_storage.hpp include/libtorrent/fingerprint.hpp +include/libtorrent/flags.hpp include/libtorrent/fwd.hpp include/libtorrent/gzip.hpp include/libtorrent/hasher.hpp +include/libtorrent/hasher512.hpp include/libtorrent/heterogeneous_queue.hpp include/libtorrent/hex.hpp include/libtorrent/http_connection.hpp @@ -85,7 +125,7 @@ include/libtorrent/http_stream.hpp include/libtorrent/http_tracker_connection.hpp include/libtorrent/i2p_stream.hpp include/libtorrent/identify_client.hpp -include/libtorrent/instantiate_connection.hpp +include/libtorrent/index_range.hpp include/libtorrent/invariant_check.hpp include/libtorrent/io.hpp include/libtorrent/io_service.hpp @@ -93,14 +133,19 @@ include/libtorrent/io_service_fwd.hpp include/libtorrent/ip_filter.hpp include/libtorrent/ip_voter.hpp include/libtorrent/kademlia/ +include/libtorrent/kademlia/announce_flags.hpp include/libtorrent/kademlia/dht_observer.hpp +include/libtorrent/kademlia/dht_settings.hpp +include/libtorrent/kademlia/dht_state.hpp include/libtorrent/kademlia/dht_storage.hpp include/libtorrent/kademlia/dht_tracker.hpp include/libtorrent/kademlia/direct_request.hpp include/libtorrent/kademlia/dos_blocker.hpp +include/libtorrent/kademlia/ed25519.hpp include/libtorrent/kademlia/find_data.hpp include/libtorrent/kademlia/get_item.hpp include/libtorrent/kademlia/get_peers.hpp +include/libtorrent/kademlia/io.hpp include/libtorrent/kademlia/item.hpp include/libtorrent/kademlia/msg.hpp include/libtorrent/kademlia/node.hpp @@ -111,17 +156,20 @@ include/libtorrent/kademlia/put_data.hpp include/libtorrent/kademlia/refresh.hpp include/libtorrent/kademlia/routing_table.hpp include/libtorrent/kademlia/rpc_manager.hpp +include/libtorrent/kademlia/sample_infohashes.hpp include/libtorrent/kademlia/traversal_algorithm.hpp +include/libtorrent/kademlia/types.hpp include/libtorrent/lazy_entry.hpp include/libtorrent/link.hpp include/libtorrent/linked_list.hpp include/libtorrent/lsd.hpp include/libtorrent/magnet_uri.hpp -include/libtorrent/max.hpp include/libtorrent/natpmp.hpp -include/libtorrent/network_thread_pool.hpp +include/libtorrent/netlink.hpp include/libtorrent/operations.hpp +include/libtorrent/optional.hpp include/libtorrent/packet_buffer.hpp +include/libtorrent/packet_pool.hpp include/libtorrent/parse_url.hpp include/libtorrent/part_file.hpp include/libtorrent/pe_crypto.hpp @@ -137,32 +185,36 @@ include/libtorrent/peer_info.hpp include/libtorrent/peer_list.hpp include/libtorrent/peer_request.hpp include/libtorrent/performance_counters.hpp +include/libtorrent/pex_flags.hpp +include/libtorrent/piece_block.hpp include/libtorrent/piece_block_progress.hpp include/libtorrent/piece_picker.hpp include/libtorrent/platform_util.hpp +include/libtorrent/portmap.hpp include/libtorrent/proxy_base.hpp include/libtorrent/puff.hpp include/libtorrent/random.hpp +include/libtorrent/read_resume_data.hpp include/libtorrent/receive_buffer.hpp include/libtorrent/request_blocks.hpp include/libtorrent/resolve_links.hpp include/libtorrent/resolver.hpp include/libtorrent/resolver_interface.hpp -include/libtorrent/rss.hpp include/libtorrent/session.hpp include/libtorrent/session_handle.hpp include/libtorrent/session_settings.hpp include/libtorrent/session_stats.hpp include/libtorrent/session_status.hpp +include/libtorrent/session_types.hpp include/libtorrent/settings_pack.hpp include/libtorrent/sha1.hpp include/libtorrent/sha1_hash.hpp +include/libtorrent/sha512.hpp include/libtorrent/sliding_average.hpp include/libtorrent/socket.hpp include/libtorrent/socket_io.hpp -include/libtorrent/socket_type.hpp -include/libtorrent/socket_type_fwd.hpp include/libtorrent/socks5_stream.hpp +include/libtorrent/span.hpp include/libtorrent/ssl_stream.hpp include/libtorrent/stack_allocator.hpp include/libtorrent/stat.hpp @@ -170,16 +222,12 @@ include/libtorrent/stat_cache.hpp include/libtorrent/storage.hpp include/libtorrent/storage_defs.hpp include/libtorrent/string_util.hpp +include/libtorrent/string_view.hpp include/libtorrent/tailqueue.hpp -include/libtorrent/thread.hpp -include/libtorrent/thread_pool.hpp include/libtorrent/time.hpp include/libtorrent/timestamp_history.hpp -include/libtorrent/tommath.h -include/libtorrent/tommath_class.h -include/libtorrent/tommath_private.h -include/libtorrent/tommath_superclass.h include/libtorrent/torrent.hpp +include/libtorrent/torrent_flags.hpp include/libtorrent/torrent_handle.hpp include/libtorrent/torrent_info.hpp include/libtorrent/torrent_peer.hpp @@ -188,8 +236,8 @@ include/libtorrent/torrent_status.hpp include/libtorrent/tracker_manager.hpp include/libtorrent/udp_socket.hpp include/libtorrent/udp_tracker_connection.hpp -include/libtorrent/uncork_interface.hpp include/libtorrent/union_endpoint.hpp +include/libtorrent/units.hpp include/libtorrent/upnp.hpp include/libtorrent/utf8.hpp include/libtorrent/utp_socket_manager.hpp @@ -198,10 +246,11 @@ include/libtorrent/vector_utils.hpp include/libtorrent/version.hpp include/libtorrent/web_connection_base.hpp include/libtorrent/web_peer_connection.hpp +include/libtorrent/write_resume_data.hpp include/libtorrent/xml_parse.hpp -lib/libtorrent-rasterbar.a +@static-lib lib/libtorrent-rasterbar.a lib/libtorrent-rasterbar.la @lib lib/libtorrent-rasterbar.so.${LIBtorrent-rasterbar_VERSION} lib/pkgconfig/libtorrent-rasterbar.pc -lib/python${MODPY_VERSION}/site-packages/libtorrent.so +@so lib/python${MODPY_VERSION}/site-packages/libtorrent.so lib/python${MODPY_VERSION}/site-packages/python_libtorrent-${MODPY_EGG_VERSION}-py${MODPY_VERSION}.egg-info