Skip to content

Commit 020a6b4

Browse files
Add add-arch action
1 parent 314b14c commit 020a6b4

3 files changed

Lines changed: 24 additions & 1 deletion

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,3 +308,8 @@ target system.
308308
Mount all squashfses in `new/iso/casper` at `old/{squash_name}` (this
309309
is mostly to make poking at ISOs in a subsequent interactive `--shell`
310310
action easier).
311+
312+
### add-arch
313+
314+
Add support for extra architectures (multi-arch). This is equivalent of running `dpkg --add-architecture <arch>`.
315+
It receives exactly one argument.

livefs_edit/actions.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,15 @@ def cache_for_dir(ctxt, dir):
510510
apt_pkg.config.clear(key)
511511
apt_pkg.config["Dir"] = dir
512512
apt_pkg.init_config()
513+
513514
apt_pkg.config["APT::Architecture"] = ctxt.get_arch()
514-
apt_pkg.config["APT::Architectures"] = ctxt.get_arch()
515+
516+
apt_pkg.config["APT::Architectures::"] = ctxt.get_arch()
517+
518+
# for multi-arch
519+
for arch in ctxt.get_extra_arches():
520+
apt_pkg.config["APT::Architectures::"] = arch
521+
515522
apt_pkg.init_system()
516523
return Cache()
517524

@@ -804,3 +811,7 @@ def mount_all_layers(ctxt, target='mounts'):
804811
squash_names = get_layer_part_names(squash.stem)
805812
lowers = [ctxt.mount_squash(name) for name in squash_names]
806813
ctxt.add_overlay(lowers, ctxt.p(f'{target}/{squash.stem}'))
814+
815+
@register_action()
816+
def add_arch(ctxt, arch):
817+
ctxt.add_arch(arch)

livefs_edit/context.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def __init__(self, source_path, *, debug=False):
6969
self._mounts = []
7070
self._squash_mounts = {}
7171
self._xorriso_extra_args = []
72+
self._extra_arches = []
7273

7374
def run(self, cmd, check=True, **kw):
7475
if self.debug:
@@ -231,6 +232,12 @@ def get_arch(self):
231232
with open(self.p('new/iso/.disk/info')) as fp:
232233
return fp.read().strip().split()[-2]
233234

235+
def add_arch(self, arch):
236+
self._extra_arches.append(arch)
237+
238+
def get_extra_arches(self):
239+
return self._extra_arches
240+
234241
def get_suite(self):
235242
from deb822 import Deb822
236243
paths = glob.glob(self.p('old/iso/dists/*/Release'))

0 commit comments

Comments
 (0)