Jasmine Lognnes asked:
Is there an easy way to make a list of the dependencies a newly installed RPM package will install with
Example: If you do
yum install ruby then it will also install some rubygems.
But when I uninstall the
ruby package I also want to get rid of the dependencies it installed.
So my first idea were to make a list of those new packages, and then do an
rpm -e on those when I uninstall
How to make such list in an automated way?
Or is there an easier way then to have to manage text files with rpm package names?
yum keeps its own history, so you can find out when a package was installed or updated using its history.
yum history packages-info ruby will give you all the transactions involving ruby, where the oldest one is usually the one where the package was installed.
Transaction ID : 102 Begin time : Thu Apr 3 17:15:17 2014 Package : ruby-18.104.22.1683-16.fc20.x86_64 State : Install Size : 64,734 Build host : buildvm-17.phx2.fedoraproject.org Build time : Thu Nov 28 06:01:20 2013 Packager : Fedora Project Vendor : Fedora Project License : (Ruby or BSD) and Public Domain URL : http://ruby-lang.org/ Source RPM : ruby-22.214.171.1243-16.fc20.src.rpm Commit Time : Mon Nov 25 07:00:00 2013 Committer : V?t Ondruch <email@example.com> Reason : user Command Line : install ruby rubygems From repo : updates Installed by : Michael Hampton <error>
This will give you the transaction ID, which you can then look up and find the dependencies which were installed, e.g. with
yum history info <ID>.
Transaction ID : 102 Begin time : Thu Apr 3 17:15:17 2014 Begin rpmdb : 2336:55d492c6f5d091f328529861bdf95111264337f6 End time : 17:15:20 2014 (3 seconds) End rpmdb : 2346:ccca040d610665c49a1ff6a11f787f8d5aa6790d User : Michael Hampton <error> Return-Code : Success Command Line : install ruby rubygems Transaction performed with: Updated rpm-4.11.2-2.fc20.x86_64 @updates/20 2 packages excluded due to repository priority protections Updated yum-3.4.3-137.fc20.noarch ? Updated yum-metadata-parser-1.1.4-9.fc20.x86_64 @fedora/20 Packages Altered: Install ruby-126.96.36.1993-16.fc20.x86_64 @updates/20 Dep-Install ruby-irb-188.8.131.523-16.fc20.noarch @updates/20 Dep-Install ruby-libs-184.108.40.2063-16.fc20.x86_64 @updates/20 Dep-Install rubygem-bigdecimal-1.2.0-16.fc20.x86_64 @updates/20 Dep-Install rubygem-io-console-0.4.2-16.fc20.x86_64 @updates/20 Dep-Install rubygem-json-1.7.7-101.fc20.x86_64 @fedora/20 Dep-Install rubygem-psych-2.0.0-16.fc20.x86_64 @updates/20 Dep-Install rubygem-rdoc-4.0.1-2.fc20.noarch @fedora/20 Install rubygems-2.1.11-115.fc20.noarch @updates/20 Dep-Install rubypick-1.1.1-1.fc20.noarch @updates/20
If the package was just installed, and hasn’t yet been updated, you can rollback the transaction with, e.g.
yum history undo 102. This won’t work if any of the packages has been updated since installation, though, as it matches name, version and release.
And if you really just installed the packages, you can skip everything else and run
yum history undo last to rollback the most recent transaction.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.