Import lsyncd 2.1.6.

Lsyncd watches a local directory tree using libinotify.  It aggregates
and combines events for a few seconds and then spawns one (or more)
process(es) to synchronize the changes. By default this is rsync. Lsyncd
is thus a light-weight live mirror solution that is comparatively easy
to install not requiring new filesystems or blockdevices and does not
hamper local filesystem performance.

ok ajacoutot@
This commit is contained in:
landry 2016-01-23 19:15:13 +00:00
parent 53bd58ad0c
commit 090eac3531
8 changed files with 181 additions and 0 deletions

45
sysutils/lsyncd/Makefile Normal file
View File

@ -0,0 +1,45 @@
# $OpenBSD: Makefile,v 1.1.1.1 2016/01/23 19:15:13 landry Exp $
COMMENT = synchronizes directories with remote targets upon changes
GH_PROJECT = lsyncd
GH_ACCOUNT = axkibe
GH_COMMIT = cce7db5ebd352690917792848c2aea92c08efdd5
DISTNAME = lsyncd-2.1.6
CATEGORIES = sysutils
# GPLv2
PERMIT_PACKAGE_CDROM = Yes
MODULES = lang/lua devel/cmake
CONFIGURE_ENV = CFLAGS="${CFLAGS} -I${LOCALBASE}/include/inotify/" \
LDFLAGS="${LDFLAGS} -L${LOCALBASE}/lib/inotify -linotify -Wl,-rpath ${LOCALBASE}/lib/inotify"
# uses a2x for the manpage but it fails
#BUILD_DEPENDS = textproc/asciidoc
RUN_DEPENDS = net/rsync
LIB_DEPENDS = ${MODLUA_LIB_DEPENDS} \
devel/libinotify
TEST_DEPENDS = ${_MODLUA_RUN_DEPENDS} \
devel/luaposix
TESTS = churn-direct churn-rsyncssh exclude-rsyncssh schedule \
churn-rsync exclude-rsync l4rsyncdata
WANTLIB += ${MODLUA_WANTLIB} lib/inotify/inotify c m pthread
pre-configure:
${SUBST_CMD} ${WRKSRC}/default-rsync.lua ${WRKSRC}/CMakeLists.txt
post-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/examples/lsyncd
${INSTALL_DATA} ${WRKSRC}/examples/*.lua ${PREFIX}/share/examples/lsyncd
do-test:
ln -sf ${WRKBUILD}/lsyncd ${WRKSRC}/lsyncd
.for f in ${TESTS}
cd ${WRKSRC} && ${MODLUA_BIN} tests/${f}.lua || echo ${f} failed
.endfor
.include <bsd.port.mk>

2
sysutils/lsyncd/distinfo Normal file
View File

@ -0,0 +1,2 @@
SHA256 (lsyncd-2.1.6.tar.gz) = dBQeW6kH0mJOO/WJVV3V9Yd/gOfAkxeg7njD0G3jzQU=
SIZE (lsyncd-2.1.6.tar.gz) = 78989

View File

@ -0,0 +1,48 @@
$OpenBSD: patch-CMakeLists_txt,v 1.1.1.1 2016/01/23 19:15:13 landry Exp $
No need to regen the manpage
--- CMakeLists.txt.orig Thu Oct 15 08:29:47 2015
+++ CMakeLists.txt Sat Jan 23 19:41:46 2016
@@ -6,7 +6,7 @@ set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_S
# finding Lua
-find_package(Lua REQUIRED)
+find_package(Lua ${MODLUA_VERSION})
include_directories ( ${LUA_INCLUDE_DIR} )
@@ -54,7 +54,7 @@ add_custom_command( OUTPUT runner.c
# this supposes the Lua compiler 'luac' is sitting right next to the Lua interpreter 'lua'
add_custom_command( OUTPUT runner.out
COMMAND ${CMAKE_COMMAND} -E echo "Compiling built-in runner"
- COMMAND ${LUA_EXECUTABLE}c -o runner.out ${PROJECT_SOURCE_DIR}/lsyncd.lua
+ COMMAND ${LUA_COMPILER} -o runner.out ${PROJECT_SOURCE_DIR}/lsyncd.lua
DEPENDS ${PROJECT_SOURCE_DIR}/lsyncd.lua
)
@@ -75,21 +75,13 @@ set( DEFAULT_CONFIGS
add_custom_command( OUTPUT defaults.out
COMMAND ${CMAKE_COMMAND} -E echo "Compiling built-in default configs"
- COMMAND ${LUA_EXECUTABLE}c -o defaults.out ${DEFAULT_CONFIGS}
+ COMMAND ${LUA_COMPILER} -o defaults.out ${DEFAULT_CONFIGS}
DEPENDS ${DEFAULT_CONFIGS}
)
-# the manpage
-add_custom_command( OUTPUT doc/lsyncd.1
- COMMAND ${CMAKE_COMMAND} -E echo "Updating the manpage"
- COMMAND a2x --format=manpage doc/lsyncd.1.txt
- DEPENDS doc/lsyncd.1.txt
-)
-add_custom_target( manpage ALL DEPENDS doc/lsyncd.1 )
-
# compiling and linking it all together
add_executable( lsyncd ${LSYNCD_SRC} )
target_link_libraries( lsyncd ${LUA_LIBRARIES} )
install( TARGETS lsyncd RUNTIME DESTINATION bin )
-install( FILES doc/lsyncd.1 DESTINATION man)
+install( FILES doc/lsyncd.1 DESTINATION man/man1)

View File

@ -0,0 +1,42 @@
$OpenBSD: patch-cmake_FindLua_cmake,v 1.1.1.1 2016/01/23 19:15:13 landry Exp $
Also detect the lua compiler: on openbsd, its not luac
nor lua5Xc but luac5X
--- cmake/FindLua.cmake.orig Sat Jan 23 17:24:05 2016
+++ cmake/FindLua.cmake Sat Jan 23 17:28:06 2016
@@ -34,6 +34,7 @@
# Always search for non-versioned lua first (recommended)
SET(_POSSIBLE_LUA_INCLUDE include include/lua)
SET(_POSSIBLE_LUA_EXECUTABLE lua)
+SET(_POSSIBLE_LUA_COMPILER luac)
SET(_POSSIBLE_LUA_LIBRARY lua)
# Determine possible naming suffixes (there is no standard for this)
@@ -47,6 +48,7 @@ ENDIF(Lua_FIND_VERSION_MAJOR AND Lua_FIND_VERSION_MINO
FOREACH(_SUFFIX ${_POSSIBLE_SUFFIXES})
LIST(APPEND _POSSIBLE_LUA_INCLUDE "include/lua${_SUFFIX}")
LIST(APPEND _POSSIBLE_LUA_EXECUTABLE "lua${_SUFFIX}")
+ LIST(APPEND _POSSIBLE_LUA_COMPILER "luac${_SUFFIX}")
LIST(APPEND _POSSIBLE_LUA_LIBRARY "lua${_SUFFIX}")
ENDFOREACH(_SUFFIX)
@@ -55,6 +57,11 @@ FIND_PROGRAM(LUA_EXECUTABLE
NAMES ${_POSSIBLE_LUA_EXECUTABLE}
)
+# Find the lua compiler
+FIND_PROGRAM(LUA_COMPILER
+ NAMES ${_POSSIBLE_LUA_COMPILER}
+)
+
# Find the lua header
FIND_PATH(LUA_INCLUDE_DIR lua.h
HINTS
@@ -114,5 +121,5 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua
REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
VERSION_VAR LUA_VERSION_STRING)
-MARK_AS_ADVANCED(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY LUA_EXECUTABLE)
+MARK_AS_ADVANCED(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY LUA_EXECUTABLE LUA_COMPILER)

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-default-rsync_lua,v 1.1.1.1 2016/01/23 19:15:13 landry Exp $
--- default-rsync.lua.orig Thu Oct 15 08:29:47 2015
+++ default-rsync.lua Sat Jan 23 19:41:49 2016
@@ -551,7 +551,7 @@ rsync.exitcodes = default.rsyncExitCodes
rsync.rsync =
{
-- The rsync binary to be called.
- binary = '/usr/bin/rsync',
+ binary = '${LOCALBASE}/bin/rsync',
links = true,
times = true,
protect_args = true

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-tests_testlib_lua,v 1.1.1.1 2016/01/23 19:15:13 landry Exp $
--- tests/testlib.lua.orig Sat Jan 23 18:42:55 2016
+++ tests/testlib.lua Sat Jan 23 18:43:08 2016
@@ -26,7 +26,7 @@ cwriteln('random seed: ', seed)
-- @returns the name of the directory
--
function mktempd()
- local f = io.popen('mktemp -td ltest.XXX', 'r')
+ local f = io.popen('mktemp -td ltest.XXXXXXXX', 'r')
local s = f:read('*a')
f:close()
s = s:gsub('[\n\r]+', ' ')

View File

@ -0,0 +1,6 @@
Lsyncd watches a local directory tree using libinotify. It aggregates
and combines events for a few seconds and then spawns one (or more)
process(es) to synchronize the changes. By default this is rsync. Lsyncd
is thus a light-weight live mirror solution that is comparatively easy
to install not requiring new filesystems or blockdevices and does not
hamper local filesystem performance.

14
sysutils/lsyncd/pkg/PLIST Normal file
View File

@ -0,0 +1,14 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2016/01/23 19:15:13 landry Exp $
@bin bin/lsyncd
@man man/man1/lsyncd.1
share/examples/lsyncd/
share/examples/lsyncd/lalarm.lua
share/examples/lsyncd/lbash.lua
share/examples/lsyncd/lecho.lua
share/examples/lsyncd/lftp.lua
share/examples/lsyncd/lgforce.lua
share/examples/lsyncd/limagemagic.lua
share/examples/lsyncd/lpostcmd.lua
share/examples/lsyncd/lrsync.lua
share/examples/lsyncd/lrsyncssh.lua
share/examples/lsyncd/lsayirc.lua