--- computer-janitor-1.14.1.orig/setup.py
+++ computer-janitor-1.14.1/setup.py
@@ -36,7 +36,7 @@
"installed one",
author='Lars Wirzenius',
author_email='lars@ubuntu.com',
- packages=['computerjanitorapp'],
+ packages=['computerjanitor', 'computerjanitorapp'],
scripts=['computer-janitor', 'computer-janitor-gtk'],
data_files=[('share/man/man8', ['computer-janitor.8',
'computer-janitor-gtk.8']),
--- computer-janitor-1.14.1.orig/computerjanitor/file_cruft_tests.py
+++ computer-janitor-1.14.1/computerjanitor/file_cruft_tests.py
@@ -0,0 +1,63 @@
+# file_cruft_tests.py - unit tests for file_cruft.py
+# Copyright (C) 2008, 2009 Canonical, Ltd.
+#
+# 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 of the License.
+#
+# 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 .
+
+
+import os
+import subprocess
+import tempfile
+
+import unittest
+
+import computerjanitor
+
+
+class FileCruftTests(unittest.TestCase):
+
+ def setUp(self):
+ fd, self.pathname = tempfile.mkstemp()
+ os.write(fd, "x" * 1024)
+ os.close(fd)
+ self.cruft = computerjanitor.FileCruft(self.pathname, "description")
+
+ def tearDown(self):
+ if False and os.path.exists(self.pathname):
+ os.remove(self.pathname)
+
+ def testReturnsCorrectPrefix(self):
+ self.assertEqual(self.cruft.get_prefix(), "file")
+
+ def testReturnsCorrectPrefixDescription(self):
+ self.assertEqual(self.cruft.get_prefix_description(), "A file on disk")
+
+ def testReturnsCorrectShortname(self):
+ self.assertEqual(self.cruft.get_shortname(), self.pathname)
+
+ def testReturnsCorrectName(self):
+ self.assertEqual(self.cruft.get_name(), "file:%s" % self.pathname)
+
+ def testReturnsCorrectDescription(self):
+ self.assertEqual(self.cruft.get_description(), "description\n")
+
+ def testReturnsCorrectDiskUsage(self):
+ p = subprocess.Popen(["du", "-s", "-B", "1", self.pathname],
+ stdout=subprocess.PIPE)
+ stdout, stderr = p.communicate()
+ du = int(stdout.splitlines()[0].split("\t")[0])
+ self.assertEqual(self.cruft.get_disk_usage(), du)
+
+ def testDeletesPackage(self):
+ self.assert_(os.path.exists(self.pathname))
+ self.cruft.cleanup()
+ self.assertFalse(os.path.exists(self.pathname))
--- computer-janitor-1.14.1.orig/computerjanitor/file_cruft.py
+++ computer-janitor-1.14.1/computerjanitor/file_cruft.py
@@ -0,0 +1,58 @@
+# file_cruft.py - implementation of file cruft
+# Copyright (C) 2008, 2009 Canonical, Ltd.
+#
+# 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 of the License.
+#
+# 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 .
+
+
+import os
+
+import computerjanitor
+_ = computerjanitor.setup_gettext()
+
+
+class FileCruft(computerjanitor.Cruft):
+
+ """Cruft that is individual files.
+
+ This type of cruft consists of individual files that should be
+ removed. Various plugins may decide that various files are cruft;
+ they can all use objects of FileCruft type to mark such files,
+ regardless of the reason the files are considered cruft.
+
+ When FileCruft instantiated, the file is identified by a pathname.
+
+ """
+
+ def __init__(self, pathname, description):
+ self.pathname = pathname
+ st = os.stat(pathname)
+ self.disk_usage = st.st_blocks * 512
+ self.description = description
+
+ def get_prefix(self):
+ return "file"
+
+ def get_prefix_description(self):
+ return _("A file on disk")
+
+ def get_shortname(self):
+ return self.pathname
+
+ def get_description(self):
+ return "%s\n" % self.description
+
+ def get_disk_usage(self):
+ return self.disk_usage
+
+ def cleanup(self):
+ os.remove(self.pathname)
--- computer-janitor-1.14.1.orig/computerjanitor/__init__.py
+++ computer-janitor-1.14.1/computerjanitor/__init__.py
@@ -0,0 +1,55 @@
+# __init__.py for computerjanitor
+# Copyright (C) 2008 Canonical, Ltd.
+#
+# 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 of the License.
+#
+# 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 .
+
+
+VERSION = "1.11"
+
+
+# Set up gettext. This needs to be before the import statements below
+# so that if any modules call it right after importing, they find
+# setup_gettext.
+
+def setup_gettext():
+ """Set up gettext for a module.
+
+ Return a method to be used for looking up translations. Usage:
+
+ import computerjanitor
+ _ = computerjanitor.setup_gettext()
+
+ """
+
+ import gettext
+ import os
+
+ domain = 'update-manager'
+ localedir = os.environ.get('LOCPATH', None)
+ t = gettext.translation(domain, localedir=localedir, fallback=True)
+ return t.ugettext
+
+
+from cruft import Cruft
+from file_cruft import FileCruft
+from package_cruft import PackageCruft
+from missing_package_cruft import MissingPackageCruft
+from exc import ComputerJanitorException as Exception, UnimplementedMethod
+from plugin import Plugin, PluginManager
+
+
+# The following is a kludge to silence python-apt's warning about
+# the API being unstable.
+import warnings
+warnings.filterwarnings("ignore", "apt API not stable yet", FutureWarning)
+import apt
--- computer-janitor-1.14.1.orig/computerjanitor/package_cruft.py
+++ computer-janitor-1.14.1/computerjanitor/package_cruft.py
@@ -0,0 +1,57 @@
+# package_cruft.py - implementation for the package craft
+# Copyright (C) 2008 Canonical, Ltd.
+#
+# 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 of the License.
+#
+# 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 .
+
+
+import computerjanitor
+_ = computerjanitor.setup_gettext()
+
+
+class PackageCruft(computerjanitor.Cruft):
+
+ """Cruft that is .deb packages.
+
+ This type of cruft consists of .deb packages installed onto the
+ system which can be removed. Various plugins may decide that
+ various packages are cruft; they can all use objects of PackageCruft
+ type to mark such packages, regardless of the reason the packages
+ are considered cruft.
+
+ When PackageCruft instantiated, the package is identified by an
+ apt.Package object. That object is used for all the real operations,
+ so this class is merely a thin wrapper around it.
+
+ """
+
+ def __init__(self, pkg, description):
+ self._pkg = pkg
+ self._description = description
+
+ def get_prefix(self):
+ return "deb"
+
+ def get_prefix_description(self):
+ return _(".deb package")
+
+ def get_shortname(self):
+ return self._pkg.name
+
+ def get_description(self):
+ return u"%s\n\n%s" % (self._description, self._pkg.summary)
+
+ def get_disk_usage(self):
+ return self._pkg.installedSize
+
+ def cleanup(self):
+ self._pkg.markDelete()
--- computer-janitor-1.14.1.orig/computerjanitor/plugin_tests.py
+++ computer-janitor-1.14.1/computerjanitor/plugin_tests.py
@@ -0,0 +1,112 @@
+# plugin_tests.py - unit tests for plugin.py
+# Copyright (C) 2008 Canonical, Ltd.
+#
+# 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 of the License.
+#
+# 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 .
+
+
+import os
+import tempfile
+import unittest
+
+import computerjanitor
+
+
+class PluginTests(unittest.TestCase):
+
+ def testGetCruftRaisesException(self):
+ p = computerjanitor.Plugin()
+ self.assertRaises(computerjanitor.UnimplementedMethod, p.get_cruft)
+
+ def testPostCleanupReturnsNone(self):
+ p = computerjanitor.Plugin()
+ self.assertEqual(p.post_cleanup(), None)
+
+ def testDoesNotHaveAppAttributeByDefault(self):
+ p = computerjanitor.Plugin()
+ self.assertFalse(hasattr(p, "app"))
+
+ def testSetApplicationSetsApp(self):
+ p = computerjanitor.Plugin()
+ p.set_application("foo")
+ self.assertEqual(p.app, "foo")
+
+ def testSetsRequiredConditionToNoneByDefault(self):
+ p = computerjanitor.Plugin()
+ self.assertEqual(p.condition, [])
+
+
+class PluginManagerTests(unittest.TestCase):
+
+ def testFindsNoPluginsInEmptyDirectory(self):
+ tempdir = tempfile.mkdtemp()
+ pm = computerjanitor.PluginManager(None, [tempdir])
+ plugins = pm.get_plugins()
+ os.rmdir(tempdir)
+ self.assertEqual(plugins, [])
+
+ def testFindsOnePluginFileInTestPluginDirectory(self):
+ pm = computerjanitor.PluginManager(None, ["testplugins"])
+ self.assertEqual(pm.get_plugin_files(),
+ ["testplugins/hello_plugin.py"])
+
+ def testFindsOnePluginInTestPluginDirectory(self):
+ pm = computerjanitor.PluginManager(None, ["testplugins"])
+ self.assertEqual(len(pm.get_plugins()), 1)
+
+ def testFindPluginsSetsApplicationInPluginsFound(self):
+ pm = computerjanitor.PluginManager("foo", ["testplugins"])
+ self.assertEqual(pm.get_plugins()[0].app, "foo")
+
+ def callback(self, filename, index, count):
+ self.callback_called = True
+
+ def testCallsCallbackWhenFindingPlugins(self):
+ pm = computerjanitor.PluginManager(None, ["testplugins"])
+ self.callback_called = False
+ pm.get_plugins(callback=self.callback)
+ self.assert_(self.callback_called)
+
+
+class ConditionTests(unittest.TestCase):
+
+ def setUp(self):
+ self.pm = computerjanitor.PluginManager(None, ["testplugins"])
+
+ class White(computerjanitor.Plugin):
+ pass
+
+ class Red(computerjanitor.Plugin):
+ def __init__(self):
+ self.condition = ["red"]
+
+ class RedBlack(computerjanitor.Plugin):
+ def __init__(self):
+ self.condition = ["red","black"]
+
+ self.white = White()
+ self.red = Red()
+ self.redblack = RedBlack()
+ self.pm._plugins = [self.white, self.red, self.redblack]
+
+ def testReturnsOnlyConditionlessPluginByDefault(self):
+ self.assertEqual(self.pm.get_plugins(), [self.white])
+
+ def testReturnsOnlyRedPluginWhenConditionIsRed(self):
+ self.assertEqual(self.pm.get_plugins(condition="red"), [self.red, self.redblack])
+
+ def testReturnsOnlyRedPluginWhenConditionIsRedAndBlack(self):
+ self.assertEqual(self.pm.get_plugins(condition=["red","black"]), [self.redblack])
+
+ def testReturnsEallPluginsWhenRequested(self):
+ self.assertEqual(set(self.pm.get_plugins(condition="*")),
+ set([self.white, self.red, self.redblack]))
--- computer-janitor-1.14.1.orig/computerjanitor/cruft_tests.py
+++ computer-janitor-1.14.1/computerjanitor/cruft_tests.py
@@ -0,0 +1,56 @@
+# cruft_tests.py - unit tests for cruft.py
+# Copyright (C) 2008 Canonical, Ltd.
+#
+# 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 of the License.
+#
+# 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 .
+
+
+import unittest
+
+import computerjanitor
+
+
+class CruftTests(unittest.TestCase):
+
+ def setUp(self):
+ self.cruft = computerjanitor.Cruft()
+
+ def testReturnsClassNameAsDefaultPrefix(self):
+ class Mockup(computerjanitor.Cruft):
+ pass
+ self.assertEqual(Mockup().get_prefix(), "Mockup")
+
+ def testReturnsEmptyStringAsDefaultPrefixDescription(self):
+ self.assertEqual(self.cruft.get_prefix_description(), "")
+
+ def testReturnsDescriptionAsDefaultPrefixDescription(self):
+ self.cruft.get_description = lambda: "foo"
+ self.assertEqual(self.cruft.get_prefix_description(), "foo")
+
+ def testRaisesErrorForDefaultGetShortname(self):
+ self.assertRaises(computerjanitor.UnimplementedMethod,
+ self.cruft.get_shortname)
+
+ def testReturnsCorrectStringForFullName(self):
+ self.cruft.get_prefix = lambda *args: "foo"
+ self.cruft.get_shortname = lambda *args: "bar"
+ self.assertEqual(self.cruft.get_name(), "foo:bar")
+
+ def testReturnsEmptyStringAsDefaultDescription(self):
+ self.assertEqual(self.cruft.get_description(), "")
+
+ def testReturnsNoneForDiskUsage(self):
+ self.assertEqual(self.cruft.get_disk_usage(), None)
+
+ def testRaisesErrorForDefaultCleanup(self):
+ self.assertRaises(computerjanitor.UnimplementedMethod,
+ self.cruft.cleanup)
--- computer-janitor-1.14.1.orig/computerjanitor/missing_package_cruft.py
+++ computer-janitor-1.14.1/computerjanitor/missing_package_cruft.py
@@ -0,0 +1,45 @@
+# missing_package_cruft.py - install a missing package
+# Copyright (C) 2009 Canonical, Ltd.
+#
+# 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 of the License.
+#
+# 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 .
+
+
+import computerjanitor
+_ = computerjanitor.setup_gettext()
+
+
+class MissingPackageCruft(computerjanitor.Cruft):
+
+ """Install a missing package."""
+
+ def __init__(self, package, description=None):
+ self.package = package
+ self.description = description
+
+ def get_prefix(self):
+ return "install-deb"
+
+ def get_prefix_description(self):
+ return _("Install missing package.")
+
+ def get_shortname(self):
+ return self.package.name
+
+ def get_description(self):
+ if self.description:
+ return self.description
+ else:
+ return _("Package %s should be installed.") % self.package.name
+
+ def cleanup(self):
+ self.package.markInstall()
--- computer-janitor-1.14.1.orig/computerjanitor/exc_tests.py
+++ computer-janitor-1.14.1/computerjanitor/exc_tests.py
@@ -0,0 +1,34 @@
+# exc_tests.py - unit tests for exc.py
+# Copyright (C) 2008 Canonical, Ltd.
+#
+# 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 of the License.
+#
+# 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 .
+
+
+import unittest
+
+import computerjanitor
+
+
+class ComputerJanitorExceptionTests(unittest.TestCase):
+
+ def testReturnsStrCorrectly(self):
+ e = computerjanitor.Exception()
+ e._str = "pink"
+ self.assertEqual(str(e), "pink")
+
+
+class UnimplementedMethodTests(unittest.TestCase):
+
+ def testErrorMessageContainsMethodName(self):
+ e = computerjanitor.UnimplementedMethod(self.__init__)
+ self.assert_("__init__" in str(e))
\ No newline at end of file
--- computer-janitor-1.14.1.orig/computerjanitor/exc.py
+++ computer-janitor-1.14.1/computerjanitor/exc.py
@@ -0,0 +1,30 @@
+# exc.py - exceptions for computerjanitor
+# Copyright (C) 2008 Canonical, Ltd.
+#
+# 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 of the License.
+#
+# 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 .
+
+
+import computerjanitor
+_ = computerjanitor.setup_gettext()
+
+
+class ComputerJanitorException(Exception):
+
+ def __str__(self):
+ return self._str
+
+
+class UnimplementedMethod(ComputerJanitorException):
+
+ def __init__(self, method):
+ self._str = _("Unimplemented method: %s") % str(method)
--- computer-janitor-1.14.1.orig/computerjanitor/cruft.py
+++ computer-janitor-1.14.1/computerjanitor/cruft.py
@@ -0,0 +1,138 @@
+# cruft.py - base class for different kinds of cruft
+# Copyright (C) 2008 Canonical, Ltd.
+#
+# 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 of the License.
+#
+# 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 .
+
+
+import computerjanitor
+
+
+class Cruft(object):
+
+ """One piece of cruft to be cleaned out.
+
+ A piece of cruft can be a file, a package, a configuration tweak
+ that is missing, or something else.
+
+ This is a base class, which does nothing. Subclasses do the
+ actual work.
+
+ """
+
+ def get_prefix(self):
+ """Return the unique prefix used to group this type of cruft.
+
+ For example, the .deb package called 'foo' would have a prefix
+ of 'deb'. This way, the package foo is not confused with the
+ file foo, or the username foo.
+
+ Subclasses SHOULD define this. The default implementation
+ returns the name of the class, which is rarely useful to
+ the user.
+
+ """
+
+ return self.__class__.__name__
+
+ def get_prefix_description(self):
+ """Return human-readable description of class of cruft."""
+ return self.get_description()
+
+ def get_shortname(self):
+ """Return the name of this piece of cruft.
+
+ The name should be something that the user will understand.
+ For example, it might be the name of a package, or the full
+ path to a file.
+
+ The name should be unique within the unique prefix returned
+ by get_prefix. The prefix MUST NOT be included by this method,
+ the get_name() method does that instead. The intent is that
+ get_shortname() will be used by the user interface in contexts
+ where the prefix is shown separately from the short name,
+ and get_name() when a single string is used.
+
+ Subclasses MUST define this. The default implementation
+ raises an exception.
+
+ """
+
+ raise computerjanitor.UnimplementedMethod(self.get_shortname)
+
+ def get_name(self):
+ """Return prefix plus name.
+
+ See get_prefix() and get_shortname() for a discussion of
+ the prefix and the short name. This method will return
+ the prefix, a colon, and the short name.
+
+ The long name will used to store state/configuration data:
+ _this_ package should not be removed.
+
+ """
+
+ return "%s:%s" % (self.get_prefix(), self.get_shortname())
+
+ def get_description(self):
+ """Return a description of this piece of cruft.
+
+ This may be arbitrarily long. The user interface will take
+ care of breaking it into lines or otherwise presenting it to
+ the user in a nice manner. The description should be plain
+ text, in UTF-8.
+
+ The default implementation returns the empty string. Subclasses
+ MAY override this as they wish.
+
+ """
+
+ return ""
+
+ def get_disk_usage(self):
+ """Return amount of disk space reserved by this piece of cruft.
+
+ The unit is bytes.
+
+ The disk space in question should be the amount that will be
+ freed if the cruft is cleaned up. The amount may be an estimate
+ (read: guess). It is intended to be shown to the user to help
+ them decide what to remove and what to keep.
+
+ This will also be used by the user interface to better
+ estimate how much remaining time there is when cleaning
+ up a lot of cruft.
+
+ For some types of cruft, this is not applicable and they should
+ return None. The base class implementation does that, so
+ subclasses MUST define this method if it is useful for them to
+ return something else.
+
+ The user interface will distinguish between None (not
+ applicable) and 0 (no disk space being used).
+
+ """
+
+ return None
+
+ def cleanup(self):
+ """Clean up this piece of cruft.
+
+ Depending on the type of cruft, this may mean removing files,
+ packages, modifying configuration files, or something else.
+
+ The default implementation raises an exception. Subclasses
+ MUST override this.
+
+ """
+
+ raise computerjanitor.UnimplementedMethod(self.cleanup)
--- computer-janitor-1.14.1.orig/computerjanitor/plugin.py
+++ computer-janitor-1.14.1/computerjanitor/plugin.py
@@ -0,0 +1,182 @@
+# plugin.py - plugin base class for computerjanitor
+# Copyright (C) 2008 Canonical, Ltd.
+#
+# 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 of the License.
+#
+# 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 .
+
+
+import imp
+import inspect
+import logging
+import os
+
+import computerjanitor
+_ = computerjanitor.setup_gettext()
+import logging
+
+class Plugin(object):
+
+ """Base class for plugins.
+
+ These plugins only do one thing: identify cruft. See the 'get_cruft'
+ method for details.
+
+ """
+
+ def get_condition(self):
+ if hasattr(self, "_condition"):
+ return self._condition
+ else:
+ return []
+
+ def set_condition(self, condition):
+ self._condition = condition
+
+ condition = property(get_condition, set_condition)
+
+ def set_application(self, app):
+ """Set the Application instance this plugin belongs to.
+
+ This is used by the plugin manager when creating the plugin
+ instance. In a perfect world, this would be done via the
+ __init__ method, but since I took a wrong left turn, I ended
+ up in an imperfect world, and therefore giving the Application
+ instance to __init__ would mandate that all sub-classes would
+ have to deal with that explicitly. That is a lot of unnecessary
+ make-work, which we should avoid. Therefore, we do it via this
+ method.
+
+ The class may access the Application instance via the
+ 'app' attribute.
+
+ """
+
+ self.app = app
+
+ def do_cleanup_cruft(self): # pragma: no cover
+ """Find cruft and clean it up.
+
+ This is a helper method.
+ """
+
+ for cruft in self.get_cruft():
+ cruft.cleanup()
+ self.post_cleanup()
+
+ def get_cruft(self):
+ """Find some cruft in the system.
+
+ This method MUST return an iterator (see 'yield' statement).
+ This interface design allows cruft to be collected piecemeal,
+ which makes it easier to show progress in the user interface.
+
+ The base class default implementation of this raises an
+ exception. Subclasses MUST override this method.
+
+ """
+
+ raise computerjanitor.UnimplementedMethod(self.get_cruft)
+
+ def post_cleanup(self):
+ """Does plugin wide cleanup after the individual cleanup
+ was performed.
+
+ This is useful for stuff that needs to be proccessed
+ in batches (e.g. for performance reasons) like package
+ removal.
+ """
+ pass
+
+
+class PluginManager(object):
+
+ """Class to find and load plugins.
+
+ Plugins are stored in files named '*_plugin.py' in the list of
+ directories given to the initializer.
+
+ """
+
+ def __init__(self, app, plugin_dirs):
+ self._app = app
+ self._plugin_dirs = plugin_dirs
+ self._plugins = None
+
+ def get_plugin_files(self):
+ """Return all filenames in which plugins may be stored."""
+
+ names = []
+
+ for dirname in self._plugin_dirs:
+ basenames = [x for x in os.listdir(dirname)
+ if x.endswith("_plugin.py")]
+ logging.debug("Plugin modules in %s: %s" %
+ (dirname, " ".join(basenames)))
+ names += [os.path.join(dirname, x) for x in basenames]
+
+ return names
+
+ def _find_plugins(self, module):
+ """Find and instantiate all plugins in a module."""
+ plugins = []
+ for dummy, member in inspect.getmembers(module):
+ if inspect.isclass(member) and issubclass(member, Plugin):
+ plugins.append(member)
+ logging.debug("Plugins in %s: %s" %
+ (module, " ".join(str(x) for x in plugins)))
+ return [plugin() for plugin in plugins]
+
+ def _load_module(self, filename):
+ """Load a module from a filename."""
+ logging.debug("Loading module %s" % filename)
+ module_name, dummy = os.path.splitext(os.path.basename(filename))
+ f = file(filename, "r")
+ try:
+ module = imp.load_module(module_name, f, filename,
+ (".py", "r", imp.PY_SOURCE))
+ except Exception, e: # pragma: no cover
+ logging.warning("Failed to load plugin '%s' (%s)" %
+ (module_name, e))
+ return None
+ f.close()
+ return module
+
+ def get_plugins(self, condition=[], callback=None):
+ """Return all plugins that have been found.
+
+ If callback is specified, it is called after each plugin has
+ been found, with the following arguments: filename, index of
+ filename in list of files to be examined (starting with 0), and
+ total number of files to be examined. The purpose of this is to
+ allow the callback to inform the user in case things take a long
+ time.
+
+ """
+
+ if self._plugins is None:
+ self._plugins = []
+ filenames = self.get_plugin_files()
+ for i in range(len(filenames)):
+ if callback:
+ callback(filenames[i], i, len(filenames))
+ module = self._load_module(filenames[i])
+ for plugin in self._find_plugins(module):
+ plugin.set_application(self._app)
+ self._plugins.append(plugin)
+ # get the matching plugins
+ plugins = [p for p in self._plugins
+ if (p.condition == condition) or
+ (condition in p.condition) or
+ (condition == "*") ]
+ logging.debug("plugins for condition '%s' are '%s'" %
+ (condition, plugins))
+ return plugins
--- computer-janitor-1.14.1.orig/computerjanitor/missing_package_cruft_tests.py
+++ computer-janitor-1.14.1/computerjanitor/missing_package_cruft_tests.py
@@ -0,0 +1,61 @@
+# missing_package_cruft_tests.py - unit tests for missing_package_cruft.py
+# Copyright (C) 2008, 2009 Canonical, Ltd.
+#
+# 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 of the License.
+#
+# 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 .
+
+
+import unittest
+
+import computerjanitor
+
+
+class MockAptPackage(object):
+
+ def __init__(self):
+ self.name = "name"
+ self.summary = "summary"
+ self.installedSize = 12765
+ self.installed = False
+
+ def markInstall(self):
+ self.installed = True
+
+
+class MissingPackageCruftTests(unittest.TestCase):
+
+ def setUp(self):
+ self.pkg = MockAptPackage()
+ self.cruft = computerjanitor.MissingPackageCruft(self.pkg)
+
+ def testReturnsCorrectPrefix(self):
+ self.assertEqual(self.cruft.get_prefix(), "install-deb")
+
+ def testReturnsCorrectPrefixDescription(self):
+ self.assert_("Install" in self.cruft.get_prefix_description())
+
+ def testReturnsCorrectShortname(self):
+ self.assertEqual(self.cruft.get_shortname(), "name")
+
+ def testReturnsCorrectName(self):
+ self.assertEqual(self.cruft.get_name(), "install-deb:name")
+
+ def testReturnsCorrectDescription(self):
+ self.assert_("name" in self.cruft.get_description())
+
+ def testSetsDescriptionWhenAsked(self):
+ pkg = computerjanitor.MissingPackageCruft(self.pkg, "foo")
+ self.assertEqual(pkg.get_description(), "foo")
+
+ def testInstallsPackage(self):
+ self.cruft.cleanup()
+ self.assert_(self.pkg.installed)
--- computer-janitor-1.14.1.orig/computerjanitor/package_cruft_tests.py
+++ computer-janitor-1.14.1/computerjanitor/package_cruft_tests.py
@@ -0,0 +1,61 @@
+# package_cruft_tests.py - unit tests for package_cruft.py
+# Copyright (C) 2008 Canonical, Ltd.
+#
+# 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 of the License.
+#
+# 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 .
+
+
+import unittest
+
+import computerjanitor
+
+
+class MockAptPackage(object):
+
+ def __init__(self):
+ self.name = "name"
+ self.summary = "summary"
+ self.installedSize = 12765
+ self.deleted = False
+
+ def markDelete(self):
+ self.deleted = True
+
+
+class PackageCruftTests(unittest.TestCase):
+
+ def setUp(self):
+ self.pkg = MockAptPackage()
+ self.cruft = computerjanitor.PackageCruft(self.pkg, "description")
+
+ def testReturnsCorrectPrefix(self):
+ self.assertEqual(self.cruft.get_prefix(), "deb")
+
+ def testReturnsCorrectPrefixDescription(self):
+ self.assertEqual(self.cruft.get_prefix_description(), ".deb package")
+
+ def testReturnsCorrectShortname(self):
+ self.assertEqual(self.cruft.get_shortname(), "name")
+
+ def testReturnsCorrectName(self):
+ self.assertEqual(self.cruft.get_name(), "deb:name")
+
+ def testReturnsCorrectDescription(self):
+ self.assertEqual(self.cruft.get_description(),
+ "description\n\nsummary")
+
+ def testReturnsCorrectDiskUsage(self):
+ self.assertEqual(self.cruft.get_disk_usage(), 12765)
+
+ def testDeletesPackage(self):
+ self.cruft.cleanup()
+ self.assert_(self.pkg.deleted)
--- computer-janitor-1.14.1.orig/debian/computer-janitor-gtk.lintian-overrides
+++ computer-janitor-1.14.1/debian/computer-janitor-gtk.lintian-overrides
@@ -0,0 +1,2 @@
+computer-janitor-gtk binary: su-wrapper-not-su-to-root
+computer-janitor-gtk binary: debian-changelog-file-is-a-symlink
--- computer-janitor-1.14.1.orig/debian/compat
+++ computer-janitor-1.14.1/debian/compat
@@ -0,0 +1 @@
+7
--- computer-janitor-1.14.1.orig/debian/computer-janitor.install
+++ computer-janitor-1.14.1/debian/computer-janitor.install
@@ -0,0 +1,5 @@
+usr/bin/computer-janitor
+usr/share/locale
+usr/share/man/man8/computer-janitor.8
+usr/share/computerjanitor
+debian/default.whitelist etc/computer-janitor.d
--- computer-janitor-1.14.1.orig/debian/changelog
+++ computer-janitor-1.14.1/debian/changelog
@@ -0,0 +1,377 @@
+computer-janitor (1.14.1-1) unstable; urgency=low
+
+ * Merge with Ubuntu.
+ * Set Standards-Version to 3.8.4.
+ * Do not depend on python-fstab because the fstab plugin is not shipped.
+ * Set XS-Python-Version to all again.
+
+ -- Julian Andres Klode Tue, 02 Feb 2010 15:29:44 +0100
+
+computer-janitor (1.14.1-0ubuntu1) lucid; urgency=low
+
+ * computerjanitorapp/ui_gtk.py:
+ - fix find_and_bind_widgets (LP: #503727)
+
+ -- Michael Vogt Thu, 21 Jan 2010 15:50:52 +0100
+
+computer-janitor (1.14-0ubuntu1) lucid; urgency=low
+
+ * New upstream release:
+ - merge fixes from Julian Andres Klode (many thanks)
+ - threading improvements
+ - optimization
+ - improve the UI responsiveness
+ * The above threading/UI changes should fix LP: #451833
+ (needs a updated update-manager-core as well)
+ * debian/control:
+ - remove the python-glade2 dependency (we use gtkbuilder)
+ - set XS-Python-Version to "current" to workaround strange
+ effect that python-support generates 2.5 headers for the
+ binaries otherwise
+
+ -- Michael Vogt Wed, 25 Nov 2009 10:00:18 +0100
+
+computer-janitor (1.13.3-2) unstable; urgency=low
+
+ * Correctly call dh_pysupport in debian/rules (Closes: #543796)
+
+ -- Julian Andres Klode Sun, 11 Oct 2009 18:05:52 +0200
+
+computer-janitor (1.13.3-1) unstable; urgency=low
+
+ * New upstream release.
+ * Install executables in /usr/sbin/ (Closes: #543767).
+ * Depend on python-gtk2 >= 2.16 and drop glade dependency (Closes: #543751).
+ * computerjanitorapp/app.py: When checking whether a package is downloadable,
+ check all versions and not just the candidate.
+ * Merge revisions 192-194 from lp:computer-janitor which reenable the
+ unsupported-plugin (Closes: #543770).
+ * Depend on version 0.7.9 or newer of python-apt (Closes: #543763).
+
+ -- Julian Andres Klode Sat, 10 Oct 2009 18:41:08 +0200
+
+computer-janitor (1.13.3-0ubuntu2) karmic; urgency=low
+
+ * Undid changes in previous release wrt UI and threading changes,
+ since they didn't seem to fix the problem.
+ * Set the gettext translation domain for GtkBuilder.
+ (Closes: LP: #437827)
+ * The "bored now" message dialog is used properly.
+
+ -- Lars Wirzenius Wed, 16 Sep 2009 17:19:28 +0300
+
+computer-janitor (1.13.3-0ubuntu2~ppa1) karmic; urgency=low
+
+ * New upstream release. This has no UI changes, but changes things
+ around so that the background threads to not attempt to use GTK.
+
+ -- Lars Wirzenius Wed, 16 Sep 2009 17:19:28 +0300
+
+computer-janitor (1.13.3-0ubuntu1) karmic; urgency=low
+
+ * New upstream release. Fixes the following bugs in Ubuntu:
+ - incomplete translation template (Closes: LP: #425018)
+ - "cleanup" button sensitive when there's nothing to clean up
+ (Closes: LP: #418319)
+ - wrong launchpad page link in about box (Closes: LP: #417309)
+ * Also, upstream re-introduced the "unsupported package" plugin, and
+ the Ubuntu packaging added a default whitelist file listing the
+ most common manually installed third-party packages.
+
+ -- Lars Wirzenius Wed, 09 Sep 2009 17:37:19 +0300
+
+computer-janitor (1.13.2-2) unstable; urgency=low
+
+ * debian/copyright: Update to DEP-5 draft format.
+
+ -- Julian Andres Klode Wed, 26 Aug 2009 09:10:55 +0200
+
+computer-janitor (1.13.2-1) unstable; urgency=low
+
+ * Initial upload to Debian (Closes: #542644).
+ * Install modules into private directory /usr/share/computerjanitor.
+ * Ship an embedded copy of computerjanitor module from update-manager,
+ as Debian's version of update-manager is too old and the next version
+ will not ship it anymore.
+ * computerjanitorapp/ui_gtk.py: Use isSet instead of is_set, as the latter
+ is only available on Python 2.6 and newer.
+ * debian/control: Update maintainer, standards-Version and VCS-* fields,
+ and drop the Conflicts/Replaces on system-cleaner*.
+ * Make computer-janitor-gtk depend on gksu.
+ * debian/watch: Add watch file pointing at archive.ubuntu.com.
+ * Install NEWS as the upstream changelog.
+
+ -- Julian Andres Klode Fri, 21 Aug 2009 20:47:19 +0200
+
+computer-janitor (1.13.2-0ubuntu2) karmic; urgency=low
+
+ * Fixed Vcs-Bzr, thanks to Julian Andres Klode.
+
+ -- Lars Wirzenius Mon, 24 Aug 2009 09:53:11 +0300
+
+computer-janitor (1.13.2-0ubuntu1) karmic; urgency=low
+
+ * New upstream version. Closes bugs in Launchpad:
+ - System cleaner removes explicitly installed third-party packages
+ (LP: #285746)
+ - I do not want to remove '/' (LP: #337241)
+ - computer-janitor incomplete error description (LP: #365325)
+ - computer-janitor commandline interface not pipe-friendly (LP: #375094)
+ - Python 2.6 DeprecationWarning: Accessed deprecated property
+ Package.candidateDownloadable (LP: #407127)
+ - Should use GtkBuilder rather than libglade (LP: #403537)
+ - Ambiguous wording in confirmation alert box (LP: #349336)
+ - computer-janitor-gtk crashed with UnicodeDecodeError in
+ get_description() (LP: #352461)
+ - Can't deselect fixes with space in computer-janitor (LP: #355535)
+ - relatime tweak will not be necessary in karmic (LP: #369151)
+ - computer janitor needs filesize column (LP: #396522)
+ * Packaging now uses dh from debhelper 7.
+
+ -- Lars Wirzenius Fri, 21 Aug 2009 15:48:12 +0300
+
+computer-janitor (1.12.1-0ubuntu4) karmic; urgency=low
+
+ [ Charlie Smotherman ]
+ * Fixed typo in manpage (Closes: LP: #366702).
+
+ -- Michael Vogt Wed, 08 Jul 2009 18:29:56 +0200
+
+computer-janitor (1.12.1-0ubuntu3) jaunty; urgency=low
+
+ * plugins/*.py: Fix to use the computerjanitorapp gettext instance,
+ instead of the computerjanitor one. This should fix a couple of
+ translations problems.
+ * computerjanitorapp/ui_gtk.py: Really ugly (bug localized ugly!)
+ hack to extract parts of cruft descriptions that need to be
+ translated, translating them, and then putting back the whole
+ description string again. (Closes: LP: #361312, #358354)
+
+ -- Lars Wirzenius Wed, 15 Apr 2009 18:22:01 +0300
+
+computer-janitor (1.12.1-0ubuntu2) jaunty; urgency=low
+
+ * Fix gettext translation domain to be "computerjanitor" everywhere.
+ (Closes: LP: #344704)
+ * Fix NameError crash when closing an error dialog. Can't reproduce
+ this, but I suspect it is some kind of weird race condition with
+ threads and GTK+. (Closes: LP: #335828)
+ * Fix typo on computerjanitorapp/app.py's help text for --no-act.
+ * When a cruft is selected, scroll it into view after the label has
+ been updated with the description. (Closes: LP: #349653)
+ * plugins/unsupported_plugin.py: Don't mark as cruft stuff that has
+ installed reverse dependencies. (Closes: LP: #345939)
+ * data/computer-janitor.desktop.in: Use the right translation
+ domain. (Closes: LP: #352770)
+
+ -- Lars Wirzenius Wed, 01 Apr 2009 17:20:45 +0300
+
+computer-janitor (1.12.1-0ubuntu1) intrepid; urgency=low
+
+ * New upstream release, with minor GTK user interface changes.
+ Fixes bugs reported to Ubuntu:
+ - Duplicate shortcut keys for Cleanup and Close (LP: #311557)
+ - Better description(s) needed for cleanup actions (LP: #300354)
+ * Updated package descriptions to be clearer.
+
+ -- Lars Wirzenius Wed, 04 Mar 2009 21:26:03 +0200
+
+computer-janitor (1.12-0ubuntu1) jaunty; urgency=low
+
+ * New upstream release.
+ * Upstream source has partially been moved to update-manager. This
+ has resulted in some packaging changes.
+ * debian/control: Add dependency on update-manager-core for
+ computer-janitor, on the version of update-manager-core that includes
+ the computer-janitor core code (plugin management, plugins).
+
+ -- Lars Wirzenius Thu, 19 Feb 2009 09:37:52 +0200
+
+computer-janitor (1.11-0ubuntu1) jaunty; urgency=low
+
+ * New upstream release.
+ * Package renamed to computer-janitor and computer-janitor-gtk.
+ * /usr/share/omf/* removed, due to not being used.
+ * The manpage for the -gtk version moved to the -gtk package, where it
+ belongs.
+ * debian/computer-janitor-gtk.lintian-overrides: Wrote. Lintian complains
+ about using gksu rather than su-to-root, but that's not available on
+ Ubuntu by default. Lintian also complains about the Debian changelog
+ file being a symlink, which is something (Ubuntu's?) cdbs/debhelper
+ do automatically, so if it is to get fixed, it should be fixed there,
+ but I'm not sure it's worth fixing. Lintian's justification for this
+ seems unsatisfactory.
+ * Updated build-dependency on debhelper to 5.50.51~, since we use
+ dh_icons.
+
+ -- Lars Wirzenius Tue, 03 Feb 2009 09:53:38 +0200
+
+system-cleaner (1.10.5-0ubuntu1) jaunty; urgency=low
+
+ * New upstream release.
+
+ -- Lars Wirzenius Fri, 16 Jan 2009 14:38:04 +0200
+
+system-cleaner (1.10.4-0ubuntu3) jaunty; urgency=low
+
+ * New upload, without changes, to work around problem on Launchpad
+ (Soyuz) which has removed all "Architecture: all" packages from
+ the armel Packages files. On request from Colin Watson.
+
+ -- Lars Wirzenius Mon, 22 Dec 2008 17:20:43 +0200
+
+system-cleaner (1.10.4-0ubuntu2) intrepid-proposed; urgency=low
+
+ * The "viime tingan pakettilisäykset ovat huono idea" release.
+ * Added Polish translation from Piotr Makowski. (LP: #290196)
+ * The apt Packages list is now checked for sanity. (LP: #290024)
+ * Icon is now shown in menu, and by the window manager.
+ (LP: #274714)
+ * The current kernel will now never be considered cruft.
+ (LP: #285657)
+ * Now asks user to confirm that they want to remove packages or remove
+ other cruft. (LP: #285888)
+ * Package short description is now shown in the user interface.
+ (LP: #286394)
+ * The GTK UI now shows column headers, so that it is clear what the
+ tick column means. (No bug reported about this explicitly, but it
+ has come up repeatedly.)
+ * Support for whitelists in /etc/cruft-remover.d/*.whitelist added.
+ See the cruft-remover(8) manual page for details. This can later be
+ seeded with the most common third-party packages, until dpkg+apt
+ get sufficient meta data to deal with this in a better way.
+ (Does not quite close LP: 285746.)
+
+ -- Lars Wirzenius Fri, 07 Nov 2008 15:58:25 +0200
+
+system-cleaner (1.10.4-0ubuntu1) intrepid; urgency=low
+
+ * New upstream release.
+ - Renamed to Cruft Remover. Package name stays the same for release
+ management reasons. Name change is due to an existing trademark
+ for the old name.
+ - .desktop file now support translations via po files (Closes: LP#287538).
+ - Updated translations for Finnish, Japanese, French, Spanish.
+ - A code-crashing typo fixed (Closes: LP#286731).
+ - Moved to the System/Administration menu (Closes: LP#286458).
+ - Does not add the relatime mount option if noatime is used
+ (Closes: LP#286468).
+
+ -- Lars Wirzenius Mon, 27 Oct 2008 14:04:43 +0200
+
+system-cleaner (1.10.3-0ubuntu1) intrepid; urgency=low
+
+ * New upstream version, with fixes for logging problems found by James
+ Westby.
+
+ -- Lars Wirzenius Wed, 15 Oct 2008 16:09:53 +0300
+
+system-cleaner (1.10.2-0ubuntu1) intrepid; urgency=low
+
+ * New upstream version. Fixes bugs in Ubuntu:
+ - throws exception when syslog isn't installed/running (LP:#274970)
+ - Not translated and doesn't allow for translations (LP:#279580)
+ - system-cleaner crashed with LockFailedException in _fetchArchives()
+ (LP:#281657)
+ - help button isn't functional (LP:#279577)
+ - request to be included in intrepid (LP:#283682)
+
+ -- Lars Wirzenius Wed, 15 Oct 2008 12:28:29 +0300
+
+system-cleaner (1.10.1-0ubuntu1) intrepid; urgency=low
+
+ * New uptream version. (LP: #279092)
+
+ -- Lars Wirzenius Mon, 06 Oct 2008 21:45:54 +0300
+
+system-cleaner (1.10-0ubuntu1) intrepid; urgency=low
+
+ * New upstream version.
+ * debian/control: Added versioned dependency from system-cleaner-gtk
+ to system-cleaner, so that the packages don't get out of sync.
+ * debian/control: Added build dependency on python-apt.
+
+ -- Lars Wirzenius Tue, 30 Sep 2008 23:57:49 +0300
+
+system-cleaner (1.9-0ubuntu1) hardy; urgency=low
+
+ * New upstream version, fixes bugs:
+ - "System Cleaner Does Not Refresh Following Cleaning" (LP: #274715)
+ - "System Cleaner Cleanup Button Is Always Enabled" (LP: #274717)
+
+ -- Lars Wirzenius Fri, 26 Sep 2008 20:45:05 +0300
+
+system-cleaner (1.8-0ubuntu1) intrepid; urgency=low
+
+ * New upstream version. Fixes:
+ - "Clicking on lines should not {de}select options" (LP:271390)
+ - " system-cleaner wants to cleanup /" (LP:271234)
+ * debian/copyright: Include license-check's copyright info. Thanks to
+ Steve Langasek for pointing out that it was missing.
+
+ -- Lars Wirzenius Tue, 23 Sep 2008 00:56:53 +0300
+
+system-cleaner (1.7-0ubuntu1) intrepid; urgency=low
+
+ * system-cleaner-gtk is now multi-threaded, so that the user interface
+ does not freeze during long operations.
+ * /var/lib/system-cleaner is now handled by postinst and postrm.
+ * debian/rules: Added Vcs-Bzr and Homepage.
+ * debian/copyright: Fixed to refer to GPL-3 only.
+ * debian/control: Removed warnings about alpha status of software,
+ suggested by Michael Vogt.
+
+ -- Lars Wirzenius Fri, 12 Sep 2008 21:42:53 +0300
+
+system-cleaner (1.6) hardy; urgency=low
+
+ * Wrote a GUI version with GTK.
+ * Added a system-cleaner-gtk package. Not including the GUI version in
+ the main package, so that it can be install on, say, a server, without
+ dragging in lots of GUI stuff.
+
+ -- Lars Wirzenius Wed, 20 Aug 2008 23:09:53 +0300
+
+system-cleaner (1.5) hardy; urgency=low
+
+ * Add fstab plugin. Added dependency on python-fstab; at least version
+ 1.2 is required, because the earlier versions were buggy.
+
+ -- Lars Wirzenius Thu, 14 Aug 2008 23:41:53 +0300
+
+system-cleaner (1.4) hardy; urgency=low
+
+ * Make system-cleaner the command line version not emit a warning
+ from PyGTK when running without $DISPLAY.
+
+ -- Lars Wirzenius Mon, 11 Aug 2008 21:16:53 +0300
+
+system-cleaner (1.3) hardy; urgency=low
+
+ * Undo the python-apt versioned dependency. Instead, don't install
+ the autoremoval plugin, for now.
+ * Cruft names are now prefixed with their type. This will avoid
+ conflicts between packages, files, users, etc, that have the same
+ name.
+
+ -- Lars Wirzenius Wed, 06 Aug 2008 02:15:53 +0300
+
+system-cleaner (1.2) hardy; urgency=low
+
+ * Made the dependency on python-apt be versioned, since we need a
+ version that provides the isAutoRemovable method to Package
+ objects.
+
+ -- Lars Wirzenius Wed, 06 Aug 2008 02:15:53 +0300
+
+system-cleaner (1.1) hardy; urgency=low
+
+ * Plugins are now included in the package.
+
+ -- Lars Wirzenius Wed, 06 Aug 2008 01:15:53 +0300
+
+system-cleaner (1.0) hardy; urgency=low
+
+ * First public release.
+
+ -- Lars Wirzenius Tue, 05 Aug 2008 21:16:53 +0300
--- computer-janitor-1.14.1.orig/debian/computer-janitor.docs
+++ computer-janitor-1.14.1/debian/computer-janitor.docs
@@ -0,0 +1 @@
+README
--- computer-janitor-1.14.1.orig/debian/copyright
+++ computer-janitor-1.14.1/debian/copyright
@@ -0,0 +1,35 @@
+Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?rev=59
+Source: http://archive.ubuntu.com/ubuntu/pool/main/c/computer-janitor/
+Maintainer: Lars Wirzenius
+
+Files: *
+Copyright: © 2008-2009 Canonical, Ltd.
+License: GPL-3
+
+Files: license-check
+Copyright: © 2007-2008 Lars Wirzenius
+License: GPL-2+
+ 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 2 of the License, or
+ (at your option) any later version.
+ .
+ On a Debian system, you can find a copy of the GPL version 2 in
+ /usr/share/common-licenses/GPL-2.
+
+Files: data/*.png
+Copyright: © 2008 Marco Rodrigues
+License: GPL-3
+
+Files: debian/*
+Copyright: © 2008-2009 Canonical, Ltd.
+ © 2009 Julian Andres Klode
+License: GPL-3
+
+License: GPL-3
+ 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 of the License.
+ .
+ On a Debian system, you can find a copy of the GPL version 3 in
+ /usr/share/common-licenses/GPL-3.
--- computer-janitor-1.14.1.orig/debian/pycompat
+++ computer-janitor-1.14.1/debian/pycompat
@@ -0,0 +1 @@
+2
--- computer-janitor-1.14.1.orig/debian/computer-janitor-gtk.install
+++ computer-janitor-1.14.1/debian/computer-janitor-gtk.install
@@ -0,0 +1,6 @@
+usr/bin/computer-janitor-gtk
+usr/share/man/man8/computer-janitor-gtk.8
+usr/share/computer-janitor/ComputerJanitor.ui
+usr/share/computer-janitor/computerjanitor-256x256.png
+usr/share/applications/computer-janitor-gtk.desktop
+usr/share/icons
--- computer-janitor-1.14.1.orig/debian/default.whitelist
+++ computer-janitor-1.14.1/debian/default.whitelist
@@ -0,0 +1,4 @@
+deb:skype
+deb:acrobat
+deb:google-earth
+deb:picasa
--- computer-janitor-1.14.1.orig/debian/control
+++ computer-janitor-1.14.1/debian/control
@@ -0,0 +1,44 @@
+Source: computer-janitor
+Maintainer: Julian Andres Klode
+Section: admin
+Priority: optional
+Standards-Version: 3.8.4
+Build-Depends: debhelper (>= 7.3), python-support (>= 1.0.3),
+ python, python-apt, python-distutils-extra
+XS-Python-Version: all
+Vcs-Bzr: http://bazaar.launchpad.net/~juliank/computer-janitor/debian
+Vcs-Browser: http://bazaar.launchpad.net/~juliank/computer-janitor/debian
+Homepage: https://wiki.ubuntu.com/CleanupCruft
+
+Package: computer-janitor
+Architecture: all
+Depends: ${python:Depends}, python-apt (>= 0.7.9), ${misc:Depends}
+XB-Python-Version: ${python:Versions}
+Description: clean up a system so it's more like a freshly installed one
+ Over time, a computer system tends to get cluttered. For example,
+ software packages that are no longer needed can be uninstalled.
+ When the system is upgraded from release to release, it may miss
+ out on configuration tweaks that freshly installed systems get.
+ .
+ Computer Janitor is an application to fix these kinds of problems.
+ It attempts to find software packages that can be removed, and
+ tweak the system configuration in useful ways.
+ .
+ This is the command line version.
+
+Package: computer-janitor-gtk
+Architecture: all
+Depends: ${python:Depends}, computer-janitor (=${source:Version}),
+ python-gtk2 (>= 2.16), ${misc:Depends}, gksu
+XB-Python-Version: ${python:Versions}
+Description: clean up a system so it's more like a freshly installed one
+ Over time, a computer system tends to get cluttered. For example,
+ software packages that are no longer needed can be uninstalled.
+ When the system is upgraded from release to release, it may miss
+ out on configuration tweaks that freshly installed systems get.
+ .
+ Computer Janitor is an application to fix these kinds of problems.
+ It attempts to find software packages that can be removed, and
+ tweak the system configuration in useful ways.
+ .
+ This is the GNOME version.
--- computer-janitor-1.14.1.orig/debian/rules
+++ computer-janitor-1.14.1/debian/rules
@@ -0,0 +1,35 @@
+#!/usr/bin/make -f
+%:
+ dh $@
+
+override_dh_auto_test:
+
+override_dh_installchangelogs:
+ dh_installchangelogs NEWS
+
+override_dh_auto_install:
+ dh_auto_install --buildsystem=python_distutils -- \
+ --install-lib /usr/share/computerjanitor/
+
+ mv debian/tmp/usr/share/icons/hicolor/24x24/apps/computerjanitor-24x24.png \
+ debian/tmp/usr/share/icons/hicolor/24x24/apps/computerjanitor.png
+
+override_dh_pysupport:
+ dh_pysupport /usr/share/computerjanitor
+
+override_dh_install:
+ dh_install
+ mv debian/computer-janitor/usr/bin/computer-janitor \
+ debian/computer-janitor/usr/share/computerjanitor
+
+ mkdir -p debian/computer-janitor-gtk/usr/share/computerjanitor/
+ mv debian/computer-janitor-gtk/usr/bin/computer-janitor-gtk \
+ debian/computer-janitor-gtk/usr/share/computerjanitor/computer-janitor-gtk
+
+ dh_link -pcomputer-janitor usr/share/computerjanitor/computer-janitor \
+ usr/sbin/computer-janitor
+
+ dh_link -pcomputer-janitor-gtk usr/share/computerjanitor/computer-janitor-gtk \
+ usr/sbin/computer-janitor-gtk
+
+ rmdir debian/computer-janitor-*/usr/bin
--- computer-janitor-1.14.1.orig/debian/computer-janitor.postrm
+++ computer-janitor-1.14.1/debian/computer-janitor.postrm
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+set -e
+
+# postinst creates /var/lib/computer-janitor. Running computer-janitor
+# creates state.dat in that directory. That file is similar to a config
+# file: it should be deleted at purge, but not at normal package
+# removal. We handle that here.
+
+case "$1" in
+ purge)
+ rm -f /var/lib/computer-janitor/state.dat
+ rmdir /var/lib/computer-janitor
+ ;;
+esac
+
+
+#DEBHELPER#
--- computer-janitor-1.14.1.orig/debian/computer-janitor.postinst
+++ computer-janitor-1.14.1/debian/computer-janitor.postinst
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+set -e
+
+# Create /var/lib/computer-janitor if it doesn't exist and we're being
+# installed.
+
+case "$1" in
+ configure)
+ # Make sure we have a directory to put the state file in.
+ [ -e /var/lib/computer-janitor ] || mkdir /var/lib/computer-janitor
+
+ # If this system has or had system-cleaner installed, it might
+ # have an old state file lying around. Let's copy that to the new
+ # location, but only if there isn't one there already.
+ for x in cruft-remover system-cleaner
+ do
+ if [ ! -e /var/lib/computer-janitor/state.dat ] &&
+ [ -e /var/lib/$x/state.dat ]
+ then
+ cp /var/lib/$x/state.dat /var/lib/computer-janitor
+ fi
+ done
+ ;;
+esac
+
+
+#DEBHELPER#
--- computer-janitor-1.14.1.orig/debian/watch
+++ computer-janitor-1.14.1/debian/watch
@@ -0,0 +1,3 @@
+version=3
+http://archive.ubuntu.com/ubuntu/pool/main/c/computer-janitor/ \
+ computer-janitor_(.*).orig.tar.gz