yum-pluginize our upgrade magic

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

 



As you may be aware, anaconda has some special upgrade magic in the form
of the whiteout list and the upgrade blacklist.  The whiteout list helps
us to know where to split dependency loops, and the blacklist helps us
to know which packages should be removed on upgrade.  This is mostly due
to packages changing from multilib to not.

Problem is, this information is buried inside anaconda and is not at all
easy to import into other programs.  preupgrade in particular would love
to have this knowledge so it can download the same set of packages that
anaconda would.  Right now, preupgrade is getting different results
because it just doesn't know what to do in the strange upgrade corner
cases.  I'm sure Will or Jeremy can give a specific example.

My solution for this problem is to break the whiteout and upgrade
blacklist into repo metadata files, and then write a pair of yum plugins
to handle interpreting the metadata.  Both anaconda and preupgrade can
then make use of these plugins.

Attached is my two yum plugins (the first two I've ever actually
written, so there's bound to be something I missed) and examples of the
two metadata files.  Of course we may want to alter the format of the
metadata.  These files will need to be maintained by hand in some
version control, similar to comps.  We'll also need to make sure they
get written out to repomd.xml.

I have performed minimal testing.  I'd like to try them out with
preupgrade, but haven't been able to get to that yet.  Anyway, comments?

- Chris
<blacklist>
    <package name="system-config-mouse" />
    <package name="dev" />
    <package name="e2fsprogs" arch="i386" />
    <package name="hal" arch="i386" />
    <package name="mysql" arch="i386" />
    <package name="esound" arch="i386" />
    <package name="mkinitrd" arch="i386" />
    <package name="dbus" arch="i386" />
    <package name="kdeaccessibility" arch="i386" />
    <package name="kdebase" arch="i386" />
    <package name="kdeedu" arch="i386" />
    <package name="kdegraphics" arch="i386" />
    <package name="kdemultimedia" arch="i386" />
    <package name="kdemultimedia-extras" arch="i386" />
    <package name="kdenetwork" arch="i386" />
    <package name="kdesdk" arch="i386" />
    <package name="kdeutils" arch="i386" />
    <package name="kdewebdev" arch="i386" />
    <package name="gdb" arch="i386" />
    <package name="kmymoney2" arch="i386" />
    <package name="gnome-applets" arch="i386" />
    <package name="geomview" arch="i386" />
    <package name="gnome-panel" arch="i386" />
    <package name="nas" arch="i386" />
    <package name="perl" arch="i386" />
    <package name="e2fsprogs" arch="ppc64" />
    <package name="hal" arch="ppc64" />
    <package name="mysql" arch="ppc64" />
    <package name="esound" arch="ppc64" />
    <package name="mkinitrd" arch="ppc64" />
    <package name="dbus" arch="ppc64" />
    <package name="kdeaccessibility" arch="ppc64" />
    <package name="kdebase" arch="ppc64" />
    <package name="kdeedu" arch="ppc64" />
    <package name="kdegraphics" arch="ppc64" />
    <package name="kdemultimedia" arch="ppc64" />
    <package name="kdemultimedia-extras" arch="ppc64" />
    <package name="kdenetwork" arch="ppc64" />
    <package name="kdesdk" arch="ppc64" />
    <package name="kdeutils" arch="ppc64" />
    <package name="kdewebdev" arch="ppc64" />
    <package name="gdb" arch="ppc64" />
    <package name="kmymoney2" arch="ppc64" />
    <package name="gnome-applets" arch="ppc64" />
    <package name="geomview" arch="ppc64" />
    <package name="gnome-panel" arch="ppc64" />
    <package name="nas" arch="ppc64" />
</blacklist>
#!/usr/bin/python
#
# Copyright (C) 2008
# Red Hat, Inc.  All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Author(s): Chris Lumens <clumens@xxxxxxxxxx>

# This yum plugin handles the upgrade blacklist.  This is a repo-specific
# metadata file that tells us about packages that have been obsoleted by
# some other package and should therefore be removed on upgrade.  Usually
# packages themselves provide this information through Obsoletes:, but
# with multilib we can't always count on that.
from yum.plugins import TYPE_CORE

try:
    from xml.etree import cElementTree
except ImportError:
    import cElementTree

iterparse = cElementTree.iterparse

requires_api_version = '2.6'
plugin_type = (TYPE_CORE, )

def exclude_hook(conduit):
    rpmdb = conduit.getRpmDB()
    tsinfo = conduit.getTsInfo()

    for repo in conduit.getRepos().listEnabled():
        try:
            infile = repo.retrieveMD("blacklist")
        except:
            continue

        for event, elem in iterparse(infile):
            if elem.tag == "package":
                name = elem.get("name")
                try:
                    arch = elem.get("arch")
                except:
                    arch = None

                for po in rpmdb.searchNevra(name=name, arch=arch):
                    tsinfo.addErase(po)
pango-gtkbeta-devel>pango-gtkbeta
XFree86>Mesa
xorg-x11>Mesa
compat-glibc>db2
compat-glibc>db1
pam>initscripts
initscripts>sysklogd
arts>kdelibs-sound
libgnomeprint15>gnome-print
nautilus>nautilus-mozilla
tcl>postgresql-tcl
libtermcap>bash
modutils>vixie-cron
ypbind>yp-tools
ghostscript-fonts>ghostscript
usermode>util-linux
control-center>xscreensaver
kdemultimedia-arts>kdemultimedia-libs
initscripts>util-linux
XFree86-libs>XFree86-Mesa-libGL
xorg-x11-libs>xorg-x11-Mesa-libGL
mysql>perl-DBD-MySQL
ghostscript>gimp-print
bind>bind-utils
perl>mod_perl
perl>perl-Filter
coreutils>pam
perl>mrtg
perl-Date-Calc>perl-Bit-Vector
glibc-debug>glibc-devel
xinitrc>XFree86
xinitrc>xorg-x11
xemacs>apel-xemacs
gimp>gimp-print-plugin
redhat-lsb>redhat-lsb
info>ncurses
aspell>aspell-en
dbus>dbus-glib
xemacs>xemacs-sumo
ncurses>gpm
cyrus-sasl>openldap
lvm2>kernel
initscripts>kernel
initscripts>kernel-smp
httpd>httpd-suexec
php>php-pear
gnome-python2>gnome-python2-bonobo
openoffice.org-libs>openoffice.org
gtk+>gdk-pixbuf
nautilus>nautilus-cd-burner
hicolor-icon-theme>gtk2
gtk2>scim-libs
#!/usr/bin/python
#
# Copyright (C) 2008
# Red Hat, Inc.  All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Author(s): Chris Lumens <clumens@xxxxxxxxxx>

# This yum plugin handles the whiteout file.  The whiteout is a repo-specific
# metadata file that is used to break loops in dependencies.
from yum.plugins import TYPE_CORE

requires_api_version = '2.6'
plugin_type = (TYPE_CORE, )

def postreposetup_hook(conduit):
    import rpm

    whiteout = ""

    # Merge the whiteout files from all enabled repos together.
    for repo in conduit.getRepos().listEnabled():
        try:
            f = repo.retrieveMD("whiteout")
            infile = open(f)
            lines = infile.readlines()
            infile.close()
        except:
            continue

        whiteout += " \\\n".join(map (lambda l: l.rstrip(), lines))

    rpm.addMacro("_dependency_whiteout", whiteout)
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux