diff --git a/devscripts-checkbashisms-early-fail.patch b/devscripts-checkbashisms-early-fail.patch new file mode 100644 index 0000000..f2aeab4 --- /dev/null +++ b/devscripts-checkbashisms-early-fail.patch @@ -0,0 +1,79 @@ +diff --git a/scripts/checkbashisms.1 b/scripts/checkbashisms.1 +index 6df5f3c7..1075408a 100644 +--- a/scripts/checkbashisms.1 ++++ b/scripts/checkbashisms.1 +@@ -44,6 +44,9 @@ which may be ignored. + For example, the use of "\fB$BASH_ENV\fR" may be preceded by checking + whether "\fB$BASH\fR" is set. + .TP ++.BR \-\-early-fail ", " \-e ++Exit right after a first error is seen. ++.TP + .BR \-\-version ", " \-v + Show version and copyright information. + .SH "EXIT VALUES" +diff --git a/scripts/checkbashisms.bash_completion b/scripts/checkbashisms.bash_completion +index 4ce5b521..b0e30fdf 100644 +--- a/scripts/checkbashisms.bash_completion ++++ b/scripts/checkbashisms.bash_completion +@@ -10,7 +10,7 @@ _checkbashisms() + _init_completion || return + + if [[ "$cur" == -* ]]; then +- COMPREPLY=( $( compgen -W '--newline --posix --force --extra' -- "$cur" ) ) ++ COMPREPLY=( $( compgen -W '--newline --posix --force --extra --early-fail' -- "$cur" ) ) + else + COMPREPLY=( $( compgen -o filenames -f -- "$cur" ) ) + fi +diff --git a/scripts/checkbashisms.pl b/scripts/checkbashisms.pl +index 653ec1bb..568e2c33 100755 +--- a/scripts/checkbashisms.pl ++++ b/scripts/checkbashisms.pl +@@ -30,7 +30,7 @@ sub init_hashes; + (my $progname = $0) =~ s|.*/||; + + my $usage = <<"EOF"; +-Usage: $progname [-n] [-f] [-x] script ... ++Usage: $progname [-n] [-f] [-x] [-e] script ... + or: $progname --help + or: $progname --version + This script performs basic checks for the presence of bashisms +@@ -47,7 +47,7 @@ You are free to redistribute this code under the terms of the + GNU General Public License, version 2, or (at your option) any later version. + EOF + +-my ($opt_echo, $opt_force, $opt_extra, $opt_posix); ++my ($opt_echo, $opt_force, $opt_extra, $opt_posix, $opt_early_fail); + my ($opt_help, $opt_version); + my @filenames; + +@@ -62,12 +62,13 @@ if (scalar(@ARGV) == 0 && (-p STDIN or -f STDIN)) { + $opt_help = 1 if int(@ARGV) == 0; + + GetOptions( +- "help|h" => \$opt_help, +- "version|v" => \$opt_version, +- "newline|n" => \$opt_echo, +- "force|f" => \$opt_force, +- "extra|x" => \$opt_extra, +- "posix|p" => \$opt_posix, ++ "help|h" => \$opt_help, ++ "version|v" => \$opt_version, ++ "newline|n" => \$opt_echo, ++ "force|f" => \$opt_force, ++ "extra|x" => \$opt_extra, ++ "posix|p" => \$opt_posix, ++ "early-fail|e" => \$opt_early_fail, + ) + or die + "Usage: $progname [options] filelist\nRun $progname --help for more details\n"; +@@ -543,6 +544,9 @@ sub output_explanation { + $issues = 1; + } else { + warn "possible bashism in $filename line $. ($explanation):\n$line\n"; ++ if ($opt_early_fail) { ++ exit 1; ++ } + $status |= 1; + } + } diff --git a/devscripts.changes b/devscripts.changes index 5a8f82e..dafec7f 100644 --- a/devscripts.changes +++ b/devscripts.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Nov 23 17:53:12 UTC 2020 - Martin Liška + +- Add backport from master devscripts-checkbashisms-early-fail.patch. + ------------------------------------------------------------------- Tue Sep 3 14:07:37 UTC 2019 - Tomáš Chvátal diff --git a/devscripts.spec b/devscripts.spec index a4eb521..3a12d69 100644 --- a/devscripts.spec +++ b/devscripts.spec @@ -1,7 +1,7 @@ # # spec file for package devscripts # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -31,6 +31,7 @@ Patch0: devscripts-fix-build.patch Patch1: devscripts-fix-python-install-layout.patch # PATCH-FEATURE-OPENSUSE devscripts-debcommit-hg16.patch -- Mercurial cannot commit empty, fix it. Patch2: devscripts-debcommit-hg16.patch +Patch3: devscripts-checkbashisms-early-fail.patch BuildRequires: bash-completion-devel BuildRequires: docbook-xsl-stylesheets BuildRequires: dpkg-devel >= 1.18.19 @@ -89,6 +90,7 @@ bashisms are detected. %patch0 -p1 %patch1 -p1 %patch2 -p1 +%patch3 -p1 %build make %{?_smp_mflags} V=1 \