From 895e0ac13d657adc213ae65f1dbe7fb896038b3b Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Tue, 28 Jun 2016 07:53:01 +0000 Subject: Ignore unsupported packages. git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@42843 e39458fd-73e7-0310-bf30-c45bca0a0e42 --- bin/unsupported_packages.py | 55 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 bin/unsupported_packages.py (limited to 'bin/unsupported_packages.py') diff --git a/bin/unsupported_packages.py b/bin/unsupported_packages.py new file mode 100644 index 0000000000..ffc0628847 --- /dev/null +++ b/bin/unsupported_packages.py @@ -0,0 +1,55 @@ +# Copyright 2016 Chris Lamb +# +# This file is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This file is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this file. If not, see . + +import os +import re +import requests + +re_line = re.compile(r'(?!#)(?P[^\s]+)') + +class UnsupportedPackages(set): + URL = "https://anonscm.debian.org/cgit/collab-maint/debian-security-support.git/plain/security-support-ended.deb{}" + CACHED_DATA_PATH = "~/.cache/security-support-ended.deb{}" + + def __init__(self, debian_version=7, update_cache=True): + self.debian_version = debian_version + + self.cache = os.path.expanduser(self.CACHED_DATA_PATH).format( + self.debian_version, + ) + + if update_cache: + self.update_cache() + + self.load() + + def update_cache(self): + url = self.URL.format(self.debian_version) + + print("Updating {} from {} ...".format(self.cache, url)) + + response = requests.get(url, allow_redirects=True) + response.raise_for_status() + + with open(self.cache, 'w') as f: + f.write(response.text) + + def load(self): + with open(self.cache, 'r') as f: + for x in f.readlines(): + m = re_line.match(x) + + if m is not None: + self.add(m.group('pkg')) -- cgit v1.2.3