From 848845c432c755fce35532c2a948d6216f2f4d1c Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Wed, 3 Jun 2020 09:41:20 -0400 Subject: [PATCH] upgrades: Don't enable backports on Debian derivatives - Avoid introducing dependency on dpkg-vendor. Tested: - Install a base-files package from Ubuntu. Change /etc/dpkg/origins/default to point to it. Running the setup-repositories action does not create the backports list in apt sources. Closes: #1654. Signed-off-by: James Valleroy Reviewed-by: Sunil Mohan Adapa --- actions/upgrades | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/actions/upgrades b/actions/upgrades index bfb49141b..83524846a 100755 --- a/actions/upgrades +++ b/actions/upgrades @@ -184,6 +184,21 @@ def _check_and_backports_sources(): print('Repositories list up-to-date. Skipping update.') return + try: + with open('/etc/dpkg/origins/default', 'r') as default_origin: + matches = [ + re.match(r'Vendor:\s+Debian', line, flags=re.IGNORECASE) + for line in default_origin.readlines() + ] + except FileNotFoundError: + print('Could not open /etc/dpkg/origins/default') + return + + if not any(matches): + print('System is running a derivative of Debian. Skip enabling ' + 'backports.') + return + protocol = _get_protocol() if protocol == 'tor+http': print('Package download over Tor is enabled.')