Deleting Obsolete RPM Files from the cache. #Delete obsolete RPM #System administration #Software distribution #Clean #Delete #Obsolete
Tidy RPM Cache script (previously Delete Obsolete RPMS) is a script that can used to deleting obsolete RPM files from a directory.
The Python script included on this page deletes obsolete RPM package files from the package manager's cache. RPM is a software management system used on many Linux distributions including Fedora. This script may be useful if you wish to minimise the disk space requirement of locally stored update packages.
rm_obsolete_rpms.py {-d|--dir=dir} {-n|--num-obsolete=number} {-x|--exclude=reg-ex} {-f|--force} {-s|--srpm} {-v|--verbose} {-q|--quiet} {--log-prefix=text} {-u|--usage} {-h|--help} {--version}
This script deletes obsolete files by comparing the version information of all RPM package files which provide the same software package. You can specify any number of paths of directories to search and you can also exclude specific packages from being tested for obsolescence.
To run this script simply specify the path of a directory containing RPM package files using the --dir option. For example, to delete obsolete RPMs from the directory '/tmp/packages', execute the following command:
tidy-rpm-cache.py --dir=/tmp/packages
The script will display a list of RPM packages it has deemed as obsolete and ask for confirmation before deleting them from the filesystem. To disable the confirmation message, add the --force option.
You can also configure the script to keep a specific number of obsolete versions of a package. For example, if you wish to keep one obsolete version of each package in case the newest version causes problems, you can achieve this using the following command:
tidy-rpm-cache.py --dir=/tmp/packages --num-obsolete=1
Note that the --num-obsolete option specifies the number of versions to keep excluding the newest version of the package. In this case all but the newest and the second newest versions would be deleted.
To prevent the deletion of specific packages you can supply a regular expression which will be tested against all RPM package filenames. If the expression matches, then that RPM will be excluded from the obsolescence test. For example, to exclude all kernel packages, execute the following command:
tidy-rpm-cache.py --dir=/tmp/packages --exclude='^kernel.*'
Note: always enclose the regular expressions in single quotes to prevent them being interpreted as a glob expression.
To see more information about what the script is doing and what packages it is examining, add the --verbose option. To disable all output except warning and error messages, add the --quiet option.
For more information on these and other options, please read the help information provided with the script. You can access this by adding the --help option. For example:
tidy-rpm-cache.py --help
The reason for writing this script was to provide a feature missing in the current implementation of YUM. YUM is an RPM-based software management system which provides an option to keep downloaded package files in a cache directory for later use. It does not however provide a feature to delete package files which have become obsolete because a newer version of the same package has been downloaded. The following command could be executed manually or from a cron script to clean the default cache directory on Fedora Linux systems:
tidy-rpm-cache.py --dir=/var/cache/yum --force
Fedora 9 python 2.5.1-25 rpm-python 4.4.2.3-2
System requirements
- Python
- rpm-python
What's new in Tidy RPM Cache script 1160:
- The script has been renamed from 'rm_obsolete_rpms.py' to 'tidy-rpm-cache.py' to clarify its purpose and to distinguish from the functionality in RPM relating to obsolete package files.
Tidy RPM Cache script 1160
add to watchlist add to download basket send us an update REPORT- runs on:
- Linux
- filename:
- tidy-rpm-cache.tar.gz
- main category:
- System
- developer:
- visit homepage
ShareX 16.0.1
Windows Sandbox Launcher 1.0.0
Microsoft Teams 24060.3102.2733.5911 Home / 1.7.00.7956 Work
Zoom Client 6.0.3.37634
Bitdefender Antivirus Free 27.0.35.146
7-Zip 23.01 / 24.04 Beta
IrfanView 4.67
Context Menu Manager 3.3.3.1
4k Video Downloader 1.5.3.0080 Plus / 4.30.0.5655
calibre 7.9.0
- Context Menu Manager
- 4k Video Downloader
- calibre
- ShareX
- Windows Sandbox Launcher
- Microsoft Teams
- Zoom Client
- Bitdefender Antivirus Free
- 7-Zip
- IrfanView