FreeBSD Bugzilla – Attachment 149742 Details for
Bug 195024
[maintainer-update] net-mgmt/seafile: remove requirements of /proc
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
SVN diff
seafile.diff (text/plain), 14.30 KB, created by
Jingfeng Yan
on 2014-11-23 03:11:26 UTC
(
hide
)
Description:
SVN diff
Filename:
MIME Type:
Creator:
Jingfeng Yan
Created:
2014-11-23 03:11:26 UTC
Size:
14.30 KB
patch
obsolete
>Index: Makefile >=================================================================== >--- Makefile (revision 372583) >+++ Makefile (working copy) >@@ -2,6 +2,7 @@ > > PORTNAME= seafile > PORTVERSION= 3.1.4 >+PORTREVISION= 1 > CATEGORIES= net-mgmt devel > > MAINTAINER= yan_jingfeng@yahoo.com >@@ -15,7 +16,6 @@ > libzdb.so:${PORTSDIR}/databases/libzdb \ > libcrypto.so:${PORTSDIR}/security/openssl \ > libarchive.so.13:${PORTSDIR}/archivers/libarchive \ >- libfuse.so:${PORTSDIR}/sysutils/fusefs-libs \ > libinotify.so:${PORTSDIR}/devel/libinotify \ > libccnet.so:${PORTSDIR}/net-mgmt/ccnet > RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}eggtestinfo>0:${PORTSDIR}/devel/py-eggtestinfo \ >@@ -45,6 +45,20 @@ > > MAKE_JOBS_UNSAFE= yes > >+OPTIONS_DEFINE= FUSE RIAK >+OPTIONS_SUB= yes >+FUSE_DESC= Use file system in userspace >+FUSE_CONFIGURE_ENABLE= fuse >+FUSE_LIB_DEPENDS=libfuse.so:${PORTSDIR}/sysutils/fusefs-libs >+RIAK_DESC= Use distributed noSQL database >+RIAK_CONFIGURE_ENABLE= riak >+RIAK_RUN_DEPENDS=riak:${PORTSDIR}/databases/riak >+ >+OPTIONS_DEFAULT=FUSE >+.if defined(DFLYVERSION) >+OPTIONS_DEFAULT= >+.endif >+ > post-install: > @${MKDIR} ${SEABIN} \ > ${STAGEDIR}${WWWDIR}/seafile/share/doc/seafile \ >@@ -51,7 +65,9 @@ > ${STAGEDIR}${WWWDIR}/upgrade > .for SERVPROG in fileserver seaf-fsck seafserv-gc seaf-fuse seaf-migrate \ > seaf-server seaf-server-init seafile-controller seafserv-tool >- ${LN} ${STAGEDIR}${PREFIX}/bin/${SERVPROG} ${SEABIN} >+ if [ -e "${STAGEDIR}${PREFIX}/bin/${SERVPROG}" ]; then \ >+ ${LN} ${STAGEDIR}${PREFIX}/bin/${SERVPROG} ${SEABIN}; \ >+ fi > .endfor > ${INSTALL_SCRIPT} ${WRKSRC}/scripts/*.[ps][yh] ${STAGEDIR}${WWWDIR} > ${INSTALL_SCRIPT} ${WRKSRC}/scripts/upgrade/*.[ps][yh] \ >Index: files/patch-configure.ac >=================================================================== >--- files/patch-configure.ac (revision 372583) >+++ files/patch-configure.ac (working copy) >@@ -1,5 +1,14 @@ >---- configure.ac.orig 2014-06-05 02:25:50.000000000 -0400 >-+++ configure.ac 2014-07-21 12:43:12.000000000 -0400 >+--- configure.ac.orig 2014-08-05 01:28:35.000000000 -0400 >++++ configure.ac 2014-11-22 13:34:26.927863521 -0500 >+@@ -88,7 +88,7 @@ >+ [compile_riak=$enableval],[compile_riak="no"]) >+ >+ AC_ARG_ENABLE(fuse, AC_HELP_STRING([--enable-fuse], [enable fuse virtual file system]), >+- [compile_fuse=$enableval],[compile_fuse="yes"]) >++ [compile_fuse=$enableval],[compile_fuse="no"]) >+ fi >+ >+ AC_ARG_ENABLE(client, AC_HELP_STRING([--enable-client], [enable client]), > @@ -199,25 +199,28 @@ > LIB_GDI32= > LIB_RT= >@@ -40,7 +49,7 @@ > AC_SUBST(MSVC_CFLAGS) > > >-@@ -241,7 +246,6 @@ >+@@ -242,7 +247,6 @@ > #LIBNAUTILUS_EXTENSION_REQUIRED=2.30.1 > CURL_REQUIRED=7.17 > FUSE_REQUIRED=2.8.6 >@@ -48,7 +57,7 @@ > > PKG_CHECK_MODULES(GLIB2, [glib-2.0 >= $GLIB_REQUIRED]) > AC_SUBST(GLIB2_CFLAGS) >-@@ -263,10 +267,6 @@ >+@@ -268,10 +272,6 @@ > AC_SUBST(LIBEVENT_CFLAGS) > AC_SUBST(LIBEVENT_LIBS) > >Index: files/patch-controller_seafile-controller.c >=================================================================== >--- files/patch-controller_seafile-controller.c (revision 372583) >+++ files/patch-controller_seafile-controller.c (working copy) >@@ -1,25 +1,70 @@ >---- controller/seafile-controller.c.orig 2014-08-05 01:28:35.000000000 -0400 >-+++ controller/seafile-controller.c 2014-08-30 09:11:34.868400091 -0400 >-@@ -18,6 +18,10 @@ >- #include "log.h" >- #include "seafile-controller.h" >- >-+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) >-+#include <sys/sysctl.h> >-+#endif >-+ >- #define CHECK_PROCESS_INTERVAL 10 /* every 10 seconds */ >- >- SeafileController *ctl; >-@@ -273,7 +277,11 @@ >- init_seafile_path () >- { >- GError *error = NULL; >-+#if defined(__linux__) >- char *executable = g_file_read_link ("/proc/self/exe", &error); >-+#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) >-+ char *executable = g_file_read_link ("/proc/curproc/file", &error); >-+#endif >- char *tmp = NULL; >- if (error != NULL) { >- seaf_warning ("failed to readlink: %s\n", error->message); >+20a21,32 >+> #if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) >+> #include <sys/sysctl.h> >+> #include <sys/types.h> >+> #include <sys/user.h> >+> #include <limits.h> >+> >+> #ifndef WITH_PROC_FS >+> #define WITH_PROC_FS g_file_test("/proc/curproc", G_FILE_TEST_EXISTS) >+> #endif >+> >+> #endif >+> >+24a37 >+> static char *command_name = NULL; >+275a289 >+> #if defined(__linux__) >+276a291,302 >+> #elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) >+> /* >+> * seafile.sh starts the process using abs path >+> */ >+> char executable[_POSIX_PATH_MAX]; >+> memset(executable, 0, _POSIX_PATH_MAX); >+> char * rc = realpath(command_name, executable); >+> if (!rc) { >+> seaf_warning ("failed to readpath: %s\n", executable); >+> return; >+> } >+> #endif >+289a316 >+> #if defined(__linux__) >+290a318 >+> #endif >+429a458,466 >+> gboolean with_procfs; >+> #if defined(__linux__) >+> with_procfs = g_file_test("/proc/self", G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR); >+> #elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) >+> with_procfs = g_file_test("/proc/curproc", G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR); >+> #else >+> with_procfs = FALSE; >+> #endif >+> if (with_procfs) { >+435c472,492 >+< } >+--- >+> } >+> >+> } else { >+> #if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) >+> #ifdef __OpenBSD__ >+> int min[6] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, pid, sizeof(struct kinfo_proc), 1}; >+> #else >+> int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, pid}; >+> #endif >+> size_t len = sizeof(struct kinfo_proc); >+> struct kinfo_proc kp; >+> if (sysctl(mib, sizeof(mib)/sizeof(mib[0]), &kp, &len, NULL, 0) != -1 && >+> len == sizeof(struct kinfo_proc)) { >+> return FALSE; >+> } else { >+> return TRUE; >+> } >+> #else >+> return FALSE; >+> #endif >+> } >+894a952 >+> command_name = argv[0]; >Index: files/patch-lib_Makfile.am >=================================================================== >--- files/patch-lib_Makfile.am (revision 372583) >+++ files/patch-lib_Makfile.am (working copy) >@@ -1,5 +1,14 @@ >---- lib/Makefile.am.orig 2014-08-30 02:00:00.097346044 -0400 >-+++ lib/Makefile.am 2014-08-30 02:00:10.951213463 -0400 >+--- lib/Makefile.am.orig 2014-11-11 10:47:33.631976054 -0500 >++++ lib/Makefile.am 2014-11-11 11:40:14.030311321 -0500 >+@@ -55,7 +55,7 @@ >+ libseafile_common_la_LDFLAGS = -no-undefined >+ libseafile_common_la_LIBADD = @GLIB2_LIBS@ @GOBJECT_LIBS@ -lssl -lcrypto @LIB_GDI32@ \ >+ @LIB_UUID@ @LIB_WS32@ @LIB_PSAPI@ -lsqlite3 \ >+- -levent @SEARPC_LIBS@ @LIB_SHELL32@ \ >++ -levent -lkvm @SEARPC_LIBS@ @LIB_SHELL32@ \ >+ @ZLIB_LIBS@ >+ >+ searpc_gen = searpc-signature.h searpc-marshal.h > @@ -72,8 +72,4 @@ > rm -f $(top_srcdir)/lib/rpc_table.pyc > >Index: files/patch-lib_utils.c >=================================================================== >--- files/patch-lib_utils.c (revision 372583) >+++ files/patch-lib_utils.c (working copy) >@@ -1,11 +1,26 @@ >---- lib/utils.c.orig 2014-06-05 02:25:50.000000000 -0400 >-+++ lib/utils.c 2014-07-30 22:56:37.000000000 -0400 >-@@ -1756,14 +1756,19 @@ >+--- lib/utils.c.orig 2014-08-05 01:28:35.000000000 -0400 >++++ lib/utils.c 2014-11-22 20:17:13.543784891 -0500 >+@@ -46,6 +46,15 @@ > >+ #include <zlib.h> >+ >++#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) >++#include <stdlib.h> >++#include <kvm.h> >++#include <paths.h> >++#include <sys/param.h> >++#include <sys/sysctl.h> >++#include <sys/user.h> >++#endif >++ >+ extern int inet_pton(int af, const char *src, void *dst); >+ >+ >+@@ -1756,14 +1765,19 @@ >+ > #endif /* ifdef WIN32 */ > > -#ifdef __linux__ >-+#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) > /* read the link of /proc/123/exe and compare with `process_name' */ > static int > find_process_in_dirent(struct dirent *dir, const char *process_name) >@@ -14,10 +29,167 @@ > /* fisrst construct a path like /proc/123/exe */ > +#ifdef __linux__ > if (sprintf (path, "/proc/%s/exe", dir->d_name) < 0) { >-+#endif >-+#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) >++#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) > + if (sprintf (path, "/proc/%s/file", dir->d_name) < 0) { >++#else >++ if (TRUE) { > +#endif > return -1; > } > >+@@ -1787,7 +1801,8 @@ >+ } >+ >+ /* read the /proc fs to determine whether some process is running */ >+-gboolean process_is_running (const char *process_name) >++static gboolean >++process_is_running_procfs (const char *process_name) >+ { >+ DIR *proc_dir = opendir("/proc"); >+ if (!proc_dir) { >+@@ -1812,7 +1827,8 @@ >+ return FALSE; >+ } >+ >+-int count_process(const char *process_name) >++static int >++count_process_procfs(const char *process_name) >+ { >+ int count = 0; >+ DIR *proc_dir = opendir("/proc"); >+@@ -1836,6 +1852,14 @@ >+ return count; >+ } >+ >++#ifdef __linux__ >++gboolean process_is_running (const char *process_name) { >++ return process_is_running_procfs(process_name); >++} >++ >++int count_process(const char *process_name) { >++ return count_process_procfs(process_name); >++} >+ #endif >+ >+ #ifdef __APPLE__ >+@@ -1846,6 +1870,120 @@ >+ } >+ #endif >+ >++#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) >++#if defined(__FreeBSD__) >++#define PSKIP(kp) ((kp)->ki_pid == mypid || \ >++ (!kthreads && ((kp)->ki_flag & P_KTHREAD) != 0)) >++#define KVM_OPENFILES(exec, coref, buf) \ >++ kvm_openfiles(exec, coref, NULL, O_RDONLY, buf) >++#define KVM_GETPROCS(kd, plist, nproc) \ >++ kvm_getprocs(kd, KERN_PROC_PROC, 0, &nproc) >++ >++#elif defined(__DragonFly__) >++#define PSKIP(kp) ((kp)->kp_pid == mypid || \ >++ (!kthreads && ((kp)->kp_flags & P_KTHREADP) != 0)) >++#define KVM_OPENFILES(exec, coref, buf) \ >++ kvm_openfiles(exec, coref, NULL, O_RDONLY, buf) >++#define KVM_GETPROCS(kd, plist, nproc) \ >++ kvm_getprocs(kd, KERN_PROC_ALL, 0, &nproc) >++ >++#elif defined(__NetBSD__) >++#define PSKIP(kp) ((kp)->kp_pid == mypid || \ >++ ((kp)->p_flag & P_SYSTEM) != 0) >++#define KVM_OPENFILES(exec, coref, buf) \ >++ kvm_openfiles(exec, coref, NULL, KVM_NO_FILES, buf) >++#define KVM_GETPROCS(kd, plist, nproc) \ >++ kvm_getprocs(kd, KERN_PROC_ALL, 0, sizeof(*plist), &nproc) >++ >++#elif defined(__OpenBSD__) >++#define PSKIP(kp) ((kp)->kp_pid == mypid || \ >++ ((kp)->p_flag & (P_SYSTEM | P_THREAD)) != 0) >++#define KVM_OPENFILES(exec, coref, buf) \ >++ kvm_openfiles(exec, coref, NULL, KVM_NO_FILES, buf) >++#define KVM_GETPROCS(kd, plist, nproc) \ >++ kvm_getprocs(kd, KERN_PROC_ALL, 0, sizeof(*plist), &nproc) >++ >++#else >++#define PSKIP(kp) 0 >++#define KVM_OPENFILES(exec, coref, buf) 0 >++#define KVM_GETPROCS(kd, plist, nproc) 0 >++#endif >++ >++#ifndef WITH_PROC_FS >++#define WITH_PROC_FS g_file_test("/proc/curproc", G_FILE_TEST_EXISTS) >++#endif >++ >++static int >++count_running_process_kvm(const char *process_name) { >++ >++ >++ static kvm_t *kd; >++ static struct kinfo_proc *plist; >++ static int nproc; >++ static pid_t mypid; >++ static int kthreads; >++ >++ char buf[_POSIX2_LINE_MAX]; >++ const char * execf, *coref; >++ char **pargv; >++ int i, selected_nproc; >++ struct kinfo_proc *kp; >++ >++ selected_nproc = 0; >++ execf = NULL; >++ coref = _PATH_DEVNULL; >++ >++ mypid = getpid(); >++ kd = KVM_OPENFILES(execf, coref, buf); >++ if (kd == NULL) { >++ fprintf(stderr, "Error: Cannot open kernel files (%s)", buf); >++ exit(1); >++ } >++ >++ plist = KVM_GETPROCS(kd, plist, nproc); >++ if (plist == NULL) { >++ fprintf(stderr, "Error: Cannot get process list (%s)", kvm_geterr(kd)); >++ exit(1); >++ } >++ >++ for(i = 0, kp = plist; i < nproc; i++, kp++) { >++ if (PSKIP(kp)) { >++ continue; >++ } >++ if ((pargv = kvm_getargv(kd, kp, 0)) != NULL) { >++ if (strstr(pargv[0], process_name) != NULL) { >++ selected_nproc += 1; >++ } >++ } >++ } >++ kvm_close(kd); >++ kvm_close(kd); >++ >++ return selected_nproc; >++} >++ >++gboolean >++process_is_running(const char * process_name) { >++ if (WITH_PROC_FS) { >++ return process_is_running_procfs(process_name); >++ } >++ if (count_running_process_kvm(process_name) > 0) { >++ return TRUE; >++ } else { >++ return FALSE; >++ } >++} >++ >++int >++count_process(const char * process_name) { >++ if (WITH_PROC_FS) { >++ return count_process_procfs(process_name); >++ } >++ return count_running_process_kvm(process_name); >++} >++#endif >++ >++ >+ char* >+ ccnet_object_type_from_id (const char *object_id) >+ { >Index: files/patch-lib_utils.h >=================================================================== >--- files/patch-lib_utils.h (revision 372583) >+++ files/patch-lib_utils.h (working copy) >@@ -1,5 +1,5 @@ >---- lib/utils.h.orig 2014-06-05 02:25:50.000000000 -0400 >-+++ lib/utils.h 2014-07-27 01:48:52.000000000 -0400 >+--- lib/utils.h.orig 2014-08-05 01:28:35.000000000 -0400 >++++ lib/utils.h 2014-11-11 11:30:51.843637061 -0500 > @@ -3,6 +3,9 @@ > #ifndef CCNET_UTILS_H > #define CCNET_UTILS_H >@@ -10,3 +10,14 @@ > #include <sys/time.h> > #include <time.h> > #include <stdint.h> >+@@ -13,7 +16,9 @@ >+ #include <stdlib.h> >+ #include <sys/stat.h> >+ >+-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) >++#if defined(__FreeBSD__) || defined(__DragonFly__) >++#include <evutil.h> >++#elif (__NetBSD__) || defined(__OpenBSD__) >+ #include <event2/util.h> >+ #else >+ #include <evutil.h> >Index: pkg-plist >=================================================================== >--- pkg-plist (revision 372583) >+++ pkg-plist (working copy) >@@ -2,7 +2,7 @@ > bin/seaf-cli > bin/seaf-daemon > bin/seaf-fsck >-bin/seaf-fuse >+%%FUSE%%bin/seaf-fuse > bin/seaf-migrate > bin/seaf-server > bin/seaf-server-init >@@ -47,7 +47,7 @@ > %%WWWDIR%%/seafile.sh > %%WWWDIR%%/seafile/bin/fileserver > %%WWWDIR%%/seafile/bin/seaf-fsck >-%%WWWDIR%%/seafile/bin/seaf-fuse >+%%FUSE%%%%WWWDIR%%/seafile/bin/seaf-fuse > %%WWWDIR%%/seafile/bin/seaf-migrate > %%WWWDIR%%/seafile/bin/seaf-server > %%WWWDIR%%/seafile/bin/seaf-server-init
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 195024
:
149424
|
149425
|
149520
|
149740
|
149741
|
149742
|
149744