From 68bc3338424cb3c4465ccce68dce68d8e5149dab Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Fri, 23 Aug 2019 13:57:20 -0700 Subject: [PATCH] updates: Allow matrix-synapse 1.3 to be installed for buster users - matrix-synapse 1.2 is already unavailable in buster-backports, testing and unstable. It is replaced by matrix-synapse 1.3. Allow matrix-synapse 1.3 to become available for Buster users. - Allow upgrades to all future versions of matrix-synapse from buster-backports. Since buster-backports does not have security updates except that provided by the maintainer, it is best to let users be on the latest version provided by the maintainer in buster-backports. - We don't pick and choose among the versions uploaded to backports. Once we allow a package to upgrade to backports version, we should continue to do that without any further restriction. Update descriptions accordingly. - Simplify updating the apt preferences file by providing a simple configuration instead of creating the file on the fly. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- actions/upgrades | 45 +++---------------- .../etc/apt/preferences.d/50freedombox3.pref | 16 +++++++ 2 files changed, 21 insertions(+), 40 deletions(-) create mode 100644 plinth/modules/upgrades/data/etc/apt/preferences.d/50freedombox3.pref diff --git a/actions/upgrades b/actions/upgrades index 61bdba698..db808a51f 100755 --- a/actions/upgrades +++ b/actions/upgrades @@ -21,6 +21,7 @@ Configures or runs unattended-upgrades import argparse import os +import pathlib import re import subprocess import sys @@ -170,46 +171,10 @@ def _check_and_backports_sources(): def _add_apt_preferences(): """Setup APT preferences to upgrade selected packages from backports.""" - preferences_path = '/etc/apt/preferences.d' - old_preferences_files = map( - lambda pref_file: os.path.join(preferences_path, pref_file), - ['50freedombox.pref', '50freedombox2.pref']) - - for pref_file in old_preferences_files: - os.path.exists(pref_file) and os.remove(pref_file) - - preferences_file = '/etc/apt/preferences.d/50freedombox3.pref' - if os.path.exists(preferences_file): - print('Preferences up-to-date. Skipping update') - return - - warning = 'Explanation: This file is managed by FreedomBox, do not edit.' - - freedombox_preference = ''' -Explanation: Allow carefully selected updates to 'freedombox' from backports. -Package: freedombox -Pin: release a=buster-backports -Pin-Priority: 500 -''' - - matrix_synapse_preferences = ''' -Explanation: Allow carefully selected updates to 'matrix-synapse' from backports. -Package: matrix-synapse -Pin: version 1.2* -Pin-Priority: 500 - -Explanation: Allow carefully selected updates to 'python3-service-identity' from backports. -Package: python3-service-identity -Pin: version 18.1* -Pin-Priority: 500 -''' - - preferences = "".join( - [warning, freedombox_preference, matrix_synapse_preferences]) - - print('Updating APT preferences.') - with open(preferences_file, 'w') as file_handle: - file_handle.write(preferences) + for file_name in ['50freedombox.pref', '50freedombox2.pref']: + full_path = pathlib.Path('/etc/apt/preferences.d') / file_name + if full_path.exists(): + full_path.unlink() def subcommand_setup_repositories(_): diff --git a/plinth/modules/upgrades/data/etc/apt/preferences.d/50freedombox3.pref b/plinth/modules/upgrades/data/etc/apt/preferences.d/50freedombox3.pref new file mode 100644 index 000000000..b4a19265b --- /dev/null +++ b/plinth/modules/upgrades/data/etc/apt/preferences.d/50freedombox3.pref @@ -0,0 +1,16 @@ +Explanation: This file is managed by FreedomBox, do not edit. +Explanation: Allow carefully selected updates to 'freedombox' from backports. +Package: freedombox +Pin: release a=buster-backports +Pin-Priority: 500 + +Explanation: matrix-synapse 0.99.5 introduces room version 4. Older version +Explanation: 0.99.2 in buster won't be able join newly created rooms. +Package: matrix-synapse +Pin: release a=buster-backports +Pin-Priority: 500 + +Explanation: matrix-synapse >= 1.2 requires python3-service-identity >= 18.1 +Package: python3-service-identity +Pin: release a=buster-backports +Pin-Priority: 500