Merged
优化软件包空间占用 #11
wangkui35Add on Dec 6, 2024
优化软件包空间占用 #11
Merged
Merged fromrefs/pull/11/headintomaster
Total: 15 files changed+155-99
| @@ -0,0 +1 @@ | |||
| 1 | +b988dc4f8094b8600a1184e070fa121a5c197ae56ec0c8eaaa1e5f55771eb6d1 node_modules-build-aarch64.tar.gz | ||
| @@ -0,0 +1 @@ | |||
| 1 | +4ed672d55bdfba759146fba1ff2a0306c7a1ec9c0c245270e260e3babb2d51fb node_modules-build-x86_64.tar.gz | ||
Binary files do not support preview
Binary files do not support preview
Binary files do not support preview
Binary files do not support preview
Binary files do not support preview
| @@ -1,24 +1,124 @@ | |||
| 1 | +diff --git a/build/linux/dependencies-generator.js b/build/linux/dependencies-generator.js | ||
| 2 | +index 21c4236aadc..bbc5a1c3411 100644 | ||
| 3 | +--- a/build/linux/dependencies-generator.js | ||
| 4 | ++++ b/build/linux/dependencies-generator.js | ||
| 5 | +@@ -23,7 +23,7 @@ const esm_1 = require("../lib/esm"); | ||
| 6 | + // If true, we fail the build if there are new dependencies found during that task. | ||
| 7 | + // The reference dependencies, which one has to update when the new dependencies | ||
| 8 | + // are valid, are in dep-lists.ts | ||
| 9 | +-const FAIL_BUILD_FOR_NEW_DEPENDENCIES = true; | ||
| 10 | ++const FAIL_BUILD_FOR_NEW_DEPENDENCIES = false; | ||
| 11 | + // Based on https://source.chromium.org/chromium/chromium/src/+/refs/tags/124.0.6367.243:chrome/installer/linux/BUILD.gn;l=64-80 | ||
| 12 | + // and the Linux Archive build | ||
| 13 | + // Shared library dependencies that we already bundle. | ||
| 1 | diff --git a/package.json b/package.json | 14 | diff --git a/package.json b/package.json |
| 2 | -index 13fc4f4cabe..5751b32edba 100644 | 15 | +index 13fc4f4cabe..56c01a14595 100644 |
| 3 | --- a/package.json | 16 | --- a/package.json |
| 4 | +++ b/package.json | 17 | +++ b/package.json |
| 5 | @@ -1,5 +1,5 @@ | 18 | @@ -1,5 +1,5 @@ |
| 6 | { | 19 | { |
| 7 | - "name": "code-oss-dev", | 20 | - "name": "code-oss-dev", |
| 8 | -+ "name": "Code", | 21 | ++ "name": "code", |
| 9 | "version": "1.93.1", | 22 | "version": "1.93.1", |
| 10 | "distro": "2560b0e8d341a0b6734d28ef71b08e1920ff2501", | 23 | "distro": "2560b0e8d341a0b6734d28ef71b08e1920ff2501", |
| 11 | "author": { | 24 | "author": { |
| 12 | diff --git a/product.json b/product.json | 25 | diff --git a/product.json b/product.json |
| 13 | -index 908be250245..bddd849e97b 100644 | 26 | +index 908be250245..95205f5673b 100644 |
| 14 | --- a/product.json | 27 | --- a/product.json |
| 15 | +++ b/product.json | 28 | +++ b/product.json |
| 16 | -@@ -1,6 +1,6 @@ | 29 | +@@ -1,8 +1,11 @@ |
| 17 | { | 30 | { |
| 18 | - "nameShort": "Code - OSS", | 31 | - "nameShort": "Code - OSS", |
| 19 | - "nameLong": "Code - OSS", | 32 | - "nameLong": "Code - OSS", |
| 33 | +- "applicationName": "code-oss", | ||
| 34 | +- "dataFolderName": ".vscode-oss", | ||
| 20 | + "nameShort": "Code", | 35 | + "nameShort": "Code", |
| 21 | + "nameLong": "Visual Studio Code", | 36 | + "nameLong": "Visual Studio Code", |
| 22 | - "applicationName": "code-oss", | 37 | ++ "commit": "38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40", |
| 23 | - "dataFolderName": ".vscode-oss", | 38 | ++ "date": "2024-09-11T17:20:05.685Z", |
| 39 | ++ "version": "1.93.1", | ||
| 40 | ++ "applicationName": "code", | ||
| 41 | ++ "dataFolderName": ".vscode", | ||
| 24 | "win32MutexName": "vscodeoss", | 42 | "win32MutexName": "vscodeoss", |
| 43 | + "licenseName": "MIT", | ||
| 44 | + "licenseUrl": "https://github.com/microsoft/vscode/blob/main/LICENSE.txt", | ||
| 45 | +@@ -10,9 +13,9 @@ | ||
| 46 | + "serverGreeting": [], | ||
| 47 | + "serverLicense": [], | ||
| 48 | + "serverLicensePrompt": "", | ||
| 49 | +- "serverApplicationName": "code-server-oss", | ||
| 50 | +- "serverDataFolderName": ".vscode-server-oss", | ||
| 51 | +- "tunnelApplicationName": "code-tunnel-oss", | ||
| 52 | ++ "serverApplicationName": "code-Server", | ||
| 53 | ++ "serverDataFolderName": ".vscode-server", | ||
| 54 | ++ "tunnelApplicationName": "code-tunnel", | ||
| 55 | + "win32DirName": "Microsoft Code OSS", | ||
| 56 | + "win32NameVersion": "Microsoft Code OSS", | ||
| 57 | + "win32RegValueName": "CodeOSS", | ||
| 58 | +@@ -25,60 +28,15 @@ | ||
| 59 | + "win32TunnelServiceMutex": "vscodeoss-tunnelservice", | ||
| 60 | + "win32TunnelMutex": "vscodeoss-tunnel", | ||
| 61 | + "darwinBundleIdentifier": "com.visualstudio.code.oss", | ||
| 62 | +- "linuxIconName": "code-oss", | ||
| 63 | ++ "linuxIconName": "code", | ||
| 64 | + "licenseFileName": "LICENSE.txt", | ||
| 65 | + "reportIssueUrl": "https://github.com/microsoft/vscode/issues/new", | ||
| 66 | + "nodejsRepository": "https://nodejs.org", | ||
| 67 | + "urlProtocol": "code-oss", | ||
| 68 | + "webviewContentExternalBaseUrlTemplate": "https://{{uuid}}.vscode-cdn.net/insider/ef65ac1ba57f57f2a3961bfe94aa20481caca4c6/out/vs/workbench/contrib/webview/browser/pre/", | ||
| 69 | +- "builtInExtensions": [ | ||
| 70 | +- { | ||
| 71 | +- "name": "ms-vscode.js-debug-companion", | ||
| 72 | +- "version": "1.1.3", | ||
| 73 | +- "sha256": "7380a890787452f14b2db7835dfa94de538caf358ebc263f9d46dd68ac52de93", | ||
| 74 | +- "repo": "https://github.com/microsoft/vscode-js-debug-companion", | ||
| 75 | +- "metadata": { | ||
| 76 | +- "id": "99cb0b7f-7354-4278-b8da-6cc79972169d", | ||
| 77 | +- "publisherId": { | ||
| 78 | +- "publisherId": "5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee", | ||
| 79 | +- "publisherName": "ms-vscode", | ||
| 80 | +- "displayName": "Microsoft", | ||
| 81 | +- "flags": "verified" | ||
| 82 | +- }, | ||
| 83 | +- "publisherDisplayName": "Microsoft" | ||
| 84 | +- } | ||
| 85 | +- }, | ||
| 86 | +- { | ||
| 87 | +- "name": "ms-vscode.js-debug", | ||
| 88 | +- "version": "1.93.0", | ||
| 89 | +- "sha256": "9339cb8e6b77f554df54d79e71f533279cb76b0f9b04c207f633bfd507442b6a", | ||
| 90 | +- "repo": "https://github.com/microsoft/vscode-js-debug", | ||
| 91 | +- "metadata": { | ||
| 92 | +- "id": "25629058-ddac-4e17-abba-74678e126c5d", | ||
| 93 | +- "publisherId": { | ||
| 94 | +- "publisherId": "5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee", | ||
| 95 | +- "publisherName": "ms-vscode", | ||
| 96 | +- "displayName": "Microsoft", | ||
| 97 | +- "flags": "verified" | ||
| 98 | +- }, | ||
| 99 | +- "publisherDisplayName": "Microsoft" | ||
| 100 | +- } | ||
| 101 | +- }, | ||
| 102 | +- { | ||
| 103 | +- "name": "ms-vscode.vscode-js-profile-table", | ||
| 104 | +- "version": "1.0.9", | ||
| 105 | +- "sha256": "3b62ee4276a2bbea3fe230f94b1d5edd915b05966090ea56f882e1e0ab53e1a6", | ||
| 106 | +- "repo": "https://github.com/microsoft/vscode-js-profile-visualizer", | ||
| 107 | +- "metadata": { | ||
| 108 | +- "id": "7e52b41b-71ad-457b-ab7e-0620f1fc4feb", | ||
| 109 | +- "publisherId": { | ||
| 110 | +- "publisherId": "5f5636e7-69ed-4afe-b5d6-8d231fb3d3ee", | ||
| 111 | +- "publisherName": "ms-vscode", | ||
| 112 | +- "displayName": "Microsoft", | ||
| 113 | +- "flags": "verified" | ||
| 114 | +- }, | ||
| 115 | +- "publisherDisplayName": "Microsoft" | ||
| 116 | +- } | ||
| 117 | +- } | ||
| 118 | +- ] | ||
| 119 | ++ "extensionsGallery": { | ||
| 120 | ++ "serviceUrl": "https://open-vsx.org/vscode/gallery", | ||
| 121 | ++ "itemUrl": "https://open-vsx.org/vscode/item" | ||
| 122 | ++ }, | ||
| 123 | ++ "builtInExtensions": [] | ||
| 124 | + } | ||
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | Name: code | 3 | Name: code |
| 4 | Version: 1.93.1 | 4 | Version: 1.93.1 |
| 5 | -Release: 2 | 5 | +Release: 3 |
| 6 | License: MIT | 6 | License: MIT |
| 7 | Group: Development/Tools | 7 | Group: Development/Tools |
| 8 | Summary: Code editing. Redefined. | 8 | Summary: Code editing. Redefined. |
| @@ -11,11 +11,7 @@ AutoReq: 0 | |||
| 11 | 11 | ||
| 12 | %global __provides_exclude_from ^%{_datadir}/%{name}/.*\\.so.*$ | 12 | %global __provides_exclude_from ^%{_datadir}/%{name}/.*\\.so.*$ |
| 13 | 13 | ||
| 14 | -Source0: vscode-%{version}_aa | 14 | +Source0: vscode-%{version}.tar.gz |
| 15 | -Source1: vscode-%{version}_ab | ||
| 16 | -Source2: vscode-%{version}_ac | ||
| 17 | -Source3: vscode-%{version}_ad | ||
| 18 | -Source4: %{name}.png | ||
| 19 | 15 | ||
| 20 | Patch1: vscode-name.patch | 16 | Patch1: vscode-name.patch |
| 21 | 17 | ||
| @@ -27,6 +23,7 @@ BuildRequires: gcc-c++ | |||
| 27 | BuildRequires: make | 23 | BuildRequires: make |
| 28 | BuildRequires: npm | 24 | BuildRequires: npm |
| 29 | BuildRequires: wget | 25 | BuildRequires: wget |
| 26 | +BuildRequires: unzip | ||
| 30 | BuildRequires: pkg-config | 27 | BuildRequires: pkg-config |
| 31 | BuildRequires: libX11-devel | 28 | BuildRequires: libX11-devel |
| 32 | BuildRequires: libxkbfile-devel | 29 | BuildRequires: libxkbfile-devel |
| @@ -51,97 +48,49 @@ snippets, code refactoring, and embedded Git. | |||
| 51 | 48 | ||
| 52 | %prep | 49 | %prep |
| 53 | pushd %{_sourcedir} | 50 | pushd %{_sourcedir} |
| 54 | -cat vscode-%{version}_a* > vscode-%{version}.tar.gz | 51 | +cat node_modules-build-$(arch)a* > node_modules-build-$(arch).tar.gz |
| 55 | -sha256sum -c checksum | 52 | +sha256sum -c checksum-$(arch) |
| 56 | -popd | ||
| 57 | - | ||
| 58 | -rm -rf vscode-%{version} | ||
| 59 | - | ||
| 60 | -mkdir -p vscode-%{version} | ||
| 61 | -pushd vscode-%{version} | ||
| 62 | -tar -xf %{_sourcedir}/vscode-%{version}.tar.gz --strip-components=1 | ||
| 63 | -pwd | xargs git config --global --add safe.directory | ||
| 64 | -git checkout %{version} | ||
| 65 | - | ||
| 66 | -%patch1 -p1 | ||
| 67 | -cp -r %{_sourcedir}/%{name}.png resources/linux/%{name}.png | ||
| 68 | -cp -r %{_sourcedir}/%{name}.png resources/server/%{name}-192.png | ||
| 69 | -cp -r %{_sourcedir}/%{name}.png resources/server/%{name}-512.png | ||
| 70 | - | ||
| 71 | -popd | ||
| 72 | - | ||
| 73 | -%build | ||
| 74 | -pushd vscode-%{version} | ||
| 75 | -npm config set registry https://repo.huaweicloud.com/repository/npm/ | ||
| 76 | -yarn config set registry https://repo.huaweicloud.com/repository/npm/ | ||
| 77 | -set +e | ||
| 78 | -for i in {1..10}; do | ||
| 79 | - yarn install --verbose --network-timeout 6000 | ||
| 80 | - if [ $? -eq 0 ]; then | ||
| 81 | - break | ||
| 82 | - fi | ||
| 83 | -done | ||
| 84 | -set -e | ||
| 85 | -npm run compile | ||
| 86 | -npm run electron | ||
| 87 | -bash ./scripts/code-cli.sh | true | ||
| 88 | -popd | ||
| 89 | - | ||
| 90 | -%install | ||
| 91 | -pushd vscode-%{version} | ||
| 92 | -mkdir -p %{buildroot}%{_datadir}/%{name} | ||
| 93 | -mkdir -p %{buildroot}%{_datadir}/%{name}/bin | ||
| 94 | -mkdir -p %{buildroot}%{_datadir}/applications | ||
| 95 | -mkdir -p %{buildroot}%{_datadir}/appdata | ||
| 96 | -mkdir -p %{buildroot}%{_datadir}/mime/packages | ||
| 97 | -mkdir -p %{buildroot}%{_datadir}/pixmaps | ||
| 98 | - | ||
| 99 | -install -Dm 0755 resources/linux/bin/%{name}.sh %{buildroot}%{_datadir}/%{name}/bin/%{name} | ||
| 100 | -sed -i "s/@@APPNAME@@/code/g" %{buildroot}%{_datadir}/%{name}/bin/%{name} | ||
| 101 | -sed -i "s/@@PRODNAME@@/Visual Studio Code/g" %{buildroot}%{_datadir}/%{name}/bin/%{name} | ||
| 102 | -sed -i "s/@@APPNAME@@/code/g" %{buildroot}%{_datadir}/%{name}/bin/%{name} | ||
| 103 | -sed -i "60s/code/code-oss/g" %{buildroot}%{_datadir}/%{name}/bin/%{name} | ||
| 104 | -sed -i "60iexport VSCODE_CLI=0" %{buildroot}%{_datadir}/%{name}/bin/%{name} | ||
| 105 | -sed -i "60iexport VSCODE_DEV=0" %{buildroot}%{_datadir}/%{name}/bin/%{name} | ||
| 106 | - | ||
| 107 | -cp -arf .build/electron/* %{buildroot}%{_datadir}/%{name}/ | ||
| 108 | - | ||
| 109 | -mkdir -p %{buildroot}%{_datadir}/%{name}/resources/app | ||
| 110 | -cp -arf extensions %{buildroot}%{_datadir}/%{name}/resources/app/ | ||
| 111 | -cp -arf node_modules %{buildroot}%{_datadir}/%{name}/resources/app/ | ||
| 112 | -cp -arf out %{buildroot}%{_datadir}/%{name}/resources/app/ | ||
| 113 | -cp -arf product.json %{buildroot}%{_datadir}/%{name}/resources/app/ | ||
| 114 | -cp -arf package.json %{buildroot}%{_datadir}/%{name}/resources/app/ | ||
| 115 | -cp -arf resources/completions %{buildroot}%{_datadir}/%{name}/resources/ | ||
| 116 | -sed -i "s/@@APPNAME@@/code/g" %{buildroot}%{_datadir}/%{name}/resources/completions/zsh/_%{name} | ||
| 117 | -sed -i "s/@@APPNAME@@/code/g" %{buildroot}%{_datadir}/%{name}/resources/completions/bash/%{name} | ||
| 118 | - | ||
| 119 | -# Support files | ||
| 120 | -cp -r resources/linux/%{name}.desktop %{buildroot}%{_datadir}/applications | ||
| 121 | -cp -r resources/linux/%{name}-url-handler.desktop %{buildroot}%{_datadir}/applications | ||
| 122 | -cp -r resources/linux/%{name}.appdata.xml %{buildroot}%{_datadir}/appdata | ||
| 123 | -cp -r resources/linux/%{name}-workspace.xml %{buildroot}%{_datadir}/mime/packages/%{name}-workspace.xml | ||
| 124 | -cp -r %{_sourcedir}/%{name}.png %{buildroot}%{_datadir}/pixmaps | ||
| 125 | -sed -i "s/@@NAME_LONG@@/Visual Studio Code/g" %{buildroot}%{_datadir}/applications/* | ||
| 126 | -sed -i "s/@@EXEC@@/\/usr\/share\/code\/bin\/code/g" %{buildroot}%{_datadir}/applications/* | ||
| 127 | -sed -i "s/@@ICON@@/code/g" %{buildroot}%{_datadir}/applications/* | ||
| 128 | -sed -i "s/@@URLPROTOCOL@@/vscode/g" %{buildroot}%{_datadir}/applications/* | ||
| 129 | -sed -i "s/@@NAME_SHORT@@/Code/g" %{buildroot}%{_datadir}/applications/* | ||
| 130 | -sed -i "s/@@NAME@@/code/g" %{buildroot}%{_datadir}/applications/* | ||
| 131 | -sed -i "s/@@LICENSE@@/Multiple, see https:\/\/code.visualstudio.com\/license/g" %{buildroot}%{_datadir}/appdata/%{name}.appdata.xml | ||
| 132 | -sed -i "s/@@NAME_LONG@@/Visual Studio Code/g" %{buildroot}%{_datadir}/appdata/%{name}.appdata.xml | ||
| 133 | -sed -i "s/@@NAME@@/Visual Studio Code/g" %{buildroot}%{_datadir}/appdata/%{name}.appdata.xml | ||
| 134 | -sed -i "s/@@NAME_LONG@@/Visual Studio Code/g" %{buildroot}%{_datadir}/mime/packages/%{name}-workspace.xml | ||
| 135 | -sed -i "s/@@NAME@@/Visual Studio Code/g" %{buildroot}%{_datadir}/mime/packages/%{name}-workspace.xml | ||
| 136 | -popd | ||
| 137 | 53 | ||
| 54 | +rm -rf ${HOME}/.cache/electron/edda2a221019110621f56af6c7a459e02ca6fa574ebe09e0e88459fec84f3238/ | ||
| 55 | +mkdir -p ${HOME}/.cache/electron/edda2a221019110621f56af6c7a459e02ca6fa574ebe09e0e88459fec84f3238/ | ||
| 138 | if [ "$(arch)" == "x86_64" ]; then | 56 | if [ "$(arch)" == "x86_64" ]; then |
| 139 | - find %{buildroot}%{_datadir}/ -name *-arm64 | xargs rm -rf | 57 | + cp electron-v30.4.0-linux-x64.zip ${HOME}/.cache/electron/edda2a221019110621f56af6c7a459e02ca6fa574ebe09e0e88459fec84f3238/ |
| 140 | else | 58 | else |
| 141 | - find %{buildroot}%{_datadir}/ -name *-x64 | xargs rm -rf | 59 | + cp electron-v30.4.0-linux-arm64.zip ${HOME}/.cache/electron/edda2a221019110621f56af6c7a459e02ca6fa574ebe09e0e88459fec84f3238/ |
| 142 | fi | 60 | fi |
| 143 | 61 | ||
| 144 | -find %{buildroot}%{_datadir}/ -name yarn.lock | xargs rm -rf | 62 | +popd |
| 63 | + | ||
| 64 | +%setup -q -n vscode-%{version} | ||
| 65 | + | ||
| 66 | +%autopatch -p1 -M 1 | ||
| 67 | + | ||
| 68 | + | ||
| 69 | +%build | ||
| 70 | +tar -xf %{_sourcedir}/node_modules-build-$(arch).tar.gz | ||
| 71 | + | ||
| 72 | +if [ "$(arch)" == "x86_64" ]; then | ||
| 73 | + yarn run gulp vscode-linux-x64 | ||
| 74 | + yarn run gulp vscode-linux-x64-prepare-rpm | ||
| 75 | +else | ||
| 76 | + yarn run gulp vscode-linux-arm64 | ||
| 77 | + yarn run gulp vscode-linux-arm64-prepare-rpm | ||
| 78 | +fi | ||
| 79 | + | ||
| 80 | + | ||
| 81 | +%install | ||
| 82 | +mkdir -p %{buildroot}%{_datadir} | ||
| 83 | +cp -arf .build/linux/rpm/$(arch)/rpmbuild/BUILD/usr/share/* %{buildroot}%{_datadir} | ||
| 84 | + | ||
| 85 | +pushd %{buildroot}%{_datadir}/code/resources/app/extensions | ||
| 86 | +unzip %{_sourcedir}/ms-vscode.js-debug.1.93.0.vsix extension/* | ||
| 87 | +mv extension ms-vscode.js-debug | ||
| 88 | +unzip %{_sourcedir}/ms-vscode.js-debug-companion.1.1.3.vsix extension/* | ||
| 89 | +mv extension ms-vscode.js-debug-companion | ||
| 90 | +unzip %{_sourcedir}/ms-vscode.vscode-js-profile-table.1.0.9.vsix extension/* | ||
| 91 | +mv extension ms-vscode.vscode-js-profile-table | ||
| 92 | +popd | ||
| 93 | + | ||
| 145 | 94 | ||
| 146 | %files | 95 | %files |
| 147 | %{_datadir}/%{name}/ | 96 | %{_datadir}/%{name}/ |
| @@ -149,7 +98,9 @@ find %{buildroot}%{_datadir}/ -name yarn.lock | xargs rm -rf | |||
| 149 | %{_datadir}/applications/%{name}-url-handler.desktop | 98 | %{_datadir}/applications/%{name}-url-handler.desktop |
| 150 | %{_datadir}/appdata/%{name}.appdata.xml | 99 | %{_datadir}/appdata/%{name}.appdata.xml |
| 151 | %{_datadir}/mime/packages/%{name}-workspace.xml | 100 | %{_datadir}/mime/packages/%{name}-workspace.xml |
| 152 | -%{_datadir}/pixmaps/%{name}.png | 101 | +%{_datadir}/pixmaps/code.png |
| 102 | +%{_datadir}/bash-completion/completions/%{name} | ||
| 103 | +%{_datadir}/zsh/site-functions/_%{name} | ||
| 153 | 104 | ||
| 154 | %post | 105 | %post |
| 155 | ln -s %{_datadir}/code/bin/code /usr/bin/code | 106 | ln -s %{_datadir}/code/bin/code /usr/bin/code |
| @@ -162,6 +113,9 @@ update-desktop-database | |||
| 162 | update-mime-database %{_datadir}/mime | 113 | update-mime-database %{_datadir}/mime |
| 163 | 114 | ||
| 164 | %changelog | 115 | %changelog |
| 116 | +* Thu Dec 5 2024 wangkui <wangkui35@h-partner.com> - 1.93.1-3 | ||
| 117 | +- optimized space usage | ||
| 118 | + | ||
| 165 | * Thu Oct 10 2024 wangkui <wangkui35@h-partner.com> - 1.93.1-2 | 119 | * Thu Oct 10 2024 wangkui <wangkui35@h-partner.com> - 1.93.1-2 |
| 166 | - remove git clone | 120 | - remove git clone |
| 167 | 121 | ||