Re: yum shell transaction sets

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

 



On 12/20/2008 03:13 PM, seth vidal wrote:
> On Sat, 2008-12-20 at 01:22 +0100, Alexander 'Leo' Bergolth wrote:
>> I'm trying to do a distro-upgrade using yum.
>>
>> However I'm experiencing a problem replacing a package in the yum shell
>> transaction:
>>
>> I tried the following commands:
>> -------------------- 8< --------------------
>> erase java-1.6.0-sun-compat jdk
>> install java-1.6.0-openjdk
>> upgrade
>> -------------------- 8< --------------------
>>
>> But the upgrade command seems the place java-1.6.0-sun-compat in the
>> list of packages to upgrade again. Now it is found both in the list of
>> packages to update and remove!
> 
> can you try:
> 
> erase java-1.6.0-sun-compat jdk
> install java-1.6.0-openjdk
> run
> upgrade
> run

I tried only ts solve instead of run. But this would remove many (77)
packages like grub, gimp and openoffice, most likely because of broken
dependencies in the packages. I can readd them in the same transaction
but then then they will appear both in the list of packages to remove
and to install again since the install command also doesn't seem to
consider the current transaction set.

It would be nice if the update process checked the current transaction
set and only considered packages that are not already candidates for
removal. I've attached a patch that seems to work for my test case.

I added this to the "update everything part" (without any packages
passed in as arguments) only. If packages are explicitly specified to
update, the behavior is the other way around: If those packages are
already in the transaction set marked with any of the TS_REMOVE_STATES,
the corresponding transaction set members are removed first.

I'd be glad if you could review the patch and tell me if that's the
correct way to do it.

If it's ok, maybe other commands like erase or install should also
modify potentially existing transaction set members? (install sould
remove members with TS_REMOVE_STATES and erase should remove members
with TS_INSTALL_STATES?)

Cheers,
--leo
-- 
e-mail   ::: Leo.Bergolth (at) wu-wien.ac.at
fax      ::: +43-1-31336-906050
location ::: Computer Center | Vienna University of Economics | Austria

--- yum/__init__.py.orig	2008-12-21 17:09:38.581386558 +0100
+++ yum/__init__.py	2008-12-21 18:29:48.499383928 +0100
@@ -2642,25 +2642,27 @@
         if not po and not kwargs: # update everything (the easy case)
             self.verbose_logger.log(logginglevels.DEBUG_2, _('Updating Everything'))
             for (obsoleting, installed) in obsoletes:
-                obsoleting_pkg = self.getPackageObject(obsoleting)
-                installed_pkg =  self.rpmdb.searchPkgTuple(installed)[0]
-                txmbr = self.tsInfo.addObsoleting(obsoleting_pkg, installed_pkg)
-                self.tsInfo.addObsoleted(installed_pkg, obsoleting_pkg)
-                if requiringPo:
-                    txmbr.setAsDep(requiringPo)
-                tx_return.append(txmbr)
+                if not self.tsInfo.getMembersWithState(installed, TS_REMOVE_STATES):
+                    obsoleting_pkg = self.getPackageObject(obsoleting)
+                    installed_pkg =  self.rpmdb.searchPkgTuple(installed)[0]
+                    txmbr = self.tsInfo.addObsoleting(obsoleting_pkg, installed_pkg)
+                    self.tsInfo.addObsoleted(installed_pkg, obsoleting_pkg)
+                    if requiringPo:
+                        txmbr.setAsDep(requiringPo)
+                    tx_return.append(txmbr)
                 
             for (new, old) in updates:
                 if self.tsInfo.isObsoleted(pkgtup=old):
                     self.verbose_logger.log(logginglevels.DEBUG_2, _('Not Updating Package that is already obsoleted: %s.%s %s:%s-%s'), 
                         old)
                 else:
-                    updating_pkg = self.getPackageObject(new)
-                    updated_pkg = self.rpmdb.searchPkgTuple(old)[0]
-                    txmbr = self.tsInfo.addUpdate(updating_pkg, updated_pkg)
-                    if requiringPo:
-                        txmbr.setAsDep(requiringPo)
-                    tx_return.append(txmbr)
+                    if not self.tsInfo.getMembersWithState(old, TS_REMOVE_STATES):
+                        updating_pkg = self.getPackageObject(new)
+                        updated_pkg = self.rpmdb.searchPkgTuple(old)[0]
+                        txmbr = self.tsInfo.addUpdate(updating_pkg, updated_pkg)
+                        if requiringPo:
+                            txmbr.setAsDep(requiringPo)
+                        tx_return.append(txmbr)
             
             return tx_return
 
@@ -2740,7 +2742,12 @@
         # TODO: we should search the updates and obsoletes list and
         # mark the package being updated or obsoleted away appropriately
         # and the package relationship in the tsInfo
-        
+
+        # check if the packages to upgrade are already in the transaction set
+        for installed_pkg in instpkgs:
+            toerase = self.tsInfo.getMembersWithState(installed_pkg.pkgtup, TS_REMOVE_STATES)
+            if toerase:
+                self.tsInfo.remove(toerase[0])
 
         # check for obsoletes first
         if self.conf.obsoletes:
_______________________________________________
Yum mailing list
Yum@xxxxxxxxxxxxxxxxx
http://lists.baseurl.org/mailman/listinfo/yum

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux