[PATCH] Add an option to disable even installing the core group.
Chris Lumens
clumens at redhat.com
Thu Mar 20 15:15:20 UTC 2014
Use this one wisely - it may result in a system that doesn't do anything.
---
pykickstart/parser.py | 6 ++++++
pykickstart/sections.py | 14 +++++++++++++-
tests/parser/packages.py | 22 ++++++++++++++++++++++
3 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/pykickstart/parser.py b/pykickstart/parser.py
index 94b21bb..0e3cb71 100644
--- a/pykickstart/parser.py
+++ b/pykickstart/parser.py
@@ -262,6 +262,9 @@ class Packages(KickstartObject):
addBase -- Should the Base group be installed even if it is
not specified?
+ nocore -- Should the Core group be skipped? This results in
+ a %packages section that basically only installs the
+ packages you list, and may not be a usable system.
default -- Should the default package set be selected?
environment -- What base environment should be selected? Only one
may be chosen at a time.
@@ -290,6 +293,7 @@ class Packages(KickstartObject):
KickstartObject.__init__(self, *args, **kwargs)
self.addBase = True
+ self.nocore = False
self.default = False
self.environment = None
self.excludedList = []
@@ -341,6 +345,8 @@ class Packages(KickstartObject):
retval += " --excludedocs"
if not self.addBase:
retval += " --nobase"
+ if self.nocore:
+ retval += " --nocore"
if self.handleMissing == constants.KS_MISSING_IGNORE:
retval += " --ignoremissing"
if self.instLangs:
diff --git a/pykickstart/sections.py b/pykickstart/sections.py
index 51c304a..bd98fb1 100644
--- a/pykickstart/sections.py
+++ b/pykickstart/sections.py
@@ -3,7 +3,7 @@
#
# Chris Lumens <clumens at redhat.com>
#
-# Copyright 2011 Red Hat, Inc.
+# Copyright 2011, 2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
@@ -30,9 +30,13 @@ is necessary is to create a new subclass of Section and call
parser.registerSection with an instance of your new class.
"""
from constants import *
+from errors import KickstartParseError, formatErrorMsg
from options import KSOptionParser
from version import *
+import gettext
+_ = lambda x: gettext.ldgettext("pykickstart", x)
+
class Section(object):
"""The base class for defining kickstart sections. You are free to
subclass this as appropriate.
@@ -226,6 +230,8 @@ class PackageSection(Section):
action="store_true", default=False)
op.add_option("--nobase", dest="nobase", action="store_true",
default=False, deprecated=F18)
+ op.add_option("--nocore", dest="nocore", action="store_true",
+ default=False, introduced=F21)
op.add_option("--ignoredeps", dest="resolveDeps", action="store_false",
deprecated=FC4, removed=F9)
op.add_option("--resolvedeps", dest="resolveDeps", action="store_true",
@@ -239,6 +245,11 @@ class PackageSection(Section):
(opts, extra) = op.parse_args(args=args[1:], lineno=lineno)
+ if opts.defaultPackages and opts.nobase:
+ raise KickstartParseError(formatErrorMsg(lineno, msg=_("--default and --nobase cannot be used together")))
+ elif opts.defaultPackages and opts.nocore:
+ raise KickstartParseError(formatErrorMsg(lineno, msg=_("--default and --nocore cannot be used together")))
+
self.handler.packages.excludeDocs = opts.excludedocs
self.handler.packages.addBase = not opts.nobase
if opts.ignoremissing:
@@ -252,5 +263,6 @@ class PackageSection(Section):
if opts.instLangs:
self.handler.packages.instLangs = opts.instLangs
+ self.handler.packages.nocore = opts.nocore
self.handler.packages.multiLib = opts.multiLib
self.handler.packages.seen = True
diff --git a/tests/parser/packages.py b/tests/parser/packages.py
index 560a59f..ac764fa 100644
--- a/tests/parser/packages.py
+++ b/tests/parser/packages.py
@@ -51,6 +51,28 @@ bash
self.parser.readKickstartFromString(self.ks)
self.assertEqual(len(w), 0)
+class Packages_Contains_Nobase_Default_TestCase(ParserTest):
+ ks = """
+%packages --nobase --default
+%end
+"""
+
+ def runTest(self):
+ with warnings.catch_warnings(record=True) as w:
+ warnings.simplefilter("always")
+ self.assertRaises(KickstartParseError, self.parser.readKickstartFromString, self.ks)
+
+class Packages_Contains_Nocore_Default_TestCase(ParserTest):
+ ks = """
+%packages --nocore --default
+%end
+"""
+
+ def runTest(self):
+ with warnings.catch_warnings(record=True) as w:
+ warnings.simplefilter("always")
+ self.assertRaises(KickstartParseError, self.parser.readKickstartFromString, self.ks)
+
class Packages_Contains_Environment_1_TestCase(ParserTest):
ks = """
%packages
--
1.8.3.1
More information about the anaconda-patches
mailing list