ci: use sysroots for stripping binaries in rpmbuild (#227397)

This commit is contained in:
Robo 2024-09-03 13:01:02 +09:00 committed by GitHub
parent 07a1a149e3
commit adac839773
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 42 additions and 2 deletions

View file

@ -114,6 +114,26 @@ steps:
fi
echo "Yarn failed $i, trying again..."
done
displayName: Install build dependencies
condition: and(succeeded(), ne(variables.NODE_MODULES_RESTORED, 'true'))
# Step will be used by both Install dependencies and building rpm package,
# hence avoid adding it behind NODE_MODULES_RESTORED condition.
- script: |
set -e
SYSROOT_ARCH=$VSCODE_ARCH
if [ "$SYSROOT_ARCH" == "x64" ]; then
SYSROOT_ARCH="amd64"
fi
export VSCODE_SYSROOT_DIR=$(Build.SourcesDirectory)/.build/sysroots
SYSROOT_ARCH="$SYSROOT_ARCH" node -e '(async () => { const { getVSCodeSysroot } = require("./build/linux/debian/install-sysroot.js"); await getVSCodeSysroot(process.env["SYSROOT_ARCH"]); })()'
env:
VSCODE_ARCH: $(VSCODE_ARCH)
GITHUB_TOKEN: "$(github-distro-mixin-password)"
displayName: Download vscode sysroots
- script: |
set -e
source ./build/azure-pipelines/linux/setup-env.sh
@ -290,7 +310,19 @@ steps:
- script: |
set -e
TRIPLE=""
if [ "$VSCODE_ARCH" == "x64" ]; then
TRIPLE="x86_64-linux-gnu"
elif [ "$VSCODE_ARCH" == "arm64" ]; then
TRIPLE="aarch64-linux-gnu"
elif [ "$VSCODE_ARCH" == "armhf" ]; then
TRIPLE="arm-rpi-linux-gnueabihf"
fi
export VSCODE_SYSROOT_DIR=$(Build.SourcesDirectory)/.build/sysroots
export STRIP="$VSCODE_SYSROOT_DIR/$TRIPLE/$TRIPLE/bin/strip"
yarn gulp "vscode-linux-$(VSCODE_ARCH)-prepare-rpm"
env:
VSCODE_ARCH: $(VSCODE_ARCH)
displayName: Prepare rpm package
- script: |

View file

@ -8,7 +8,12 @@ if [ "$SYSROOT_ARCH" == "x64" ]; then
fi
export VSCODE_SYSROOT_DIR=$PWD/.build/sysroots
SYSROOT_ARCH="$SYSROOT_ARCH" node -e '(async () => { const { getVSCodeSysroot } = require("./build/linux/debian/install-sysroot.js"); await getVSCodeSysroot(process.env["SYSROOT_ARCH"]); })()'
if [ -d "$VSCODE_SYSROOT_DIR" ]; then
echo "Using cached sysroot"
else
echo "Downloading sysroot"
SYSROOT_ARCH="$SYSROOT_ARCH" node -e '(async () => { const { getVSCodeSysroot } = require("./build/linux/debian/install-sysroot.js"); await getVSCodeSysroot(process.env["SYSROOT_ARCH"]); })()'
fi
if [ "$npm_config_arch" == "x64" ]; then
if [ "$(echo "$@" | grep -c -- "--only-remote")" -eq 0 ]; then

View file

@ -446,7 +446,7 @@ extends:
- ${{ if or(eq(parameters.VSCODE_BUILD_LINUX, true),eq(parameters.VSCODE_BUILD_LINUX_ARMHF, true),eq(parameters.VSCODE_BUILD_LINUX_ARM64, true),eq(parameters.VSCODE_BUILD_ALPINE, true),eq(parameters.VSCODE_BUILD_ALPINE_ARM64, true),eq(parameters.VSCODE_BUILD_MACOS, true),eq(parameters.VSCODE_BUILD_MACOS_ARM64, true),eq(parameters.VSCODE_BUILD_WIN32, true),eq(parameters.VSCODE_BUILD_WIN32_ARM64, true)) }}:
- CompileCLI
pool:
name: 1es-ubuntu-20.04-x64
name: 1es-ubuntu-22.04-x64
os: linux
jobs:
- ${{ if eq(variables['VSCODE_CIBUILD'], true) }}:

View file

@ -152,6 +152,7 @@ function getRpmPackageArch(arch) {
function prepareRpmPackage(arch) {
const binaryDir = '../VSCode-linux-' + arch;
const rpmArch = getRpmPackageArch(arch);
const stripBinary = process.env['STRIP'] ?? '/usr/bin/strip';
return function () {
const desktop = gulp.src('resources/linux/code.desktop', { base: '.' })
@ -208,6 +209,7 @@ function prepareRpmPackage(arch) {
.pipe(replace('@@QUALITY@@', product.quality || '@@QUALITY@@'))
.pipe(replace('@@UPDATEURL@@', product.updateUrl || '@@UPDATEURL@@'))
.pipe(replace('@@DEPENDENCIES@@', dependencies.join(', ')))
.pipe(replace('@@STRIP@@', stripBinary))
.pipe(rename('SPECS/' + product.applicationName + '.spec'))
.pipe(es.through(function (f) { that.emit('data', f); }, function () { that.emit('end'); }));
}));

View file

@ -19,6 +19,7 @@ Visual Studio Code is a new choice of tool that combines the simplicity of a cod
# Don't generate build_id links to prevent conflicts when installing multiple
# versions of VS Code alongside each other (e.g. `code` and `code-insiders`)
%define _build_id_links none
%define __strip @@STRIP@@
%install
# Destination directories