summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorSainnhe Park2021-04-05 15:59:10 +0800
committerSainnhe Park2021-04-05 15:59:10 +0800
commitdffa6fc887503d8ba4b448b119633547fd0835a4 (patch)
tree35a54905f1b1e9770cde021c4bea65dfd8700d20
parent5fd1ae9d26bbf6d48fa22850c883394aa27cec91 (diff)
downloadaur-dffa6fc887503d8ba4b448b119633547fd0835a4.tar.gz
[Break Change] Unblock some extensions that are specific to the official build
What this package did before this update is simply patching the `"extensionsGallery"` section in `/usr/lib/code/product.json` to let code oss use vscode marketplace. This can be implemented via patching from a single diff file. But I want to add an extra feature -- unblock some extensions that are specific to the official build. You may have noticed that some extensions like pylance and remote-ssh doesn't work in code oss, this can be fixed via patching the `"nameLong"` and `"extensionAllowedProposedApi"` section in `/usr/lib/code/product.json` (thanks to [@Lightsword](https://www.reddit.com/r/linux/comments/k0s8qw/vs_code_developers_prevent_running_the_new/gdmdqkb/)). But patching these two section can't be done via the `patch` command, because the generated diff file contains many parts that are frequently changed. That's said, a diff file will no longer work after a new version of vscode is released, so I have to use `sed` to manually patch it, but this will produce an error during this update as you may have already noticed. To fix it, execute the following commands: 1. Remove the product.json.orig file: `sudo rm /usr/lib/code/product.json.orig`. 2. Reinstall the `code` package: `sudo pacman -S code`.
-rw-r--r--.SRCINFO13
-rw-r--r--PKGBUILD16
-rw-r--r--code-marketplace.hook2
-rw-r--r--code-marketplace.install8
-rwxr-xr-xpatch.sh17
-rw-r--r--product_json.patch23
6 files changed, 37 insertions, 42 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 14d37373323b..d19e5654dc1b 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,16 +1,17 @@
pkgbase = code-marketplace
- pkgdesc = Enable vscode marketplace in Code OSS
- pkgver = 1.50.1
- pkgrel = 2
+ pkgdesc = Enable vscode marketplace in Code OSS, and unblock some extensions that are specific to the official build.
+ pkgver = 1.54.3
+ pkgrel = 1
url = https://marketplace.visualstudio.com/vscode
install = code-marketplace.install
arch = any
license = unknown
depends = code
+ depends = sed
source = code-marketplace.hook
- source = product_json.patch
- md5sums = 42452c5db24228e26f80fbdffc61ab55
- md5sums = 9e476c8aae4243010d6a1c18e56ac402
+ source = patch.sh
+ md5sums = b7442876feb4ba8b1ffb193b01fd4ff8
+ md5sums = d9cd7ce72d6fd9699d1a19029f29084a
pkgname = code-marketplace
diff --git a/PKGBUILD b/PKGBUILD
index 8fa9cd6ba334..3d1260259cef 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,19 +1,19 @@
# Maintainer: Sainnhe Park <sainnhe@gmail.com>
pkgname=code-marketplace
-pkgver=1.50.1
-pkgrel=2
-pkgdesc='Enable vscode marketplace in Code OSS'
+pkgver=1.54.3
+pkgrel=1
+pkgdesc='Enable vscode marketplace in Code OSS, and unblock some extensions that are specific to the official build.'
arch=('any')
url='https://marketplace.visualstudio.com/vscode'
license=('unknown')
-depends=('code')
+depends=('code' 'sed')
install="${pkgname}.install"
source=('code-marketplace.hook'
- 'product_json.patch')
-md5sums=('42452c5db24228e26f80fbdffc61ab55'
- '9e476c8aae4243010d6a1c18e56ac402')
+ 'patch.sh')
+md5sums=('b7442876feb4ba8b1ffb193b01fd4ff8'
+ 'd9cd7ce72d6fd9699d1a19029f29084a')
package() {
install -Dm 644 "${srcdir}"/code-marketplace.hook "${pkgdir}"/usr/share/libalpm/hooks/code-marketplace.hook
- install -Dm 644 "${srcdir}"/product_json.patch "${pkgdir}"/usr/lib/code/product_json.patch
+ install -Dm 755 "${srcdir}"/patch.sh "${pkgdir}"/usr/share/code-marketplace/patch.sh
}
diff --git a/code-marketplace.hook b/code-marketplace.hook
index 835af73254e7..fc55ff9d66fe 100644
--- a/code-marketplace.hook
+++ b/code-marketplace.hook
@@ -6,5 +6,5 @@ Target = usr/lib/code/product.json
[Action]
Description = Patching product.json...
-Exec = /usr/bin/bash -c "[ -f /usr/lib/code/product.json ] && /usr/bin/patch /usr/lib/code/product.json </usr/lib/code/product_json.patch || echo 'Failed to patch product.json. This package is only tested in [community/code 1.50.1-1].'"
+Exec = /usr/share/code-marketplace/patch.sh
When = PostTransaction
diff --git a/code-marketplace.install b/code-marketplace.install
index 2b7fa59989db..4f43e28fd979 100644
--- a/code-marketplace.install
+++ b/code-marketplace.install
@@ -1,15 +1,15 @@
post_install() {
- [ -f /usr/lib/code/product.json ] && /usr/bin/patch /usr/lib/code/product.json </usr/lib/code/product_json.patch || echo 'Failed to patch product.json. This package is only tested in [community/code 1.50.1-1].'
+ /usr/share/code-marketplace/patch.sh
}
pre_upgrade() {
- [ -f /usr/lib/code/product.json ] && /usr/bin/patch -R /usr/lib/code/product.json </usr/lib/code/product_json.patch || echo 'Failed to patch product.json. This package is only tested in [community/code 1.50.1-1].'
+ /usr/share/code-marketplace/patch.sh -R
}
post_upgrade() {
- [ -f /usr/lib/code/product.json ] && /usr/bin/patch /usr/lib/code/product.json </usr/lib/code/product_json.patch || echo 'Failed to patch product.json. This package is only tested in [community/code 1.50.1-1].'
+ /usr/share/code-marketplace/patch.sh
}
pre_remove() {
- [ -f /usr/lib/code/product.json ] && /usr/bin/patch -R /usr/lib/code/product.json </usr/lib/code/product_json.patch || echo 'Failed to patch product.json. This package is only tested in [community/code 1.50.1-1].'
+ /usr/share/code-marketplace/patch.sh -R
}
diff --git a/patch.sh b/patch.sh
new file mode 100755
index 000000000000..80caeabcc71b
--- /dev/null
+++ b/patch.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env sh
+
+if [ "${1}" = "-R" ]; then
+ sed -i 's/^[[:blank:]]*"serviceUrl":.*/\t\t"serviceUrl": "https:\/\/open-vsx.org\/vscode\/gallery",/' /usr/lib/code/product.json
+ sed -i '/^[[:blank:]]*"cacheUrl/d' /usr/lib/code/product.json
+ sed -i 's/^[[:blank:]]*"itemUrl":.*/\t\t"itemUrl": "https:\/\/open-vsx.org\/vscode\/item"/' /usr/lib/code/product.json
+ sed -i '/^[[:blank:]]*"documentationUrl/i\\t"linkProtectionTrustedDomains": ["https://open-vsx.org"],' /usr/lib/code/product.json
+ sed -i 's/^[[:blank:]]*"nameLong":.*/\t"nameLong": "Code - OSS",/' /usr/lib/code/product.json
+ sed -i 's/^[[:blank:]]*"extensionAllowedProposedApi":.*/\t"extensionAllowedProposedApi": ["ms-vscode.vscode-js-profile-flame", "ms-vscode.vscode-js-profile-table", "ms-vscode.github-browser", "ms-vscode.github-richnav"],/' /usr/lib/code/product.json
+else
+ sed -i 's/^[[:blank:]]*"serviceUrl":.*/\t\t"serviceUrl": "https:\/\/marketplace.visualstudio.com\/_apis\/public\/gallery",/' /usr/lib/code/product.json
+ sed -i '/^[[:blank:]]*"serviceUrl/a\\t\t"cacheUrl": "https:\/\/vscode.blob.core.windows.net\/gallery\/index",' /usr/lib/code/product.json
+ sed -i 's/^[[:blank:]]*"itemUrl":.*/\t\t"itemUrl": "https:\/\/marketplace.visualstudio.com\/items"/' /usr/lib/code/product.json
+ sed -i '/^[[:blank:]]*"linkProtectionTrustedDomains/d' /usr/lib/code/product.json
+ sed -i 's/^[[:blank:]]*"nameLong":.*/\t"nameLong": "Visual Studio Code",/' /usr/lib/code/product.json
+ sed -i 's/^[[:blank:]]*"extensionAllowedProposedApi":.*/\t"extensionAllowedProposedApi": ["GitHub.codespaces", "GitHub.vscode-pull-request-github-insiders", "GitHub.vscode-pull-request-github", "Microsoft.vscode-nmake-tools", "ms-ai-tools.notebook-renderers", "ms-dotnettools.dotnet-interactive-vscode", "ms-python.gather", "ms-python.python", "ms-toolsai.jupyter", "ms-toolsai.vscode-ai", "ms-toolsai.vscode-ai-remote", "ms-vscode-remote.remote-containers-nightly", "ms-vscode-remote.remote-containers", "ms-vscode-remote.remote-ssh-edit-nightly", "ms-vscode-remote.remote-ssh-edit", "ms-vscode-remote.remote-ssh-nightly", "ms-vscode-remote.remote-ssh", "ms-vscode-remote.remote-wsl-nightly", "ms-vscode-remote.remote-wsl", "ms-vscode-remote.remote-wsl-recommender", "ms-vscode-remote.vscode-remote-extensionpack-nightly", "ms-vscode-remote.vscode-remote-extensionpack", "ms-vscode.azure-account", "ms-vscode.azure-sphere-tools-ui", "ms-vscode.azure-sphere-tools", "ms-vscode.github-browser", "ms-vscode.github-richnav", "ms-vscode.js-debug-nightly", "ms-vscode.js-debug", "ms-vscode.lsif-browser", "ms-vscode.vscode-js-profile-flame", "ms-vscode.vscode-js-profile-table", "ms-vscode.vscode-selfhost-test-provider", "ms-vsliveshare.cloudenv-explorer", "ms-vsliveshare.cloudenv", "ms-vsliveshare.vsliveshare", "ms-vsonline.vsonline", "dbaeumer.vscode-eslint"],/' /usr/lib/code/product.json
+fi
diff --git a/product_json.patch b/product_json.patch
deleted file mode 100644
index ff3b8ec1854e..000000000000
--- a/product_json.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- product.json 2020-10-15 18:25:40.000000000 +0800
-+++ /usr/lib/code/product.json 2020-10-28 21:19:42.844503712 +0800
-@@ -1,10 +1,10 @@
- {
- "quality": "stable",
- "extensionsGallery": {
-- "serviceUrl": "https://open-vsx.org/vscode/gallery",
-- "itemUrl": "https://open-vsx.org/vscode/item"
-+ "serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery",
-+ "cacheUrl": "https://vscode.blob.core.windows.net/gallery/index",
-+ "itemUrl": "https://marketplace.visualstudio.com/items"
- },
-- "linkProtectionTrustedDomains": ["https://open-vsx.org"],
- "documentationUrl": "https://code.visualstudio.com/docs",
- "requestFeatureUrl": "https://github.com/Microsoft/vscode/issues",
- "introductoryVideosUrl": "https://go.microsoft.com/fwlink/?linkid=832146",
-@@ -144,4 +144,4 @@
- "vs/code/electron-browser/workbench/workbench.html": "DCAx76TE79oJvbVEouBCXQ",
- "vs/code/electron-browser/workbench/workbench.js": "EWRP4AdsNbp965Vz0YEmAA"
- }
--}
-\ No newline at end of file
-+}