Tuesday, January 31, 2012

PPA-Purge: the magic undo buttton

If your helping with testing new features in the development version of ubuntu, you will likely encounter installing new packages from a ppa. What happens when you want to roll back those changes? Thankfully there is a tool to help called ppa-purge. PPA-purge will uninstall all packages from a specified ppa and downgrade you back to the archive versions. In addition it will disable the ppa so you can't install packages from it.

Installation
sudo apt-get install ppa-purge
 
How to use
Simply execute the following line, replace the ppa:NAMEOFPPA with the ppa you wish to purge.  

sudo ppa-purge ppa:NAMEOFPPA

I'll show you a quick example of me removing the HUD ppa: 

sudo ppa-purge ppa:unity-team/hud
Updating packages lists
PPA to be removed: unity-team hud
comm: file 2 is not in sorted order
Package revert list generated:
 gir1.2-dbusmenu-glib-0.4/precise gir1.2-dbusmenu-gtk-0.4/precise
indicator-appmenu/precise libdbusmenu-glib4/precise libdbusmenu-gtk3-4/precise
libdbusmenu-gtk4/precise libunity-core-5.0-5/precise unity/precise
unity-common/precise unity-services/precise

Disabling unity-team PPA from
/etc/apt/sources.list.d/unity-team-hud-precise.list
...
The following packages will be DOWNGRADED:
  gir1.2-dbusmenu-glib-0.4 gir1.2-dbusmenu-gtk-0.4 libdbusmenu-glib4
  libdbusmenu-gtk3-4 libdbusmenu-gtk4 indicator-appmenu

Note that it found the packages I had installed and offered to downgrade them. Say yes and ppa-purge will put you back to archive state. Neat!

1 comment: