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
Add support for offline builds #2963
Conversation
The pull request contains a a sub-set of the patches in the FreeBSD ports tree: https://github.com/freebsd/freebsd-ports/tree/main/games/anki/files.
|
ca0b263
to
5545f62
Compare
Hi Kai, I'm ok with merging distro-related changes when they're unobtrusive and can't be easily avoided. Could you clarify some things for me though please?
|
Hi Damien, thank you for the feedback. I'll try to answer your questions as best I can.
For the FreeBSD port in its current state, the folder structure for the "pseudo" venv is created accordingly in advance (see also https://github.com/freebsd/freebsd-ports/blob/main/games/anki/Makefile#L112). I tried again with I also initially considered adding some sort of offline: bool, like you mentioned it for But this seemed too invasive regarding the code of
I tried it without
I had originally thought that I admit that a better approach would be like this (in pseudo code):
That would of course be cleaner and the code would also be reduced in some way. I'm happy to give it a try, but please bear with me, I'm not very savy with Rust, as I already mentioned it earlier. |
Hi Kai,
|
f317a3e
to
186fe2a
Compare
Hi Damien, thank you for the suggestions. I've updated the PR and it should contain following changes:
I did some more research and found that the offline cache for yarn can also be defined by its own environment variable I have therefore also removed the parameter In short: There's only At last but not least: The commit message has been updated as well to reflect the changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some minor tweaks:
186fe2a
to
6537e4a
Compare
Thank you for your suggestions, which have now been implemented accordingly. |
Thanks Kai. This looks all ready to go, except it currently has a conflict. Could you please rebase your changes over the latest main? Then I'll be able to merge them in. |
Downloading files during build time is a non-starter for FreeBSD ports (and presumably for other *BSD ports and some Linux distros as well). In order to still be able to build Anki successfully, two new environment variables have been added that can be set accordingly: * NO_VENV: If set, the Python system environment is used instead of a venv. This is necessary if there are no usable Python wheels for a platform, e.g. PyQt6. * OFFLINE_BUILD: If set, the git repository synchronization (translation files, build hash, etc.) is skipped. To successfully build Anki offline, following conditions must be met: 1. All required dependencies (node, Python, rust, yarn, etc.) must be present in the build environment. 2. The offline repositories for the translation files must be copied/linked to ftl/qt-repo and ftl/core-repo. 3. The Python pseudo venv needs to be setup: $ mkdir out/pyenv/bin $ ln -s /path/to/python out/pyenv/bin/python $ ln -s /path/to/protoc-gen-mypy out/pyenv/bin/protoc-gen-mypy 4. Create the offline cache for yarn and use its own environment variable YARN_CACHE_FOLDER to it: YARN_CACHE_FOLDER=/path/to/the/yarn/cache $ /path/to/yarn install --ignore-scripts 5. Build Anki: $ /path/to/cargo build --package runner --release --verbose --verbose $ OFFLINE_BUILD=1 \ NO_VENV=1 \ ${WRKSRC}/out/rust/release/runner build wheels
6537e4a
to
d87e705
Compare
No problem, Damien. Now it should be all set. |
**Summary** Release notes: - [2.1.55](https://github.com/ankitects/anki/releases/tag/2.1.55) - [2.1.56](https://github.com/ankitects/anki/releases/tag/2.1.56) - [2.1.57](https://github.com/ankitects/anki/releases/tag/2.1.57) - [2.1.58](https://github.com/ankitects/anki/releases/tag/2.1.58) - [2.1.59](https://github.com/ankitects/anki/releases/tag/2.1.59) - [2.1.60](https://github.com/ankitects/anki/releases/tag/2.1.60) - [2.1.61](https://github.com/ankitects/anki/releases/tag/2.1.61) - [2.1.62](https://github.com/ankitects/anki/releases/tag/2.1.62) - [2.1.63](https://github.com/ankitects/anki/releases/tag/2.1.63) - [2.1.64](https://github.com/ankitects/anki/releases/tag/2.1.64) - [2.1.65](https://github.com/ankitects/anki/releases/tag/2.1.65) - [2.1.66](https://github.com/ankitects/anki/releases/tag/2.1.66) - [23.10](https://github.com/ankitects/anki/releases/tag/23.10) - [23.10.1](https://github.com/ankitects/anki/releases/tag/23.10.1) - [23.12](https://github.com/ankitects/anki/releases/tag/23.12) - [23.12.1](https://github.com/ankitects/anki/releases/tag/23.12.1) Packaging notes: Anki (once again) downloads many build dependencies instead of using local ones, and also pins them to very specific versions. Recently [a PR was merged that starts the process of enabling local dependencies](ankitects/anki#2963), this didn't quite work right yet in my testing. Signed-off-by: Thomas Staudinger <Staudi.Kaos@gmail.com>
**Summary** Release notes: - [2.1.55](https://github.com/ankitects/anki/releases/tag/2.1.55) - [2.1.56](https://github.com/ankitects/anki/releases/tag/2.1.56) - [2.1.57](https://github.com/ankitects/anki/releases/tag/2.1.57) - [2.1.58](https://github.com/ankitects/anki/releases/tag/2.1.58) - [2.1.59](https://github.com/ankitects/anki/releases/tag/2.1.59) - [2.1.60](https://github.com/ankitects/anki/releases/tag/2.1.60) - [2.1.61](https://github.com/ankitects/anki/releases/tag/2.1.61) - [2.1.62](https://github.com/ankitects/anki/releases/tag/2.1.62) - [2.1.63](https://github.com/ankitects/anki/releases/tag/2.1.63) - [2.1.64](https://github.com/ankitects/anki/releases/tag/2.1.64) - [2.1.65](https://github.com/ankitects/anki/releases/tag/2.1.65) - [2.1.66](https://github.com/ankitects/anki/releases/tag/2.1.66) - [23.10](https://github.com/ankitects/anki/releases/tag/23.10) - [23.10.1](https://github.com/ankitects/anki/releases/tag/23.10.1) - [23.12](https://github.com/ankitects/anki/releases/tag/23.12) - [23.12.1](https://github.com/ankitects/anki/releases/tag/23.12.1) Packaging notes: Anki (once again) downloads many build dependencies instead of using local ones, and also pins them to very specific versions. Recently [a PR was merged that starts the process of enabling local dependencies](ankitects/anki#2963), this didn't quite work right yet in my testing. Signed-off-by: Thomas Staudinger <Staudi.Kaos@gmail.com>
**Summary** Release notes: - [2.1.55](https://github.com/ankitects/anki/releases/tag/2.1.55) - [2.1.56](https://github.com/ankitects/anki/releases/tag/2.1.56) - [2.1.57](https://github.com/ankitects/anki/releases/tag/2.1.57) - [2.1.58](https://github.com/ankitects/anki/releases/tag/2.1.58) - [2.1.59](https://github.com/ankitects/anki/releases/tag/2.1.59) - [2.1.60](https://github.com/ankitects/anki/releases/tag/2.1.60) - [2.1.61](https://github.com/ankitects/anki/releases/tag/2.1.61) - [2.1.62](https://github.com/ankitects/anki/releases/tag/2.1.62) - [2.1.63](https://github.com/ankitects/anki/releases/tag/2.1.63) - [2.1.64](https://github.com/ankitects/anki/releases/tag/2.1.64) - [2.1.65](https://github.com/ankitects/anki/releases/tag/2.1.65) - [2.1.66](https://github.com/ankitects/anki/releases/tag/2.1.66) - [23.10](https://github.com/ankitects/anki/releases/tag/23.10) - [23.10.1](https://github.com/ankitects/anki/releases/tag/23.10.1) - [23.12](https://github.com/ankitects/anki/releases/tag/23.12) - [23.12.1](https://github.com/ankitects/anki/releases/tag/23.12.1) **Packaging notes:** Anki (once again) changed their whole build system and (once again) downloads many build dependencies instead of using local ones. It also pins them to very specific versions. Recently [a PR was merged that enables some more local deps and offline builds](ankitects/anki#2963), but this didn't quite work right yet in my testing. Signed-off-by: Thomas Staudinger <Staudi.Kaos@gmail.com>
**Summary** Release notes: - [2.1.55](https://github.com/ankitects/anki/releases/tag/2.1.55) | [2.1.56](https://github.com/ankitects/anki/releases/tag/2.1.56) | [2.1.57](https://github.com/ankitects/anki/releases/tag/2.1.57) | [2.1.58](https://github.com/ankitects/anki/releases/tag/2.1.58) | [2.1.59](https://github.com/ankitects/anki/releases/tag/2.1.59) - [2.1.60](https://github.com/ankitects/anki/releases/tag/2.1.60) | [2.1.61](https://github.com/ankitects/anki/releases/tag/2.1.61) | [2.1.62](https://github.com/ankitects/anki/releases/tag/2.1.62) | [2.1.63](https://github.com/ankitects/anki/releases/tag/2.1.63) | [2.1.64](https://github.com/ankitects/anki/releases/tag/2.1.64) | [2.1.65](https://github.com/ankitects/anki/releases/tag/2.1.65) | [2.1.66](https://github.com/ankitects/anki/releases/tag/2.1.66) - [23.10](https://github.com/ankitects/anki/releases/tag/23.10) | [23.10.1](https://github.com/ankitects/anki/releases/tag/23.10.1) | [23.12](https://github.com/ankitects/anki/releases/tag/23.12) | [23.12.1](https://github.com/ankitects/anki/releases/tag/23.12.1) **Packaging notes:** Anki (once again) changed their whole build system and (once again) downloads many build dependencies instead of using local ones. It also pins them to very specific versions. Recently [a PR was merged that enables some more local deps and offline builds](ankitects/anki#2963), but this didn't quite work right yet in my testing. **Test Plan** - Installed and ran in a fresh Budgie VM to confirm dependencies were correct - Imported a new deck - Played through a few dozen cards with audio and pictures **Checklist** - [x] Package was built and tested against unstable
Downloading files during build time is a non-starter for FreeBSD ports (and presumably for other *BSD ports and some Linux distros as well).
In order to still be able to build Anki successfully, a few new environment variables have been added that can be set accordingly:
NO_BUNDLE: If set, the creation of bundles is skipped.
NO_VENV: If set, the Python system environment is used instead of a venv. This is necessary if there are no usable Python wheels for a platform, e.g. PyQt6.
OFFLINE_BUILD: If set, the git repository synchronization (translation files, build hash, etc.) is skipped.
OFFLINE_YARNCACHE: Path to the offline cache that is being used by yarn(1).
To successfully build Anki offline, following conditions must be met:
All required dependencies (node, Python, rust, yarn, etc.) must be present in the build environment.
The offline repositories for the translation files must be copied/linked to ftl/qt-repo and ftl/core-repo.
The Python pseudo venv needs to be setup:
$ mkdir out/pyenv/bin $ ln -s /path/to/python out/pyenv/bin/python
$ ln -s /path/to/protoc-gen-mypy out/pyenv/bin/protoc-gen-mypy
Create the offline cache for yarn and point
OFFLINE_YARNCACHE
to it:OFFLINE_YARNCACHE=/path/to/the/yarn/cache $ /path/to/yarn --cache-folder $OFFLINE_YARNCACHE install --ignore-scripts
Build Anki:
$ /path/to/cargo build --package runner --release --verbose --verbose $ OFFLINE_BUILD=1 \ OFFLINE_YARNCACHE=/path/to/the/yarn/cache \ NO_BUNDLE=1 \ NO_VENV=1 \ ${WRKSRC}/out/rust/release/runner build wheels