Re: yum update so slow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2007-09-24 at 11:45 +0200, Jochen Schlick wrote:
> Hi, I have a laptop where rawhide is installed since the days
> of Fedora Core 1. It has only 256MB ram so updating using yum
> was always like a lame duck but nowadays it's really a crap.

 This might not help, but if you'd like to try something I've attached
some python code which calls yum and "iterativlely updates". This might
make it be small enough that it isn't living in swap, or at least not as
badly.
 Let me know how it goes.

-- 
James Antill <james.antill@xxxxxxxxxx>
Red Hat
#! /usr/bin/python -tt

# Copyright 2007 Red Hat
# Author: James Antill <jantill@xxxxxxxxxx>

import os
import sys

import yum
from yum.update_md import UpdateMetadata


def current_updates():
    y = yum.YumBase()

    y.localPackages = []
    y.updates = []

    y.doConfigSetup(init_plugins=False)

    return y.doPackageLists('updates')

ygh = current_updates()

sec_only  = False

if len(sys.argv) == 2:
    if sys.argv[1] == "security":
        sec_only = True

needsReboot = False
repos = []

if sec_only:
    upmd = UpdateMetadata()

    for i in ygh.updates:
        if i.repo not in repos:
            repos.append(i.repo)

    for r in repos:
        try: # attempt to grab the updateinfo.xml.gz from the repodata
            upmd.add(r)
        except yum.Errors.RepoMDError:
            pass # No metadata found for this repo

# Walk our list of updates trying to do them one at a time
my_updates = ygh.updates[:]
pkg = None
while my_updates:
    if pkg in ygh.updates:
        print >>sys.stderr, " Error: Failed to update:", pkg
        
    pkg = my_updates.pop(0)
    if pkg not in ygh.updates:
        pkg = None
        continue
    
    md = True
    if sec_only:
        md = upmd.get_notice((pkg.name, pkg.ver, pkg.rel))
    if md:
        if sec_only:
            md = md.get_metadata()
            if md['type'] != 'security':
                pkg = None
                continue
        print "Updating:", pkg
        os.system("yum update -d 0 -y %s" % pkg.name)

    ygh = current_updates()

Attachment: signature.asc
Description: This is a digitally signed message part

-- 
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux