From d924be0c9ee29c06903042bd3b714ffafaf35b5e Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Wed, 26 Sep 2018 19:40:37 -0700 Subject: [PATCH] Backport PR #480 for DNF 3.6 compatibility (RHBZ #1595917) --- ...end-to-DNF-config-value-that-can-t-t.patch | 68 +++++++++++++++++++ lorax.spec | 10 ++- 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 0001-Don-t-try-to-append-to-DNF-config-value-that-can-t-t.patch diff --git a/0001-Don-t-try-to-append-to-DNF-config-value-that-can-t-t.patch b/0001-Don-t-try-to-append-to-DNF-config-value-that-can-t-t.patch new file mode 100644 index 0000000..67bf97d --- /dev/null +++ b/0001-Don-t-try-to-append-to-DNF-config-value-that-can-t-t.patch @@ -0,0 +1,68 @@ +From a7c2d7d66b1a4df5b06a0c5b401558531199f791 Mon Sep 17 00:00:00 2001 +From: Adam Williamson +Date: Wed, 26 Sep 2018 18:14:06 -0700 +Subject: [PATCH] Don't try to append to DNF config value that can't take it + +See https://bugzilla.redhat.com/show_bug.cgi?id=1595917 and +https://github.com/rpm-software-management/dnf/pull/1200 for +more on this. Briefly, DNF before 3.0 presented this config +value as a list...and mutating it worked. DNF from 3.0 until +3.6 presented it as a list...mutating it didn't work, but also +didn't *fail*, so this has actually not been doing anything on +DNF 3.x but we haven't noticed. + +In DNF 3.6 values like this are presented as tuples instead of +lists, to try and catch usages like this, and it worked! We +need to change this one. + +There is an additional weirdness here. tsflags is actually, in +libdnf terms, an OptionStringListAppend option: that means that +when something tries to *set* its value, the new value is just +appended to the existing list of values. This is very weird +behaviour when you're interacting with it like this, but +happens to be quite useful, as we can just 'set' the value to +a list like this and it will actually get appended (which is +what we want), and this one syntax happens to work correctly in +DNF 2.x, 3.0 through 3.5.1, and 3.6. + +Signed-off-by: Adam Williamson +--- + src/pylorax/api/dnfbase.py | 5 ++++- + src/sbin/lorax | 5 ++++- + 2 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/src/pylorax/api/dnfbase.py b/src/pylorax/api/dnfbase.py +index b7a4d1c6..1d7f32cc 100644 +--- a/src/pylorax/api/dnfbase.py ++++ b/src/pylorax/api/dnfbase.py +@@ -56,7 +56,10 @@ def get_base_object(conf): + dbc.reposdir = [repodir] + dbc.install_weak_deps = False + dbc.prepend_installroot('persistdir') +- dbc.tsflags.append('nodocs') ++ # this is a weird 'AppendOption' thing that, when you set it, ++ # actually appends. Doing this adds 'nodocs' to the existing list ++ # of values, over in libdnf, it does not replace the existing values. ++ dbc.tsflags = ['nodocs'] + + if conf.get_default("dnf", "proxy", None): + dbc.proxy = conf.get("dnf", "proxy") +diff --git a/src/sbin/lorax b/src/sbin/lorax +index 30b9cadc..2729757d 100755 +--- a/src/sbin/lorax ++++ b/src/sbin/lorax +@@ -212,7 +212,10 @@ def get_dnf_base_object(installroot, sources, mirrorlists=None, repos=None, + conf.releasever = releasever + conf.installroot = installroot + conf.prepend_installroot('persistdir') +- conf.tsflags.append('nodocs') ++ # this is a weird 'AppendOption' thing that, when you set it, ++ # actually appends. Doing this adds 'nodocs' to the existing list ++ # of values, over in libdnf, it does not replace the existing values. ++ conf.tsflags = ['nodocs'] + + if proxy: + conf.proxy = proxy +-- +2.19.0 + diff --git a/lorax.spec b/lorax.spec index f4ef13f..a2f11ba 100644 --- a/lorax.spec +++ b/lorax.spec @@ -4,7 +4,7 @@ Name: lorax Version: 29.15 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Tool for creating the anaconda install images Group: Applications/System @@ -15,6 +15,10 @@ URL: https://github.com/weldr/lorax # git checkout -b archive-branch lorax-%%{version}-%%{release} # tito build --tgz Source0: %{name}-%{version}.tar.gz +# More DNF config interface shenanigans... +# https://github.com/weldr/lorax/pull/480 +# https://bugzilla.redhat.com/show_bug.cgi?id=1595917 +Patch0: 0001-Don-t-try-to-append-to-DNF-config-value-that-can-t-t.patch BuildRequires: python3-devel @@ -156,6 +160,7 @@ build images, etc. from the command line. %prep %setup -q -n %{name}-%{version} +%patch0 -p1 %build @@ -230,6 +235,9 @@ getent passwd weldr >/dev/null 2>&1 || useradd -r -g weldr -d / -s /sbin/nologin %{_sysconfdir}/bash_completion.d/composer-cli %changelog +* Wed Sep 26 2018 Adam Williamson - 29.15-2 +- Backport PR #480 for DNF 3.6 compatibility (RHBZ #1595917) + * Fri Sep 07 2018 Brian C. Lane 29.15-1 - Add a Makefile target for building html docs using a rawhide environment (bcl@redhat.com) - Revert "Don't activate default auto connections after switchroot" (rvykydal@redhat.com)