summaryrefslogtreecommitdiffstats
path: root/packages.py
diff options
context:
space:
mode:
authorPaul Nasrat <pnasrat@redhat.com>2005-08-19 19:43:39 +0000
committerPaul Nasrat <pnasrat@redhat.com>2005-08-19 19:43:39 +0000
commit34737651369521e81d9c307f3bbad84c0b82f4e5 (patch)
tree95082c7e3055d77dc6d6eaa5f1b4f667faa552b7 /packages.py
parent231a239587b541492e90879ceb12c8f777e63f9f (diff)
downloadanaconda-34737651369521e81d9c307f3bbad84c0b82f4e5.tar.gz
anaconda-34737651369521e81d9c307f3bbad84c0b82f4e5.tar.xz
anaconda-34737651369521e81d9c307f3bbad84c0b82f4e5.zip
break all but nfs installs
Diffstat (limited to 'packages.py')
-rw-r--r--packages.py279
1 files changed, 0 insertions, 279 deletions
diff --git a/packages.py b/packages.py
index f8996ed3a..faad56fd4 100644
--- a/packages.py
+++ b/packages.py
@@ -719,285 +719,6 @@ def doPreInstall(method, id, intf, instPath, dir):
# else:
# id.fsset.migratewrite(instPath)
-def doInstall(method, id, intf, instPath):
- if flags.test:
- return
-
- # set up dependency white outs
- import whiteout
-
- upgrade = id.getUpgrade()
- ts = getAnacondaTS(instPath)
-
- total = 0
- totalSize = 0
- totalFiles = 0
-
- if upgrade:
- how = "u"
- else:
- how = "i"
- rpm.addMacro("__dbi_htconfig", "hash nofsync %{__dbi_other} %{__dbi_perms}")
-
- if id.excludeDocs:
- rpm.addMacro("_excludedocs", "1")
-
- l = []
-
- for p in id.grpset.hdrlist.values():
- if p.isSelected():
- l.append(p)
- l.sort(sortPackages)
-
- progress = intf.progressWindow(_("Processing"),
- _("Preparing RPM transaction..."),
- len(l))
-
-
- # this is kind of a hack, but has to be done so we can have a chance
- # with broken triggers
- if upgrade and len(id.upgradeRemove) > 0:
- # simple rpm callback since erasure doesn't need anything
- def install_callback(what, bytes, total, h, user):
- pass
-
- for pkg in id.upgradeRemove:
- ts.addErase(pkg)
-
- # set the rpm log file to /dev/null to start with so we don't segfault
- f = open("/dev/null", "w+")
- rpm.setLogFile(f)
- ts.scriptFd = f.fileno()
-
- # if we hit problems, it's not like there's anything we can
- # do about it
- ts.run(install_callback, 0)
-
- # new transaction set
- ts.closeDB()
- del ts
- ts = getAnacondaTS(instPath)
-
- # we don't want to try to remove things more than once (#84221)
- id.upgradeRemove = []
-
- i = 0
- updcount = 0
- updintv = len(l) / 25
- for p in l:
- ts.addInstall(p.hdr, p.hdr, how)
- total = total + 1
- totalSize = totalSize + (p[rpm.RPMTAG_SIZE] / 1024)
- totalFiles = totalFiles + len(p[rpm.RPMTAG_BASENAMES])
- i = i + 1
-
- # HACK - dont overload progress bar with useless requests
- updcount = updcount + 1
- if updcount > updintv:
- progress.set(i)
- updcount = 0
-
- progress.pop()
-
- # set the rpm log file to /dev/null to start with so we don't segfault
- f = open("/dev/null", "w+")
- rpm.setLogFile(f)
- ts.scriptFd = f.fileno()
-
- depcheck = DependencyChecker(id.grpset)
- if not id.grpset.hdrlist.preordered():
- log.warning ("not all packages in hdlist had order tag")
- # have to call ts.check before ts.order() to set up the alIndex
- ts.check(depcheck.callback)
- ts.order()
- else:
- ts.check(depcheck.callback)
-
- f.close()
-
- if upgrade:
- logname = '/root/upgrade.log'
- else:
- logname = '/root/install.log'
-
- instLogName = instPath + logname
- try:
- iutil.rmrf (instLogName)
- except OSError:
- pass
-
- instLog = open(instLogName, "w+")
-
- # dont start syslogd if we arent creating filesystems
- if flags.setupFilesystems:
- syslogname = "%s%s.syslog" % (instPath, logname)
- try:
- iutil.rmrf (syslogname)
- except OSError:
- pass
- syslog.start (instPath, syslogname)
- else:
- syslogname = None
-
- if id.compspkg is not None:
- num = i + 1
- else:
- num = i
-
- if upgrade:
- instLog.write(_("Upgrading %s packages\n\n") % (num,))
- else:
- instLog.write(_("Installing %s packages\n\n") % (num,))
-
- ts.scriptFd = instLog.fileno ()
- rpm.setLogFile(instLog)
- # the transaction set dup()s the file descriptor and will close the
- # dup'd when we go out of scope
-
- if upgrade:
- modeText = _("Upgrading %s-%s-%s.%s.\n")
- else:
- modeText = _("Installing %s-%s-%s.%s.\n")
-
- errors = rpmErrorClass(instLog)
- pkgTimer = timer.Timer(start = 0)
-
- id.instProgress.setSizes(total, totalSize, totalFiles)
- id.instProgress.processEvents()
-
- cb = InstallCallback(intf.messageWindow, id.instProgress, pkgTimer,
- method, intf.progressWindow, instLog, modeText,
- ts)
-
- # write out migrate adjusted fstab so kernel RPM can get initrd right
- if upgrade:
- id.fsset.migratewrite(instPath)
- if id.upgradeDeps:
- instLog.write(_("\n\nThe following packages were automatically\n"
- "selected to be installed:"
- "\n"
- "%s"
- "\n\n") % (id.upgradeDeps,))
-
- cb.initWindow = intf.waitWindow(_("Install Starting"),
- _("Starting install process. This may take several minutes..."))
-
- ts.setProbFilter(~rpm.RPMPROB_FILTER_DISKSPACE)
- problems = ts.run(cb.cb, 0)
-
- if problems:
- # restore old fstab if we did anything for migrating
- if upgrade:
- id.fsset.restoreMigratedFstab(instPath)
-
- spaceneeded = {}
- nodeneeded = {}
- size = 12
-
- for (descr, (type, mount, need)) in problems:
- log.warning("(%s, (%s, %s, %s))" %(descr, type, mount, need))
- if mount and mount.startswith(instPath):
- mount = mount[len(instPath):]
- if not mount:
- mount = '/'
-
- if type == rpm.RPMPROB_DISKSPACE:
- if spaceneeded.has_key (mount) and spaceneeded[mount] < need:
- spaceneeded[mount] = need
- else:
- spaceneeded[mount] = need
- elif type == nodeprob:
- if nodeneeded.has_key (mount) and nodeneeded[mount] < need:
- nodeneeded[mount] = need
- else:
- nodeneeded[mount] = need
- else:
- if descr is None:
- descr = "no description"
- log.warning ("unhandled problem returned from "
- "transaction set type %d (%s)",
- type, descr)
-
- probs = ""
- if spaceneeded:
- probs = probs + _("You don't appear to have enough disk space "
- "to install the packages you've selected. "
- "You need more space on the following "
- "file systems:\n\n")
- probs = probs + ("%-15s %s\n") % (_("Mount Point"),
- _("Space Needed"))
-
- for (mount, need) in spaceneeded.items ():
- log.warning("(%s, %s)" %(mount, need))
- if need > (1024*1024):
- need = (need + 1024 * 1024 - 1) / (1024 * 1024)
- suffix = "M"
- else:
- need = (need + 1023) / 1024
- suffix = "k"
-
- prob = "%-15s %d %c\n" % (mount, need, suffix)
- probs = probs + prob
- if nodeneeded:
- if probs:
- probs = probs + '\n'
- probs = probs + _("You don't appear to have enough file nodes "
- "to install the packages you've selected. "
- "You need more file nodes on the following "
- "file systems:\n\n")
- probs = probs + ("%-15s %s\n") % (_("Mount Point"),
- _("Nodes Needed"))
-
- for (mount, need) in nodeneeded.items ():
- prob = "%-15s %d\n" % (mount, need)
- probs = probs + prob
-
- if len(probs) == 0:
- probs = ("ERROR: NO! An unexpected problem has occurred with "
- "your transaction set. Please see tty3 for more "
- "information")
-
- intf.messageWindow (_("Disk Space"), probs)
-
- ts.closeDB()
- del ts
- instLog.close()
-
- if syslogname:
- syslog.stop()
-
- method.systemUnmounted ()
-
- return DISPATCH_BACK
-
- # This should close the RPM database so that you can
- # do RPM ops in the chroot in a %post ks script
- ts.closeDB()
- del ts
-
- # make sure the window gets popped (#82862)
- if not cb.beenCalled:
- cb.initWindow.pop()
-
- method.filesDone ()
-
- # rpm environment files go bye-bye
- for file in ["__db.001", "__db.002", "__db.003"]:
- try:
- os.unlink("%s/var/lib/rpm/%s" %(instPath, file))
- except Exception, e:
- log.error("failed to unlink /var/lib/rpm/%s: %s" %(file,e))
- # FIXME: remove the /var/lib/rpm symlink that keeps us from having
- # db->close error messages shown. I don't really like this though :(
- try:
- os.unlink("/var/lib/rpm")
- except Exception, e:
- log.error("failed to unlink /var/lib/rpm: %s" %(e,))
-
- instLog.close ()
-
- id.instProgress = None
-
def doPostInstall(method, id, intf, instPath):
if flags.test:
return