[PATCH v3 09/16] apt-fetcher: prepare for chroot specific fetching

'Felix Moessbauer' via isar-users
2026-04-07T14:23:37Z

The implementation of the fetching depends on the chroot mode (e.g.
schroot or unshare). As a preparation for the unshare mode, we hide the
concrete fetcher implementation behind a factory, so that we will be
able to dispatch based on the mode.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
meta/classes-recipe/dpkg-base.bbclass | 2 +-
meta/lib/aptsrc_fetcher.py | 12 +++++++++---
2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/meta/classes-recipe/dpkg-base.bbclass b/meta/classes-recipe/dpkg-base.bbclass
index e5987554..e8721c79 100644
--- a/meta/classes-recipe/dpkg-base.bbclass
+++ b/meta/classes-recipe/dpkg-base.bbclass
@@ -84,7 +84,7 @@ python() {

# apt-src fetcher
import aptsrc_fetcher
- methods.append(aptsrc_fetcher.AptSrc())
+ methods.append(aptsrc_fetcher.AptSrc.create(d))

src_uri = (d.getVar('SRC_URI', False) or "").split()
for u in src_uri:
diff --git a/meta/lib/aptsrc_fetcher.py b/meta/lib/aptsrc_fetcher.py
index da2d94c2..1d133aae 100644
--- a/meta/lib/aptsrc_fetcher.py
+++ b/meta/lib/aptsrc_fetcher.py
@@ -9,6 +9,10 @@ from bb.fetch2 import logger
from bb.fetch2 import runfetchcmd

class AptSrc(FetchMethod):
+ @classmethod
+ def create(cls, d):
+ return AptSrcSchroot()
+
def supports(self, ud, d):
return ud.type in ['apt']

@@ -20,6 +24,11 @@ class AptSrc(FetchMethod):
codename = d.getVar('BASE_DISTRO_CODENAME')
ud.localfile='deb-src/' + base_distro + '-' + codename + '/' + ud.host

+ def clean(self, ud, d):
+ bb.utils.remove(ud.localpath, recurse=True)
+
+
+class AptSrcSchroot(AptSrc):
def download(self, ud, d):
bb.utils.exec_flat_python_func('isar_export_proxies', d)
bb.build.exec_func('schroot_create_configs', d)
@@ -83,6 +92,3 @@ class AptSrc(FetchMethod):
finally:
runfetchcmd(f'schroot -q -f -e -c {session_id}', d)
bb.build.exec_func('schroot_delete_configs', d)
-
- def clean(self, ud, d):
- bb.utils.remove(ud.localpath, recurse=True)
--
2.53.0

--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20260407142310.2327696-10-felix.moessbauer%40siemens.com.