import boom-boot-1.2-2.el8

This commit is contained in:
CentOS Sources 2020-07-14 01:09:03 +00:00 committed by Andrew Lukoshko
parent 0da6707d35
commit 30227064b0
7 changed files with 301 additions and 1 deletions

View File

@ -0,0 +1,46 @@
boom.spec | 2 +-
boom/__init__.py | 2 +-
doc/conf.py | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/boom.spec b/boom.spec
index 160aa53..9331112 100644
--- a/boom.spec
+++ b/boom.spec
@@ -2,7 +2,7 @@
%global sphinx_docs 1
Name: boom
-Version: 1.1
+Version: 1.2
Release: 1%{?dist}
Summary: %{summary}
diff --git a/boom/__init__.py b/boom/__init__.py
index fa17610..34f2d14 100644
--- a/boom/__init__.py
+++ b/boom/__init__.py
@@ -35,6 +35,6 @@ from __future__ import print_function
from ._boom import *
from ._boom import __all__
-__version__ = "1.1"
+__version__ = "1.2"
# vim: set et ts=4 sw=4 :
diff --git a/doc/conf.py b/doc/conf.py
index cccdcfa..043655b 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -64,9 +64,9 @@ author = u'Bryn M. Reeves'
# built documents.
#
# The short X.Y version.
-version = u'1.1'
+version = u'1.2'
# The full version, including alpha/beta/rc tags.
-release = u'1.1'
+release = u'1.2'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.

View File

@ -0,0 +1,117 @@
boom/command.py | 84 ++++++++++++++++++++++++++++++++++++++++++---------------
1 file changed, 63 insertions(+), 21 deletions(-)
diff --git a/boom/command.py b/boom/command.py
index dc9abae..8900457 100644
--- a/boom/command.py
+++ b/boom/command.py
@@ -482,24 +482,72 @@ def _do_print_type(report_fields, selected, output_fields=None,
return br.report_output()
-def _merge_add_del_opts(orig_opts, opts):
+def _merge_add_del_opts(bp, add_opts, del_opts):
"""Merge a set of existing bootparams option alterations with
a set of command-line provided values to produce a single
set of options to add or remove from a cloned or edited
``BootEntry``.
- :param orig_opts: A list of original option modifications
- :param opts: A space-separated string containing a list of
- command line option modifications
- :returns: A single list containing the merged options
- """
- # Merge new and cloned kernel options
- all_opts = set()
- if opts:
- all_opts.update(opts.split())
- if orig_opts:
- all_opts.update(orig_opts)
- return list(all_opts)
+ The sets are merged giving precedence to alterations on the
+ current command line: i.e. if an option is present in both
+ ``bp.del_opts`` and ``add_opts`` (or vice versa) then the
+ option taken from the current command line will be effective.
+
+ :param bp: A ``BootParams`` object with the original ``add_opts``
+ and ``del_opts`` values.
+ :param add_opts: A space-separated string containing a list of
+ additional options taken from the current
+ command line.
+ :param del_opts: A space-separated string containing a list of
+ options to delete taken from the current
+ command line.
+ :returns: A tuple ``(effective_add_opts, effective_del_opts)``
+ giving the final effective values as a list of
+ strings, one per option word.
+ """
+ def _merge_opts(orig_opts, opts, r_opts):
+ # Merge new and cloned kernel options
+ all_opts = set()
+ if opts:
+ all_opts.update(opts)
+ if orig_opts:
+ all_opts.update(orig_opts)
+ all_opts = list(all_opts)
+ return [o for o in all_opts if o not in r_opts]
+
+ _log_debug_cmd("Add opts: %s" % add_opts)
+ _log_debug_cmd("Del opts: %s" % del_opts)
+ _log_debug_cmd("Original add_opts: %s" % bp.add_opts)
+ _log_debug_cmd("Original del_opts: %s" % bp.del_opts)
+
+ r_del_opts = []
+ r_add_opts = []
+
+ add_opts = add_opts.split() if add_opts else []
+ del_opts = del_opts.split() if del_opts else []
+
+ for add_opt in list(add_opts):
+ # Do not allow conflicting command line add/del opts
+ if add_opt in del_opts:
+ raise ValueError("Conflicting --add-opts %s and --del-opts %s" %
+ (add_opt, add_opt))
+
+ if add_opt in bp.del_opts:
+ r_del_opts.append(add_opt)
+ add_opts.remove(add_opt)
+
+ for del_opt in list(del_opts):
+ if del_opt in bp.add_opts:
+ r_add_opts.append(del_opt)
+ del_opts.remove(del_opt)
+
+ add_opts = _merge_opts(bp.add_opts, add_opts, r_add_opts)
+ del_opts = _merge_opts(bp.del_opts, del_opts, r_del_opts)
+
+ _log_debug_cmd("Effective add options: %s" % add_opts)
+ _log_debug_cmd("Effective del options: %s" % del_opts)
+
+ return (add_opts, del_opts)
#
@@ -759,10 +807,7 @@ def clone_entry(selection=None, title=None, version=None, machine_id=None,
else be.bp.btrfs_subvol_id)
profile = profile if profile else be._osp
- add_opts = _merge_add_del_opts(be.bp.add_opts, add_opts)
- del_opts = _merge_add_del_opts(be.bp.del_opts, del_opts)
- _log_debug_cmd("Effective add options: %s" % add_opts)
- _log_debug_cmd("Effective del options: %s" % del_opts)
+ (add_opts, del_opts) = _merge_add_del_opts(be.bp, add_opts, del_opts)
bp = BootParams(version, root_device, lvm_root_lv=lvm_root_lv,
btrfs_subvol_path=btrfs_subvol_path,
@@ -864,10 +909,7 @@ def edit_entry(selection=None, title=None, version=None, machine_id=None,
machine_id = machine_id or be.machine_id
version = version or be.version
- add_opts = _merge_add_del_opts(be.bp.add_opts, add_opts)
- del_opts = _merge_add_del_opts(be.bp.del_opts, del_opts)
- _log_debug_cmd("Effective add options: %s" % add_opts)
- _log_debug_cmd("Effective del options: %s" % del_opts)
+ (add_opts, del_opts) = _merge_add_del_opts(be.bp, add_opts, del_opts)
be._osp = profile or be._osp
be.title = title or be.title

View File

@ -0,0 +1,25 @@
boom/command.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/boom/command.py b/boom/command.py
index 8900457..165a8a8 100644
--- a/boom/command.py
+++ b/boom/command.py
@@ -2256,6 +2256,9 @@ def _edit_cmd(cmd_args, select, opts, identifier):
profile = _find_profile(cmd_args, version, machine_id, "edit")
+ add_opts = cmd_args.add_opts
+ del_opts = cmd_args.del_opts
+
arch = cmd_args.architecture
try:
@@ -2264,6 +2267,7 @@ def _edit_cmd(cmd_args, select, opts, identifier):
lvm_root_lv=lvm_root_lv,
btrfs_subvol_path=btrfs_subvol_path,
btrfs_subvol_id=btrfs_subvol_id, profile=profile,
+ add_opts=add_opts, del_opts=del_opts,
architecture=arch, expand=cmd_args.expand_variables)
except ValueError as e:
print(e)

View File

@ -0,0 +1,19 @@
boom/command.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/boom/command.py b/boom/command.py
index 165a8a8..c164b33 100644
--- a/boom/command.py
+++ b/boom/command.py
@@ -927,6 +927,11 @@ def edit_entry(selection=None, title=None, version=None, machine_id=None,
be.initrd = _cache_image(be.initrd, images == I_BACKUP)
be.linux = _cache_image(be.linux, images == I_BACKUP)
+ # Is the entry now identical to an existing entry?
+ if len(find_entries(Selection(boot_id=be.boot_id))) > 1:
+ raise ValueError("Entry already exists (boot_id=%s)." %
+ be.disp_boot_id)
+
be.update_entry(expand=expand)
__write_legacy()

View File

@ -0,0 +1,50 @@
tests/command_tests.py | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/tests/command_tests.py b/tests/command_tests.py
index 6d0c79b..fee6a33 100644
--- a/tests/command_tests.py
+++ b/tests/command_tests.py
@@ -519,6 +519,42 @@ class CommandTests(unittest.TestCase):
be.delete_entry()
self.assertFalse(exists(be._entry_path))
+ def test_clone_entry_del_opts_and_re_add(self):
+ # Fedora 24 (Workstation Edition)
+
+ # Delete rhgb quiet
+ osp = get_os_profile_by_id(test_os_id)
+ be = create_entry("delopts", "2.6.0", "ffffffff", test_lv,
+ lvm_root_lv=test_root_lv, profile=osp,
+ del_opts="rhgb quiet")
+
+ # Assert it's gone
+ self.assertFalse("rhgb quiet" in be.options)
+
+ be2 = clone_entry(Selection(boot_id=be.boot_id), title="addoptsclone",
+ add_opts="rhgb quiet")
+
+ # Assert it's back
+ self.assertTrue("rhgb quiet" in be2.options)
+
+ def test_clone_entry_add_opts_and_re_del(self):
+ # Fedora 24 (Workstation Edition)
+
+ # Add debug
+ osp = get_os_profile_by_id(test_os_id)
+ be = create_entry("addopts", "2.6.0", "ffffffff", test_lv,
+ lvm_root_lv=test_root_lv, profile=osp,
+ add_opts="debug")
+
+ # Assert it's there
+ self.assertTrue("debug" in be.options)
+
+ be2 = clone_entry(Selection(boot_id=be.boot_id), title="deloptsclone",
+ del_opts="debug")
+
+ # Assert it's gone
+ self.assertFalse("debug" in be2.options)
+
@unittest.skipIf(not have_root_lv(), "requires root LV")
def test_clone_delete_entry(self):
# Fedora 24 (Workstation Edition)

View File

@ -0,0 +1,23 @@
tests/command_tests.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tests/command_tests.py b/tests/command_tests.py
index fee6a33..b85b7dd 100644
--- a/tests/command_tests.py
+++ b/tests/command_tests.py
@@ -519,6 +519,7 @@ class CommandTests(unittest.TestCase):
be.delete_entry()
self.assertFalse(exists(be._entry_path))
+ @unittest.skipIf(not have_root_lv(), "requires root LV")
def test_clone_entry_del_opts_and_re_add(self):
# Fedora 24 (Workstation Edition)
@@ -537,6 +538,7 @@ class CommandTests(unittest.TestCase):
# Assert it's back
self.assertTrue("rhgb quiet" in be2.options)
+ @unittest.skipIf(not have_root_lv(), "requires root LV")
def test_clone_entry_add_opts_and_re_del(self):
# Fedora 24 (Workstation Edition)

View File

@ -3,7 +3,7 @@
Name: boom-boot
Version: 1.2
Release: 1%{?dist}
Release: 2%{?dist}
Summary: %{summary}
License: GPLv2
@ -12,6 +12,13 @@ Source0: https://github.com/snapshotmanager/boom/archive/%{version}/boom-%{versi
Patch0: Disable-GRUB2-plugin-on-RHEL-8.patch
Patch1: 0001-etc-Remove-executable-permission-from-etc-default-bo.patch
Patch2: 0002-man-Fix-line-starting-with.patch
Patch3: 0003-boom-bump-release-to-1.2.patch
Patch4: 0004-boom-fix-precedence-and-handle-conflicts-when-mergin.patch
Patch5: 0005-boom-pass-add-del-opts-to-edit_entry-in-edit-command.patch
Patch6: 0006-boom-check-for-duplicates-in-edit_entry.patch
Patch7: 0007-tests-add-test_clone_entry_-add-del-_opts_and_re_-ad.patch
Patch8: 0008-tests-skip-add-del-and-re-del-add-tests-if-have_root.patch
BuildArch: noarch
@ -90,6 +97,12 @@ This package provides integration scripts for grub2 bootloader.
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%build
%if 0%{?sphinx_docs}
@ -117,6 +130,7 @@ install -d -m 700 ${RPM_BUILD_ROOT}/boot/boom/hosts
install -d -m 700 ${RPM_BUILD_ROOT}/boot/loader/entries
install -d -m 700 ${RPM_BUILD_ROOT}/boot/boom/cache
install -m 644 examples/boom.conf ${RPM_BUILD_ROOT}/boot/boom
install -m 644 examples/profiles/*.profile ${RPM_BUILD_ROOT}/boot/boom/profiles
mkdir -p ${RPM_BUILD_ROOT}/%{_mandir}/man8
mkdir -p ${RPM_BUILD_ROOT}/%{_mandir}/man5
@ -150,6 +164,7 @@ rm doc/conf.py
%dir /boot/boom
%config(noreplace) /boot/boom/boom.conf
%dir /boot/boom/profiles
%config(noreplace) /boot/boom/profiles/*
%dir /boot/boom/hosts
%dir /boot/boom/cache
%dir /boot/loader/entries
@ -162,6 +177,11 @@ rm doc/conf.py
%changelog
* Mon Jun 29 2020 Marian Csontos <mcsontos@redhat.com> 1.2-2
- Fix RHEL-8 profiles.
- Fix --add/del-opt precedence.
- Fix backup image reference counting.
* Sun Jun 07 2020 Marian Csontos <mcsontos@redhat.com> 1.2-1
- Update to bug fix release 1.2.