From 25eced62b651fceee04706af787bccd328d36496 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 29 Jun 2017 15:16:06 -0400 Subject: Update emoji-data URL for Unicode 10 vim-patch:8.0.0652 --- scripts/download-unicode-files.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/download-unicode-files.sh b/scripts/download-unicode-files.sh index 54fc32550c..5e9efebb43 100755 --- a/scripts/download-unicode-files.sh +++ b/scripts/download-unicode-files.sh @@ -30,7 +30,7 @@ for filename in $data_files ; do done for filename in $emoji_files ; do - curl -o "$UNIDIR/$filename" "$DOWNLOAD_URL_BASE/emoji/3.0/$filename" + curl -o "$UNIDIR/$filename" "$DOWNLOAD_URL_BASE/emoji/latest/$filename" ( cd "$UNIDIR" git add $filename -- cgit From 03fc0e3f4110740b95849cfc98d7714dedd1a9dd Mon Sep 17 00:00:00 2001 From: James McCoy Date: Thu, 29 Jun 2017 17:44:47 -0400 Subject: scripts: Tell curl to follow redirects --- scripts/download-unicode-files.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/download-unicode-files.sh b/scripts/download-unicode-files.sh index 5e9efebb43..5f38d0589a 100755 --- a/scripts/download-unicode-files.sh +++ b/scripts/download-unicode-files.sh @@ -22,7 +22,7 @@ UNIDIR=${1:-$UNIDIR_DEFAULT} DOWNLOAD_URL_BASE=${2:-$DOWNLOAD_URL_BASE_DEFAULT} for filename in $data_files ; do - curl -o "$UNIDIR/$filename" "$DOWNLOAD_URL_BASE/UNIDATA/$filename" + curl -L -o "$UNIDIR/$filename" "$DOWNLOAD_URL_BASE/UNIDATA/$filename" ( cd "$UNIDIR" git add $filename @@ -30,7 +30,7 @@ for filename in $data_files ; do done for filename in $emoji_files ; do - curl -o "$UNIDIR/$filename" "$DOWNLOAD_URL_BASE/emoji/latest/$filename" + curl -L -o "$UNIDIR/$filename" "$DOWNLOAD_URL_BASE/emoji/latest/$filename" ( cd "$UNIDIR" git add $filename -- cgit From aa3e3b4ca641cd87b1c051f740f16bd11f57197d Mon Sep 17 00:00:00 2001 From: ZyX Date: Tue, 4 Jul 2017 19:22:48 +0300 Subject: pvscheck: Add --environment-cc switch To be used to make bot-ci able to use clang-4.0 without hacks. [ci skip] --- scripts/pvscheck.sh | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'scripts') diff --git a/scripts/pvscheck.sh b/scripts/pvscheck.sh index dfdc539bf9..e4536b3dce 100755 --- a/scripts/pvscheck.sh +++ b/scripts/pvscheck.sh @@ -19,8 +19,11 @@ get_jobs_num() { help() { echo 'Usage:' - echo ' pvscheck.sh [--pvs URL] [--deps] [target-directory [branch]]' - echo ' pvscheck.sh [--pvs URL] [--recheck|--only-analyse] [target-directory]' + echo ' pvscheck.sh [--pvs URL] [--deps] [--environment-cc]' + echo ' [target-directory [branch]]' + echo ' pvscheck.sh [--pvs URL] [--recheck] [--environment-cc]' + echo ' [target-directory]' + echo ' pvscheck.sh [--pvs URL] --only-analyse [target-directory]' echo ' pvscheck.sh [--pvs URL] --pvs-install {target-directory}' echo ' pvscheck.sh --patch [--only-build]' echo @@ -35,6 +38,9 @@ help() { echo ' Without this it assumes all dependencies are already' echo ' installed.' echo + echo ' --environment-cc: (for regular run and --recheck) Do not export' + echo ' CC=clang. Build is still run with CFLAGS=-O0.' + echo echo ' --only-build: (for --patch) Only patch files in ./build directory.' echo echo ' --pvs-install: Only install PVS-studio to the specified location.' @@ -270,8 +276,11 @@ install_pvs() {( create_compile_commands() {( local tgt="$1" ; shift local deps="$1" ; shift + local environment_cc="$1" ; shift - export CC=clang + if test -z "$environment_cc" ; then + export CC=clang + fi export CFLAGS=' -O0 ' if test -z "$deps" ; then @@ -356,19 +365,21 @@ do_check() { local branch="$1" ; shift local pvs_url="$1" ; shift local deps="$1" ; shift + local environment_cc="$1" ; shift git clone --branch="$branch" . "$tgt" install_pvs "$tgt" "$pvs_url" - do_recheck "$tgt" "$deps" + do_recheck "$tgt" "$deps" "$environment_cc" } do_recheck() { local tgt="$1" ; shift local deps="$1" ; shift + local environment_cc="$1" ; shift - create_compile_commands "$tgt" "$deps" + create_compile_commands "$tgt" "$deps" "$environment_cc" do_analysis "$tgt" } @@ -408,6 +419,7 @@ main() { only-analyse store_const \ pvs-install store_const \ deps store_const \ + environment-cc store_const \ -- \ 'modify realdir tgt "$PWD/../neovim-pvs"' \ 'store branch master' \ @@ -426,11 +438,11 @@ main() { elif test -n "$pvs_install" ; then install_pvs "$tgt" "$pvs_url" elif test -n "$recheck" ; then - do_recheck "$tgt" "$deps" + do_recheck "$tgt" "$deps" "$environment_cc" elif test -n "$only_analyse" ; then do_analysis "$tgt" else - do_check "$tgt" "$branch" "$pvs_url" "$deps" + do_check "$tgt" "$branch" "$pvs_url" "$deps" "$environment_cc" fi } -- cgit From 06ec15121a4da439684cfa1909d920c3f22f2894 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sat, 8 Apr 2017 22:50:50 -0400 Subject: Bump Vim version to 8.0 and applied patches --- scripts/vim-patch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 63665b9253..2f9edad986 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -310,7 +310,7 @@ list_vim_patches() { # Get missing Vim commits local vim_commits - vim_commits="$(cd "${VIM_SOURCE_DIR}" && git log --reverse --format='%H' v7.4.1979..HEAD)" + vim_commits="$(cd "${VIM_SOURCE_DIR}" && git log --reverse --format='%H' v8.0.0000..HEAD)" local vim_commit for vim_commit in ${vim_commits}; do -- cgit From e3a2b7220f642aa34c38e6679051caba1cfe3c29 Mon Sep 17 00:00:00 2001 From: lonerover Date: Sat, 15 Jul 2017 20:34:24 +0800 Subject: vim-patch.sh: only show missing patches --- scripts/vim-patch.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 2f9edad986..37c472ce5b 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -320,6 +320,7 @@ list_vim_patches() { vim_tag="$(cd "${VIM_SOURCE_DIR}" && git describe --tags --exact-match "${vim_commit}" 2>/dev/null)" || true if [[ -n "${vim_tag}" ]]; then local patch_number="${vim_tag:5}" # Remove prefix like "v7.4." + patch_number="$(echo ${patch_number} | sed 's/^0*//g')" # Remove prefix "0" # Tagged Vim patch, check version.c: is_missing="$(sed -n '/static const int included_patches/,/}/p' "${NVIM_SOURCE_DIR}/src/nvim/version.c" | grep -x -e "[[:space:]]*//[[:space:]]${patch_number} NA.*" -e "[[:space:]]*${patch_number}," >/dev/null && echo "false" || echo "true")" -- cgit From 8aa0dfd684266f8b3ab87018d6b59ff66e3ad1cf Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Wed, 15 Mar 2017 00:12:21 +0100 Subject: doc: "terminal" always means "embedded terminal emulator" - Prefer "TUI" where possible to refer to the host terminal. - Remove obsolete tags and ancient TTY exposition. - Establish "terminal" to consistently mean "terminal emulator" in all Nvim documentation. This removes the need for verbose qualifiers in tags and prose. References #6280 References #6803 --- scripts/vim-patch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 37c472ce5b..5ebb6a38b3 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -135,7 +135,7 @@ preprocess_patch() { local na_src='proto\|Make*\|gui_*\|if_lua\|if_mzsch\|if_olepp\|if_ole\|if_perl\|if_py\|if_ruby\|if_tcl\|if_xcmdsrv' 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/\S*\<\%('${na_src}'\)@norm! d/\v(^diff)|%$ ' +w +q "$file" - # Remove channel.txt, netbeans.txt, os_*.txt, todo.txt, version*.txt, tags + # Remove channel.txt, netbeans.txt, os_*.txt, term.txt, todo.txt, version*.txt, tags local na_doc='channel\.txt\|netbeans\.txt\|os_\w\+\.txt\|term\.txt\|todo\.txt\|version\d\.txt\|tags' 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/runtime/doc/\<\%('${na_doc}'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file" -- cgit From e6d4b7686ca31d44de854bdfd417da083fea5fc4 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Wed, 27 Sep 2017 08:20:43 -0400 Subject: vim-patch.sh: Exclude testdir/ files from src/ file pruning Without the testdir/ exclusion, all directories under src/ were affected by this cleanup. However, testdir/ has its own pruning that happens later. --- scripts/vim-patch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 5ebb6a38b3..4f6bb40488 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -133,7 +133,7 @@ preprocess_patch() { # Remove *.proto, Make*, gui_*, some if_* local na_src='proto\|Make*\|gui_*\|if_lua\|if_mzsch\|if_olepp\|if_ole\|if_perl\|if_py\|if_ruby\|if_tcl\|if_xcmdsrv' - 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/\S*\<\%('${na_src}'\)@norm! d/\v(^diff)|%$ ' +w +q "$file" + 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/\S*\<\%(testdir/\)\@ Date: Mon, 6 Nov 2017 03:59:34 +0100 Subject: gen_api_vimdoc.py: support Doxygen @note --- scripts/gen_api_vimdoc.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/gen_api_vimdoc.py b/scripts/gen_api_vimdoc.py index 4dcb42d685..9128483f5f 100644 --- a/scripts/gen_api_vimdoc.py +++ b/scripts/gen_api_vimdoc.py @@ -217,7 +217,12 @@ def parse_para(parent, width=62): width=width) + '\n') elif child.nodeName == 'simplesect': kind = child.getAttribute('kind') - if kind == 'return': + if kind == 'note': + lines.append('Note:') + lines.append(doc_wrap(parse_para(child), + prefix=' ', + width=width)) + elif kind == 'return': lines.append('%s:~' % kind.title()) lines.append(doc_wrap(parse_para(child), prefix=' ', -- cgit From 7e59b897c150e4d43af223aa47da115ee8beb653 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 6 Nov 2017 04:15:43 +0100 Subject: gen_api_vimdoc.py: workaround: attributes of (void) functions --- scripts/gen_api_vimdoc.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/gen_api_vimdoc.py b/scripts/gen_api_vimdoc.py index 9128483f5f..8bc32d938f 100644 --- a/scripts/gen_api_vimdoc.py +++ b/scripts/gen_api_vimdoc.py @@ -38,6 +38,10 @@ import subprocess from xml.dom import minidom +if sys.version_info[0] < 3: + print("use Python 3") + sys.exit(1) + doc_filename = 'api.txt' # String used to find the start of the generated part of the doc. section_start_token = '*api-global*' @@ -285,14 +289,19 @@ def parse_source_xml(filename): parts = return_type.strip('_').split('_') return_type = '%s(%s)' % (parts[0], ', '.join(parts[1:])) + name = get_text(get_child(member, 'name')) + annotations = get_text(get_child(member, 'argsstring')) if annotations and ')' in annotations: annotations = annotations.rsplit(')', 1)[-1].strip() + # XXX: (doxygen 1.8.11) 'argsstring' only includes FUNC_ATTR_* + # attributes if the function signature is non-void. + # Force attributes here for such functions. + if name == 'nvim_get_mode' and len(annotations) == 0: + annotations += 'FUNC_API_ASYNC' annotations = filter(None, map(lambda x: annotation_map.get(x), annotations.split())) - name = get_text(get_child(member, 'name')) - vimtag = '*%s()*' % name args = [] type_length = 0 -- cgit From 280943d9b938e95fcf77ef5290576630b84511fb Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 6 Nov 2017 02:00:39 +0100 Subject: doc: API (generated) --- scripts/gen_api_vimdoc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/gen_api_vimdoc.py b/scripts/gen_api_vimdoc.py index 8bc32d938f..51e585a007 100644 --- a/scripts/gen_api_vimdoc.py +++ b/scripts/gen_api_vimdoc.py @@ -73,7 +73,7 @@ text_width = 78 script_path = os.path.abspath(__file__) base_dir = os.path.dirname(os.path.dirname(script_path)) src_dir = os.path.join(base_dir, 'src/nvim/api') -out_dir = os.path.join(base_dir, 'tmp/api_doc') +out_dir = os.path.join(base_dir, 'tmp-api-doc') filter_cmd = '%s %s' % (sys.executable, script_path) seen_funcs = set() -- cgit From dc9290109481e5e0d0c224fecb217ceb5a4c978d Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 7 Nov 2017 00:29:19 +0100 Subject: vim-patch.sh: new option `-P` --- scripts/vim-patch.sh | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 4f6bb40488..fd1d2a200b 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -22,9 +22,10 @@ usage() { echo "Options:" echo " -h Show this message and exit." echo " -l Show list of Vim patches missing from Neovim." - echo " -p {vim-revision} Download and apply the Vim patch vim-revision." - echo " vim-revision can be a version number of the " - echo " format '7.4.xxx' or a Git commit hash." + echo " -p {vim-revision} Download and generate the specified Vim patch." + echo " vim-revision can be a version number '8.0.xxx'" + echo " or a valid Git ref (hash, tag, etc.)." + echo " -P {vim-revision} Download, generate and apply the Vim patch." echo " -g {vim-revision} Download the Vim patch vim-revision." echo " vim-revision can be a version number of the " echo " format '7.4.xxx' or a Git commit hash." @@ -32,7 +33,7 @@ usage() { echo " -r {pr-number} Review a vim-patch pull request to Neovim." echo echo "Set VIM_SOURCE_DIR to change where Vim's sources are stored." - echo "The default is '${VIM_SOURCE_DIR_DEFAULT}'." + echo "Default is '${VIM_SOURCE_DIR_DEFAULT}'." } # Checks if a program is in the user's PATH, and is executable. @@ -186,6 +187,7 @@ get_vim_patch() { stage_patch() { get_vim_patch "$1" + local try_apply="${2:-}" local git_remote git_remote="$(find_git_remote)" @@ -215,14 +217,23 @@ stage_patch() { echo "✔ ${output}" || (echo "✘ ${output}"; false) - printf "\nInstructions: - Proceed to port the patch. This may help: - patch -p1 < ${patch_file} + if test -n "$try_apply" ; then + if ! check_executable patch; then + printf "\n✘ 'patch' command not found\n" + else + printf "\nApplying patch...\n" + patch -p1 < "${patch_file}" + fi + printf "\nInstructions:\n Proceed to port the patch.\n" + else + printf "\nInstructions:\n Proceed to port the patch.\n Try the 'patch' command (or use '${BASENAME} -P ...' next time):\n patch -p1 < ${patch_file}\n" + fi - Stage your changes ('git add ...') and use 'git commit --amend' to commit. + printf " + Stage your changes ('git add ...'), then use 'git commit --amend' to commit. - To port additional patches related to ${vim_version} and add them to the - current branch, call '${BASENAME} -p' again. + To port more patches (if any) related to ${vim_version}, + run '${BASENAME}' again. * Do this only for _related_ patches (otherwise it increases the size of the pull request, making it harder to review) @@ -446,7 +457,7 @@ review_pr() { clean_files } -while getopts "hlp:g:r:s" opt; do +while getopts "hlp:P:g:r:s" opt; do case ${opt} in h) usage @@ -460,6 +471,10 @@ while getopts "hlp:g:r:s" opt; do stage_patch "${OPTARG}" exit 0 ;; + P) + stage_patch "${OPTARG}" TRY_APPLY + exit 0 + ;; g) get_vim_patch "${OPTARG}" exit 0 -- cgit From 3a7feb69897ad081cbe4a782b08176084df6e386 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 7 Nov 2017 20:25:34 +0100 Subject: vim-patch.sh: remove vimrc_example.vim vimrc_example.vim is not relevant to Nvim. Anything worth having in there should be made an actual default. .gitignore: - remove *.orig ... super annoying --- scripts/vim-patch.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index fd1d2a200b..07b3904570 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -151,6 +151,10 @@ preprocess_patch() { local na_po='sjiscorr.c\|ja.sjis.po\|ko.po\|pl.cp1250.po\|pl.po\|ru.cp1251.po\|uk.cp1251.po\|zh_CN.cp936.po\|zh_CN.po\|zh_TW.po' 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/po/\<\%('${na_po}'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file" + # Remove vimrc_example.vim + local na_vimrcexample='vimrc_example\.vim' + 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/runtime/\<\%('${na_vimrcexample}'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file" + # Rename src/ paths to src/nvim/ LC_ALL=C sed -e 's/\( [ab]\/src\)/\1\/nvim/g' \ "$file" > "$file".tmp && mv "$file".tmp "$file" -- cgit From ea51f08276ce7c9386b88b320fd63ae71324351a Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 7 Nov 2017 20:41:35 +0100 Subject: vim-patch.sh: avoid creating *.orig files --- scripts/vim-patch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 07b3904570..2875e7d95a 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -226,7 +226,7 @@ stage_patch() { printf "\n✘ 'patch' command not found\n" else printf "\nApplying patch...\n" - patch -p1 < "${patch_file}" + patch -p1 --posix < "${patch_file}" fi printf "\nInstructions:\n Proceed to port the patch.\n" else -- cgit From d6f9d1df04cfae3d73496b2cd99408d5344d0ad4 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 18 Nov 2017 12:44:03 +0100 Subject: version bump --- scripts/release.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts') diff --git a/scripts/release.sh b/scripts/release.sh index 692b46e921..f1dbf99473 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -75,6 +75,8 @@ nvim +'/NVIM_VERSION' +10new +'exe "norm! iUpdate version numbers!!!\"' \ git add CMakeLists.txt git commit -m "$__BUMP_MSG" +rm CMakeLists.txt.bk || true + echo " Next steps: - Double-check NVIM_VERSION_* in CMakeLists.txt -- cgit From 84d9245c70c2c65668e0b56beee7f4dcd8ea3644 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 21 Nov 2017 01:31:34 +0100 Subject: pvscheck.sh: auto-detect URL by default The hardcoded URL breaks very often, this confuses people. Instead, auto-detect if no URL is provided. Also auto-detect if the script is invoked with no arguments. --- scripts/pvscheck.sh | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) (limited to 'scripts') diff --git a/scripts/pvscheck.sh b/scripts/pvscheck.sh index e4536b3dce..30c4d296d7 100755 --- a/scripts/pvscheck.sh +++ b/scripts/pvscheck.sh @@ -27,12 +27,8 @@ help() { echo ' pvscheck.sh [--pvs URL] --pvs-install {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 ' --pvs: Fetch pvs-studio from URL.' + echo ' --pvs detect: Auto-detect latest version (by scraping viva64.com).' echo echo ' --deps: (for regular run) Use top-level Makefile and build deps.' echo ' Without this it assumes all dependencies are already' @@ -360,6 +356,17 @@ run_analysis() {( plog-converter -t tasklist -o PVS-studio.tsk PVS-studio.log )} +detect_url() { + local url="${1:-detect}" + if test "$url" = detect ; then + curl --silent -L 'https://www.viva64.com/en/pvs-studio-download-linux/' \ + | grep -o 'https\{0,1\}://[^"<>]\{1,\}/pvs-studio[^/"<>]*\.tgz' \ + || echo FAILED + else + printf '%s' "$url" + fi +} + do_check() { local tgt="$1" ; shift local branch="$1" ; shift @@ -367,6 +374,15 @@ do_check() { local deps="$1" ; shift local environment_cc="$1" ; shift + if test -z "$pvs_url" || test "$pvs_url" = FAILED ; then + pvs_url="$(detect_url detect)" + if test -z "$pvs_url" || test "$pvs_url" = FAILED ; then + echo "failed to auto-detect PVS URL" + exit 1 + fi + echo "Auto-detected PVS URL: ${pvs_url}" + fi + git clone --branch="$branch" . "$tgt" install_pvs "$tgt" "$pvs_url" @@ -397,22 +413,11 @@ do_analysis() { run_analysis "$tgt" } -detect_url() { - local url="${1:-detect}" - if test "$url" = detect ; then - curl -L 'https://www.viva64.com/en/pvs-studio-download-linux/' \ - | grep -o 'https\{0,1\}://[^"<>]\{1,\}/pvs-studio[^/"<>]*\.tgz' - else - printf '%s' "$url" - fi -} - main() { - local def_pvs_url="http://files.viva64.com/pvs-studio-6.15.21741.1-x86_64.tgz" eval "$( getopts_long \ help store_const \ - pvs 'modify detect_url pvs_url "${def_pvs_url}"' \ + pvs 'modify detect_url pvs_url' \ patch store_const \ only-build 'store_const --only-build' \ recheck store_const \ @@ -431,7 +436,7 @@ main() { return 0 fi - set -x + # set -x if test -n "$patch" ; then patch_sources "$tgt" "$only_build" -- cgit From 9ada97a81027e03d4988cc61b366ff05e2e5b92f Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 10 Dec 2017 01:30:05 +0100 Subject: gen_api_vimdoc.py: require "nvim_" prefix Avoids doxygen bugs (things that aren't functions) and other noise (e.g. `remote_ui_disconnect()` was incorrectly included in api.txt). --- scripts/gen_api_vimdoc.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'scripts') diff --git a/scripts/gen_api_vimdoc.py b/scripts/gen_api_vimdoc.py index 51e585a007..4ddf415f1a 100644 --- a/scripts/gen_api_vimdoc.py +++ b/scripts/gen_api_vimdoc.py @@ -45,6 +45,8 @@ if sys.version_info[0] < 3: doc_filename = 'api.txt' # String used to find the start of the generated part of the doc. section_start_token = '*api-global*' +# Required prefix for API function names. +api_func_name_prefix = 'nvim_' # Section name overrides. section_name = { @@ -260,11 +262,11 @@ def parse_parblock(parent, width=62): def parse_source_xml(filename): """Collects API functions. - This returns two strings: - 1. The API functions - 2. The deprecated API functions + Returns two strings: + 1. API functions + 2. Deprecated API functions - The caller decides what to do with the deprecated documentation. + Caller decides what to do with the deprecated documentation. """ global xrefs xrefs = set() @@ -294,9 +296,8 @@ def parse_source_xml(filename): annotations = get_text(get_child(member, 'argsstring')) if annotations and ')' in annotations: annotations = annotations.rsplit(')', 1)[-1].strip() - # XXX: (doxygen 1.8.11) 'argsstring' only includes FUNC_ATTR_* - # attributes if the function signature is non-void. - # Force attributes here for such functions. + # XXX: (doxygen 1.8.11) 'argsstring' only includes attributes of + # non-void functions. Special-case void functions here. if name == 'nvim_get_mode' and len(annotations) == 0: annotations += 'FUNC_API_ASYNC' annotations = filter(None, map(lambda x: annotation_map.get(x), @@ -379,7 +380,7 @@ def parse_source_xml(filename): if 'Deprecated' in xrefs: deprecated_functions.append(func_doc) - else: + elif name.startswith(api_func_name_prefix): functions.append(func_doc) xrefs.clear() -- cgit From 5bd8827431b44b023ae858d903eb543f22cafbdd Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 4 Dec 2017 09:08:07 +0100 Subject: vim-patch.sh: always use git log, not version.c --- scripts/vim-patch.sh | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 2875e7d95a..5c24ede13f 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -327,6 +327,11 @@ list_vim_patches() { local vim_commits vim_commits="$(cd "${VIM_SOURCE_DIR}" && git log --reverse --format='%H' v8.0.0000..HEAD)" + # Find all "vim-patch:xxx" tokens in the Nvim git log. + local tokens + tokens="$(cd "${NVIM_SOURCE_DIR}" && git log -E --grep='vim-patch:[^ ]+' | grep 'vim-patch')" + tokens="$(for i in $tokens ; do echo "$i" | grep -E 'vim-patch:[^ ]{7}' | sed 's/.*\(vim-patch:[.0-9a-z]\+\).*/\1/' ; done)" + local vim_commit for vim_commit in ${vim_commits}; do local is_missing @@ -334,22 +339,21 @@ list_vim_patches() { # This fails for untagged commits (e.g., runtime file updates) so mask the return status vim_tag="$(cd "${VIM_SOURCE_DIR}" && git describe --tags --exact-match "${vim_commit}" 2>/dev/null)" || true if [[ -n "${vim_tag}" ]]; then - local patch_number="${vim_tag:5}" # Remove prefix like "v7.4." - patch_number="$(echo ${patch_number} | sed 's/^0*//g')" # Remove prefix "0" - # Tagged Vim patch, check version.c: - is_missing="$(sed -n '/static const int included_patches/,/}/p' "${NVIM_SOURCE_DIR}/src/nvim/version.c" | - grep -x -e "[[:space:]]*//[[:space:]]${patch_number} NA.*" -e "[[:space:]]*${patch_number}," >/dev/null && echo "false" || echo "true")" + # Vim version number (not commit hash). + local patch_number="${vim_tag:1}" # "v7.4.0001" => "7.4.0001" + is_missing="$(echo "$tokens" | >/dev/null 2>&1 grep "vim\-patch:${patch_number}" && echo false || echo true)" vim_commit="${vim_tag#v}" - if (cd "${VIM_SOURCE_DIR}" && git --no-pager show --color=never --name-only "v${vim_commit}" 2>/dev/null) | grep -q ^runtime; then - vim_commit="${vim_commit} (+runtime)" + if ! [ "$is_missing" = "false" ] ; then + if (cd "${VIM_SOURCE_DIR}" && git --no-pager show --color=never --name-only "v${vim_commit}" 2>/dev/null) | grep -q ^runtime; then + vim_commit="${vim_commit} (+runtime)" + fi fi else - # Untagged Vim patch (e.g. runtime updates), check the Neovim git log: - is_missing="$(cd "${NVIM_SOURCE_DIR}" && - git log -1 --no-merges --grep="vim\-patch:${vim_commit:0:7}" --pretty=format:false)" + # Untagged Vim patch (e.g. runtime updates). + is_missing="$(echo "$tokens" | >/dev/null 2>&1 grep "vim\-patch:${vim_commit:0:7}" && echo false || echo true)" fi - if [[ ${is_missing} != "false" ]]; then + if ! [ "$is_missing" = "false" ]; then echo " • ${vim_commit}" fi done -- cgit From 56b49955b70aa803f9fb42e48a147f1881ecb33c Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 11 Dec 2017 00:49:44 +0100 Subject: vim-patch.sh: introduce `-L` --- scripts/vim-patch.sh | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 5c24ede13f..bac5657cc6 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -21,7 +21,8 @@ usage() { echo echo "Options:" echo " -h Show this message and exit." - echo " -l Show list of Vim patches missing from Neovim." + echo " -l Show list of missing Vim patches." + echo " -L Print missing Vim patches in machine-readable form." echo " -p {vim-revision} Download and generate the specified Vim patch." echo " vim-revision can be a version number '8.0.xxx'" echo " or a valid Git ref (hash, tag, etc.)." @@ -318,11 +319,8 @@ submit_pr() { done } +# Prints a newline-delimited list of Vim commits, for use by scripts. list_vim_patches() { - get_vim_sources - - printf "\nVim patches missing from Neovim:\n" - # Get missing Vim commits local vim_commits vim_commits="$(cd "${VIM_SOURCE_DIR}" && git log --reverse --format='%H' v8.0.0000..HEAD)" @@ -343,18 +341,27 @@ list_vim_patches() { local patch_number="${vim_tag:1}" # "v7.4.0001" => "7.4.0001" is_missing="$(echo "$tokens" | >/dev/null 2>&1 grep "vim\-patch:${patch_number}" && echo false || echo true)" vim_commit="${vim_tag#v}" - if ! [ "$is_missing" = "false" ] ; then - if (cd "${VIM_SOURCE_DIR}" && git --no-pager show --color=never --name-only "v${vim_commit}" 2>/dev/null) | grep -q ^runtime; then - vim_commit="${vim_commit} (+runtime)" - fi - fi else # Untagged Vim patch (e.g. runtime updates). is_missing="$(echo "$tokens" | >/dev/null 2>&1 grep "vim\-patch:${vim_commit:0:7}" && echo false || echo true)" fi if ! [ "$is_missing" = "false" ]; then - echo " • ${vim_commit}" + echo "${vim_commit}" + fi + done +} + +# Prints a human-formatted list of Vim commits, with instructional messages. +show_vim_patches() { + get_vim_sources + printf "\nVim patches missing from Neovim:\n" + + list_vim_patches | while read vim_commit; do + if (cd "${VIM_SOURCE_DIR}" && git --no-pager show --color=never --name-only "v${vim_commit}" 2>/dev/null) | grep -q ^runtime; then + printf " • ${vim_commit} (+runtime)\n" + else + printf " • ${vim_commit}\n" fi done @@ -465,13 +472,17 @@ review_pr() { clean_files } -while getopts "hlp:P:g:r:s" opt; do +while getopts "hlLp:P:g:r:s" opt; do case ${opt} in h) usage exit 0 ;; l) + show_vim_patches + exit 0 + ;; + L) list_vim_patches exit 0 ;; -- cgit From 23fb833ea75107a3349dfb0be2eeccc06111399c Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 11 Dec 2017 00:54:25 +0100 Subject: vim-patch.sh: remove version.c in generated patch Vim patch tracking is now driven completely by `vim-patch:xxx` tokens in the VCS logs. version.c will be auto-generated, if it is used at all. --- scripts/vim-patch.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index bac5657cc6..04bc16dd25 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -148,6 +148,10 @@ preprocess_patch() { local na_src_testdir='Make_amiga.mak\|Make_dos.mak\|Make_ming.mak\|Make_vms.mms' 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/testdir/\<\%('${na_src_testdir}'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file" + # Remove version.c #7555 + local na_po='version.c' + 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/\<\%('${na_po}'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file" + # Remove some *.po files. #5622 local na_po='sjiscorr.c\|ja.sjis.po\|ko.po\|pl.cp1250.po\|pl.po\|ru.cp1251.po\|uk.cp1251.po\|zh_CN.cp936.po\|zh_CN.po\|zh_TW.po' 2>/dev/null $nvim --cmd 'set dir=/tmp' +'g@^diff --git a/src/po/\<\%('${na_po}'\)\>@norm! d/\v(^diff)|%$ ' +w +q "$file" -- cgit From 067bb1e9f41319fbe695ba6c0209621addca5b7f Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sat, 16 Dec 2017 21:42:08 -0500 Subject: vim-patch.sh: Include upstream summary in commit message [ci skip] --- scripts/vim-patch.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 04bc16dd25..530701e223 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -92,8 +92,11 @@ get_vim_sources() { } commit_message() { - printf 'vim-patch:%s\n\n%s\n\n%s' "${vim_version}" \ - "${vim_message}" "${vim_commit_url}" + if [[ -n "$vim_tag" ]]; then + printf '%s\n\n%s' "${vim_message}" "${vim_commit_url}" + else + printf 'vim-patch:%s\n\n%s\n\n%s' "$vim_version" "$vim_message" "$vim_commit_url" + fi } find_git_remote() { @@ -108,22 +111,23 @@ assign_commit_details() { vim_tag="v${1}" vim_commit=$(cd "${VIM_SOURCE_DIR}" \ && git log -1 --format="%H" "${vim_tag}") - local strip_commit_line=true + local munge_commit_line=true else # Interpret parameter as commit hash. vim_version="${1:0:12}" + vim_tag= vim_commit=$(cd "${VIM_SOURCE_DIR}" \ && git log -1 --format="%H" "${vim_version}") - local strip_commit_line=false + local munge_commit_line=false fi vim_commit_url="https://github.com/vim/vim/commit/${vim_commit}" vim_message="$(cd "${VIM_SOURCE_DIR}" \ && git log -1 --pretty='format:%B' "${vim_commit}" \ | sed -e 's/\(#[0-9]*\)/vim\/vim\1/g')" - if [[ ${strip_commit_line} == "true" ]]; then + if [[ ${munge_commit_line} == "true" ]]; then # Remove first line of commit message. - vim_message="$(echo "${vim_message}" | sed -e '1d')" + vim_message="$(echo "${vim_message}" | sed -e '1s/^patch /vim-patch:/')" fi patch_file="vim-${vim_version}.patch" } @@ -286,9 +290,10 @@ submit_pr() { local git_remote git_remote="$(find_git_remote)" local pr_body - pr_body="$(git log --reverse --format='#### %s%n%n%b%n' "${git_remote}"/master..HEAD)" + pr_body="$(git log --grep=vim-patch --reverse --format='#### %s%n%n%b%n' "${git_remote}"/master..HEAD)" local patches - patches=("$(git log --reverse --format='%s' "${git_remote}"/master..HEAD)") + # Extract just the "vim-patch:X.Y.ZZZZ" or "vim-patch:sha" portion of each log + patches=("$(git log --grep=vim-patch --reverse --format='%s' "${git_remote}"/master..HEAD | sed 's/: .*//')") patches=(${patches[@]//vim-patch:}) # Remove 'vim-patch:' prefix for each item in array. local pr_title="${patches[*]}" # Create space-separated string from array. pr_title="${pr_title// /,}" # Replace spaces with commas. -- cgit From fe60fa9faafd90cfe756c80119abae6f8906fc4b Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 16 Dec 2017 21:33:59 +0100 Subject: doc vim-patch:8.0.1206: no autocmd for entering or leaving the command line (commit a4f6cec7a31ff8dbfa089b9e22227afbeb951e9b) NA patches: vim-patch:8.0.0320: warning for unused variable with small build --- scripts/gen_api_vimdoc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/gen_api_vimdoc.py b/scripts/gen_api_vimdoc.py index 4ddf415f1a..69f70f6e2b 100644 --- a/scripts/gen_api_vimdoc.py +++ b/scripts/gen_api_vimdoc.py @@ -478,7 +478,7 @@ def gen_docs(config): docs += '\n\n\n' docs = docs.rstrip() + '\n\n' - docs += ' vim:tw=78:ts=8:ft=help:norl:' + docs += ' vim:tw=78:ts=8:ft=help:norl:\n' doc_file = os.path.join(base_dir, 'runtime/doc', doc_filename) delete_lines_below(doc_file, section_start_token) -- cgit From 973bd10a127f468b55c79e57f8d7215f9b6e6073 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 11 Dec 2017 01:58:55 +0100 Subject: vim-patch.sh: introduce `-V` --- scripts/vim-patch.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 530701e223..55a4acc830 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -32,9 +32,10 @@ usage() { echo " format '7.4.xxx' or a Git commit hash." echo " -s Submit a vim-patch pull request to Neovim." echo " -r {pr-number} Review a vim-patch pull request to Neovim." + echo ' -V Clones the Vim source code to $VIM_SOURCE_DIR.' echo - echo "Set VIM_SOURCE_DIR to change where Vim's sources are stored." - echo "Default is '${VIM_SOURCE_DIR_DEFAULT}'." + echo ' $VIM_SOURCE_DIR controls where Vim sources are found' + echo " (default: '${VIM_SOURCE_DIR_DEFAULT}')" } # Checks if a program is in the user's PATH, and is executable. @@ -481,7 +482,7 @@ review_pr() { clean_files } -while getopts "hlLp:P:g:r:s" opt; do +while getopts "hlLVp:P:g:r:s" opt; do case ${opt} in h) usage @@ -515,6 +516,10 @@ while getopts "hlLp:P:g:r:s" opt; do submit_pr exit 0 ;; + V) + get_vim_sources + exit 0 + ;; *) exit 1 ;; -- cgit From 903ed09a61b15a63c4909d4fad7b098fa2368d1d Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 16 Dec 2017 21:38:53 +0100 Subject: vim-patch.sh: extract list_vimpatch_tokens() Use streams instead of for-loop (20x speedup for list_vimpatch_tokens). --- scripts/vim-patch.sh | 62 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 25 deletions(-) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 55a4acc830..b82d21b03e 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -174,7 +174,7 @@ preprocess_patch() { "$file" > "$file".tmp && mv "$file".tmp "$file" } -get_vim_patch() { +get_vimpatch() { get_vim_sources assign_commit_details "${1}" @@ -200,7 +200,7 @@ get_vim_patch() { } stage_patch() { - get_vim_patch "$1" + get_vimpatch "$1" local try_apply="${2:-}" local git_remote @@ -329,31 +329,43 @@ submit_pr() { done } -# Prints a newline-delimited list of Vim commits, for use by scripts. -list_vim_patches() { - # Get missing Vim commits - local vim_commits - vim_commits="$(cd "${VIM_SOURCE_DIR}" && git log --reverse --format='%H' v8.0.0000..HEAD)" +# Gets all Vim commits since the "start" commit. +list_vim_commits() { ( + cd "${VIM_SOURCE_DIR}" && git log --reverse --format='%H' v8.0.0000..HEAD +) } - # Find all "vim-patch:xxx" tokens in the Nvim git log. +# Prints all "vim-patch:xxx" tokens found in the Nvim git log. +list_vimpatch_tokens() { local tokens + # Find all "vim-patch:xxx" tokens in the Nvim git log. tokens="$(cd "${NVIM_SOURCE_DIR}" && git log -E --grep='vim-patch:[^ ]+' | grep 'vim-patch')" - tokens="$(for i in $tokens ; do echo "$i" | grep -E 'vim-patch:[^ ]{7}' | sed 's/.*\(vim-patch:[.0-9a-z]\+\).*/\1/' ; done)" + echo "$tokens" | grep -E 'vim-patch:[^ ,{]{7,}' \ + | sed 's/.*\(vim-patch:[.0-9a-z]\+\).*/\1/' \ + | sort \ + | uniq +} + +# Prints a newline-delimited list of Vim commits, for use by scripts. +list_missing_vimpatches() { + local tokens vim_commit vim_commits is_missing vim_tag patch_number + + # Find all "vim-patch:xxx" tokens in the Nvim git log. + tokens="$(list_vimpatch_tokens)" - local vim_commit + # Get missing Vim commits + vim_commits="$(list_vim_commits)" for vim_commit in ${vim_commits}; do - local is_missing - local vim_tag - # This fails for untagged commits (e.g., runtime file updates) so mask the return status - vim_tag="$(cd "${VIM_SOURCE_DIR}" && git describe --tags --exact-match "${vim_commit}" 2>/dev/null)" || true - if [[ -n "${vim_tag}" ]]; then + # Check for vim-patch: (usually runtime updates). + is_missing="$(echo "$tokens" | >/dev/null 2>&1 grep "vim\-patch:${vim_commit:0:7}" && echo false || echo true)" + + if ! [ "$is_missing" = "false" ] \ + && vim_tag="$(cd "${VIM_SOURCE_DIR}" && git describe --tags --exact-match "${vim_commit}" 2>/dev/null)" + then # Vim version number (not commit hash). - local patch_number="${vim_tag:1}" # "v7.4.0001" => "7.4.0001" + # Check for vim-patch: (not commit hash). + patch_number="${vim_tag:1}" # "v7.4.0001" => "7.4.0001" is_missing="$(echo "$tokens" | >/dev/null 2>&1 grep "vim\-patch:${patch_number}" && echo false || echo true)" vim_commit="${vim_tag#v}" - else - # Untagged Vim patch (e.g. runtime updates). - is_missing="$(echo "$tokens" | >/dev/null 2>&1 grep "vim\-patch:${vim_commit:0:7}" && echo false || echo true)" fi if ! [ "$is_missing" = "false" ]; then @@ -363,11 +375,11 @@ list_vim_patches() { } # Prints a human-formatted list of Vim commits, with instructional messages. -show_vim_patches() { +show_vimpatches() { get_vim_sources printf "\nVim patches missing from Neovim:\n" - list_vim_patches | while read vim_commit; do + list_missing_vimpatches | while read vim_commit; do if (cd "${VIM_SOURCE_DIR}" && git --no-pager show --color=never --name-only "v${vim_commit}" 2>/dev/null) | grep -q ^runtime; then printf " • ${vim_commit} (+runtime)\n" else @@ -441,7 +453,7 @@ review_commit() { echo "✔ Saved pull request diff to '${NVIM_SOURCE_DIR}/n${patch_file}'." CREATED_FILES+=("${NVIM_SOURCE_DIR}/n${patch_file}") - get_vim_patch "${vim_version}" + get_vimpatch "${vim_version}" CREATED_FILES+=("${NVIM_SOURCE_DIR}/${patch_file}") echo @@ -489,11 +501,11 @@ while getopts "hlLVp:P:g:r:s" opt; do exit 0 ;; l) - show_vim_patches + show_vimpatches exit 0 ;; L) - list_vim_patches + list_missing_vimpatches exit 0 ;; p) @@ -505,7 +517,7 @@ while getopts "hlLVp:P:g:r:s" opt; do exit 0 ;; g) - get_vim_patch "${OPTARG}" + get_vimpatch "${OPTARG}" exit 0 ;; r) -- cgit From 7773bbd0989d798b29486a669775a81cd4ec6d3b Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 26 Dec 2017 03:38:42 +0100 Subject: vimpatch.lua: automate version.c Invoke it like this: VIM_SOURCE_DIR=~/neovim/.vim-src/ nvim -i NONE -u NONE --headless +'luafile ./scripts/vimpatch.lua' +q --- scripts/vim-patch.sh | 41 ++++++++++++++++++++------------ scripts/vimpatch.lua | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+), 15 deletions(-) create mode 100755 scripts/vimpatch.lua (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index b82d21b03e..c6ff280bb5 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -14,25 +14,23 @@ readonly BRANCH_PREFIX="vim-" CREATED_FILES=() usage() { - echo "Helper script for porting Vim patches. For more information, see" + echo "Port Vim patches to Neovim" echo "https://github.com/neovim/neovim/wiki/Merging-patches-from-upstream-vim" echo echo "Usage: ${BASENAME} [-h | -l | -p vim-revision | -r pr-number]" echo echo "Options:" echo " -h Show this message and exit." - echo " -l Show list of missing Vim patches." - echo " -L Print missing Vim patches in machine-readable form." - echo " -p {vim-revision} Download and generate the specified Vim patch." - echo " vim-revision can be a version number '8.0.xxx'" - echo " or a valid Git ref (hash, tag, etc.)." - echo " -P {vim-revision} Download, generate and apply the Vim patch." - echo " -g {vim-revision} Download the Vim patch vim-revision." - echo " vim-revision can be a version number of the " - echo " format '7.4.xxx' or a Git commit hash." - echo " -s Submit a vim-patch pull request to Neovim." - echo " -r {pr-number} Review a vim-patch pull request to Neovim." - echo ' -V Clones the Vim source code to $VIM_SOURCE_DIR.' + echo " -l List missing Vim patches." + echo " -L List missing Vim patches (for scripts)." + echo " -M List all merged patch-numbers (at current v:version)." + echo " -p {vim-revision} Download and generate a Vim patch. vim-revision" + echo " can be a Vim version (8.0.xxx) or a Git hash." + echo " -P {vim-revision} Download, generate and apply a Vim patch." + echo " -g {vim-revision} Download a Vim patch." + echo " -s Create a vim-patch pull request." + echo " -r {pr-number} Review a vim-patch pull request." + echo ' -V Clone the Vim source code to $VIM_SOURCE_DIR.' echo echo ' $VIM_SOURCE_DIR controls where Vim sources are found' echo " (default: '${VIM_SOURCE_DIR_DEFAULT}')" @@ -334,7 +332,7 @@ list_vim_commits() { ( cd "${VIM_SOURCE_DIR}" && git log --reverse --format='%H' v8.0.0000..HEAD ) } -# Prints all "vim-patch:xxx" tokens found in the Nvim git log. +# Prints all (sorted) "vim-patch:xxx" tokens found in the Nvim git log. list_vimpatch_tokens() { local tokens # Find all "vim-patch:xxx" tokens in the Nvim git log. @@ -345,6 +343,15 @@ list_vimpatch_tokens() { | uniq } +# Prints all patch-numbers (for the current v:version) for which there is +# a "vim-patch:xxx" token in the Nvim git log. +list_vimpatch_numbers() { + # Transform "vim-patch:X.Y.ZZZZ" to "ZZZZ". + list_vimpatch_tokens | while read vimpatch_token; do + echo "$vimpatch_token" | grep '8\.0\.' | sed 's/.*vim-patch:8\.0\.\([0-9a-z]\+\).*/\1/' + done +} + # Prints a newline-delimited list of Vim commits, for use by scripts. list_missing_vimpatches() { local tokens vim_commit vim_commits is_missing vim_tag patch_number @@ -494,7 +501,7 @@ review_pr() { clean_files } -while getopts "hlLVp:P:g:r:s" opt; do +while getopts "hlLMVp:P:g:r:s" opt; do case ${opt} in h) usage @@ -508,6 +515,10 @@ while getopts "hlLVp:P:g:r:s" opt; do list_missing_vimpatches exit 0 ;; + M) + list_vimpatch_numbers + exit 0 + ;; p) stage_patch "${OPTARG}" exit 0 diff --git a/scripts/vimpatch.lua b/scripts/vimpatch.lua new file mode 100755 index 0000000000..0924f3d718 --- /dev/null +++ b/scripts/vimpatch.lua @@ -0,0 +1,67 @@ +-- Updates version.c list of applied Vim patches. +-- +-- Usage: +-- VIM_SOURCE_DIR=~/neovim/.vim-src/ nvim -i NONE -u NONE --headless +'luafile ./scripts/vimpatch.lua' +q + +local nvim = vim.api + +local function pprint(o) + print(nvim.nvim_call_function('string', { o })) +end + +local function systemlist(...) + local rv = nvim.nvim_call_function('systemlist', ...) + local err = nvim.nvim_get_vvar('shell_error') + local args_str = nvim.nvim_call_function('string', ...) + if 0 ~= err then + error('command failed: '..args_str) + end + return rv +end + +local function vimpatch_sh_list_numbers() + return systemlist( { { 'bash', '-c', 'scripts/vim-patch.sh -M', } } ) +end + +-- Generates the lines to be inserted into the src/version.c +-- `included_patches[]` definition. +local function gen_version_c_lines() + -- Set of merged Vim 8.0.zzzz patch numbers. + local merged_patch_numbers = {} + local highest = 0 + for _, n in ipairs(vimpatch_sh_list_numbers()) do + if n then + merged_patch_numbers[tonumber(n)] = true + highest = math.max(highest, n) + end + end + + local lines = {} + for i = highest, 0, -1 do + local is_merged = (nil ~= merged_patch_numbers[i]) + if is_merged then + table.insert(lines, string.format(' %s,', i)) + else + table.insert(lines, string.format(' // %s,', i)) + end + end + + return lines +end + +local function patch_version_c() + local lines = gen_version_c_lines() + + nvim.nvim_command('silent noswapfile noautocmd edit src/nvim/version.c') + nvim.nvim_command('/static const int included_patches') + -- Delete the existing lines. + nvim.nvim_command('silent normal! j0d/};\rk') + -- Insert the lines. + nvim.nvim_call_function('append', { + nvim.nvim_eval('line(".")'), + lines, + }) + nvim.nvim_command('silent write') +end + +patch_version_c() -- cgit From 0d548b73efb31452465dab5d15238e336125042c Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sat, 30 Dec 2017 14:15:51 +0100 Subject: scripts/vim-patch.sh: continue when patching with -P fails (#7790) The `set -e` caused the script to stop in case `patch` fails, but it is better to continue giving instructions. --- scripts/vim-patch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index c6ff280bb5..ac5e326e9d 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -234,7 +234,7 @@ stage_patch() { printf "\n✘ 'patch' command not found\n" else printf "\nApplying patch...\n" - patch -p1 --posix < "${patch_file}" + patch -p1 --posix < "${patch_file}" || true fi printf "\nInstructions:\n Proceed to port the patch.\n" else -- cgit From e69a71427cd7ebfe9fd86ced65f87521878e409f Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 2 Feb 2018 01:33:34 +0100 Subject: vim-patch.sh: remove --posix from patch invocation This was supposed to avoid creating *.orig. It doesn't do that, and worse, it also seems to prevent new files from being created. --- scripts/vim-patch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index ac5e326e9d..90a731710a 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -234,7 +234,7 @@ stage_patch() { printf "\n✘ 'patch' command not found\n" else printf "\nApplying patch...\n" - patch -p1 --posix < "${patch_file}" || true + patch -p1 < "${patch_file}" || true fi printf "\nInstructions:\n Proceed to port the patch.\n" else -- cgit From b67ce84c453e5db5dd28fdb55efde89b07ecad40 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 2 Feb 2018 21:56:22 +0100 Subject: vim-patch.sh: delete *.orig files --- scripts/vim-patch.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 90a731710a..c7a23abe5e 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -235,6 +235,7 @@ stage_patch() { else printf "\nApplying patch...\n" patch -p1 < "${patch_file}" || true + find -name '*.orig' -type f -delete fi printf "\nInstructions:\n Proceed to port the patch.\n" else -- cgit From a98736b9c0f3b5a860ab030853c04427d2da64cd Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Sun, 4 Mar 2018 02:52:23 +0100 Subject: scripts: fix shebang of shadacat.py [ci skip] --- scripts/shadacat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/shadacat.py b/scripts/shadacat.py index 2f2cf19f9d..522379aad4 100755 --- a/scripts/shadacat.py +++ b/scripts/shadacat.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3.4 +#!/usr/bin/env python3 import os import sys -- cgit From d53aa0e94f87beb9997dd95f77ca277ecd804ba7 Mon Sep 17 00:00:00 2001 From: Giuseppe Date: Thu, 8 Mar 2018 12:58:16 +0100 Subject: vim-patch.sh: more colorful #8115 --- scripts/vim-patch.sh | 63 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 27 deletions(-) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index c7a23abe5e..21f11fbf1c 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -36,6 +36,14 @@ usage() { echo " (default: '${VIM_SOURCE_DIR_DEFAULT}')" } +msg_ok() { + printf "\e[32m✔\e[0m $@\n" +} + +msg_err() { + printf "\e[31m✘\e[0m $@\n" +} + # Checks if a program is in the user's PATH, and is executable. check_executable() { test -x "$(command -v "${1}")" @@ -73,20 +81,20 @@ get_vim_sources() { require_executable git if [[ ! -d ${VIM_SOURCE_DIR} ]]; then - echo "Cloning Vim sources into '${VIM_SOURCE_DIR}'." + echo "Cloning Vim into: ${VIM_SOURCE_DIR}" git clone https://github.com/vim/vim.git "${VIM_SOURCE_DIR}" cd "${VIM_SOURCE_DIR}" else if [[ ! -d "${VIM_SOURCE_DIR}/.git" ]]; then - echo "✘ ${VIM_SOURCE_DIR} does not appear to be a git repository." + msg_err "${VIM_SOURCE_DIR} does not appear to be a git repository." echo " Please remove it and try again." exit 1 fi cd "${VIM_SOURCE_DIR}" - echo "Updating Vim sources in '${VIM_SOURCE_DIR}'." + echo "Updating Vim sources: ${VIM_SOURCE_DIR}" git pull && - echo "✔ Updated Vim sources." || - echo "✘ Could not update Vim sources; ignoring error." + msg_ok "Updated Vim sources." || + msg_err "Could not update Vim sources; ignoring error." fi } @@ -178,10 +186,10 @@ get_vimpatch() { assign_commit_details "${1}" git log -1 "${vim_commit}" -- >/dev/null 2>&1 || { - >&2 echo "✘ Couldn't find Vim revision '${vim_commit}'." + >&2 msg_err "Couldn't find Vim revision '${vim_commit}'." exit 3 } - echo "✔ Found Vim revision '${vim_commit}'." + msg_ok "Found Vim revision '${vim_commit}'." local patch_content patch_content="$(git --no-pager show --color=never -1 --pretty=medium "${vim_commit}")" @@ -194,7 +202,7 @@ get_vimpatch() { printf "Pre-processing patch...\n" preprocess_patch "${NVIM_SOURCE_DIR}/${patch_file}" - printf "✔ Saved patch to '${NVIM_SOURCE_DIR}/${patch_file}'.\n" + msg_ok "Saved patch to '${NVIM_SOURCE_DIR}/${patch_file}'.\n" } stage_patch() { @@ -207,31 +215,32 @@ stage_patch() { checked_out_branch="$(git rev-parse --abbrev-ref HEAD)" if [[ "${checked_out_branch}" == ${BRANCH_PREFIX}* ]]; then - echo "✔ Current branch '${checked_out_branch}' seems to be a vim-patch" + msg_ok "Current branch '${checked_out_branch}' seems to be a vim-patch" echo " branch; not creating a new branch." else printf "\nFetching '${git_remote}/master'.\n" output="$(git fetch "${git_remote}" master 2>&1)" && - echo "✔ ${output}" || - (echo "✘ ${output}"; false) + msg_ok "${output}" || + (msg_err "${output}"; false) local nvim_branch="${BRANCH_PREFIX}${vim_version}" echo echo "Creating new branch '${nvim_branch}' based on '${git_remote}/master'." cd "${NVIM_SOURCE_DIR}" output="$(git checkout -b "${nvim_branch}" "${git_remote}/master" 2>&1)" && - echo "✔ ${output}" || - (echo "✘ ${output}"; false) + msg_ok "${output}" || + (msg_err "${output}"; false) fi printf "\nCreating empty commit with correct commit message.\n" output="$(commit_message | git commit --allow-empty --file 2>&1 -)" && - echo "✔ ${output}" || - (echo "✘ ${output}"; false) + msg_ok "${output}" || + (msg_err "${output}"; false) if test -n "$try_apply" ; then if ! check_executable patch; then - printf "\n✘ 'patch' command not found\n" + printf "\n" + msg_err "'patch' command not found\n" else printf "\nApplying patch...\n" patch -p1 < "${patch_file}" || true @@ -283,7 +292,7 @@ submit_pr() { local checked_out_branch checked_out_branch="$(git rev-parse --abbrev-ref HEAD)" if [[ "${checked_out_branch}" != ${BRANCH_PREFIX}* ]]; then - echo "✘ Current branch '${checked_out_branch}' doesn't seem to be a vim-patch branch." + msg_err "Current branch '${checked_out_branch}' doesn't seem to be a vim-patch branch." exit 1 fi @@ -304,16 +313,16 @@ submit_pr() { if [[ $push_first -ne 0 ]]; then echo "Pushing to 'origin/${checked_out_branch}'." output="$(git push origin "${checked_out_branch}" 2>&1)" && - echo "✔ ${output}" || - (echo "✘ ${output}"; false) + msg_ok "${output}" || + (msg_err "${output}"; false) echo fi echo "Creating pull request." output="$(${submit_fn} "${pr_message}" 2>&1)" && - echo "✔ ${output}" || - (echo "✘ ${output}"; false) + msg_ok "${output}" || + (msg_err "${output}"; false) echo echo "Cleaning up files." @@ -324,7 +333,7 @@ submit_pr() { continue fi rm -- "${NVIM_SOURCE_DIR}/${patch_file}" - echo "✔ Removed '${NVIM_SOURCE_DIR}/${patch_file}'." + msg_ok "Removed '${NVIM_SOURCE_DIR}/${patch_file}'." done } @@ -421,9 +430,9 @@ review_commit() { echo if [[ -n "${vim_version}" ]]; then - echo "✔ Detected Vim patch '${vim_version}'." + msg_ok "Detected Vim patch '${vim_version}'." else - echo "✘ Could not detect the Vim patch number." + msg_err "Could not detect the Vim patch number." echo " This script assumes that the PR contains only commits" echo " with 'vim-patch:XXX' in their title." echo @@ -446,9 +455,9 @@ review_commit() { local commit_message commit_message="$(tail -n +4 <<< "${nvim_patch}" | head -n "${message_length}")" if [[ "${commit_message#${git_patch_prefix}}" == "${expected_commit_message}" ]]; then - echo "✔ Found expected commit message." + msg_ok "Found expected commit message." else - echo "✘ Wrong commit message." + msg_err "Wrong commit message." echo " Expected:" echo "${expected_commit_message}" echo " Actual:" @@ -458,7 +467,7 @@ review_commit() { echo echo "Creating files." echo "${nvim_patch}" > "${NVIM_SOURCE_DIR}/n${patch_file}" - echo "✔ Saved pull request diff to '${NVIM_SOURCE_DIR}/n${patch_file}'." + msg_ok "Saved pull request diff to '${NVIM_SOURCE_DIR}/n${patch_file}'." CREATED_FILES+=("${NVIM_SOURCE_DIR}/n${patch_file}") get_vimpatch "${vim_version}" -- cgit From b0d08998f5b1c613e5a1a7b425ab228a0af637b7 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Fri, 9 Mar 2018 09:36:05 -0500 Subject: genappimage: Use AppImage/AppImages repo to avoid redirects --- scripts/genappimage.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/genappimage.sh b/scripts/genappimage.sh index a73ccd86c7..b891a3f629 100755 --- a/scripts/genappimage.sh +++ b/scripts/genappimage.sh @@ -35,7 +35,7 @@ VERSION=$("$ROOT_DIR"/build/bin/nvim --version | head -n 1 | grep -o 'v.*') cd "$APP_BUILD_DIR" -curl -Lo "$APP_BUILD_DIR"/appimage_functions.sh https://github.com/probonopd/AppImages/raw/master/functions.sh +curl -Lo "$APP_BUILD_DIR"/appimage_functions.sh https://github.com/AppImage/AppImages/raw/master/functions.sh . ./appimage_functions.sh # Copy desktop and icon file to AppDir for AppRun to pick them up. @@ -53,7 +53,7 @@ move_lib # Delete stuff that should not go into the AppImage. # Delete dangerous libraries; see -# https://github.com/probonopd/AppImages/blob/master/excludelist +# https://github.com/AppImage/AppImages/blob/master/excludelist delete_blacklisted ######################################################################## @@ -71,10 +71,8 @@ cd "$APP_BUILD_DIR" # Get out of AppImage directory. # - Produces: ../out/$APP-$VERSION.glibc$GLIBC_NEEDED-$ARCH.AppImage generate_appimage -# NOTE: There is currently a bug in the `generate_appimage` function (see -# https://github.com/probonopd/AppImages/issues/228) that causes repeated builds -# that result in the same name to fail. -# Moving the final executable to a different folder gets around this issue. +# Moving the final executable to a different folder so it isn't in the +# way for a subsequent build. mv "$ROOT_DIR"/out/*.AppImage "$ROOT_DIR"/build/bin # Remove the (now empty) folder the AppImage was built in -- cgit From e1f27cdb4cafaa72a055e82f5dae06c27e7557e5 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Fri, 9 Mar 2018 09:59:35 -0500 Subject: genappimage: Create a type 2 AppImage --- scripts/genappimage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/genappimage.sh b/scripts/genappimage.sh index b891a3f629..3b7dd6f2bd 100755 --- a/scripts/genappimage.sh +++ b/scripts/genappimage.sh @@ -69,7 +69,7 @@ cd "$APP_BUILD_DIR" # Get out of AppImage directory. # - Expects: $ARCH, $APP, $VERSION env vars # - Expects: ./$APP.AppDir/ directory # - Produces: ../out/$APP-$VERSION.glibc$GLIBC_NEEDED-$ARCH.AppImage -generate_appimage +generate_type2_appimage # Moving the final executable to a different folder so it isn't in the # way for a subsequent build. -- cgit From 9dc3cc2c68088ab468d78d9d9b89acd72ac75f80 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Fri, 9 Mar 2018 10:51:27 -0500 Subject: genappimage: Include update information for releases/nightlies This will allow users to use AppImageUpdate to update their AppImage. It requires publishing the created zsync file alongside the appimage file for the releases. --- scripts/genappimage.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/genappimage.sh b/scripts/genappimage.sh index 3b7dd6f2bd..2c10ed7202 100755 --- a/scripts/genappimage.sh +++ b/scripts/genappimage.sh @@ -11,6 +11,8 @@ if [ -z "$ARCH" ]; then export ARCH="$(arch)" fi +TAG=$1 + # App name, used by generate_appimage. APP=nvim @@ -69,12 +71,16 @@ cd "$APP_BUILD_DIR" # Get out of AppImage directory. # - Expects: $ARCH, $APP, $VERSION env vars # - Expects: ./$APP.AppDir/ directory # - Produces: ../out/$APP-$VERSION.glibc$GLIBC_NEEDED-$ARCH.AppImage -generate_type2_appimage +if [ -n "$TAG" ]; then + generate_type2_appimage -u "gh-releases-zsync|neovim|neovim|$TAG|nvim.appimage.zsync" +else + generate_type2_appimage +fi # Moving the final executable to a different folder so it isn't in the # way for a subsequent build. -mv "$ROOT_DIR"/out/*.AppImage "$ROOT_DIR"/build/bin +mv "$ROOT_DIR"/out/*.AppImage* "$ROOT_DIR"/build/bin # Remove the (now empty) folder the AppImage was built in rmdir "$ROOT_DIR"/out -- cgit From 4e5e6506b51d3f952023df609b2b3e4469cbdc63 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sun, 11 Mar 2018 18:01:44 -0400 Subject: pvscheck: Ignore exit code of pvs-studio-analyzer Since its typically non-zero, the script immediately exits instead of converting the binary log into useful formats. --- scripts/pvscheck.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/pvscheck.sh b/scripts/pvscheck.sh index 30c4d296d7..314966f6aa 100755 --- a/scripts/pvscheck.sh +++ b/scripts/pvscheck.sh @@ -343,13 +343,15 @@ run_analysis() {( cd "$tgt" + # pvs-studio-analyzer exits with a non-zero exit code when there are detected + # errors, so ignore its return pvs-studio-analyzer \ analyze \ --threads "$(get_jobs_num)" \ --output-file PVS-studio.log \ --verbose \ --file build/compile_commands.json \ - --sourcetree-root . + --sourcetree-root . || true plog-converter -t xml -o PVS-studio.xml PVS-studio.log plog-converter -t errorfile -o PVS-studio.err PVS-studio.log -- cgit From f8d2aef4f20887bb5a407b5a34cd5dc29fc6771c Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 24 Mar 2018 22:42:13 +0100 Subject: vim-patch.sh: remove blank line before URL This "stacks" better in squashed PRs, etc. --- scripts/vim-patch.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh index 21f11fbf1c..5182756d83 100755 --- a/scripts/vim-patch.sh +++ b/scripts/vim-patch.sh @@ -100,9 +100,9 @@ get_vim_sources() { commit_message() { if [[ -n "$vim_tag" ]]; then - printf '%s\n\n%s' "${vim_message}" "${vim_commit_url}" + printf '%s\n%s' "${vim_message}" "${vim_commit_url}" else - printf 'vim-patch:%s\n\n%s\n\n%s' "$vim_version" "$vim_message" "$vim_commit_url" + printf 'vim-patch:%s\n\n%s\n%s' "$vim_version" "$vim_message" "$vim_commit_url" fi } -- cgit