summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2003-05-20 20:08:02 +0000
committerJeremy Katz <katzj@redhat.com>2003-05-20 20:08:02 +0000
commit50e73041839cce44304d50c1890aefb799b9782c (patch)
tree618dcf6580b677163b90bfc80e1a0dac20958c1d
parenta51283fad449d1ac3dbb01c65dd6f04aa57416c3 (diff)
downloadanaconda-50e73041839cce44304d50c1890aefb799b9782c.tar.gz
anaconda-50e73041839cce44304d50c1890aefb799b9782c.tar.xz
anaconda-50e73041839cce44304d50c1890aefb799b9782c.zip
merge fixes from taroon branch:
* syntax error * fix upgrades * fix writing out of %packages in anaconda-ks.cfg * create the Everything group
-rw-r--r--hdrlist.py26
-rw-r--r--instdata.py100
-rw-r--r--packages.py8
-rw-r--r--upgrade.py52
4 files changed, 100 insertions, 86 deletions
diff --git a/hdrlist.py b/hdrlist.py
index df91adc97..42b9dc69d 100644
--- a/hdrlist.py
+++ b/hdrlist.py
@@ -38,6 +38,17 @@ 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.")
+
+EverythingExclude = {'kernel' : None, 'kernel-BOOT' : None,
+ 'kernel-smp' : None, 'kernel-bigmem' : None,
+ 'kernel-summit' : None, 'kernel-enterprise' : None,
+ 'kernel-tape' : None, 'kernel-BOOTtape' : None,
+ 'kernel-pseries': None, 'kernel-iseries': None}
+
def showMem():
f = open("/proc/self/status", "r")
lines = f.readlines()
@@ -540,6 +551,18 @@ class GroupSet:
group = Group(self, xmlgrp)
self.groups[xmlgrp.id] = group
+ # build up an Everything group
+ everything = rhpl.comps.Group(self.compsxml)
+ everything.name = N_("Everything")
+ everything.id = "everything"
+ everything.description = EVERYTHING_DESCRIPTION
+ for pkgname in hdrlist.pkgnames.keys():
+ if EverythingExclude.has_key(pkgname):
+ continue
+ everything.packages[pkgname] = (u'mandatory', pkgname)
+ self.compsxml.groups["Everything"] = everything
+ self.groups["everything"] = Group(self, everything)
+
# have to do includes and metagroups in a second pass so that
# we can make sure the group is defined.
for xmlgrp in compsxml.groups.values():
@@ -551,6 +574,7 @@ class GroupSet:
continue
group.addGroupRequires(id)
# FIXME: need to add back metapkgs
+
def mergePackageDeps(self):
self.hdrlist.mergePackageDeps(self.compsxml.packages)
@@ -826,3 +850,5 @@ if __name__ == "__main__":
print depcheck.added
sys.exit(0)
ts.run(simpleInstallCallback, 0)
+
+
diff --git a/instdata.py b/instdata.py
index a8c7ca9da..0452143dd 100644
--- a/instdata.py
+++ b/instdata.py
@@ -23,6 +23,7 @@ import fsset
import bootloader
import partitions
import partedUtils
+import hdrlist
from flags import *
from constants import *
@@ -148,7 +149,6 @@ class InstallData:
self.accounts.writeKScommands(f, self.auth)
def writePackagesKS(self, f):
- return
f.write("\n%packages")
if self.handleDeps == IGNORE_DEPS:
f.write(" --ignoredeps\n")
@@ -159,66 +159,50 @@ class InstallData:
packages = {}
forcedoff = {}
forcedon = {}
- for comp in self.comps:
- if comp.isSelected():
- if (comp.isSelected(justManual = 1) and comp.name != "Base"
- and comp.name != "Core"):
- f.write("@ %s\n" % comp.name)
-
- for metapkg in comp.metapkgs.keys():
- (type, on) = comp.metapkgs[metapkg]
- default = comp.metadef[metapkg]
- if on == 1 and default == 0:
- f.write("@ %s\n" % metapkg.name)
- elif on == 0 and default == 1:
- # this isn't quite right
- for pkg in metapkg.newpkgDict.keys():
- forcedoff[pkg.name] = 1
-
- for pkg in comp.newpkgDict.keys():
+ for group in self.grpset.groups.values():
+ if group.isSelected():
+ if (group.isSelected(justManual = 1) and group.id != "base"
+ 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
+
+ for (pkgnevra, pkg) in group.packages.items():
+ name = self.grpset.hdrlist[pkgnevra].name
# if it's in base or core, it really should be installed
- if comp.name == "Base" or comp.name == "Core":
- packages[pkg.name] = 1
- elif comp.newpkgDict.has_key(pkg):
- (type, installed) = comp.newpkgDict[pkg]
- # if it's mandatory, put it in the dict of ones
- # already handled
- if type == 0:
- packages[pkg.name] = 1
+ if group.id == "base" or group.id == "core":
+ packages[name] = 1
+ else:
+ if pkg["type"] == hdrlist.PKGTYPE_MANDATORY:
+ packages[name] = 1
else:
- if comp.optDict.has_key(pkg):
- type = comp.optDict[pkg]
- # it's default and selected for installation
- if type == 1 and installed == 1:
- packages[pkg.name] = 1
- # default and off
- elif type == 1 and installed == 0:
- forcedoff[pkg.name] = 1
- # optional and on
- elif type == 2 and installed == 1:
- forcedon[pkg.name] = 1
- # optional and off
- elif type == 2 and installed == 0:
- pass
- else:
- # otherwise it's optional -- if it's off, we
- # should mark it as forced off so that it
- # gets listed as such in the comps file
- if installed == 0:
- forcedoff[pkg.name] = 1
- # or if it's there as a dep, pretend we don't care
- elif comp.depsDict.has_key(pkg.name):
- packages[pkg.name] = 1
-
- for pkg in comp.depsDict.keys():
- packages[pkg] = 1
-
-
- for pkg in self.hdList.values():
- if pkg.isSelected() and (forcedon.has_key(pkg.name) or
- not packages.has_key(pkg.name)):
+ if ((pkg["type"] == hdrlist.PKGTYPE_DEFAULT) and
+ (pkg["state"] in hdrlist.ON_STATES)):
+ packages[name] = 1
+ elif ((pkg["type"] == hdrlist.PKGTYPE_DEFAULT) and
+ (pkg["state"] in hdrlist.OFF_STATES)):
+ forcedoff[name] = 1
+ elif ((pkg["type"] == hdrlist.PKGTYPE_OPTIONAL) and
+ (pkg["state"] in hdrlist.ON_STATES)):
+ forcedon[name] = 1
+ elif ((pkg["type"] == hdrlist.PKGTYPE_OPTIONAL) and
+ (pkg["state"] not in hdrlist.ON_STATES)):
+ pass
+
+ for pkg in self.grpset.hdrlist.values():
+ if ((pkg.isSelected() and pkg.manual_state == 2) or
+ (forcedon.has_key(pkg.name))):
f.write("%s\n" % pkg.name)
- if pkg.wasForcedOff() or forcedoff.has_key(pkg.name):
+ if ((not pkg.isSelected() and pkg.manual_state == -2) or
+ forcedoff.has_key(pkg.name)):
f.write("-%s\n" %(pkg.name))
def __init__(self, extraModules, floppyDevice, configFileData, methodstr):
diff --git a/packages.py b/packages.py
index 49362b18f..c87e5698d 100644
--- a/packages.py
+++ b/packages.py
@@ -922,10 +922,10 @@ def doInstall(method, id, intf, instPath):
for p in id.grpset.hdrlist.values():
if not p.isSelected():
lines.append("%s-%s-%s.%s.rpm\n" %
- (p.h[rpm.RPMTAG_NAME],
- p.h[rpm.RPMTAG_VERSION],
- p.h[rpm.RPMTAG_RELEASE],
- p.h[rpm.RPMTAG_ARCH]))
+ (p.hdr[rpm.RPMTAG_NAME],
+ p.hdr[rpm.RPMTAG_VERSION],
+ p.hdr[rpm.RPMTAG_RELEASE],
+ p.hdr[rpm.RPMTAG_ARCH]))
lines.sort()
for line in lines:
instLog.write(line)
diff --git a/upgrade.py b/upgrade.py
index 4e43be813..acc60541b 100644
--- a/upgrade.py
+++ b/upgrade.py
@@ -24,6 +24,7 @@ import partedUtils
import string
import shutil
import lvm
+import hdrlist
from flags import flags
from fsset import *
from partitioning import *
@@ -328,7 +329,7 @@ def upgradeFindPackages(intf, method, id, instPath, dir):
if not rebuildTime:
rebuildTime = str(int(time.time()))
try:
- method.mergeFullHeaders(id.hdList)
+ method.mergeFullHeaders(id.grpset.hdrlist)
except FileCopyException:
method.unmountCD()
intf.messageWindow(_("Error"),
@@ -377,7 +378,8 @@ def upgradeFindPackages(intf, method, id, instPath, dir):
except:
log("failed to unlink /var/lib/rpm/%s" %(file,))
- packages = findpackageset.findpackageset(id.hdList.hdlist, instPath)
+ packages = findpackageset.findpackageset(id.grpset.hdrlist.hdlist,
+ instPath)
except rpm.error:
if id.dbpath is not None:
resetRpmdb(id.dbpath, instPath)
@@ -388,16 +390,16 @@ def upgradeFindPackages(intf, method, id, instPath, dir):
sys.exit(0)
# Turn off all comps
- for comp in id.comps:
- comp.unselect()
+ id.grpset.unselectAll()
# unselect all packages
- for package in id.hdList.packages.values():
- package.selected = 0
+ for package in id.grpset.hdrlist.pkgs.values():
+ package.usecount = 0
+ package.manual_state = 0
# turn on the packages in the upgrade set
for package in packages:
- id.hdList[package[rpm.RPMTAG_NAME]].select()
+ id.grpset.hdrlist[hdrlist.nevra(package)].select()
# open up the database to check dependencies and currently
# installed packages
@@ -549,7 +551,7 @@ def upgradeFindPackages(intf, method, id, instPath, dir):
# FIXME: generalize so that specific bits aren't needed
if iutil.getArch() == "i386" and id.bootloader.useGrub():
log("Upgrade: User selected to use GRUB for bootloader")
- if id.hdList.has_key("grub") and not id.hdList["grub"].isSelected():
+ if id.grpset.hdrlist.has_key("grub") and not id.grpset.hdrlist["grub"].isSelected():
log("Upgrade: grub is not currently selected to be upgraded")
h = ts.dbMatch('name', 'grub').next()
if h is None:
@@ -557,10 +559,10 @@ def upgradeFindPackages(intf, method, id, instPath, dir):
"system, selecting GRUB")
id.upgradeDeps ="%s%s\n" % (id.upgradeDeps, text)
log(text)
- id.hdList["grub"].select()
+ id.grpset.hdrlist["grub"].select()
if iutil.getArch() == "i386" and not id.bootloader.useGrub():
log("Upgrade: User selected to use LILO for bootloader")
- if id.hdList.has_key("lilo") and not id.hdList["lilo"].isSelected():
+ if id.grpset.hdrlist.has_key("lilo") and not id.grpset.hdrlist["lilo"].isSelected():
log("Upgrade: lilo is not currently selected to be upgraded")
h = ts.dbMatch('name', 'lilo').next()
if h is None:
@@ -568,7 +570,7 @@ def upgradeFindPackages(intf, method, id, instPath, dir):
"system, selecting LILO")
id.upgradeDeps ="%s%s\n" % (id.upgradeDeps, text)
log(text)
- id.hdList["lilo"].select()
+ id.grpset.hdrlist["lilo"].select()
h = ts.dbMatch('name', 'gnome-core').next()
@@ -578,8 +580,8 @@ def upgradeFindPackages(intf, method, id, instPath, dir):
for pkg in ("gnome-terminal", "gnome-desktop", "gnome-session",
"gnome-panel", "metacity", "file-roller", "yelp",
"nautilus"):
- if id.hdList.has_key(pkg) and not id.hdList[pkg].isSelected():
- id.hdList[pkg].select()
+ if id.grpset.hdrlist.has_key(pkg) and not id.grpset.hdrlist[pkg].isSelected():
+ id.grpset.hdrlist[pkg].select()
upgraded.append(pkg)
text = ("Upgrade: gnome-core is on the system. Selecting packages "
@@ -588,8 +590,8 @@ def upgradeFindPackages(intf, method, id, instPath, dir):
# if they have up2date-gnome, they probably want the applet now too
# since it works in both gnome and kde
- if (id.hdList.has_key("rhn-applet")
- and not id.hdList["rhn-applet"].isSelected()):
+ if (id.grpset.hdrlist.has_key("rhn-applet")
+ and not id.grpset.hdrlist["rhn-applet"].isSelected()):
log("Upgrade: rhn-applet is not currently selected to be upgraded")
h = ts.dbMatch('name', 'up2date-gnome').next()
@@ -601,7 +603,7 @@ def upgradeFindPackages(intf, method, id, instPath, dir):
"rhn-applet to be installed")
id.upgradeDeps = "%s%s\n" % (id.upgradeDeps, text)
log(text)
- id.hdList["rhn-applet"].select()
+ id.grpset.hdrlist["rhn-applet"].select()
# now some upgrade removal black list checking... there are things that
# if they were installed in the past, we want to remove them because
@@ -616,14 +618,16 @@ def upgradeFindPackages(intf, method, id, instPath, dir):
id.upgradeRemove.append(pkg)
# new package dependency fixup
- deps = id.comps.verifyDeps(instPath, 1)
- for (name, suggest) in deps:
- if suggest != _("no suggestion"):
- text = ("Upgrade Dependency: %s needs %s, "
- "automatically added." % (name, suggest))
- log(text)
- id.upgradeDeps = "%s%s\n" % (id.upgradeDeps, text)
- id.comps.selectDeps(deps)
+ depcheck = hdrlist.DependencyChecker(id.grpset, how = "u")
+ for p in id.grpset.hdrlist.pkgs.values():
+ if p.isSelected():
+ ts.addInstall(p.hdr, p.hdr, "u")
+ deps = ts.check(depcheck.callback)
+ for pkgnevra in deps:
+ text = ("Upgrade Dependency: Needs %s, "
+ "automatically added." % (pkgnevra,))
+ # log(text)
+ id.upgradeDeps = "%s%s\n" % (id.upgradeDeps, text)
win.pop()