noviembre 20, 2009

yum history

Una de las cosas buenas de usar una distribución es contar con una herramienta de administración para la instalación y actualicación de software. En el caso de Fedora es yum. Como buen administrador de paquetes, yum permite resolver automáticamente las dependencias de lo que quieras instalar, por ejemplo:

yum -y install gnome-commander
Loaded plugins: presto, refresh-packagekit
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package gnome-commander.i686 0:1.3-0.3.git_D20090929T1100_13dev.fc12 set to be updated
--> Processing Dependency: meld for package: gnome-commander- 1.3-0.3.git_D20090929T1100_13dev.fc12.i686
--> Processing Dependency: libexiv2.so.5 for package: gnome-commander- 1.3-0.3.git_D20090929T1100_13dev.fc12.i686
--> Running transaction check
---> Package exiv2-libs.i686 0:0.18.2-2.fc12 set to be updated
---> Package meld.noarch 0:1.3.0-2.fc12 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

========================================
Package Arch Version Repository Size
========================================
Installing:
gnome-commander i686 1.3-0.3.git_D20090929T1100_13dev.fc12 fedora 1.5 M
Installing for dependencies:
exiv2-libs i686 0.18.2-2.fc12 fedora 604 k
meld noarch 1.3.0-2.fc12 fedora 665 k

El problema es que yum no es tan inteligente ;-) a la hora de eliminar los paquetes:

yum -y remove gnome-commander
Loaded plugins: presto, refresh-packagekit
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package gnome-commander.i686 0:1.3-0.3.git_D20090929T1100_13dev.fc12 set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

========================================
Package Arch Version Repository Size
========================================
Removing:
gnome-commander i686 1.3-0.3.git_D20090929T1100_13dev.fc12 installed 4.7 M

Claro, elimina el paquete seleccionado, pero no las dependencias que instaló para el mismo!
Lo bueno, es que en Fedora 12 esto ya tiene solución! Para los regalones, les tenemos "history"

history
The history command allows the user to view what has happened in past transactions (assuming the history_record config. option is set). You can use info/list/summary to view what happened, undo/redo to act on that information and new to start a new history file.

The info/list/summary commands take either a transactions id or a package (with wildcards, as in Specifying package names), all three can also be passed no arguments. list can be passed the keyword "all" to list all the transactions. undo/redo just take a transaction id.


Ejemplo de uso, en el caso anterior

# yum history list
Loaded plugins: presto, refresh-packagekit
ID | Login user | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
21 | Carlos ... | 2009-11-20 10:44 | Install | 3
.
.
.


Identificamos la transacción que nos interesa

# yum history info 21
Loaded plugins: presto, refresh-packagekit
Transaction ID : 21
Begin time : Fri Nov 20 10:44:30 2009
Begin rpmdb : 1189:ba0aa90010d5d9c492556b3ff420f8940f22be12
End time : 10:44:35 2009 (5 seconds)
End rpmdb : 1192:756121f2f471a4e319c533854bab28042df46680
User : Carlos (casep) Sepulveda
Return-Code : Success
Transaction performed with:
Installed rpm-4.7.1-6.fc12.i686
Installed yum-3.2.25-1.fc12.noarch
Installed yum-metadata-parser-1.1.2-14.fc12.i686
Packages Altered:
Dep-Install exiv2-libs-0.18.2-2.fc12.i686
Install gnome-commander-1.3-0.3.git_D20090929T1100_13dev.fc12.i686
Dep-Install meld-1.3.0-2.fc12.noarch
history info


Y para reversar la operación basta con

# yum -y history undo 21
Loaded plugins: presto, refresh-packagekit
Undoing transaction 21, from Fri Nov 20 10:44:30 2009
Dep-Install exiv2-libs-0.18.2-2.fc12.i686
Install gnome-commander-1.3-0.3.git_D20090929T1100_13dev.fc12.i686
Dep-Install meld-1.3.0-2.fc12.noarch
Resolving Dependencies
--> Running transaction check
---> Package exiv2-libs.i686 0:0.18.2-2.fc12 set to be erased
---> Package gnome-commander.i686 0:1.3-0.3.git_D20090929T1100_13dev.fc12 set to be erased
---> Package meld.noarch 0:1.3.0-2.fc12 set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

===================================
Package Arch Version Repository Size
===================================
Removing:
exiv2-libs i686 0.18.2-2.fc12 installed 2.4 M
gnome-commander i686 1.3-0.3.git_D20090929T1100_13dev.fc12 installed 4.7 M
meld noarch 1.3.0-2.fc12 installed 2.0 M

Transaction Summary
===================================
Remove 3 Package(s)
Reinstall 0 Package(s)
Downgrade 0 Package(s)

Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing : meld-1.3.0-2.fc12.noarch 1/3
Erasing : exiv2-libs-0.18.2-2.fc12.i686 2/3
Erasing : gnome-commander-1.3-0.3.git_D20090929T1100_13dev.fc12.i686 3/3

Removed:
exiv2-libs.i686 0:0.18.2-2.fc12 gnome-commander.i686 0:1.3-0.3.git_D20090929T1100_13dev.fc12 meld.noarch 0:1.3.0-2.fc12

Complete!


Listo! ahora nuestro sistema no se llenará de dependencias guachas!

By Casep!

No hay comentarios:

Publicar un comentario en la entrada