summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2003-02-12 04:40:03 +0000
committerJeremy Katz <katzj@redhat.com>2003-02-12 04:40:03 +0000
commit3936193ec8fa48c6d576fbf04685fe3b46babd1f (patch)
treef778e8409a649529643300986b2f69a41c56796b
parent4d9a77b78d2b6d031e9983d1b41687c950a6340e (diff)
downloadanaconda-3936193ec8fa48c6d576fbf04685fe3b46babd1f.tar.gz
anaconda-3936193ec8fa48c6d576fbf04685fe3b46babd1f.tar.xz
anaconda-3936193ec8fa48c6d576fbf04685fe3b46babd1f.zip
ow.
keep a copy of whether metapkgs and optional components are selected by default. then use this information when writing out the anaconda-ks.cfg so that we can write out something which is correct (#73195, #80838). note that for metapkgs, we have to write out -pkg for each package in the group because we have no syntax for unselecting groups and staying that way seems saner
-rw-r--r--comps.py5
-rw-r--r--instdata.py53
2 files changed, 46 insertions, 12 deletions
diff --git a/comps.py b/comps.py
index d5273a32a..ff8b3294e 100644
--- a/comps.py
+++ b/comps.py
@@ -343,6 +343,7 @@ class Component:
def addMetaPkg(self, comp, isDefault = 0):
self.metapkgs[comp] = (PKGTYPE_OPTIONAL, isDefault)
+ self.metadef[comp] = isDefault
def addPackage(self, p, pkgtype, handleDeps = 1):
if pkgtype == PKGTYPE_MANDATORY:
@@ -355,10 +356,12 @@ class Component:
p.registerComponent(self)
self.newpkgDict[p] = (PKGTYPE_OPTIONAL, 1)
self.pkgDict[p] = None
+ self.optDict[p] = 1
if handleDeps == 1:
self.updateDependencyCountForAddition(p)
elif pkgtype == PKGTYPE_OPTIONAL:
self.newpkgDict[p] = (PKGTYPE_OPTIONAL, 0)
+ self.optDict[p] = 2
else:
log("Unable to add package %s to component %s because it has an unknown pkgtype of %d" %(p.name, self.name, pkgtype))
@@ -543,8 +546,10 @@ class Component:
self.pkgDict = {}
self.newpkgDict = {}
+ self.optDict = {}
self.includes = []
self.metapkgs = {}
+ self.metadef = {}
self.manuallySelected = 0
self.selectionCount = 0
self.depsDict = {}
diff --git a/instdata.py b/instdata.py
index eba4fea4a..53d224e61 100644
--- a/instdata.py
+++ b/instdata.py
@@ -150,38 +150,67 @@ class InstallData:
f.write("\n")
packages = {}
forcedoff = {}
+ forcedon = {}
for comp in self.comps:
if comp.isSelected():
if (comp.isSelected(justManual = 1) and comp.name != "Base"
and comp.name != "Core"):
f.write("@ %s\n" % comp.name)
+ for metapkg in comp.metapkgs.keys():
+ (type, on) = comp.metapkgs[metapkg]
+ default = comp.metadef[metapkg]
+ if on == 1 and default == 0:
+ f.write("@ %s\n" % metapkg.name)
+ elif on == 0 and default == 1:
+ # this isn't quite right
+ for pkg in metapkg.newpkgDict.keys():
+ forcedoff[pkg.name] = 1
+
for pkg in comp.newpkgDict.keys():
# if it's in base or core, it really should be installed
if comp.name == "Base" or comp.name == "Core":
- packages[pkg] = 1
+ packages[pkg.name] = 1
elif comp.newpkgDict.has_key(pkg):
(type, installed) = comp.newpkgDict[pkg]
# if it's mandatory, put it in the dict of ones
# already handled
if type == 0:
- packages[pkg] = 1
- elif comp.depsDict.has_key(pkg.name):
- packages[pkg] = 1
+ packages[pkg.name] = 1
else:
- # otherwise it's optional -- if it's off, we
- # should mark it as forced off so that it
- # gets listed as such in the comps file
- if installed == 0:
- forcedoff[pkg] = 1
+ if comp.optDict.has_key(pkg):
+ type = comp.optDict[pkg]
+ # it's default and selected for installation
+ if type == 1 and installed == 1:
+ packages[pkg.name] = 1
+ # default and off
+ elif type == 1 and installed == 0:
+ forcedoff[pkg.name] = 1
+ # optional and on
+ elif type == 2 and installed == 1:
+ forcedon[pkg.name] = 1
+ # optional and off
+ elif type == 2 and installed == 0:
+ pass
+ else:
+ # otherwise it's optional -- if it's off, we
+ # should mark it as forced off so that it
+ # gets listed as such in the comps file
+ if installed == 0:
+ forcedoff[pkg.name] = 1
# or if it's there as a dep, pretend we don't care
elif comp.depsDict.has_key(pkg.name):
- packages[pkg] = 1
+ packages[pkg.name] = 1
+
+ for pkg in comp.depsDict.keys():
+ packages[pkg] = 1
+
for pkg in self.hdList.values():
- if not packages.has_key(pkg) and pkg.isSelected():
+ if pkg.isSelected() and (forcedon.has_key(pkg.name) or
+ not packages.has_key(pkg.name)):
f.write("%s\n" % pkg.name)
- if pkg.wasForcedOff() or forcedoff.has_key(pkg):
+ if pkg.wasForcedOff() or forcedoff.has_key(pkg.name):
f.write("-%s\n" %(pkg.name))
def __init__(self, extraModules, floppyDevice, configFileData, methodstr):