diff options
author | Sainnhe Park | 2023-09-19 16:27:01 +0800 |
---|---|---|
committer | Sainnhe Park | 2023-09-19 16:27:01 +0800 |
commit | db82a4907171ff72f5d324003447c82342f1ddbc (patch) | |
tree | 3971af9427c847b9ac70841962eb24352ca2d107 | |
parent | 61cb9678250560e1d6d9accb45df44fbea6496a5 (diff) | |
download | aur-db82a4907171ff72f5d324003447c82342f1ddbc.tar.gz |
Use python to patch
-rw-r--r-- | .SRCINFO | 5 | ||||
-rw-r--r-- | PKGBUILD | 8 | ||||
-rw-r--r-- | package.json.patch | 11 | ||||
-rwxr-xr-x | patch.py | 13 |
4 files changed, 20 insertions, 17 deletions
@@ -8,13 +8,14 @@ pkgbase = neovim-coc-rust-analyzer-git makedepends = yarn makedepends = npm makedepends = git + makedepends = python depends = neovim-coc depends = rust-analyzer provides = neovim-coc-rust-analyzer conflicts = neovim-coc-rust-analyzer source = coc-rust-analyzer::git+https://github.com/fannheyward/coc-rust-analyzer.git - source = package.json.patch + source = patch.py sha256sums = SKIP - sha256sums = 157e798a11ae75f4ee6e797ea800249a3ea452ff0ae19c9b9e0529d7f6f19e30 + sha256sums = 5b734b06d80a148fc3b0f5df841c669bc8d82b465e59b222dca9519b0bfc423c pkgname = neovim-coc-rust-analyzer-git @@ -10,14 +10,14 @@ provides=("${_variant}-${_extname}") conflicts=("${_variant}-${_extname}") arch=('any') depends=("${_variant}-coc" 'rust-analyzer') -makedepends=('yarn' 'npm' 'git') +makedepends=('yarn' 'npm' 'git' 'python') license=('MIT') source=("${_extname}::git+${url}.git" - 'package.json.patch') + 'patch.py') pkgver=r1222.dc17ad2 pkgrel=1 sha256sums=('SKIP' - '157e798a11ae75f4ee6e797ea800249a3ea452ff0ae19c9b9e0529d7f6f19e30') + '5b734b06d80a148fc3b0f5df841c669bc8d82b465e59b222dca9519b0bfc423c') pkgver() { cd "${srcdir}/${_extname}" @@ -41,6 +41,6 @@ package() { install -Dm 644 '{}' "${pkgdir}/${_packdir}/{}" \; rm -rf "${srcdir}/${_extname}/package" find "$pkgdir" -name package.json -print0 | xargs -r -0 sed -i '/_where/d' - patch "$pkgdir/$_packdir/package.json" <"$srcdir/package.json.patch" + "$srcdir/patch.py" "$pkgdir/$_packdir/package.json" chown -R root:root "${pkgdir}" } diff --git a/package.json.patch b/package.json.patch deleted file mode 100644 index 76c7c9e1145e..000000000000 --- a/package.json.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- package.json.old 2022-06-26 19:53:54.778327977 +0800 -+++ package.json.new 2022-06-26 19:56:09.771667299 +0800 -@@ -120,7 +120,7 @@ - "null", - "string" - ], -- "default": null, -+ "default": "/usr/bin/rust-analyzer", - "markdownDescription": "Path to rust-analyzer executable (points to bundled binary by default). If this is set, then \"rust-analyzer.updates.channel\" setting is not used" - }, - "rust-analyzer.server.extraEnv": { diff --git a/patch.py b/patch.py new file mode 100755 index 000000000000..1b15384dba90 --- /dev/null +++ b/patch.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +import sys +import json +import os + +file_path = sys.argv[1] + +with open(file_path, "r") as rfile: + data = json.load(rfile) +data["contributes"]["configuration"]["properties"]["rust-analyzer.server.path"]["default"] = "/usr/bin/rust-analyzer" +with open(file_path, "w") as wfile: + json.dump(data, wfile, indent='\t') |