

    tidy-rpm-cache.py - Deletes obsolete RPM package files in a directory.

    Usage:

    tidy-rpm-cache.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 osolete
    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 each RPM package filename. 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 see the section
    called 'Options' below.


    Minimising the Size of a YUM Cache Directory:

    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


    Options:

    -d, --dir         =<dir> The path of a directory to search recursively for
                             RPM files. This option can be specified multiple
                             times. If this option is not specified, the
                             current directory is searched.

    -n, --num-obsolete=<int> The maximum number of obsolete versions of a
                             package to keep. Note that the default value is 0
                             meaning that all but the newest version of a
                             package will be deleted.

    -f, --force              Do not confirm before deleting obsolete RPM package
                             files.

    -x, --exclude  =<reg-ex> Exclude package filenames which match this
                             regular expression from being checked. This option
                             can be specified multiple times.

    -s, --srpm               Check for obsolete source RPMs instead of normal
                             RPMs.

    --log-prefix =<text>     Prepend text to the start of every information,
                             warning, and error message.

    -v, --verbose            Increase the amount of information displayed
                             during execution.

    -q, --quiet              Do not display any information during execution
                             except warnings and error messages.

    -u, --usage              Display usage information

    -h, --help               Display help information.

        --version            Display version information


    Copyright:

    Copyright (C) 2008-2009 Darwin Slattery


    License:

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.


    
