seafile-ccnet: Update to 7.1.2, add Python 3 bindings package

* Update package to 7.1.2

* Add Python 3 bindings package. The Python dependency is moved from
  seafile-ccnet to python3-seafile-ccnet.

* Refresh patches. The path to valac does not need to be patched in
  010-Makefile.patch because $(STAGING_DIR_HOSTPKG)/bin is already in
  the path during package build.

* Use SEAFILE_UCI_LOG_DIR and SEAFILE_UCI_SOCKET_DIR, which will be
  added to seafile-server

* Install binaries to /usr/libexec instead of /usr/bin, to mirror an
  upcoming change in seafile-server

* Clean up Makefile formatting

* Add myself as a maintainer

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
This commit is contained in:
Jeffery To 2020-02-13 22:57:07 +08:00
parent 825400ee41
commit 6b84a7d38d
4 changed files with 110 additions and 76 deletions

View File

@ -8,67 +8,100 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=seafile-ccnet
PKG_VERSION:=6.3.4
PKG_RELEASE:=2
PKG_LICENSE:=GPL-3.0
PKG_VERSION:=7.1.2
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/haiwen/ccnet-server/tar.gz/v$(PKG_VERSION)-server?
PKG_HASH:=ab3d5bda728f87c71929a6247c9f74c5209b9b8e44bafa77db91e8de590ec6ef
PKG_HASH:=32d3d7290415497c52ab407a64468538662dde81ccd139b6e4499e3f2c5b8d4b
PKG_MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>, Jeffery To <jeffery.to@gmail.com>
PKG_LICENSE:=AGPL-3.0-only
PKG_LICENSE_FILES:=LICENSE.txt
PKG_BUILD_DIR:=$(BUILD_DIR)/ccnet-server-$(PKG_VERSION)-server
PKG_MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
PKG_BUILD_DEPENDS:=vala/host
PKG_FIXUP:=autoreconf
PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
include ../../lang/python/python-package.mk
include ../../lang/python/python3-package.mk
define Package/seafile-ccnet
SECTION:=net
CATEGORY:=Network
TITLE:=Seafile server - ccnet component
URL:=http://seafile.com/
DEPENDS:=+libsearpc +libevent2 +libopenssl \
+glib2 +python +libzdb +libuuid \
+libpthread +libsqlite3 +jansson $(ICONV_DEPENDS)
SECTION:=net
CATEGORY:=Network
TITLE:=Seafile server - ccnet component
URL:=http://seafile.com/
DEPENDS:= \
+glib2 \
+jansson \
+libevent2 \
+libmariadb \
+libopenssl \
+libpthread \
+libsearpc \
+libsqlite3 \
+libuuid \
$(ICONV_DEPENDS)
endef
define Package/seafile-ccnet/description
Ccnet is a framework for writing networked applications in C.
Ccnet is a framework for writing networked applications in C.
endef
CONFIGURE_ARGS += --disable-client \
--enable-server \
--disable-ldap \
--disable-cluster \
--enable-python \
--disable-server-pkg \
--disable-static-build \
--disable-compile-demo \
--disable-console
define Package/python3-seafile-ccnet
SECTION:=lang
CATEGORY:=Languages
SUBMENU:=Python
TITLE:=Python bindings for Seafile Ccnet
DEPENDS:=+seafile-ccnet +python3-light +python3-searpc
VARIANT:=python3
endef
PKG_BUILD_DEPENDS:=vala/host
define Package/python3-seafile-ccnet/description
$(call Package/seafile-ccnet/description)
TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv \
-L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz
This package contains Python bindings for Ccnet.
endef
CONFIGURE_ARGS += \
--disable-console \
--disable-ldap \
--enable-python \
--with-mysql="$(STAGING_DIR)/usr/bin/mysql_config"
# Include Python 2 bindings in this package to maintain compatibility with previous versions
define Package/seafile-ccnet/install
$(INSTALL_DIR) $(1)/usr/{bin,lib}
$(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
$(CP) $(PKG_INSTALL_DIR)/usr/bin/ccnet* $(1)/usr/bin/
$(CP) $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/ccnet $(1)$(PYTHON_PKG_DIR)
$(INSTALL_DIR) $(1)/usr/{lib,libexec}
$(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)/ccnet
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/libexec/
$(INSTALL_DATA) $(PKG_BUILD_DIR)/python/ccnet/*.py $(1)$(PYTHON_PKG_DIR)/ccnet/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libccnet.so* $(1)/usr/lib/
find $(1) -name "*\.pyc" -o -name "*\.pyo" | xargs rm -f
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include
$(INSTALL_DIR) $(1)/usr/include/ccnet
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) $(PKG_INSTALL_DIR)/usr/include/ccnet* $(1)/usr/include/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libccnet.pc $(1)/usr/lib/pkgconfig/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libccnet.so* $(1)/usr/lib/
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/ccnet/*.h $(1)/usr/include/ccnet/
$(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libccnet.pc $(1)/usr/lib/pkgconfig/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libccnet.{a,la,so*} $(1)/usr/lib/
endef
define Py3Build/Compile
rm -rf $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/ccnet
$(INSTALL_DIR) $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/ccnet
$(INSTALL_DATA) $(PKG_BUILD_DIR)/python/ccnet/*.py $(PKG_INSTALL_DIR)$(PYTHON3_PKG_DIR)/ccnet/
endef
Py3Package/python3-seafile-ccnet/install:=:
$(eval $(call BuildPackage,seafile-ccnet))
$(eval $(call Py3Package,python3-seafile-ccnet))
$(eval $(call BuildPackage,python3-seafile-ccnet))
$(eval $(call BuildPackage,python3-seafile-ccnet-src))

View File

@ -5,21 +5,7 @@
AM_CPPFLAGS = @GLIB2_CFLAGS@ -I$(top_srcdir)/include \
-I$(top_srcdir)/include/ccnet \
@@ -72,11 +73,11 @@ ccnet-client.c: ccnet-object.h
ccnet-object.h: ${ccnet_object_define}
rm -f $@
- valac --pkg posix ${ccnet_object_define} -C -H ccnet-object.h
+ "$(STAGING_DIR_HOSTPKG)/bin/valac" --pkg posix ${ccnet_object_define} -C -H ccnet-object.h
ccnetobj.c: ${ccnet_object_define}
rm -f $@
- valac -C --pkg posix ${ccnet_object_define}
+ "$(STAGING_DIR_HOSTPKG)/bin/valac" -C --pkg posix ${ccnet_object_define}
searpc_gen = searpc-signature.h searpc-marshal.h
@@ -86,7 +87,7 @@ rpc_table.stamp: ${top_srcdir}/lib/rpc_table.py
@@ -85,7 +86,7 @@ rpc_table.stamp: ${top_srcdir}/lib/rpc_t
@rm -f rpc_table.tmp
@touch rpc_table.tmp
@echo "[libsearpc]: generating rpc header files"

View File

@ -20,8 +20,6 @@ Signed-off-by: Eneas U de Queiroz <cote2004-github@yahoo.com>
tools/ccnet-init.c | 2 ++
7 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/lib/rsa.c b/lib/rsa.c
index 7cca150..d969a62 100644
--- a/lib/rsa.c
+++ b/lib/rsa.c
@@ -4,6 +4,7 @@
@ -36,11 +34,10 @@ index 7cca150..d969a62 100644
generate_private_key(u_int bits)
{
RSA *private = NULL;
-
+ BIGNUM *e = NULL;
- private = RSA_generate_key(bits, 35, NULL, NULL);
- if (private == NULL)
+ BIGNUM *e = NULL;
+
+ private = RSA_new();
+ e = BN_new();
+ if (private == NULL || e == NULL || !BN_set_word(e, 35) ||
@ -53,11 +50,9 @@ index 7cca150..d969a62 100644
+ BN_free(e);
return private;
}
diff --git a/net/common/processors/keepalive-proc.c b/net/common/processors/keepalive-proc.c
index 609d102..42a0c23 100644
--- a/net/common/processors/keepalive-proc.c
+++ b/net/common/processors/keepalive-proc.c
@@ -401,7 +401,7 @@ static void send_challenge(CcnetProcessor *processor)
@@ -401,7 +401,7 @@ static void send_challenge(CcnetProcesso
unsigned char *buf;
int len;
@ -66,7 +61,7 @@ index 609d102..42a0c23 100644
buf = public_key_encrypt (peer->pubkey, priv->random_buf, 40, &len);
ccnet_processor_send_update (processor, "311", NULL, (char *)buf, len);
@@ -434,7 +434,7 @@ static void send_challenge_user(CcnetProcessor *processor, CcnetUser *user)
@@ -434,7 +434,7 @@ static void send_challenge_user(CcnetPro
ccnet_debug ("[Keepalive] Send user challenge to %.8s\n",
processor->peer->id);
@ -75,11 +70,9 @@ index 609d102..42a0c23 100644
buf = public_key_encrypt (user->pubkey, priv->random_buf, 40, &len);
ccnet_processor_send_update (processor, "321", NULL, (char *)buf, len);
diff --git a/net/common/processors/keepalive2-proc.c b/net/common/processors/keepalive2-proc.c
index d3e799e..d81c266 100644
--- a/net/common/processors/keepalive2-proc.c
+++ b/net/common/processors/keepalive2-proc.c
@@ -306,7 +306,7 @@ static void send_challenge(CcnetProcessor *processor)
@@ -306,7 +306,7 @@ static void send_challenge(CcnetProcesso
unsigned char *buf;
int len;
@ -88,11 +81,9 @@ index d3e799e..d81c266 100644
buf = public_key_encrypt (peer->pubkey, priv->random_buf, 40, &len);
if (len < 0) {
ccnet_debug ("[Keepalive] Failed to encrypt challenge "
diff --git a/net/common/processors/sendsessionkey-proc.c b/net/common/processors/sendsessionkey-proc.c
index 3ec2757..10c3340 100644
--- a/net/common/processors/sendsessionkey-proc.c
+++ b/net/common/processors/sendsessionkey-proc.c
@@ -124,7 +124,7 @@ generate_session_key (CcnetProcessor *processor, int *len_p)
@@ -124,7 +124,7 @@ generate_session_key (CcnetProcessor *pr
unsigned char random_buf[40];
SHA_CTX s;
@ -101,11 +92,9 @@ index 3ec2757..10c3340 100644
SHA1_Init (&s);
SHA1_Update (&s, random_buf, sizeof(random_buf));
diff --git a/net/common/processors/sendsessionkey-v2-proc.c b/net/common/processors/sendsessionkey-v2-proc.c
index c1c6924..4805ba6 100644
--- a/net/common/processors/sendsessionkey-v2-proc.c
+++ b/net/common/processors/sendsessionkey-v2-proc.c
@@ -125,7 +125,7 @@ generate_session_key (CcnetProcessor *processor, int *len_p)
@@ -125,7 +125,7 @@ generate_session_key (CcnetProcessor *pr
unsigned char random_buf[40];
SHA_CTX s;
@ -114,11 +103,9 @@ index c1c6924..4805ba6 100644
SHA1_Init (&s);
SHA1_Update (&s, random_buf, sizeof(random_buf));
diff --git a/net/server/user-mgr.c b/net/server/user-mgr.c
index 8a356f0..7a3f5cb 100644
--- a/net/server/user-mgr.c
+++ b/net/server/user-mgr.c
@@ -816,9 +816,13 @@ hash_password_pbkdf2_sha256 (const char *passwd,
@@ -816,9 +816,13 @@ hash_password_pbkdf2_sha256 (const char
char salt_str[SHA256_DIGEST_LENGTH*2+1];
if (!RAND_bytes (salt, sizeof(salt))) {
@ -132,11 +119,9 @@ index 8a356f0..7a3f5cb 100644
}
PKCS5_PBKDF2_HMAC (passwd, strlen(passwd),
diff --git a/tools/ccnet-init.c b/tools/ccnet-init.c
index 4748962..28c9995 100644
--- a/tools/ccnet-init.c
+++ b/tools/ccnet-init.c
@@ -162,7 +162,9 @@ main(int argc, char **argv)
@@ -108,7 +108,9 @@ main(int argc, char **argv)
config_dir = ccnet_expand_path (config_dir);
/* printf("[conf_dir=%s\n]", config_dir); */
@ -146,6 +131,3 @@ index 4748962..28c9995 100644
if (RAND_status() != 1) { /* it should be seeded automatically */
fprintf(stderr, "PRNG is not seeded\n");
--
2.19.1

View File

@ -0,0 +1,33 @@
--- a/net/common/rpc-service.c
+++ b/net/common/rpc-service.c
@@ -314,7 +314,11 @@ ccnet_start_rpc(CcnetSession *session)
#endif /* CCNET_SERVER */
- char *path = g_build_filename (session->config_dir, CCNET_SOCKET_NAME, NULL);
+ const char *socket_dir = g_getenv ("SEAFILE_UCI_SOCKET_DIR");
+ if (!socket_dir) {
+ socket_dir = session->config_dir;
+ }
+ char *path = g_build_filename (socket_dir, CCNET_SOCKET_NAME, NULL);
SearpcNamedPipeServer *server = searpc_create_named_pipe_server_with_threadpool (path, NAMED_PIPE_SERVER_THREAD_POOL_SIZE);
if (!server) {
ccnet_warning ("Failed to create named pipe server.\n");
--- a/net/server/ccnet-server.c
+++ b/net/server/ccnet-server.c
@@ -292,10 +292,13 @@ main (int argc, char **argv)
config_dir = ccnet_expand_path (config_dir);
if (!log_file) {
- char *logdir = g_build_filename (config_dir, "logs", NULL);
+ char *logdir = g_strdup (g_getenv ("SEAFILE_UCI_LOG_DIR"));
+ if (!logdir) {
+ logdir = g_build_filename (config_dir, "logs", NULL);
+ }
checkdir_with_mkdir (logdir);
+ log_file = g_build_filename (logdir, "ccnet.log", NULL);
g_free (logdir);
- log_file = g_build_filename (config_dir, "logs", "ccnet.log", NULL);
}
if (ccnet_log_init (log_file, log_level_str) < 0) {
fprintf (stderr, "ccnet_log_init error: %s, %s\n", strerror(errno),