mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
pvscheck: Add --pvs key to pvscheck.sh
[ci skip]
This commit is contained in:
parent
7fc3cccfaa
commit
15d39022ab
@ -10,10 +10,17 @@ get_jobs_num() {
|
|||||||
|
|
||||||
help() {
|
help() {
|
||||||
echo 'Usage:'
|
echo 'Usage:'
|
||||||
echo ' pvscheck.sh [target-directory [branch]]'
|
echo ' pvscheck.sh [--pvs URL] [target-directory [branch]]'
|
||||||
echo ' pvscheck.sh [--recheck] [target-directory]'
|
echo ' pvscheck.sh [--pvs URL] [--recheck] [target-directory]'
|
||||||
echo ' pvscheck.sh --patch [--only-build]'
|
echo ' pvscheck.sh --patch [--only-build]'
|
||||||
echo
|
echo
|
||||||
|
echo ' --pvs: Use the specified URL as a path to pvs-studio archive.'
|
||||||
|
echo ' By default latest tested version is used.'
|
||||||
|
echo
|
||||||
|
echo ' May use `--pvs detect` to try detecting latest version.'
|
||||||
|
echo ' That assumes certain viva64.com site properties and'
|
||||||
|
echo ' may be broken by the site update.'
|
||||||
|
echo
|
||||||
echo ' --patch: patch sources in the current directory.'
|
echo ' --patch: patch sources in the current directory.'
|
||||||
echo ' Does not patch already patched files.'
|
echo ' Does not patch already patched files.'
|
||||||
echo ' Does not run analysis.'
|
echo ' Does not run analysis.'
|
||||||
@ -38,10 +45,12 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
install_pvs() {
|
install_pvs() {
|
||||||
|
local pvs_url="$1"
|
||||||
|
|
||||||
mkdir pvs-studio
|
mkdir pvs-studio
|
||||||
cd pvs-studio
|
cd pvs-studio
|
||||||
|
|
||||||
curl -o pvs-studio.tar.gz "$PVS_URL"
|
curl -L -o pvs-studio.tar.gz "$pvs_url"
|
||||||
tar xzf pvs-studio.tar.gz
|
tar xzf pvs-studio.tar.gz
|
||||||
rm pvs-studio.tar.gz
|
rm pvs-studio.tar.gz
|
||||||
local pvsdir="$(find . -maxdepth 1 -mindepth 1)"
|
local pvsdir="$(find . -maxdepth 1 -mindepth 1)"
|
||||||
@ -108,14 +117,15 @@ run_analysis() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
do_check() {
|
do_check() {
|
||||||
local tgt="${1}"
|
local tgt="$1"
|
||||||
local branch="${2}"
|
local branch="$2"
|
||||||
|
local pvs_url="$3"
|
||||||
|
|
||||||
git clone --branch="$branch" . "$tgt"
|
git clone --branch="$branch" . "$tgt"
|
||||||
|
|
||||||
cd "$tgt"
|
cd "$tgt"
|
||||||
|
|
||||||
install_pvs
|
install_pvs "$pvs_url"
|
||||||
|
|
||||||
create_compile_commands
|
create_compile_commands
|
||||||
|
|
||||||
@ -132,8 +142,13 @@ do_recheck() {
|
|||||||
run_analysis
|
run_analysis
|
||||||
}
|
}
|
||||||
|
|
||||||
|
detect_url() {
|
||||||
|
curl -L 'https://www.viva64.com/en/pvs-studio-download-linux/' \
|
||||||
|
| grep -o 'https\{0,1\}://[^"<>]\{1,\}/pvs-studio[^/"<>]*\.tgz'
|
||||||
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
local PVS_URL="http://files.viva64.com/pvs-studio-6.15.21741.1-x86_64.tgz"
|
local pvs_url="http://files.viva64.com/pvs-studio-6.15.21741.1-x86_64.tgz"
|
||||||
|
|
||||||
if test "$1" = "--help" ; then
|
if test "$1" = "--help" ; then
|
||||||
help
|
help
|
||||||
@ -142,6 +157,15 @@ main() {
|
|||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
|
if test "$1" = "--pvs" ; then
|
||||||
|
shift
|
||||||
|
pvs_url="$1" ; shift
|
||||||
|
|
||||||
|
if test "$pvs_url" = "detect" ; then
|
||||||
|
pvs_url="$(detect_url)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if test "$1" = "--patch" ; then
|
if test "$1" = "--patch" ; then
|
||||||
shift
|
shift
|
||||||
if test "$1" = "--only-build" ; then
|
if test "$1" = "--only-build" ; then
|
||||||
@ -163,7 +187,7 @@ main() {
|
|||||||
local branch="${2:-master}"
|
local branch="${2:-master}"
|
||||||
|
|
||||||
if test -z "$recheck" ; then
|
if test -z "$recheck" ; then
|
||||||
do_check "$tgt" "$branch"
|
do_check "$tgt" "$branch" "$pvs_url"
|
||||||
else
|
else
|
||||||
do_recheck "$tgt"
|
do_recheck "$tgt"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user