18.1.39
by James Westby
Place the package under the GPL |
1 |
# errors.py -- Error classes
|
18.1.43
by James Westby
Correct (C) statements. Add copyright to setup.py |
2 |
# Copyright (C) 2006 James Westby <jw+debian@jameswestby.net>
|
290
by James Westby
Cleanup of the repack tarball code, splitting out the work for each type. |
3 |
#
|
18.1.39
by James Westby
Place the package under the GPL |
4 |
# This file is part of bzr-builddeb.
|
5 |
#
|
|
75.1.2
by Jelmer Vernooij
Fix some typos |
6 |
# bzr-builddeb is free software; you can redistribute it and/or modify
|
18.1.39
by James Westby
Place the package under the GPL |
7 |
# it under the terms of the GNU General Public License as published by
|
8 |
# the Free Software Foundation; either version 2 of the License, or
|
|
9 |
# (at your option) any later version.
|
|
10 |
#
|
|
11 |
# bzr-builddeb is distributed in the hope that it will be useful,
|
|
12 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 |
# GNU General Public License for more details.
|
|
15 |
#
|
|
16 |
# You should have received a copy of the GNU General Public License
|
|
17 |
# along with bzr-builddeb; if not, write to the Free Software
|
|
18 |
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
19 |
#
|
|
18.1.35
by James Westby
Refactored code to use multiple files. |
20 |
|
42.1.1
by Jelmer Vernooij
Use new style errors (BzrNewError was deprecated in bzr 0.13). |
21 |
from bzrlib.errors import BzrError |
22 |
||
23 |
||
24 |
class DebianError(BzrError): |
|
290
by James Westby
Cleanup of the repack tarball code, splitting out the work for each type. |
25 |
_fmt = "A Debian packaging error occurred: %(asdf)s" |
26 |
||
27 |
def __init__(self, cause): |
|
292
by James Westby
Fix thinko in errors.py changes. |
28 |
BzrError.__init__(self, cause=cause) |
290
by James Westby
Cleanup of the repack tarball code, splitting out the work for each type. |
29 |
|
30 |
||
31 |
class NoSourceDirError(BzrError): |
|
32 |
_fmt = ("There is no existing source directory to use. Use " |
|
33 |
"--export-only or --dont-purge to get one that can be used") |
|
34 |
||
35 |
||
36 |
class BuildFailedError(BzrError): |
|
37 |
_fmt = "The build failed." |
|
38 |
||
39 |
||
40 |
class StopBuild(BzrError): |
|
41 |
_fmt = "Stopping the build: %(reason)s." |
|
42 |
||
43 |
def __init__(self, reason): |
|
321.1.1
by James Westby
Make errors printable again. |
44 |
BzrError.__init__(self, reason=reason) |
290
by James Westby
Cleanup of the repack tarball code, splitting out the work for each type. |
45 |
|
46 |
||
47 |
class MissingChangelogError(BzrError): |
|
48 |
_fmt = 'Could not find changelog at %(locations)s.' |
|
49 |
||
50 |
def __init__(self, locations): |
|
321.1.1
by James Westby
Make errors printable again. |
51 |
BzrError.__init__(self, location=locations) |
290
by James Westby
Cleanup of the repack tarball code, splitting out the work for each type. |
52 |
|
53 |
||
54 |
class AddChangelogError(BzrError): |
|
55 |
_fmt = 'Please add "%(changelog)s" to the branch using bzr add.' |
|
56 |
||
57 |
def __init__(self, changelog): |
|
321.1.1
by James Westby
Make errors printable again. |
58 |
BzrError.__init__(self, changelog=changelog) |
290
by James Westby
Cleanup of the repack tarball code, splitting out the work for each type. |
59 |
|
60 |
||
61 |
class ImportError(BzrError): |
|
62 |
_fmt = "The files could not be imported: %(reason)s" |
|
63 |
||
64 |
def __init__(self, reason): |
|
321.1.1
by James Westby
Make errors printable again. |
65 |
BzrError.__init__(self, reason=reason) |
290
by James Westby
Cleanup of the repack tarball code, splitting out the work for each type. |
66 |
|
130
by James Westby
Improve the handling of strange .dsc files. |
67 |
|
178.1.13
by James Westby
Internal hook execution support. |
68 |
class HookFailedError(BzrError): |
290
by James Westby
Cleanup of the repack tarball code, splitting out the work for each type. |
69 |
_fmt = 'The "%(hook_name)s" hook failed.' |
178.1.13
by James Westby
Internal hook execution support. |
70 |
|
290
by James Westby
Cleanup of the repack tarball code, splitting out the work for each type. |
71 |
def __init__(self, hook_name): |
321.1.1
by James Westby
Make errors printable again. |
72 |
BzrError.__init__(self, hook_name=hook_name) |
178.1.13
by James Westby
Internal hook execution support. |
73 |
|
178.1.29
by James Westby
Add support for incremental import dsc. |
74 |
|
75 |
class OnlyImportSingleDsc(BzrError): |
|
290
by James Westby
Cleanup of the repack tarball code, splitting out the work for each type. |
76 |
_fmt = "You are only allowed to import one version in incremental mode." |
77 |
||
178.1.29
by James Westby
Add support for incremental import dsc. |
78 |
|
210
by James Westby
* Don't silently skip unkown types when extracting a tarball, error |
79 |
class UnknownType(BzrError): |
290
by James Westby
Cleanup of the repack tarball code, splitting out the work for each type. |
80 |
_fmt = 'Cannot extract "%(path)s" from archive as it is an unknown type.' |
210
by James Westby
* Don't silently skip unkown types when extracting a tarball, error |
81 |
|
290
by James Westby
Cleanup of the repack tarball code, splitting out the work for each type. |
82 |
def __init__(self, path): |
321.1.1
by James Westby
Make errors printable again. |
83 |
BzrError.__init__(self, path=path) |
210
by James Westby
* Don't silently skip unkown types when extracting a tarball, error |
84 |
|
247
by James Westby
Use standard locations for the directories. |
85 |
|
86 |
class MissingChanges(BzrError): |
|
290
by James Westby
Cleanup of the repack tarball code, splitting out the work for each type. |
87 |
_fmt = "Could not find .changes file: %(changes)s." |
247
by James Westby
Use standard locations for the directories. |
88 |
|
290
by James Westby
Cleanup of the repack tarball code, splitting out the work for each type. |
89 |
def __init__(self, changes): |
321.1.1
by James Westby
Make errors printable again. |
90 |
BzrError.__init__(self, changes=changes) |
247
by James Westby
Use standard locations for the directories. |
91 |
|
92 |
||
254
by James Westby
Switch to DistributionBranch for merge-upstream. |
93 |
class UpstreamAlreadyImported(BzrError): |
290
by James Westby
Cleanup of the repack tarball code, splitting out the work for each type. |
94 |
_fmt = 'Upstream version "%(version)s" has already been imported.' |
254
by James Westby
Switch to DistributionBranch for merge-upstream. |
95 |
|
96 |
def __init__(self, version): |
|
321.1.1
by James Westby
Make errors printable again. |
97 |
BzrError.__init__(self, version=str(version)) |
254
by James Westby
Switch to DistributionBranch for merge-upstream. |
98 |
|
99 |
||
266.1.4
by James Westby
Add a revisionspec that allows you to specify revisions by package versions. |
100 |
class AmbiguousPackageSpecification(BzrError): |
290
by James Westby
Cleanup of the repack tarball code, splitting out the work for each type. |
101 |
_fmt = ('You didn\'t specify a distribution with the package ' |
102 |
'specification, and tags exists that state that the '
|
|
103 |
'version that you specified has been uploaded to more '
|
|
104 |
'than one distribution. Please specify which version '
|
|
105 |
'you wish to refer to by by appending ":debian" or '
|
|
106 |
'":ubuntu" to the revision specifier: %(specifier)s') |
|
266.1.4
by James Westby
Add a revisionspec that allows you to specify revisions by package versions. |
107 |
|
108 |
def __init__(self, specifier): |
|
321.1.1
by James Westby
Make errors printable again. |
109 |
BzrError.__init__(self, specifier=specifier) |
266.1.4
by James Westby
Add a revisionspec that allows you to specify revisions by package versions. |
110 |
|
111 |
||
112 |
class UnknownVersion(BzrError): |
|
290
by James Westby
Cleanup of the repack tarball code, splitting out the work for each type. |
113 |
_fmt = ('No tag exists in this branch indicating that version ' |
114 |
'"%(version)s" has been uploaded.') |
|
266.1.4
by James Westby
Add a revisionspec that allows you to specify revisions by package versions. |
115 |
|
116 |
def __init__(self, version): |
|
321.1.1
by James Westby
Make errors printable again. |
117 |
BzrError.__init__(self, version=version) |
266.1.4
by James Westby
Add a revisionspec that allows you to specify revisions by package versions. |
118 |
|
119 |
||
120 |
class UnknownDistribution(BzrError): |
|
121 |
_fmt = "Unknown distribution: %(distribution)s." |
|
122 |
||
123 |
def __init__(self, distribution): |
|
321.1.1
by James Westby
Make errors printable again. |
124 |
BzrError.__init__(self, distribution=distribution) |
266.1.4
by James Westby
Add a revisionspec that allows you to specify revisions by package versions. |
125 |
|
126 |
||
127 |
class VersionNotSpecified(BzrError): |
|
128 |
_fmt = "You did not specify a package version." |
|
129 |
||
130 |
||
290
by James Westby
Cleanup of the repack tarball code, splitting out the work for each type. |
131 |
class UnsupportedRepackFormat(BzrError): |
132 |
_fmt = ('Either the file extension of "%(location)s" indicates that ' |
|
133 |
'it is a format unsupported for repacking or it is a '
|
|
134 |
'remote directory.') |
|
135 |
||
136 |
def __init__(self, location): |
|
321.1.1
by James Westby
Make errors printable again. |
137 |
BzrError.__init__(self, location=location) |
321.1.2
by James Westby
Initial support for pristine-tar. |
138 |
|
139 |
||
140 |
class PristineTarError(BzrError): |
|
141 |
_fmt = 'There was an error using pristine-tar: %(error)s.' |
|
142 |
||
143 |
def __init__(self, error): |
|
144 |
BzrError.__init__(self, error=error) |