From 785cc05e4d744f9e3d8f38e9049ab939eae6d01e Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Sun, 20 May 2018 18:22:26 +0200 Subject: [PATCH 1/2] Upgrade to 0.13 --- check_process | 20 ++++++++++++++------ conf/app-frontend.src | 4 ++-- conf/app.src | 4 ++-- manifest.json | 2 +- sources/patches/app-001.patch | 35 ----------------------------------- 5 files changed, 19 insertions(+), 46 deletions(-) delete mode 100644 sources/patches/app-001.patch diff --git a/check_process b/check_process index bae967b..248b549 100644 --- a/check_process +++ b/check_process @@ -10,15 +10,16 @@ admin="john" (USER) is_public=1 (PUBLIC|public=1|private=0) ; Checks - pkg_linter=1 + pkg_linter=0 setup_sub_dir=0 - setup_root=1 + setup_root=0 setup_nourl=0 - setup_private=1 - setup_public=1 + setup_private=0 + setup_public=0 upgrade=1 - backup_restore=1 - multi_instance=1 + upgrade=1 from_commit=9b30b385673eb4dda1c85a84a9cacf8409cf4ab7 + backup_restore=0 + multi_instance=0 incorrect_path=0 port_already_use=0 change_url=0 @@ -35,3 +36,10 @@ Level 8=0 Level 9=0 Level 10=0 +;;; Options +Email=jean-baptiste@holcroft.fr +Notification=all +;;; Upgrade options + ; commit=9b30b385673eb4dda1c85a84a9cacf8409cf4ab7 + name=Upgrade from 0.12 +manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1 \ No newline at end of file diff --git a/conf/app-frontend.src b/conf/app-frontend.src index 084e202..d54fb90 100644 --- a/conf/app-frontend.src +++ b/conf/app-frontend.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://code.eliotberriot.com/funkwhale/funkwhale/builds/artifacts/0.12/download?job=build_front -SOURCE_SUM=9c83b90877c6025654c071a87dd60dd69c5548df0fdfa77abcc27a259c846c64 +SOURCE_URL=https://code.eliotberriot.com/funkwhale/funkwhale/builds/artifacts/0.13/download?job=build_front +SOURCE_SUM=6b22681951b7e5f2acea84ee8f1767256b723591ddcaf3e526c885ba26335934 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=false diff --git a/conf/app.src b/conf/app.src index 225a7fb..bb9b41a 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://code.eliotberriot.com/funkwhale/funkwhale/-/archive/0.12/funkwhale-0.12.tar.bz2 -SOURCE_SUM=5ef7a2cdc760f16f9fde818e1a17eff18bc59e47b985f405b85337d38f71ddaf +SOURCE_URL=https://code.eliotberriot.com/funkwhale/funkwhale/-/archive/0.13/funkwhale-0.13.tar.bz2 +SOURCE_SUM=e615fdb072528cac190c6a241ac371dc2f57a5e5ee7ae8788d7b512f39300788 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.bz2 SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index f8d3dfe..e2122b6 100644 --- a/manifest.json +++ b/manifest.json @@ -8,7 +8,7 @@ "description": { "en": "A modern, convivial and free music server" }, - "version": "0.12.0-1", + "version": "0.13.0~ynh1", "url": "https://funkwhale.audio", "license": "BSD-3-Clause", "maintainer": { diff --git a/sources/patches/app-001.patch b/sources/patches/app-001.patch deleted file mode 100644 index 5e56695..0000000 --- a/sources/patches/app-001.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git a/api/funkwhale_api/users/models.py b/api/funkwhale_api/users/models.py -index 773d60f38ebec50dd46cda63b05b37ac4659573c..f067a2a8b44b4bfbd61b8f7af86829301d178da0 100644 ---- a/api/funkwhale_api/users/models.py -+++ b/api/funkwhale_api/users/models.py -@@ -1,8 +1,9 @@ - # -*- coding: utf-8 -*- - from __future__ import unicode_literals, absolute_import - -+import binascii -+import os - import uuid --import secrets - - from django.conf import settings - from django.contrib.auth.models import AbstractUser -@@ -14,6 +15,10 @@ from django.utils.translation import ugettext_lazy as _ - from funkwhale_api.common import fields - - -+def get_token(): -+ return binascii.b2a_hex(os.urandom(15)).decode('utf-8') -+ -+ - @python_2_unicode_compatible - class User(AbstractUser): - -@@ -58,7 +63,7 @@ class User(AbstractUser): - return self.secret_key - - def update_subsonic_api_token(self): -- self.subsonic_api_token = secrets.token_hex(32) -+ self.subsonic_api_token = get_token() - return self.subsonic_api_token - - def set_password(self, raw_password): From 9615629ed20bbbaf821152c374c76ec808c01300 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Sun, 20 May 2018 19:58:33 +0200 Subject: [PATCH 2/2] Improve redis helper --- check_process | 14 +++++++------- scripts/_common.sh | 10 ++++++++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/check_process b/check_process index 248b549..ac15523 100644 --- a/check_process +++ b/check_process @@ -6,20 +6,20 @@ ;; Test complet ; Manifest domain="domain.tld" (DOMAIN) - path="/path" (PATH) + path="/" (PATH) admin="john" (USER) is_public=1 (PUBLIC|public=1|private=0) ; Checks - pkg_linter=0 + pkg_linter=1 setup_sub_dir=0 - setup_root=0 + setup_root=1 setup_nourl=0 - setup_private=0 - setup_public=0 + setup_private=1 + setup_public=1 upgrade=1 upgrade=1 from_commit=9b30b385673eb4dda1c85a84a9cacf8409cf4ab7 - backup_restore=0 - multi_instance=0 + backup_restore=1 + multi_instance=1 incorrect_path=0 port_already_use=0 change_url=0 diff --git a/scripts/_common.sh b/scripts/_common.sh index 4d52e5a..08ae00d 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -12,20 +12,26 @@ # usage: ynh_redis_get_free_db # | returns: the database number to use ynh_redis_get_free_db() { - local result + local result max db result=$(redis-cli INFO keyspace) + # get the num + max=$(cat /etc/redis/redis.conf | grep ^databases | grep -Eow "[0-9]+") + db=0 # default Debian setting is 15 databases - for i in $(seq 0 15) + for i in $(seq 0 "$max") do if ! echo "$result" | grep -q "db$i" then db=$i break 1 + db=-1 fi done + test "$db" -eq -1 && ynh_die "No available Redis databases..." + echo "$db" }