Friday, April 10, 2009

Menghapus Package yang Tidak Terpakai (Studi Kasus Fedora 10)

Ketika meng-install sebuah package sudah biasa kita harus meng-install juga package-package yang dibutuhkan (dependensi). Namun, ketika kita hendak menghapus (uninstall) package tersebut, package-package dependensinya tidak ikut terhapus. Jadi, terasa mubazir, package-package dependensi tersebut tidak terpakai.

Misalnya, kita install package kdeedu-kstars:

[hafni@localhost ~]$ su -c 'yum install kdeedu-kstars'
Password:
Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
* rpmfusion-nonfree-updates: astromirror.uchicago.edu
* rpmfusion-free-updates: astromirror.uchicago.edu
* rpmfusion-free: astromirror.uchicago.edu
* rpmfusion-nonfree: astromirror.uchicago.edu
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package kdeedu-kstars.x86_64 0:4.2.1-1.fc10 set to be updated
--> Processing Dependency: kdeedu-libs = 4.2.1-1.fc10 for package: kdeedu-kstars
--> Processing Dependency: libindi.so.0()(64bit) for package: kdeedu-kstars
--> Processing Dependency: libkdeeduui.so.4()(64bit) for package: kdeedu-kstars
--> Processing Dependency: libcfitsio.so.0()(64bit) for package: kdeedu-kstars
--> Running transaction check
---> Package cfitsio.x86_64 0:3.100-1.fc10 set to be updated
---> Package kdeedu-libs.x86_64 0:4.2.1-1.fc10 set to be updated
---> Package libindi.x86_64 0:0.6-4.fc10 set to be updated
--> Processing Dependency: libfli.so.1()(64bit) for package: libindi
--> Processing Dependency: libnova-0.12.so.1()(64bit) for package: libindi
--> Running transaction check
---> Package libfli.x86_64 0:1.7-4.fc10 set to be updated
---> Package libnova.x86_64 0:0.12.1-3.fc10 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package          Arch      Version            Repository                  Size
================================================================================
Installing:
kdeedu-kstars    x86_64    4.2.1-1.fc10       fedora-updates-handmade     10 M
Installing for dependencies:
cfitsio          x86_64    3.100-1.fc10       fedora-handmade            1.3 M
kdeedu-libs      x86_64    4.2.1-1.fc10       fedora-updates-handmade    345 k
libfli           x86_64    1.7-4.fc10         fedora-updates-handmade     38 k
libindi          x86_64    0.6-4.fc10         fedora-updates-handmade    700 k
libnova          x86_64    0.12.1-3.fc10      fedora-handmade            1.1 M

Transaction Summary
================================================================================
Install      6 Package(s)        
Update       0 Package(s)        
Remove       0 Package(s)        

Total download size: 14 M
Is this ok [y/N]: y
Downloading Packages:
(1/6): libfli-1.7-4.fc10.x86_64.rpm                           |  38 kB     00:00    
(2/6): kdeedu-libs-4.2.1-1.fc10.x86_64.rpm                    | 345 kB     00:00    
(3/6): libindi-0.6-4.fc10.x86_64.rpm                          | 700 kB     00:00    
(4/6): libnova-0.12.1-3.fc10.x86_64.rpm                       | 1.1 MB     00:00    
(5/6): cfitsio-3.100-1.fc10.x86_64.rpm                        | 1.3 MB     00:00    
(6/6): kdeedu-kstars-4.2.1-1.fc10.x86_64.rpm                  |  10 MB     00:01    
-------------------------------------------------------------------------------------
Total                                                4.2 MB/s |  14 MB     00:03    
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
 Installing     : cfitsio                                                        1/6
 Installing     : libfli                                                         2/6
 Installing     : kdeedu-libs                                                    3/6
 Installing     : libnova                                                        4/6
 Installing     : libindi                                                        5/6
 Installing     : kdeedu-kstars                                                  6/6

Installed:
 kdeedu-kstars.x86_64 0:4.2.1-1.fc10                                          

Dependency Installed:
 cfitsio.x86_64 0:3.100-1.fc10         kdeedu-libs.x86_64 0:4.2.1-1.fc10      
 libfli.x86_64 0:1.7-4.fc10            libindi.x86_64 0:0.6-4.fc10            
 libnova.x86_64 0:0.12.1-3.fc10      

Complete!

Dari meng-install kdeedu-kstars tersebut, kita harus meng-install 5 package lain, yaitu cfitsio, libfli, kdeedu-libs, libnova, dan libindi. Nah, ketika hendak menghapus package kdeedu-kstars, 5 package ini tidak ikut terhapus. Berikut ini buktinya:

[hafni@localhost ~]$ su -c 'yum remove kdeedu-kstars'
Password:
Loaded plugins: fastestmirror, refresh-packagekit
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package kdeedu-kstars.x86_64 0:4.2.1-1.fc10 set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================
Package                Arch            Version               Repository          Size
=======================================================================================
Removing:
kdeedu-kstars          x86_64          4.2.1-1.fc10          installed           21 M

Transaction Summary
=======================================================================================
Install      0 Package(s)        
Update       0 Package(s)        
Remove       1 Package(s)        

Is this ok [y/N]: N
Exiting on user Command
Complete!

Cara tergampang untuk turut serta menghapus package dependensinya, kita install salah satu plugin yum yang berguna untuk menghapusnya, yaitu yum-remove-with-leaves. Silakan install dulu:

[hafni@localhost ~]$ su -c 'yum install yum-remove-with-leaves'

Nah, setelah kita meng-install plugin tersebut, kita coba hapus package kdeedu-kstars:

[hafni@localhost ~]$ su -c 'yum remove kdeedu-kstars'
Password:
Loaded plugins: fastestmirror, refresh-packagekit, remove-with-leaves
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package kdeedu-kstars.x86_64 0:4.2.1-1.fc10 set to be erased
--> Finished Dependency Resolution
removing kdeedu-libs-4.2.1-1.fc10.x86_64. It is not required by anything else.
removing libindi-0.6-4.fc10.x86_64. It is not required by anything else.
removing cfitsio-3.100-1.fc10.x86_64. It is not required by anything else.
removing libfli-1.7-4.fc10.x86_64. It is not required by anything else.
removing libnova-0.12.1-3.fc10.x86_64. It is not required by anything else.
--> Running transaction check
---> Package cfitsio.x86_64 0:3.100-1.fc10 set to be erased
---> Package kdeedu-libs.x86_64 0:4.2.1-1.fc10 set to be erased
---> Package libfli.x86_64 0:1.7-4.fc10 set to be erased
---> Package libindi.x86_64 0:0.6-4.fc10 set to be erased
---> Package libnova.x86_64 0:0.12.1-3.fc10 set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================
Package               Arch           Version                  Repository         Size
=======================================================================================
Removing:
cfitsio               x86_64         3.100-1.fc10             installed         3.7 M
kdeedu-kstars         x86_64         4.2.1-1.fc10             installed          21 M
kdeedu-libs           x86_64         4.2.1-1.fc10             installed         1.7 M
libfli                x86_64         1.7-4.fc10               installed          82 k
libindi               x86_64         0.6-4.fc10               installed         1.6 M
libnova               x86_64         0.12.1-3.fc10            installed         3.5 M

Transaction Summary
=======================================================================================
Install      0 Package(s)        
Update       0 Package(s)        
Remove       6 Package(s)        

Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
 Erasing        : libindi                                                         1/6
 Erasing        : libnova                                                         2/6
 Erasing        : cfitsio                                                         3/6
 Erasing        : kdeedu-kstars                                                   4/6
 Erasing        : kdeedu-libs                                                     5/6
 Erasing        : libfli                                                          6/6

Removed:
 cfitsio.x86_64 0:3.100-1.fc10             kdeedu-kstars.x86_64 0:4.2.1-1.fc10       
 kdeedu-libs.x86_64 0:4.2.1-1.fc10         libfli.x86_64 0:1.7-4.fc10                
 libindi.x86_64 0:0.6-4.fc10               libnova.x86_64 0:0.12.1-3.fc10            

Complete!

Dengan plugin yum-remove-with-leaves, package-package dependensi jadi ikut terhapus. Sekarang tidak ada lagi package yang tidak terpakai.