core: Set installonly to ensure we only have one kernel
The goal here is to support `override replace kernel.x86_64.rpm`. There's a whole lot of logic in libdnf to support having multiple kernel packages installed. AIUI, that was implemented because: 1) The kernel is the biggest source of regressions 2) It'd be quite noticeable if all of your kernel modules were deleted Of course point 2) applies to a lot of userspace too...that's something rpm-ostree fixes of course. Anyways, in some testing all we need to do really is just turn that logic off unconditionally. Closes: https://github.com/projectatomic/rpm-ostree/issues/946 Closes: #1228 Approved by: jlebon
This commit is contained in:
parent
40b010a7ea
commit
12dc565b00
@ -1881,6 +1881,12 @@ rpmostree_context_prepare (RpmOstreeContext *self,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Don't try to keep multiple kernels per root; that's a traditional thing,
|
||||
* ostree binds kernel + userspace.
|
||||
*/
|
||||
dnf_sack_set_installonly (dnf_context_get_sack (self->dnfctx), NULL);
|
||||
dnf_sack_set_installonly_limit (dnf_context_get_sack (self->dnfctx), 0);
|
||||
|
||||
if (self->jigdo_pure)
|
||||
{
|
||||
g_assert_cmpint (g_strv_length (pkgnames), ==, 0);
|
||||
|
52
tests/vmcheck/test-override-kernel.sh
Executable file
52
tests/vmcheck/test-override-kernel.sh
Executable file
@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2017 Red Hat, Inc.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the
|
||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
. ${commondir}/libtest.sh
|
||||
. ${commondir}/libvm.sh
|
||||
|
||||
set -x
|
||||
|
||||
osid=$(vm_cmd grep -E '^ID=' /etc/os-release)
|
||||
if test "${osid}" != 'ID=fedora'; then
|
||||
echo "ok skip on OS ID=${osid}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Test that we can override the kernel. For ease of testing
|
||||
# I just picked the "gold" F27 kernel.
|
||||
vm_cmd 'curl -sS -L -O https://dl.fedoraproject.org/pub/fedora/linux/releases/27/Everything/x86_64/os/Packages/k/kernel-4.13.9-300.fc27.x86_64.rpm \
|
||||
-O https://dl.fedoraproject.org/pub/fedora/linux/releases/27/Everything/x86_64/os/Packages/k/kernel-core-4.13.9-300.fc27.x86_64.rpm \
|
||||
-O https://dl.fedoraproject.org/pub/fedora/linux/releases/27/Everything/x86_64/os/Packages/k/kernel-modules-4.13.9-300.fc27.x86_64.rpm \
|
||||
-O https://dl.fedoraproject.org/pub/fedora/linux/releases/27/Everything/x86_64/os/Packages/k/kernel-modules-extra-4.13.9-300.fc27.x86_64.rpm'
|
||||
current=$(vm_get_booted_csum)
|
||||
vm_cmd rpm-ostree db list "${current}" > current-dblist.txt
|
||||
assert_not_file_has_content current-dblist.txt 'kernel-4.13.9-300.fc27'
|
||||
grep -E '^ kernel-4' current-dblist.txt | sed -e 's,^ *,,' > orig-kernel.txt
|
||||
assert_streq "$(wc -l < orig-kernel.txt)" "1"
|
||||
orig_kernel=$(cat orig-kernel.txt)
|
||||
vm_rpmostree override replace ./kernel*4.13.9*.rpm
|
||||
new=$(vm_get_pending_csum)
|
||||
vm_cmd rpm-ostree db list "${new}" > new-dblist.txt
|
||||
assert_file_has_content_literal new-dblist.txt 'kernel-4.13.9-300.fc27'
|
||||
if grep -q -F -e "${orig_kernel}" new-dblist.txt; then
|
||||
fatal "Found kernel: ${line}"
|
||||
fi
|
||||
echo "ok override kernel"
|
Loading…
Reference in New Issue
Block a user