Skip to content

Commit

Permalink
Synthesize lockfile for local RPM overrides
Browse files Browse the repository at this point in the history
This way (1) we don't require users to play around with lockfiles, and
(2) we ensure rpm-ostree will pick the override RPMs, even if their
NEVRAs are lower than in the other repos.

Closes: #740
  • Loading branch information
jlebon authored and cgwalters committed Sep 20, 2019
1 parent 3e134ca commit 1fe8e03
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/cmdlib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,23 @@ EOF
fi
if [[ -n $(ls "${overridesdir}/rpm/"*.rpm 2> /dev/null) ]]; then
(cd "${overridesdir}"/rpm && rm -rf .repodata && createrepo_c .)
# synthesize an override lockfile to force rpm-ostree to pick up our
# override RPMS -- we try to be nice here and allow multiple versions of
# the same RPMs: the `dnf repoquery` below is to pick the latest one
local_overrides_lockfile="${tmp_overridesdir}/local-overrides.json"
dnf repoquery --repofrompath=tmp,"file://${overridesdir}/rpm" \
--disablerepo '*' --enablerepo tmp --refresh --latest-limit 1 \
--qf '%{NAME}\t%{EVR}\t%{ARCH}' --quiet | python3 -c '
import sys, json
lockfile = {"packages": {}}
for line in sys.stdin:
name, evr, arch = line.strip().split("\t")
lockfile["packages"][name] = {"evra": f"{evr}.{arch}"}
json.dump(lockfile, sys.stdout)' > "${local_overrides_lockfile}"

# we need our overrides to be at the end of the list
set - "$@" --ex-lockfile="${local_overrides_lockfile}"

echo "Using RPM overrides from: ${overridesdir}/rpm"
touch "${overrides_active_stamp}"
cat >> "${override_manifest}" <<EOF
Expand Down

0 comments on commit 1fe8e03

Please sign in to comment.