-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
app-editors/vscode-9999: fails to build; yarn not supported #377
Comments
You could pack and dist the npm-cache directory like the www-apps/vaultwarden-web GURU package does. There's also NixOS's method to fetch the individual nodejs dep tarballs and generate an npm-cache directory. |
Which would imply I have to store this tarball somewhere. This is also non-reusable between versions :(
This one looks promising, thanks for the hint. I'll try investigating their approach at some point. |
There is another option that offers full compatibility with the Yarn cache: |
Does portage allow starting network services during the build? |
Yes, as far as I know, Portage does this through LD_PRELOAD, so it should not block the daemons created in the script. I tested it through build-online and everything works. Now, I am updating the code for this library, modified it, and now all that remains is to add all the necessary libraries to SRC_URI |
With |
Oops, got confused, with -build-online |
Great! VSCode is now compiling, and all the necessary packages have been added. How should distribute it now? Should create a repository and publish it on npm, or is there a more convenient option? I was considering using patches, but need to update the libraries there too |
Distribute what exactly? |
Modification of offline-mirror-registry, maybe you can create a repository for it, for npm cases? |
Online build is functional, but in offline mode, nvmrc tries to load https://electronjs.org/headers/v30.5.1/node-v30.5.1-headers.tar.gz |
Are your modifications too Gentoo-specific and make no sense upstream? One of the options could be to create an ebuild where you apply your changes and install it system-wide … maybe … don't know if it is reasonable and/or doable at all.
But why? |
Couldn't you download and |
No, these modifications are not specific to Gentoo. The upstream implementation of semver is quite poor, and the glob pattern does not function as expected. Additionally, there are issues with nested paths, such as @types/node. Overall, the upstream project seems to be abandoned..
It’s quite possible, but it would be easier to create a fork in PF4Public that compiles it into a single js file with the embedded modules, eliminating the need to load node modules at all. For now, as a quick solution, I simply placed it in the files and compiled it into a single JS file, works great. Maybe it would be better to move it to the repository? Maybe do it with patches with npm i and manual unzipping of tar? Maybe move it to ebuild altogether? Or maybe leave it as a binary JS file? Don’t rly know |
Why haven't you considered other options mentioned here? Another option might be to ship modified version of |
I meant to I've seen your pr and actually kinda prefer the I should note that I haven't looked over the vscode ebuild entirely, only enough to see a lot of registry uris... So again: YMMV :) |
Agreed, to me it also looks a bit complicated and fragile.
Code collapse to the rescue :D |
The mirror looks like a more promising option. I've already started rewriting it and integrating functionality that will show the missing packages in package.json. I think this will significantly simplify the process, as I spent about 8 hours searching for missing dependencies in the NPM logs. As for installing from tar files, it's quite complicated. Sometimes, installing from tar requires certain dependencies, and among 2000 dependencies, there may be post-installation scripts that won't execute without the necessary libraries. This can lead to errors or incorrect execution due to conditional statements in the scripts. Additionally, many libraries require multiple versions of the same dependency, which should be isolated in folders for sub-dependencies. In the end, how do you keep track of all this? In VSCode, there's support for subprojects, and it might be necessary to write a parser for package-lock.json. Overall, installing from tar files can become a real nightmare. "Why do the work of a package manager?" (c) |
I would like to create something like a system package, but we are using esbuild as well, loading it as a tar. So right now, I'm just transferring fixes to the NPM registry. The presence of the module in files doesn't make me happy either :0 |
A Perl script ;)
IIRC element-desktop was rewritten to pack everything manually :) i.e. without esbuild :) |
So I spent several hours picking dependencies for nothing 🔢 Then do you think it's worth try to install them locally using a Perl script and npm install tarball?
As far as I can see in their repository, they have completely removed esbuild. However, in other overlays, I’ve encountered esbuild as a Gentoo package ¯_(ツ)_/¯ |
I had a quick fiddle with my theory and most of what you said is right :) In the end I was trying export npm_config_nodedir="/usr/include/electron-${ELECTRON_SLOT}/node"
if ! use build-online; then
npm config set cache npm-cache
npm config set offline true
_IFS=${IFS}
IFS=$'\n'
for uri in $VS_NPM_URIS; do
tarball=$(basename "$uri")
# handle cases where the scope has meant renaming the file
tarball=${tarball#* -\> }
echo "caching ${tarball}" # REMOVE ME
npm cache add "${DISTDIR}/${tarball}"
done
IFS=${_IFS}
fi
npm clean-install --ignore-scripts \
--arch=${VSCODE_ARCH} --no-progress || die
# --ignore-optional
# --ignore-engines
# --production=true
# --no-progress
# --skip-integrity-check
# --verbose
npm rebuild But I grew tired of waiting... |
Not sure I understand you correctly. I meant that the list of dependencies you see in the ebuild is essentially a concatenation of all
Oh that's new, I may be missing something there. I'll have to update the ebuild.
Right, but it is a Go package. I doubt, I want to pull in Go while building electron-apps :( |
Ah, I thought you were talking about full control via perl script huh
It would be fun to use both Rust and Golang and Zig and Java as mandatory for building electron apps :) |
I was just experimenting with this today. The final version is now in the ebuild. Although the npm cache add command works with multiple arguments, I had to split the packages into several chunks. NPM, by its nature, works with tar in a semi-multithreaded manner, using 2-3 threads per process. gentoo-overlay/app-editors/vscode/vscode-1.94.2.ebuild Lines 2455 to 2465 in 86ab581
|
is it slow as @JohnFlowerful mentioned?
As if needing the whole browser with js engine with additional js engine wasn't funny enough. |
In @JohnFlowerful case, a new npm command is invoked for each .tgz file, which involves both the JIT runtime and the bash interpreter, along with loading various resources, fortunately, Also would be great to regenerate the dependencies with your script, as there are many outdated and unnecessary ones
Fair enough 🥲 |
This is right. I would have gotten there if time was on my side, I swear :(
Which might also prove that relying on the files having a .tgz extension to be problematic. |
Well, 2000 packages to install is really a lot, especially when you look at other editors that don't even take up 1/40 of VSCode :(
In the case of Gentoo, it is common practice to align package installation processes with the ebuild pipeline. For dependencies, there is an offline mode because the same package may be used at least once by other programs that utilize npm. Moreover, emerge is very similar to CI, having to download dependencies in online mode with every update might not be the best idea, instead, you essentially only need to update the list of dependencies. Difficult, but we know what we're fighting for!! ;) |
I meant the npm registry. Packages can be git based as well. As I said however: I don't know if vscode has had or will ever have git based dependencies. I do know that it doesn't have any in 1.94.2 since I ran my own script to get the uris for testing. |
Hold my beer! microsoft/vscode#149291 :D |
Ah, I see, VSCode has Git dependencies, and they are described just like regular packages and can be loaded in the same way (although I’m not sure if "1ca1b5cc18" is the correct full package name, but in any case, it seems there is only one such Git package). This works with Yarn, but npm cannot fetch them from the cache cause Git packages are dynamic, package-lock.json file for such packages does not contain checksums, licenses, or anything - not even versions |
I mean that yes, you can use |
Git based packages are denoted with (git|git+ssh|git+https|ssh) at the beginning of the Again, the only reason I'm even mentioning this is because of gentoo-overlay/app-editors/vscode/vscode-1.94.2.ebuild Lines 2160 to 2165 in 58c7025
Also again: I don't think this is something for you to worry about, and more an issue for @PF4Public. But it seems like this kind of fuckery might already be known and possibly already accounted for. |
The issue is that Git commits do not have checksums.
Both indices refer to the same context:
There is no point in NOT adjusting them, SRC_URI will only save the commit name without even adding .tar.gz, thanks to the URI structure tar.gz/commit, so what's the difference? still need to use the -> notation |
They've returned to maintaining their dependencies via npm instead of yarn, which is a bad thing since IIRC npm does not provide [useful] offline functionality.
The text was updated successfully, but these errors were encountered: