Commit 8fbfb0ba authored by David Boddie's avatar David Boddie 💬
Browse files

Remove hard-coded suite names

parent 87f98f26
Pipeline #44508 canceled with stages
......@@ -99,9 +99,7 @@ class Application(Gtk.Application):
def get_installed_packages(self):
self.worker = Worker(['amber-security', 'amber-updates',
'amber-phone', 'amber'], '/',
self.output_dir)
self.worker = Worker('/', self.output_dir)
self.lines.append(_('Reading package sources'))
self.update_label()
......
......@@ -8,6 +8,7 @@
# SPDX-License-Identifier: GPL-3.0+
# Author: David Boddie <david.boddie@puri.sm>
import glob
import os
import subprocess
......@@ -16,9 +17,8 @@ from debian import deb822
class Worker:
def __init__(self, suite_names, root_dir, output_dir):
def __init__(self, root_dir, output_dir):
self.suite_names = suite_names
self.root_dir = root_dir
self.output_dir = output_dir
......@@ -27,15 +27,18 @@ class Worker:
def read_sources(self):
lists_dir = os.path.join(self.root_dir, 'var', 'lib', 'apt', 'lists')
sources_files = glob.glob(os.path.join(lists_dir, '*_Sources'))
self.sources = {}
files = []
total = 0
for suite_name in self.suite_names:
list_name = 'repo.pureos.net_pureos_dists_%s_main_source_Sources' % suite_name
sources_file = os.path.join(self.root_dir, 'var', 'lib', 'apt',
'lists', list_name)
for sources_file in sources_files:
file_name = os.path.split(sources_file)[1]
rest = file_name.split('_dists_')[1]
suite_name = rest[:rest.find('_')]
files.append((suite_name, sources_file))
total += open(sources_file).read().count('\n\n')
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment