[devscripts] 01/02: debuild: Run lintian (and hook) directly
James McCoy
jamessan at debian.org
Fri Dec 9 12:03:27 UTC 2016
This is an automated email from the git hooks/post-receive script.
jamessan pushed a commit to branch master
in repository devscripts.
commit 602d25c02c4bc4ace2bfd646bec1dbb55e07f616
Author: James McCoy <jamessan at debian.org>
Date: Thu Dec 8 23:12:04 2016 -0500
debuild: Run lintian (and hook) directly
When the running of lintian was moved to dpkg-buildpackage, that removed
the ability to ignore the return code. While it's generally better to
avoid lintian having a non-zero return code, this was an unplanned
regression and breaks valid use cases.
Similarly, the check for the existence of lintian was restored, so
debuild doesn't fail if lintian doesn't exist.
Signed-off-by: James McCoy <jamessan at debian.org>
---
debian/changelog | 4 ++++
scripts/debuild.pl | 27 ++++++++++++++++++++-------
2 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index f84e221..f2b2cb4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,10 @@ devscripts (2.16.12) UNRELEASED; urgency=medium
* mergechanges:
+ Add handling for buildinfo files, based on a patch by Simon McVittie.
(Closes #843470)
+ * debuild:
+ + Move invocation of lintian back into debuild. This restores the
+ behavior of ignoring the return code of lintian (Closes: #847168) and
+ only running lintian when it is present (Closes: 846711).
-- James McCoy <jamessan at debian.org> Mon, 05 Dec 2016 22:58:29 -0500
diff --git a/scripts/debuild.pl b/scripts/debuild.pl
index 639bbac..9976b21 100755
--- a/scripts/debuild.pl
+++ b/scripts/debuild.pl
@@ -176,6 +176,7 @@ my $preserve_env=0;
my %save_vars;
my $root_command='';
my $run_lintian=1;
+my $lintian_exists=0;
my @dpkg_extra_opts=();
my @lintian_extra_opts=();
my @lintian_opts=();
@@ -200,6 +201,7 @@ $externalHook{'post-dpkg-buildpackage'} = 1;
# Track which hooks are run by dpkg-buildpackage vs. debuild
my %dpkgHook;
@dpkgHook{@hooks} = (1) x @hooks;
+$dpkgHook{lintian} = 0;
$dpkgHook{signing} = 0;
$dpkgHook{'post-dpkg-buildpackage'} = 0;
@@ -591,13 +593,16 @@ my @preserve_vars = qw(TERM HOME LOGNAME PGPPATH GNUPGHOME GPG_AGENT_INFO
next;
}
- if ($arg =~ /^--hook-(sign|done)=(.*)$/) {
+ if ($arg =~ /^--hook-(check|sign|done)=(.*)$/) {
my $name = $1;
my $opt = $2;
unless (defined($opt)) {
fatal "$arg requires an argmuent,\nrun $progname --help for usage information";
}
- if ($name eq 'sign') {
+ if ($name eq 'check') {
+ setDpkgHook('lintian', $opt);
+ }
+ elsif ($name eq 'sign') {
setDpkgHook('signing', $opt);
}
else {
@@ -743,7 +748,6 @@ my %debuild2dpkg = (
'binary' => 'binary',
'dpkg-genchanges' => 'changes',
'final-clean' => 'postclean',
- 'lintian' => 'check',
);
for my $h_name (@hooks) {
@@ -977,6 +981,9 @@ if (@ARGV) {
}
}
else {
+ if ($run_lintian && system('command -v lintian >/dev/null 2>&1') == 0) {
+ $lintian_exists = 1;
+ }
# We'll need to be a bit cleverer to determine the changes file name;
# see below
$build="${pkg}_${sversion}_${arch}.build";
@@ -988,10 +995,6 @@ else {
open STDOUT, ">&BUILD" or fatal "can't reopen stdout: $!";
open STDERR, ">&BUILD" or fatal "can't reopen stderr: $!";
- if ($run_lintian) {
- push(@dpkg_opts, '--check-command=lintian',
- map { "--check-option=$_" } @lintian_opts);
- }
system_withecho('dpkg-buildpackage', @dpkg_opts);
chdir '..' or fatal "can't chdir: $!";
@@ -1010,6 +1013,16 @@ else {
unless $ch =~ /Changes:.*(remaining|Ubuntu)(.|\n )*(differen|changes)/is;
}
+ run_hook('lintian', $run_lintian && $lintian_exists);
+
+ if ($run_lintian && $lintian_exists) {
+ $<=$>=$uid; # Give up on root privileges if we can
+ $(=$)=$gid;
+ print "Now running lintian...\n";
+ system('lintian', @lintian_extra_opts, @lintian_opts, $changes);
+ print "Finished running lintian.\n";
+ }
+
# They've insisted. Who knows why?!
if (($signchanges or $signsource) and $usepause) {
print "Press the return key to start signing process\n";
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git
More information about the devscripts-devel
mailing list