Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

elbepack: cdroms: use source name of pkgs with on_src_cd attribute #419

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions elbepack/aptpkgutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def parse_built_using(value):
yield package, version


def get_corresponding_source_packages(cache, pkg_lst=None):
def get_corresponding_source_packages(cache, pkg_lst=None, include_built_using=True):

if pkg_lst is None:
pkg_lst = {p.name for p in cache if p.is_installed}
Expand All @@ -203,8 +203,9 @@ def get_corresponding_source_packages(cache, pkg_lst=None):

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

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

return list(src_set)

Expand Down
14 changes: 10 additions & 4 deletions elbepack/cdroms.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

def add_source_pkg(repo, component, cache, pkg, version, forbid):
if pkg in forbid:
logging.info("Ignoring source package %s", pkg)
return
pkg_id = f'{pkg}-{version}'
try:
Expand All @@ -42,12 +43,12 @@ def mk_source_cdrom(components, codename,

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

forbiddenPackages = []
forbidden_packages = []
if xml is not None and xml.has('target/pkg-list'):
for i in xml.node('target/pkg-list'):
try:
if i.tag == 'pkg' and i.et.attrib['on_src_cd'] == 'False':
forbiddenPackages.append(i.text('.').strip())
forbidden_packages.append(i.text('.').strip())
except KeyError:
pass

Expand All @@ -56,6 +57,11 @@ def mk_source_cdrom(components, codename,
for component in components.keys():
rfs, cache, pkg_lst = components[component]
logging.info('Adding %s component', component)

forbidden_src_packages = set()
for name, _ in cache.get_corresponding_source_packages(forbidden_packages, include_built_using=False):
forbidden_src_packages.add(name)

rfs.mkdir_p('/var/cache/elbe/sources')
repo = CdromSrcRepo(codename, init_codename,
os.path.join(target, f'srcrepo-{component}'),
Expand All @@ -64,14 +70,14 @@ def mk_source_cdrom(components, codename,
for pkg, version in pkg_lst:
add_source_pkg(repo, component,
cache, pkg, version,
forbiddenPackages)
forbidden_src_packages)

if component == 'main' and xml is not None:
for p in xml.node('debootstrappkgs'):
pkg = XMLPackage(p)
srcpkgs = cache.get_corresponding_source_packages([pkg])
for srcpkg, srcpkg_ver in srcpkgs:
add_source_pkg(repo, component, cache, srcpkg, srcpkg_ver, forbiddenPackages)
add_source_pkg(repo, component, cache, srcpkg, srcpkg_ver, forbidden_src_packages)

# elbe fetch_initvm_pkgs has downloaded all sources to
# /var/cache/elbe/sources
Expand Down
4 changes: 2 additions & 2 deletions elbepack/rpcaptcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ def is_installed(self, pkgname):
def get_pkg(self, pkgname):
return APTPackage(self.cache[pkgname])

def get_corresponding_source_packages(self, pkg_lst=None):
return get_corresponding_source_packages(self.cache, pkg_lst)
def get_corresponding_source_packages(self, pkg_lst=None, *, include_built_using=True):
return get_corresponding_source_packages(self.cache, pkg_lst, include_built_using)

def download_binary(self, pkgname, path, version=None):
p = self.cache[pkgname]
Expand Down
1 change: 1 addition & 0 deletions newsfragments/+source-exclude.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Resolve corresponding source package names for exclude source CD.