180 lines
6.7 KiB
Diff
180 lines
6.7 KiB
Diff
From 8e9d4b5d27982da1c09ff81c3c8bc93349e968cd Mon Sep 17 00:00:00 2001
|
|
From: Michal Luscon <mluscon@redhat.com>
|
|
Date: Tue, 24 May 2016 16:30:20 +0200
|
|
Subject: [PATCH 3/3] Revert "group: treat mandatory pkgs as mandatory if
|
|
strict=true" (RhBug:1337731)
|
|
|
|
This reverts commit f0f6488e86e39b574c7d552d8a6c1aa6d09c5852.
|
|
---
|
|
dnf/base.py | 4 +---
|
|
dnf/cli/commands/group.py | 10 +---------
|
|
dnf/persistor.py | 3 ---
|
|
tests/repos/main_comps.xml | 8 --------
|
|
tests/support.py | 2 +-
|
|
tests/test_comps.py | 6 +++---
|
|
tests/test_groups.py | 23 +----------------------
|
|
7 files changed, 7 insertions(+), 49 deletions(-)
|
|
|
|
diff --git a/dnf/base.py b/dnf/base.py
|
|
index 7943c8a..7bb3a26 100644
|
|
--- a/dnf/base.py
|
|
+++ b/dnf/base.py
|
|
@@ -1208,14 +1208,12 @@ class Base(object):
|
|
for it in attr:
|
|
if not self.sack.query().filter(name=it):
|
|
# a comps item that doesn't refer to anything real
|
|
- if (attr == trans.install):
|
|
- self._group_persistor._rollback()
|
|
- raise dnf.exceptions.MarkingError(it)
|
|
continue
|
|
sltr = dnf.selector.Selector(self.sack)
|
|
sltr.set(name=it)
|
|
fn(select=sltr)
|
|
cnt += 1
|
|
+
|
|
self._goal.group_members.update(trans.install)
|
|
self._goal.group_members.update(trans.install_opt)
|
|
return cnt
|
|
diff --git a/dnf/cli/commands/group.py b/dnf/cli/commands/group.py
|
|
index d28f84c..510c539 100644
|
|
--- a/dnf/cli/commands/group.py
|
|
+++ b/dnf/cli/commands/group.py
|
|
@@ -404,15 +404,7 @@ class GroupCommand(commands.Command):
|
|
if cmd == 'install':
|
|
types, patterns = self._split_extcmds(extcmds)
|
|
self._remark = True
|
|
- try:
|
|
- return self.base.env_group_install(patterns, types,
|
|
- self.base.conf.strict)
|
|
- except dnf.exceptions.MarkingError as e:
|
|
- msg = _('No package %s%s%s available.')
|
|
- logger.info(msg, self.base.output.term.MODE['bold'], e,
|
|
- self.base.output.term.MODE['normal'])
|
|
- raise dnf.exceptions.PackagesNotAvailableError(
|
|
- _("Unable to find a mandatory group package."))
|
|
+ return self.base.env_group_install(patterns, types)
|
|
if cmd == 'upgrade':
|
|
return self.base.env_group_upgrade(extcmds)
|
|
if cmd == 'remove':
|
|
diff --git a/dnf/persistor.py b/dnf/persistor.py
|
|
index 367343c..5d54895 100644
|
|
--- a/dnf/persistor.py
|
|
+++ b/dnf/persistor.py
|
|
@@ -356,9 +356,6 @@ class GroupPersistor(object):
|
|
for id_ in del_list:
|
|
del members_dct[id_]
|
|
|
|
- def _rollback(self):
|
|
- self.db = self._original.clone()
|
|
-
|
|
def commit(self):
|
|
self._commit = True
|
|
|
|
diff --git a/tests/repos/main_comps.xml b/tests/repos/main_comps.xml
|
|
index 3cf8faa..67fc6c7 100644
|
|
--- a/tests/repos/main_comps.xml
|
|
+++ b/tests/repos/main_comps.xml
|
|
@@ -39,14 +39,6 @@
|
|
<packagereq>lotus</packagereq>
|
|
</packagelist>
|
|
</group>
|
|
- <group>
|
|
- <id>broken-group</id>
|
|
- <name>Broken Group</name>
|
|
- <packagelist>
|
|
- <packagereq type="mandatory">meaning-of-life</packagereq>
|
|
- <packagereq>lotus</packagereq>
|
|
- </packagelist>
|
|
- </group>
|
|
<category>
|
|
<id>base-system</id>
|
|
<display_order>99</display_order>
|
|
diff --git a/tests/support.py b/tests/support.py
|
|
index 584e7fe..275549c 100644
|
|
--- a/tests/support.py
|
|
+++ b/tests/support.py
|
|
@@ -82,7 +82,7 @@ SYSTEM_NSOLVABLES = TOTAL_RPMDB_COUNT
|
|
MAIN_NSOLVABLES = 9
|
|
UPDATES_NSOLVABLES = 4
|
|
AVAILABLE_NSOLVABLES = MAIN_NSOLVABLES + UPDATES_NSOLVABLES
|
|
-TOTAL_GROUPS = 4
|
|
+TOTAL_GROUPS = 3
|
|
TOTAL_NSOLVABLES = SYSTEM_NSOLVABLES + AVAILABLE_NSOLVABLES
|
|
|
|
# testing infrastructure
|
|
diff --git a/tests/test_comps.py b/tests/test_comps.py
|
|
index 576e801..07a65ab 100644
|
|
--- a/tests/test_comps.py
|
|
+++ b/tests/test_comps.py
|
|
@@ -100,7 +100,7 @@ class CompsTest(support.TestCase):
|
|
def test_iteration(self):
|
|
comps = self.comps
|
|
self.assertEqual([g.name for g in comps.groups_iter()],
|
|
- ['Base', 'Solid Ground', "Pepper's", "Broken Group"])
|
|
+ ['Base', 'Solid Ground', "Pepper's"])
|
|
self.assertEqual([c.name for c in comps.categories_iter()],
|
|
['Base System'])
|
|
g = dnf.util.first(comps.groups_iter())
|
|
@@ -108,7 +108,7 @@ class CompsTest(support.TestCase):
|
|
|
|
def test_group_display_order(self):
|
|
self.assertEqual([g.name for g in self.comps.groups],
|
|
- ["Pepper's", 'Base', 'Solid Ground', 'Broken Group'])
|
|
+ ["Pepper's", 'Base', 'Solid Ground'])
|
|
|
|
def test_packages(self):
|
|
comps = self.comps
|
|
@@ -120,7 +120,7 @@ class CompsTest(support.TestCase):
|
|
|
|
def test_size(self):
|
|
comps = self.comps
|
|
- self.assertLength(comps, 6)
|
|
+ self.assertLength(comps, 5)
|
|
self.assertLength(comps.groups, support.TOTAL_GROUPS)
|
|
self.assertLength(comps.categories, 1)
|
|
self.assertLength(comps.environments, 1)
|
|
diff --git a/tests/test_groups.py b/tests/test_groups.py
|
|
index 1986c0d..83f66d8 100644
|
|
--- a/tests/test_groups.py
|
|
+++ b/tests/test_groups.py
|
|
@@ -68,7 +68,7 @@ class EmptyPersistorTest(support.ResultTestCase):
|
|
self.assertEmpty(removed)
|
|
|
|
trans = dnf.comps.TransactionBunch()
|
|
- trans.install_opt.add('waltz')
|
|
+ trans.install.add('waltz')
|
|
self.assertEqual(self.base._add_comps_trans(trans), 0)
|
|
|
|
|
|
@@ -121,27 +121,6 @@ class PresetPersistorTest(support.ResultTestCase):
|
|
self.assertEmpty(removed)
|
|
self.assertTrue(p_grp.installed)
|
|
|
|
- def test_group_install_broken(self):
|
|
- prst = self.base._group_persistor
|
|
- grp = self.base.comps.group_by_pattern('Broken Group')
|
|
- p_grp = prst.group('broken-group')
|
|
- self.assertFalse(p_grp.installed)
|
|
-
|
|
- self.assertRaises(dnf.exceptions.MarkingError,
|
|
- self.base.group_install, grp.id,
|
|
- ('mandatory', 'default'))
|
|
- p_grp = prst.group('broken-group')
|
|
- self.assertFalse(p_grp.installed)
|
|
-
|
|
- self.assertEquals(self.base.group_install(grp.id,
|
|
- ('mandatory', 'default'),
|
|
- strict=False), 1)
|
|
- inst, removed = self.installed_removed(self.base)
|
|
- self.assertLength(inst, 1)
|
|
- self.assertEmpty(removed)
|
|
- p_grp = prst.group('broken-group')
|
|
- self.assertTrue(p_grp.installed)
|
|
-
|
|
def test_group_remove(self):
|
|
prst = self.base._group_persistor
|
|
grp_ids = prst.groups_by_pattern('somerset')
|
|
--
|
|
2.7.4
|
|
|