From d4874a7ee62c817b90d80098f53ad205f9909ccb Mon Sep 17 00:00:00 2001 From: ryneeverett Date: Sat, 21 Mar 2020 04:27:09 +0000 Subject: [PATCH 1/8] vimPlugins: Automate redirect updates in update.py Many of the plugins in vim-plugin-names are out of date and redirect to their new github repos. This commit adds a flag to automatically update these and defines a process for committing these updates into nixpkgs. --- doc/languages-frameworks/vim.section.md | 2 +- pkgs/misc/vim-plugins/update.py | 100 ++++++++++++++++++++---- 2 files changed, 86 insertions(+), 16 deletions(-) diff --git a/doc/languages-frameworks/vim.section.md b/doc/languages-frameworks/vim.section.md index 05a23d26cf2f7..cd53926defeb6 100644 --- a/doc/languages-frameworks/vim.section.md +++ b/doc/languages-frameworks/vim.section.md @@ -263,7 +263,7 @@ Sometimes plugins require an override that must be changed when the plugin is up To add a new plugin: - 1. run `./update.py` and create a commit named "vimPlugins: Update", + 1. run `./update.py --update-redirects` and create a commit named "vimPlugins: Update", 2. add the new plugin to [vim-plugin-names](/pkgs/misc/vim-plugins/vim-plugin-names) and add overrides if required to [overrides.nix](/pkgs/misc/vim-plugins/overrides.nix), 3. run `./update.py` again and create a commit named "vimPlugins.[name]: init at [version]" (where `name` and `version` can be found in [generated.nix](/pkgs/misc/vim-plugins/generated.nix)), and 4. create a pull request. diff --git a/pkgs/misc/vim-plugins/update.py b/pkgs/misc/vim-plugins/update.py index 0ef93ac569ab0..2a0688927114d 100755 --- a/pkgs/misc/vim-plugins/update.py +++ b/pkgs/misc/vim-plugins/update.py @@ -9,13 +9,16 @@ # $ nix run nixpkgs.python3Packages.flake8 -c flake8 --ignore E501,E265 update.py import argparse +import fileinput import functools +import http import json import os import subprocess import sys import traceback import urllib.error +import urllib.parse import urllib.request import xml.etree.ElementTree as ET from datetime import datetime @@ -71,9 +74,11 @@ def f_retry(*args: Any, **kwargs: Any) -> Any: class Repo: - def __init__(self, owner: str, name: str) -> None: + def __init__(self, owner: str, name: str, alias: str) -> None: self.owner = owner self.name = name + self.alias = alias + self.redirect: Dict[str, str] = {} def url(self, path: str) -> str: return urljoin(f"https://github.com/{self.owner}/{self.name}/", path) @@ -96,7 +101,9 @@ def has_submodules(self) -> bool: @retry(urllib.error.URLError, tries=4, delay=3, backoff=2) def latest_commit(self) -> Tuple[str, datetime]: - with urllib.request.urlopen(self.url("commits/master.atom"), timeout=10) as req: + commit_url = self.url("commits/master.atom") + with urllib.request.urlopen(commit_url, timeout=10) as req: + self.check_for_redirect(commit_url, req) xml = req.read() root = ET.fromstring(xml) latest_entry = root.find(ATOM_ENTRY) @@ -111,6 +118,22 @@ def latest_commit(self) -> Tuple[str, datetime]: updated = datetime.strptime(updated_tag.text, "%Y-%m-%dT%H:%M:%SZ") return Path(str(url.path)).name, updated + def check_for_redirect(self, url: str, req: http.client.HTTPResponse): + response_url = req.geturl() + if url != response_url: + new_owner, new_name = ( + urllib.parse.urlsplit(response_url).path.strip("/").split("/")[:2] + ) + end_line = f" as {self.alias}\n" if self.alias else "\n" + plugin_line = "{owner}/{name}" + end_line + + old_plugin = plugin_line.format(owner=self.owner, name=self.name) + new_plugin = plugin_line.format(owner=new_owner, name=new_name) + self.redirect[old_plugin] = new_plugin + + if new_name != self.name: + print(f"Plugin Name Changed: {self.name} -> {new_name}") + def prefetch_git(self, ref: str) -> str: data = subprocess.check_output( ["nix-prefetch-git", "--fetch-submodules", self.url(""), ref] @@ -197,15 +220,17 @@ def get_current_plugins() -> List[Plugin]: return plugins -def prefetch_plugin(user: str, repo_name: str, alias: str, cache: "Cache") -> Plugin: - repo = Repo(user, repo_name) +def prefetch_plugin( + user: str, repo_name: str, alias: str, cache: "Cache" +) -> Tuple[Plugin, Dict[str, str]]: + repo = Repo(user, repo_name, alias) commit, date = repo.latest_commit() has_submodules = repo.has_submodules() cached_plugin = cache[commit] if cached_plugin is not None: cached_plugin.name = alias or repo_name cached_plugin.date = date - return cached_plugin + return cached_plugin, repo.redirect print(f"prefetch {user}/{repo_name}") if has_submodules: @@ -213,7 +238,10 @@ def prefetch_plugin(user: str, repo_name: str, alias: str, cache: "Cache") -> Pl else: sha256 = repo.prefetch_github(commit) - return Plugin(alias or repo_name, commit, has_submodules, sha256, date=date) + return ( + Plugin(alias or repo_name, commit, has_submodules, sha256, date=date), + repo.redirect, + ) def print_download_error(plugin: str, ex: Exception): @@ -227,20 +255,22 @@ def print_download_error(plugin: str, ex: Exception): def check_results( - results: List[Tuple[str, str, Union[Exception, Plugin]]] -) -> List[Tuple[str, str, Plugin]]: + results: List[Tuple[str, str, Union[Exception, Plugin], Dict[str, str]]] +) -> Tuple[List[Tuple[str, str, Plugin]], Dict[str, str]]: failures: List[Tuple[str, Exception]] = [] plugins = [] - for (owner, name, result) in results: + redirects: Dict[str, str] = {} + for (owner, name, result, redirect) in results: if isinstance(result, Exception): failures.append((name, result)) else: plugins.append((owner, name, result)) + redirects.update(redirect) print(f"{len(results) - len(failures)} plugins were checked", end="") if len(failures) == 0: print() - return plugins + return plugins, redirects else: print(f", {len(failures)} plugin(s) could not be downloaded:\n") @@ -328,15 +358,15 @@ def __setitem__(self, key: str, value: Plugin) -> None: def prefetch( args: Tuple[str, str, str], cache: Cache -) -> Tuple[str, str, Union[Exception, Plugin]]: +) -> Tuple[str, str, Union[Exception, Plugin], dict]: assert len(args) == 3 owner, repo, alias = args try: - plugin = prefetch_plugin(owner, repo, alias, cache) + plugin, redirect = prefetch_plugin(owner, repo, alias, cache) cache[plugin.commit] = plugin - return (owner, repo, plugin) + return (owner, repo, plugin, redirect) except Exception as e: - return (owner, repo, e) + return (owner, repo, e, {}) header = ( @@ -386,6 +416,31 @@ def generate_nix(plugins: List[Tuple[str, str, Plugin]], outfile: str): print(f"updated {outfile}") +def update_redirects(input_file: Path, output_file: Path, redirects: dict): + with fileinput.input(input_file, inplace=True) as f: + for line in f: + print(redirects.get(line, line), end="") + print( + f"""\ +Redirects have been detected and {input_file} has been updated. Please take the +following steps: + 1. Go ahead and commit just the updated expressions as you intended to do: + git add {output_file} + git commit -m "vimPlugins: Update" + 2. If any of the plugin names were changed, add the old names as aliases in + aliases.nix + 3. Make sure the updated {input_file} is still correctly sorted: + sort -udf ./vim-plugin-names > sorted && mv sorted vim-plugin-names + 4. Run this script again so these changes will be reflected in the + generated expressions (no need to use the --update-redirects flag again): + ./update.py + 5. Commit {input_file} along with aliases and generated expressions: + git add {output_file} {input_file} aliases.nix + git commit -m "vimPlugins: Update redirects" +""" + ) + + def parse_args(): parser = argparse.ArgumentParser( description=( @@ -407,6 +462,12 @@ def parse_args(): default=DEFAULT_OUT, help="Filename to save generated nix code", ) + parser.add_argument( + "--update-redirects", + dest="update_redirects", + action="store_true", + help="Update input file if repos have been redirected.", + ) return parser.parse_args() @@ -428,10 +489,19 @@ def main() -> None: finally: cache.store() - plugins = check_results(results) + plugins, redirects = check_results(results) generate_nix(plugins, args.outfile) + if redirects: + if args.update_redirects: + update_redirects(args.input_file, args.outfile, redirects) + else: + print( + "Outdated vim-plugin-names found. Please run with " + "--update-redirects flag." + ) + if __name__ == "__main__": main() From c78aa8e1004bc383038bb1ba7c192becce42ce96 Mon Sep 17 00:00:00 2001 From: ryneeverett Date: Sun, 22 Mar 2020 04:05:19 +0000 Subject: [PATCH 2/8] vimPlugins: Update --- pkgs/misc/vim-plugins/generated.nix | 70 ++++++++++++++--------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/pkgs/misc/vim-plugins/generated.nix b/pkgs/misc/vim-plugins/generated.nix index 06667caf5c83f..427384cb71102 100644 --- a/pkgs/misc/vim-plugins/generated.nix +++ b/pkgs/misc/vim-plugins/generated.nix @@ -611,12 +611,12 @@ let coc-tsserver = buildVimPluginFrom2Nix { pname = "coc-tsserver"; - version = "2020-03-09"; + version = "2020-03-21"; src = fetchFromGitHub { owner = "neoclide"; repo = "coc-tsserver"; - rev = "dae0cc36b0245a601d4431ae8dd2319eaa919058"; - sha256 = "1559c0hwyknz1j6vbigywg1fjads4wf8by59z0sri6aah9q77q2z"; + rev = "54bea1ec1ab44802a155f876a4d1cc2c44b2bc42"; + sha256 = "0npjc7c3x9mdqc6asav1f2wwv4p6lb5hk7c1p9b7m3vjg21w0k22"; }; }; @@ -909,12 +909,12 @@ let denite-nvim = buildVimPluginFrom2Nix { pname = "denite-nvim"; - version = "2020-03-18"; + version = "2020-03-21"; src = fetchFromGitHub { owner = "Shougo"; repo = "denite.nvim"; - rev = "a184e87b7df5e8f35aee115153b37f178e47718c"; - sha256 = "1na637k62sgpqx69r6j5prad4qdc9dp3psq75jhqyvhm3yq2432w"; + rev = "c3206a06508a197650ee4e1d85da39ff24e3a56b"; + sha256 = "1yy6j5zpja8jr1j8sghwc1l0fkb47r8cvv36ckf75x9x5gpylb5m"; }; }; @@ -1121,12 +1121,12 @@ let deoplete-nvim = buildVimPluginFrom2Nix { pname = "deoplete-nvim"; - version = "2020-03-18"; + version = "2020-03-21"; src = fetchFromGitHub { owner = "Shougo"; repo = "deoplete.nvim"; - rev = "db7d2dc5f416634c9917054bcd6e1e5d925bb4d7"; - sha256 = "1d34zy81j47icsrnbxpp4x9f35ihrmd0lnd0vphi216kdlkxk37b"; + rev = "1439c621dc94016c504e1732ce8270081a42768f"; + sha256 = "1c8qx839zmf52cfazlbbnlhxw6cvnsr3ds0rclawgycbl4s1qy8f"; }; }; @@ -2027,12 +2027,12 @@ let neoformat = buildVimPluginFrom2Nix { pname = "neoformat"; - version = "2020-03-03"; + version = "2020-03-20"; src = fetchFromGitHub { owner = "sbdchd"; repo = "neoformat"; - rev = "69140aedb7da5a5a0b25b82e7f756f91d08170ea"; - sha256 = "132ksy20rb01xm18zwwl3lv5zapfhfvaf5zz6md8dnr5hvkvvrgx"; + rev = "d02b169e70bd6d2b2365bf6cda721967616a30bf"; + sha256 = "1cya26wfqc7l7dqy854m4kwrq3w66knmn2cgviqh9cnsjzhwxs0d"; }; }; @@ -2258,12 +2258,12 @@ let nvim-lsp = buildVimPluginFrom2Nix { pname = "nvim-lsp"; - version = "2020-03-19"; + version = "2020-03-21"; src = fetchFromGitHub { owner = "neovim"; repo = "nvim-lsp"; - rev = "6d5e81c71bb90568b3bf9ca061980b9b30cdbc15"; - sha256 = "1va480pw7nk650bmh4z7rvr2a5sqd4q86y19341p6mj12p2r2fcv"; + rev = "4fe58ec4e1fa3500c7ef98464174bf6c4cb8ce67"; + sha256 = "1xyqbr0f2pgvbbk0cpg92pswavff910hy8rjkm05grhqw43vkzcg"; }; }; @@ -3568,12 +3568,12 @@ let vim-codefmt = buildVimPluginFrom2Nix { pname = "vim-codefmt"; - version = "2020-02-26"; + version = "2020-03-20"; src = fetchFromGitHub { owner = "google"; repo = "vim-codefmt"; - rev = "6d69f933f243ed3d7797641bd41c0e65d245c931"; - sha256 = "0vzzyz7v03ihky3vx12rji4l1r6vbxgslvc1fvi4dznfqn5m9gfn"; + rev = "d6676620f7a85fa49e8893cad041df59497fd845"; + sha256 = "01wrlq9h2wzngi8qna0zrwycrp0iqp7qsijyby287zbckrs25rnd"; }; }; @@ -4041,11 +4041,11 @@ let vim-fugitive = buildVimPluginFrom2Nix { pname = "vim-fugitive"; - version = "2020-03-12"; + version = "2020-03-22"; src = fetchFromGitHub { owner = "tpope"; repo = "vim-fugitive"; - rev = "9a4d730270882f9d39a411eb126143eda4d46963"; + rev = "0e35c9bbc78159318e7b7ffd228f09a96afb8fde"; sha256 = "098fz3lmfysv6gr5cjwgqsdzxjxygwc0x4ak1sxj3h6djys5x66b"; }; }; @@ -4118,12 +4118,12 @@ let vim-go = buildVimPluginFrom2Nix { pname = "vim-go"; - version = "2020-03-17"; + version = "2020-03-20"; src = fetchFromGitHub { owner = "fatih"; repo = "vim-go"; - rev = "f5d34f40d6757470f40600000c9c08de142d7ced"; - sha256 = "0a2g8f9xza2m07qm4pcj2aqjh1yvs9cxn8f3zima06swfw2ahdh8"; + rev = "50d52bafa00448ca8cde2b0e05b0fe71c9397762"; + sha256 = "1c8dwllscwxiqp409zy7ajwz84bn8g7p9gldqrhx8i9l7q382z0w"; }; }; @@ -4614,12 +4614,12 @@ let vim-lsc = buildVimPluginFrom2Nix { pname = "vim-lsc"; - version = "2020-02-11"; + version = "2020-03-22"; src = fetchFromGitHub { owner = "natebosch"; repo = "vim-lsc"; - rev = "62c6f6aa227b1b3ef5e7cf7df9f0a9c1d855d7fe"; - sha256 = "1qimz08rqm4ch6dr0znwxl328593kmz0yxdqq15g1yrw4ig0fi22"; + rev = "3dd7a19e8689847956266e0be1bbfb4ca12da746"; + sha256 = "0dj1b8v9iz67m833x1z3s7jac0jpfxgs43ylc6m0v3al67qcb0mj"; }; }; @@ -5527,12 +5527,12 @@ let vim-test = buildVimPluginFrom2Nix { pname = "vim-test"; - version = "2020-03-17"; + version = "2020-03-21"; src = fetchFromGitHub { owner = "janko-m"; repo = "vim-test"; - rev = "d878e9d61f186140f18a7a8a8badc0605d8955ba"; - sha256 = "06kihjif3g00bibx304vz22w2w9z84v0g6a55cxs1hqlc4ygnl8v"; + rev = "b302a325116d8708dc0721b7cd97ff59536f4e75"; + sha256 = "099dzadzhfkhf92lv5cmfk0iawbp40v1rz9xxp462hxxcn3p3c97"; }; }; @@ -5945,12 +5945,12 @@ let vimtex = buildVimPluginFrom2Nix { pname = "vimtex"; - version = "2020-03-17"; + version = "2020-03-21"; src = fetchFromGitHub { owner = "lervag"; repo = "vimtex"; - rev = "16b23314b31862510d3feb8a2569199062b083ac"; - sha256 = "0vibfwsyamp4jqbaaa872m922yg89fx7k0cfa6kfhr5ks4vhpya5"; + rev = "8c59031d50feeec8b4f3549f70f82564975265f0"; + sha256 = "16a7qpp19gci8hq8h2999pwv0gd6x0mqgifv325mlb0jj5lxy7m1"; }; }; @@ -6099,12 +6099,12 @@ let yats-vim = buildVimPluginFrom2Nix { pname = "yats-vim"; - version = "2020-03-02"; + version = "2020-03-21"; src = fetchFromGitHub { owner = "HerringtonDarkholme"; repo = "yats.vim"; - rev = "68ef9623656fe9aaa53c1d9ab906f09c2c095f06"; - sha256 = "0cn1k8lda71vm4gx14ly9gdvk1j17jds0axx9jvjp4w9jid6ksqk"; + rev = "4d3f69a3a5f56bae9475a96c3291ffdcbd9ff0b1"; + sha256 = "0f3dq4lrm9xzh780fd471b7ddibfzb9vfq1k6gn53pmqpiw6a498"; fetchSubmodules = true; }; }; From 6601c1699f5d005f3efefc5c42c0e46eee6ce47e Mon Sep 17 00:00:00 2001 From: ryneeverett Date: Sun, 22 Mar 2020 04:15:58 +0000 Subject: [PATCH 3/8] vimPlugins: Update redirects --- pkgs/misc/vim-plugins/aliases.nix | 7 +- pkgs/misc/vim-plugins/generated.nix | 90 +++++++++++++------------- pkgs/misc/vim-plugins/overrides.nix | 4 +- pkgs/misc/vim-plugins/vim-plugin-names | 40 ++++++------ 4 files changed, 72 insertions(+), 69 deletions(-) diff --git a/pkgs/misc/vim-plugins/aliases.nix b/pkgs/misc/vim-plugins/aliases.nix index cfdd629369c03..e301d40874a82 100644 --- a/pkgs/misc/vim-plugins/aliases.nix +++ b/pkgs/misc/vim-plugins/aliases.nix @@ -67,7 +67,8 @@ mapAliases { ghc-mod-vim = ghcmod-vim; ghcmod = ghcmod-vim; goyo = goyo-vim; - Gist = gist-vim; + Gist = vim-gist; + gist-vim = vim-gist; # backwards compat, added 2020-3-22 gitgutter = vim-gitgutter; gundo = gundo-vim; Gundo = gundo-vim; # backwards compat, added 2015-10-03 @@ -125,15 +126,17 @@ mapAliases { unite = unite-vim; UltiSnips = ultisnips; vim-addon-vim2nix = vim2nix; + vim-jade = vim-pug; # backwards compat, added 2020-3-22 vimproc = vimproc-vim; vimshell = vimshell-vim; vinegar = vim-vinegar; + vundle = Vundle-vim; # backwards compat, added 2020-3-22 watchdogs = vim-watchdogs; WebAPI = webapi-vim; wombat256 = wombat256-vim; # backwards compat, added 2015-7-8 yankring = YankRing-vim; Yankring = YankRing-vim; - YouCompleteMe = youcompleteme; + youcompleteme = YouCompleteMe; # backwards compat, added 2020-3-22 xterm-color-table = xterm-color-table-vim; zeavim = zeavim-vim; } diff --git a/pkgs/misc/vim-plugins/generated.nix b/pkgs/misc/vim-plugins/generated.nix index 427384cb71102..1d39465ddf803 100644 --- a/pkgs/misc/vim-plugins/generated.nix +++ b/pkgs/misc/vim-plugins/generated.nix @@ -63,7 +63,7 @@ let pname = "ale"; version = "2020-03-11"; src = fetchFromGitHub { - owner = "w0rp"; + owner = "dense-analysis"; repo = "ale"; rev = "bbe5153fcb36dec9860ced33ae8ff0b5d76ac02a"; sha256 = "1xvmh66lgii98z6f4lk1mjs73ysrvs55xdlcmf224k3as822jmw0"; @@ -283,7 +283,7 @@ let pname = "clang_complete"; version = "2018-09-19"; src = fetchFromGitHub { - owner = "Rip-Rip"; + owner = "xavierd"; repo = "clang_complete"; rev = "0b98d7533ad967aac3fc4c1a5b0508dafa8a676f"; sha256 = "04mdhc1kbv66blkn6qn98iyj659dac4z49nmpf3anglz8dgcxjgc"; @@ -889,7 +889,7 @@ let pname = "denite-extra"; version = "2019-03-29"; src = fetchFromGitHub { - owner = "chemzqm"; + owner = "neoclide"; repo = "denite-extra"; rev = "af18257544027ce89269dba70c12aba1f5b9e23c"; sha256 = "0bmq9yhylfd3v6bfwvakw3pbsz5kk8wlmmql0yllqayp6410w25a"; @@ -900,7 +900,7 @@ let pname = "denite-git"; version = "2020-03-02"; src = fetchFromGitHub { - owner = "chemzqm"; + owner = "neoclide"; repo = "denite-git"; rev = "88b5323a6fc0ace197eed5205215d80f3b613f91"; sha256 = "0b687i64hr8hll7pv7r1xz906b46cl2q62zm18ipikhkpva6iv13"; @@ -933,7 +933,7 @@ let pname = "deoplete-clang"; version = "2019-11-10"; src = fetchFromGitHub { - owner = "zchee"; + owner = "deoplete-plugins"; repo = "deoplete-clang"; rev = "2ea262e98edcb66e828f9077fcc844100320eb63"; sha256 = "1wvk61f8ph2vpl6llzmir3qs3zwaw3lrphs16d1j7ljkdl3bk49k"; @@ -989,7 +989,7 @@ let pname = "deoplete-go"; version = "2020-01-01"; src = fetchFromGitHub { - owner = "zchee"; + owner = "deoplete-plugins"; repo = "deoplete-go"; rev = "4f1ccd2ed70211fd025d052ec725c0b835bea487"; sha256 = "0zmx98kz6pxfpakizr8xm1nrv1rjr0frz19pkik29mk6aj2b2l08"; @@ -1397,17 +1397,6 @@ let }; }; - gist-vim = buildVimPluginFrom2Nix { - pname = "gist-vim"; - version = "2020-01-29"; - src = fetchFromGitHub { - owner = "mattn"; - repo = "gist-vim"; - rev = "2158eceb210b0a354bc17aa4144554e5d8bb6c79"; - sha256 = "1dz33c63q7gghz35hyrvbshqw20faccs7bvxlda5w70mkbz9h9c4"; - }; - }; - gitignore-vim = buildVimPluginFrom2Nix { pname = "gitignore-vim"; version = "2014-03-16"; @@ -2150,7 +2139,7 @@ let pname = "nerdcommenter"; version = "2020-02-19"; src = fetchFromGitHub { - owner = "scrooloose"; + owner = "preservim"; repo = "nerdcommenter"; rev = "c62e618a1ab5a50a4028e3296500ba29d9b033d8"; sha256 = "0w4bxj423dxxkcxnfmipf8x5jfm058rq4g3m98wzcz5zbambv3qs"; @@ -2161,7 +2150,7 @@ let pname = "nerdtree"; version = "2020-02-20"; src = fetchFromGitHub { - owner = "scrooloose"; + owner = "preservim"; repo = "nerdtree"; rev = "e67324fdea7a192c7ce1b4c6b3c3b9f82f11eee7"; sha256 = "0y7hd69k0i21cqgs11n80ljv6cl0gfcjjwa0dvdywpd8mmn1ad4k"; @@ -2447,7 +2436,7 @@ let pname = "purescript-vim"; version = "2018-12-10"; src = fetchFromGitHub { - owner = "raichoo"; + owner = "purescript-contrib"; repo = "purescript-vim"; rev = "67ca4dc4a0291e5d8c8da48bffc0f3d2c9739e7f"; sha256 = "1insh39hzbynr6qxb215qxhpifl5m8i5i0d09a3b6v679i7s11i8"; @@ -2590,7 +2579,7 @@ let pname = "riv-vim"; version = "2020-02-17"; src = fetchFromGitHub { - owner = "Rykka"; + owner = "gu-fan"; repo = "riv.vim"; rev = "d52844691ca2f139e4b634db65aa49c57a0fc2b3"; sha256 = "0s4jvqwlnmmh2zw9v9rlwynwx44ypdrzhhyfb20sippxg9g6z0c5"; @@ -2821,7 +2810,7 @@ let pname = "sved"; version = "2019-01-25"; src = fetchFromGitHub { - owner = "peder2tm"; + owner = "peterbjorgensen"; repo = "sved"; rev = "3362db72447e8ac812c7299c15ecfc9f41341713"; sha256 = "1r2nv069d6r2q6gbiz795x94mfjm9hnv05zka085hhq9a3yf1pgx"; @@ -2843,7 +2832,7 @@ let pname = "syntastic"; version = "2020-01-29"; src = fetchFromGitHub { - owner = "scrooloose"; + owner = "vim-syntastic"; repo = "syntastic"; rev = "f3766538720116f099a8b1517f76ae2f094afd20"; sha256 = "1bzjav87fcibwlp8siqnx6x8wv8w3mwrrqrd5w19ny9scr5x2a65"; @@ -3867,7 +3856,7 @@ let pname = "vim-elixir"; version = "2020-03-11"; src = fetchFromGitHub { - owner = "elixir-lang"; + owner = "elixir-editors"; repo = "vim-elixir"; rev = "088cfc407460dea7b81c10b29db23843f85e7919"; sha256 = "1w9w4arzlbjhd5kcvyv5fykq9djc4n4j1nc75qqlzsfggbjjwhbk"; @@ -4061,6 +4050,17 @@ let }; }; + vim-gist = buildVimPluginFrom2Nix { + pname = "vim-gist"; + version = "2020-01-29"; + src = fetchFromGitHub { + owner = "mattn"; + repo = "vim-gist"; + rev = "2158eceb210b0a354bc17aa4144554e5d8bb6c79"; + sha256 = "1dz33c63q7gghz35hyrvbshqw20faccs7bvxlda5w70mkbz9h9c4"; + }; + }; + vim-gista = buildVimPluginFrom2Nix { pname = "vim-gista"; version = "2020-01-04"; @@ -4380,17 +4380,6 @@ let }; }; - vim-jade = buildVimPluginFrom2Nix { - pname = "vim-jade"; - version = "2019-09-23"; - src = fetchFromGitHub { - owner = "digitaltoad"; - repo = "vim-jade"; - rev = "ea39cd942cf3194230cf72bfb838901a5344d3b3"; - sha256 = "07141jkfnaia4ydc6qcg0bc06w720l2lzl7bm4bsjwswqrzmhfam"; - }; - }; - vim-janah = buildVimPluginFrom2Nix { pname = "vim-janah"; version = "2018-10-01"; @@ -5052,6 +5041,17 @@ let }; }; + vim-pug = buildVimPluginFrom2Nix { + pname = "vim-pug"; + version = "2019-09-23"; + src = fetchFromGitHub { + owner = "digitaltoad"; + repo = "vim-pug"; + rev = "ea39cd942cf3194230cf72bfb838901a5344d3b3"; + sha256 = "07141jkfnaia4ydc6qcg0bc06w720l2lzl7bm4bsjwswqrzmhfam"; + }; + }; + vim-puppet = buildVimPluginFrom2Nix { pname = "vim-puppet"; version = "2019-09-16"; @@ -5529,7 +5529,7 @@ let pname = "vim-test"; version = "2020-03-21"; src = fetchFromGitHub { - owner = "janko-m"; + owner = "janko"; repo = "vim-test"; rev = "b302a325116d8708dc0721b7cd97ff59536f4e75"; sha256 = "099dzadzhfkhf92lv5cmfk0iawbp40v1rz9xxp462hxxcn3p3c97"; @@ -5998,12 +5998,12 @@ let }; }; - vundle = buildVimPluginFrom2Nix { - pname = "vundle"; + Vundle-vim = buildVimPluginFrom2Nix { + pname = "Vundle-vim"; version = "2019-08-17"; src = fetchFromGitHub { - owner = "gmarik"; - repo = "vundle"; + owner = "VundleVim"; + repo = "Vundle.vim"; rev = "b255382d6242d7ea3877bf059d2934125e0c4d95"; sha256 = "0fkmklcq3fgvd6x6irz9bgyvcdaxafykk3k89gsi9p6b0ikw3rw6"; }; @@ -6109,12 +6109,12 @@ let }; }; - youcompleteme = buildVimPluginFrom2Nix { - pname = "youcompleteme"; + YouCompleteMe = buildVimPluginFrom2Nix { + pname = "YouCompleteMe"; version = "2020-03-18"; src = fetchFromGitHub { - owner = "valloric"; - repo = "youcompleteme"; + owner = "ycm-core"; + repo = "YouCompleteMe"; rev = "cf4a76acaeed27eb3ca1dca5adf1115b6abbcfa3"; sha256 = "0si9by2ag2f7xgxidp5215d6wkg1mdhq9j5c4icdpsly9gv3w5s8"; fetchSubmodules = true; @@ -6158,7 +6158,7 @@ let pname = "zig-vim"; version = "2020-02-10"; src = fetchFromGitHub { - owner = "zig-lang"; + owner = "ziglang"; repo = "zig.vim"; rev = "55b690029791022fd7818ebd0ee395e8976899fe"; sha256 = "10xkrn4yhjda187mpw1y3qw0s6bp7aklk87pansaa3fvysdf3b6c"; diff --git a/pkgs/misc/vim-plugins/overrides.nix b/pkgs/misc/vim-plugins/overrides.nix index e4710e27193ca..5248a817f43ea 100644 --- a/pkgs/misc/vim-plugins/overrides.nix +++ b/pkgs/misc/vim-plugins/overrides.nix @@ -393,7 +393,7 @@ self: super: { configurePhase = "cd plugins/nvim"; }); - gist-vim = super.gist-vim.overrideAttrs(old: { + vim-gist = super.vim-gist.overrideAttrs(old: { dependencies = with super; [ webapi-vim ]; }); @@ -640,7 +640,7 @@ self: super: { sourceRoot = "."; }); - youcompleteme = super.youcompleteme.overrideAttrs(old: { + YouCompleteMe = super.YouCompleteMe.overrideAttrs(old: { buildPhase = '' substituteInPlace plugin/youcompleteme.vim \ --replace "'ycm_path_to_python_interpreter', '''" \ diff --git a/pkgs/misc/vim-plugins/vim-plugin-names b/pkgs/misc/vim-plugins/vim-plugin-names index 874b2471d5c47..704fc12e39bf0 100644 --- a/pkgs/misc/vim-plugins/vim-plugin-names +++ b/pkgs/misc/vim-plugins/vim-plugin-names @@ -20,8 +20,8 @@ autozimu/LanguageClient-neovim ayu-theme/ayu-vim bazelbuild/vim-bazel bbchung/clighter8 -benmills/vimux benizi/vim-automkdir +benmills/vimux bhurlow/vim-parinfer bitc/vim-hdevtools bkad/camelcasemotion @@ -35,8 +35,6 @@ brooth/far.vim carlitux/deoplete-ternjs ccarpita/rtorrent-syntax-file cespare/vim-toml -chemzqm/denite-extra -chemzqm/denite-git Chiel92/vim-autoformat chikatoike/concealedyank.vim chikatoike/sourcemap.vim @@ -65,14 +63,17 @@ dart-lang/dart-vim-plugin david-a-wheeler/vim-metamath davidhalter/jedi-vim dcharbon/vim-flatbuffers +dense-analysis/ale +deoplete-plugins/deoplete-clang deoplete-plugins/deoplete-dictionary +deoplete-plugins/deoplete-go deoplete-plugins/deoplete-jedi deoplete-plugins/deoplete-zsh derekelkins/agda-vim derekwyatt/vim-scala dhruvasagar/vim-prosession dhruvasagar/vim-table-mode -digitaltoad/vim-jade +digitaltoad/vim-pug direnv/direnv.vim dleonard0/pony-vim-syntax dracula/vim @@ -85,7 +86,7 @@ easymotion/vim-easymotion editorconfig/editorconfig-vim ehamberg/vim-cute-python eikenb/acp -elixir-lang/vim-elixir +elixir-editors/vim-elixir elmcast/elm-vim elzr/vim-json embear/vim-localvimrc @@ -108,7 +109,6 @@ garbas/vim-snipmate gentoo/gentoo-syntax gibiansky/vim-textobj-haskell glts/vim-textobj-comment -gmarik/vundle godlygeek/csapprox godlygeek/tabular google/vim-codefmt @@ -117,6 +117,7 @@ google/vim-maktaba gorkunov/smartpairs.vim gotcha/vimelette gregsexton/gitv +gu-fan/riv.vim guns/vim-clojure-highlight guns/vim-clojure-static guns/vim-sexp @@ -147,7 +148,7 @@ itchyny/vim-cursorword itchyny/vim-gitbranch ivanov/vim-ipython jacoborus/tender.vim -janko-m/vim-test +janko/vim-test jaredgorski/SpaceCamp JazzCore/ctrlp-cmatcher jceb/vim-hier @@ -259,7 +260,7 @@ markonm/traces.vim martinda/Jenkinsfile-vim-syntax mattn/calendar-vim as mattn-calendar-vim mattn/emmet-vim -mattn/gist-vim +mattn/vim-gist mattn/webapi-vim matze/vim-move maximbaz/lightline-ale @@ -329,6 +330,8 @@ neoclide/coc-vimtex neoclide/coc-wxml neoclide/coc-yaml neoclide/coc-yank +neoclide/denite-extra +neoclide/denite-git neoclide/vim-easygit neomake/neomake neovimhaskell/haskell-vim @@ -355,7 +358,7 @@ osyo-manga/vim-watchdogs pangloss/vim-javascript parsonsmatt/intero-neovim pearofducks/ansible-vim -peder2tm/sved +peterbjorgensen/sved peterhoeg/vim-qml phanviet/vim-monokai-pro plasticboy/vim-markdown @@ -363,7 +366,10 @@ ponko2/deoplete-fish posva/vim-vue powerman/vim-plugin-AnsiEsc PProvost/vim-ps1 +preservim/nerdcommenter +preservim/nerdtree ptzz/lf.vim +purescript-contrib/purescript-vim python-mode/python-mode qnighy/lalrpop.vim qpkorr/vim-bufkill @@ -372,7 +378,6 @@ racer-rust/vim-racer rafaqz/ranger.vim rafi/awesome-vim-colorschemes raghur/vim-ghost -raichoo/purescript-vim Raimondi/delimitMate rakr/vim-one rbgrouleff/bclose.vim @@ -381,7 +386,6 @@ reedes/vim-wordy rhysd/committia.vim rhysd/vim-grammarous rhysd/vim-operator-surround -Rip-Rip/clang_complete rodjek/vim-puppet romainl/vim-cool ron89/thesaurus_query.vim @@ -391,15 +395,11 @@ roxma/nvim-yarp RRethy/vim-illuminate rust-lang/rust.vim ryanoasis/vim-devicons -Rykka/riv.vim ryvnf/readline.vim sakhnik/nvim-gdb saltstack/salt-vim samoshkin/vim-mergetool sbdchd/neoformat -scrooloose/nerdcommenter -scrooloose/nerdtree -scrooloose/syntastic sebastianmarkow/deoplete-rust SevereOverfl0w/deoplete-github sheerun/vim-polyglot @@ -501,7 +501,6 @@ uarun/vim-protobuf udalov/kotlin-vim ujihisa/neco-look unblevable/quick-scope -valloric/youcompleteme Valodim/deoplete-notmuch vhda/verilog_systemverilog.vim vim-airline/vim-airline @@ -537,11 +536,12 @@ vim-scripts/taglist.vim vim-scripts/utl.vim vim-scripts/wombat256.vim vim-scripts/YankRing.vim +vim-syntastic/syntastic vim-utils/vim-husk vimwiki/vimwiki vito-c/jq.vim vmchale/dhall-vim -w0rp/ale +VundleVim/Vundle.vim wakatime/vim-wakatime wannesm/wmgraphviz.vim wellle/targets.vim @@ -550,11 +550,11 @@ will133/vim-dirdiff wincent/command-t wincent/ferret wsdjeg/vim-fetch +xavierd/clang_complete xolox/vim-easytags xolox/vim-misc xuhdev/vim-latex-live-preview +ycm-core/YouCompleteMe Yggdroot/indentLine zah/nim.vim -zchee/deoplete-clang -zchee/deoplete-go -zig-lang/zig.vim +ziglang/zig.vim From a9c9b0d40c9de6084b928e6e8d97b1abef553f35 Mon Sep 17 00:00:00 2001 From: ryneeverett Date: Tue, 24 Mar 2020 03:04:42 +0000 Subject: [PATCH 4/8] vimPlugins: --update-redirects improvements. In response to @timokau's review here are a couple changes: - Decrease the fragility of the replacement code by normalizing whitespace on each line. - Throw an error when plugins are renamed rather than silently aliasing to the new name. --- pkgs/misc/vim-plugins/aliases.nix | 11 +++++++---- pkgs/misc/vim-plugins/update.py | 5 +++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pkgs/misc/vim-plugins/aliases.nix b/pkgs/misc/vim-plugins/aliases.nix index e301d40874a82..627008a2aebf9 100644 --- a/pkgs/misc/vim-plugins/aliases.nix +++ b/pkgs/misc/vim-plugins/aliases.nix @@ -30,6 +30,9 @@ let (removeRecurseForDerivations (checkInPkgs n alias))) aliases; + + deprecateName = oldName: newName: + throw "${oldName} was renamed to ${newName}. Please update to ${newName}."; in mapAliases { @@ -68,7 +71,7 @@ mapAliases { ghcmod = ghcmod-vim; goyo = goyo-vim; Gist = vim-gist; - gist-vim = vim-gist; # backwards compat, added 2020-3-22 + gist-vim = deprecateName "vim-gist" "gist-vim"; # backwards compat, added 2020-3-22 gitgutter = vim-gitgutter; gundo = gundo-vim; Gundo = gundo-vim; # backwards compat, added 2015-10-03 @@ -126,17 +129,17 @@ mapAliases { unite = unite-vim; UltiSnips = ultisnips; vim-addon-vim2nix = vim2nix; - vim-jade = vim-pug; # backwards compat, added 2020-3-22 + vim-jade = deprecateName "vim-pug" "vim-jade"; # backwards compat, added 2020-3-22 vimproc = vimproc-vim; vimshell = vimshell-vim; vinegar = vim-vinegar; - vundle = Vundle-vim; # backwards compat, added 2020-3-22 + vundle = deprecateName "Vundle-vim" "vundle"; # backwards compat, added 2020-3-22 watchdogs = vim-watchdogs; WebAPI = webapi-vim; wombat256 = wombat256-vim; # backwards compat, added 2015-7-8 yankring = YankRing-vim; Yankring = YankRing-vim; - youcompleteme = YouCompleteMe; # backwards compat, added 2020-3-22 + youcompleteme = deprecateName "YouCompleteMe" "youcompleteme"; # backwards compat, added 2020-3-22 xterm-color-table = xterm-color-table-vim; zeavim = zeavim-vim; } diff --git a/pkgs/misc/vim-plugins/update.py b/pkgs/misc/vim-plugins/update.py index 2a0688927114d..9410f78be28af 100755 --- a/pkgs/misc/vim-plugins/update.py +++ b/pkgs/misc/vim-plugins/update.py @@ -419,6 +419,7 @@ def generate_nix(plugins: List[Tuple[str, str, Plugin]], outfile: str): def update_redirects(input_file: Path, output_file: Path, redirects: dict): with fileinput.input(input_file, inplace=True) as f: for line in f: + line = " ".join(line.split()) print(redirects.get(line, line), end="") print( f"""\ @@ -427,8 +428,8 @@ def update_redirects(input_file: Path, output_file: Path, redirects: dict): 1. Go ahead and commit just the updated expressions as you intended to do: git add {output_file} git commit -m "vimPlugins: Update" - 2. If any of the plugin names were changed, add the old names as aliases in - aliases.nix + 2. If any of the plugin names were changed, throw an error in aliases.nix: + = deprecateName "" ""; # backwards compat, added YYYY-MM-DD 3. Make sure the updated {input_file} is still correctly sorted: sort -udf ./vim-plugin-names > sorted && mv sorted vim-plugin-names 4. Run this script again so these changes will be reflected in the From cffb6cb63762d0ddc5f7470b783159672ed683b1 Mon Sep 17 00:00:00 2001 From: ryneeverett Date: Tue, 24 Mar 2020 14:46:07 +0000 Subject: [PATCH 5/8] vimPlugins: Update redirects without flag. Per review, the input file will now be rewritten automatically if redirects are found. --- doc/languages-frameworks/vim.section.md | 2 +- pkgs/misc/vim-plugins/update.py | 16 ++-------------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/doc/languages-frameworks/vim.section.md b/doc/languages-frameworks/vim.section.md index cd53926defeb6..05a23d26cf2f7 100644 --- a/doc/languages-frameworks/vim.section.md +++ b/doc/languages-frameworks/vim.section.md @@ -263,7 +263,7 @@ Sometimes plugins require an override that must be changed when the plugin is up To add a new plugin: - 1. run `./update.py --update-redirects` and create a commit named "vimPlugins: Update", + 1. run `./update.py` and create a commit named "vimPlugins: Update", 2. add the new plugin to [vim-plugin-names](/pkgs/misc/vim-plugins/vim-plugin-names) and add overrides if required to [overrides.nix](/pkgs/misc/vim-plugins/overrides.nix), 3. run `./update.py` again and create a commit named "vimPlugins.[name]: init at [version]" (where `name` and `version` can be found in [generated.nix](/pkgs/misc/vim-plugins/generated.nix)), and 4. create a pull request. diff --git a/pkgs/misc/vim-plugins/update.py b/pkgs/misc/vim-plugins/update.py index 9410f78be28af..c0ecd5d036e84 100755 --- a/pkgs/misc/vim-plugins/update.py +++ b/pkgs/misc/vim-plugins/update.py @@ -433,7 +433,7 @@ def update_redirects(input_file: Path, output_file: Path, redirects: dict): 3. Make sure the updated {input_file} is still correctly sorted: sort -udf ./vim-plugin-names > sorted && mv sorted vim-plugin-names 4. Run this script again so these changes will be reflected in the - generated expressions (no need to use the --update-redirects flag again): + generated expressions: ./update.py 5. Commit {input_file} along with aliases and generated expressions: git add {output_file} {input_file} aliases.nix @@ -463,12 +463,6 @@ def parse_args(): default=DEFAULT_OUT, help="Filename to save generated nix code", ) - parser.add_argument( - "--update-redirects", - dest="update_redirects", - action="store_true", - help="Update input file if repos have been redirected.", - ) return parser.parse_args() @@ -495,13 +489,7 @@ def main() -> None: generate_nix(plugins, args.outfile) if redirects: - if args.update_redirects: - update_redirects(args.input_file, args.outfile, redirects) - else: - print( - "Outdated vim-plugin-names found. Please run with " - "--update-redirects flag." - ) + update_redirects(args.input_file, args.outfile, redirects) if __name__ == "__main__": From b886ad90e7395d98d9c4956eef817e29bfce71a5 Mon Sep 17 00:00:00 2001 From: ryneeverett Date: Tue, 24 Mar 2020 19:00:31 +0000 Subject: [PATCH 6/8] vimPlugins: Automatically sort vim-plugin-names. Python's `sorted` method works a little differently than `sort` in the handling of dashes. --- pkgs/misc/vim-plugins/default.nix | 1 - pkgs/misc/vim-plugins/update.py | 36 ++++++++++++++------------ pkgs/misc/vim-plugins/vim-plugin-names | 14 +++++----- 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/pkgs/misc/vim-plugins/default.nix b/pkgs/misc/vim-plugins/default.nix index 20cbbf275c3ab..e6bca9484a260 100644 --- a/pkgs/misc/vim-plugins/default.nix +++ b/pkgs/misc/vim-plugins/default.nix @@ -11,7 +11,6 @@ let # TL;DR # * Add your plugin to ./vim-plugin-names - # * sort -udf ./vim-plugin-names > sorted && mv sorted vim-plugin-names # * run ./update.py # # If additional modifications to the build process are required, diff --git a/pkgs/misc/vim-plugins/update.py b/pkgs/misc/vim-plugins/update.py index c0ecd5d036e84..ac959f055b488 100755 --- a/pkgs/misc/vim-plugins/update.py +++ b/pkgs/misc/vim-plugins/update.py @@ -9,7 +9,6 @@ # $ nix run nixpkgs.python3Packages.flake8 -c flake8 --ignore E501,E265 update.py import argparse -import fileinput import functools import http import json @@ -124,7 +123,7 @@ def check_for_redirect(self, url: str, req: http.client.HTTPResponse): new_owner, new_name = ( urllib.parse.urlsplit(response_url).path.strip("/").split("/")[:2] ) - end_line = f" as {self.alias}\n" if self.alias else "\n" + end_line = "\n" if self.alias is None else f" as {self.alias}\n" plugin_line = "{owner}/{name}" + end_line old_plugin = plugin_line.format(owner=self.owner, name=self.name) @@ -416,13 +415,14 @@ def generate_nix(plugins: List[Tuple[str, str, Plugin]], outfile: str): print(f"updated {outfile}") -def update_redirects(input_file: Path, output_file: Path, redirects: dict): - with fileinput.input(input_file, inplace=True) as f: - for line in f: - line = " ".join(line.split()) - print(redirects.get(line, line), end="") - print( - f"""\ +def rewrite_input(input_file: Path, output_file: Path, redirects: dict): + with open(input_file, "r") as f: + lines = f.readlines() + + if redirects: + lines = [redirects.get(line, line) for line in lines] + print( + f"""\ Redirects have been detected and {input_file} has been updated. Please take the following steps: 1. Go ahead and commit just the updated expressions as you intended to do: @@ -430,16 +430,19 @@ def update_redirects(input_file: Path, output_file: Path, redirects: dict): git commit -m "vimPlugins: Update" 2. If any of the plugin names were changed, throw an error in aliases.nix: = deprecateName "" ""; # backwards compat, added YYYY-MM-DD - 3. Make sure the updated {input_file} is still correctly sorted: - sort -udf ./vim-plugin-names > sorted && mv sorted vim-plugin-names - 4. Run this script again so these changes will be reflected in the + 3. Run this script again so these changes will be reflected in the generated expressions: ./update.py - 5. Commit {input_file} along with aliases and generated expressions: + 4. Commit {input_file} along with aliases and generated expressions: git add {output_file} {input_file} aliases.nix git commit -m "vimPlugins: Update redirects" -""" - ) + """ + ) + + lines = sorted(lines, key=str.casefold) + + with open(input_file, "w") as f: + f.writelines(lines) def parse_args(): @@ -488,8 +491,7 @@ def main() -> None: generate_nix(plugins, args.outfile) - if redirects: - update_redirects(args.input_file, args.outfile, redirects) + rewrite_input(args.input_file, args.outfile, redirects) if __name__ == "__main__": diff --git a/pkgs/misc/vim-plugins/vim-plugin-names b/pkgs/misc/vim-plugins/vim-plugin-names index 704fc12e39bf0..8ec4e90e39447 100644 --- a/pkgs/misc/vim-plugins/vim-plugin-names +++ b/pkgs/misc/vim-plugins/vim-plugin-names @@ -55,8 +55,8 @@ cocopon/iceberg.vim cohama/lexima.vim ctjhoa/spacevim ctrlpvim/ctrlp.vim -dag/vim2hs dag/vim-fish +dag/vim2hs dannyob/quickfixstatus darfink/starsearch.vim dart-lang/dart-vim-plugin @@ -315,8 +315,8 @@ neoclide/coc-neco neoclide/coc-pairs neoclide/coc-prettier neoclide/coc-python -neoclide/coc-rls neoclide/coc-r-lsp +neoclide/coc-rls neoclide/coc-smartf neoclide/coc-snippets neoclide/coc-solargraph @@ -334,10 +334,10 @@ neoclide/denite-extra neoclide/denite-git neoclide/vim-easygit neomake/neomake +neovim/nvim-lsp +neovim/nvimdev.nvim neovimhaskell/haskell-vim neovimhaskell/nvim-hs.vim -neovim/nvimdev.nvim -neovim/nvim-lsp neutaaaaan/iosvkem nfnty/vim-nftables nicoe/deoplete-khard @@ -505,16 +505,14 @@ Valodim/deoplete-notmuch vhda/verilog_systemverilog.vim vim-airline/vim-airline vim-airline/vim-airline-themes -vimlab/split-term.vim -vimoutliner/vimoutliner vim-pandoc/vim-pandoc vim-pandoc/vim-pandoc-after vim-pandoc/vim-pandoc-syntax vim-ruby/vim-ruby +vim-scripts/a.vim vim-scripts/align vim-scripts/argtextobj.vim vim-scripts/autoload_cscope.vim -vim-scripts/a.vim vim-scripts/bats.vim vim-scripts/changeColorScheme.vim vim-scripts/Colour-Sampler-Pack @@ -538,6 +536,8 @@ vim-scripts/wombat256.vim vim-scripts/YankRing.vim vim-syntastic/syntastic vim-utils/vim-husk +vimlab/split-term.vim +vimoutliner/vimoutliner vimwiki/vimwiki vito-c/jq.vim vmchale/dhall-vim From 7cc024b59e03b33de0a073f9205f47dc18029bde Mon Sep 17 00:00:00 2001 From: ryneeverett Date: Thu, 26 Mar 2020 06:11:20 +0000 Subject: [PATCH 7/8] vimPlugins: Automatic rename deprecations When an updated redirect results in a package name change, not just an owner change, throw an error to warn users the package names has changed. --- pkgs/misc/vim-plugins/aliases.nix | 15 ++++++--------- pkgs/misc/vim-plugins/deprecated.json | 6 ++++++ pkgs/misc/vim-plugins/update.py | 23 +++++++++++++++-------- 3 files changed, 27 insertions(+), 17 deletions(-) create mode 100644 pkgs/misc/vim-plugins/deprecated.json diff --git a/pkgs/misc/vim-plugins/aliases.nix b/pkgs/misc/vim-plugins/aliases.nix index 627008a2aebf9..645b8db7db444 100644 --- a/pkgs/misc/vim-plugins/aliases.nix +++ b/pkgs/misc/vim-plugins/aliases.nix @@ -31,11 +31,12 @@ let (checkInPkgs n alias))) aliases; - deprecateName = oldName: newName: - throw "${oldName} was renamed to ${newName}. Please update to ${newName}."; -in + deprecations = lib.mapAttrs (old: new: + throw "${old} was renamed to ${new}. Please update to ${new}." + ) (builtins.fromJSON (builtins.readFile ./deprecated.json)); -mapAliases { +in +mapAliases ({ airline = vim-airline; alternative = a-vim; # backwards compat, added 2014-10-21 bats = bats-vim; @@ -71,7 +72,6 @@ mapAliases { ghcmod = ghcmod-vim; goyo = goyo-vim; Gist = vim-gist; - gist-vim = deprecateName "vim-gist" "gist-vim"; # backwards compat, added 2020-3-22 gitgutter = vim-gitgutter; gundo = gundo-vim; Gundo = gundo-vim; # backwards compat, added 2015-10-03 @@ -129,17 +129,14 @@ mapAliases { unite = unite-vim; UltiSnips = ultisnips; vim-addon-vim2nix = vim2nix; - vim-jade = deprecateName "vim-pug" "vim-jade"; # backwards compat, added 2020-3-22 vimproc = vimproc-vim; vimshell = vimshell-vim; vinegar = vim-vinegar; - vundle = deprecateName "Vundle-vim" "vundle"; # backwards compat, added 2020-3-22 watchdogs = vim-watchdogs; WebAPI = webapi-vim; wombat256 = wombat256-vim; # backwards compat, added 2015-7-8 yankring = YankRing-vim; Yankring = YankRing-vim; - youcompleteme = deprecateName "YouCompleteMe" "youcompleteme"; # backwards compat, added 2020-3-22 xterm-color-table = xterm-color-table-vim; zeavim = zeavim-vim; -} +} // deprecations) diff --git a/pkgs/misc/vim-plugins/deprecated.json b/pkgs/misc/vim-plugins/deprecated.json new file mode 100644 index 0000000000000..bb4ad18c3ecdc --- /dev/null +++ b/pkgs/misc/vim-plugins/deprecated.json @@ -0,0 +1,6 @@ +{ + "gist-vim": "vim-gist", + "vim-jade": "vim-pug", + "vundle": "Vundle.vim", + "youcompleteme": "YouCompleteMe" +} \ No newline at end of file diff --git a/pkgs/misc/vim-plugins/update.py b/pkgs/misc/vim-plugins/update.py index ac959f055b488..d513669d0f320 100755 --- a/pkgs/misc/vim-plugins/update.py +++ b/pkgs/misc/vim-plugins/update.py @@ -34,6 +34,7 @@ ROOT = Path(__file__).parent DEFAULT_IN = ROOT.joinpath("vim-plugin-names") DEFAULT_OUT = ROOT.joinpath("generated.nix") +DEPRECATED = ROOT.joinpath("deprecated.json") import time from functools import wraps @@ -130,9 +131,6 @@ def check_for_redirect(self, url: str, req: http.client.HTTPResponse): new_plugin = plugin_line.format(owner=new_owner, name=new_name) self.redirect[old_plugin] = new_plugin - if new_name != self.name: - print(f"Plugin Name Changed: {self.name} -> {new_name}") - def prefetch_git(self, ref: str) -> str: data = subprocess.check_output( ["nix-prefetch-git", "--fetch-submodules", self.url(""), ref] @@ -421,6 +419,17 @@ def rewrite_input(input_file: Path, output_file: Path, redirects: dict): if redirects: lines = [redirects.get(line, line) for line in lines] + + with open(DEPRECATED, "r") as f: + deprecations = json.load(f) + for old, new in redirects.items(): + old_name = old.split("/")[1].split(" ")[0].strip("\n") + new_name = new.split("/")[1].split(" ")[0].strip("\n") + if old_name != new_name: + deprecations[old_name] = new_name + with open(DEPRECATED, "w") as f: + json.dump(deprecations, f, indent=4, sort_keys=True) + print( f"""\ Redirects have been detected and {input_file} has been updated. Please take the @@ -428,13 +437,11 @@ def rewrite_input(input_file: Path, output_file: Path, redirects: dict): 1. Go ahead and commit just the updated expressions as you intended to do: git add {output_file} git commit -m "vimPlugins: Update" - 2. If any of the plugin names were changed, throw an error in aliases.nix: - = deprecateName "" ""; # backwards compat, added YYYY-MM-DD - 3. Run this script again so these changes will be reflected in the + 2. Run this script again so these changes will be reflected in the generated expressions: ./update.py - 4. Commit {input_file} along with aliases and generated expressions: - git add {output_file} {input_file} aliases.nix + 3. Commit {input_file} along with deprecations and generated expressions: + git add {output_file} {input_file} {DEPRECATED} git commit -m "vimPlugins: Update redirects" """ ) From 25fea4538e475fdec31ff7692778ff315059efb3 Mon Sep 17 00:00:00 2001 From: ryneeverett Date: Fri, 27 Mar 2020 15:38:16 +0000 Subject: [PATCH 8/8] vimPlugins: Store deprecation date. --- pkgs/misc/vim-plugins/aliases.nix | 4 ++-- pkgs/misc/vim-plugins/deprecated.json | 20 ++++++++++++++++---- pkgs/misc/vim-plugins/update.py | 6 +++++- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/pkgs/misc/vim-plugins/aliases.nix b/pkgs/misc/vim-plugins/aliases.nix index 645b8db7db444..74061dcfd588b 100644 --- a/pkgs/misc/vim-plugins/aliases.nix +++ b/pkgs/misc/vim-plugins/aliases.nix @@ -31,8 +31,8 @@ let (checkInPkgs n alias))) aliases; - deprecations = lib.mapAttrs (old: new: - throw "${old} was renamed to ${new}. Please update to ${new}." + deprecations = lib.mapAttrs (old: info: + throw "${old} was renamed to ${info.new} on ${info.date}. Please update to ${info.new}." ) (builtins.fromJSON (builtins.readFile ./deprecated.json)); in diff --git a/pkgs/misc/vim-plugins/deprecated.json b/pkgs/misc/vim-plugins/deprecated.json index bb4ad18c3ecdc..2c02982f6c609 100644 --- a/pkgs/misc/vim-plugins/deprecated.json +++ b/pkgs/misc/vim-plugins/deprecated.json @@ -1,6 +1,18 @@ { - "gist-vim": "vim-gist", - "vim-jade": "vim-pug", - "vundle": "Vundle.vim", - "youcompleteme": "YouCompleteMe" + "gist-vim": { + "date": "2020-03-27", + "new": "vim-gist" + }, + "vim-jade": { + "date": "2020-03-27", + "new": "vim-pug" + }, + "vundle": { + "date": "2020-03-27", + "new": "Vundle.vim" + }, + "youcompleteme": { + "date": "2020-03-27", + "new": "YouCompleteMe" + } } \ No newline at end of file diff --git a/pkgs/misc/vim-plugins/update.py b/pkgs/misc/vim-plugins/update.py index d513669d0f320..bbeef0889f422 100755 --- a/pkgs/misc/vim-plugins/update.py +++ b/pkgs/misc/vim-plugins/update.py @@ -420,13 +420,17 @@ def rewrite_input(input_file: Path, output_file: Path, redirects: dict): if redirects: lines = [redirects.get(line, line) for line in lines] + cur_date_iso = datetime.now().strftime("%Y-%m-%d") with open(DEPRECATED, "r") as f: deprecations = json.load(f) for old, new in redirects.items(): old_name = old.split("/")[1].split(" ")[0].strip("\n") new_name = new.split("/")[1].split(" ")[0].strip("\n") if old_name != new_name: - deprecations[old_name] = new_name + deprecations[old_name] = { + "new": new_name, + "date": cur_date_iso, + } with open(DEPRECATED, "w") as f: json.dump(deprecations, f, indent=4, sort_keys=True)