!3 添加vscode

From: @wangkui35 
Reviewed-by: @Lostwayzxc 
Signed-off-by: @Lostwayzxc
This commit is contained in:
openeuler-ci-bot 2024-10-11 02:38:13 +00:00 committed by Gitee
commit 060785f039
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
8 changed files with 194 additions and 0 deletions

1
checksum Normal file
View File

@ -0,0 +1 @@
ba33958f74272b94a085d9724d87d08ea317793e1408cf1c17907990b386d64a vscode-1.93.1.tar.gz

BIN
code.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

BIN
vscode-1.93.1_aa Normal file

Binary file not shown.

BIN
vscode-1.93.1_ab Normal file

Binary file not shown.

BIN
vscode-1.93.1_ac Normal file

Binary file not shown.

BIN
vscode-1.93.1_ad Normal file

Binary file not shown.

24
vscode-name.patch Normal file
View File

@ -0,0 +1,24 @@
diff --git a/package.json b/package.json
index 13fc4f4cabe..5751b32edba 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,5 @@
{
- "name": "code-oss-dev",
+ "name": "Code",
"version": "1.93.1",
"distro": "2560b0e8d341a0b6734d28ef71b08e1920ff2501",
"author": {
diff --git a/product.json b/product.json
index 908be250245..bddd849e97b 100644
--- a/product.json
+++ b/product.json
@@ -1,6 +1,6 @@
{
- "nameShort": "Code - OSS",
- "nameLong": "Code - OSS",
+ "nameShort": "Code",
+ "nameLong": "Visual Studio Code",
"applicationName": "code-oss",
"dataFolderName": ".vscode-oss",
"win32MutexName": "vscodeoss",

169
vscode.spec Normal file
View File

@ -0,0 +1,169 @@
%define debug_package %{nil}
Name: code
Version: 1.93.1
Release: 2
License: MIT
Group: Development/Tools
Summary: Code editing. Redefined.
Url: https://github.com/microsoft/vscode
AutoReq: 0
%global __provides_exclude_from ^%{_datadir}/%{name}/.*\\.so.*$
Source0: vscode-%{version}_aa
Source1: vscode-%{version}_ab
Source2: vscode-%{version}_ac
Source3: vscode-%{version}_ad
Source4: %{name}.png
Patch1: vscode-name.patch
BuildRequires: python3
BuildRequires: git
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: make
BuildRequires: npm
BuildRequires: wget
BuildRequires: pkg-config
BuildRequires: libX11-devel
BuildRequires: libxkbfile-devel
BuildRequires: libsecret-devel
BuildRequires: krb5-devel
BuildRequires: nss
BuildRequires: dbus-devel
BuildRequires: atk-devel
BuildRequires: at-spi2-atk-devel
BuildRequires: cups-libs
BuildRequires: pango
BuildRequires: mesa-libgbm
BuildRequires: alsa-lib
BuildRequires: nodejs-devel
BuildRequires: nodejs-yarn
%description
Visual Studio Code, also commonly referred to as VS Code, is a source-code editor
made by Microsoft with the Electron Framework, for Windows, Linux and macOS.
Features include support for debugging, syntax highlighting, intelligent code completion,
snippets, code refactoring, and embedded Git.
%prep
pushd %{_sourcedir}
cat vscode-%{version}_a* > vscode-%{version}.tar.gz
sha256sum -c checksum
popd
rm -rf vscode-%{version}
mkdir -p vscode-%{version}
pushd vscode-%{version}
tar -xf %{_sourcedir}/vscode-%{version}.tar.gz --strip-components=1
pwd | xargs git config --global --add safe.directory
git checkout %{version}
%patch1 -p1
cp -r %{_sourcedir}/%{name}.png resources/linux/%{name}.png
cp -r %{_sourcedir}/%{name}.png resources/server/%{name}-192.png
cp -r %{_sourcedir}/%{name}.png resources/server/%{name}-512.png
popd
%build
pushd vscode-%{version}
npm config set registry https://repo.huaweicloud.com/repository/npm/
yarn config set registry https://repo.huaweicloud.com/repository/npm/
set +e
for i in {1..10}; do
yarn install --verbose --network-timeout 6000
if [ $? -eq 0 ]; then
break
fi
done
set -e
npm run compile
npm run electron
bash ./scripts/code-cli.sh | true
popd
%install
pushd vscode-%{version}
mkdir -p %{buildroot}%{_datadir}/%{name}
mkdir -p %{buildroot}%{_datadir}/%{name}/bin
mkdir -p %{buildroot}%{_datadir}/applications
mkdir -p %{buildroot}%{_datadir}/appdata
mkdir -p %{buildroot}%{_datadir}/mime/packages
mkdir -p %{buildroot}%{_datadir}/pixmaps
install -Dm 0755 resources/linux/bin/%{name}.sh %{buildroot}%{_datadir}/%{name}/bin/%{name}
sed -i "s/@@APPNAME@@/code/g" %{buildroot}%{_datadir}/%{name}/bin/%{name}
sed -i "s/@@PRODNAME@@/Visual Studio Code/g" %{buildroot}%{_datadir}/%{name}/bin/%{name}
sed -i "s/@@APPNAME@@/code/g" %{buildroot}%{_datadir}/%{name}/bin/%{name}
sed -i "60s/code/code-oss/g" %{buildroot}%{_datadir}/%{name}/bin/%{name}
sed -i "60iexport VSCODE_CLI=0" %{buildroot}%{_datadir}/%{name}/bin/%{name}
sed -i "60iexport VSCODE_DEV=0" %{buildroot}%{_datadir}/%{name}/bin/%{name}
cp -arf .build/electron/* %{buildroot}%{_datadir}/%{name}/
mkdir -p %{buildroot}%{_datadir}/%{name}/resources/app
cp -arf extensions %{buildroot}%{_datadir}/%{name}/resources/app/
cp -arf node_modules %{buildroot}%{_datadir}/%{name}/resources/app/
cp -arf out %{buildroot}%{_datadir}/%{name}/resources/app/
cp -arf product.json %{buildroot}%{_datadir}/%{name}/resources/app/
cp -arf package.json %{buildroot}%{_datadir}/%{name}/resources/app/
cp -arf resources/completions %{buildroot}%{_datadir}/%{name}/resources/
sed -i "s/@@APPNAME@@/code/g" %{buildroot}%{_datadir}/%{name}/resources/completions/zsh/_%{name}
sed -i "s/@@APPNAME@@/code/g" %{buildroot}%{_datadir}/%{name}/resources/completions/bash/%{name}
# Support files
cp -r resources/linux/%{name}.desktop %{buildroot}%{_datadir}/applications
cp -r resources/linux/%{name}-url-handler.desktop %{buildroot}%{_datadir}/applications
cp -r resources/linux/%{name}.appdata.xml %{buildroot}%{_datadir}/appdata
cp -r resources/linux/%{name}-workspace.xml %{buildroot}%{_datadir}/mime/packages/%{name}-workspace.xml
cp -r %{_sourcedir}/%{name}.png %{buildroot}%{_datadir}/pixmaps
sed -i "s/@@NAME_LONG@@/Visual Studio Code/g" %{buildroot}%{_datadir}/applications/*
sed -i "s/@@EXEC@@/\/usr\/share\/code\/bin\/code/g" %{buildroot}%{_datadir}/applications/*
sed -i "s/@@ICON@@/code/g" %{buildroot}%{_datadir}/applications/*
sed -i "s/@@URLPROTOCOL@@/vscode/g" %{buildroot}%{_datadir}/applications/*
sed -i "s/@@NAME_SHORT@@/Code/g" %{buildroot}%{_datadir}/applications/*
sed -i "s/@@NAME@@/code/g" %{buildroot}%{_datadir}/applications/*
sed -i "s/@@LICENSE@@/Multiple, see https:\/\/code.visualstudio.com\/license/g" %{buildroot}%{_datadir}/appdata/%{name}.appdata.xml
sed -i "s/@@NAME_LONG@@/Visual Studio Code/g" %{buildroot}%{_datadir}/appdata/%{name}.appdata.xml
sed -i "s/@@NAME@@/Visual Studio Code/g" %{buildroot}%{_datadir}/appdata/%{name}.appdata.xml
sed -i "s/@@NAME_LONG@@/Visual Studio Code/g" %{buildroot}%{_datadir}/mime/packages/%{name}-workspace.xml
sed -i "s/@@NAME@@/Visual Studio Code/g" %{buildroot}%{_datadir}/mime/packages/%{name}-workspace.xml
popd
if [ "$(arch)" == "x86_64" ]; then
find %{buildroot}%{_datadir}/ -name *-arm64 | xargs rm -rf
else
find %{buildroot}%{_datadir}/ -name *-x64 | xargs rm -rf
fi
find %{buildroot}%{_datadir}/ -name yarn.lock | xargs rm -rf
%files
%{_datadir}/%{name}/
%{_datadir}/applications/%{name}.desktop
%{_datadir}/applications/%{name}-url-handler.desktop
%{_datadir}/appdata/%{name}.appdata.xml
%{_datadir}/mime/packages/%{name}-workspace.xml
%{_datadir}/pixmaps/%{name}.png
%post
ln -s %{_datadir}/code/bin/code /usr/bin/code
update-desktop-database
update-mime-database %{_datadir}/mime
%postun
rm -rf /usr/bin/code
update-desktop-database
update-mime-database %{_datadir}/mime
%changelog
* Thu Oct 10 2024 wangkui <wangkui35@h-partner.com> - 1.93.1-2
- remove git clone
* Wed Oct 9 2024 wangkui <wangkui35@h-partner.com> - 1.93.1-1
- init