A very large first-pass refactoring of the packaging code. Ultimately
my goal is to replace the if-elif-elif-else type method calls in
the package manager that fetches a file with a more OO-style method
that tries to fetch the files from a variety of RepositoryFetcher
instances. My primary motivation for doing that is so that I can
add a more specialized RepositoryFetcher instance that's closesly
tied to the code in harness_autoserv.py and I feel it would be a bad
idea to try and intergrate that into packages.py itself.

However some other refactoring and cleanup ended up being required
so as a first pass I left the if-elif-elif-else style of
fetch_pkg_file, except now it just creates and instance of the
RepositoryFetcher on the fly and asks it to fetch a package.

The major changes that I did make were:
  - moved the fetch_pkg_file_* methods into RepositoryFetcher classes
  - moved the bulk of the packages.py into a base_packages.py file
    and just left a base+site stub in packages.py since I was running
    into some circular dependency troubles with packages and
    site_packages
  - moved the package error classes out of packages.py and into
    error.py, and added an extra abstract error class so that all
    the package error classes inherit from a common class
  - cleaned up some of the fetch_pkg_file_* code while moving it around
    such as removing a bunch of dead code from fetch_pkg_file_http
  - fixed up all the utilities, tests and infrastructure that
    referenced the packages module to use the error module instead
    (or in a few cases base_packages)

 Functionally these rather large changes should actually have very
 little impact on Autotest as a whole, since this is mostly just moving
 code around. I plan to follow it up with another patch later on that
 replaces the fetch_pkg_file code with something that uses a set of
 long-lived RepositoryFetcher instances, along with factory methods
 for constructing those fetchers, and then later on with a patch that
 adds support for retriving packages directly from autoserv (using
 harness_autoserv).

 Risk: High
 Visibility: Mostly refactoring, moved error classes into error.py,
             an a few bits and pieces of code cleanup in the moved
     code.

Signed-off-by: John Admanski <jadmanski@google.com>



git-svn-id: http://test.kernel.org/svn/autotest/trunk@3511 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/common_lib/error.py b/client/common_lib/error.py
index 60425af..f2810ab 100644
--- a/client/common_lib/error.py
+++ b/client/common_lib/error.py
@@ -268,6 +268,44 @@
     pass
 
 
+# packaging system errors
+
+class PackagingError(AutotestError):
+    'Abstract error class for all packaging related errors.'
+
+
+class PackageUploadError(PackagingError):
+    'Raised when there is an error uploading the package'
+
+
+class PackageFetchError(PackagingError):
+    'Raised when there is an error fetching the package'
+
+
+class PackageRemoveError(PackagingError):
+    'Raised when there is an error removing the package'
+
+
+class PackageInstallError(PackagingError):
+    'Raised when there is an error installing the package'
+
+
+class RepoDiskFullError(PackagingError):
+    'Raised when the destination for packages is full'
+
+
+class RepoWriteError(PackagingError):
+    "Raised when packager cannot write to a repo's desitnation"
+
+
+class RepoUnknownError(PackagingError):
+    "Raised when packager cannot write to a repo's desitnation"
+
+
+class RepoError(PackagingError):
+    "Raised when a repo isn't working in some way"
+
+
 # This MUST remain at the end of the file.
 # Limit 'from error import *' to only import the exception instances.
 for _name, _thing in locals().items():