浏览代码

fix(linux-reh-x86): use unofficial nodejs to build archive (#2465)

Baptiste Augrain 4 天之前
父节点
当前提交
7245ccb8bd

+ 13 - 4
.github/workflows/insider-linux.yml

@@ -206,7 +206,7 @@ jobs:
         if: env.DISABLED != 'yes' && env.SHOULD_BUILD == 'yes'
 
       - name: Install GH
-        run: ./install_gh.sh
+        run: ./build/linux/install_gh.sh
         if: env.DISABLED != 'yes' && env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
 
       - name: Check existing VSCodium tags/releases
@@ -331,7 +331,16 @@ jobs:
         uses: actions/setup-node@v4
         with:
           node-version-file: '.nvmrc'
-        if: env.DISABLED != 'yes'
+        if: env.DISABLED != 'yes' && matrix.npm_arch != 'x64'
+
+      - name: Install Unofficial Node.js
+        run: ./build/linux/install_nodejs.sh
+        env:
+          NODEJS_ARCH: ${{ matrix.npm_arch }}
+          NODEJS_SITE: https://unofficial-builds.nodejs.org
+          NODEJS_URLROOT: /download/release
+          NODEJS_URLSUFFIX: -glibc-217
+        if: env.DISABLED != 'yes' && matrix.npm_arch == 'x64'
 
       - name: Setup Python 3
         uses: actions/setup-python@v5
@@ -344,7 +353,7 @@ jobs:
         if: env.DISABLED != 'yes'
 
       - name: Install GH
-        run: ./install_gh.sh
+        run: ./build/linux/install_gh.sh
         if: env.DISABLED != 'yes' && env.SHOULD_DEPLOY == 'yes'
 
       - name: Check existing VSCodium tags/releases
@@ -426,7 +435,7 @@ jobs:
           platform: x64
 
       - name: Install GH
-        run: ./install_gh.sh
+        run: ./build/linux/install_gh.sh
         if: env.SHOULD_DEPLOY == 'yes'
 
       - name: Check existing VSCodium tags/releases

+ 3 - 3
.github/workflows/stable-linux.yml

@@ -207,7 +207,7 @@ jobs:
         if: env.DISABLED != 'yes'
 
       - name: Install GH
-        run: ./install_gh.sh
+        run: ./build/linux/install_gh.sh
         if: env.DISABLED != 'yes' && env.SHOULD_BUILD == 'yes' && env.SHOULD_DEPLOY == 'yes'
 
       - name: Check existing VSCodium tags/releases
@@ -345,7 +345,7 @@ jobs:
         if: env.DISABLED != 'yes'
 
       - name: Install GH
-        run: ./install_gh.sh
+        run: ./build/linux/install_gh.sh
         if: env.DISABLED != 'yes' && env.SHOULD_DEPLOY == 'yes'
 
       - name: Check existing VSCodium tags/releases
@@ -427,7 +427,7 @@ jobs:
           platform: x64
 
       - name: Install GH
-        run: ./install_gh.sh
+        run: ./build/linux/install_gh.sh
         if: env.SHOULD_DEPLOY == 'yes'
 
       - name: Check existing VSCodium tags/releases

+ 0 - 0
install_gh.sh → build/linux/install_gh.sh


+ 13 - 0
build/linux/install_nodejs.sh

@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+set -ex
+
+NODEJS_VERSION=$( cat .nvmrc )
+
+curl -fsSL "${NODEJS_SITE}${NODEJS_URLROOT}/v${NODEJS_VERSION}/node-v${NODEJS_VERSION}-linux-${NODEJS_ARCH}${NODEJS_URLSUFFIX}.tar.xz" -o node.tar.xz
+
+tar -xf node.tar.xz
+
+sudo mv "node-v${NODEJS_VERSION}-linux-${NODEJS_ARCH}${NODEJS_URLSUFFIX}" /usr/local/node
+
+echo "/usr/local/node/bin" >> $GITHUB_PATH

+ 4 - 0
build/linux/package_reh.sh

@@ -171,6 +171,8 @@ for i in {1..5}; do # try 5 times
 done
 
 if [[ "${VSCODE_ARCH}" == "x64" ]]; then
+  pushd "remote"
+
   for LIB in @parcel/watcher @vscode/spdlog kerberos
   do
     pushd "node_modules/${LIB}"
@@ -179,6 +181,8 @@ if [[ "${VSCODE_ARCH}" == "x64" ]]; then
 
     popd
   done
+
+  popd
 fi
 
 mv .npmrc.bak .npmrc

+ 16 - 11
patches/linux/arch-0-support.patch

@@ -1,5 +1,5 @@
 diff --git a/build/azure-pipelines/linux/setup-env.sh b/build/azure-pipelines/linux/setup-env.sh
-index a148d51..fb2f8ff 100755
+index 6805633..9d4b59f 100755
 --- a/build/azure-pipelines/linux/setup-env.sh
 +++ b/build/azure-pipelines/linux/setup-env.sh
 @@ -2,3 +2,3 @@
@@ -12,11 +12,16 @@ index a148d51..fb2f8ff 100755
 -  SYSROOT_ARCH="$SYSROOT_ARCH" VSCODE_SYSROOT_DIR="$VSCODE_REMOTE_SYSROOT_DIR" VSCODE_SYSROOT_PREFIX="-glibc-2.28-gcc-8.5.0" node -e '(async () => { const { getVSCodeSysroot } = require("./build/linux/debian/install-sysroot.js"); await getVSCodeSysroot(process.env["SYSROOT_ARCH"]); })()'
 +  SYSROOT_ARCH="$SYSROOT_ARCH" VSCODE_SYSROOT_DIR="$VSCODE_REMOTE_SYSROOT_DIR" node -e '(async () => { const { getVSCodeSysroot } = require("./build/linux/debian/install-sysroot.js"); await getVSCodeSysroot(process.env["SYSROOT_ARCH"]); })()'
  fi
+@@ -50,3 +50,3 @@ if [ "$npm_config_arch" == "x64" ]; then
+   export VSCODE_REMOTE_CXX=$VSCODE_REMOTE_SYSROOT_DIR/x86_64-linux-gnu/bin/x86_64-linux-gnu-g++
+-  export VSCODE_REMOTE_CXXFLAGS="--sysroot=$VSCODE_REMOTE_SYSROOT_DIR/x86_64-linux-gnu/x86_64-linux-gnu/sysroot"
++  export VSCODE_REMOTE_CXXFLAGS="--sysroot=$VSCODE_REMOTE_SYSROOT_DIR/x86_64-linux-gnu/x86_64-linux-gnu/sysroot -D_GLIBCXX_USE_CXX11_ABI=0"
+   export VSCODE_REMOTE_LDFLAGS="--sysroot=$VSCODE_REMOTE_SYSROOT_DIR/x86_64-linux-gnu/x86_64-linux-gnu/sysroot -L$VSCODE_REMOTE_SYSROOT_DIR/x86_64-linux-gnu/x86_64-linux-gnu/sysroot/usr/lib/x86_64-linux-gnu -L$VSCODE_REMOTE_SYSROOT_DIR/x86_64-linux-gnu/x86_64-linux-gnu/sysroot/lib/x86_64-linux-gnu"
 diff --git a/build/gulpfile.reh.js b/build/gulpfile.reh.js
-index c1d64c0..5ac9f95 100644
+index 10b7b44..0ad7550 100644
 --- a/build/gulpfile.reh.js
 +++ b/build/gulpfile.reh.js
-@@ -232,9 +232,23 @@ function nodejs(platform, arch) {
+@@ -233,9 +233,23 @@ function nodejs(platform, arch) {
  		case 'linux':
 -			return (product.nodejsRepository !== 'https://nodejs.org' ?
 -				fetchGithub(product.nodejsRepository, { version: `${nodeVersion}-${internalNodeVersion}`, name: expectedName, checksumSha256 }) :
@@ -48,7 +53,7 @@ index c1d64c0..5ac9f95 100644
 +			}
  		case 'alpine':
 diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js
-index 26a6287..004417f 100644
+index 25d8916..250ba7c 100644
 --- a/build/gulpfile.vscode.js
 +++ b/build/gulpfile.vscode.js
 @@ -366,2 +366,12 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
@@ -70,7 +75,7 @@ index 26a6287..004417f 100644
 +			.pipe(electron({ ...config, ...electronOverride, platform, arch: arch === 'armhf' ? 'arm' : arch, ffmpegChromium: false }))
  			.pipe(filter(['**', '!LICENSE', '!version'], { dot: true }));
 diff --git a/build/linux/debian/dep-lists.js b/build/linux/debian/dep-lists.js
-index 4ef448d..057961c 100644
+index f58d0f8..4edb371 100644
 --- a/build/linux/debian/dep-lists.js
 +++ b/build/linux/debian/dep-lists.js
 @@ -140,3 +140,3 @@ exports.referenceGeneratedDepsByArch = {
@@ -88,33 +93,33 @@ index 5b7ccd5..707129f 100644
 +	],
  };
 diff --git a/build/linux/debian/install-sysroot.js b/build/linux/debian/install-sysroot.js
-index 612d0a3..8fbdf3d 100644
+index d16e13b..18e409a 100644
 --- a/build/linux/debian/install-sysroot.js
 +++ b/build/linux/debian/install-sysroot.js
-@@ -74,3 +74,5 @@ async function fetchUrl(options, retries = 10, retryDelay = 1000) {
+@@ -73,3 +73,5 @@ async function fetchUrl(options, retries = 10, retryDelay = 1000) {
          try {
 -            const response = await fetch(`https://api.github.com/repos/Microsoft/vscode-linux-build-agent/releases/tags/v${version}`, {
 +            const repository = process.env['VSCODE_SYSROOT_REPOSITORY'] ?? 'Microsoft/vscode-linux-build-agent';
 +            const actualVersion = process.env['VSCODE_SYSROOT_VERSION'] ?? version;
 +            const response = await fetch(`https://api.github.com/repos/${repository}/releases/tags/v${actualVersion}`, {
                  headers: ghApiHeaders,
-@@ -83,3 +85,3 @@ async function fetchUrl(options, retries = 10, retryDelay = 1000) {
+@@ -82,3 +84,3 @@ async function fetchUrl(options, retries = 10, retryDelay = 1000) {
                  if (!asset) {
 -                    throw new Error(`Could not find asset in release of Microsoft/vscode-linux-build-agent @ ${version}`);
 +                    throw new Error(`Could not find asset in release of ${repository} @ ${actualVersion}`);
                  }
 diff --git a/build/linux/debian/install-sysroot.ts b/build/linux/debian/install-sysroot.ts
-index 8a61159..9f3fd15 100644
+index 670fb68..092fc68 100644
 --- a/build/linux/debian/install-sysroot.ts
 +++ b/build/linux/debian/install-sysroot.ts
-@@ -83,3 +83,5 @@ async function fetchUrl(options: IFetchOptions, retries = 10, retryDelay = 1000)
+@@ -82,3 +82,5 @@ async function fetchUrl(options: IFetchOptions, retries = 10, retryDelay = 1000)
  		try {
 -			const response = await fetch(`https://api.github.com/repos/Microsoft/vscode-linux-build-agent/releases/tags/v${version}`, {
 +			const repository = process.env['VSCODE_SYSROOT_REPOSITORY'] ?? 'Microsoft/vscode-linux-build-agent';
 +			const actualVersion = process.env['VSCODE_SYSROOT_VERSION'] ?? version;
 +			const response = await fetch(`https://api.github.com/repos/${repository}/releases/tags/v${actualVersion}`, {
  				headers: ghApiHeaders,
-@@ -92,3 +94,3 @@ async function fetchUrl(options: IFetchOptions, retries = 10, retryDelay = 1000)
+@@ -91,3 +93,3 @@ async function fetchUrl(options: IFetchOptions, retries = 10, retryDelay = 1000)
  				if (!asset) {
 -					throw new Error(`Could not find asset in release of Microsoft/vscode-linux-build-agent @ ${version}`);
 +					throw new Error(`Could not find asset in release of ${repository} @ ${actualVersion}`);