Skip to content

Commit 7868f4d

Browse files
authored
Fix cross-compilation (#6441)
* Avoid packaging yarn.lock Since the shrinkwrap is what we want everything to use. * Build with npm It seems we stuck with yarn because npm was giving us errors but I will try sorting it out now so we can build with npm as originally intended. * Remove build from source Not using CentOS 7 anymore so based on the comment we no longer need this. Keytar seems to install fine now. * Update missed Node version These numbers are all over the place. * npm_config_arch must be lowercase * Patch out Kerberos I am not sure exactly how it is used but I think it is not a path code-server worries about, at least not right now. Just going to patch it out rather than figure out how to build it on armv7l but we can revisit later.
1 parent acc50a5 commit 7868f4d

File tree

7 files changed

+69
-19
lines changed

7 files changed

+69
-19
lines changed

.github/workflows/release.yaml

+5-7
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ jobs:
119119
CC: ${{ format('{0}-gcc', matrix.prefix) }}
120120
CXX: ${{ format('{0}-g++', matrix.prefix) }}
121121
LINK: ${{ format('{0}-g++', matrix.prefix) }}
122-
NPM_CONFIG_ARCH: ${{ matrix.arch }}
122+
npm_config_arch: ${{ matrix.arch }}
123123
NODE_VERSION: v18.15.0
124124

125125
steps:
@@ -150,15 +150,13 @@ jobs:
150150
- name: Decompress npm package
151151
run: tar -xzf package.tar.gz
152152

153-
# NOTE@jsjoeio - npm fails here
154-
# so use yarn
155153
- name: Build standalone release
156-
run: yarn release:standalone
154+
run: npm run release:standalone
157155

158156
- name: Replace node with cross-compile equivalent
159157
run: |
160-
wget https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-${NPM_CONFIG_ARCH}.tar.xz
161-
tar -xf node-${NODE_VERSION}-linux-${NPM_CONFIG_ARCH}.tar.xz node-${NODE_VERSION}-linux-${NPM_CONFIG_ARCH}/bin/node --strip-components=2
158+
wget https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-${npm_config_arch}.tar.xz
159+
tar -xf node-${NODE_VERSION}-linux-${npm_config_arch}.tar.xz node-${NODE_VERSION}-linux-${npm_config_arch}/bin/node --strip-components=2
162160
mv ./node ./release-standalone/lib/node
163161
164162
# NOTE@jsjoeio - we do this so we can strip out the v
@@ -171,7 +169,7 @@ jobs:
171169
- name: Build packages with nfpm
172170
env:
173171
VERSION: ${{ env.VERSION }}
174-
run: yarn package ${NPM_CONFIG_ARCH}
172+
run: yarn package ${npm_config_arch}
175173

176174
- uses: softprops/action-gh-release@v1
177175
with:

.node-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16
1+
18

ci/build/build-release.sh

-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ bundle_code_server() {
5656
}
5757
EOF
5858
) > "$RELEASE_PATH/package.json"
59-
rsync yarn.lock "$RELEASE_PATH"
6059
mv npm-shrinkwrap.json "$RELEASE_PATH"
6160

6261
rsync ci/build/npm-postinstall.sh "$RELEASE_PATH/postinstall.sh"
@@ -95,12 +94,10 @@ bundle_vscode() {
9594
"$VSCODE_SRC_PATH/remote/package.json" \
9695
"$VSCODE_SRC_PATH/package.json" > "$VSCODE_OUT_PATH/package.json"
9796

98-
rsync "$VSCODE_SRC_PATH/remote/yarn.lock" "$VSCODE_OUT_PATH/yarn.lock"
9997
mv "$VSCODE_SRC_PATH/remote/npm-shrinkwrap.json" "$VSCODE_OUT_PATH/npm-shrinkwrap.json"
10098

10199
# Include global extension dependencies as well.
102100
rsync "$VSCODE_SRC_PATH/extensions/package.json" "$VSCODE_OUT_PATH/extensions/package.json"
103-
rsync "$VSCODE_SRC_PATH/extensions/yarn.lock" "$VSCODE_OUT_PATH/extensions/yarn.lock"
104101
mv "$VSCODE_SRC_PATH/extensions/npm-shrinkwrap.json" "$VSCODE_OUT_PATH/extensions/npm-shrinkwrap.json"
105102
rsync "$VSCODE_SRC_PATH/extensions/postinstall.mjs" "$VSCODE_OUT_PATH/extensions/postinstall.mjs"
106103
}

ci/build/build-standalone-release.sh

-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
# This is due to an upstream issue with RHEL7/CentOS 7 comptability with node-argon2
5-
# See: https://github.com/cdr/code-server/pull/3422#pullrequestreview-677765057
6-
export npm_config_build_from_source=true
7-
84
main() {
95
cd "$(dirname "${0}")/../.."
106

ci/build/npm-postinstall.sh

-4
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ symlink_bin_script() {
5353

5454
OS="$(os)"
5555

56-
# This is due to an upstream issue with RHEL7/CentOS 7 comptability with node-argon2
57-
# See: https://github.com/cdr/code-server/pull/3422#pullrequestreview-677765057
58-
export npm_config_build_from_source=true
59-
6056
main() {
6157
# Grabs the major version of node from $npm_config_user_agent which looks like
6258
# yarn/1.21.1 npm/? node/v14.2.0 darwin x64

patches/dependencies.diff

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
Modify VS Code dependencies
2+
3+
1. Kerberos: this is not building in our cross-compile step. It does not look
4+
like something code-server uses right now anyway.
5+
6+
Index: code-server/lib/vscode/remote/package.json
7+
===================================================================
8+
--- code-server.orig/lib/vscode/remote/package.json
9+
+++ code-server/lib/vscode/remote/package.json
10+
@@ -18,7 +18,6 @@
11+
"http-proxy-agent": "^2.1.0",
12+
"https-proxy-agent": "^2.2.3",
13+
"jschardet": "3.0.0",
14+
- "kerberos": "^2.0.1",
15+
"keytar": "7.9.0",
16+
"minimist": "^1.2.6",
17+
"native-watchdog": "^1.4.1",
18+
Index: code-server/lib/vscode/remote/yarn.lock
19+
===================================================================
20+
--- code-server.orig/lib/vscode/remote/yarn.lock
21+
+++ code-server/lib/vscode/remote/yarn.lock
22+
@@ -454,15 +454,6 @@ [email protected]:
23+
resolved "https://registry.yarnpkg.com/jschardet/-/jschardet-3.0.0.tgz#898d2332e45ebabbdb6bf2feece9feea9a99e882"
24+
integrity sha512-lJH6tJ77V8Nzd5QWRkFYCLc13a3vADkh3r/Fi8HupZGWk2OVVDfnZP8V/VgQgZ+lzW0kG2UGb5hFgt3V3ndotQ==
25+
26+
-kerberos@^2.0.1:
27+
- version "2.0.1"
28+
- resolved "https://registry.yarnpkg.com/kerberos/-/kerberos-2.0.1.tgz#663b0b46883b4da84495f60f2e9e399a43a33ef5"
29+
- integrity sha512-O/jIgbdGK566eUhFwIcgalbqirYU/r76MW7/UFw06Fd9x5bSwgyZWL/Vm26aAmezQww/G9KYkmmJBkEkPk5HLw==
30+
- dependencies:
31+
- bindings "^1.5.0"
32+
- node-addon-api "^4.3.0"
33+
- prebuild-install "7.1.1"
34+
-
35+
36+
version "7.9.0"
37+
resolved "https://registry.yarnpkg.com/keytar/-/keytar-7.9.0.tgz#4c6225708f51b50cbf77c5aae81721964c2918cb"
38+
@@ -604,24 +595,6 @@ picomatch@^2.3.1:
39+
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
40+
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
41+
42+
43+
- version "7.1.1"
44+
- resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-7.1.1.tgz#de97d5b34a70a0c81334fd24641f2a1702352e45"
45+
- integrity sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==
46+
- dependencies:
47+
- detect-libc "^2.0.0"
48+
- expand-template "^2.0.3"
49+
- github-from-package "0.0.0"
50+
- minimist "^1.2.3"
51+
- mkdirp-classic "^0.5.3"
52+
- napi-build-utils "^1.0.1"
53+
- node-abi "^3.3.0"
54+
- pump "^3.0.0"
55+
- rc "^1.2.7"
56+
- simple-get "^4.0.0"
57+
- tar-fs "^2.0.0"
58+
- tunnel-agent "^0.6.0"
59+
-
60+
prebuild-install@^7.0.1:
61+
version "7.0.1"
62+
resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-7.0.1.tgz#c10075727c318efe72412f333e0ef625beaf3870"

patches/series

+1
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ display-language.diff
2020
cli-window-open.diff
2121
getting-started.diff
2222
safari.diff
23+
dependencies.diff

0 commit comments

Comments
 (0)