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 authored and James Valleroy committed 2019-08-25 17:41:58 -04:00
1 parent 88cab90917
commit 68bc333842
2 files changed
+21 -40

No files matched your search

+5 -40
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(_):