Skip to content

Commit 48c2883

Browse files
martin-29t-8ch
authored andcommitted
elbepack: use source name of pkgs with on_src_cd attribute
Resolve the corresponding source name of the binary packages where the XML attribute on_src_cd="False" is set. Until now the binary name was used, which doesn't work when the source name differs to the binary name of the package. The forbidden_packages list, containing the binary package names will be resolved and the corresponding source package names are stored in the forbidden_src_packages list which is then used for the comparison inside the add_source_pkg function. Signed-off-by: Martin Hoehn <[email protected]> Signed-off-by: Thomas Weißschuh <[email protected]>
1 parent c52265e commit 48c2883

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

elbepack/aptpkgutils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def parse_built_using(value):
186186
yield package, version
187187

188188

189-
def get_corresponding_source_packages(cache, pkg_lst=None):
189+
def get_corresponding_source_packages(cache, pkg_lst=None, include_built_using=True):
190190

191191
if pkg_lst is None:
192192
pkg_lst = {p.name for p in cache if p.is_installed}
@@ -201,8 +201,9 @@ def get_corresponding_source_packages(cache, pkg_lst=None):
201201

202202
src_set.add((version.source_name, version.source_version))
203203

204-
for name, ver in parse_built_using(version.record.get('Built-Using')):
205-
src_set.add((name, ver))
204+
if include_built_using:
205+
for name, ver in parse_built_using(version.record.get('Built-Using')):
206+
src_set.add((name, ver))
206207

207208
return list(src_set)
208209

elbepack/cdroms.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
def add_source_pkg(repo, component, cache, pkg, version, forbid):
2424
if pkg in forbid:
25+
logging.info('Ignoring source package %s', pkg)
2526
return
2627
pkg_id = f'{pkg}-{version}'
2728
try:
@@ -42,12 +43,12 @@ def mk_source_cdrom(components, codename,
4243

4344
os.makedirs('/var/cache/elbe/sources', exist_ok=True)
4445

45-
forbiddenPackages = []
46+
forbidden_packages = []
4647
if xml is not None and xml.has('target/pkg-list'):
4748
for i in xml.node('target/pkg-list'):
4849
try:
4950
if i.tag == 'pkg' and i.et.attrib['on_src_cd'] == 'False':
50-
forbiddenPackages.append(i.text('.').strip())
51+
forbidden_packages.append(i.text('.').strip())
5152
except KeyError:
5253
pass
5354

@@ -56,6 +57,12 @@ def mk_source_cdrom(components, codename,
5657
for component in components.keys():
5758
rfs, cache, pkg_lst = components[component]
5859
logging.info('Adding %s component', component)
60+
61+
forbidden_src_packages = set()
62+
for name, _ in cache.get_corresponding_source_packages(forbidden_packages,
63+
include_built_using=False):
64+
forbidden_src_packages.add(name)
65+
5966
rfs.mkdir_p('/var/cache/elbe/sources')
6067
repo = CdromSrcRepo(codename, init_codename,
6168
os.path.join(target, f'srcrepo-{component}'),
@@ -64,14 +71,15 @@ def mk_source_cdrom(components, codename,
6471
for pkg, version in pkg_lst:
6572
add_source_pkg(repo, component,
6673
cache, pkg, version,
67-
forbiddenPackages)
74+
forbidden_src_packages)
6875

6976
if component == 'main' and xml is not None:
7077
for p in xml.node('debootstrappkgs'):
7178
pkg = XMLPackage(p)
7279
srcpkgs = cache.get_corresponding_source_packages([pkg])
7380
for srcpkg, srcpkg_ver in srcpkgs:
74-
add_source_pkg(repo, component, cache, srcpkg, srcpkg_ver, forbiddenPackages)
81+
add_source_pkg(repo, component, cache, srcpkg, srcpkg_ver,
82+
forbidden_src_packages)
7583

7684
# elbe fetch_initvm_pkgs has downloaded all sources to
7785
# /var/cache/elbe/sources

elbepack/rpcaptcache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,8 @@ def is_installed(self, pkgname):
264264
def get_pkg(self, pkgname):
265265
return APTPackage(self.cache[pkgname])
266266

267-
def get_corresponding_source_packages(self, pkg_lst=None):
268-
return get_corresponding_source_packages(self.cache, pkg_lst)
267+
def get_corresponding_source_packages(self, pkg_lst=None, *, include_built_using=True):
268+
return get_corresponding_source_packages(self.cache, pkg_lst, include_built_using)
269269

270270
def download_binary(self, pkgname, path, version=None):
271271
p = self.cache[pkgname]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Resolve corresponding source package names for exclude source CD.

0 commit comments

Comments
 (0)