Skip to content

Commit

Permalink
Update sanity check command for dnf5
Browse files Browse the repository at this point in the history
Signed-off-by: Mattia Verga <[email protected]>
  • Loading branch information
mattiaverga committed Dec 7, 2024
1 parent 55e44d5 commit e7f0894
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions bodhi-server/bodhi/server/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,26 @@ def sanity_check_repodata_dnf(tempdir, myurl, *dnf_args):
Raises:
Exception: If the repodata is not valid or does not exist.
"""
cmd = ['dnf',
'--disablerepo=*',
f'--repofrompath=testrepo,{myurl}',
'--enablerepo=testrepo',
'--setopt=skip_if_unavailable=0',
'--setopt=testrepo.skip_if_unavailable=0',
'--refresh',
'--nogpgcheck'] + list(dnf_args)
# check dnf version
version_cmd = subprocess.check_output(['dnf', '--version'], encoding='utf-8',
stderr=subprocess.STDOUT)
if version_cmd.startswith('dnf5'):
cmd = ['dnf',
f'--repofrompath=testrepo,{myurl}',
'--repo=testrepo',
'--setopt=skip_if_unavailable=0',
'--setopt=testrepo.skip_if_unavailable=0',
'--refresh',
'--no-gpgchecks'] + list(dnf_args)
else:
cmd = ['dnf',
'--disablerepo=*',
f'--repofrompath=testrepo,{myurl}',
'--enablerepo=testrepo',
'--setopt=skip_if_unavailable=0',
'--setopt=testrepo.skip_if_unavailable=0',
'--refresh',
'--nogpgcheck'] + list(dnf_args)

return subprocess.check_output(cmd, encoding='utf-8', stderr=subprocess.STDOUT)

Expand Down

0 comments on commit e7f0894

Please sign in to comment.