summaryrefslogtreecommitdiff
path: root/app-misc/anki/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2024-05-16 00:01:30 +0100
committerV3n3RiX <venerix@koprulu.sector>2024-05-16 00:01:30 +0100
commit66113e7871aede225d661473925cea4cce9e6d23 (patch)
tree5bca10c8eeb5527fc3625567fc296a60dd9695cd /app-misc/anki/files
parent514c44bb9cc421df9c323acbad430cbb6ee5b89a (diff)
gentoo auto-resync : 16:05:2024 - 00:01:30
Diffstat (limited to 'app-misc/anki/files')
-rw-r--r--app-misc/anki/files/23.12.1/configure-offline-build.patch63
-rw-r--r--app-misc/anki/files/23.12.1/ninja-gentoo-setup.patch81
-rw-r--r--app-misc/anki/files/23.12.1/no-git-submodule-sync.patch69
-rw-r--r--app-misc/anki/files/23.12.1/pseudo-venv.patch127
-rw-r--r--app-misc/anki/files/24.04.1/ninja-gentoo-setup.patch45
-rw-r--r--app-misc/anki/files/24.04.1/remove-mypy-protobuf.patch28
-rw-r--r--app-misc/anki/files/24.04.1/remove-yarn.patch (renamed from app-misc/anki/files/23.12.1/remove-yarn-dep.patch)32
-rw-r--r--app-misc/anki/files/24.04.1/revert-cert-store-hack.patch21
8 files changed, 111 insertions, 355 deletions
diff --git a/app-misc/anki/files/23.12.1/configure-offline-build.patch b/app-misc/anki/files/23.12.1/configure-offline-build.patch
deleted file mode 100644
index 28c77916e555..000000000000
--- a/app-misc/anki/files/23.12.1/configure-offline-build.patch
+++ /dev/null
@@ -1,63 +0,0 @@
-This is an adapted patch from the games/anki FreeBSD port.
-https://github.com/freebsd/freebsd-ports/blob/109c3d4629b84972e660b689d169ac0761c1a519/games/anki/files/patch-build_configure_src_main.rs
-
-It replaces or skips network-reliant methods of the build setup and disables
-the setup for bundles and for offline documentation. This way, we achieve a
-lean offline build.
-Delete setup_python call to avoid setting an extra environment variable to
-prevent network access.
-
-The FreeBSD port offers greater flexibility with additional environment
-variables such as OFFLINE_BUILD and should probably be upstreamed. I
-have contacted the port maintainer (Kai Knoblich <kai@FreeBSD.org>).
-
-From: Lucio Sauer <watermanpaint@posteo.net>
---- a/build/configure/src/main.rs
-+++ b/build/configure/src/main.rs
-@@ -11,25 +11,21 @@ mod web;
-
- use anyhow::Result;
- use aqt::build_and_check_aqt;
--use bundle::build_bundle;
- use ninja_gen::glob;
- use ninja_gen::inputs;
- use ninja_gen::protobuf::check_proto;
- use ninja_gen::protobuf::setup_protoc;
--use ninja_gen::python::setup_python;
- use ninja_gen::Build;
- use pylib::build_pylib;
- use pylib::check_pylib;
- use python::check_python;
--use python::setup_venv;
-+use python::setup_venv_stub;
- use rust::build_rust;
- use rust::check_minilints;
- use rust::check_rust;
- use web::build_and_check_web;
- use web::check_sql;
-
--use crate::python::setup_sphix;
--
- fn anki_version() -> String {
- std::fs::read_to_string(".version")
- .unwrap()
-@@ -44,16 +40,15 @@ fn main() -> Result<()> {
- setup_protoc(build)?;
- check_proto(build, inputs![glob!["proto/**/*.proto"]])?;
-
-- setup_python(build)?;
-- setup_venv(build)?;
-+ println!("Patch: Using Python system environment.");
-+ setup_venv_stub(build)?;
-
- build_rust(build)?;
- build_pylib(build)?;
- build_and_check_web(build)?;
- build_and_check_aqt(build)?;
-- build_bundle(build)?;
-
-- setup_sphix(build)?;
-+ println!("Patch: Skipping build of bundles.");
-
- check_rust(build)?;
- check_pylib(build)?;
diff --git a/app-misc/anki/files/23.12.1/ninja-gentoo-setup.patch b/app-misc/anki/files/23.12.1/ninja-gentoo-setup.patch
deleted file mode 100644
index 8671057d4054..000000000000
--- a/app-misc/anki/files/23.12.1/ninja-gentoo-setup.patch
+++ /dev/null
@@ -1,81 +0,0 @@
-This is an adapted patch from the games/anki FreeBSD port.
-https://github.com/freebsd/freebsd-ports/blob/109c3d4629b84972e660b689d169ac0761c1a519/games/anki/files/patch-build_runner_src_build.rs
-
-It adapts the ninja(-compatible) build system to the Gentoo system and
-prevents repo sync via git.
-* Mimic ninja-utils.eclass behavior to respect NINJA_VERBOSE.
- Can also be implemented in the ebuild via runner args when the rest
- of the patch gets dropped.
-* Respect NINJA_STATUS if already set.
-* Respect app-alternatives/ninja symlink (n2 is not yet in the tree).
- This is a workaround. A proper implementation similar to
- the LTO implementation (c6f429) should allow the build system to be set at
- configure time.
-
-From: Lucio Sauer <watermanpaint@posteo.net>
---- a/build/ninja_gen/src/build.rs
-+++ b/build/ninja_gen/src/build.rs
-@@ -49,7 +49,7 @@ impl Build {
- output_text: Default::default(),
- action_names: Default::default(),
- groups: Default::default(),
-- have_n2: which::which("n2").is_ok(),
-+ have_n2: false,
- };
-
- build.add_action("build:configure", ConfigureBuild {})?;
---- a/build/runner/src/build.rs
-+++ b/build/runner/src/build.rs
-@@ -56,11 +56,15 @@ pub fn run_build(args: BuildArgs) {
-
- let start_time = Instant::now();
- let mut command = Command::new(get_ninja_command());
-+
-+ if env::var("NINJA_VERBOSE").unwrap_or(String::from("ON")).eq("ON") {
-+ command.arg("-v");
-+ }
-+
- command
- .arg("-f")
- .arg(&build_file)
- .args(ninja_args)
-- .env("NINJA_STATUS", "[%f/%t; %r active; %es] ")
- .env("PATH", &path)
- .env(
- "MYPY_CACHE_DIR",
-@@ -75,6 +79,11 @@ pub fn run_build(args: BuildArgs) {
- // Updating svelte-check or its deps will likely remove the need for it.
- .env("NODE_OPTIONS", "--no-experimental-fetch");
-
-+ if env::var("NINJA_STATUS").is_err() {
-+ command.env("NINJA_STATUS", "[%f/%t; %r active; %es] ");
-+ }
-+
-+
- // run build
- let mut status = command.status().expect("ninja not installed");
- if !status.success() && Instant::now().duration_since(start_time).as_secs() < 3 {
-@@ -109,11 +118,7 @@ pub fn run_build(args: BuildArgs) {
- }
-
- fn get_ninja_command() -> &'static str {
-- if which::which("n2").is_ok() {
-- "n2"
-- } else {
-- "ninja"
-- }
-+ "ninja"
- }
-
- fn setup_build_root() -> Utf8PathBuf {
-@@ -154,8 +159,9 @@ fn bootstrap_build() {
-
- fn maybe_update_buildhash(build_root: &Utf8Path) {
- // only updated on release builds
-+ println!("Patch: Skipping buildhash update if {build_root}/buildhash exists.");
- let path = build_root.join("buildhash");
-- if env::var("RELEASE").is_ok() || !path.exists() {
-+ if !path.exists() {
- write_if_changed(&path, &get_buildhash())
- }
- }
diff --git a/app-misc/anki/files/23.12.1/no-git-submodule-sync.patch b/app-misc/anki/files/23.12.1/no-git-submodule-sync.patch
deleted file mode 100644
index df09a09b91a4..000000000000
--- a/app-misc/anki/files/23.12.1/no-git-submodule-sync.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-This is an adapted patch from the games/anki FreeBSD port.
-https://github.com/freebsd/freebsd-ports/blob/109c3d4629b84972e660b689d169ac0761c1a519/games/anki/files/patch-build_configure_src_rust.rs
-https://github.com/freebsd/freebsd-ports/blob/109c3d4629b84972e660b689d169ac0761c1a519/games/anki/files/patch-build_ninja__gen_src_git.rs
-
-It prevents the build system from issuing the repo sync that
-requires git and an internet connection.
-
-From: Lucio Sauer <watermanpaint@posteo.net>
---- a/build/configure/src/rust.rs
-+++ b/build/configure/src/rust.rs
-@@ -10,7 +10,7 @@ use ninja_gen::cargo::CargoClippy;
- use ninja_gen::cargo::CargoFormat;
- use ninja_gen::cargo::CargoTest;
- use ninja_gen::cargo::RustOutput;
--use ninja_gen::git::SyncSubmodule;
-+use ninja_gen::git::SyncSubmoduleOffline;
- use ninja_gen::glob;
- use ninja_gen::hash::simple_hash;
- use ninja_gen::input::BuildInput;
-@@ -27,15 +27,16 @@ pub fn build_rust(build: &mut Build) -> Result<()> {
-
- fn prepare_translations(build: &mut Build) -> Result<()> {
- // ensure repos are checked out
-+ println!("Patch: Skipping git repository sync for translation files.");
- build.add_action(
- "ftl:repo:core",
-- SyncSubmodule {
-+ SyncSubmoduleOffline {
- path: "ftl/core-repo",
- },
- )?;
- build.add_action(
- "ftl:repo:qt",
-- SyncSubmodule {
-+ SyncSubmoduleOffline {
- path: "ftl/qt-repo",
- },
- )?;
---- a/build/ninja_gen/src/git.rs
-+++ b/build/ninja_gen/src/git.rs
-@@ -12,6 +12,10 @@ pub struct SyncSubmodule {
- pub path: &'static str,
- }
-
-+pub struct SyncSubmoduleOffline {
-+ pub path: &'static str,
-+}
-+
- impl BuildAction for SyncSubmodule {
- fn command(&self) -> &str {
- "git -c protocol.file.allow=always submodule update --init $path"
-@@ -37,6 +41,17 @@ impl BuildAction for SyncSubmodule {
- }
- }
-
-+impl BuildAction for SyncSubmoduleOffline {
-+ fn command(&self) -> &str {
-+ "echo Running SyncSubmoduleOffline stub function for $path"
-+ }
-+
-+ fn files(&mut self, build: &mut impl build::FilesHandle) {
-+ build.add_variable("path", self.path);
-+ build.add_output_stamp(format!("git/{}", self.path));
-+ }
-+}
-+
- /// We check the mtime of .git/HEAD to detect when we should sync submodules.
- /// If this repo is a submodule of another project, .git/HEAD will not exist,
- /// and we fall back on .git/modules/*/HEAD in a parent folder instead.
diff --git a/app-misc/anki/files/23.12.1/pseudo-venv.patch b/app-misc/anki/files/23.12.1/pseudo-venv.patch
deleted file mode 100644
index 8c173021a5b7..000000000000
--- a/app-misc/anki/files/23.12.1/pseudo-venv.patch
+++ /dev/null
@@ -1,127 +0,0 @@
-This is an adapted patch from the games/anki FreeBSD port.
-https://github.com/freebsd/freebsd-ports/blob/109c3d4629b84972e660b689d169ac0761c1a519/games/anki/files/patch-build_configure_src_python.rs
-https://github.com/freebsd/freebsd-ports/blob/109c3d4629b84972e660b689d169ac0761c1a519/games/anki/files/patch-build_ninja__gen_src_python.rs
-
-Use the "PythonEnvironmentStub" function to use a native Python environment
-instead of a Python venv.
-* Avoid the use of Python's pip (network access).
-* Remove the python_binary input for PythonEnvironmentStub since we create the
- pseudo venv manually in the ebuild. This saves us from setting an extra
- environment variable to prevent network access.
-
- The python_binary input should really only be added to PythonEnvironment, if
- the venv is not set up.
-* TODO: add dev-python/mypy-protobuf to tree for fully typed Anki.
-
-From: Lucio Sauer <watermanpaint@posteo.net>
---- a/build/configure/src/python.rs
-+++ b/build/configure/src/python.rs
-@@ -13,6 +13,7 @@ use ninja_gen::input::BuildInput;
- use ninja_gen::inputs;
- use ninja_gen::python::python_format;
- use ninja_gen::python::PythonEnvironment;
-+use ninja_gen::python::PythonEnvironmentStub;
- use ninja_gen::python::PythonLint;
- use ninja_gen::python::PythonTypecheck;
- use ninja_gen::rsync::RsyncFiles;
-@@ -81,6 +82,25 @@ pub fn setup_venv(build: &mut Build) -> Result<()> {
- Ok(())
- }
-
-+pub fn setup_venv_stub(build: &mut Build) -> Result<()> {
-+ build.add_action(
-+ "pyenv",
-+ PythonEnvironmentStub {
-+ folder: "pyenv",
-+ extra_binary_exports: &[
-+ "mypy", // Required in some parts of the code, but not for build
-+ "black", // dito
-+ "isort", // dito
-+ "pylint", // dito
-+ "pytest", // dito
-+ "protoc-gen-mypy",
-+ ],
-+ },
-+ )?;
-+
-+ Ok(())
-+}
-+
- pub struct GenPythonProto {
- pub proto_files: BuildInput,
- }
-@@ -88,9 +108,7 @@ pub struct GenPythonProto {
- impl BuildAction for GenPythonProto {
- fn command(&self) -> &str {
- "$protoc $
-- --plugin=protoc-gen-mypy=$protoc-gen-mypy $
- --python_out=$builddir/pylib $
-- --mypy_out=$builddir/pylib $
- -Iproto $in"
- }
-
-@@ -108,7 +126,6 @@ impl BuildAction for GenPythonProto {
- .collect();
- build.add_inputs("in", &self.proto_files);
- build.add_inputs("protoc", inputs![":protoc_binary"]);
-- build.add_inputs("protoc-gen-mypy", inputs![":pyenv:protoc-gen-mypy"]);
- build.add_outputs("", python_outputs);
- }
-
-@@ -254,7 +271,6 @@ impl BuildAction for Sphinx {
-
- fn files(&mut self, build: &mut impl FilesHandle) {
- build.add_inputs("python", inputs![":pyenv:bin"]);
-- build.add_inputs("pip", inputs![":pyenv:pip"]);
- build.add_inputs("", &self.deps);
- build.add_output_stamp("python/sphinx/stamp");
- }
---- a/build/ninja_gen/src/python.rs
-+++ b/build/ninja_gen/src/python.rs
-@@ -86,6 +86,11 @@ pub struct PythonEnvironment {
- pub extra_binary_exports: &'static [&'static str],
- }
-
-+pub struct PythonEnvironmentStub {
-+ pub folder: &'static str,
-+ pub extra_binary_exports: &'static [&'static str],
-+}
-+
- impl BuildAction for PythonEnvironment {
- fn command(&self) -> &str {
- "$runner pyenv $python_binary $builddir/$pyenv_folder $system_pkgs $base_requirements $requirements"
-@@ -118,6 +123,34 @@ impl BuildAction for PythonEnvironment {
- }
- }
-
-+impl BuildAction for PythonEnvironmentStub {
-+ fn command(&self) -> &str {
-+ "echo Running PythonEnvironmentStub..."
-+ }
-+
-+ fn files(&mut self, build: &mut impl crate::build::FilesHandle) {
-+ let bin_path = |binary: &str| -> Vec<String> {
-+ let folder = self.folder;
-+ let path = if cfg!(windows) {
-+ format!("{folder}/scripts/{binary}.exe")
-+ } else {
-+ format!("{folder}/bin/{binary}")
-+ };
-+ vec![path]
-+ };
-+
-+ build.add_variable("pyenv_folder", self.folder);
-+ build.add_outputs_ext("bin", bin_path("python"), true);
-+ for binary in self.extra_binary_exports {
-+ build.add_outputs_ext(*binary, bin_path(binary), true);
-+ }
-+ }
-+
-+ fn check_output_timestamps(&self) -> bool {
-+ true
-+ }
-+}
-+
- pub struct PythonTypecheck {
- pub folders: &'static [&'static str],
- pub deps: BuildInput,
diff --git a/app-misc/anki/files/24.04.1/ninja-gentoo-setup.patch b/app-misc/anki/files/24.04.1/ninja-gentoo-setup.patch
new file mode 100644
index 000000000000..9774d4e407ee
--- /dev/null
+++ b/app-misc/anki/files/24.04.1/ninja-gentoo-setup.patch
@@ -0,0 +1,45 @@
+Respect app-alternatives/ninja (n2 is not yet in the tree) and
+user variables from the ninja-utils eclass.
+This is a workaround. A proper implementation similar to
+the LTO implementation (c6f429) should allow the build system to be set at
+configure time.
+
+From: Lucio Sauer <watermanpaint@posteo.net>
+--- a/build/ninja_gen/src/build.rs
++++ b/build/ninja_gen/src/build.rs
+@@ -49,7 +49,7 @@ impl Build {
+ output_text: Default::default(),
+ action_names: Default::default(),
+ groups: Default::default(),
+- have_n2: which::which("n2").is_ok(),
++ have_n2: false,
+ };
+
+ build.add_action("build:configure", ConfigureBuild {})?;
+--- a/build/runner/src/build.rs
++++ b/build/runner/src/build.rs
+@@ -56,6 +56,11 @@ pub fn run_build(args: BuildArgs) {
+
+ let start_time = Instant::now();
+ let mut command = Command::new(get_ninja_command());
++
++ if env::var("NINJA_VERBOSE").unwrap_or(String::from("ON")).eq("ON") {
++ command.arg("-v");
++ }
++
+ command
+ .arg("-f")
+ .arg(&build_file)
+@@ -112,11 +117,7 @@ pub fn run_build(args: BuildArgs) {
+ }
+
+ fn get_ninja_command() -> &'static str {
+- if which::which("n2").is_ok() {
+- "n2"
+- } else {
+- "ninja"
+- }
++ "ninja"
+ }
+
+ fn setup_build_root() -> Utf8PathBuf {
diff --git a/app-misc/anki/files/24.04.1/remove-mypy-protobuf.patch b/app-misc/anki/files/24.04.1/remove-mypy-protobuf.patch
new file mode 100644
index 000000000000..363cfff56a1e
--- /dev/null
+++ b/app-misc/anki/files/24.04.1/remove-mypy-protobuf.patch
@@ -0,0 +1,28 @@
+https://github.com/nipunn1313/mypy-protobuf has not yet been packaged.
+It adds typing information to Anki and is only needed for development.
+
+I have packaged some of its test-dependencies on ::guru. Unfortunately,
+I'm not too happy yet with the quality of the transitive test-dep
+dev-python/pytest-mypy-plugins. Any help is welcome!
+
+From: Lucio Sauer <watermanpaint@posteo.net>
+--- a/build/configure/src/python.rs
++++ b/build/configure/src/python.rs
+@@ -90,9 +90,7 @@ pub struct GenPythonProto {
+ impl BuildAction for GenPythonProto {
+ fn command(&self) -> &str {
+ "$protoc $
+- --plugin=protoc-gen-mypy=$protoc-gen-mypy $
+ --python_out=$builddir/pylib $
+- --mypy_out=$builddir/pylib $
+ -Iproto $in"
+ }
+
+@@ -110,7 +108,6 @@ impl BuildAction for GenPythonProto {
+ .collect();
+ build.add_inputs("in", &self.proto_files);
+ build.add_inputs("protoc", inputs![":protoc_binary"]);
+- build.add_inputs("protoc-gen-mypy", inputs![":pyenv:protoc-gen-mypy"]);
+ build.add_outputs("", python_outputs);
+ }
+
diff --git a/app-misc/anki/files/23.12.1/remove-yarn-dep.patch b/app-misc/anki/files/24.04.1/remove-yarn.patch
index d4cfb30b80b4..9343f426de58 100644
--- a/app-misc/anki/files/23.12.1/remove-yarn-dep.patch
+++ b/app-misc/anki/files/24.04.1/remove-yarn.patch
@@ -1,16 +1,6 @@
-This is an adapted patch from the games/anki FreeBSD port.
-https://github.com/freebsd/freebsd-ports/blob/109c3d4629b84972e660b689d169ac0761c1a519/games/anki/files/patch-build_runner_src_yarn.rs
-
The ebuild ships a ready-to-use node_modules tarball which does not require
-sys-apps/yarn to be installed. Pre-built node_modules allows us to run JS tests.
-* Don't add inputs that depend on the yarn:bin target. This saves us from
-setting an extra environment variable.
-
-Rework when nodejs.eclass (GitHub PR 33426) gets added to the tree?
-The benefit of `yarn install --cache-folder .yarn --offline --ignore-scripts`
-is the hackability of `.yarn` contents in src_prepare.
-The drawback is that we lose JS tests since some npm test deps (which?) access
-the network to update their dependency graph before building.
+sys-apps/yarn to be installed. Pre-built node_modules allows us to run JS tests
+but we lose the ability to hack node packages' source files in YARN_CACHE_FOLDER.
From: Lucio Sauer <watermanpaint@posteo.net>
--- a/build/ninja_gen/src/node.rs
@@ -42,9 +32,11 @@ From: Lucio Sauer <watermanpaint@posteo.net>
for binary in binary_exports {
--- a/build/runner/src/yarn.rs
+++ b/build/runner/src/yarn.rs
-@@ -2,23 +2,18 @@
+@@ -1,36 +1,18 @@
+ // Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
+-use std::env;
use std::path::Path;
-use std::process::Command;
@@ -59,10 +51,20 @@ From: Lucio Sauer <watermanpaint@posteo.net>
}
pub fn setup_yarn(args: YarnArgs) {
-+ println!("Patch: Linking pre-built node_modules.");
link_node_modules();
-- run_command(Command::new(&args.yarn_bin).arg("install"));
+- if env::var("OFFLINE_BUILD").is_ok() {
+- println!("OFFLINE_BUILD is set");
+- println!("Running yarn with '--offline' and '--ignore-scripts'.");
+- run_command(
+- Command::new(&args.yarn_bin)
+- .arg("install")
+- .arg("--offline")
+- .arg("--ignore-scripts"),
+- );
+- } else {
+- run_command(Command::new(&args.yarn_bin).arg("install"));
+- }
-
std::fs::write(args.stamp, b"").unwrap();
}
diff --git a/app-misc/anki/files/24.04.1/revert-cert-store-hack.patch b/app-misc/anki/files/24.04.1/revert-cert-store-hack.patch
new file mode 100644
index 000000000000..0bef71e104ca
--- /dev/null
+++ b/app-misc/anki/files/24.04.1/revert-cert-store-hack.patch
@@ -0,0 +1,21 @@
+pip_system_certs is a hack to force certifi to use the system
+certificate store. Let's use dev-python/certifi, which is a hack of
+its own, instead of introducing an automagical dependency.
+
+From: Lucio Sauer <watermanpaint@posteo.net>
+--- a/qt/aqt/__init__.py
++++ b/qt/aqt/__init__.py
+@@ -6,13 +6,6 @@ from __future__ import annotations
+ import logging
+ import sys
+
+-try:
+- import pip_system_certs.wrapt_requests
+-except ModuleNotFoundError:
+- print(
+- "Python module pip_system_certs is not installed. System certificate store and custom SSL certificates may not work. See: https://github.com/ankitects/anki/issues/3016"
+- )
+-
+ if sys.version_info[0] < 3 or sys.version_info[1] < 9:
+ raise Exception("Anki requires Python 3.9+")
+