diff options
-rw-r--r-- | comps.py | 5 | ||||
-rw-r--r-- | instdata.py | 53 |
2 files changed, 46 insertions, 12 deletions
@@ -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): |