Skip to content

Commit 4d5ff31

Browse files
committed
rewrite get_suite in an excessively fancy way
1 parent 971c140 commit 4d5ff31

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

livefs_edit/actions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,9 @@ def add_autoinstall_config(ctxt, autoinstall_config):
334334

335335
@register_action()
336336
def resign_pool(ctxt, dist=None):
337+
if dist is None:
338+
dist = ctxt.get_suite()
339+
337340
gpgconf = ctxt.tmpfile()
338341
gpghome = ctxt.tmpdir()
339342
with open(gpgconf, 'x') as c:
@@ -361,6 +364,7 @@ def resign_pool(ctxt, dist=None):
361364
with open(key_path, 'w') as new_key:
362365
run(['gpg', '--home', gpghome, '--export'], stdout=new_key)
363366

367+
364368
@register_action()
365369
def add_debs_to_pool(ctxt, debs: List[str] = ()):
366370
from debian import deb822

livefs_edit/context.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,11 @@ def get_arch(self):
184184
return fp.read().strip().split()[-2]
185185

186186
def get_suite(self):
187-
path=glob.glob(self.p('old/iso/dists/*/Release'))
188-
suite=path[0].split(os.sep)[6]
189-
return suite
187+
from deb822 import Deb822
188+
paths = glob.glob(self.p('old/iso/dists/*/Release'))
189+
with open(paths[0]) as fp:
190+
release = Deb822(fp)
191+
return release['Suite']
190192

191193
def edit_squashfs(self, name, *, add_sys_mounts=True):
192194
lower = self.mount_squash(name)

0 commit comments

Comments
 (0)