diff options
54 files changed, 880 insertions, 870 deletions
@@ -109,7 +109,7 @@ def startVNCServer(vncpassword=None, root='/'): except: dup_log("Unknown expection setting vnc password.") rc = 1 - + if rc: dup_log(_("Unable to set vnc password - using no password!")) dup_log(_("Make sure your password is at least 6 characters in length.")) @@ -327,6 +327,10 @@ else: if os.environ.has_key("LD_PRELOAD"): del os.environ["LD_PRELOAD"] +# we need to do this really early so we make sure its done before rpm +# is imported +iutil.writeRpmPlatform() + try: (args, extra) = isys.getopt(theargs, 'CGTRxtdr:fm:', [ 'graphical', 'text', 'test', 'debug', 'nofallback', diff --git a/autopart.py b/autopart.py index 1cafef1a4..be397d492 100644 --- a/autopart.py +++ b/autopart.py @@ -36,6 +36,9 @@ BOOTEFI_NOT_VFAT = -2 BOOTALPHA_NOT_BSD = -3 BOOTALPHA_NO_RESERVED_SPACE = -4 BOOTPSERIES_NOT_PREP = -5 +# XXX TODO: check for PReP partitions > 4 MiB and starting over 4096M. +BOOTPSERIES_LARGER_THAN_4M = -6 +BOOTPSERIES_ABOVE_4096M = -7 DEBUG_LVM_GROW = 0 @@ -1410,7 +1413,7 @@ def getAutopartitionBoot(): return ("/boot/efi", "vfat", 100, None, 0, 1) elif (iutil.getPPCMachine() == "pSeries" or iutil.getPPCMachine() == "iSeries"): - return(None, "PPC PReP Boot", 8, None, 0, 1) + return(None, "PPC PReP Boot", 4, None, 0, 1) else: return ("/boot", None, 100, None, 0, 1) diff --git a/bootloader.py b/bootloader.py index e4630ea9e..66c56641d 100644 --- a/bootloader.py +++ b/bootloader.py @@ -127,7 +127,7 @@ def writeBootloader(intf, instRoot, fsset, bl, langs, comps): f = open("/proc/sys/kernel/exec-shield", "w") f.write("0") f.close() - + dosync() try: bl.write(instRoot, fsset, bl, langs, kernelList, otherList, defaultDev, diff --git a/constants.py b/constants.py index 8365de134..73865b1cc 100644 --- a/constants.py +++ b/constants.py @@ -19,6 +19,10 @@ BETANAG = 1 DEBUG = 0 +cmdline = open("/proc/cmdline", "r").read() +if cmdline.find("debug") != -1: + DEBUG = 1 + DISPATCH_BACK = -1 DISPATCH_FORWARD = 1 DISPATCH_NOOP = None diff --git a/hdrlist.py b/hdrlist.py index 42b9dc69d..9dc97b669 100644 --- a/hdrlist.py +++ b/hdrlist.py @@ -23,25 +23,27 @@ import os,sys,time from rhpl.log import log from rhpl.translate import _, N_ import rhpl.comps +import rhpl.arch import language ON = 1 MANUAL_ON = 2 +DEP_ON = 3 OFF = -1 MANUAL_OFF = -2 MANUAL_NONE = 0 -ON_STATES = (ON, MANUAL_ON) +ON_STATES = (ON, MANUAL_ON, DEP_ON) OFF_STATES = (OFF, MANUAL_OFF) PKGTYPE_MANDATORY = 0 PKGTYPE_DEFAULT = 1 PKGTYPE_OPTIONAL = 2 -EVERYTHING_DESCRIPTION = N_("This group includes all the packages available. " - "Note that there are substantially more packages " - "than just the ones in all the other package " - "groups on this page.") +EVERYTHING_DESCRIPTION = _("This group includes all the packages available. " + "Note that there are substantially more packages " + "than just the ones in all the other package " + "groups on this page.") EverythingExclude = {'kernel' : None, 'kernel-BOOT' : None, 'kernel-smp' : None, 'kernel-bigmem' : None, @@ -81,6 +83,97 @@ def getLangs(): langs = [] return langs +# poor heuristic for figuring out the best of two packages with the same +# name. it sucks, but it's the best we've got right now. +# basically, we generally prefer the shorter name with some special-case +# caveats. +def betterPackageForProvides(h1, h2): + # if one is none, return the other + if h2 is None: + return h1 + if h1 is None: + return h2 + + # if we're already being installed, then we're clearly the superior + # answer + if h1.isSelected(): + return h1 + if h2.isSelected(): + return h2 + + # sendmail is preferred over postfix + if h1['name'] == "sendmail" and h2['name'] == "postfix": + return h1 + if h2['name'] == "sendmail" and h1['name'] == "postfix": + return h2 + + # we generally prefer non-devel over devel + if h1['name'].endswith("-devel") and not h2["name"].endswith("-devel"): + return h2 + if h2['name'].endswith("-devel") and not h1["name"].endswith("-devel"): + return h1 + + # else, shorter name wins + # this handles glibc-debug, kernel-*, kde2-compat, etc + if len(h1['name']) < len(h2['name']): + return h1 + if len(h2['name']) < len(h1['name']): + return h2 + + # same package names, which is a better arch? + score1 = rhpl.arch.score(h1['arch']) + score2 = rhpl.arch.score(h2['arch']) + if score1 == 0: + return h2 + elif score2 == 0: + return h1 + elif (score1 < score2): + return h1 + elif (score2 < score1): + return h2 + + # okay, there's no convincing difference. just go with the first + return h1 + +cached = {} +# returns the best nevra in hdrlist to match dep +# FIXME: doesn't care about EVR right now -- the tree is assumed to be +# sane and dep is just the name +def depMatch(dep, hdrlist): + # ignore rpmlib + if dep.startswith("rpmlib("): + return None + # try to see if it just exists first + elif hdrlist.has_key(dep): + return nevra(hdrlist[dep]) + elif cached.has_key(dep): + return cached[dep] + # next, see if its a file dep (FIXME: we have Provides: /usr/sbin/sendmail + # with alternatives) + elif dep[0] == "/": + hdr = None + for h in hdrlist.pkgs.values(): + l = [] + for f in h.hdr.fiFromHeader(): + l.append(f[0]) + if (dep in l): + hdr = betterPackageForProvides(h, hdr) + if hdr is not None: + # cache all binaries from this package. helps with, eg, coreutils + for f in hdr.hdr.fiFromHeader(): + if f[0].find("bin") != -1: cached[f[0]] = nevra(hdr) + cached[dep] = nevra(hdr) + return nevra(hdr) + else: + hdr = None + for h in hdrlist.pkgs.values(): + if (dep in h[rpm.RPMTAG_PROVIDENAME]): + hdr = betterPackageForProvides(h, hdr) + if hdr is not None: + cached[dep] = nevra(hdr) + return nevra(hdr) + return None + class DependencyChecker: def __init__(self, grpset, how = "i"): @@ -90,39 +183,25 @@ class DependencyChecker: self.how = how # FIXME: this is the simple stupid version. it doesn't actually handle - # paying attention to EVR + # paying attention to EVR. def callback(self, ts, tag, name, evr, flags): if tag == rpm.RPMTAG_REQUIRENAME: - hdr = None - if name[0] == "/": - for h in self.grpset.hdrlist.pkgs.values(): - l = [] - for f in h.hdr.fiFromHeader(): l.append(f[0]) - - if ((name in l) and - ((hdr is None) or (len(h[rpm.RPMTAG_NAME]) < - len(hdr[rpm.RPMTAG_NAME])))): - hdr = h + pkgnevra = depMatch(name, self.grpset.hdrlist) + if pkgnevra and self.grpset.hdrlist.has_key(pkgnevra): + hdr = self.grpset.hdrlist[pkgnevra] else: - # do we have a package named this? - if self.grpset.hdrlist.has_key(name): - hdr = self.grpset.hdrlist[name] - # otherwise, go through provides and find the shortest name - else: - for h in self.grpset.hdrlist.pkgs.values(): - if ((name in h[rpm.RPMTAG_PROVIDENAME]) and - ((hdr is None) or (len(h[rpm.RPMTAG_NAME]) < - len(hdr[rpm.RPMTAG_NAME])))): - hdr = h - - if hdr is not None: + hdr = None + + if hdr is not None and not hdr.isSelected(): if evr: nevr = "%s-%s" %(name, evr) else: nevr = name log("using %s to satisfy %s" %(nevra(hdr), nevr)) ts.addInstall(hdr.hdr, hdr.hdr, self.how) + hdr.select(isDep = 1) self.added.append(nevra(hdr.hdr)) + return -1 return 1 @@ -134,6 +213,7 @@ class Package: self.usecount = 0 self.manual_state = MANUAL_NONE self.dependencies = [] + self.depsFound = 0 self.name = self.hdr[rpm.RPMTAG_NAME] @@ -143,16 +223,22 @@ class Package: def setState(self, state): (self.usecount, self.manual_state) = state - def addDeps(self, deps): + def addDeps(self, deps, main = 1): self.dependencies.extend(deps) + # FIXME: this is a hack so that adding deps for lang support stuff + # doesn't set depsFound + if main: + self.depsFound = 1 - def select(self, isManual = 0): + def select(self, isManual = 0, isDep = 0): self.usecount = self.usecount + 1 if isManual: if self.manual_state == MANUAL_NONE: self.manual_state = MANUAL_ON elif self.manual_state == MANUAL_OFF: self.manual_state = MANUAL_NONE + if isDep: + self.manual_state = DEP_ON def unselect(self, isManual = 0): self.usecount = self.usecount - 1 @@ -169,7 +255,7 @@ class Package: # if we've been manually turned on or off, follow that # otherwise, if the usecount is > 0, then we're selected def isSelected(self): - if self.manual_state == MANUAL_ON: + if self.manual_state == MANUAL_ON or self.manual_state == DEP_ON: return 1 elif self.manual_state == MANUAL_OFF: return 0 @@ -215,7 +301,7 @@ class HeaderList: def has_key(self, item): if self.pkgs.has_key(item): return 1 - elif self.pkgnames.has_key(item): + elif self.getBestNevra(item): return 1 return 0 @@ -225,17 +311,10 @@ class HeaderList: def values(self): return self.pkgs.values() - # FIXME: the package deps stuff needs to be nevra instead of name based - def mergePackageDeps(self, pkgsxml): - for pkg in pkgsxml.values(): - for (p, a) in self.pkgnames[pkg.name]: - self.pkgs[p].addDeps(pkg.dependencies) - # this is definite crack rock, but it allows us to avoid tripling # our memory usage :( # reads an hdlist2 file and merges the header information we split out # (things like file lists) - # FIXME: BUSTED! def mergeFullHeaders(self, file): if self.hasFullHeaders is not None: return @@ -255,22 +334,33 @@ class HeaderList: # FIXME: surely this can be made faster/less complicated # doing scoring everytime seems like it might be overkill # then again, it shouldn't be called *that* often so it might not matter - def getBestNevra(self, item): + def getBestNevra(self, item, prefArch = None): bestscore = 0 bestpkg = None if not self.pkgnames.has_key(item): return None - - for (nevra, arch) in self.pkgnames[item]: - # FIXME: need to use our replacement for arch scoring - # so that we can work with biarch - score = rpm.archscore(arch) - if not score: - continue - if (bestscore == 0) or (score < bestscore): - bestpkg = nevra - bestscore = score + + # the best nevra is going to be defined by being 1) the best match + # for the primary arch (eg, x86_64 on AMD64, ppc on pSeries) and + # if that fails, fall back to the canonical (which could be the same) + # This will allow us to get the best package by name for both + # system packages and kernel while not getting the secondary arch + # glibc. + if rhpl.arch.getBaseArch() != rhpl.arch.canonArch: + arches = (rhpl.arch.getBaseArch(), rhpl.arch.canonArch) + else: + arches = (rhpl.arch.canonArch, ) + for basearch in arches: + for (nevra, arch) in self.pkgnames[item]: + score = rhpl.arch.archDifference(basearch, arch) + if not score: + continue + if (bestscore == 0) or (score < bestscore): + bestpkg = nevra + bestscore = score + if bestpkg is not None: + return bestpkg return bestpkg # FIXME: surely this can be made faster/less complicated @@ -296,10 +386,6 @@ class HeaderListFromFile (HeaderList): class Group: def __init__(self, grpset, xmlgrp): - # dict of package info. nevra and type are obvious - # state is one of the ON/OFF states - def makePackageDict(pkgnevra, type, installed = 0): - return { "nevra": pkgnevra, "type": type, "state": installed } self.id = xmlgrp.id self.basename = xmlgrp.name @@ -314,17 +400,25 @@ class Group: if (self.description is None and xmlgrp.translated_description.has_key(lang)): self.description = xmlgrp.translated_description[lang] - # fall back to english if they're not set + # fall back to english if they're not set and try to see if the + # translation is in the anaconda.po (eg, Everything) if self.name is None: - self.name = xmlgrp.name + self.name = _(xmlgrp.name) if self.description is None: self.description = xmlgrp.description # obviously enough, hidden components aren't shown self.hidden = not xmlgrp.user_visible + # whether or not a group should be enabled by default. only # really matters for custom installs self.default = xmlgrp.default + + # if it's a biarch group and we're not a biarch-arch, be hidden and off + if xmlgrp.biarchonly and rhpl.arch.getSecondaryArch() is None: + self.hidden = 1 + self.default = 0 + # FIXME: this is a hack to handle language support groups self.langonly = xmlgrp.langonly @@ -347,18 +441,7 @@ class Group: %(self.id, pkg)) continue - if type == u'mandatory': - pkgtype = PKGTYPE_MANDATORY - elif type == u'default': - pkgtype = PKGTYPE_DEFAULT - elif type == u'optional': - pkgtype = PKGTYPE_OPTIONAL - else: - log("Invalid package type of %s for %s in %s; defaulting to " - "optional" % (type, pkgnevra, self.id)) - pkgtype = PKGTYPE_OPTIONAL - - self.packages[pkgnevra] = makePackageDict(pkgnevra, pkgtype) + self.packages[pkgnevra] = self.makePackageDict(pkgnevra, type) def getState(self): return (self.usecount, self.manual_state) @@ -370,6 +453,30 @@ class Group: if grpid not in self.groupreqs: self.groupreqs.append(grpid) + def addMetaPkg(self, metapkginfo): + (type, id) = metapkginfo + if id in self.packages.keys(): + log("already have %s in %s" %(id, self.id)) + return + self.packages[id] = self.makePackageDict(id, type, isMeta = 1) + + # dict of package info. nevra and type are obvious + # state is one of the ON/OFF states + def makePackageDict(self, pkgnevra, type, installed = 0, isMeta = 0): + if type == u'mandatory': + pkgtype = PKGTYPE_MANDATORY + elif type == u'default': + pkgtype = PKGTYPE_DEFAULT + elif type == u'optional': + pkgtype = PKGTYPE_OPTIONAL + else: + log("Invalid package type of %s for %s in %s; defaulting to " + "optional" % (type, pkgnevra, self.id)) + pkgtype = PKGTYPE_OPTIONAL + + return { "nevra": pkgnevra, "type": pkgtype, "state": installed, + "meta": isMeta } + # FIXME: this doesn't seem like the right place for it, but ... :/ def selectDeps(self, pkgs, uses = 1): checked = [] @@ -377,25 +484,65 @@ class Group: tocheck = pkgs pkgs = [] for pkgnevra in tocheck: - pkg = self.grpset.hdrlist[pkgnevra] - - deps = pkg.dependencies - for dep in deps: - # hmm, not in the header list. we can't do much but - # hope for the best - if not self.grpset.hdrlist.has_key(dep): - log("Package %s requires %s which we don't have" - %(tocheck, dep)) - continue - # if we've already checked for this package, don't worry - if dep in checked: - continue - self.grpset.hdrlist[dep].select() - # FIXME: this is a hack so we can make sure the usecount - # is bumped high enough for langsupport packages - self.grpset.hdrlist[dep].usecount += uses - 1 - pkgs.append(nevra(self.grpset.hdrlist[dep])) - checked.append(dep) + if pkgnevra in checked: + continue + pkg = self.grpset.hdrlist[pkgnevra] + + # this is a little bit complicated. we don't want to keep + # the deps in the comps file (because that gets ugly with biarch) + # but we also don't want to have to resolve every time + # (it's slow!). so, we cache the first time through + if pkg.depsFound == 0: + deps = pkg[rpm.RPMTAG_REQUIRENAME] + thisone = [] + for dep in deps: + # hey wait, this is me! + if ((pkg[rpm.RPMTAG_PROVIDENAME] is not None) and + (dep in pkg[rpm.RPMTAG_PROVIDENAME])): + continue + for f in pkg.hdr.fiFromHeader(): + if f[0] == dep: + continue + # ignore rpmlib stuff + if dep.startswith("rpmlib("): + continue + p = depMatch(dep, self.grpset.hdrlist) + # don't care about self referential deps + if p == pkg.nevra(): + continue + if p in checked or p in tocheck or p in pkgs: + continue + if p is None: +# log("ERROR: unable to resolve dep %s" %(dep,)) + continue + + self.grpset.hdrlist[p].select() + # FIXME: this is a hack so we can make sure the + # usecount is bumped high enough for + # langsupport packages + self.grpset.hdrlist[p].usecount += uses - 1 + + pkgs.append(p) + thisone.append(p) + pkg.addDeps(thisone) + else: + deps = pkg.dependencies + for dep in deps: + # if we've already checked for this package, don't worry + if dep in checked or dep in tocheck or dep in pkgs: + continue + # hmm, not in the header list. we can't do much but + # hope for the best + if not self.grpset.hdrlist.has_key(dep): + log("Package %s requires %s which we don't have" + %(tocheck, dep)) + continue + self.grpset.hdrlist[dep].select() + # FIXME: this is a hack so we can make sure the usecount + # is bumped high enough for langsupport packages + self.grpset.hdrlist[dep].usecount += uses - 1 + pkgs.append(dep) + checked.append(pkgnevra) # FIXME: this doesn't seem like the right place for it, but ... :/ @@ -409,19 +556,18 @@ class Group: deps = pkg.dependencies for dep in deps: + # if we've already checked for this package, don't worry + if dep in checked or dep in tocheck or dep in pkgs: + continue # hmm, not in the header list. we can't do much but # hope for the best if not self.grpset.hdrlist.has_key(dep): log("Package %s requires %s which we don't have" %(tocheck, dep)) continue - # if we've already checked for this package, don't worry - if dep in checked: - continue - sys.stdout.flush() self.grpset.hdrlist[dep].unselect() - pkgs.append(nevra(self.grpset.hdrlist[dep])) - checked.append(dep) + pkgs.append(dep) + checked.append(pkgnevra) # forInclude is whether this group is an include from a previous @@ -436,6 +582,10 @@ class Group: self.usecount = self.usecount + 1 if not forInclude: self.manual_state = MANUAL_ON + + for grpid in self.groupreqs: + self.grpset.groups[grpid].select(forInclude = (not subAsInclude)) + if self.usecount > 1: return @@ -445,12 +595,12 @@ class Group: if pkg["type"] == PKGTYPE_OPTIONAL: continue pkg["state"] = ON - hdrlist[pkgnevra].select() - selected.append(pkgnevra) - self.selectDeps(selected) - - for grpid in self.groupreqs: - self.grpset.groups[grpid].select(forInclude = (not subAsInclude)) + if pkg["meta"] == 0: + hdrlist[pkgnevra].select() + selected.append(pkgnevra) + self.selectDeps([pkgnevra]) + else: + self.grpset.groups[pkgnevra].select(forInclude = 1) # manual package selection def selectPackage(self, pkgnevra): @@ -458,8 +608,11 @@ class Group: if pkg["state"] in ON_STATES: return pkg["state"] = ON - self.grpset.hdrlist[pkgnevra].select() - self.selectDeps([pkgnevra]) + if pkg["meta"] == 0: + self.grpset.hdrlist[pkgnevra].select() + self.selectDeps([pkgnevra]) + else: + self.grpset.groups[pkgnevra].select(forInclude = 1) def unselect(self, forInclude = 0): hdrlist = self.grpset.hdrlist @@ -471,6 +624,10 @@ class Group: if not forInclude: self.manual_state = MANUAL_OFF if self.usecount < 0: log("WARNING: usecount for %s < 0 (%d)" %(self.id, self.usecount)) + + for grpid in self.groupreqs: + self.grpset.groups[grpid].unselect(forInclude = 1) + if self.usecount > 0: return @@ -479,21 +636,24 @@ class Group: pkgnevra = pkg["nevra"] if pkg["state"] not in ON_STATES: continue - hdrlist[pkgnevra].unselect() pkg["state"] = OFF - selected.append(pkgnevra) - self.unselectDeps(selected) - - for grpid in self.groupreqs: - self.grpset.groups[grpid].unselect(forInclude = 1) + if pkg["meta"] == 0: + hdrlist[pkgnevra].unselect() + selected.append(pkgnevra) + self.unselectDeps([pkgnevra]) + else: + self.grpset.groups[pkgnevra].unselect(forInclude = 1) def unselectPackage(self, pkgnevra): pkg = self.packages[pkgnevra] if pkg["state"] not in ON_STATES: return - self.grpset.hdrlist[pkgnevra].unselect() pkg["state"] = OFF - self.unselectDeps([pkgnevra]) + if pkg["meta"] == 0: + self.grpset.hdrlist[pkgnevra].unselect() + self.unselectDeps([pkgnevra]) + else: + self.grpset.groups[pkgnevra].unselect(forInclude = 1) def isSelected(self, justManual = 0): if justManual: @@ -531,13 +691,7 @@ class Group: tocheck.append(m) return 0 - def getDescription(self): - if self.id == "everything": - return _("This group includes all the packages available. " - "Note that there are substantially more packages than " - "just the ones in all the other package groups on " - "this page.") return self.description @@ -573,11 +727,14 @@ class GroupSet: %(xmlgrp.id, id)) continue group.addGroupRequires(id) - # FIXME: need to add back metapkgs - - def mergePackageDeps(self): - self.hdrlist.mergePackageDeps(self.compsxml.packages) + for id in xmlgrp.metapkgs.keys(): + if not self.groups.has_key(id): + log("%s references component %s which doesn't exist" + %(xmlgrp.id, id)) + continue + group.addMetaPkg(xmlgrp.metapkgs[id]) + def selectGroup(self, group, asMeta = 0): if self.groups.has_key(group): @@ -590,9 +747,13 @@ class GroupSet: raise KeyError, "No such group %s" %(group,) def unselectAll(self): + # force everything to be in an off state for group in self.groups.values(): - if group.isSelected(justManual = 1): - group.unselect() + group.usecount = 0 + group.manual_state = MANUAL_NONE + for pkg in self.hdrlist.pkgs.values(): + pkg.usecount = 0 + pkg.manual_state = MANUAL_NONE def getSelectionState(self): grpst = [] @@ -656,7 +817,7 @@ class GroupSet: return kernelVersions -def groupSetFromCompsFile(filename, hdrlist): +def groupSetFromCompsFile(filename, hdrlist, doSelect = 1): import urllib2 tries = 0 @@ -683,12 +844,16 @@ def groupSetFromCompsFile(filename, hdrlist): file.close() grpset = GroupSet(compsxml, hdrlist) - grpset.mergePackageDeps() + # precache provides of base and core. saves us about 10% time-wise + for pnevra in (grpset.groups["base"].packages.keys() + + grpset.groups["core"].packages.keys()): + for prov in grpset.hdrlist[pnevra][rpm.RPMTAG_PROVIDENAME]: + cached[prov] = pnevra - for group in grpset.groups.values(): - if group.default: - group.select() - + if doSelect: + for group in grpset.groups.values(): + if group.default: + group.select() return grpset def getGroupDescription(group): @@ -761,7 +926,7 @@ def orderPackageGroups(grpset): return (retlist, retdict) if __name__ == "__main__": - tree = "/mnt/test/latest-taroon-i386/" + tree = "/mnt/redhat/test/katzj2/i386/i386/" def simpleInstallCallback(what, amount, total, h, (param)): global rpmfd @@ -819,13 +984,9 @@ if __name__ == "__main__": hdrlist = HeaderList(hdrs) hdrlist.mergeFullHeaders(tree + "/RedHat/base/hdlist2") showMem() - hdrlist.mergePackageDeps(comps.packages) - showMem() groups = GroupSet(comps, hdrlist) showMem() -# sys.exit(0) - ts = rpm.TransactionSet("/tmp/testinstall") ts.setVSFlags(-1) ts.setFlags(rpm.RPMTRANS_FLAG_ANACONDA) @@ -303,7 +303,9 @@ class CdromInstallMethod(ImageInstallMethod): def __init__(self, url, messageWindow, progressWindow, rootPath): - (self.device, tree) = string.split(url, "/", 1) + (self.device, tree) = string.split(url, ":", 1) + if not tree.startswith("/"): + tree = "/%s" %(tree,) self.messageWindow = messageWindow self.progressWindow = progressWindow self.loopbackFile = None @@ -324,7 +326,7 @@ class CdromInstallMethod(ImageInstallMethod): else: self.currentDisc = [ 1 ] - ImageInstallMethod.__init__(self, "/" + tree, rootPath) + ImageInstallMethod.__init__(self, tree, rootPath) class NfsInstallMethod(ImageInstallMethod): diff --git a/instdata.py b/instdata.py index 0452143dd..218612889 100644 --- a/instdata.py +++ b/instdata.py @@ -165,17 +165,27 @@ class InstallData: and group.id != "core"): f.write("@ %s\n" % group.id) -# 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 - + # handle metapkgs. this is a little weird + for (pkgnevra, pkg) in group.packages.items(): + if pkg["meta"] == 0: + continue + metapkg = self.grpset.groups[pkgnevra] + # if it's optional and turned on, put it in the ks.cfg + if (metapkg.isSelected() and + pkg["type"] == hdrlist.PKGTYPE_OPTIONAL): + f.write("@ %s\n" %(metapkg.id,)) + # if it's default and turned off, then turn off the + # component packages (we dont' have a -@grp syntax) + elif (not metapkg.isSelected() and + pkg["type"] == hdrlist.PKGTYPE_DEFAULT): + for (pkgnevra, pkg) in metapkg.packages.items(): + name = self.grpset.hdrlist[pkgnevra].name + forcedoff[name] = 1 + + # handle packages for (pkgnevra, pkg) in group.packages.items(): + if pkg["meta"] != 0: + continue name = self.grpset.hdrlist[pkgnevra].name # if it's in base or core, it really should be installed if group.id == "base" or group.id == "core": diff --git a/isomd5sum/Makefile b/isomd5sum/Makefile index a4d605fd8..368e43207 100644 --- a/isomd5sum/Makefile +++ b/isomd5sum/Makefile @@ -1,14 +1,30 @@ include ../Makefile.inc -all: - gcc -c -O -g -fPIC -D_FILE_OFFSET_BITS=64 md5.c - gcc -c -O -g -fPIC -D_FILE_OFFSET_BITS=64 libimplantisomd5.c - gcc -O -g -D_FILE_OFFSET_BITS=64 -o implantisomd5 implantisomd5.c libimplantisomd5.o md5.o -lm -lpopt - gcc -c -O -g -fPIC -D_FILE_OFFSET_BITS=64 libcheckisomd5.c - gcc -O -g -D_FILE_OFFSET_BITS=64 -o checkisomd5 checkisomd5.c libcheckisomd5.o md5.o -lm +CFLAGS = -g -fPIC -D_FILE_OFFSET_BITS=64 -I$(PYTHONINCLUDE) -O +OBJECTS = md5.o libimplantisomd5.o checkisomd5.o pyisomd5sum.c \ + implantisomd5 checkisomd5 +SOURCES = $(patsubst %.o,%.c,$(OBJECTS)) +LDFLAGS = -lpopt - gcc -c -O -g -fPIC -o pyisomd5sum.lo pyisomd5sum.c -I$(PYTHONINCLUDE) - gcc -shared -g -o pyisomd5sum.so -fpic pyisomd5sum.lo libcheckisomd5.o libimplantisomd5.o md5.o +PYOBJS = pyisomd5sum.o libcheckisomd5.o libimplantisomd5.o md5.o + +ifeq (.depend,$(wildcard .depend)) +TARGET=all +else +TARGET=depend all +endif + +all: implantisomd5 checkisomd5 pyisomd5sum.so + +%.o: %.c + gcc -c -O $(CFLAGS) -o $@ $< + +implantisomd5: implantisomd5.o md5.o libimplantisomd5.o + +checkisomd5: checkisomd5.o md5.o libcheckisomd5.o + +pyisomd5sum.so: $(PYOBJS) + gcc -shared -g -o pyisomd5sum.so -fpic $(PYOBJS) install: install -m 755 implantisomd5 $(DESTDIR)/$(RUNTIMEDIR) @@ -16,7 +32,13 @@ install: install -s pyisomd5sum.so $(DESTDIR)/$(RUNTIMEDIR) clean: - rm -f *.o *.lo *.so *.pyc + rm -f *.o *.lo *.so *.pyc .depend *~ rm -f implantisomd5 checkisomd5 depend: + $(CPP) -M $(CFLAGS) -I$(PYTHONINCLUDE) *.c > .depend + + +ifeq (.depend,$(wildcard .depend)) +include .depend +endif diff --git a/isys/isys.c b/isys/isys.c index 5083daa72..34f8b6f26 100644 --- a/isys/isys.c +++ b/isys/isys.c @@ -90,6 +90,7 @@ static PyObject * doIsIdeRemovable(PyObject * s, PyObject * args); static PyObject * doEjectCdrom(PyObject * s, PyObject * args); static PyObject * doVtActivate(PyObject * s, PyObject * args); static PyObject * doisPsudoTTY(PyObject * s, PyObject * args); +static PyObject * doisVioConsole(PyObject * s); static PyObject * doSync(PyObject * s, PyObject * args); static PyObject * doisIsoImage(PyObject * s, PyObject * args); static PyObject * dogetGeometry(PyObject * s, PyObject * args); @@ -142,6 +143,7 @@ static PyMethodDef isysModuleMethods[] = { { "isIdeRemovable", (PyCFunction) doIsIdeRemovable, METH_VARARGS, NULL}, { "vtActivate", (PyCFunction) doVtActivate, METH_VARARGS, NULL}, { "isPsudoTTY", (PyCFunction) doisPsudoTTY, METH_VARARGS, NULL}, + { "isVioConsole", (PyCFunction) doisVioConsole, METH_NOARGS, NULL}, { "sync", (PyCFunction) doSync, METH_VARARGS, NULL}, { "isisoimage", (PyCFunction) doisIsoImage, METH_VARARGS, NULL}, { "getGeometry", (PyCFunction) dogetGeometry, METH_VARARGS, NULL}, @@ -982,7 +984,6 @@ static PyObject * doRaidStop(PyObject * s, PyObject * args) { } static PyObject * doLoadFont (PyObject * s, PyObject * args) { - char * font; int ret; if (!PyArg_ParseTuple(args, "")) return NULL; @@ -1263,6 +1264,10 @@ static PyObject * doisPsudoTTY(PyObject * s, PyObject * args) { return Py_BuildValue("i", (major(sb.st_rdev) == 3)); } +static PyObject * doisVioConsole(PyObject * s) { + return Py_BuildValue("i", isVioConsole()); +} + static PyObject * doSync(PyObject * s, PyObject * args) { int fd; diff --git a/isys/isys.h b/isys/isys.h index 7f594543c..ccbf45703 100644 --- a/isys/isys.h +++ b/isys/isys.h @@ -19,4 +19,7 @@ int fileIsIso(const char * file); /* returns 1 for link, 0 for no link, -1 for unknown */ int get_link_status(char *ifname); +/* returns 1 if on an iSeries vio console, 0 otherwise */ +int isVioConsole(void); + #endif diff --git a/isys/isys.py b/isys/isys.py index 8d26d4f55..f7e89b321 100644 --- a/isys/isys.py +++ b/isys/isys.py @@ -591,4 +591,5 @@ def startBterm(): printObject = _isys.printObject bind_textdomain_codeset = _isys.bind_textdomain_codeset +isVioConsole = _isys.isVioConsole diff --git a/isys/probe.h b/isys/probe.h index 7f6f013ac..2bbaa3c27 100644 --- a/isys/probe.h +++ b/isys/probe.h @@ -94,4 +94,5 @@ int vioGetCdDevs(struct knownDevices * devices); int readFD (int fd, char **buf); void addDevice(struct knownDevices * devices, struct kddevice dev); int deviceKnown(struct knownDevices * devices, char * dev); +int isUsableDasd(char *device); #endif diff --git a/isys/smp.c b/isys/smp.c index 5478e14a6..0e32edd1d 100644 --- a/isys/smp.c +++ b/isys/smp.c @@ -337,6 +337,7 @@ static int groupForSMP(int mode) if (!strncmp(cth.oem_id, "IBM ENSW", 8) && (!strncmp(cth.product_id, "NF 6000R", 8) || !strncmp(cth.product_id, "VIGIL SMP", 9) || + !strncmp(cth.product_id, "EXA", 3) || !strncmp(cth.product_id, "RUTHLESS", 8))) return 1; return 0; diff --git a/isys/vio.c b/isys/vio.c index bad6ac708..1d4ffb13f 100644 --- a/isys/vio.c +++ b/isys/vio.c @@ -172,3 +172,45 @@ int vioGetDasdDevs(struct knownDevices * devices) { return 0; #endif } + +int isVioConsole(void) { +#if !defined(__powerpc__) + return 0; +#else + int fd, i; + char *buf, *start; + char driver[50], device[50]; + static int isviocons = -1; + + if (isviocons != -1) + return isviocons; + + fd = open("/proc/tty/drivers", O_RDONLY); + if (fd < 0) { + fprintf(stderr, "failed to open /proc/tty/drivers!\n"); + return 0; + } + i = readFD(fd, &buf); + if (i == -1) { + close(fd); + free(buf); + fprintf(stderr, "error reading /proc/tty/drivers!\n"); + return 0; + } + isviocons = 0; + start = buf; + while (start && *start) { + if (sscanf(start, "%s %s", &driver, &device) == 2) { + if (!strcmp(driver, "vioconsole") && !strcmp(device, "/dev/tty")) { + isviocons = 1; + break; + } + } + start = strchr(start, '\n'); + if (start) + start++; + } + free(buf); + return isviocons; +#endif +} @@ -16,6 +16,7 @@ import types, os, sys, isys, select, string, stat, signal import os.path from rhpl.log import log +from flags import flags def getArch (): arch = os.uname ()[4] @@ -560,3 +561,27 @@ def getPPCMacBook(): if not string.find(string.lower(line), 'book') == -1: return 1 return 0 + +def writeRpmPlatform(root="/"): + import rhpl.arch + + if flags.test: + return + if os.access("%s/etc/rpm/platform" %(root,), os.R_OK): + return + if not os.access("%s/etc/rpm" %(root,), os.X_OK): + os.mkdir("%s/etc/rpm" %(root,)) + f = open("%s/etc/rpm/platform" %(root,), 'w+') + f.write("%s-redhat-linux\n" %(rhpl.arch.canonArch,)) + f.close() + + # FIXME: writing /etc/rpm/macros feels wrong somehow + # temporary workaround for #92285 + if os.access("%s/etc/rpm/macros" %(root,), os.R_OK): + return + if not (rhpl.arch.canonArch.startswith("ppc64") or + rhpl.arch.canonArch in ("s390x", "sparc64", "x86_64")): + return + f = open("%s/etc/rpm/macros" %(root,), 'w+') + f.write("_transaction_color 3\n") + f.close() diff --git a/iw/package_gui.py b/iw/package_gui.py index 30e7d8c36..9468e3056 100644 --- a/iw/package_gui.py +++ b/iw/package_gui.py @@ -579,7 +579,7 @@ class PackageSelectionWindow (InstallWindow): continue if newstate: - sel = c.isSelected() + sel = c.isSelected(justManual = 1) # print "saving ",c.name," at state ",sel if savestate: self.savedStateDict[c.id] = sel diff --git a/iw/partition_dialog_gui.py b/iw/partition_dialog_gui.py index 91490875b..3edd3548d 100644 --- a/iw/partition_dialog_gui.py +++ b/iw/partition_dialog_gui.py @@ -164,6 +164,7 @@ class PartitionEditor: else: request.start = self.startcylspin.get_value_as_int() request.end = self.endcylspin.get_value_as_int() + request.primary = primonly if request.end <= request.start: self.intf.messageWindow(_("Error With Request"), diff --git a/iw/partition_gui.py b/iw/partition_gui.py index 9bd537481..0a9cf8c3f 100644 --- a/iw/partition_gui.py +++ b/iw/partition_gui.py @@ -1184,7 +1184,7 @@ class PartitionWindow(InstallWindow): def makeLvmCB(self, widget): if (not fileSystemTypeGet('physical volume (LVM)').isSupported() or - lvm.lvmDevicePresent == 0): + not lvm.has_lvm()): self.intf.messageWindow(_("Not supported"), _("LVM is NOT supported on " "this platform."), type="ok", diff --git a/iw/xconfig_gui.py b/iw/xconfig_gui.py index 7917a0121..9e4999ccc 100644 --- a/iw/xconfig_gui.py +++ b/iw/xconfig_gui.py @@ -653,6 +653,7 @@ class MonitorWindow (InstallWindow): keys = monitorslist.keys () keys.sort () + # treat Generic monitors special idx = 0 for man in ["Generic LCD Display", "Generic CRT Display", "Generic"]: if man in keys: @@ -697,7 +698,7 @@ class MonitorWindow (InstallWindow): toplevels[man] = self.monitorstore.append(None) self.monitorstore.set_value(toplevels[man], 0, man) - + previous_monitor = "" for amonitor in models: if previous_monitor != "": diff --git a/kickstart.py b/kickstart.py index 0c7b09a12..5aad8600f 100644 --- a/kickstart.py +++ b/kickstart.py @@ -1202,7 +1202,7 @@ class KickstartBase(BaseInstallClass): for script in self.tracebackScripts: script.run("/", self.serial) - # Note that this assumes setGroupSelection() is called after + # Note that this assumes setGroupSelection() is called before # setPackageSelection() def setPackageSelection(self, hdlist, intf): for n in self.packageList: @@ -1228,7 +1228,7 @@ class KickstartBase(BaseInstallClass): def setGroupSelection(self, grpset, intf): grpset.unselectAll() - + grpset.selectGroup("base") for n in self.groupList: try: @@ -1251,7 +1251,7 @@ class KickstartBase(BaseInstallClass): sys.exit(1) else: pass - + for n in self.excludedList: if grpset.hdrlist.has_key(n): grpset.hdrlist[n].unselect(isManual = 1) diff --git a/loader2/cdinstall.c b/loader2/cdinstall.c index 3d633c000..7d1f4c9f2 100644 --- a/loader2/cdinstall.c +++ b/loader2/cdinstall.c @@ -299,7 +299,7 @@ char * setupCdrom(char * location, for (i = 0; i < kd->numKnown; i++) { if (kd->known[i].class != CLASS_CDROM) continue; buf = malloc(200); - sprintf(buf, "cdrom://%s/mnt/source", kd->known[i].name); + sprintf(buf, "cdrom://%s:/mnt/source", kd->known[i].name); return buf; } } @@ -328,7 +328,7 @@ char * setupCdrom(char * location, queryCDMediaCheck(kd->known[i].name, flags); buf = malloc(200); - sprintf(buf, "cdrom://%s/mnt/source", kd->known[i].name); + sprintf(buf, "cdrom://%s:/mnt/source", kd->known[i].name); return buf; } diff --git a/loader2/driverdisk.c b/loader2/driverdisk.c index 73a5ca2d4..ec063193f 100644 --- a/loader2/driverdisk.c +++ b/loader2/driverdisk.c @@ -56,7 +56,18 @@ static int verifyDriverDisk(char *mntpt, int flags) { } } - /* side effect: file is still mntpt/rhdd-6.1 */ + /* check for both versions */ + sprintf(file, "%s/rhdd", mntpt); + if (!access(file, R_OK)) { + logMessage("not a new format driver disk, checking for old"); + sprintf(file, "%s/rhdd-6.1", mntpt); + if (!access(file, R_OK)) { + logMessage("can't find either driver disk identifier, bad " + "driver disk"); + } + } + + /* side effect: file is still mntpt/ddident */ stat(file, &sb); if (!sb.st_size) return LOADER_BACK; @@ -74,9 +85,19 @@ static int loadDriverDisk(moduleInfoSet modInfo, moduleList modLoaded, struct moduleBallLocation * location; struct stat sb; static int disknum = 0; + int version = 1; int fd; - sprintf(file, "%s/rhdd-6.1", mntpt); + /* check for both versions */ + sprintf(file, "%s/rhdd", mntpt); + if (!access(file, R_OK)) { + version = 0; + sprintf(file, "%s/rhdd-6.1", mntpt); + if (!access(file, R_OK)) { + /* this can't happen, we already verified it! */ + return LOADER_BACK; + } + } stat(file, &sb); title = malloc(sb.st_size + 1); @@ -101,6 +122,7 @@ static int loadDriverDisk(moduleInfoSet modInfo, moduleList modLoaded, location = malloc(sizeof(struct moduleBallLocation)); location->title = strdup(title); location->path = sdupprintf("/tmp/ramfs/DD-%d/modules.cgz", disknum); + location->version = version; sprintf(file, "%s/modinfo", mntpt); readModuleInfo(file, modInfo, location, 1); diff --git a/loader2/hardware.c b/loader2/hardware.c index 509fd4cb5..24e6d2381 100644 --- a/loader2/hardware.c +++ b/loader2/hardware.c @@ -329,12 +329,14 @@ void dasdSetup(moduleList modLoaded, moduleDeps modDeps, strcpy(parms,"dasd="); strcat(parms, ports); dasd_parms[0] = parms; - simpleRemoveLoadedModule("dasd_eckd_mod", modLoaded, flags); - simpleRemoveLoadedModule("dasd_fba_mod", modLoaded, flags); - simpleRemoveLoadedModule("dasd_diag_mod", modLoaded, flags); - simpleRemoveLoadedModule("dasd_mod", modLoaded, flags); - reloadUnloadedModule("dasd_mod", modLoaded, dasd_parms, flags); - reloadUnloadedModule("dasd_eckd_mod", modLoaded, NULL, flags); + removeLoadedModule("dasd_eckd_mod", modLoaded, flags); + removeLoadedModule("dasd_fba_mod", modLoaded, flags); + removeLoadedModule("dasd_diag_mod", modLoaded, flags); + removeLoadedModule("dasd_mod", modLoaded, flags); + mlLoadModule("dasd_mod", modLoaded, modDeps, modInfo, + dasd_parms, flags); + mlLoadModuleSet("dasd_diag_mod:dasd_fba_mod:dasd_eckd_mod", + modLoaded, modDeps, modInfo, flags); free(dasd_parms); free(ports); } diff --git a/loader2/hdinstall.c b/loader2/hdinstall.c index fff21a518..3941c1fea 100644 --- a/loader2/hdinstall.c +++ b/loader2/hdinstall.c @@ -50,7 +50,7 @@ int isPartitionName(char *pname) { return 0; /* if it has a '/' in it then treat it specially */ - if (strchr(pname, '/')) { + if (strchr(pname, '/') && !strstr(pname, "iseries")) { /* assume its either a /dev/ida/ or /dev/cciss device */ /* these have form of c?d?p? if its a partition */ return strchr(pname, 'p') != NULL; @@ -160,6 +160,7 @@ int lenPartitionsList(char **list) { char **part; int rc; + if (!list) return 0; for (rc = 0, part = list; *part; rc++, part++); return rc; @@ -199,6 +200,15 @@ static int loadHDImages(char * prefix, char * dir, int flags, return 1; } + /* handle updates.img now before we copy stage2 over... this allows + * us to keep our ramdisk size as small as possible */ + sprintf(path, "%s/%s/RedHat/base/updates.img", prefix, dir ? dir : ""); + copyUpdatesImg(path); + + rc = copyFileAndLoopbackMount(fd, "/tmp/ramfs/hdstg2.img", flags, + device, mntpoint); + close(fd); + if (!verifyStamp(mntpoint)) { char * buf; buf = sdupprintf(_("The %s installation tree in that directory does " @@ -210,15 +220,6 @@ static int loadHDImages(char * prefix, char * dir, int flags, return 1; } - /* handle updates.img now before we copy stage2 over... this allows - * us to keep our ramdisk size as small as possible */ - sprintf(path, "%s/%s/RedHat/base/updates.img", prefix, dir ? dir : ""); - copyUpdatesImg(path); - - rc = copyFileAndLoopbackMount(fd, "/tmp/ramfs/hdstg2.img", flags, - device, mntpoint); - close(fd); - return rc; } @@ -494,7 +495,7 @@ char * mountHardDrive(struct installMethod * method, label = newtLabel(-1, -1, _("Directory holding images:")); - dirEntry = newtEntry(28, 11, dir, 28, &tmpDir, NEWT_ENTRY_SCROLL); + dirEntry = newtEntry(28, 11, dir, 28, (const char **) &tmpDir, NEWT_ENTRY_SCROLL); /* if we had ks data around use it to prime entry, then get rid of it*/ if (ksdirectory) { diff --git a/loader2/lang.c b/loader2/lang.c index 52cf0ed77..7450f7162 100644 --- a/loader2/lang.c +++ b/loader2/lang.c @@ -36,6 +36,7 @@ #include "../isys/stubs.h" #include "../isys/cpio.h" #include "../isys/lang.h" +#include "../isys/isys.h" static int startBterm(int flags); @@ -228,7 +229,7 @@ static int setupLanguage(int choice, int flags) { /* load the language only if it is displayable. if they're using * a serial console, we hope it's smart enough */ if (!strcmp(languages[choice].font, "bterm") && !FL_SERIAL(flags) && - startBterm(flags)) { + !isVioConsole() && startBterm(flags)) { if (FL_KICKSTART(flags)) return 0; newtWinMessage("Language Unavailable", "OK", @@ -385,9 +386,10 @@ int chooseLanguage(char ** lang, int flags) { if (i == numLanguages) abort(); /* load the language only if it is displayable. assume that if they're - * on a serial console that their terminal is smart. */ + * on a serial console or iSeries vioconsole that their terminal is + * smart. */ if (!strcmp(languages[choice].font, "bterm") && !FL_SERIAL(flags) && - startBterm(flags)) { + !isVioConsole() && startBterm(flags)) { newtWinMessage("Language Unavailable", "OK", "%s display is unavailable in text mode. The " "installation will continue in English until the " diff --git a/loader2/linuxrc.s390 b/loader2/linuxrc.s390 index df964865d..b20a6abcf 100644 --- a/loader2/linuxrc.s390 +++ b/loader2/linuxrc.s390 @@ -232,6 +232,8 @@ if [ ":$NETTYPE" = ":ctc" -o ":$NETTYPE" = ":escon" ]; then ifconfig $DEVICE $IPADDR $MMTU pointopoint $GATEWAY route add -host $IPADDR dev $DEVICE 2>/dev/null elif [ ":$NETTYPE" = ":iucv" ]; then + insmod fsm$LO + insmod iucv$LO insmod netiucv$LO $IUCV ifconfig $DEVICE $IPADDR $MMTU pointopoint $GATEWAY route add -host $IPADDR dev $DEVICE 2>/dev/null diff --git a/loader2/loader.c b/loader2/loader.c index 00423aba8..60c870b6a 100644 --- a/loader2/loader.c +++ b/loader2/loader.c @@ -688,6 +688,11 @@ static char *doLoaderMain(char * location, if (url && !FL_RESCUE(flags)) return url; } + /* iSeries vio console users will be telnetting in to the primary + partition, so use a terminal type that is appripriate */ + if (isVioConsole()) + setenv("TERM", "vt100", 1); + startNewt(flags); step = STEP_LANG; @@ -984,6 +989,7 @@ int main(int argc, char ** argv) { /* JKFIXME: very very bad hack */ secondStageModuleLocation = malloc(sizeof(struct moduleBallLocation)); secondStageModuleLocation->path = strdup("/mnt/runtime/modules/modules.cgz"); + secondStageModuleLocation->version = CURRENT_MODBALLVER; if (!strcmp(argv[0] + strlen(argv[0]) - 6, "insmod")) return ourInsmodCommand(argc, argv); diff --git a/loader2/modstubs.c b/loader2/modstubs.c index 9e3f71f2a..e783ced94 100644 --- a/loader2/modstubs.c +++ b/loader2/modstubs.c @@ -25,10 +25,16 @@ #include <sys/wait.h> #include "modstubs.h" +#include "modules.h" #include "../isys/cpio.h" #include "../isys/stubs.h" +static int usage() { + fprintf(stderr, "usage: insmod [-p <path>] <module>.o\n"); + return 1; +} + int ourInsmodCommand(int argc, char ** argv) { char * file; char finalName[100]; @@ -37,21 +43,28 @@ int ourInsmodCommand(int argc, char ** argv) { int rc, rmObj = 0; char * ballPath = NULL; char fullName[100]; - struct utsname u; - - uname(&u); + int version = 1; if (argc < 2) { - fprintf(stderr, "usage: insmod [-p <path>] <module>.o [params]\n"); - return 1; + return usage(); + } + + while (argc > 2) { + if (!strcmp(argv[1], "-p")) { + ballPath = malloc(strlen(argv[2]) + 30); + sprintf(ballPath, "%s/modules.cgz", argv[2]); + argv += 2; + argc -= 2; + } else if (!strcmp(argv[1], "--modballversion")) { + version = atoi(argv[2]); + argv += 2; + argc -= 2; + } else { + break; + } } - if (!strcmp(argv[1], "-p")) { - ballPath = malloc(strlen(argv[2]) + 30); - sprintf(ballPath, "%s/modules.cgz", argv[2]); - argv += 2; - argc -= 2; - } else { + if (!ballPath) { ballPath = strdup("/modules/modules.cgz"); } @@ -69,7 +82,8 @@ int ourInsmodCommand(int argc, char ** argv) { if (chptr) file = chptr + 1; sprintf(finalName, "/tmp/%s", file); - sprintf(fullName, "%s/%s", u.release, file); + /* XXX: leak */ + sprintf(fullName, "%s/%s", getModuleLocation(version), file); if (installCpioFile(fd, fullName, finalName, 0)) { free(ballPath); diff --git a/loader2/moduleinfo.h b/loader2/moduleinfo.h index becee0e74..8c6bd3966 100644 --- a/loader2/moduleinfo.h +++ b/loader2/moduleinfo.h @@ -33,7 +33,14 @@ struct moduleBallLocation { char * path; /* path to module ball that this driver is from. if NULL, * implies /modules/modules.cgz */ char * title; /* title used for driver disk -- may be NULL */ + int version; /* module ball version, used to determine layout */ }; +#define CURRENT_MODBALLVER 1 + +/* valid moduleball versions + * 0: old single-arch module ball, modules are in uname.release + * 1: multi-arch, modules are in uname.release/arch + */ typedef struct moduleInfoSet_s * moduleInfoSet; diff --git a/loader2/modules.c b/loader2/modules.c index b0df111ee..b9fad4f38 100644 --- a/loader2/modules.c +++ b/loader2/modules.c @@ -483,7 +483,7 @@ static int doLoadModules(const char * origModNames, moduleList modLoaded, } /* here we need to save the state of stage2 */ - simpleRemoveLoadedModule("usb-storage", modLoaded, flags); + removeLoadedModule("usb-storage", modLoaded, flags); /* JKFIXME: here are the big hacks... for now, just described. * 1) figure out which scsi devs are claimed by usb-storage. @@ -510,7 +510,7 @@ static int doLoadModules(const char * origModNames, moduleList modLoaded, } if (reloadUsbStorage) { - reloadUnloadedModule("usb-storage", modLoaded, NULL, flags); + mlLoadModule("usb-storage", modLoaded, modDeps, modInfo, NULL, flags); /* JKFIXME: here's the rest of the hacks. basically do the reverse * of what we did before. */ @@ -701,6 +701,40 @@ void writeScsiDisks(moduleList list) { return; } +char * getModuleLocation(int version) { + struct utsname u; + static char * arch = NULL; + const char * archfile = "/etc/arch"; + char * ret; + + uname(&u); + + if (!arch) { + struct stat sb; + int fd; + + stat(archfile, &sb); + arch = malloc(sb.st_size + 1); + + fd = open(archfile, O_RDONLY); + read(fd, arch, sb.st_size); + if (arch[sb.st_size -1 ] == '\n') + sb.st_size--; + arch[sb.st_size] = '\0'; + close(fd); + } + + if (version == 1) { + ret = malloc(strlen(u.release) + strlen(arch) + 1); + sprintf(ret, "%s/%s", u.release, arch); + return ret; + } else { + ret = malloc(strlen(u.release) + 1); + strcpy(ret, u.release); + return ret; + } +} + /* JKFIXME: needs a way to know about module locations. also, we should * extract them to a ramfs instead of /tmp */ static struct extractedModule * extractModules (char * const * modNames, @@ -715,15 +749,15 @@ static struct extractedModule * extractModules (char * const * modNames, char fn[255]; const char * failedFile; struct stat sb; - struct utsname u; - - uname(&u); + char * modpath; - /* JKFIXME: handle driver disk path somehow */ - if (!location) + if (!location) { ballPath = strdup("/modules/modules.cgz"); - else + modpath = getModuleLocation(CURRENT_MODBALLVER); + } else { ballPath = strdup(location->path); + modpath = getModuleLocation(location->version); + } fd = gunzip_open(ballPath); if (!fd) { @@ -744,9 +778,9 @@ static struct extractedModule * extractModules (char * const * modNames, for (m = modNames, i = 0, numMaps = 0; *m; m++, i++) { /* if we don't know the path of this module yet, "figure" it out */ if (!oldPaths[i].path) { - map[numMaps].archivePath = alloca(strlen(u.release) + + map[numMaps].archivePath = alloca(strlen(modpath) + strlen(*m) + 25); - sprintf(map[numMaps].archivePath, "%s/%s.o", u.release, *m); + sprintf(map[numMaps].archivePath, "%s/%s.o", modpath, *m); map[numMaps].fsPath = alloca(10 + strlen(*m)); sprintf(map[numMaps].fsPath, "/tmp/%s.o", *m); unlink(map[numMaps].fsPath); @@ -758,6 +792,7 @@ static struct extractedModule * extractModules (char * const * modNames, if (!numMaps) { gunzip_close(fd); free(ballPath); + free(modpath); return oldPaths; } @@ -787,18 +822,17 @@ static struct extractedModule * extractModules (char * const * modNames, } free(ballPath); + free(modpath); return oldPaths; } -/* simple removal of a loaded module which is going to be reloaded. - * Note that this doesn't remove the module from the modLoaded struct - * but we do update the loadedModuleInfo to reflect the fact that its using - * no devices anymore. +/* remove a module which has been loaded, including removal from the + * modLoaded struct */ -int simpleRemoveLoadedModule(const char * modName, moduleList modLoaded, - int flags) { +int removeLoadedModule(const char * modName, moduleList modLoaded, + int flags) { int status, rc = 0; pid_t child; struct loadedModuleInfo * mod; @@ -834,70 +868,25 @@ int simpleRemoveLoadedModule(const char * modName, moduleList modLoaded, if (!WIFEXITED(status) || WEXITSTATUS(status)) { rc = 1; } else { - rc = 0; - } - } - return rc; -} - -/* simple reinsertion of a module; just looks for the module and reloads it - * if we think it was already loaded. we also update firstDevNum and - * lastDevNum to be current - */ -int reloadUnloadedModule(char * modName, moduleList modLoaded, - char ** args, int flags) { - char fileName[200]; - int rc, status; - pid_t child; - struct extractedModule * path = NULL; - char * list[2]; - int i; - - for (i = 0; i < modLoaded->numModules; i++) - if (!strcmp(modLoaded->mods[i].name, modName)) - break; - - if (i >= modLoaded->numModules) - return 0; - - modLoaded->mods[i].firstDevNum = scsiDiskCount(); - - list[0] = modName; - list[1] = NULL; - - path = extractModules(list, path, NULL); - - sprintf(fileName, "%s.o", modName); - - if (FL_TESTING(flags)) { - logMessage("would have insmod %s", fileName); - rc = 0; - } else { - logMessage("going to insmod %s", fileName); - - if (!(child = fork())) { - int fd = open("/dev/tty3", O_RDWR); - - dup2(fd, 0); - dup2(fd, 1); - dup2(fd, 2); - close(fd); - - rc = insmod(fileName, NULL, args); - _exit(rc); - } - - waitpid(child, &status, 0); + int found = -1; + int i; + + /* find our module. once we've found it, shutffle everything + * else back one */ + for (i = 0; i < modLoaded->numModules; i++) { + if (found > -1) { + modLoaded->mods[i - 1] = modLoaded->mods[i]; + } else if (!strcmp(modLoaded->mods[i].name, modName)) { + found = i; + free(modLoaded->mods[i].name); + free(modLoaded->mods[i].path); + } + } + modLoaded->numModules--; - if (!WIFEXITED(status) || WEXITSTATUS(status)) { - rc = 1; - } else { - rc = 0; + rc = 0; } } - - modLoaded->mods[i].lastDevNum = scsiDiskCount(); - logMessage("reloadModule returning %d", rc); return rc; } @@ -963,3 +952,4 @@ void loadKickstartModule(struct loaderData_s * loaderData, int argc, mlLoadModule(module, loaderData->modLoaded, *(loaderData->modDepsPtr), loaderData->modInfo, args, flags); } + diff --git a/loader2/modules.h b/loader2/modules.h index 7f43457c8..616da95aa 100644 --- a/loader2/modules.h +++ b/loader2/modules.h @@ -44,9 +44,8 @@ int mlLoadModuleSetLocation(const char * modNames, int mlModuleInList(const char * modName, moduleList list); void writeScsiDisks(moduleList list); -int simpleRemoveLoadedModule(const char * modName, moduleList modLoaded, +int removeLoadedModule(const char * modName, moduleList modLoaded, int flags); -int reloadUnloadedModule(char * modName, moduleList modLoaded, - char **, int flags); +char * getModuleLocation(int version); #endif diff --git a/loader2/net.c b/loader2/net.c index d8c6d1bcb..799580a38 100644 --- a/loader2/net.c +++ b/loader2/net.c @@ -706,6 +706,7 @@ int chooseNetworkInterface(struct knownDevices * kd, int deviceNums = 0; int deviceNum; char ** devices; + int foundDev = 0; /* JKFIXME: this is a lot bigger than it has to be.. */ devices = alloca((kd->numKnown + 1) * sizeof(*devices)); @@ -715,12 +716,17 @@ int chooseNetworkInterface(struct knownDevices * kd, devices[deviceNums++] = kd->known[i].name; + /* make sure that this device is disabled */ + pumpDisableInterface(kd->known[i].name); + /* this device has been set and we don't really need to ask * about it again... */ if (loaderData->netDev && (loaderData->netDev_set == 1) && !strcmp(loaderData->netDev, kd->known[i].name)) - return LOADER_NOOP; + foundDev = 1; } + if (foundDev == 1) + return LOADER_NOOP; devices[deviceNums] = NULL; diff --git a/loader2/otherinsmod.c b/loader2/otherinsmod.c deleted file mode 100644 index 881946533..000000000 --- a/loader2/otherinsmod.c +++ /dev/null @@ -1,161 +0,0 @@ -#include <stdio.h> -#include <string.h> -#include <unistd.h> -#include <fcntl.h> -#include <stdlib.h> -#include <sys/utsname.h> -#include <sys/wait.h> - -#include "cpio.h" -#include "isys.h" -#include "stubs.h" - -/* hack */ -int combined_insmod_main(int argc, char ** argv); - -int ourInsmodCommand(int argc, char ** argv) { - char * file; - char finalName[100]; - char * chptr; - gzFile fd; - int rc, rmObj = 0; - int sparc64 = 0, i; - char * ballPath = NULL; - char fullName[100]; - struct utsname u; - - uname(&u); - -#ifdef __sparc__ - if (!strcmp(u.machine, "sparc64")) - sparc64 = 1; -#endif - - if (argc < 2) { - fprintf(stderr, "usage: insmod [-p <path>] <module>.o [params]\n"); - return 1; - } - - if (!strcmp(argv[1], "-p")) { - ballPath = malloc(strlen(argv[2]) + 30); - sprintf(ballPath, "%s/%s", argv[2], sparc64 ? - "modules64.cgz" : "modules.cgz"); - argv += 2; - argc -= 2; - } else { - ballPath = strdup(sparc64 ? - "/modules/modules64.cgz" : - "/modules/modules.cgz"); - - } - - file = argv[1]; - - if (access(file, R_OK)) { - /* Try two balls on sparc64, one elsewhere */ - for (i = 0; ; i++) { - /* it might be having a ball */ - fd = gunzip_open(ballPath); - if (!fd) { - free(ballPath); - return 1; - } - - chptr = strrchr(file, '/'); - if (chptr) file = chptr + 1; - sprintf(finalName, "/tmp/%s", file); - - sprintf(fullName, "%s/%s", u.release, file); - - if (installCpioFile(fd, fullName, finalName, 0)) { - if (i < sparc64) { - ballPath[strlen(ballPath)-5] = '5'; - continue; - } - free(ballPath); - return 1; - } - - rmObj = 1; - file = finalName; - break; - } - } - - free(ballPath); - - argv[0] = "insmod"; - argv[1] = file; - - rc = combined_insmod_main(argc, argv); - - if (rmObj) unlink(file); - - return rc; -} - -int rmmod(char * modName) { - pid_t child; - int status; - char * argv[] = { "/bin/rmmod", modName, NULL }; - int argc = 2; - int rc = 0; - - if ((child = fork()) == 0) { - exit(combined_insmod_main(argc, argv)); - } - - waitpid(child, &status, 0); - - if (WIFEXITED(status)) - rc = WEXITSTATUS(status); - else - rc = -1; - - return rc; -} - -int insmod(char * modName, char * path, char ** args) { - int argc; - char ** argv; - int rc = 0; - pid_t child; - int status; - int count; - - argc = 0; - for (argv = args; argv && *argv; argv++, argc++); - - argv = alloca(sizeof(*argv) * (argc + 5)); - argv[0] = "/bin/insmod"; - count = 1; - if (path) { - argv[1] = "-p"; - argv[2] = path; - count += 2; - } - - argv[count] = modName; - count++; - - if (args) - memcpy(argv + count, args, sizeof(*args) * argc); - - argv[argc + count] = NULL; - - argc += count; - - if ((child = fork()) == 0) { - execv("/bin/loader", argv); - exit(1); - } - - waitpid(child, &status, 0); - - if (WIFEXITED(status)) - rc = WEXITSTATUS(status); - else - rc = -1; - - return rc; -} @@ -42,6 +42,7 @@ def has_lvm(): if name == "lvm": lvmDevicePresent = 1 break + return lvmDevicePresent # now check to see if lvm is available has_lvm() diff --git a/network.py b/network.py index b59c947f0..859728415 100644 --- a/network.py +++ b/network.py @@ -121,7 +121,8 @@ class NetworkDevice(SimpleConfigFile): return s def __init__(self, dev): - self.info = { "DEVICE" : dev } + self.info = { "DEVICE" : dev, + "ONBOOT": "no" } class Network: def __init__(self): @@ -236,7 +237,7 @@ class Network: "looking up host name", dev.get('device')) if not self.isConfigured: - log("no network devices were availabe to look up host name") + log("no network devices were available to look up host name") return None f = open("/etc/resolv.conf", "w") diff --git a/packages.py b/packages.py index c87e5698d..010333258 100644 --- a/packages.py +++ b/packages.py @@ -37,6 +37,7 @@ from installmethod import FileCopyException from rhpl.log import log from rhpl.translate import _ +import rhpl.arch def queryUpgradeContinue(intf, dir): if dir == DISPATCH_FORWARD: @@ -132,10 +133,12 @@ def writeXConfiguration(id, instPath): def readPackages(intf, method, id): if id.grpset: grpset = id.grpset - hdrlist = idr.grpset.hdrlist + hdrlist = id.grpset.hdrlist + doselect = 0 else: grpset = None hdrlist = None + doselect = 1 while hdrlist is None: w = intf.waitWindow(_("Reading"), _("Reading package information...")) @@ -151,7 +154,6 @@ def readPackages(intf, method, id): continue w.pop() - id.instClass.setPackageSelection(hdrlist, intf) while grpset is None: try: @@ -163,9 +165,11 @@ def readPackages(intf, method, id): "due to a missing file or bad media. " "Press <return> to try again.")) continue - id.instClass.setGroupSelection(grpset, intf) id.grpset = grpset + if doselect: + id.instClass.setGroupSelection(grpset, intf) + id.instClass.setPackageSelection(hdrlist, intf) def handleX11Packages(dir, intf, disp, id, instPath): @@ -224,6 +228,21 @@ def setSaneXSettings(xsetup): xsetup.xhwstate.choose_sane_default() xsetup.imposed_sane_default = 1 +def getAnacondaTS(instPath = None): + if instPath: + ts = rpm.TransactionSet(instPath) + else: + ts = rpm.TransactionSet() + ts.setVSFlags(~(rpm.RPMVSF_NORSA|rpm.RPMVSF_NODSA)) + ts.setFlags(rpm.RPMTRANS_FLAG_ANACONDA) + + # set color if needed. FIXME: why isn't this the default :/ + if (rhpl.arch.canonArch.startswith("ppc64") or + rhpl.arch.canonArch in ("s390x", "sparc64", "x86_64")): + ts.setColor(3) + + return ts + def checkDependencies(dir, intf, disp, id, instPath): if dir == DISPATCH_BACK: return @@ -234,13 +253,11 @@ def checkDependencies(dir, intf, disp, id, instPath): # FIXME: we really don't need to build up a ts more than once # granted, this is better than before still if id.upgrade.get(): - ts = rpm.TransactionSet(instPath) + ts = getAnacondaTS(instPath) how = "u" else: - ts = rpm.TransactionSet() + ts = getAnacondaTS() how = "i" - ts.setVSFlags(-1) - ts.setFlags(rpm.RPMTRANS_FLAG_ANACONDA) for p in id.grpset.hdrlist.pkgs.values(): if p.isSelected(): @@ -250,7 +267,7 @@ def checkDependencies(dir, intf, disp, id, instPath): win.pop() - if id.dependencies and id.handleDeps == CHECK_DEPS: + if depcheck.added and id.handleDeps == CHECK_DEPS: disp.skipStep("dependencies", skip = 0) log("FIXME: had dependency problems. resolved them without informing the user") disp.skipStep("dependencies") @@ -609,7 +626,7 @@ def doPreInstall(method, id, intf, instPath, dir): for i in ( '/var', '/var/lib', '/var/lib/rpm', '/tmp', '/dev', '/etc', '/etc/sysconfig', '/etc/sysconfig/network-scripts', - '/etc/X11', '/root', '/var/tmp' ): + '/etc/X11', '/root', '/var/tmp', '/etc/rpm' ): try: os.mkdir(instPath + i) except os.error, (errno, msg): @@ -618,6 +635,9 @@ def doPreInstall(method, id, intf, instPath, dir): if flags.setupFilesystems: + # setup /etc/rpm/platform for the post-install environment + iutil.writeRpmPlatform(instPath) + try: # FIXME: making the /var/lib/rpm symlink here is a hack to # workaround db->close() errors from rpm @@ -667,10 +687,7 @@ def doInstall(method, id, intf, instPath): import whiteout upgrade = id.upgrade.get() - ts = rpm.TransactionSet(instPath) - - ts.setVSFlags(~(rpm.RPMVSF_NORSA|rpm.RPMVSF_NODSA)) - ts.setFlags(rpm.RPMTRANS_FLAG_ANACONDA) + ts = getAnacondaTS(instPath) total = 0 totalSize = 0 @@ -709,9 +726,7 @@ def doInstall(method, id, intf, instPath): # new transaction set ts.closeDB() del ts - ts = rpm.TransactionSet(instPath) - ts.setVSFlags(~(rpm.RPMVSF_NORSA|rpm.RPMVSF_NODSA)) - ts.setFlags(rpm.RPMTRANS_FLAG_ANACONDA) + ts = getAnacondaTS(instPath) # we don't want to try to remove things more than once (#84221) id.upgradeRemove = [] @@ -975,9 +990,9 @@ def doPostInstall(method, id, intf, instPath): # XXX currently Bad Things (X async reply) happen when doing # Mouse Magic on Sparc (Mach64, specificly) # The s390 doesn't even have a mouse! - if os.environ.has_key ("DISPLAY") and not (arch == "sparc" or arch == "s390"): - import xmouse + if os.environ.get('DISPLAY') == ':1' and arch != 'sparc': try: + import xmouse mousedev = xmouse.get()[0] except RuntimeError: pass @@ -1278,9 +1293,10 @@ def selectLanguageSupportGroups(grpset, langSupport): # add to the deps in the dependencies structure for the # package. this should take care of whenever we're # selected - grpset.hdrlist[req].addDeps([package]) + grpset.hdrlist[req].addDeps([package], main = 0) if grpset.hdrlist[req].isSelected(): grpset.hdrlist[package].select() sys.stdout.flush() grpset.hdrlist[package].usecount += grpset.hdrlist[req].usecount - 1 - group.selectDeps([package], uses = grpset.hdrlist[req].usecount - 1) + group.selectDeps([package], uses = grpset.hdrlist[req].usecount) + diff --git a/partIntfHelpers.py b/partIntfHelpers.py index 96f67d252..7caf7da67 100644 --- a/partIntfHelpers.py +++ b/partIntfHelpers.py @@ -150,6 +150,13 @@ def doDeletePartitionByRequest(intf, requestlist, partition, _("You cannot delete free space."), custom_icon="error") return 0 + elif partition.type & parted.PARTITION_PROTECTED: + # LDL formatted DASDs always have one partition, you'd have to reformat the + # DASD in CDL mode to get rid of it + intf.messageWindow(_("Unable To Delete"), + _("You cannot delete a partition of a LDL formatted DASD."), + custom_icon="error") + return 0 else: device = partedUtils.get_partition_name(partition) @@ -235,7 +242,7 @@ def doDeletePartitionsByDevice(intf, requestlist, diskset, device, reqIDs = [] for req in requests: part = partedUtils.get_partition_by_name(diskset.disks, req.device) - if part.type & parted.PARTITION_FREESPACE or part.type & parted.PARTITION_METADATA: + if part.type & parted.PARTITION_FREESPACE or part.type & parted.PARTITION_METADATA or part.type & parted.PARTITION_PROTECTED: continue reqIDs.append(req.uniqueID) @@ -262,7 +269,7 @@ def doDeletePartitionsByDevice(intf, requestlist, diskset, device, leftIDs = [] for req in left_requests: part = partedUtils.get_partition_by_name(diskset.disks, req.device) - if part.type & parted.PARTITION_FREESPACE or part.type & parted.PARTITION_METADATA: + if part.type & parted.PARTITION_FREESPACE or part.type & parted.PARTITION_METADATA or part.type & parted.PARTITION_PROTECTED: continue leftIDs.append(req.uniqueID) diff --git a/partedUtils.py b/partedUtils.py index ec0569d0a..c144ef844 100644 --- a/partedUtils.py +++ b/partedUtils.py @@ -468,7 +468,7 @@ class DiskSet: return labels - def findExistingRootPartitions(self, intf, mountpoint): + def findExistingRootPartitions(self, intf, mountpoint, upgradeany = 0): """Return a list of all of the partitions which look like a root fs.""" rootparts = [] @@ -552,7 +552,8 @@ class DiskSet: cmdline = open('/proc/cmdline', 'r').read() if (relstr.startswith(productName) or - cmdline.find("upgradeany") != -1): + cmdline.find("upgradeany") != -1 or + upgradeany == 1): rootparts.append ((node, part.fs_type.name, relstr)) isys.umount(mountpoint) @@ -247,7 +247,7 @@ def runRescue(instPath, mountroot, id): else: readOnly = 0 - disks = upgrade.findExistingRoots(intf, id, instPath) + disks = upgrade.findExistingRoots(intf, id, instPath, upgradeany = 1) if not disks: root = None diff --git a/scripts/mk-images b/scripts/mk-images index 963810fed..56aa49f6c 100755 --- a/scripts/mk-images +++ b/scripts/mk-images @@ -29,16 +29,14 @@ TOPDIR=$(cd $TOPDIR; pwd) INSTIMGPATH=$TOPDESTPATH/RedHat/base INSTIMGTEMPLATE=$3 IMGPATH=$4 - KERNELROOT=/tmp/updboot.kernel.$$ - MODDEPS=$KERNELROOT/moddeps + KERNELBASE=/tmp/updboot.kernel.$$ + MODDEPS=$KERNELBASE/moddeps BUILDARCH=$5 if [ "$BUILDARCH" = "ppc" -o "$BUILDARCH" = "ppc64" ]; then KERNELNAME=vmlinux - KERNELARCH=ppc64 else KERNELNAME=vmlinuz - KERNELARCH=$BUILDARCH fi if [ "$BUILDARCH" = "ia64" ]; then @@ -72,11 +70,11 @@ TOPDIR=$(cd $TOPDIR; pwd) rm -rf $IMAGEPATH rm -rf $FULLMODPATH rm -rf $FINALFULLMODPATH - rm -rf $KERNELROOT + rm -rf $KERNELBASE mkdir -p $IMAGEPATH mkdir -p $FULLMODPATH mkdir -p $FINALFULLMODPATH - mkdir -p $KERNELROOT + mkdir -p $KERNELBASE mkdir -p $INSTIMGPATH # Stuff that we need @@ -92,8 +90,8 @@ TOPDIR=$(cd $TOPDIR; pwd) BOOTDISKDIR=$IMGPATH/usr/lib/anaconda-runtime/boot LANGTABLE=$IMGPATH/usr/lib/anaconda/lang-table PCITABLE=$IMGPATH/usr/share/hwdata/pcitable - CACHE=$KERNELROOT/lib/modules/.cache - MODULESUSED=$KERNELROOT/modules-used + CACHE=$KERNELBASE/.cache + MODULESUSED=$KERNELBASE/modules-used touch $MODULESUSED @@ -227,10 +225,11 @@ intcopymodules () { echo $n >> $MODULESUSED for o in $m ; do echo $n - ver=$(echo $o |cut -d / -f 6) - if ! [ -d $dir/$ver ] ; then mkdir $dir/$ver ; fi - if ! cp $o $dir/$ver; then - echo "Failed to copy $o to $dir/$ver (for module $n)" >&2 + ver=$(echo $o |cut -d / -f 7) + myarch=$(echo $o |cut -d / -f 4) + if ! [ -d $dir/$ver/$myarch ] ; then mkdir -p $dir/$ver/$myarch ; fi + if ! cp $o $dir/$ver/$myarch; then + echo "Failed to copy $o to $dir/$ver/$myarch (for module $n)" >&2 fi done fi @@ -330,7 +329,7 @@ makemoduleball() { $TRIMPCITABLE $(find . -name *.o -exec basename {} \;) < $PCITABLE > ../pcitable if [ -n "$MMB_DD" ]; then - echo $MMB_DD > $MMB_DIR/rhdd-6.1 + echo $MMB_DD > $MMB_DIR/rhdd fi find . -type f | cpio --quiet -H crc -o | gzip -9 > ../$MMB_NAME @@ -469,6 +468,9 @@ makeinitrd() { root::0:0:root:/:/bin/bash EOF + # set up the arch bits + echo $arch > $MBD_DIR/etc/arch + install -s -m 755 $LOADERBINDIR/$LOADERBIN $MBD_DIR/sbin/loader install -s -m 755 $LOADERBINDIR/$INITBIN $MBD_DIR/sbin if [ "$BUILDARCH" != "s390" -a "$BUILDARCH" != "s390x" ]; then @@ -856,13 +858,14 @@ fi # Find the kernel, unpack it, and verify it vertag="BOOT" -if [ "$BUILDARCH" = "s390" -o "$BUILDARCH" = "s390x" ]; then - vertag="dummyvar tape" -fi if [ "$BUILDARCH" = "ppc" -o "$BUILDARCH" = "ppc64" ]; then - vertag="pseries iseries" + arches="ppc64pseries ppc64iseries" +else + arches="$BUILDARCH" fi -for kernelvers in $vertag; do +for KERNELARCH in $arches; do + for kernelvers in $vertag; do + KERNELROOT=$KERNELBASE/$KERNELARCH kpackage=$($LATEST $KERNELPATH kernel-$kernelvers) mkdir -p $KERNELROOT/lib/modules/misc if [ ! -f "$kpackage" ]; then @@ -877,7 +880,8 @@ for kernelvers in $vertag; do fi version=$(rpm --qf '%{VERSION}-%{RELEASE}' -qp $kpackage)${kernelvers} - echo "unpacking $kpackage" + arch=$(rpm --qf '%{ARCH}\n' -qp $kpackage) + echo "unpacking $kpackage.$arch" rpm2cpio $kpackage | (cd $KERNELROOT; cpio --quiet -iumd) if [ ! -z $ppackage ]; then @@ -912,10 +916,11 @@ for kernelvers in $vertag; do # make the boot images makeBootImages + done done # make the second stage -find $KERNELROOT/lib/modules/ > $CACHE +find $KERNELBASE/*/lib/modules/ > $CACHE makeSecondStage -rm -rf $KERNELROOT +rm -rf $KERNELBASE diff --git a/scripts/mk-images.ia64 b/scripts/mk-images.ia64 index 90a6738dc..3ee2170ce 100644 --- a/scripts/mk-images.ia64 +++ b/scripts/mk-images.ia64 @@ -2,7 +2,8 @@ USBMODS="usb-uhci usb-ohci hid keybdev" LATEUSBMODS="mousedev" -COMMONMODULES="nfs fat vfat cramfs floppy" +BTERMMODULES="vga16fb" +COMMONMODULES="nfs fat vfat cramfs loop floppy $BTERMMODULES" SECSTAGE="nfs fat vfat raid0 raid1 raid5 lvm-mod ext3 $LATEUSBMODS" NETMODULES="3c59x acenic bcm5700 e100 e1000 eepro100 hamachi sk98lin starfire sunhme tulip yellowfin tg3" SCSIMODULES="sd_mod sr_mod scsi_mod DAC960 cciss cpqarray aic7xxx aic7xxx_mod megaraid qla1280 qla2200 qla2300 sym53c8xx sym53c8xx_2 mptscsih mptbase ips" diff --git a/scripts/mk-images.ppc b/scripts/mk-images.ppc index 9ba290b72..bdd2a84d6 100644 --- a/scripts/mk-images.ppc +++ b/scripts/mk-images.ppc @@ -21,7 +21,7 @@ prepareBootImage() { makeBootImages() { echo "Building boot images for kernel $kernelvers" - if [ "$kernelvers" = "pseries" ]; then + if [ "$KERNELARCH" = "ppc64pseries" ]; then echo "Building pSeries initrd" makeinitrd --initrdto $TOPDESTPATH/ppc/chrp/ramdisk.image.gz \ --initrdsize 8192 \ @@ -29,7 +29,7 @@ makeBootImages() { --modules "$COMMONMODULES $NETMODULES $SCSIMODULES $SCSIMODS $IDEMODS $ISOMODULES" mkdir -p $TOPDESTPATH/etc $TOPDESTPATH/ppc/chrp - cp $KERNELROOT/boot/vmlinux-*pseries* $TOPDESTPATH/ppc/chrp/vmlinux + cp $KERNELROOT/boot/vmlinux-* $TOPDESTPATH/ppc/chrp/vmlinux cp $BOOTDISKDIR/yaboot.conf $TOPDESTPATH/etc/yaboot.conf cp $BOOTDISKDIR/bootinfo.txt $TOPDESTPATH/ppc/bootinfo.txt cp $IMGPATH/usr/lib/yaboot/yaboot $TOPDESTPATH/ppc/chrp @@ -45,7 +45,7 @@ makeBootImages() { cp $TOPDESTPATH/boot_image $TOPDESTPATH/isopath/boot_image mkisofs -generic-boot $TOPDESTPATH/isopath/boot_image -A "$PRODUCT $VERSION" -V "PBOOT" -J -R -v -T -allow-multidot -l -o $TOPDESTPATH/images/boot.iso $TOPDESTPATH/isopath rm -rf $TOPDESTPATH/isopath/ - elif [ "$kernelvers" = "iseries" ]; then + elif [ "$KERNELARCH" = "ppc64iseries" ]; then mkdir -p $TOPDESTPATH/ppc/iSeries echo "Building iSeries initrd" @@ -54,12 +54,14 @@ makeBootImages() { --loaderbin loader \ --modules "$COMMONMODULES $NETMODULES $SCSIMODULES $IDEMODS $ISOMODULES $ISERIESMODULES" - cp $KERNELROOT/boot/vmlinux-*iseries* $TOPDESTPATH/ppc/iSeries/vmlinux - cp $KERNELROOT/boot/System.map-*iseries* $TOPDESTPATH/ppc/iSeries/System.map - - $IMGPATH/usr/sbin/addRamDisk $TOPDESTPATH/ppc/iSeries/ramdisk.image.gz $TOPDESTPATH/ppc/iSeries/System.map $TOPDESTPATH/ppc/iSeries/vmlinux $TOPDESTPATH/ppc/iSeries/boot.img + cp $KERNELROOT/boot/vmlinux-* $TOPDESTPATH/ppc/iSeries/vmlinux + cp $KERNELROOT/boot/System.map-* $TOPDESTPATH/ppc/iSeries/System.map + + $IMGPATH/usr/sbin/addSystemMap $TOPDESTPATH/ppc/iSeries/System.map $TOPDESTPATH/ppc/iSeries/vmlinux $TOPDESTPATH/ppc/iSeries/vmlinux.sm + $IMGPATH/usr/sbin/addRamDisk $TOPDESTPATH/ppc/iSeries/ramdisk.image.gz $TOPDESTPATH/ppc/iSeries/System.map $TOPDESTPATH/ppc/iSeries/vmlinux.sm $TOPDESTPATH/ppc/iSeries/boot.img + rm -f $TOPDESTPATH/ppc/iSeries/vmlinux.sm else - echo "Unknown kernel version: $kernelvers" + echo "Unknown kernel arch: $KERNELARCH" # mac? # echo "Building Mac initrd" # makeinitrd --initrdto $TOPDESTPATH/images/ramdisk.image.gz \ diff --git a/scripts/mk-images.s390 b/scripts/mk-images.s390 index 821447a96..e428d4284 100644 --- a/scripts/mk-images.s390 +++ b/scripts/mk-images.s390 @@ -159,6 +159,9 @@ EOF cp -f $IMGPATH/usr/bin/login $MBD_DIR/sbin/login cp -f $IMGPATH/usr/sbin/sshd $MBD_DIR/sbin/sshd + # set up the arch bits + echo $arch > $MBD_DIR/etc/arch + install -s -m 755 $LOADERBINDIR/$LOADERBIN $MBD_DIR/sbin/loader install -s -m 755 $LOADERBINDIR/shutdown $MBD_DIR/sbin/shutdown #install -s -m 755 $LOADERBINDIR/load_anaconda $MBD_DIR/sbin/loader @@ -434,25 +437,14 @@ SECSTAGE="$IDEMODS $SCSIMODS raid0 raid1 raid5 lvm-mod" COMMONMODULES="loop cramfs dasd_diag_mod dasd_eckd_mod dasd_fba_mod dasd_mod tape390 isofs ext3" LOCALMODULES="$COMMONMODULES tape390 $IDEMODS $SCSIMODS" -NETWORKMODULES="$COMMONMODULES nfs ctc netiucv ipv6" +NETWORKMODULES="$COMMONMODULES nfs ctc netiucv ipv6 lcs" makeBootImages() { - echo "In mk-images.s390: kernelvers is $kernelvers" - if [ "$kernelvers" = "" ]; then makeS390initrd --initrdto $TOPDESTPATH/images/initrd.img \ --initrdsize 15000 \ --loaderbin loader \ --modules "$NETWORKMODULES" cp -vf $KERNELROOT/boot/${KERNELNAME}-${version} $TOPDESTPATH/images/kernel.img - fi - - if [ "$kernelvers" = "tape" ]; then - makeS390initrd --initrdto $TOPDESTPATH/images/tapeinrd.img \ - --initrdsize 15000 \ - --loaderbin loader \ - --modules "$NETWORKMODULES" - cp -vf $KERNELROOT/boot/${KERNELNAME}-${version} $TOPDESTPATH/images/tapekrnl.img - fi } makeSecondStage() { diff --git a/scripts/pkgorder b/scripts/pkgorder index 91cb0cd5a..a7f77dbfa 100755 --- a/scripts/pkgorder +++ b/scripts/pkgorder @@ -20,6 +20,7 @@ log.handler = anaconda_log rpmFD = None import hdrlist +import rhpl.arch def cmpHeaderByName(h1, h2): n1 = string.lower(h1.nevra()) @@ -32,19 +33,35 @@ def cmpHeaderByName(h1, h2): return 1 -# returns 1 if comp is in the parent chain for subcomp -def isParent(comp, subcomp): - if not subcomp: - return 0 - if subcomp.parent == comp: - return 1 - return isParent(comp, comp.parent) - -# turns on a whole comp chain -def selectComp(comp): - comp.select() - if comp.parent: - selectComp(comp.parent) +def addIfNeeded(pkg): + global pkgOrder, pkgHash + canon = rhpl.arch.canonArch + second = rhpl.arch.getSecondaryArch() + diff = rhpl.arch.archDifference + if not pkgHash.has_key (pkg.name): + pkgHash[pkg.name] = [ pkg ] + pkgOrder.append(pkg.nevra()) + elif second is None: + # this isn't a biarch arch, so we don't need to worry about + # multiple glibcs + return + else: + # this is a biarch arch. we want to just have a primary package + # for each here + for p in pkgHash[pkg.name]: + arch1 = p['arch'] + arch2 = pkg['arch'] + # same arch, don't worry about it + if arch1 == arch2: + continue + # if one of them doesn't work for the canon arch and the other + # does, then one of them is for the secondary arch and we want + # to add it. + if ( ((diff(canon, arch1) == 0) and (diff(second, arch2) != 0)) or + ((diff(canon, arch2) == 0) and (diff(second, arch1) != 0)) ): + pkgHash[pkg.name].append(pkg) + pkgOrder.append(pkg.nevra()) + # set PKGORDER_DEBUG to get rpm debugging if os.environ.has_key("PKGORDER_DEBUG"): @@ -75,7 +92,9 @@ except rpm.error: sys.exit(1) # and read the comps file grpset = hdrlist.groupSetFromCompsFile("file://%s/RedHat/base/comps.xml" - %(distDir,), hdlist) + %(distDir,), hdlist, doSelect = 0) +grpset.unselectAll() +#grpset.groups["everything"].select() # work out the order we'd like to install everything in pkgOrder = [] @@ -87,9 +106,13 @@ for package in hdlist.keys(): not package.startswith("kernel-doc") and not package.startswith("kernel-source") and not package.startswith("kernel-debug")): - hdlist[package].select() + try: + hdlist[package].select() + except: + print package + print type(package) pkgOrder.append(hdlist[package].nevra()) - pkgHash[hdlist[package].name] = None + pkgHash[hdlist[package].name] = [ hdlist[package] ] # Tier 1 language packages get priority. tier1langs = ("en:en_US:de:de_DE:es:es_ES:fr:fr_FR:it:it_IT:ja:ja_JP:" @@ -121,6 +144,8 @@ latelangs = [] for id in grpids: if id in complist: continue + if id == "everything": #this would be silly + continue if ((grpset.groups[id].langonly is not None) and (tier1langs.find(grpset.groups[id].langonly) == -1)): latelangs.append(id) @@ -136,6 +161,7 @@ for id in complist: group = grpset.groups[id] list = [] + grpset.unselectAll() group.select() # append what got turned on to our order. @@ -144,9 +170,7 @@ for id in complist: list.append(p) list.sort(cmpHeaderByName) for item in list: - if not pkgHash.has_key (item.name): - pkgOrder.append(item.nevra()) - pkgHash[item.name] = None + addIfNeeded(item) # add all of the packages that haven't been added yet. list = [] @@ -163,9 +187,11 @@ os.system ("mkdir -p " + testpath + "/var/lib/rpm") ts = rpm.TransactionSet(testpath) ts.setVSFlags(~(rpm.RPMVSF_NORSA|rpm.RPMVSF_NODSA)) -ts.setFlags(rpm.RPMTRANS_FLAG_NOMD5|rpm.RPMTRANS_FLAG_ANACONDA) +ts.setFlags(rpm.RPMTRANS_FLAG_ANACONDA) +i = 0 for h in pkgOrder: - #print "in:", h[1000000] +# sys.stderr.write("%s: %s\n" %(i, h)) + i += 1 ts.addInstall(hdlist[h].hdr, hdlist[h].hdr, 'i') pkgOrder = [] @@ -181,7 +207,25 @@ except AttributeError: print "you don't have the latest RPM!" sys.exit(1) +outputted = [] # print the results. for p in pkgOrder: - print "%s-%s-%s" % (p['name'], p['version'], p['release']) + def archSort(hdr1, hdr2): + h1 = hdlist[hdr1[0]] + h2 = hdlist[hdr2[0]] + + if rhpl.arch.score(h1['arch']) > rhpl.arch.score(h2['arch']): + return -1 + elif rhpl.arch.score(h1['arch']) < rhpl.arch.score(h2['arch']): + return 1 + return 0 + + if p['name'] in outputted: + continue + pkgs = hdlist.pkgnames[p['name']] + pkgs.sort(archSort) + for pnevra in pkgs: + pkg = hdlist.pkgs[pnevra[0]] + print "%s-%s-%s.%s" % (pkg['name'], pkg['version'], + pkg['release'], pkg['arch']) diff --git a/scripts/splitdistro b/scripts/splitdistro deleted file mode 100755 index 14a9f60b5..000000000 --- a/scripts/splitdistro +++ /dev/null @@ -1,282 +0,0 @@ -#!/usr/bin/python2.2 - -# These dirs, along with RPMS, make up disc 2 -disc2dirs = [ "preview" ] - -# These files appear on all binary CDs -jointfiles = [ "beta_eula.txt", "RPM-GPG-KEY", "README", "GPL", "EULA"] - -targetSize = 648 * 1024.0 * 1024.0 - -# Leave about 1.2MB of space on the disc -fudgeFactor = 1.2 * 1024 * 1024 - -# rough estimate of the size of the comps package -- we don't create it -# until after we run splitdistro but need to leave room for it on CD1 -compsSize = 10.0 * 1024 * 1024 - -#----------------- - -import sys -import os -import os.path -import string -import getopt -import time -import types - -def stamp(path, releasestr, num, arch, startedAt, dirInfo): - try: - os.unlink("%s/.discinfo" % path) - except: - pass - f = open("%s/.discinfo" % path, "w") - f.write("%f\n" % startedAt) - f.write("%s\n" % releasestr) - f.write("%s\n" % arch) - f.write("%s\n" % num) - if dirInfo is not None: - for item in dirInfo: - f.write("%s\n" % item) - f.close() - -def moveFiles(srcDir, destDir, files): - for fn in files: - src = "%s/%s" % (srcDir, fn) - dest = "%s/%s" % (destDir, fn) - try: - os.rename(src, dest) - except: - print "in moveFiles, src was %s, dest was %s" % (src, dest) - raise RuntimeError - -def linkFile(srcDir, destDir, file): - for file in jointfiles: - src = "%s/%s" % (srcDir, file) - dest = "%s/%s" %(destDir, file) - try: - os.link(src, dest) - except OSError, (errno, msg): - pass -# print "**** WARNING linking %s to %s: %s" % (src, dest, msg) - -def excessFiles(path, fileList, maxSize): - total = 0 - moveList = [] - found = 0 - - for fns in fileList: - if type(fns) == types.StringType: - fns = [ fns ] - - size = 0 - for fn in fns: - thisSize = os.path.getsize(path + "/" + fn) - size = size + thisSize + ((thisSize + 2047) % 2048) - - if size + total < maxSize: - total = total + size - else: - # once we're done, we're done - if found == 0: -# print "straw was %s" % (fns,) - found = 1 - total = maxSize - moveList.extend(fns) - - return moveList - -class DirectoryIterator: - def __init__(self): - self.inodes = {} - - def traverse (self, arg, dirname, names): - for name in names: - sb = os.lstat (dirname + "/" + name) - if not self.inodes.has_key(sb[1]): - self.inodes[sb[1]] = sb[6] - - def total(self): - total = 0 - for size in self.inodes.values(): - total = total + size - return total - -def spaceUsed(path): - foo = DirectoryIterator() - os.path.walk (path, foo.traverse, None) - return foo.total() - -fns = {} - -(args, extra) = getopt.getopt(sys.argv[1:], '', [ 'fileorder=', 'release=' ]) - -if len(extra) != 2: - print "splitdistro --fileorder <file> [--release <comment>] <toppath> <arch>" - sys.exit(1) - -releasestr = "" -packageOrderFile = None -for n in args: - (str, arg) = n - if str == '--fileorder': - packageOrderFile = arg - if str == '--release': - releasestr = arg - -if not packageOrderFile: - print "splitdistro --fileorder <file> [--release <comment>] <toppath> <arch>" - sys.exit(1) - - -arch = extra[1] -distDir = os.path.normpath(extra[0] + "/" + arch) -srcDir = os.path.normpath(extra[0] + "/" + arch + "/SRPMS") - -if not os.access("%s/.discinfo" %(distDir,), os.O_RDONLY): - startedAt = time.time() - dirInfo = None -else: - f = open("%s/.discinfo" %(distDir,), "r") - startedAt = string.atof(f.readline()[:-1]) - releasestr = f.readline()[:-1] - newarch = f.readline()[:-1] - if newarch != arch: - raise RuntimeError, "Passed arch doesn't match arch in .discinfo file" - # throw out discnum - f.readline() - # basedir, packagedir, and pixmapdir - dirInfo = [ f.readline()[:-1], f.readline()[:-1], f.readline()[:-1] ] - -if not os.path.isdir(distDir): - print "error: %s is not a directory" % distDir - sys.exit(1) - -if not os.path.isdir(srcDir): - print "error: %s is not a directory" % srcDir - sys.exit(1) - -disc1Dir = distDir + "-disc1" -disc2Dir = distDir + "-disc2" -disc3Dir = distDir + "-disc3" -disc1SrcDir = distDir + "-disc4" -disc2SrcDir = distDir + "-disc5" -disc3SrcDir = distDir + "-disc6" - -id = 0 - -files = os.listdir(distDir + "/RedHat/RPMS") -files.sort() -packages = {} -for file in files: - l = string.split(file, ".") - pkg = string.join(l[:-2], ".") - if packages.has_key(pkg): - packages[pkg].append(file) - else: - packages[pkg] = [ file ] - -f = open(packageOrderFile, "r") -binPkgList = [] -for pkg in f.readlines(): - # chop - pkg = pkg[:len(pkg) - 1] - if pkg[0:8] != "warning:": - binPkgList.append(packages[pkg]) - -del f - -print "Splitting tree..." - -totalsize = spaceUsed(distDir) -rpmsize = spaceUsed(distDir + "/RedHat/RPMS") -dirsize = 0 -for dir in disc2dirs: - what = distDir + "/" + dir - if os.access(what, os.R_OK): - dirsize = dirsize + spaceUsed(distDir + "/" + dir) -srpmsize = spaceUsed(distDir + "/SRPMS") - -disc1used = totalsize - rpmsize - dirsize - srpmsize - -os.system("rm -rf %s %s %s %s" % ( disc1Dir, disc2Dir, disc1SrcDir, - disc2SrcDir)) -os.system("mkdir -p %s %s/SRPMS %s/SRPMS %s/RedHat/RPMS %s/RedHat/RPMS %s/SRPMS" % - (disc1Dir, disc1SrcDir, disc2SrcDir, disc2Dir, - disc3Dir, disc3SrcDir)) - -print "Creating disc1..." - -os.system("cp -al %s/. %s" % (distDir, disc1Dir)) -stamp(disc1Dir, releasestr, "1", arch, startedAt, dirInfo) - -# remove the srpms dir from disc1 since it shouldn't be there -os.system("rm -rf %s/SRPMS" % (disc1Dir,)) - -print "Creating disc2..." -stamp(disc2Dir, releasestr, "2", arch, startedAt, dirInfo) - -for file in jointfiles: - linkFile(disc1Dir, disc2Dir, file) - -print targetSize / (1024.0 * 1024.0) -print disc1used / (1024.0 * 1024.0) -print fudgeFactor / (1024.0 * 1024.0) -print compsSize / (1024.0 * 1024.0) -print (targetSize - disc1used - fudgeFactor - compsSize) / (1024.0 * 1024.0) -disc2pkgs = excessFiles(distDir + "/RedHat/RPMS", binPkgList, - targetSize - disc1used - fudgeFactor - compsSize) -print "first to move to disc2 is", disc2pkgs[0] -moveFiles("%s/RedHat/RPMS" % disc1Dir, - "%s/RedHat/RPMS" % disc2Dir, - disc2pkgs); -disc1Size = spaceUsed(disc1Dir) - -print "Creating disc3..." -stamp(disc3Dir, releasestr, "3", arch, startedAt, dirInfo) - -for file in jointfiles: - linkFile(disc1Dir, disc2Dir, file) - -disc3pkgs = excessFiles(distDir + "/RedHat/RPMS", binPkgList, - targetSize + disc1Size - disc1used - fudgeFactor) - -print "first to move to disc3 is", disc3pkgs[0] -moveFiles("%s/RedHat/RPMS" % disc2Dir, - "%s/RedHat/RPMS" % disc3Dir, - disc3pkgs); -disc3used = spaceUsed(disc3Dir) - -print "Creating first source disc..." -stamp(disc1SrcDir, releasestr, "4", arch, startedAt, dirInfo) -os.system("cp -al %s %s" % (srcDir, disc1SrcDir)) - -print "Creating second source disc..." -stamp(disc2SrcDir, releasestr, "5", arch, startedAt, dirInfo) - -srcPkgList = os.listdir("%s/SRPMS" % disc1SrcDir) -srcPkgList.sort() -#srcPkgList.reverse() -disc2pkgs = excessFiles(srcDir, srcPkgList, - targetSize - fudgeFactor) -print "first src pkg to move to 2nd src cd is", disc2pkgs[0] -moveFiles("%s/SRPMS" % disc1SrcDir, - "%s/SRPMS" % disc2SrcDir, - disc2pkgs); -srcDisc1Size = spaceUsed(disc1SrcDir) - -print "Dropping remainder of sources on third disc..." -stamp(disc3SrcDir, releasestr, "6", arch, startedAt, dirInfo) -disc3pkgs = excessFiles(srcDir, srcPkgList, - srcDisc1Size + targetSize - fudgeFactor) -print "first src pkg to move to 3rd src cd is", disc3pkgs[0] -moveFiles("%s/SRPMS" % disc2SrcDir, - "%s/SRPMS" % disc3SrcDir, - disc3pkgs) - -#sys.exit(0) - -sys.stdout.flush() - -os.system("du -sh %s %s %s %s %s %s" % (disc1Dir, disc2Dir, disc3Dir, - disc1SrcDir, disc2SrcDir, disc3SrcDir)) diff --git a/scripts/upd-instroot b/scripts/upd-instroot index 47cac4124..10c280eec 100755 --- a/scripts/upd-instroot +++ b/scripts/upd-instroot @@ -484,6 +484,7 @@ $LIBDIR/libnss_dns* $LIBDIR/libpam* $LIBDIR/libproc* sbin/addRamDisk +sbin/addSystemMap sbin/debugfs sbin/e2fsck sbin/e2label @@ -328,8 +328,11 @@ class InstallInterface: if exc.options & flag: buttons.append(_(errorstring)) buttonToAction[string.lower(_(errorstring))] = flag - rc = ButtonChoiceWindow(self.screen, exc.type_string, exc.message, - buttons=buttons) + + rc = None + while not buttonToAction.has_key(rc): + rc = ButtonChoiceWindow(self.screen, exc.type_string, exc.message, + buttons=buttons) return buttonToAction[rc] @@ -388,10 +391,10 @@ class InstallInterface: # self.screen.suspendCallback(killSelf, self.screen) # uncomment this line to drop into the python debugger on <Ctrl+Z> # --VERY handy-- - if DEBUG: + if DEBUG or flags.test: self.screen.suspendCallback(debugSelf, self.screen) - if flags.serial or isys.isPsudoTTY(0): + if flags.serial or isys.isPsudoTTY(0) or isys.isVioConsole(): self.screen.suspendCallback(spawnShell, self.screen) # clear out the old root text by writing spaces in the blank @@ -430,6 +433,9 @@ class InstallInterface: step = len(classNames) - 1 while step >= 0 and step < len(classNames): + # reget the args. they could change (especially direction) + (foo, args) = dispatch.currentStep() + nextWindow = None s = "from %s import %s; nextWindow = %s" % \ (file, classNames[step], classNames[step]) @@ -447,8 +453,10 @@ class InstallInterface: if rc == INSTALL_BACK: step = step - 1 + dispatch.dir = DISPATCH_BACK elif rc == INSTALL_OK: step = step + 1 + dispatch.dir = DISPATCH_FORWARD lastrc = rc diff --git a/textw/language_text.py b/textw/language_text.py index f113f2d7c..1b68057df 100644 --- a/textw/language_text.py +++ b/textw/language_text.py @@ -57,7 +57,8 @@ class LanguageWindow: if (flags.setupFilesystems and instLanguage.getFontFile(choice) == "bterm" and not isys.isPsudoTTY(0) - and not flags.serial): + and not flags.serial + and not isys.isVioConsole()): # bterm to the rescue... have to shut down the screen and # create a new one, though (and do a sleep) log("starting bterm") diff --git a/textw/network_text.py b/textw/network_text.py index ef22b6093..07d7f710f 100644 --- a/textw/network_text.py +++ b/textw/network_text.py @@ -23,6 +23,7 @@ from network import sanityCheckHostname from snack import * from constants_text import * from rhpl.translate import _ +from rhpl.log import log def badIPDisplay(screen, the_ip): @@ -54,8 +55,13 @@ class NetworkDeviceWindow: def runScreen(self, screen, network, dev, showonboot=1): boot = dev.get("bootproto") onboot = dev.get("onboot") - onbootIsOn = ((dev == network.available().values()[0] and not onboot) - or onboot == "yes") + + devnames = self.devices.keys() + devnames.sort() + if devnames.index(dev.get("DEVICE")) == 0: + onbootIsOn = 1 + else: + onbootIsOn = (onboot == "yes") if not boot: boot = "dhcp" @@ -118,9 +124,9 @@ class NetworkDeviceWindow: while 1: result = toplevel.run() rc = bb.buttonPressed (result) - screen.popWindow() if rc == TEXT_BACK_CHECK: + screen.popWindow() return INSTALL_BACK if self.onbootCb.selected() != 0: @@ -158,16 +164,17 @@ class NetworkDeviceWindow: break + screen.popWindow() return INSTALL_OK def __call__(self, screen, network, dir, intf, showonboot=1): - devices = network.available() - if not devices: + self.devices = network.available() + if not self.devices: return INSTALL_NOOP - list = devices.keys() + list = self.devices.keys() list.sort() devLen = len(list) if dir == 1: @@ -176,7 +183,8 @@ class NetworkDeviceWindow: currentDev = devLen - 1 while currentDev < devLen and currentDev >= 0: - rc = self.runScreen(screen, network, devices[list[currentDev]], showonboot) + rc = self.runScreen(screen, network, + self.devices[list[currentDev]], showonboot) if rc == INSTALL_BACK: currentDev = currentDev - 1 else: @@ -252,9 +260,9 @@ class NetworkGlobalWindow: while 1: result = toplevel.run() rc = bb.buttonPressed (result) - screen.popWindow() if rc == TEXT_BACK_CHECK: + screen.popWindow() return INSTALL_BACK val = gwEntry.value() @@ -281,7 +289,8 @@ class NetworkGlobalWindow: continue network.ternaryNS = val break - + + screen.popWindow() return INSTALL_OK @@ -352,9 +361,9 @@ class HostnameWindow: while 1: result = toplevel.run() rc = bb.buttonPressed(result) - screen.popWindow() if rc == TEXT_BACK_CHECK: + screen.popWindow() return INSTALL_BACK if radio.getSelection() != "manual": @@ -363,13 +372,13 @@ class HostnameWindow: else: hname = string.strip(hostEntry.value()) if len(hname) == 0: - ButtonChoiceWindow(_("Invalid Hostname"), + ButtonChoiceWindow(screen, _("Invalid Hostname"), _("You have not specified a hostname."), buttons = [ _("OK") ]) continue neterrors = sanityCheckHostname(hname) if neterrors is not None: - ButtonChoiceWindow(_("Invalid Hostname"), + ButtonChoiceWindow(screen, _("Invalid Hostname"), _("The hostname \"%s\" is not valid " "for the following reason:\n\n%s") %(hname, neterrors), @@ -380,6 +389,7 @@ class HostnameWindow: network.hostname = hname break + screen.popWindow() return INSTALL_OK diff --git a/textw/packages_text.py b/textw/packages_text.py index b972dd572..c539c386f 100644 --- a/textw/packages_text.py +++ b/textw/packages_text.py @@ -15,6 +15,7 @@ import rpm from snack import * from constants_text import * from rhpl.translate import _ +from hdrlist import orderPackageGroups class PackageGroupWindow: @@ -43,9 +44,13 @@ class PackageGroupWindow: origSelection = grpset.getSelectionState() ct = CheckboxTree(height = 8, scroll = 1) - for group in grpset.groups.values(): - if not group.hidden: - ct.append(group.name, group, group.isSelected(justManual = 1)) + + (parlist, pardict) = orderPackageGroups(grpset) + for par in parlist: + for grp in pardict[par]: + if grp.hidden: + continue + ct.append(grp.name, grp, grp.isSelected(justManual = 1)) cb = Checkbox (_("Select individual packages"), not dispatch.stepInSkipList("indivpackage")) diff --git a/textw/partition_text.py b/textw/partition_text.py index 81f050296..487daa725 100644 --- a/textw/partition_text.py +++ b/textw/partition_text.py @@ -178,7 +178,13 @@ class PartitionWindow: [LEFT, RIGHT, RIGHT, RIGHT, LEFT, LEFT]) else: - self.lb.append(["%s%s" %(indent, devify(get_partition_name(part))), + dev = devify(get_partition_name(part)) + # save some space per #90838 + if dev.startswith("/dev/iseries/"): + dev = dev[13:] + elif dev.startswith("/dev/"): + dev = dev[5:] + self.lb.append(["%s%s" %(indent, dev), "%d" %(start), "%d" %(end), "%dM" %(size), diff --git a/textw/xconfig_text.py b/textw/xconfig_text.py index 405d53a6d..a99b85f51 100644 --- a/textw/xconfig_text.py +++ b/textw/xconfig_text.py @@ -84,7 +84,7 @@ class XCustomWindow: print "Invalid widget in xconfig_text::desktopCB" - def __call__(self, screen, xsetup, monitor, videocard, desktop, comps, + def __call__(self, screen, xsetup, monitor, videocard, desktop, grpset, instClass, instPath): self.instPath = instPath @@ -113,11 +113,11 @@ class XCustomWindow: "1920x1440", "2048x1536"] #--If both KDE and GNOME are selected - if comps: - gnomeSelected = (comps.packages.has_key('gnome-session') - and comps.packages['gnome-session'].selected) - kdeSelected = (comps.packages.has_key('kdebase') - and comps.packages['kdebase'].selected) + if grpset: + gnomeSelected = (grpset.hdrlist.has_key('gnome-session') + and grpset.hdrlist['gnome-session'].isSelected()) + kdeSelected = (grpset.hdrlist.has_key('kdebase') + and grpset.hdrlist['kdebase'].isSelected()) else: gnomeSelected = 0 kdeSelected = 0 @@ -619,7 +619,7 @@ class XConfigWindowCard: text = _("Your system will be setup to " "use the frame buffer driver for " "the X Window System. If you do " - "not want setup the X Window " + "not want to setup the X Window " "System, choose " "'Skip X Configuration' below.") diff --git a/upgrade.py b/upgrade.py index acc60541b..9d05d90da 100644 --- a/upgrade.py +++ b/upgrade.py @@ -53,7 +53,7 @@ def findRootParts(intf, id, dispatch, dir, chroot): dispatch.skipStep("findinstall", skip = 1) dispatch.skipStep("installtype", skip = 0) -def findExistingRoots(intf, id, chroot): +def findExistingRoots(intf, id, chroot, upgradeany = 0): if not flags.setupFilesystems: return [(chroot, 'ext2', "")] diskset = partedUtils.DiskSet() @@ -63,7 +63,8 @@ def findExistingRoots(intf, id, chroot): _("Searching for %s installations...") % (productName,), 5) - rootparts = diskset.findExistingRootPartitions(intf, chroot) + rootparts = diskset.findExistingRootPartitions(intf, chroot, + upgradeany = upgradeany) for i in range(1, 6): time.sleep(0.5) win.set(i) diff --git a/utils/genhdlist.c b/utils/genhdlist.c index a952b7f12..ccbe7ac1e 100644 --- a/utils/genhdlist.c +++ b/utils/genhdlist.c @@ -173,7 +173,8 @@ int onePrePass(const char * dirName) { return 0; } -int onePass(FD_t outfd, FD_t out2fd, const char * dirName, int cdNum) { +int onePass(FD_t outfd, FD_t out2fd, const char * dirName, int cdNum, + int doSplit) { FD_t fd; struct dirent * ent; char * subdir = alloca(strlen(dirName) + 20); @@ -353,18 +354,20 @@ int onePass(FD_t outfd, FD_t out2fd, const char * dirName, int cdNum) { } compressFilelist(h); - h2 = headerNew(); - for (i = 0; tagsInList2[i] > -1; i++) { - int_32 type, c; - void * p; - - if (headerGetEntry(h, tagsInList2[i], &type, &p, &c)) { - headerAddEntry(h2, tagsInList2[i], type, p, c); - headerRemoveEntry(h, tagsInList2[i]); - } - - /* XXX need to headerFreeData */ - } + if (doSplit) { + h2 = headerNew(); + for (i = 0; tagsInList2[i] > -1; i++) { + int_32 type, c; + void * p; + + if (headerGetEntry(h, tagsInList2[i], &type, &p, &c)) { + headerAddEntry(h2, tagsInList2[i], type, p, c); + headerRemoveEntry(h, tagsInList2[i]); + } + + /* XXX need to headerFreeData */ + } + } if (newFileList) { headerAddEntry(h, RPMTAG_OLDFILENAMES, @@ -382,14 +385,17 @@ int onePass(FD_t outfd, FD_t out2fd, const char * dirName, int cdNum) { free(newFileFlags); newFileList = NULL; } - - headerAddEntry(h, MATCHER_TAG, RPM_INT32_TYPE, &marker, 1); - headerAddEntry(h2, MATCHER_TAG, RPM_INT32_TYPE, &marker, 1); - marker++; + + if (doSplit) { + headerAddEntry(h, MATCHER_TAG, RPM_INT32_TYPE, &marker, 1); + headerAddEntry(h2, MATCHER_TAG, RPM_INT32_TYPE, &marker, 1); + marker++; + } nh = headerCopy (h); headerWrite(outfd, nh, HEADER_MAGIC_YES); - headerWrite(out2fd, h2, HEADER_MAGIC_YES); + if (doSplit) + headerWrite(out2fd, h2, HEADER_MAGIC_YES); headerFree(h); headerFree(nh); @@ -419,10 +425,11 @@ static void usage(void) { int main(int argc, const char ** argv) { char buf[300]; - FD_t outfd, out2fd; + FD_t outfd = NULL, out2fd = NULL; int cdNum = -1; const char ** args; int doNumber = 0; + int split = 1, noSplit = 0, doSplit = 0; int rc; int i; char * hdListFile = NULL; @@ -433,6 +440,8 @@ int main(int argc, const char ** argv) { { "hdlist", '\0', POPT_ARG_STRING, &hdListFile, 0 }, { "withnumbers", '\0', 0, &doNumber, 0 }, { "fileorder", '\0', POPT_ARG_STRING, &depOrderFile, 0 }, + { "nosplit", '\0', 0, &noSplit, 0 }, + { "split", '\0', 0, &split, 0 }, { 0, 0, 0, 0, 0 } }; @@ -450,6 +459,8 @@ int main(int argc, const char ** argv) { if (!args || !args[0] || !args[0][0]) usage(); + if (split && !noSplit) doSplit = 1; + if (depOrderFile) { FILE *f; int nalloced = 0; @@ -511,11 +522,13 @@ int main(int argc, const char ** argv) { return 1; } - out2fd = Fopen(hdListFile2, "w"); - if (!out2fd) { - fprintf(stderr,"error creating file %s: %s\n", hdListFile2, - strerror(errno)); - return 1; + if (doSplit) { + out2fd = Fopen(hdListFile2, "w"); + if (!out2fd) { + fprintf(stderr,"error creating file %s: %s\n", hdListFile2, + strerror(errno)); + return 1; + } } if (doNumber) @@ -535,14 +548,15 @@ int main(int argc, const char ** argv) { i = 0; while (args[i]) { - if (onePass(outfd, out2fd, args[i], cdNum)) + if (onePass(outfd, out2fd, args[i], cdNum, doSplit)) return 1; if (doNumber) cdNum++; i++; } Fclose(outfd); - Fclose(out2fd); + if (doSplit) + Fclose(out2fd); poptFreeContext(optCon); |