diff options
author | Guillem Jover <guillem@debian.org> | 2008-12-06 19:05:10 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2008-12-09 05:49:28 +0200 |
commit | cb30ab1729f7cd1fa1620f4b9de3d2ed020bc238 (patch) | |
tree | 67647adef219683aab567033bf44c3e1fd1d615a /scripts/Dpkg/Source | |
parent | 40a15bdb0c74ec3c20fe46248fbdd27e3e242bc0 (diff) | |
download | dpkg-cb30ab1729f7cd1fa1620f4b9de3d2ed020bc238.tar.gz |
Properly use internerr to report about programming bugs
Use internerr for internal error conditions which happen only due to
programming bugs and should never occur, otherwise the code is wrong
and should be fixed.
Diffstat (limited to 'scripts/Dpkg/Source')
-rw-r--r-- | scripts/Dpkg/Source/Archive.pm | 6 | ||||
-rw-r--r-- | scripts/Dpkg/Source/CompressedFile.pm | 4 | ||||
-rw-r--r-- | scripts/Dpkg/Source/Compressor.pm | 4 | ||||
-rw-r--r-- | scripts/Dpkg/Source/Package.pm | 6 | ||||
-rw-r--r-- | scripts/Dpkg/Source/Patch.pm | 3 |
5 files changed, 12 insertions, 11 deletions
diff --git a/scripts/Dpkg/Source/Archive.pm b/scripts/Dpkg/Source/Archive.pm index f1dbb6512..5d1ae4eec 100644 --- a/scripts/Dpkg/Source/Archive.pm +++ b/scripts/Dpkg/Source/Archive.pm @@ -52,7 +52,7 @@ sub create { sub _add_entry { my ($self, $file) = @_; - error("call create first") unless $self->{"tar_input"}; + internerr("call create first") unless $self->{"tar_input"}; $file = $2 if ($file =~ /^\Q$self->{'cwd'}\E\/(.+)$/); # Relative names print({ $self->{'tar_input'} } "$file\0") || syserr(_g("write on tar input")); @@ -64,7 +64,7 @@ sub add_file { if ($self->{"chdir"}) { $testfile = File::Spec->catfile($self->{"chdir"}, $file); } - error("add_file() doesn't handle directories") if not -l $testfile and -d _; + internerr("add_file() doesn't handle directories") if not -l $testfile and -d _; $self->_add_entry($file); } @@ -74,7 +74,7 @@ sub add_directory { if ($self->{"chdir"}) { $testfile = File::Spec->catdir($self->{"chdir"}, $file); } - error("add_directory() only handles directories") unless not -l $testfile and -d _; + internerr("add_directory() only handles directories") unless not -l $testfile and -d _; $self->_add_entry($file); } diff --git a/scripts/Dpkg/Source/CompressedFile.pm b/scripts/Dpkg/Source/CompressedFile.pm index a3df25b5a..1784cdf65 100644 --- a/scripts/Dpkg/Source/CompressedFile.pm +++ b/scripts/Dpkg/Source/CompressedFile.pm @@ -83,8 +83,8 @@ sub get_filename { my $comp = $self->{"compression"}; if ($self->{'add_comp_ext'}) { if ($comp eq "auto") { - error("automatic detection of compression is " . - "incompatible with add_comp_ext"); + internerr("automatic detection of compression is " . + "incompatible with add_comp_ext"); } elsif ($comp eq "none") { return $self->{"filename"}; } else { diff --git a/scripts/Dpkg/Source/Compressor.pm b/scripts/Dpkg/Source/Compressor.pm index 0ab236d1a..bcaafeac4 100644 --- a/scripts/Dpkg/Source/Compressor.pm +++ b/scripts/Dpkg/Source/Compressor.pm @@ -96,8 +96,8 @@ sub _sanity_check { $to++ if $opts{"to_$_"}; $from++ if $opts{"from_$_"}; } - error("exactly one to_* parameter is needed") if $to != 1; - error("exactly one from_* parameter is needed") if $from != 1; + internerr("exactly one to_* parameter is needed") if $to != 1; + internerr("exactly one from_* parameter is needed") if $from != 1; return %opts; } diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm index fd7732559..079488667 100644 --- a/scripts/Dpkg/Source/Package.pm +++ b/scripts/Dpkg/Source/Package.pm @@ -372,7 +372,8 @@ sub extract { } sub do_extract { - error("Dpkg::Source::Package doesn't know how to unpack a source package. Use one of the subclasses."); + internerr("Dpkg::Source::Package doesn't know how to unpack a " . + "source package. Use one of the subclasses."); } # Function used specifically during creation of a source package @@ -387,7 +388,8 @@ sub build { } sub do_build { - error("Dpkg::Source::Package doesn't know how to build a source package. Use one of the subclasses."); + internerr("Dpkg::Source::Package doesn't know how to build a " . + "source package. Use one of the subclasses."); } sub can_build { diff --git a/scripts/Dpkg/Source/Patch.pm b/scripts/Dpkg/Source/Patch.pm index dcf31ae41..15f1c36e9 100644 --- a/scripts/Dpkg/Source/Patch.pm +++ b/scripts/Dpkg/Source/Patch.pm @@ -111,8 +111,7 @@ sub add_diff_file { "original or modified version)"), $new); } else { chomp; - internerr(_g("unknown line from diff -u on %s: `%s'"), - $new, $_); + error(_g("unknown line from diff -u on %s: `%s'"), $new, $_); } print({ $self->{'handle'} } $_) || syserr(_g("failed to write")); } |