--- /dev/null
+package Dpkg::Exit;
+
+use strict;
+use warnings;
+
+our @handlers = ();
+sub exit_handler {
+ &$_() foreach (reverse @handlers);
+ exit(127);
+}
+
+$SIG{'INT'} = \&exit_handler;
+$SIG{'HUP'} = \&exit_handler;
+$SIG{'QUIT'} = \&exit_handler;
+
+# vim: set et sw=4 ts=8
+1;
--- /dev/null
+package Dpkg::Source::Functions;
+
+use strict;
+use warnings;
+
+use Exporter;
+our @ISA = qw(Exporter);
+our @EXPORT_OK = qw(erasedir);
+
+use Dpkg::ErrorHandling qw(syserr subprocerr failure);
+use Dpkg::Gettext;
+
+use POSIX;
+
+sub erasedir {
+ my ($dir) = @_;
+ if (not lstat($dir)) {
+ return if $! == ENOENT;
+ syserr(_g("cannot stat directory %s (before removal)"), $dir);
+ }
+ system 'rm','-rf','--',$dir;
+ subprocerr("rm -rf $dir") if $?;
+ if (not stat($dir)) {
+ return if $! == ENOENT;
+ syserr(_g("unable to check for removal of dir `%s'"), $dir);
+ }
+ failure(_g("rm -rf failed to remove `%s'"), $dir);
+}
+
+# vim: set et sw=4 ts=8
+1;
Dpkg/Control.pm \
Dpkg/Deps.pm \
Dpkg/ErrorHandling.pm \
+ Dpkg/Exit.pm \
Dpkg/Fields.pm \
Dpkg/Gettext.pm \
Dpkg/IPC.pm \
Dpkg/Source/Archive.pm \
Dpkg/Source/CompressedFile.pm \
Dpkg/Source/Compressor.pm \
+ Dpkg/Source/Functions.pm \
Dpkg/Source/Patch.pm \
Dpkg/Source/VCS/git.pm \
Dpkg.pm
scripts/Dpkg/Source/Archive.pm
scripts/Dpkg/Source/CompressedFile.pm
scripts/Dpkg/Source/Compressor.pm
+scripts/Dpkg/Source/Functions.pm
scripts/Dpkg/Source/Patch.pm
scripts/Dpkg/Source/VCS/git.pm
scripts/Dpkg/Substvars.pm