/usr/share/software-center/expunge-cache.py is in software-center 5.2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | #!/usr/bin/python
# Copyright (C) 2012 Canonical
#
# Authors:
# Michael Vogt
#
# 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; version 3.
#
# 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, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
"""
Expunge httplib2 caches
"""
import argparse
import logging
import os
import sys
from softwarecenter.expunge import ExpungeCache
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description='clean software-center httplib2 cache')
parser.add_argument(
'--debug', action="store_true",
help='show debug output')
parser.add_argument(
'--dry-run', action="store_true",
help='do not act, just show what would be done')
parser.add_argument(
'directories', metavar='directory', nargs='+', type=str,
help='directories to be checked')
parser.add_argument(
'--by-days', type=int, default=0,
help='expire everything older than N days')
parser.add_argument(
'--by-unsuccessful-http-states', action="store_true",
help='expire any non 200 status responses')
args = parser.parse_args()
if args.debug:
logging.basicConfig(level=logging.DEBUG)
else:
logging.basicConfig(level=logging.INFO)
# sanity checking
if args.by_days == 0 and not args.by_unsuccessful_http_states:
print "Need either --by-days or --by-unsuccessful-http-states argument"
sys.exit(1)
# be nice
os.nice(19)
# do it
cleaner = ExpungeCache(args.directories,
args.by_days,
args.by_unsuccessful_http_states,
args.dry_run)
cleaner.clean()
|