FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 07-14-2008, 05:57 PM
Chris Lumens
 
Default yum-pluginize our upgrade magic

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
#!/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@redhat.com>

# 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@redhat.com>

# 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 += "
".join(map (lambda l: l.rstrip(), lines))

rpm.addMacro("_dependency_whiteout", whiteout)
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 07-14-2008, 06:19 PM
Jeremy Katz
 
Default yum-pluginize our upgrade magic

Two tiny nits --
1) import rpm at the toplevel of the whiteout plugin please, no reason
not to
2) Not convinced that exclude is the right place to hook for the remove
stuff. I'd be slightly inclined to do the preresolve slot instead

Otherwise, looks fine to me

Jeremy

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 07-14-2008, 06:25 PM
seth vidal
 
Default yum-pluginize our upgrade magic

On Mon, 2008-07-14 at 13:57 -0400, Chris Lumens wrote:
> 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.
>
> 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?


Will the blacklist ever need to take evr's as well as name-archs? If
not, then jeremy's suggestion of preresolve is probably not
unreasonable. However, if it will need to take evr's then putting them
in the exclude_hook makes more sense.

thanks,
-sv


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 07-14-2008, 06:32 PM
Jeremy Katz
 
Default yum-pluginize our upgrade magic

On Mon, 2008-07-14 at 14:25 -0400, seth vidal wrote:
> On Mon, 2008-07-14 at 13:57 -0400, Chris Lumens wrote:
> > 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.
> >
> > 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?
>
> Will the blacklist ever need to take evr's as well as name-archs? If
> not, then jeremy's suggestion of preresolve is probably not
> unreasonable. However, if it will need to take evr's then putting them
> in the exclude_hook makes more sense.

Should just be name-arch pairs. It's "this package of this arch went
away because multilib is fun". Of course, with the snazzy new
architecture requires stuff in rpm, we might eventually be able to move
these to be carried as obsoletes in the packages but I'd have to spend
more than 2 seconds thinking about it to say that for sure ;-)

Jeremy

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 03:38 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org