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 <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2019-08-23 13:57:20 -07:00 committed by James Valleroy
parent 88cab90917
commit 68bc333842
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 21 additions and 40 deletions

View File

@ -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(_):

View File

@ -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