aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-05-02 12:00:35 +0200
committerGitHub <noreply@github.com>2017-05-02 12:00:35 +0200
commit1d4f8f6b6aaebf9fff6e6dd3a95cb046f536dfde (patch)
tree62f8519aa6e8281605f2fbd9846889724450fb50
parent1b0d573a6552726a8faf1e93bdb23e22b97f20ce (diff)
parent15d39022abc3eb3d086b33977b9dec9972aab8e1 (diff)
downloadrneovim-1d4f8f6b6aaebf9fff6e6dd3a95cb046f536dfde.tar.gz
rneovim-1d4f8f6b6aaebf9fff6e6dd3a95cb046f536dfde.tar.bz2
rneovim-1d4f8f6b6aaebf9fff6e6dd3a95cb046f536dfde.zip
Merge #6636 from ZyX-I/pvs-update
-rwxr-xr-xscripts/pvscheck.sh50
1 files changed, 37 insertions, 13 deletions
diff --git a/scripts/pvscheck.sh b/scripts/pvscheck.sh
index 32d63646aa..2af38d7711 100755
--- a/scripts/pvscheck.sh
+++ b/scripts/pvscheck.sh
@@ -10,10 +10,17 @@ get_jobs_num() {
help() {
echo 'Usage:'
- echo ' pvscheck.sh [target-directory [branch]]'
- echo ' pvscheck.sh [--recheck] [target-directory]'
+ echo ' pvscheck.sh [--pvs URL] [target-directory [branch]]'
+ echo ' pvscheck.sh [--pvs URL] [--recheck] [target-directory]'
echo ' pvscheck.sh --patch [--only-build]'
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 ' Does not patch already patched files.'
echo ' Does not run analysis.'
@@ -38,10 +45,12 @@ EOF
}
install_pvs() {
+ local pvs_url="$1"
+
mkdir 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
rm pvs-studio.tar.gz
local pvsdir="$(find . -maxdepth 1 -mindepth 1)"
@@ -108,14 +117,15 @@ run_analysis() {
}
do_check() {
- local tgt="${1}"
- local branch="${2}"
+ local tgt="$1"
+ local branch="$2"
+ local pvs_url="$3"
git clone --branch="$branch" . "$tgt"
cd "$tgt"
- install_pvs
+ install_pvs "$pvs_url"
create_compile_commands
@@ -132,19 +142,33 @@ do_recheck() {
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() {
- local PVS_URL="http://files.viva64.com/pvs-studio-6.14.21446.1-x86_64.tgz"
+ local pvs_url="http://files.viva64.com/pvs-studio-6.15.21741.1-x86_64.tgz"
- if test "x$1" = "x--help" ; then
+ if test "$1" = "--help" ; then
help
return
fi
set -x
- if test "x$1" = "x--patch" ; then
+ 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
shift
- if test "x$1" = "x--only-build" ; then
+ if test "$1" = "--only-build" ; then
shift
patch_sources --only-build
else
@@ -154,7 +178,7 @@ main() {
fi
local recheck=
- if test "x$1" = "x--recheck" ; then
+ if test "$1" = "--recheck" ; then
recheck=1
shift
fi
@@ -162,8 +186,8 @@ main() {
local tgt="${1:-$PWD/../neovim-pvs}"
local branch="${2:-master}"
- if test "x$recheck" = "x" ; then
- do_check "$tgt" "$branch"
+ if test -z "$recheck" ; then
+ do_check "$tgt" "$branch" "$pvs_url"
else
do_recheck "$tgt"
fi