code-server: restore previous patch (#240194)

Also add a note about the `commit` value and how to get it.
This commit is contained in:
Pol Dellaiera 2023-06-27 23:04:28 +02:00 committed by GitHub
parent f7d2276f86
commit a835a56b54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 22 deletions

View file

@ -1,15 +1,8 @@
diff --git a/ci/build/build-vscode.sh b/ci/build/build-vscode.sh
index a72549fb..b1b6074b 100755
index a72549fb..3aed1ad5 100755
--- a/ci/build/build-vscode.sh
+++ b/ci/build/build-vscode.sh
@@ -52,13 +52,12 @@ main() {
# since Code tries to get the commit from the `.git` directory which will fail
# as it is a submodule.
export BUILD_SOURCEVERSION
- BUILD_SOURCEVERSION=$(git rev-parse HEAD)
+ BUILD_SOURCEVERSION=none
# Add the date, our name, links, and enable telemetry (this just makes
@@ -58,7 +58,6 @@ main() {
# telemetry available; telemetry can still be disabled by flag or setting).
# This needs to be done before building as Code will read this file and embed
# it into the client-side code.
@ -17,21 +10,11 @@ index a72549fb..b1b6074b 100755
cp product.json product.original.json # Since jq has no inline edit.
jq --slurp '.[0] * .[1]' product.original.json <(
cat << EOF
@@ -105,17 +104,12 @@ EOF
@@ -105,7 +104,6 @@ EOF
# Reset so if you develop after building you will not be stuck with the wrong
# commit (the dev client will use `oss-dev` but the dev server will still use
# product.json which will have `stable-$commit`).
- git checkout product.json
popd
pushd lib/vscode-reh-web-linux-x64
# Make sure Code took the version we set in the environment variable. Not
# having a version will break display languages.
- if ! jq -e .commit product.json; then
- echo "'commit' is missing from product.json"
- exit 1
- fi
popd
# These provide a `code-server` command in the integrated terminal to open

View file

@ -54,6 +54,24 @@ let
sed -i 's/${version}/${esbuild'.version}/g' ${path}/node_modules/esbuild/lib/main.js
ln -s -f ${esbuild'}/bin/esbuild ${path}/node_modules/esbuild/bin/esbuild
'';
# Comment from @code-asher, the code-server maintainer
# See https://github.com/NixOS/nixpkgs/pull/240001#discussion_r1244303617
#
# If the commit is missing it will break display languages (Japanese, Spanish,
# etc). For some reason VS Code has a hard dependency on the commit being set
# for that functionality.
# The commit is also used in cache busting. Without the commit you could run
# into issues where the browser is loading old versions of assets from the
# cache.
# Lastly, it can be helpful for the commit to be accurate in bug reports
# especially when they are built outside of our CI as sometimes the version
# numbers can be unreliable (since they are arbitrarily provided).
#
# To compute the commit when upgrading this derivation, do:
# `$ git rev-parse <git-rev>` where <git-rev> is the git revision of the `src`
# Example: `$ git rev-parse v4.14.1`
commit = "5c199629305a0b935b4388b7db549f77eae82b5a";
in
stdenv.mkDerivation (finalAttrs: {
pname = "code-server";
@ -129,6 +147,12 @@ stdenv.mkDerivation (finalAttrs: {
export HOME=$PWD
patchShebangs ./ci
# inject git commit
substituteInPlace ./ci/build/build-vscode.sh \
--replace '$(git rev-parse HEAD)' "${commit}"
substituteInPlace ./ci/build/build-release.sh \
--replace '$(git rev-parse HEAD)' "${commit}"
'';
configurePhase = ''