Merge pull request #2586 from jreidinger/perl_linter

Perl linter
This commit is contained in:
Josef Reidinger 2021-07-09 08:50:48 +02:00 committed by GitHub
commit 80bd9187ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 5 deletions

View File

@ -132,7 +132,7 @@ for my $test (glob("/usr/lib/obs/service/source_validators/*")) {
my $odir = getcwd(); my $odir = getcwd();
chdir($dir) || "chdir $dir failed"; chdir($dir) || die "chdir $dir failed";
for my $patch (glob("*.diff *.patch *.dif")) { for my $patch (glob("*.diff *.patch *.dif")) {
$patches{$patch} = 'current'; $patches{$patch} = 'current';
} }
@ -213,7 +213,7 @@ if (-d "$old") {
$diff = diff "$old/$changes", "$dir/$changes"; $diff = diff "$old/$changes", "$dir/$changes";
} }
for my $line (split(/\n/, $diff)) { for my $line (split(/\n/, $diff)) {
next unless $line =~ m/^+/; next unless $line =~ m/^\+/;
$line =~ s/^\+//; $line =~ s/^\+//;
for my $patch (keys %patches) { for my $patch (keys %patches) {
if (index($line, $patch) != -1) { if (index($line, $patch) != -1) {
@ -238,14 +238,14 @@ if (-d "$old") {
} }
} }
my $odir = getcwd; my $odir2 = getcwd;
my $tmpdir = tempdir("obs-XXXXXXX", TMPDIR => 1, CLEANUP => 1); my $tmpdir = tempdir("obs-XXXXXXX", TMPDIR => 1, CLEANUP => 1);
chdir($dir) || die 'tempdir failed'; chdir($dir) || die 'tempdir failed';
if (system("/usr/lib/obs/service/download_files","--enforceupstream", "yes", "--enforcelocal", "yes", "--outdir", $tmpdir)) { if (system("/usr/lib/obs/service/download_files","--enforceupstream", "yes", "--enforcelocal", "yes", "--outdir", $tmpdir)) {
print "Source URLs are not valid. Try \"osc service runall download_files\".\n"; print "Source URLs are not valid. Try \"osc service runall download_files\".\n";
$ret = 2; $ret = 2;
} }
chdir($odir); chdir($odir2);
for my $rpmlint (glob("$dir/*rpmlintrc")) { for my $rpmlint (glob("$dir/*rpmlintrc")) {
open(RPMLINTRC, $rpmlint); open(RPMLINTRC, $rpmlint);
@ -295,7 +295,7 @@ if (-f "$dir/_service.bak") {
my %files; my %files;
chdir($old); chdir($old);
prepare_package(\%files); prepare_package(\%files);
chdir($odir); chdir($odir2);
chdir($dir); chdir($dir);
prepare_package(\%files); prepare_package(\%files);
exit(0); exit(0);

View File

@ -4,3 +4,4 @@ set -ex
run_as_tester flake8 run_as_tester flake8
run_as_tester ./dist/ci/flake-extra run_as_tester ./dist/ci/flake-extra
run_as_tester ./dist/ci/perl-check.sh

4
dist/ci/perl-check.sh vendored Executable file
View File

@ -0,0 +1,4 @@
#! /usr/bin/sh
for i in `find . | grep 'p[lm]$'`; do
perl -I bs_copy -Wc $i || exit $?;
done