[elbe-devel] [PATCH 1/1] cdroms: Generate src-cdrom for each component
Christian Teklenborg
chris at linutronix.de
Fri Feb 26 16:17:48 CET 2021
Split the src-cdrom as already implemented for the licence-* files with
c05ff16f5b (elbeproject: Generate license files for most of the RFS).
The initvm source packages are provided on the "main" component cdrom.
For split src-cdroms, volume-specific archives are added for each of the
components.
Signed-off-by: Christian Teklenborg <chris at linutronix.de>
---
elbepack/cdroms.py | 50 +++++++++++++++++++++++------------------
elbepack/elbeproject.py | 11 ++++-----
2 files changed, 34 insertions(+), 27 deletions(-)
diff --git a/elbepack/cdroms.py b/elbepack/cdroms.py
index e0f8749b..b3fde13f 100644
--- a/elbepack/cdroms.py
+++ b/elbepack/cdroms.py
@@ -51,11 +51,6 @@ def mk_source_cdrom(components, codename,
hostfs.mkdir_p('/var/cache/elbe/sources')
- repo = CdromSrcRepo(codename, init_codename,
- os.path.join(target, "srcrepo"),
- cdrom_size,
- mirror)
-
forbiddenPackages = []
if xml is not None and xml.has('target/pkg-list'):
for i in xml.node('target/pkg-list'):
@@ -65,9 +60,16 @@ def mk_source_cdrom(components, codename,
except KeyError:
pass
- for component, (rfs, cache, pkg_lst) in components.items():
+ repos = {}
+
+ for component in components.keys():
+ rfs, cache, pkg_lst = components[component]
logging.info("Adding %s component", component)
- rfs.mkdir_p('/var/cache/elbe/sources')
+ rfs.mkdir_p("/var/cache/elbe/sources")
+ repo = CdromSrcRepo(codename, init_codename,
+ os.path.join(target, "srcrepo-%s" % component),
+ cdrom_size, mirror)
+ repos[component] = repo
for pkg, version in pkg_lst:
add_source_pkg(repo, component,
cache, pkg, version,
@@ -87,9 +89,10 @@ def mk_source_cdrom(components, codename,
if not dsc_real.endswith('.dsc'):
continue
- repo.include_init_dsc(dsc_real, 'initvm')
+ repos["main"].include_init_dsc(dsc_real, "initvm")
- repo.finalize()
+ for repo in repos.values():
+ repo.finalize()
if xml is not None:
options = get_iso_options(xml)
@@ -97,22 +100,25 @@ def mk_source_cdrom(components, codename,
for arch_vol in xml.all('src-cdrom/archive'):
volume_attr = arch_vol.et.get('volume')
- if volume_attr == 'all':
- volume_list = repo.volume_indexes
- else:
- volume_list = [int(v) for v in volume_attr.split(",")]
- for volume_number in volume_list:
- with archive_tmpfile(arch_vol.text(".")) as fp:
- if volume_number in repo.volume_indexes:
- do('tar xvfj "%s" -h -C "%s"' % (fp.name,
- repo.get_volume_fs(volume_number).path))
- else:
- logging.warning("The src-cdrom archive's volume value "
- "is not contained in the actual volumes")
+ for repo in repos.values():
+
+ if volume_attr == 'all':
+ volume_list = repo.volume_indexes
+ else:
+ volume_list = [int(v) for v in volume_attr.split(",")]
+ for volume_number in volume_list:
+ with archive_tmpfile(arch_vol.text(".")) as fp:
+ if volume_number in repo.volume_indexes:
+ do('tar xvfj "%s" -h -C "%s"' % (fp.name,
+ repo.get_volume_fs(volume_number).path))
+ else:
+ logging.warning("The src-cdrom archive's volume value "
+ "is not contained in the actual volumes")
else:
options = ""
- return repo.buildiso(os.path.join(target, "src-cdrom.iso"), options=options)
+ return [(repo.buildiso(os.path.join(target, "src-cdrom-%s.iso" % component),
+ options=options)) for component, repo in repos.items()]
def mk_binary_cdrom(rfs, arch, codename, init_codename, xml, target):
# pylint: disable=too-many-arguments
diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index 6fce66e2..78a46454 100644
--- a/elbepack/elbeproject.py
+++ b/elbepack/elbeproject.py
@@ -539,11 +539,12 @@ class ElbeProject:
if self.xml is not None:
kwargs["mirror"] = self.xml.get_primary_mirror(env.rfs.fname("cdrom"))
- self.repo_images += mk_source_cdrom(components,
- self.codename,
- init_codename,
- self.builddir,
- **kwargs)
+ for iso in mk_source_cdrom(components,
+ self.codename,
+ init_codename,
+ self.builddir,
+ **kwargs):
+ self.repo_images += iso
except SystemError as e:
# e.g. no deb-src urls specified
validation.error(str(e))
--
2.20.1
More information about the elbe-devel
mailing list