[debhelper-devel] Bug#785811: debhelper: Please add doit*_noerror methods in Buildsystem.pm
Emmanuel Bourg
ebourg at apache.org
Wed May 20 13:13:59 UTC 2015
Package: debhelper
Version: 9.20150507
Severity: wishlist
Tags: patch
Dear Maintainer,
Dh_Lib.pm provides a doit_noerror method but Buildsystem.pm doesn't define
similar methods for doit_in_sourcedir and doit_in_builddir. I'm attaching
a patch implementing these methods.
I plan to use doit_in_builddir_noerror in maven-debian-helper [1] where
errors often occur when invoking 'mvn clean', thus preventing the completion
of the clean target.
Thank you,
Emmanuel Bourg
[1] https://sources.debian.net/src/maven-debian-helper/1.6.11/share/perl/maven.pm/#L115
---
>From 2acd9c295fa4291da041c05d890025d5a079371b Mon Sep 17 00:00:00 2001
From: Emmanuel Bourg <ebourg at apache.org>
Date: Wed, 20 May 2015 14:35:08 +0200
Subject: [PATCH] Add doit_in_sourcedir_noerror and doit_in_builddir_noerror in
Buildsystem.pm
---
Debian/Debhelper/Buildsystem.pm | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/Debian/Debhelper/Buildsystem.pm b/Debian/Debhelper/Buildsystem.pm
index 3043c79..7f5819f 100644
--- a/Debian/Debhelper/Buildsystem.pm
+++ b/Debian/Debhelper/Buildsystem.pm
@@ -310,6 +310,23 @@ sub doit_in_sourcedir {
return 1;
}
+# Changes working directory to the source directory (if needed),
+# calls print_and_doit(@_) and changes working directory back to the
+# top directory. Errors are ignored.
+sub doit_in_sourcedir_noerror {
+ my $this=shift;
+ if ($this->get_sourcedir() ne '.') {
+ my $sourcedir = $this->get_sourcedir();
+ $this->_cd($sourcedir);
+ print_and_doit_noerror(@_);
+ $this->_cd($this->_rel2rel($this->{cwd}, $sourcedir));
+ }
+ else {
+ print_and_doit_noerror(@_);
+ }
+ return 1;
+}
+
# Changes working directory to the build directory (if needed),
# calls print_and_doit(@_) and changes working directory back to the
# top directory.
@@ -327,6 +344,23 @@ sub doit_in_builddir {
return 1;
}
+# Changes working directory to the build directory (if needed),
+# calls print_and_doit(@_) and changes working directory back to the
+# top directory. Errors are ignored.
+sub doit_in_builddir_noerror {
+ my $this=shift;
+ if ($this->get_buildpath() ne '.') {
+ my $buildpath = $this->get_buildpath();
+ $this->_cd($buildpath);
+ print_and_doit_noerror(@_);
+ $this->_cd($this->_rel2rel($this->{cwd}, $buildpath));
+ }
+ else {
+ print_and_doit_noerror(@_);
+ }
+ return 1;
+}
+
# In case of out of source tree building, whole build directory
# gets wiped (if it exists) and 1 is returned. If build directory
# had 2 or more levels, empty parent directories are also deleted.
--
2.1.4
More information about the debhelper-devel
mailing list