Skip to content

Commit

Permalink
use dnf4 explicitly if available
Browse files Browse the repository at this point in the history
dnf5 doesn't have reposync [1] and repodiff [2] plugins, which we need.
As dnf5 is the default dnf implementation on Fedora 41, let's try to
check whether a dnf4 binary exists and use that instead.

[1] rpm-software-management/dnf5#931
[2] rpm-software-management/dnf5#944
  • Loading branch information
evgeni committed Oct 15, 2024
1 parent b864750 commit 3dfb950
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions build_stage_repository
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ import dnf.comps
import argparse


if os.path.exists('/usr/bin/dnf4'):
DNF = 'dnf4'
else:
DNF = 'dnf'


def filter_packages(target_dir, packages):
files = glob.glob(f"{target_dir}/*.rpm")

Expand Down Expand Up @@ -144,7 +150,7 @@ def sync_prod_repository(collection, version, target_dir, dist, arch):
print(f"Syncing {collection} {version} RPM repository from {repository_url}")

cmd = [
'dnf',
DNF,
'--config',
f'tmp/dnf.conf',
'reposync',
Expand Down Expand Up @@ -208,7 +214,7 @@ def prod_repository(collection, version, dist, arch):

def copr_repository_urls(repository):
cmd = [
'dnf',
DNF,
'reposync',
'--urls',
'--refresh',
Expand All @@ -224,7 +230,7 @@ def copr_repository_urls(repository):

def compare_repositories(new_repository, old_repository, arch, source=False):
cmd = [
'dnf',
DNF,
'--config',
f'tmp/dnf.conf',
'repodiff',
Expand Down

0 comments on commit 3dfb950

Please sign in to comment.