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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
|
# errors.py -- Error classes
# Copyright (C) 2006 James Westby <jw+debian@jameswestby.net>
#
# This file is part of bzr-builddeb.
#
# bzr-builddeb 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.
#
# bzr-builddeb 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 bzr-builddeb; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
from bzrlib.errors import BzrError
class DebianError(BzrError):
_fmt = "A Debian packaging error occurred: %(cause)s"
def __init__(self, cause):
BzrError.__init__(self, cause=cause)
class NoSourceDirError(BzrError):
_fmt = ("There is no existing source directory to use. Use "
"--export-only or --dont-purge to get one that can be used")
class MissingUpstreamTarball(BzrError):
_fmt = ("Unable to find the needed upstream tarball for package %(package)s, "
"version %(version)s.")
def __init__(self, package, version):
BzrError.__init__(self, package=package, version=version)
class TarFailed(BzrError):
_fmt = "There was an error executing tar to %(operation)s %(tarball)s."
def __init__(self, operation, tarball):
BzrError.__init__(self, operation=operation, tarball=tarball)
class BuildFailedError(BzrError):
_fmt = "The build failed."
class UnparseableChangelog(BzrError):
_fmt = "There was an error parsing the changelog: %(error)s"
def __init__(self, error):
BzrError.__init__(self, error=error)
class StopBuild(BzrError):
_fmt = "Stopping the build: %(reason)s."
def __init__(self, reason):
BzrError.__init__(self, reason=reason)
class MissingChangelogError(BzrError):
_fmt = 'Could not find changelog at %(location)s in tree.'
def __init__(self, locations):
BzrError.__init__(self, location=locations)
class AddChangelogError(BzrError):
_fmt = 'Please add "%(changelog)s" to the branch using bzr add.'
def __init__(self, changelog):
BzrError.__init__(self, changelog=changelog)
class ImportError(BzrError):
_fmt = "The files could not be imported: %(reason)s"
def __init__(self, reason):
BzrError.__init__(self, reason=reason)
class HookFailedError(BzrError):
_fmt = 'The "%(hook_name)s" hook failed.'
def __init__(self, hook_name):
BzrError.__init__(self, hook_name=hook_name)
class OnlyImportSingleDsc(BzrError):
_fmt = "You are only allowed to import one version in incremental mode."
class UnknownType(BzrError):
_fmt = 'Cannot extract "%(path)s" from archive as it is an unknown type.'
def __init__(self, path):
BzrError.__init__(self, path=path)
class MissingChanges(BzrError):
_fmt = "Could not find .changes file: %(changes)s."
def __init__(self, changes):
BzrError.__init__(self, changes=changes)
class UpstreamAlreadyImported(BzrError):
_fmt = 'Upstream version "%(version)s" has already been imported.'
def __init__(self, version):
BzrError.__init__(self, version=str(version))
class UpstreamBranchAlreadyMerged(BzrError):
_fmt = 'That revision of the upstream branch has already been merged.'
class AmbiguousPackageSpecification(BzrError):
_fmt = ('You didn\'t specify a distribution with the package '
'specification, and tags exists that state that the '
'version that you specified has been uploaded to more '
'than one distribution. Please specify which version '
'you wish to refer to by by appending ":debian" or '
'":ubuntu" to the revision specifier: %(specifier)s')
def __init__(self, specifier):
BzrError.__init__(self, specifier=specifier)
class UnknownVersion(BzrError):
_fmt = ('No tag exists in this branch indicating that version '
'"%(version)s" has been uploaded.')
def __init__(self, version):
BzrError.__init__(self, version=version)
class VersionNotSpecified(BzrError):
_fmt = "You did not specify a package version."
class PackageVersionNotPresent(BzrError):
_fmt = "%(package)s %(version)s was not found in %(upstream)s."
def __init__(self, package, version, upstream):
BzrError.__init__(self, package=package, version=version,
upstream=upstream)
class UnsupportedRepackFormat(BzrError):
_fmt = ('Either the file extension of "%(location)s" indicates that '
'it is a format unsupported for repacking or it is a '
'remote directory.')
def __init__(self, location):
BzrError.__init__(self, location=location)
class SharedUpstreamConflictsWithTargetPackaging(BzrError):
_fmt = ('The upstream branches for the merge source and target have '
'diverged. Unfortunately, the attempt to fix this problem '
'resulted in conflicts. Please resolve these, commit and '
're-run the "%(cmd)s" command to finish. '
'Alternatively, until you commit you can use "bzr revert" to '
'restore the state of the unmerged branch.')
def __init__(self, cmd):
self.cmd = cmd
class PerFileTimestampsNotSupported(BzrError):
_fmt = ("Per file timestamps are not supported by the "
"currently loaded version of bzrlib.")
class NoPreviousUpload(BzrError):
_fmt = ("There was no previous upload to %(distribution)s.")
def __init__(self, distribution):
BzrError.__init__(self, distribution=distribution)
class UnableToFindPreviousUpload(BzrError):
_fmt = ("Unable to determine the previous upload for --package-merge.")
class InconsistentSourceFormatError(BzrError):
_fmt = ("Inconsistency between source format and version: version is "
"%(version_bool)snative, format is %(format_bool)snative.")
def __init__(self, version_native, format_native):
if version_native:
version_bool = ""
else:
version_bool = "not "
if format_native:
format_bool = ""
else:
format_bool = "not "
BzrError.__init__(self, version_bool=version_bool, format_bool=format_bool)
class WatchFileMissing(BzrError):
_fmt = "No watch file found."
class StrictBuildFailed(BzrError):
_fmt = ("Build refused because there are unknown files in the tree. "
"To list all known files, run 'bzr unknowns'.")
class DchError(BzrError):
_fmt = 'There was an error using dch: %(error)s.'
def __init__(self, error):
BzrError.__init__(self, error=error)
class MultipleUpstreamTarballsNotSupported(BzrError):
_fmt = ("Importing packages using source format 3.0 multiple tarballs "
"is not yet supported.")
class QuiltUnapplyError(BzrError):
_fmt = ("Unable to unapply quilt patches for %(kind)r tree: %(msg)s")
def __init__(self, kind, msg):
BzrError.__init__(self)
self.kind = kind
if msg is not None and msg.count("\n") == 1:
msg = msg.strip()
self.msg = msg
|