mirror of
https://github.com/curl/curl.git
synced 2026-06-05 09:44:16 +03:00
checksrc-all: rewrite in Perl
This commit is contained in:
parent
1df2174ae2
commit
70bbd7b598
5 changed files with 41 additions and 26 deletions
2
.github/workflows/checksrc.yml
vendored
2
.github/workflows/checksrc.yml
vendored
|
|
@ -43,7 +43,7 @@ jobs:
|
|||
persist-credentials: false
|
||||
|
||||
- name: 'check'
|
||||
run: scripts/checksrc-all.sh
|
||||
run: scripts/checksrc-all.pl
|
||||
|
||||
codespell-cmakelint-pytype-ruff:
|
||||
name: 'codespell, cmakelint, pytype, ruff'
|
||||
|
|
|
|||
2
.github/workflows/distcheck.yml
vendored
2
.github/workflows/distcheck.yml
vendored
|
|
@ -113,7 +113,7 @@ jobs:
|
|||
make test-ci
|
||||
make install
|
||||
popd
|
||||
scripts/checksrc-all.sh
|
||||
scripts/checksrc-all.pl
|
||||
|
||||
verify-out-of-tree-cmake:
|
||||
name: 'CM out-of-tree'
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
#
|
||||
###########################################################################
|
||||
|
||||
EXTRA_DIST = coverage.sh completion.pl firefox-db2pem.sh checksrc.pl checksrc-all.sh \
|
||||
EXTRA_DIST = coverage.sh completion.pl firefox-db2pem.sh checksrc.pl checksrc-all.pl \
|
||||
mk-ca-bundle.pl mk-unity.pl schemetable.c cd2nroff nroff2cd cdall cd2cd managen \
|
||||
dmaketgz maketgz release-tools.sh verify-release cmakelint.sh mdlinkcheck \
|
||||
CMakeLists.txt pythonlint.sh randdisable wcurl top-complexity extract-unit-protos
|
||||
|
|
|
|||
38
scripts/checksrc-all.pl
Executable file
38
scripts/checksrc-all.pl
Executable file
|
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env perl
|
||||
# Copyright (C) Viktor Szakats
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use File::Basename;
|
||||
use File::Find;
|
||||
use Cwd 'abs_path';
|
||||
|
||||
my @files;
|
||||
if(system('git rev-parse --is-inside-work-tree >/dev/null 2>&1') == 0) {
|
||||
@files = `git ls-files '*.[ch]'`;
|
||||
}
|
||||
else {
|
||||
find(sub { if(/\.[ch]/) { push(@files, $File::Find::name) } }, ('.'));
|
||||
}
|
||||
if(@ARGV) {
|
||||
find(sub { if(/\.[ch]/) { push(@files, $File::Find::name) } }, @ARGV);
|
||||
}
|
||||
|
||||
@files = grep !/\/CMakeFiles\//, @files;
|
||||
@files = map { dirname($_) } @files;
|
||||
my @dirs = sort { $a cmp $b } keys %{{ map { $_ => 1 } @files }};
|
||||
|
||||
my $scripts_dir = dirname(abs_path($0));
|
||||
my $anyfailed = 0;
|
||||
|
||||
for my $dir (@dirs) {
|
||||
@files = glob("$dir/*.[ch]");
|
||||
if(@files && system("$scripts_dir/checksrc.pl", @files) != 0) {
|
||||
$anyfailed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
exit $anyfailed;
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
#!/bin/sh
|
||||
# Copyright (C) Viktor Szakats
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
|
||||
set -eu
|
||||
|
||||
anyfailed=0
|
||||
|
||||
for dir in $({
|
||||
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
||||
git ls-files '*.[ch]'
|
||||
else
|
||||
find . -name '*.[ch]'
|
||||
fi
|
||||
[ -n "${1:-}" ] && find "$@" -name '*.[ch]'
|
||||
} | grep -v -F '/CMakeFiles/' | sed -E 's|/[^/]+$||' | sort -u); do
|
||||
if ! ./scripts/checksrc.pl "${dir}"/*.[ch]; then
|
||||
anyfailed=1
|
||||
fi
|
||||
done
|
||||
|
||||
exit "${anyfailed}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue