Skip to content

Commit

Permalink
cmdlib.sh: fix repoquery when building overrides lockfile
Browse files Browse the repository at this point in the history
Fallout from the move to f41 and dnf5.

A few issues: first, looks like Looks like dnf5 repoquery's `--qf` acts
differently. Not only it no longer implicitly emits a newline, but also
it doesn't interpret `\t` anymore. This is tracked at:

rpm-software-management/dnf5#709

Second, `--quiet` is broken and still includes output from progress bar:

rpm-software-management/dnf5#1915

Work around this by using spaces instead of `\t`, adding `\n`, and
prefixing pkg entries with `pkg:`.
  • Loading branch information
jlebon committed Nov 29, 2024
1 parent 49ce2cb commit 1353d16
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/cmdlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -450,15 +450,17 @@ EOF
# the same RPMs: the `dnf repoquery` below is to pick the latest one
dnf repoquery --repofrompath=tmp,"file://${overridesdir}/rpm" \
--disablerepo '*' --enablerepo tmp --refresh --latest-limit 1 \
--exclude '*.src' --qf '%{name}\t%{evr}\t%{arch}' \
--exclude '*.src' --qf 'pkg: %{name} %{evr} %{arch}\n' \
--quiet > "${tmp_overridesdir}/pkgs.txt"

# shellcheck disable=SC2002
cat "${tmp_overridesdir}/pkgs.txt" | python3 -c '
import sys, json
lockfile = {"packages": {}}
for line in sys.stdin:
name, evr, arch = line.strip().split("\t")
if not line.startswith("pkg: "):
continue
_, name, evr, arch = line.strip().split()
lockfile["packages"][name] = {"evra": f"{evr}.{arch}"}
json.dump(lockfile, sys.stdout)' > "${local_overrides_lockfile}"

Expand Down

0 comments on commit 1353d16

Please sign in to comment.