Skip to content

Commit

Permalink
seafile-server: new ebuild with deps
Browse files Browse the repository at this point in the history
  • Loading branch information
blshkv committed Jun 12, 2019
1 parent 9f9f3ff commit 93732f5
Show file tree
Hide file tree
Showing 11 changed files with 345 additions and 3 deletions.
1 change: 1 addition & 0 deletions net-libs/libevhtp/Manifest
@@ -0,0 +1 @@
DIST libevhtp-1.2.18.tar.gz 208153 BLAKE2B 8e7b482e90062d08b4f94039f0b295e5dcc49942742de5cc3de97f994ad644abfb347f329bbcd9f2e5a362011ccbf2e0fe9c65c16f59c50567e14f818fc1f36e SHA512 e01d771a9358fcf912578f34acd235711a3231029b453781f2992cf51cea26aa3f1eb170d3a834f15d4f9b3f37235fb006853eeee509945e2c18e3a7fbb06ae4
39 changes: 39 additions & 0 deletions net-libs/libevhtp/libevhtp-1.2.18.ebuild
@@ -0,0 +1,39 @@
# Copyright 1999-2019 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=7
inherit cmake-utils

DESCRIPTION="Create extremely-fast and secure embedded HTTP servers with ease"
HOMEPAGE="https://github.com/criticalstack/libevhtp"
SRC_URI="https://github.com/criticalstack/libevhtp/archive/${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="+oniguruma"

RDEPEND="oniguruma? ( dev-libs/oniguruma )"
DEPEND="${RDEPEND}"

src_prepare() {
sed -i -e "s|lib/pkgconfig|$(get_libdir)/pkgconfig|" \
-e "s|lib/cmake|$(get_libdir)/cmake|" \
-e "s|DESTINATION \"lib|DESTINATION \"$(get_libdir)|" \
"${S}/CMakeLists.txt"
cmake-utils_src_prepare
eapply_user
}

src_configure() {
local mycmakeargs=(
# #libevent issue
-DEVHTP_DISABLE_MEMFUNCTIONS=ON
# #https://manual.seafile.com/build_seafile/server.html
# -DEVHTP_DISABLE_SSL=ON
# -DEVHTP_BUILD_SHARED=OFF
#must be OFF for seafile
$(usex oniguruma -DEVHTP_DISABLE_REGEX=OFF)
)
cmake-utils_src_configure
}
1 change: 1 addition & 0 deletions net-misc/ccnet-server/Manifest
@@ -0,0 +1 @@
DIST ccnet-server-7.0.1.tar.gz 218014 BLAKE2B 952e982cfcd05a1dff504b2817e9de128abfb3bdf7a67d214a21eaedf9e37fa0c176b88a7f463d16126fca2c3fda0ebfb6a2552ac5fbbf3cfdd3b7b5d07a6f8c SHA512 1c87896f5a3a7c1840c7302709b5f09dd6b93ca3063f4a7526a1d5621b811d17460d99fd0c55e3ce554bb0dce53da8690a7edfb7d6dfb5e12862490e818a9dbc
48 changes: 48 additions & 0 deletions net-misc/ccnet-server/ccnet-server-7.0.1.ebuild
@@ -0,0 +1,48 @@
# Copyright 1999-2019 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=7

PYTHON_COMPAT=( python2_7 )
inherit autotools python-single-r1 vala

DESCRIPTION="Internal communication framework and user/group management for Seafile server"
HOMEPAGE="https://github.com/haiwen/ccnet-server/ http://www.seafile.com/"
SRC_URI="https://github.com/haiwen/${PN}/archive/v${PV}-server.tar.gz -> ${P}.tar.gz"

LICENSE="GPL-2+-with-openssl-exception"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""

RDEPEND="${PYTHON_DEPS}
!net-libs/ccnet
dev-libs/libevent
net-libs/libsearpc
dev-libs/glib"

#openssl... yes
#gobject-2.0 >= 2.16.0... yes

DEPEND="${RDEPEND}
$(vala_depend)"

S="${WORKDIR}/${P}-server"

src_prepare() {
sed -i -e 's/valac /${VALAC} /' lib/Makefile.am || die

# sed -i -e 's|\/ccnet|\/ccnet-server|' include/ccnet/Makefile.am
# sed -i -e 's|\/ccnet|\/ccnet-server|' include/Makefile.am

eautoreconf
vala_src_prepare
eapply_user
}

#src_configure() {
# econf \
# --enable-python=no
# #--with-mysql \
# #--with-postgresql \
#}
1 change: 1 addition & 0 deletions net-misc/seafile-server/Manifest
@@ -0,0 +1 @@
DIST seafile-server-7.0.1.tar.gz 747882 BLAKE2B c3d081137fdaf6a09000439f6d82d3b65ce8822da235c658a57c0b8dd6a9ae18609abad43b1463f09e0e504d1d4c2c39869b499e4c3fea3d5a9295f34ea6febd SHA512 f9b3dec5c91558ca47b51a230329bc5103a06490f59c18913c1ba0bbafabe99a1a99370500a972fe8507b25b8e668b52aa83747c886996bd4d77e2c50ce2e03e
42 changes: 42 additions & 0 deletions net-misc/seafile-server/files/7.0.1-ccnet.patch
@@ -0,0 +1,42 @@
diff -urN seafile-server-7.0.1-server.orig/server/repo-mgr.c seafile-server-7.0.1-server/server/repo-mgr.c
--- seafile-server-7.0.1-server.orig/server/repo-mgr.c 2019-05-30 20:37:43.000000000 +0800
+++ seafile-server-7.0.1-server/server/repo-mgr.c 2019-06-12 12:50:04.040923729 +0800
@@ -4260,7 +4260,7 @@
return NULL;

/* Get the groups this user belongs to. */
- groups = ccnet_get_groups_by_user (rpc_client, user, 1);
+ groups = ccnet_get_groups_by_user (rpc_client, user);
if (!groups) {
goto out;
}
@@ -4472,7 +4472,7 @@
goto out;

/* Get the groups this user belongs to. */
- groups = ccnet_get_groups_by_user (rpc_client, user, 1);
+ groups = ccnet_get_groups_by_user (rpc_client, user);
if (!groups) {
goto out;
}
diff -urN seafile-server-7.0.1-server.orig/server/repo-perm.c seafile-server-7.0.1-server/server/repo-perm.c
--- seafile-server-7.0.1-server.orig/server/repo-perm.c 2019-05-30 20:37:43.000000000 +0800
+++ seafile-server-7.0.1-server/server/repo-perm.c 2019-06-12 12:49:53.449922950 +0800
@@ -55,7 +55,7 @@
return NULL;

/* Get the groups this user belongs to. */
- groups = ccnet_get_groups_by_user (rpc_client, user_name, 1);
+ groups = ccnet_get_groups_by_user (rpc_client, user_name);
if (!groups) {
goto out;
}
@@ -170,7 +170,7 @@
}
g_hash_table_destroy (user_perms);

- groups = ccnet_get_groups_by_user (rpc_client, user, 1);
+ groups = ccnet_get_groups_by_user (rpc_client, user);
ccnet_rpc_client_free (rpc_client);
if (!groups) {
return NULL;
148 changes: 148 additions & 0 deletions net-misc/seafile-server/files/libevhtp-1.2.18.patch
@@ -0,0 +1,148 @@
Author: Alexandre Rossi <alexandre.rossi@gmail.com>
Description: Fix download stalling on recent libevhtp
A while ago[1], evhtp_request_pause() behavior changed: it now disables
both read and write events. seafile-server would then stall.
.
[1] https://github.com/criticalstack/libevhtp/commit/6cd89466fd6bd76c5b8624be65af5893afe3e40c
[2] https://github.com/haiwen/seafile/issues/1119
Forwarded: no

Index: seafile-server/server/access-file.c
===================================================================
--- seafile-server.orig/server/access-file.c 2018-02-01 12:23:53.209308343 +0100
+++ seafile-server/server/access-file.c 2018-02-01 12:23:53.205308288 +0100
@@ -618,7 +618,7 @@
/* Block any new request from this connection before finish
* handling this request.
*/
- evhtp_request_pause (req);
+ bufferevent_disable(bev, EV_READ);

/* Kick start data transfer by sending out http headers. */
evhtp_send_reply_start(req, EVHTP_RES_OK);
@@ -967,7 +967,7 @@
/* Block any new request from this connection before finish
* handling this request.
*/
- evhtp_request_pause (req);
+ bufferevent_disable(bev, EV_READ);

/* Kick start data transfer by sending out http headers. */
evhtp_send_reply_start(req, EVHTP_RES_PARTIAL);
@@ -1032,7 +1032,7 @@
/* Block any new request from this connection before finish
* handling this request.
*/
- evhtp_request_pause (req);
+ bufferevent_disable(bev, EV_READ);

/* Kick start data transfer by sending out http headers. */
evhtp_send_reply_start(req, EVHTP_RES_OK);
@@ -1365,7 +1365,7 @@
/* Block any new request from this connection before finish
* handling this request.
*/
- evhtp_request_pause (req);
+ bufferevent_disable(bev, EV_READ);

/* Kick start data transfer by sending out http headers. */
evhtp_send_reply_start(req, EVHTP_RES_OK);
Index: seafile-server/server/upload-file.c
===================================================================
--- seafile-server.orig/server/upload-file.c 2018-02-01 12:23:53.209308343 +0100
+++ seafile-server/server/upload-file.c 2018-02-01 12:25:14.542400155 +0100
@@ -2054,6 +2054,7 @@
if (res != EVHTP_RES_OK) {
/* Don't receive any data before the connection is closed. */
//evhtp_request_pause (req);
+ // or for later evhtp bufferevent_disable(evhtp_request_get_bev(req), EV_READ);

/* Set keepalive to 0. This will cause evhtp to close the
* connection after sending the reply.
@@ -2271,6 +2272,7 @@
err:
/* Don't receive any data before the connection is closed. */
//evhtp_request_pause (req);
+ // or for later evhtp bufferevent_disable(evhtp_request_get_bev(req), EV_READ);

/* Set keepalive to 0. This will cause evhtp to close the
* connection after sending the reply.
--- seafile-server.orig/server/upload-file.c 2018-02-01 12:25:52.666911934 +0100
+++ seafile-server/server/upload-file.c 2018-02-01 12:27:37.812323399 +0100
@@ -2059,7 +2059,7 @@
/* Set keepalive to 0. This will cause evhtp to close the
* connection after sending the reply.
*/
- req->keepalive = 0;
+ req->flags &= ~EVHTP_REQ_FLAG_KEEPALIVE;

fsm->state = RECV_ERROR;
}
@@ -2260,8 +2260,8 @@
}

/* Set up per-request hooks, so that we can read file data piece by piece. */
- evhtp_set_hook (&req->hooks, evhtp_hook_on_read, upload_read_cb, fsm);
- evhtp_set_hook (&req->hooks, evhtp_hook_on_request_fini, upload_finish_cb, fsm);
+ evhtp_request_set_hook (req, evhtp_hook_on_read, upload_read_cb, fsm);
+ evhtp_request_set_hook (req, evhtp_hook_on_request_fini, upload_finish_cb, fsm);
/* Set arg for upload_cb or update_cb. */
req->cbarg = fsm;

@@ -2277,7 +2277,7 @@
/* Set keepalive to 0. This will cause evhtp to close the
* connection after sending the reply.
*/
- req->keepalive = 0;
+ req->flags &= ~EVHTP_REQ_FLAG_KEEPALIVE;
send_error_reply (req, EVHTP_RES_BADREQ, err_msg);

g_free (repo_id);
@@ -2346,38 +2346,32 @@

cb = evhtp_set_regex_cb (htp, "^/upload/.*", upload_cb, NULL);
/* upload_headers_cb() will be called after evhtp parsed all http headers. */
- evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
+ evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);

cb = evhtp_set_regex_cb (htp, "^/upload-api/.*", upload_api_cb, NULL);
- evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
+ evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);

cb = evhtp_set_regex_cb (htp, "^/upload-raw-blks-api/.*",
upload_raw_blks_api_cb, NULL);
- evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
+ evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);

cb = evhtp_set_regex_cb (htp, "^/upload-blks-api/.*", upload_blks_api_cb, NULL);
- evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
-
- /* cb = evhtp_set_regex_cb (htp, "^/upload-blks-aj/.*", upload_blks_ajax_cb, NULL); */
- /* evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL); */
+ evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);

cb = evhtp_set_regex_cb (htp, "^/upload-aj/.*", upload_ajax_cb, NULL);
- evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
+ evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);

cb = evhtp_set_regex_cb (htp, "^/update/.*", update_cb, NULL);
- evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
+ evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);

cb = evhtp_set_regex_cb (htp, "^/update-api/.*", update_api_cb, NULL);
- evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
+ evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);

cb = evhtp_set_regex_cb (htp, "^/update-blks-api/.*", update_blks_api_cb, NULL);
- evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
-
- /* cb = evhtp_set_regex_cb (htp, "^/update-blks-aj/.*", update_blks_ajax_cb, NULL); */
- /* evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL); */
+ evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);

cb = evhtp_set_regex_cb (htp, "^/update-aj/.*", update_ajax_cb, NULL);
- evhtp_set_hook(&cb->hooks, evhtp_hook_on_headers, upload_headers_cb, NULL);
+ evhtp_callback_set_hook(cb, evhtp_hook_on_headers, upload_headers_cb, NULL);

evhtp_set_regex_cb (htp, "^/upload_progress.*", upload_progress_cb, NULL);

57 changes: 57 additions & 0 deletions net-misc/seafile-server/seafile-server-7.0.1.ebuild
@@ -0,0 +1,57 @@
# Copyright 1999-2019 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=7
PYTHON_COMPAT=( python2_7 )
inherit autotools python-single-r1 vala

DESCRIPTION="File syncing and sharing software with file encryption and group sharing"
HOMEPAGE="https://github.com/haiwen/seafile-server/ http://www.seafile.com/"
SRC_URI="https://github.com/haiwen/${PN}/archive/v${PV}-server.tar.gz -> ${P}.tar.gz"

LICENSE="GPL-2+-with-openssl-exception"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""

RDEPEND="${PYTHON_DEPS}
!net-libs/ccnet
net-misc/ccnet-server
net-libs/libevhtp[oniguruma]
dev-libs/libevent
net-misc/curl
dev-libs/glib
virtual/libmysqlclient
app-arch/libarchive
dev-libs/jansson
sys-fs/fuse
dev-db/sqlite:3
dev-python/pillow[${PYTHON_USEDEP}]
>=dev-python/termcolor-1.1.0[${PYTHON_USEDEP}]
>=dev-python/requests-2.8.0[${PYTHON_USEDEP}]
>=dev-python/pytest-3.3.2[${PYTHON_USEDEP}]
>=dev-python/backports-functools-lru-cache-1.4[${PYTHON_USEDEP}]
>=dev-python/tenacity-4.8.0[${PYTHON_USEDEP}]"
#moviepy
DEPEND="${RDEPEND}
$(vala_depend)"

S="${WORKDIR}/${P}-server"

src_prepare() {
#https://github.com/haiwen/seafile-server/issues/181
#https://github.com/haiwen/ccnet-server/issues/19
# eapply "${FILESDIR}/7.0.1-ccnet.patch"

#https://github.com/haiwen/seafile-server/issues/67#issuecomment-337904800
eapply "${FILESDIR}/libevhtp-1.2.18.patch"

python_fix_shebang tools/seafile-admin

sed -i -e 's/valac /${VALAC} /' lib/Makefile.am || die
eautoreconf
vala_src_prepare
eapply_user
}
Expand Up @@ -16,8 +16,9 @@ IUSE=""
REQUIRED_USE="${PYTHON_REQUIRED_USE}" REQUIRED_USE="${PYTHON_REQUIRED_USE}"


RDEPEND="${PYTHON_DEPS} RDEPEND="${PYTHON_DEPS}
!net-libs/ccnet
>=net-libs/libsearpc-3.1[${PYTHON_USEDEP}] >=net-libs/libsearpc-3.1[${PYTHON_USEDEP}]
~net-libs/ccnet-6.1.7[${PYTHON_USEDEP}] net-misc/ccnet-server
dev-libs/glib:2 dev-libs/glib:2
dev-libs/libevent:0 dev-libs/libevent:0
dev-libs/jansson dev-libs/jansson
Expand Down
2 changes: 2 additions & 0 deletions profiles/pentoo/base/package.accept_keywords/net-libs
Expand Up @@ -40,3 +40,5 @@ net-libs/libpfring


#upstream removed previous versions #upstream removed previous versions
~net-libs/serf-1.3.9 ~net-libs/serf-1.3.9

~net-libs/libevhtp-1.2.18
6 changes: 4 additions & 2 deletions profiles/pentoo/base/package.accept_keywords/net-misc
Expand Up @@ -116,6 +116,8 @@ net-misc/karma
=net-misc/sipp-3.5* =net-misc/sipp-3.5*
net-misc/voipong net-misc/voipong


~net-misc/seafile-7.0.1 =net-misc/seafile-server-7*
=net-misc/seafile-7*
~net-libs/libsearpc-3.1 ~net-libs/libsearpc-3.1
~net-libs/ccnet-6.1.7 =net-libs/ccnet-6.1*
=net-misc/ccnet-server-7*

0 comments on commit 93732f5

Please sign in to comment.