1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/synapse_ynh.git synced 2024-09-03 20:26:38 +02:00

Upgrade to 0.25.0

This commit is contained in:
Josué Tille 2017-11-11 13:17:49 +01:00
parent 2eaf418a5f
commit 22e3aae214
8 changed files with 49 additions and 12 deletions

View file

@ -1,6 +1,6 @@
SOURCE_URL=https://github.com/Josue-T/synapse_python_build/releases/download/v__APP_VERSION__/matrix-synapse___APP_VERSION__-bin1_armv7l.tar.gz
SOURCE_SUM=20b6b3b195210aa778a017796a310b4327d8ecbd1b423214e83603aae319957c
SOURCE_SUM=e1a1790936d10624faf7bbb51b72924a76a6385fc4ed909629e371b4cdc240bf
# (Optional) Program to check the integrity (sha256sum, md5sum...)
# default: sha256
SOURCE_SUM_PRG=sha256sum

View file

@ -9,7 +9,7 @@
"en": "Instant messaging server who use matrix",
"fr": "Un serveur de messagerie instantané basé sur matrix"
},
"version": "0.24.1",
"version": "0.25.0",
"url": "http://matrix.org",
"license": "Apache-2.0",
"maintainer": {

View file

@ -16,7 +16,7 @@ get_app_version_from_json() {
APP_VERSION=$(get_app_version_from_json)
install_dependances() {
ynh_install_app_dependencies coturn build-essential python2.7-dev libffi-dev python-pip python-setuptools sqlite3 libssl-dev python-virtualenv libxml2-dev libxslt1-dev python-lxml libjpeg-dev libpq-dev postgresql
ynh_install_app_dependencies coturn build-essential python2.7-dev libffi-dev python-pip python-setuptools sqlite3 libssl-dev python-virtualenv libxml2-dev libxslt1-dev python-lxml libjpeg-dev libpq-dev postgresql acl
pip install --upgrade pip
pip install --upgrade virtualenv
}

View file

@ -56,6 +56,7 @@ install_dependances
ynh_system_user_create $synapse_user /var/lib/matrix-synapse
# Create postgresql database
ynh_psql_test_if_first_run
ynh_psql_create_user $synapse_db_user $synapse_db_pwd
ynh_psql_execute_as_root \
"CREATE DATABASE $synapse_db_name ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' template=template0 OWNER $synapse_db_user;"

View file

@ -49,4 +49,21 @@ ynh_psql_drop_db() {
# | arg: user - the user name to drop
ynh_psql_drop_user() {
sudo su -c "dropuser ${1}" - postgres
}
ynh_psql_test_if_first_run() {
if [ -f /etc/yunohost/psql ];
then
echo "PostgreSQL is already installed, no need to create master password"
else
local pgsql=$(ynh_string_random)
echo "$pgsql" >> /etc/yunohost/psql
systemctl start postgresql
sudo -u postgres psql -c "ALTER user postgres WITH PASSWORD '${pgsql}'"
# we can t use peer since YunoHost create users with nologin
sed -i '/local\s*all\s*all\s*peer/i \
local all all password' /etc/postgresql/9.4/main/pg_hba.conf
systemctl enable postgresql
systemctl reload postgresql
fi
}

View file

@ -47,6 +47,7 @@ python $final_path/add_sso_conf.py
set_certificat_access
# Restore postgresql database
ynh_psql_test_if_first_run
ynh_psql_create_user $synapse_db_user $synapse_db_pwd
ynh_psql_execute_as_root \
"CREATE DATABASE $synapse_db_name

View file

@ -34,7 +34,7 @@ ynh_abort_if_errors
if [[ -z $synapse_old_version ]]
then
# To be sure that the migration is sucessfull we check that the old synapse version is compatible with the synapse_port_db script.
if [[ $(dpkg -l | grep -c -E "ii.*matrix-synapse.*0.23") != 1 ]] && [[ $(dpkg -l | grep -c -E "ii.*matrix-synapse.*0.24") != 1 ]]
if [[ $(dpkg -l | grep -c -E "ii.*matrix-synapse.*0.25") != 1 ]] && [[ $(dpkg -l | grep -c -E "ii.*matrix-synapse.*0.24") != 1 ]]
then
systemctl start matrix-synapse.service
ynh_die "Update from this synapse version is not available now. You need to wait for the next update."

View file

@ -43,6 +43,13 @@ BOOLEAN_COLUMNS = {
"device_lists_outbound_pokes": ["sent"],
"users_who_share_rooms": ["share_private"],
"groups": ["is_public"],
"group_rooms": ["is_public"],
"group_users": ["is_public", "is_admin"],
"group_summary_rooms": ["is_public"],
"group_room_categories": ["is_public"],
"group_summary_users": ["is_public"],
"group_roles": ["is_public"],
"local_group_membership": ["is_publicised", "is_admin"],
}
@ -319,7 +326,7 @@ class Porter(object):
backward_chunk = min(row[0] for row in brows) - 1
rows = frows + brows
self._convert_rows(table, headers, rows)
rows = self._convert_rows(table, headers, rows)
def insert(txn):
self.postgres_store.insert_many_txn(
@ -555,17 +562,29 @@ class Porter(object):
i for i, h in enumerate(headers) if h in bool_col_names
]
class BadValueException(Exception):
pass
def conv(j, col):
if j in bool_cols:
return bool(col)
elif isinstance(col, basestring) and "\0" in col:
logger.warn("DROPPING ROW: NUL value in table %s col %s: %r", table, headers[j], col)
raise BadValueException();
return col
outrows = []
for i, row in enumerate(rows):
rows[i] = tuple(
conv(j, col)
for j, col in enumerate(row)
if j > 0
)
try:
outrows.append(tuple(
conv(j, col)
for j, col in enumerate(row)
if j > 0
))
except BadValueException:
pass
return outrows
@defer.inlineCallbacks
def _setup_sent_transactions(self):
@ -593,7 +612,7 @@ class Porter(object):
"select", r,
)
self._convert_rows("sent_transactions", headers, rows)
rows = self._convert_rows("sent_transactions", headers, rows)
inserted_rows = len(rows)
if inserted_rows:
@ -954,4 +973,3 @@ if __name__ == "__main__":
if end_error_exec_info:
exc_type, exc_value, exc_traceback = end_error_exec_info
traceback.print_exception(exc_type, exc_value, exc_traceback)