isobuilder: pass ignore_dangling_symlinks=True when copying apt config

ubuntukylin's /etc/apt/trusted.gpg.d/ubuntukylin-archive-keyring.gpg
contains a symlink to
"/usr/share/keyrings/ubuntukylin-archive-keyring.gpg" as an absolute
path. This obviously doesn't work when not chrooted into the chroot but
we don't need to copy it over to the apt config used to build the pool
as no package from any archive signed by this key is going to be
included in the pool...
This commit is contained in:
michael.hudson@canonical.com 2026-02-16 21:24:34 +13:00
parent 3645bdf230
commit f0c7c28618
No known key found for this signature in database
GPG Key ID: 80E627A0AB757E23

View File

@ -41,7 +41,7 @@ class AptStateManager:
for path in "etc/apt", "var/lib/apt":
tgt = self.apt_root.joinpath(path)
tgt.parent.mkdir(parents=True, exist_ok=True)
shutil.copytree(chroot.joinpath(path), tgt)
shutil.copytree(chroot.joinpath(path), tgt, ignore_dangling_symlinks=True)
self.apt_conf_path.write_text(f'Dir "{self.apt_root}/"; \n')
with self.logger.logged("updating apt indices"):
self.logger.run(["apt-get", "update"], env=self._apt_env())