Skip to content

Commit

Permalink
Use placeholder EVR and Arch values
Browse files Browse the repository at this point in the history
Libsolv does need these, so we have to provide fake ones, not just an
empty string.

re: #5071
https://pulp.plan.io/issues/5071
  • Loading branch information
dralley committed Aug 7, 2019
1 parent 36c14af commit 9ed9e0b
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions plugins/pulp_rpm/plugins/importers/yum/pulp_solv.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,13 +415,14 @@ def module_artifacts_conversion(pool, module_solvable, name, evr, arch):
rpm_solvable.add_deparray(solv.SOLVABLE_REQUIRES, module_solvable.nsvca_rel)
# Provide: modular-package()
rpm_solvable.add_deparray(solv.SOLVABLE_PROVIDES, pool.Dep('modular-package()'))
# Make the module recommend this artifact too
module_solvable.add_deparray(solv.SOLVABLE_RECOMMENDS, rel)
_LOGGER.debug('link {mod} <-rec-> {solv}', mod=module_solvable, solv=rpm_solvable)
# # Make the module require this artifact too
# module_solvable.add_deparray(solv.SOLVABLE_REQUIRES, rel)
# _LOGGER.debug('link {mod} <-rec-> {solv}', mod=module_solvable, solv=rpm_solvable)

solvable_name = module_solvable_name(unit)
solvable.name = solvable_name
solvable.evr = ''
# there's no reasonable way to construct an EVR, but it has to be set, so use '0-1' (V-R)
solvable.evr = '0-1'

arch = unit.get('arch', 'noarch').encode('utf-8')
solvable.arch = arch
Expand Down Expand Up @@ -570,8 +571,10 @@ def module_defaults_unit_to_solvable(solv_repo, unit):
:rtype: solv.Solvable
"""
solvable = solv_repo.add_solvable()
solvable.evr = ''
solvable.arch = ''
# there's no reasonable way to construct an EVR, but it has to be set, so use '0-1' (V-R)
solvable.evr = '0-1'
# a module default has no arch, use 'noarch'
solvable.arch = 'noarch'

name = unit.get('name')
if name is not None:
Expand Down Expand Up @@ -859,7 +862,11 @@ def _handle_nothing_provides(self, info):
if not target_repo:
return
dummy = target_repo.add_solvable()
dummy.name = 'dummy-provides:{}'.format(str(info.dep))
dummy.arch = 'noarch'
dummy.evr = '0-1'
dummy.add_deparray(solv.SOLVABLE_PROVIDES, info.dep)
self._pool.createwhatprovides()
_LOGGER.debug('Created dummy provides: {name}', name=info.dep.str())

def _handle_same_name(self, info, jobs):
Expand Down

0 comments on commit 9ed9e0b

Please sign in to comment.