Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable kernel multiversion setting (boo#1172229) #234

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions libzypp.spec.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,16 @@ Group: Documentation/HTML
%description devel-doc
Developer documentation for libzypp.

%if 0%{?suse_version} >= 1550
%package kernel-multiversion
Summary: Kernel multi-version config file for libzypp
Requires: libzypp

%description kernel-multiversion
A configuration file that enables the multi-version feature of
libzypp for kernel packages.
%endif

%prep
%setup -q

Expand Down Expand Up @@ -274,9 +284,13 @@ mkdir -p %{buildroot}/%{_var}/lib/zypp
mkdir -p %{buildroot}/%{_var}/log/zypp
mkdir -p %{buildroot}/%{_var}/cache/zypp

# Default to 'solver.dupAllowVendorChange = false' on TW and post SLE12
%if 0%{?suse_version} >= 1330 || "%{distribution}" == "openSUSE Tumbleweed"
sed -i "s|# solver.dupAllowVendorChange = true|solver.dupAllowVendorChange = false|g" %{buildroot}%{_sysconfdir}/zypp/zypp.conf
%if 0%{?suse_version} < 1550
# restore previous config file on old distros so we don't produce
# an .rpmnew
sed -i -e '/^# \(multiversion\(\.kernels\)\?\|solver\.allowVendorChange\) =/s/^# //' %{buildroot}/%{_sysconfdir}/zypp/zypp.conf
%else
# kernel multiversion feature
echo "provides:multiversion(kernel)" > %{buildroot}/%{_sysconfdir}/zypp/multiversion.d/kernel.conf
%endif

cd ..
Expand Down Expand Up @@ -398,4 +412,9 @@ fi
%defattr(-,root,root)
%{_docdir}/%{name}

%if 0%{?suse_version} >= 1550
%files kernel-multiversion
%config(noreplace) %{_sysconfdir}/zypp/multiversion.d/kernel.conf
%endif

%changelog
9 changes: 3 additions & 6 deletions zypp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@
## Default value:
## empty
##
multiversion = provides:multiversion(kernel)
# multiversion = provides:multiversion(kernel)

##
## Defining directory which may contain additional multiversion definitions.
Expand Down Expand Up @@ -543,11 +543,8 @@ multiversion = provides:multiversion(kernel)
## oldest - Keep kernel with the lowest version number (the GA kernel)
## oldest+N - Keep kernel with the Nth lowest version number
##
## Note: This entry is not evaluated by libzypp, but by the
## purge-kernels service (via /sbin/purge-kernels).
##
## Default: Do not delete any kernels if multiversion = provides:multiversion(kernel) is set
multiversion.kernels = latest,latest-1,running
## Default: latest,latest-1,running
# multiversion.kernels = latest,latest-1,running

##
## Path to locks file. If not exist then is create.
Expand Down
14 changes: 7 additions & 7 deletions zypp/PurgeKernels.cc
Original file line number Diff line number Diff line change
Expand Up @@ -255,14 +255,19 @@ namespace zypp {
const unsigned tokenGrp = 1; //index of the group matching the token
const unsigned modifierGrp = 2; //index of the group matching the offset modifier

if (_keepSpec.empty()) {
_keepSpec = "latest,latest-1,running";
}

MIL << "Parsing keep spec: " << _keepSpec << std::endl;

std::vector<std::string> words;
str::split( _keepSpec, std::back_inserter(words), ",", str::TRIM );
if ( words.empty() ) {
WAR << "Invalid keep spec: " << _keepSpec << " using default latest,running." << std::endl;
return;
WAR << "Invalid keep spec: " << _keepSpec << " using default latest,latest-1,running." << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we really just fall back to the default keep spec if the admin speficied a incorrect one? That might result in purging kernels and packages that should not be purged. IMO its better to error out in that case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe but that would be separate change. The previous code just skipped the parsing in error case so used the global defaults of those variables. Ie equivalent to "latest,running". That's even less than the config file default of "latest,latest-1,running". So this change is for consistency.

words.push_back("latest");
words.push_back("latest-1");
words.push_back("running");
}

_keepRunning = false;
Expand Down Expand Up @@ -414,11 +419,6 @@ namespace zypp {
{
MIL << std::endl << "--------------------- Starting to mark obsolete kernels ---------------------"<<std::endl;

if ( _pimpl->_keepSpec.empty() ) {
WAR << "Keep spec is empty, removing nothing." << std::endl;
return;
}

_pimpl->parseKeepSpec();

if ( _pimpl->_keepRunning && !_pimpl->_detectedRunning ) {
Expand Down
2 changes: 1 addition & 1 deletion zypp/ZConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ namespace zypp
, solver_dupAllowDowngrade ( true )
, solver_dupAllowNameChange ( true )
, solver_dupAllowArchChange ( true )
, solver_dupAllowVendorChange ( true )
, solver_dupAllowVendorChange ( false )
, solver_cleandepsOnRemove ( false )
, solver_upgradeTestcasesToKeep ( 2 )
, solverUpgradeRemoveDroppedPackages( true )
Expand Down