Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/pkg
Path: blob/main/external/curl/scripts/perlcheck.sh
2645 views
1
#!/bin/sh
2
#***************************************************************************
3
# _ _ ____ _
4
# Project ___| | | | _ \| |
5
# / __| | | | |_) | |
6
# | (__| |_| | _ <| |___
7
# \___|\___/|_| \_\_____|
8
#
9
# Copyright (C) Dan Fandrich, <[email protected]>, Viktor Szakats, et al.
10
#
11
# This software is licensed as described in the file COPYING, which
12
# you should have received as part of this distribution. The terms
13
# are also available at https://curl.se/docs/copyright.html.
14
#
15
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
16
# copies of the Software, and permit persons to whom the Software is
17
# furnished to do so, under the terms of the COPYING file.
18
#
19
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20
# KIND, either express or implied.
21
#
22
# SPDX-License-Identifier: curl
23
#
24
###########################################################################
25
26
# The xargs invocation is portable, but does not preserve spaces in file names.
27
# If such a file is ever added, then this can be portably fixed by switching to
28
# "xargs -I{}" and appending {} to the end of the xargs arguments (which will
29
# call cmakelint once per file) or by using the GNU extension "xargs -d'\n'".
30
31
set -eu
32
33
cd "$(dirname "$0")"/..
34
35
procs=6
36
command -v nproc >/dev/null && procs="$(nproc)"
37
echo "parallel: ${procs}"
38
39
{
40
if [ -n "${1:-}" ]; then
41
for A in "$@"; do printf "%s\n" "$A"; done
42
elif git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
43
{
44
git ls-files | grep -E '\.(pl|pm)$'
45
git grep -l -E '^#!/usr/bin/env perl'
46
} | sort -u
47
else
48
# strip off the leading ./ to make the grep regexes work properly
49
find . -type f \( -name '*.pl' -o -name '*.pm' \) | sed 's@^\./@@'
50
fi
51
} | xargs -n 1 -P "${procs}" perl -c -Itests --
52
53