From 1d275a8f2790600dfd766318b8275b071f1f4196 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Sun, 23 Feb 2020 04:08:23 +0800 Subject: [PATCH] seafile-seahub: Update to 7.1.2, refresh patches Other changes include: * Package Python bytecode in seafile-seahub, add source code package (seafile-seahub-src) * Instead of changing default settings, custom settings will be added to /etc/seafile/conf/seahub_settings.py during seafile-server setup * Use SEAFILE_UCI_DATA_DIR, which will be added to seafile-server * Clean up Makefile formatting * Add myself as a maintainer Signed-off-by: Jeffery To --- net/seafile-seahub/Makefile | 87 ++++++++++++------- .../patches/010-default-config.patch | 29 ------- .../patches/020-Makefile-fixes.patch | 9 +- net/seafile-seahub/patches/030-uci-conf.patch | 29 +++++++ .../patches/040-manage-shebang.patch | 8 ++ 5 files changed, 94 insertions(+), 68 deletions(-) delete mode 100644 net/seafile-seahub/patches/010-default-config.patch create mode 100644 net/seafile-seahub/patches/030-uci-conf.patch create mode 100644 net/seafile-seahub/patches/040-manage-shebang.patch diff --git a/net/seafile-seahub/Makefile b/net/seafile-seahub/Makefile index a479c7d4e..47a6df773 100644 --- a/net/seafile-seahub/Makefile +++ b/net/seafile-seahub/Makefile @@ -8,67 +8,88 @@ include $(TOPDIR)/rules.mk PKG_NAME:=seafile-seahub -PKG_VERSION:=6.3.4 -PKG_RELEASE:=8 +PKG_VERSION:=7.1.2 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/haiwen/seahub/tar.gz/v$(PKG_VERSION)-server? -PKG_HASH:=53a9efdb6791fd3a2a191e89cb0f133632056046ec08adbb2ad72088e6161430 +PKG_HASH:=647dca870c996ed00844d3bf45bc15f22fdf5268cfd3ac4c0dd9e4c15360361d -PKG_MAINTAINER:=Alexandru Ardelean +PKG_MAINTAINER:=Alexandru Ardelean , Jeffery To PKG_LICENSE:=Apache-2.0 PKG_LICENSE_FILES:=LICENSE.txt -HOST_PYTHON_PACKAGE_BUILD_DEPENDS:="django>=1.11" - PKG_BUILD_DIR:=$(BUILD_DIR)/seahub-$(PKG_VERSION)-server -include $(INCLUDE_DIR)/package.mk -include ../../lang/python/python-package.mk +HOST_PYTHON3_PACKAGE_BUILD_DEPENDS:="Django~=1.11" + +PKG_BUILD_PARALLEL:=1 -SEAFILE_PYTHON_DEPENDS:= \ - simplejson chardet dateutil mysqlclient pytz qrcode requests requests-oauthlib \ - django1 django-constance django-appconf django-compressor django-formtools \ - django-jsonfield django-picklefield django-postoffice django-restframework39 \ - pillow django-simple-captcha django-statici18n django-webpack-loader +include $(INCLUDE_DIR)/package.mk +include ../../lang/python/python3-package.mk define Package/seafile-seahub SECTION:=net CATEGORY:=Network TITLE:=Seafile server - seahub component URL:=https://seafile.com/ - DEPENDS:=+python \ - +python-flup +gunicorn +openpyxl \ - $(foreach dep,$(SEAFILE_PYTHON_DEPENDS),+python-$(dep)) + DEPENDS:= \ + +gunicorn3 \ + +python3 \ + +python3-chardet \ + +python3-cryptodome \ + +python3-dateutil \ + +python3-django1 \ + +python3-django-formtools \ + +python3-django-picklefield \ + +python3-django-postoffice \ + +python3-django-restframework39 \ + +python3-django-simple-captcha \ + +python3-django-statici18n \ + +python3-django-webpack-loader \ + +python3-openpyxl \ + +python3-pillow \ + +python3-pyjwt \ + +python3-pymysql \ + +python3-pytz \ + +python3-qrcode \ + +python3-requests \ + +python3-requests-oauthlib \ + +python3-seafile-ccnet \ + +python3-searpc + VARIANT:=python3 +endef + +define Package/seafile-seahub/description + The web end of seafile server. + + Note: Localization support is turned off by default for performance + reasons. Set 'USE_I18N = True' in /etc/seafile/conf/seahub_settings.py + to use languages other than English. endef define Build/Configure endef MAKE_VARS += \ - PYTHON="$(HOST_PYTHON_BIN)" \ + PYTHON="$(HOST_PYTHON3_BIN)" \ DJANGO_ADMIN_PY="$(STAGING_DIR_HOSTPKG)/bin/django-admin" -define Build/Compile - $(call Build/Compile/HostPyPipInstall,$(HOST_PYTHON_PACKAGE_BUILD_DEPENDS)) +define Py3Build/Compile + $(call Build/Compile/HostPy3PipInstall,$(HOST_PYTHON3_PACKAGE_BUILD_DEPENDS)) $(call Build/Compile/Default,locale) + $(INSTALL_DIR) $(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR) endef -define Package/seafile-seahub/description - The web end of seafile server. - - NOTE: in order to have better performance, localization support is turned off by default. - Please set 'USE_I18N = True' in seahub_settings.py if you intend to use languages other than English. -endef - -define Package/seafile-seahub/install - $(INSTALL_DIR) $(1)/usr/share/seafile/seafile-server/seahub - $(CP) $(PKG_BUILD_DIR)/{locale,media,fabfile,seahub,sql,tests,thirdpart,tools} $(1)/usr/share/seafile/seafile-server/seahub/ - $(CP) $(PKG_BUILD_DIR)/*.{sh,template,py,txt} $(1)/usr/share/seafile/seafile-server/seahub/ - $(CP) $(PKG_BUILD_DIR)/{CONTRIBUTORS,HACKING,README.markdown} $(1)/usr/share/seafile/seafile-server/seahub/ - $(CP) $(PKG_BUILD_DIR)/pylintrc* $(1)/usr/share/seafile/seafile-server/seahub/ - find $(1) -name "*\.pyc" -o -name "*\.pyo" | xargs rm -f +define Py3Package/seafile-seahub/install + $(INSTALL_DIR) $(1)/usr/share/seafile/seafile-server/seahub/tools + $(CP) $(PKG_BUILD_DIR)/{frontend,locale,media,seahub,sql,static,thirdpart} $(1)/usr/share/seafile/seafile-server/seahub/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/manage.py $(1)/usr/share/seafile/seafile-server/seahub/ + $(INSTALL_DATA) $(PKG_BUILD_DIR)/tools/secret_key_generator.py $(1)/usr/share/seafile/seafile-server/seahub/tools/ $(SED) "s/\(SEAFILE_VERSION\s*=\s*\)'\([0-9]\.[0-9]\.[0-9]\)'/\1'$(PKG_VERSION)'/g" $(1)/usr/share/seafile/seafile-server/seahub/seahub/settings.py + mv $(1)/usr/share/seafile/seafile-server/seahub/media/avatars $(1)/usr/share/seafile/seafile-server/seahub/media/avatars_default endef +$(eval $(call Py3Package,seafile-seahub)) $(eval $(call BuildPackage,seafile-seahub)) +$(eval $(call BuildPackage,seafile-seahub-src)) diff --git a/net/seafile-seahub/patches/010-default-config.patch b/net/seafile-seahub/patches/010-default-config.patch deleted file mode 100644 index 91ccabc0f..000000000 --- a/net/seafile-seahub/patches/010-default-config.patch +++ /dev/null @@ -1,29 +0,0 @@ ---- a/seahub/settings.py -+++ b/seahub/settings.py -@@ -46,7 +46,7 @@ SITE_ID = 1 - - # If you set this to False, Django will make some optimizations so as not - # to load the internationalization machinery. --USE_I18N = True -+USE_I18N = False - - # If you set this to False, Django will not format dates, numbers and - # calendars according to the current locale. -@@ -339,7 +339,7 @@ SHARE_LINK_EMAIL_LANGUAGE = '' - ENABLE_UPLOAD_LINK_VIRUS_CHECK = False - - # mininum length for user's password --USER_PASSWORD_MIN_LENGTH = 6 -+USER_PASSWORD_MIN_LENGTH = 8 - - # LEVEL based on four types of input: - # num, upper letter, lower letter, other symbols -@@ -348,7 +348,7 @@ USER_PASSWORD_STRENGTH_LEVEL = 3 - - # default False, only check USER_PASSWORD_MIN_LENGTH - # when True, check password strength level, STRONG(or above) is allowed --USER_STRONG_PASSWORD_REQUIRED = False -+USER_STRONG_PASSWORD_REQUIRED = True - - # Force user to change password when admin add/reset a user. - FORCE_PASSWORD_CHANGE = True diff --git a/net/seafile-seahub/patches/020-Makefile-fixes.patch b/net/seafile-seahub/patches/020-Makefile-fixes.patch index 36c808493..12451b8f6 100644 --- a/net/seafile-seahub/patches/020-Makefile-fixes.patch +++ b/net/seafile-seahub/patches/020-Makefile-fixes.patch @@ -7,7 +7,7 @@ PROJECT=seahub develop: setup-git -@@ -9,7 +12,7 @@ dist: locale uglify statici18n collectstatic +@@ -9,22 +12,22 @@ dist: locale statici18n collectstatic locale: @echo "--> Compile locales" @@ -15,9 +15,6 @@ + $(DJANGO_ADMIN_PY) compilemessages @echo "" - uglify: -@@ -19,17 +22,17 @@ uglify: - statici18n: @echo "--> Generate JS locale files in static/scripts/i18n" - python manage.py compilejsi18n @@ -26,8 +23,8 @@ collectstatic: @echo "--> Collect django static files to media/assets" rm -rf media/assets 2> /dev/null -- python manage.py collectstatic --noinput -i admin -i termsandconditions -i app -i sysadmin-app -i build.js -+ $(PYTHON) manage.py collectstatic --noinput -i admin -i termsandconditions -i app -i sysadmin-app -i build.js +- python manage.py collectstatic --noinput -i admin -i termsandconditions ++ $(PYTHON) manage.py collectstatic --noinput -i admin -i termsandconditions compressstatic: @echo "--> Compress static files(css) to media/CACHE" diff --git a/net/seafile-seahub/patches/030-uci-conf.patch b/net/seafile-seahub/patches/030-uci-conf.patch new file mode 100644 index 000000000..e5559e52d --- /dev/null +++ b/net/seafile-seahub/patches/030-uci-conf.patch @@ -0,0 +1,29 @@ +--- a/seahub/settings.py ++++ b/seahub/settings.py +@@ -140,7 +140,7 @@ TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [ +- os.path.join(PROJECT_ROOT, '../../seahub-data/custom/templates'), ++ os.path.join(os.environ.get('SEAFILE_UCI_DATA_DIR', os.path.join(PROJECT_ROOT, '../..')), 'seahub-data/custom/templates'), + os.path.join(PROJECT_ROOT, 'seahub/templates'), + ], + 'APP_DIRS': True, +@@ -627,7 +627,7 @@ CAPTCHA_IMAGE_SIZE = (90, 42) + ENABLE_THUMBNAIL = True + + # Absolute filesystem path to the directory that will hold thumbnail files. +-SEAHUB_DATA_ROOT = os.path.join(PROJECT_ROOT, '../../seahub-data') ++SEAHUB_DATA_ROOT = os.path.join(os.environ.get('SEAFILE_UCI_DATA_DIR', os.path.join(PROJECT_ROOT, '../..')), 'seahub-data') + if os.path.exists(SEAHUB_DATA_ROOT): + THUMBNAIL_ROOT = os.path.join(SEAHUB_DATA_ROOT, 'thumbnail') + else: +@@ -790,7 +790,7 @@ except ImportError: + pass + else: + # In server release, sqlite3 db file is /seahub.db +- DATABASES['default']['NAME'] = os.path.join(install_topdir, 'seahub.db') ++ DATABASES['default']['NAME'] = os.path.join(os.environ.get('SEAFILE_UCI_DATA_DIR', install_topdir), 'seahub.db') + + # In server release, gunicorn is used to deploy seahub + INSTALLED_APPS += ('gunicorn', ) diff --git a/net/seafile-seahub/patches/040-manage-shebang.patch b/net/seafile-seahub/patches/040-manage-shebang.patch new file mode 100644 index 000000000..8507d0c19 --- /dev/null +++ b/net/seafile-seahub/patches/040-manage-shebang.patch @@ -0,0 +1,8 @@ +--- a/manage.py ++++ b/manage.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/python3 + import os + import sys +