Skip to content

Commit

Permalink
games/anki: Update to 2.1.46
Browse files Browse the repository at this point in the history
* Remove DIST_SUBDIR, which once made sense when Anki was still a pure
  Python port.  Anki now needs a lot of Rust crates that are also used
  by other ports.

  Therefore, these crates should be placed in the usual place and not
  in an additional subdirectory to save bandwidth and disk space. [1]

Reported by:	se [1]
MFH:		2021Q3
  • Loading branch information
knobix committed Aug 13, 2021
1 parent 4d0cb93 commit 83f30a2
Show file tree
Hide file tree
Showing 22 changed files with 1,185 additions and 898 deletions.
256 changes: 142 additions & 114 deletions games/anki/Makefile

Large diffs are not rendered by default.

1,326 changes: 683 additions & 643 deletions games/anki/distinfo

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions games/anki/files/bazel/BUILD.bazel-local_esbuild
@@ -0,0 +1 @@
exports_files(["bin/esbuild"])
25 changes: 0 additions & 25 deletions games/anki/files/bazel/BUILD.bazel-rslib

This file was deleted.

10 changes: 10 additions & 0 deletions games/anki/files/bazel/BUILD.bazel-rslib-i18n
@@ -0,0 +1,10 @@
# Handles the further processing of "strings.json" within bazel

load("@bazel_skylib//rules:copy_file.bzl", "copy_file")

copy_file(
name = "strings_json",
src = "//local_repos/rust_output/strings_json",
out = "strings.json",
visibility = ["//visibility:public"],
)
7 changes: 0 additions & 7 deletions games/anki/files/bazel/BUILD.bazel-rust_output-fluent_proto

This file was deleted.

7 changes: 7 additions & 0 deletions games/anki/files/bazel/BUILD.bazel-rust_output-strings_json
@@ -0,0 +1,7 @@
# Expose "strings.json" to bazel

filegroup(
name = "strings_json",
srcs = ["strings.json"],
visibility = ["//visibility:public"],
)
16 changes: 8 additions & 8 deletions games/anki/files/bazel/repos.bzl
Expand Up @@ -13,7 +13,7 @@ def register_repos():
# rust
########
native.local_repository(
name = "io_bazel_rules_rust",
name = "rules_rust",
path = "%%_MY_LOCALREPO%%/rules_rust",
)

Expand Down Expand Up @@ -45,20 +45,20 @@ def register_repos():
path = "%%_MY_LOCALREPO%%/rules_nodejs",
)

# esbuild-toolchain
#####################
native.local_repository(
name = "esbuild_toolchain",
path = "%%_MY_LOCALREPO%%/esbuild_toolchain",
)

# sass
########
native.local_repository(
name = "io_bazel_rules_sass",
path = "%%_MY_LOCALREPO%%/rules_sass",
)

# svelte
##########
native.local_repository(
name = "build_bazel_rules_svelte",
path = "%%_MY_LOCALREPO%%/rules_svelte",
)

# i18n translation files
##########################
native.local_repository(
Expand Down
9 changes: 9 additions & 0 deletions games/anki/files/patch-WORKSPACE
@@ -0,0 +1,9 @@
--- WORKSPACE.orig 2021-08-03 06:38:55 UTC
+++ WORKSPACE
@@ -13,6 +13,3 @@ load(":defs.bzl", "setup_deps")

setup_deps()

-load(":late_deps.bzl", "setup_late_deps")
-
-setup_late_deps()
27 changes: 13 additions & 14 deletions games/anki/files/patch-defs.bzl
Expand Up @@ -4,30 +4,29 @@ dependencies (cargo crates, Python packages) during the build process.
Also define local repositories to use "www/node" and "www/yarn" from the
Ports tree.

--- defs.bzl.orig 2021-05-04 05:04:50 UTC
--- defs.bzl.orig 2021-07-30 08:30:37 UTC
+++ defs.bzl
@@ -1,6 +1,5 @@
@@ -1,13 +1,11 @@
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
load("@bazel_skylib//lib:versions.bzl", "versions")
-load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories")
load("@net_ankiweb_anki//cargo:crates.bzl", "raze_fetch_remote_crates")
-load("@rules_rust//rust:repositories.bzl", "rust_repositories")
load("@ankidesktop//cargo:crates.bzl", "raze_fetch_remote_crates")
load(":python.bzl", "setup_local_python")
load(":protobuf.bzl", "setup_protobuf_binary")
@@ -8,7 +7,6 @@ load("//rslib:clang_format.bzl", "setup_clang_format")
load("//proto:protobuf.bzl", "setup_protobuf_binary")
load("//proto:format.bzl", "setup_clang_format")
load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "yarn_install")
load("@io_bazel_rules_sass//:defs.bzl", "sass_repositories")
load("@build_bazel_rules_svelte//:defs.bzl", "rules_svelte_dependencies")
-load("@com_github_ali5h_rules_pip//:defs.bzl", "pip_import")
load("//pip/pyqt5:defs.bzl", "install_pyqt5")
load("@esbuild_toolchain//:esbuild_repo.bzl", "esbuild_dependencies")

anki_version = "2.1.44"
@@ -18,13 +16,6 @@ def setup_deps():
versions.check(minimum_bazel_version = "3.7.0")

- rust_repositories(
- edition = "2018",
- version = "1.48.0",
- include_rustc_srcs = False,
- )
-
- raze_fetch_remote_crates()
Expand All @@ -41,7 +40,7 @@ Ports tree.

- pip_import(
- name = "py_deps",
- requirements = "@net_ankiweb_anki//pip:requirements.txt",
- requirements = "@ankidesktop//pip:requirements.txt",
- python_runtime = "@python//:python",
- )
-
Expand All @@ -50,11 +49,11 @@ Ports tree.
python_runtime = "@python//:python",
)

- node_repositories(package_json = ["@net_ankiweb_anki//ts:package.json"])
- node_repositories(package_json = ["@ankidesktop//ts:package.json"])
+ node_repositories(
+ package_json = ["@net_ankiweb_anki//ts:package.json"],
+ vendored_node = "@local_node//:node",
+ vendored_yarn = "@local_node//:yarn",
+ package_json = ["@ankidesktop//ts:package.json"],
+ vendored_node = "@local_node//:node",
+ vendored_yarn = "@local_node//:yarn",
+ )

yarn_install(
Expand Down
14 changes: 0 additions & 14 deletions games/anki/files/patch-late__deps.bzl

This file was deleted.

@@ -0,0 +1,14 @@
Define a local repository to use "devel/esbuild" from the Ports tree.

--- local_repos/esbuild_toolchain/esbuild_repo.bzl.orig 2021-08-03 12:18:17 UTC
+++ local_repos/esbuild_toolchain/esbuild_repo.bzl
@@ -51,4 +51,9 @@ def esbuild_dependencies():
sha256 = "60af935fc3c29d6defd6e3822d9a00220dc631f4aba5cf5af3ce12d2d0d268e6",
)

+ native.local_repository(
+ name = "esbuild_freebsd",
+ path = "%%_MY_LOCALREPO%%/local_esbuild",
+ )
+
register_default_toolchains()
@@ -0,0 +1,12 @@
Set a custom repository for FreeBSD to use "devel/esbuild" from the Ports tree.

--- local_repos/esbuild_toolchain/toolchain.bzl.orig 2021-08-03 10:59:28 UTC
+++ local_repos/esbuild_toolchain/toolchain.bzl
@@ -14,6 +14,7 @@ TOOLCHAIN = "@esbuild_toolchain//:toolchain_type"

_default_toolchains = [
["@esbuild_darwin//:bin/esbuild", "macos"],
+ ["@esbuild_freebsd//:bin/esbuild", "freebsd"],
["@esbuild_linux//:bin/esbuild", "linux"],
["@esbuild_linux_arm64//:bin/esbuild", "linux_arm64"],
["@esbuild_windows//:esbuild.exe", "windows"],
@@ -1,13 +1,13 @@
Avoid hardcoded paths and Use "shells/bash" from the Ports tree.

--- local_repos/rules_nodejs/internal/node/node_patches.js.orig 2021-02-20 14:13:32 UTC
--- local_repos/rules_nodejs/internal/node/node_patches.js.orig 2021-08-02 17:17:08 UTC
+++ local_repos/rules_nodejs/internal/node/node_patches.js
@@ -579,7 +579,7 @@ set Path=${nodeDir};%Path%
@@ -560,7 +560,7 @@ set Path=${nodeDir};%Path%
else {
const nodeEntry = path.join(nodeDir, 'node');
if (!fs$1.existsSync(nodeEntry)) {
- fs$1.writeFileSync(nodeEntry, `#!/bin/bash
+ fs$1.writeFileSync(nodeEntry, `#!%%LOCALBASE%%/bin/bash
const nodeEntry = path__default['default'].join(nodeDir, 'node');
if (!fs__default['default'].existsSync(nodeEntry)) {
- fs__default['default'].writeFileSync(nodeEntry, `#!/bin/bash
+ fs__default['default'].writeFileSync(nodeEntry, `#!%%LOCALBASE%%/bin/bash
export NP_SUBPROCESS_NODE_DIR="${nodeDir}"
export PATH="${nodeDir}":\$PATH
if [[ ! "\${@}" =~ "${file}" ]]; then
Expand Up @@ -3,9 +3,9 @@ Add FreeBSD to the list of supported operating systems.
At the moment only the "amd64" architecture is defined here but it should be
possible to add more architectures here.

--- local_repos/rules_nodejs/toolchains/node/BUILD.bazel.orig 2021-02-20 14:13:32 UTC
--- local_repos/rules_nodejs/toolchains/node/BUILD.bazel.orig 2021-08-02 17:50:39 UTC
+++ local_repos/rules_nodejs/toolchains/node/BUILD.bazel
@@ -26,6 +26,14 @@ platform(
@@ -34,6 +34,14 @@ platform(
)

platform(
Expand All @@ -19,24 +19,24 @@ possible to add more architectures here.
+platform(
name = "linux_amd64",
constraint_values = [
"@bazel_tools//platforms:linux",
@@ -78,6 +86,7 @@ alias(
name = "toolchain",
"@platforms//os:linux",
@@ -90,6 +98,7 @@ alias(
actual = select({
"@bazel_tools//src/conditions:darwin": "@nodejs_darwin_amd64_config//:toolchain",
"@bazel_tools//src/conditions:darwin_arm64": "@nodejs_darwin_arm64_config//:toolchain",
"@bazel_tools//src/conditions:darwin_x86_64": "@nodejs_darwin_amd64_config//:toolchain",
+ "@bazel_tools//src/conditions:freebsd_x86_64": "@nodejs_freebsd_amd64_config//:toolchain",
"@bazel_tools//src/conditions:linux_aarch64": "@nodejs_linux_arm64_config//:toolchain",
"@bazel_tools//src/conditions:linux_s390x": "@nodejs_linux_s390x_config//:toolchain",
"@bazel_tools//src/conditions:linux_x86_64": "@nodejs_linux_amd64_config//:toolchain",
@@ -92,6 +101,7 @@ alias(
name = "node_bin",
@@ -105,6 +114,7 @@ alias(
actual = select({
"@bazel_tools//src/conditions:darwin": "@nodejs_darwin_amd64//:node_bin",
"@bazel_tools//src/conditions:darwin_arm64": "@nodejs_darwin_arm64//:node_bin",
"@bazel_tools//src/conditions:darwin_x86_64": "@nodejs_darwin_amd64//:node_bin",
+ "@bazel_tools//src/conditions:freebsd_x86_64": "@nodejs_freebsd_amd64//:node_bin",
"@bazel_tools//src/conditions:linux_aarch64": "@nodejs_linux_arm64//:node_bin",
"@bazel_tools//src/conditions:linux_s390x": "@nodejs_linux_s390x//:node_bin",
"@bazel_tools//src/conditions:linux_x86_64": "@nodejs_linux_amd64//:node_bin",
@@ -99,6 +109,16 @@ alias(
@@ -112,6 +122,16 @@ alias(
"//conditions:default": "@nodejs_linux_amd64//:node_bin",
}),
visibility = ["//visibility:public"],
Expand Down
Expand Up @@ -3,14 +3,14 @@ Define a local repository to use "devel/protobuf" from the Ports tree.
At the moment it is only exposed for the "amd64" architecture but it should be
possible to add more architectures here.

--- protobuf.bzl.orig 2021-03-27 05:13:11 UTC
+++ protobuf.bzl
--- proto/protobuf.bzl.orig 2021-07-30 08:30:37 UTC
+++ proto/protobuf.bzl
@@ -15,6 +15,7 @@ alias(
"@net_ankiweb_anki//platforms:windows_x86_64": "@protoc_bin_windows//:bin/protoc.exe",
"@net_ankiweb_anki//platforms:macos_x86_64": "@protoc_bin_macos//:bin/protoc",
"@net_ankiweb_anki//platforms:linux_x86_64": "@protoc_bin_linux_x86_64//:bin/protoc",
+ "@net_ankiweb_anki//platforms:freebsd_x86_64": "@protoc_bin_freebsd//:bin/protoc",
"@net_ankiweb_anki//platforms:linux_arm64": "@protoc_bin_linux_arm64//:bin/protoc"
"@ankidesktop//platforms:windows_x86_64": "@protoc_bin_windows//:bin/protoc.exe",
"@ankidesktop//platforms:macos_x86_64": "@protoc_bin_macos//:bin/protoc",
"@ankidesktop//platforms:linux_x86_64": "@protoc_bin_linux_x86_64//:bin/protoc",
+ "@ankidesktop//platforms:freebsd_x86_64": "@protoc_bin_freebsd//:bin/protoc",
"@ankidesktop//platforms:linux_arm64": "@protoc_bin_linux_arm64//:bin/protoc"
}),
visibility = ["//visibility:public"]
@@ -66,6 +67,11 @@ def setup_protobuf_binary(name):
Expand Down
10 changes: 6 additions & 4 deletions games/anki/files/patch-pylib_anki_BUILD.bazel
@@ -1,7 +1,7 @@
Avoid loading of "requirements.bzl" because it requires "pip_import" which
is already disabled in "defs.bzl".

--- pylib/anki/BUILD.bazel.orig 2021-05-04 05:04:50 UTC
--- pylib/anki/BUILD.bazel.orig 2021-07-30 08:30:37 UTC
+++ pylib/anki/BUILD.bazel
@@ -1,6 +1,5 @@
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
Expand All @@ -10,21 +10,23 @@ is already disabled in "defs.bzl".
load("@rules_python//experimental/python:wheel.bzl", "py_package", "py_wheel")
load("//:defs.bzl", "anki_version")
load("//pylib:orjson.bzl", "orjson_if_available")
@@ -39,13 +38,6 @@ py_library(
],
@@ -41,15 +40,6 @@ py_library(
visibility = ["//visibility:public"],
deps = [
":proto",
- requirement("beautifulsoup4"),
- requirement("decorator"),
- requirement("distro"),
- requirement("protobuf"),
- requirement("requests"),
- requirement("flask"),
- requirement("waitress"),
- requirement("markdown"),
- requirement("stringcase"),
] + orjson_if_available(),
)

@@ -70,6 +62,7 @@ py_wheel(
@@ -74,6 +64,7 @@ py_wheel(
"//platforms:windows_x86_64": "win_amd64",
"//platforms:macos_x86_64": "macosx_10_7_x86_64",
"//platforms:linux_x86_64": "manylinux2014_x86_64",
Expand Down
15 changes: 12 additions & 3 deletions games/anki/files/patch-pylib_anki___backend_BUILD.bazel
@@ -1,21 +1,30 @@
Avoid loading of "requirements.bzl" because it requires "pip_import" which
is already disabled in "defs.bzl".

--- pylib/anki/_backend/BUILD.bazel.orig 2021-05-04 05:04:50 UTC
--- pylib/anki/_backend/BUILD.bazel.orig 2021-07-30 08:30:37 UTC
+++ pylib/anki/_backend/BUILD.bazel
@@ -1,5 +1,4 @@
load("@rules_python//python:defs.bzl", "py_binary")
-load("@py_deps//:requirements.bzl", "requirement")
load("//pylib:protobuf.bzl", "py_proto_library_typed")
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
load("@bazel_skylib//lib:selects.bzl", "selects")
@@ -27,9 +26,6 @@ py_binary(

@@ -9,9 +8,6 @@ py_binary(
"genbackend.py",
],
deps = [
- requirement("black"),
- requirement("stringcase"),
- requirement("protobuf"),
"//pylib/anki:proto",
],
)
@@ -29,8 +25,6 @@ py_binary(
"genfluent.py",
],
deps = [
- requirement("black"),
- requirement("stringcase"),
],
)

10 changes: 9 additions & 1 deletion games/anki/files/patch-pylib_tools_BUILD.bazel
@@ -1,7 +1,7 @@
Avoid loading of "requirements.bzl" because it requires "pip_import" which
is already disabled in "defs.bzl".

--- pylib/tools/BUILD.bazel.orig 2021-05-04 05:04:50 UTC
--- pylib/tools/BUILD.bazel.orig 2021-07-30 08:30:37 UTC
+++ pylib/tools/BUILD.bazel
@@ -1,5 +1,4 @@
load("@rules_python//python:defs.bzl", "py_binary", "py_library")
Expand All @@ -26,3 +26,11 @@ is already disabled in "defs.bzl".
],
)

@@ -53,7 +49,6 @@ py_binary(
],
tags = ["manual"],
deps = [
- requirement("stringcase"),
],
)

0 comments on commit 83f30a2

Please sign in to comment.