summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaleb Maclennan2024-03-06 21:44:52 +0300
committerCaleb Maclennan2024-03-06 21:44:52 +0300
commit38ffdd2c096a0180124a62de07df3d4dc3eb2b60 (patch)
treeced9ce2491553f359db36740f1be58e33b8afd94
parentf9913a22a1209008f3a21457fd781e18673cc3af (diff)
downloadaur-38ffdd2c096a0180124a62de07df3d4dc3eb2b60.tar.gz
upgpkg: 29.1.1-2
-rw-r--r--.SRCINFO16
-rw-r--r--PKGBUILD12
-rw-r--r--makepkg-source-roller.py375
3 files changed, 389 insertions, 14 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 5be735da29ac..799c5587c29a 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = electron29
pkgdesc = Build cross platform desktop apps with web technologies
- pkgver = 29.1.0
+ pkgver = 29.1.1
pkgrel = 2
url = https://electronjs.org
arch = x86_64
@@ -82,21 +82,21 @@ pkgbase = electron29
optdepends = trash-cli: file deletion support (trash-put)
optdepends = xdg-utils: open URLs with desktop’s default (xdg-email, xdg-open)
options = !lto
- source = git+https://github.com/electron/electron.git#tag=v29.1.0
+ source = git+https://github.com/electron/electron.git#tag=v29.1.1
source = https://gitlab.com/Matt.Jolly/chromium-patches/-/archive/122-3/chromium-patches-122-3.tar.bz2
source = support-ICU-74-in-LazyTextBreakIterator.patch
source = REVERT-simplify-blink-NativeValueTraitsBase.patch
source = REVERT-use-v8-Array-Iterate-for-converting-script-wrappables.patch
source = chromium-constexpr.patch
- source = drop-flags-unsupported-by-clang16.patch
source = compiler-rt-16.patch
source = default_app-icon.patch
+ source = drop-flags-unsupported-by-clang16.patch
source = electron-launcher.sh
source = electron.desktop
source = jinja-python-3.10.patch
source = use-system-libraries-in-node.patch
source = makepkg-source-roller.py
- source = chromium-mirror::git+https://github.com/chromium/chromium.git#tag=122.0.6261.70
+ source = chromium-mirror::git+https://github.com/chromium/chromium.git#tag=122.0.6261.95
source = chromium-mirror_third_party_nan::git+https://github.com/nodejs/nan.git#commit=e14bdcd1f72d62bca1d541b66da43130384ec213
source = chromium-mirror_third_party_electron_node::git+https://github.com/nodejs/node.git#tag=v20.9.0
source = chromium-mirror_third_party_engflow-reclient-configs::git+https://github.com/EngFlow/reclient-configs.git#commit=955335c30a752e9ef7bff375baab5e0819b6c00d
@@ -131,7 +131,7 @@ pkgbase = electron29
source = chromium-mirror_third_party_cros_system_api::git+https://chromium.googlesource.com/chromiumos/platform2/system_api.git#commit=12d5e386005a211570cfdf9849d2fa6a3b38594b
source = chromium-mirror_third_party_crossbench::git+https://chromium.googlesource.com/crossbench.git#commit=1983b3f517da56c35c91296467458f71ad5b9340
source = chromium-mirror_third_party_depot_tools::git+https://chromium.googlesource.com/chromium/tools/depot_tools.git#commit=6fc0c97ab284021b72e3bc962f7fa879ffcad65b
- source = chromium-mirror_third_party_devtools-frontend_src::git+https://chromium.googlesource.com/devtools/devtools-frontend.git#commit=e4d13b251b100b3fdd0c846b94453c0597bc251f
+ source = chromium-mirror_third_party_devtools-frontend_src::git+https://chromium.googlesource.com/devtools/devtools-frontend.git#commit=3fa1fc736f46022f45c7ba7d817d1df1519c55d7
source = chromium-mirror_third_party_dom_distiller_js_dist::git+https://chromium.googlesource.com/chromium/dom-distiller/dist.git#commit=199de96b345ada7c6e7e6ba3d2fa7a6911b8767d
source = chromium-mirror_third_party_eigen3_src::git+https://chromium.googlesource.com/external/gitlab.com/libeigen/eigen.git#commit=454f89af9d6f3525b1df5f9ef9c86df58bf2d4d3
source = chromium-mirror_third_party_farmhash_src::git+https://chromium.googlesource.com/external/github.com/google/farmhash.git#commit=816a4ae622e964763ca0862d9dbd19324a1eaf45
@@ -211,14 +211,14 @@ pkgbase = electron29
source = chromium-mirror_third_party_webdriver_pylib::git+https://chromium.googlesource.com/external/github.com/SeleniumHQ/selenium/py.git#commit=fc5e7e70c098bfb189a9a74746809ad3c5c34e04
source = chromium-mirror_third_party_webgl_src::git+https://chromium.googlesource.com/external/khronosgroup/webgl.git#commit=f4bf599a8b575df685c31d9c4729a70a04e377ed
source = chromium-mirror_third_party_webgpu-cts_src::git+https://chromium.googlesource.com/external/github.com/gpuweb/cts.git#commit=e082b08475761a2ba6a3349dfea72f704c8b68d4
- source = chromium-mirror_third_party_webrtc::git+https://webrtc.googlesource.com/src.git#commit=be2786cd2383b7ec5d158add166275d19e246763
+ source = chromium-mirror_third_party_webrtc::git+https://webrtc.googlesource.com/src.git#commit=6b419a0536b1a0ccfff3682f997c6f19bcbd9bd8
source = chromium-mirror_third_party_wuffs_src::git+https://skia.googlesource.com/external/github.com/google/wuffs-mirror-release-c.git#commit=e3f919ccfe3ef542cfc983a82146070258fb57f8
source = chromium-mirror_third_party_weston_src::git+https://chromium.googlesource.com/external/anongit.freedesktop.org/git/wayland/weston.git#commit=ccf29cb237c3ed09c5f370f35239c93d07abfdd7
source = chromium-mirror_third_party_xdg-utils::git+https://chromium.googlesource.com/chromium/deps/xdg-utils.git#commit=cb54d9db2e535ee4ef13cc91b65a1e2741a94a44
source = chromium-mirror_third_party_xnnpack_src::git+https://chromium.googlesource.com/external/github.com/google/XNNPACK.git#commit=a68aa0a24b0d3e1c75f2f7c0915b70121cee0470
source = chromium-mirror_tools_page_cycler_acid3::git+https://chromium.googlesource.com/chromium/deps/acid3.git#commit=a926d0a32e02c4c03ae95bb798e6c780e0e184ba
source = chromium-mirror_third_party_zstd_src::git+https://chromium.googlesource.com/external/github.com/facebook/zstd.git#commit=050fec5c378d676fede8b2171ec5e84f6afa1504
- source = chromium-mirror_v8::git+https://chromium.googlesource.com/v8/v8.git#commit=7ca8cf1710353b309b30a27873709a2500585ad0
+ source = chromium-mirror_v8::git+https://chromium.googlesource.com/v8/v8.git#commit=d5c51572dec5b2a385b57549fe195c319f1284e2
source = chromium-mirror_third_party_angle_third_party_glmark2_src::git+https://chromium.googlesource.com/external/github.com/glmark2/glmark2.git#commit=ca8de51fedb70bace5351c6b002eb952c747e889
source = chromium-mirror_third_party_angle_third_party_rapidjson_src::git+https://chromium.googlesource.com/external/github.com/Tencent/rapidjson.git#commit=781a4e667d84aeedbeb8184b7b62425ea66ec59f
source = chromium-mirror_third_party_angle_third_party_VK-GL-CTS_src::git+https://chromium.googlesource.com/external/github.com/KhronosGroup/VK-GL-CTS.git#commit=0f6fd3de81102058dc2ae299af1ad5287d2145dd
@@ -254,9 +254,9 @@ pkgbase = electron29
sha256sums = 318df8f8662071cebcdf953698408058e17f59f184500b7e12e01a04a4206b50
sha256sums = 00e06b889e4face0ef41293233ce55bd52064ab040f1fdd84aa19525f8ac3601
sha256sums = a061f83e2b628927feb4dbc441eb54f8b8c3d81348e447cf3b90755d7cda5f54
- sha256sums = 53774fd7f807ad42f77d45cab9e5480cc2bcb0a5c5138110a434407521af9607
sha256sums = 8a2649dcc6ff8d8f24ddbe40dc2a171824f681c6f33c39c4792b645b87c9dcab
sha256sums = dd2d248831dd4944d385ebf008426e66efe61d6fdf66f8932c963a12167947b4
+ sha256sums = 53774fd7f807ad42f77d45cab9e5480cc2bcb0a5c5138110a434407521af9607
sha256sums = b0ac3422a6ab04859b40d4d7c0fd5f703c893c9ec145c9894c468fbc0a4d457c
sha256sums = 4484200d90b76830b69eea3a471c103999a3ce86bb2c29e6c14c945bf4102bae
sha256sums = 55dbe71dbc1f3ab60bf1fa79f7aea7ef1fe76436b1d7df48728a1f8227d2134e
diff --git a/PKGBUILD b/PKGBUILD
index 54796f0a7f20..7b8a28e33539 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -8,7 +8,7 @@
# Note: source array can be synced with an Electron release after updating $pkgver with:
# bash -c 'source PKGBUILD; _update_sources'
-pkgver=29.1.0
+pkgver=29.1.1
_gcc_patches=122-3
pkgrel=2
_major_ver=${pkgver%%.*}
@@ -76,7 +76,7 @@ source=("git+https://github.com/electron/electron.git#tag=v$pkgver"
use-system-libraries-in-node.patch
makepkg-source-roller.py
# BEGIN managed sources
- chromium-mirror::git+https://github.com/chromium/chromium.git#tag=122.0.6261.70
+ chromium-mirror::git+https://github.com/chromium/chromium.git#tag=122.0.6261.95
chromium-mirror_third_party_nan::git+https://github.com/nodejs/nan.git#commit=e14bdcd1f72d62bca1d541b66da43130384ec213
chromium-mirror_third_party_electron_node::git+https://github.com/nodejs/node.git#tag=v20.9.0
chromium-mirror_third_party_engflow-reclient-configs::git+https://github.com/EngFlow/reclient-configs.git#commit=955335c30a752e9ef7bff375baab5e0819b6c00d
@@ -111,7 +111,7 @@ source=("git+https://github.com/electron/electron.git#tag=v$pkgver"
chromium-mirror_third_party_cros_system_api::git+https://chromium.googlesource.com/chromiumos/platform2/system_api.git#commit=12d5e386005a211570cfdf9849d2fa6a3b38594b
chromium-mirror_third_party_crossbench::git+https://chromium.googlesource.com/crossbench.git#commit=1983b3f517da56c35c91296467458f71ad5b9340
chromium-mirror_third_party_depot_tools::git+https://chromium.googlesource.com/chromium/tools/depot_tools.git#commit=6fc0c97ab284021b72e3bc962f7fa879ffcad65b
- chromium-mirror_third_party_devtools-frontend_src::git+https://chromium.googlesource.com/devtools/devtools-frontend.git#commit=e4d13b251b100b3fdd0c846b94453c0597bc251f
+ chromium-mirror_third_party_devtools-frontend_src::git+https://chromium.googlesource.com/devtools/devtools-frontend.git#commit=3fa1fc736f46022f45c7ba7d817d1df1519c55d7
chromium-mirror_third_party_dom_distiller_js_dist::git+https://chromium.googlesource.com/chromium/dom-distiller/dist.git#commit=199de96b345ada7c6e7e6ba3d2fa7a6911b8767d
chromium-mirror_third_party_eigen3_src::git+https://chromium.googlesource.com/external/gitlab.com/libeigen/eigen.git#commit=454f89af9d6f3525b1df5f9ef9c86df58bf2d4d3
chromium-mirror_third_party_farmhash_src::git+https://chromium.googlesource.com/external/github.com/google/farmhash.git#commit=816a4ae622e964763ca0862d9dbd19324a1eaf45
@@ -191,14 +191,14 @@ source=("git+https://github.com/electron/electron.git#tag=v$pkgver"
chromium-mirror_third_party_webdriver_pylib::git+https://chromium.googlesource.com/external/github.com/SeleniumHQ/selenium/py.git#commit=fc5e7e70c098bfb189a9a74746809ad3c5c34e04
chromium-mirror_third_party_webgl_src::git+https://chromium.googlesource.com/external/khronosgroup/webgl.git#commit=f4bf599a8b575df685c31d9c4729a70a04e377ed
chromium-mirror_third_party_webgpu-cts_src::git+https://chromium.googlesource.com/external/github.com/gpuweb/cts.git#commit=e082b08475761a2ba6a3349dfea72f704c8b68d4
- chromium-mirror_third_party_webrtc::git+https://webrtc.googlesource.com/src.git#commit=be2786cd2383b7ec5d158add166275d19e246763
+ chromium-mirror_third_party_webrtc::git+https://webrtc.googlesource.com/src.git#commit=6b419a0536b1a0ccfff3682f997c6f19bcbd9bd8
chromium-mirror_third_party_wuffs_src::git+https://skia.googlesource.com/external/github.com/google/wuffs-mirror-release-c.git#commit=e3f919ccfe3ef542cfc983a82146070258fb57f8
chromium-mirror_third_party_weston_src::git+https://chromium.googlesource.com/external/anongit.freedesktop.org/git/wayland/weston.git#commit=ccf29cb237c3ed09c5f370f35239c93d07abfdd7
chromium-mirror_third_party_xdg-utils::git+https://chromium.googlesource.com/chromium/deps/xdg-utils.git#commit=cb54d9db2e535ee4ef13cc91b65a1e2741a94a44
chromium-mirror_third_party_xnnpack_src::git+https://chromium.googlesource.com/external/github.com/google/XNNPACK.git#commit=a68aa0a24b0d3e1c75f2f7c0915b70121cee0470
chromium-mirror_tools_page_cycler_acid3::git+https://chromium.googlesource.com/chromium/deps/acid3.git#commit=a926d0a32e02c4c03ae95bb798e6c780e0e184ba
chromium-mirror_third_party_zstd_src::git+https://chromium.googlesource.com/external/github.com/facebook/zstd.git#commit=050fec5c378d676fede8b2171ec5e84f6afa1504
- chromium-mirror_v8::git+https://chromium.googlesource.com/v8/v8.git#commit=7ca8cf1710353b309b30a27873709a2500585ad0
+ chromium-mirror_v8::git+https://chromium.googlesource.com/v8/v8.git#commit=d5c51572dec5b2a385b57549fe195c319f1284e2
chromium-mirror_third_party_angle_third_party_glmark2_src::git+https://chromium.googlesource.com/external/github.com/glmark2/glmark2.git#commit=ca8de51fedb70bace5351c6b002eb952c747e889
chromium-mirror_third_party_angle_third_party_rapidjson_src::git+https://chromium.googlesource.com/external/github.com/Tencent/rapidjson.git#commit=781a4e667d84aeedbeb8184b7b62425ea66ec59f
chromium-mirror_third_party_angle_third_party_VK-GL-CTS_src::git+https://chromium.googlesource.com/external/github.com/KhronosGroup/VK-GL-CTS.git#commit=0f6fd3de81102058dc2ae299af1ad5287d2145dd
@@ -236,9 +236,9 @@ sha256sums=('SKIP'
'318df8f8662071cebcdf953698408058e17f59f184500b7e12e01a04a4206b50'
'00e06b889e4face0ef41293233ce55bd52064ab040f1fdd84aa19525f8ac3601'
'a061f83e2b628927feb4dbc441eb54f8b8c3d81348e447cf3b90755d7cda5f54'
- '53774fd7f807ad42f77d45cab9e5480cc2bcb0a5c5138110a434407521af9607'
'8a2649dcc6ff8d8f24ddbe40dc2a171824f681c6f33c39c4792b645b87c9dcab'
'dd2d248831dd4944d385ebf008426e66efe61d6fdf66f8932c963a12167947b4'
+ '53774fd7f807ad42f77d45cab9e5480cc2bcb0a5c5138110a434407521af9607'
'b0ac3422a6ab04859b40d4d7c0fd5f703c893c9ec145c9894c468fbc0a4d457c'
'4484200d90b76830b69eea3a471c103999a3ce86bb2c29e6c14c945bf4102bae'
'55dbe71dbc1f3ab60bf1fa79f7aea7ef1fe76436b1d7df48728a1f8227d2134e'
diff --git a/makepkg-source-roller.py b/makepkg-source-roller.py
new file mode 100644
index 000000000000..d4d3a99f9c71
--- /dev/null
+++ b/makepkg-source-roller.py
@@ -0,0 +1,375 @@
+from collections import OrderedDict
+from importlib.util import spec_from_loader, module_from_spec
+from importlib.machinery import SourceFileLoader
+from tempfile import NamedTemporaryFile
+from heapq import heappush
+import sys
+import requests
+import base64
+import re
+import os
+
+
+def eprint(*args, **kwargs):
+ print(*args, file=sys.stderr, **kwargs)
+
+
+def fetch_deps(url, rev):
+ # Get the DEPS file from the given URL and revision
+ if "googlesource.com" in url:
+ response = requests.get(f"{url}/+/{rev}/DEPS?format=text")
+ response.raise_for_status()
+ return base64.b64decode(response.text).decode("utf-8")
+ elif url.startswith("https://github.com/"):
+ if url.endswith(".git"):
+ url = url[: -len(".git")]
+ response = requests.get(f"{url}/raw/{rev}/DEPS")
+ response.raise_for_status()
+ return response.text
+ else:
+ raise Exception(f"Unimplemented for URL {url}")
+
+
+class Str:
+ def __init__(self, s):
+ self.inner = s
+
+ def __str__(self):
+ return self.inner
+
+
+ignored_dep_prefix = [
+ # MacOS specific
+ "src/third_party/squirrel.mac",
+ # Unnecessary parts
+ "src/docs/website",
+]
+
+
+def parse_deps(path, prefix="", is_src=False, vars=None, reverse_map=None):
+ """
+ path: Path to the DEPS file
+ prefix: Prefix to add when using recursedeps
+ is_src: Whether the current DEPS file is the one from "src" repo
+ vars: Override variables when generating gclient gn args file
+ reverse_map: Map from url to path. Used for de-duplication
+ """
+ spec = spec_from_loader("deps", SourceFileLoader("deps", path))
+ deps_module = module_from_spec(spec)
+
+ def var_substitute(var_name):
+ return deps_module.vars[var_name]
+
+ deps_module.Var = var_substitute
+ deps_module.Str = Str
+
+ spec.loader.exec_module(deps_module)
+
+ for k in (
+ "checkout_win",
+ "checkout_mac",
+ "checkout_ios",
+ "checkout_chromeos",
+ "checkout_fuchsia",
+ "checkout_android",
+ "checkout_cxx_debugging_extension_deps",
+ ):
+ deps_module.vars[k] = False
+ deps_module.vars["checkout_linux"] = True
+ deps_module.vars["build_with_chromium"] = True
+ deps_module.vars["host_os"] = "linux"
+ use_relative_paths = (
+ hasattr(deps_module, "use_relative_paths") and deps_module.use_relative_paths
+ )
+
+ def url_and_revision(raw_url):
+ url = raw_url.format(**deps_module.vars)
+ url, rev = url.rsplit("@", 1)
+ if '.googlesource.com/' in url and not url.endswith(".git"):
+ # Unify url format by adding .git suffix (for de-duplication)
+ url += ".git"
+ return (url, rev)
+
+ def format_path(dep_name):
+ return dep_name if not use_relative_paths else f"{prefix}/{dep_name}"
+
+ real_deps = OrderedDict()
+ cipd_deps = {}
+ reverse_map = reverse_map or {}
+
+ def add_dep(dep_name, raw_url):
+ path = format_path(dep_name)
+ for ignored_prefix in ignored_dep_prefix:
+ if path.startswith(ignored_prefix):
+ eprint(f"Ignoring {path}")
+ return
+ url, rev = url_and_revision(raw_url)
+ real_deps[path] = (url, rev)
+ # Add to reverse map for de-duplication, use a heap to make sure the shortest path is chosen
+ heappush(reverse_map.setdefault(url, []), (len(path), path))
+
+ for dep_name, dep_value in deps_module.deps.items():
+ if isinstance(dep_value, dict):
+ if "dep_type" in dep_value:
+ if dep_value["dep_type"] == "cipd":
+ cipd_deps[format_path(dep_name)] = dep_value["packages"]
+ else:
+ raise Exception(f"Unknown DEP {dep_name} = {dep_value}")
+ else:
+ if "condition" in dep_value and not eval(
+ dep_value["condition"], vars, deps_module.vars
+ ):
+ eprint(
+ f"Skipping {format_path(dep_name)} because of unmet condition {dep_value['condition']}"
+ )
+ continue
+ add_dep(dep_name, dep_value["url"])
+ elif isinstance(dep_value, str):
+ add_dep(dep_name, dep_value)
+ else:
+ raise Exception(f"Unknown DEP {dep_name} = {dep_value}")
+
+ gclient_gn_args = {}
+ vars = vars or {}
+
+ if is_src and hasattr(deps_module, "gclient_gn_args"):
+ for arg in deps_module.gclient_gn_args:
+ # electron vars overwrites chromium vars
+ gclient_gn_args[arg] = (deps_module.vars | vars).get(arg)
+
+ if hasattr(deps_module, "recursedeps"):
+ for dep in deps_module.recursedeps:
+ if dep not in real_deps:
+ eprint(f"Skipping recursive DEP {dep} as it's not found in deps dict")
+ continue
+ eprint(f"Fetching recursedep {dep}")
+ deps_text = fetch_deps(*real_deps[dep])
+ with NamedTemporaryFile(mode="w", delete=True) as f:
+ f.write(deps_text)
+ f.flush()
+ dep_deps, dep_gclient_gn_args, dep_cipd_deps, _ = parse_deps(
+ f.name,
+ format_path(dep),
+ dep == "src",
+ deps_module.vars | vars,
+ reverse_map,
+ )
+ real_deps.update(dep_deps)
+ gclient_gn_args.update(dep_gclient_gn_args)
+ cipd_deps.update(dep_cipd_deps)
+ return real_deps, gclient_gn_args, cipd_deps, reverse_map
+
+
+repos_with_changed_url = {
+ "https://chromium.googlesource.com/chromium/llvm-project/compiler-rt/lib/fuzzer.git",
+ "https://chromium.googlesource.com/external/github.com/protocolbuffers/protobuf.git",
+}
+
+
+def get_source_path(path, url, pkgname, reverse_map):
+ """returns the source path and whether it's deduplicated or not"""
+ deduplicated = False
+ if len(reverse_map[url]) > 1:
+ # Deduplicate, choose the shortest path
+ shortest = reverse_map[url][0][1]
+ if path != shortest:
+ eprint(f"Deduplicate: {path} -> {shortest}")
+ deduplicated = True
+ path = shortest
+ flattened = path.replace("/", "_")
+ result = re.sub("^src", "chromium-mirror", flattened)
+ if url in repos_with_changed_url:
+ # To make makepkg happy when using SRCDEST
+ result += f"_{pkgname}"
+ return result, deduplicated
+
+
+def generate_fragment(rev):
+ if "." in rev:
+ # Treat revisions that contain dot as tags
+ return f"tag={rev}"
+ else:
+ return f"commit={rev}"
+
+
+preferred_url_map = {
+ # Replace with github mirror
+ "https://chromium.googlesource.com/chromium/src.git": "https://github.com/chromium/chromium.git",
+}
+
+
+def get_preferred_url(url):
+ preferred_url = preferred_url_map.get(url)
+ return preferred_url or url
+
+
+def generate_source_list(deps, indent, extra_sources, pkgname, reverse_map):
+ for path, (url, rev) in deps.items():
+ source_path, deduplicated = get_source_path(path, url, pkgname, reverse_map)
+ if deduplicated:
+ # Skip the duplicated source
+ continue
+ yield f"{indent}{source_path}::git+{get_preferred_url(url)}#{generate_fragment(rev)}"
+ for s in extra_sources:
+ yield f"{indent}{s}"
+
+
+def generate_managed_scripts(deps, extra_cmds, pkgname, reverse_map):
+ script = """#!/usr/bin/env rbash
+set -e
+# Generated file. Do not modify by hand.
+# Usage: script <CARCH>
+place_subproject_into_tree () {
+ # place_subproject_into_tree flattened_path path should_copy
+ local parent_dir="$(dirname "$2")"
+ if [[ -n "$parent_dir" ]]; then
+ mkdir -p "$parent_dir"
+ fi
+ # Remove the target dir
+ rm -rf "$2"
+ if [[ "$3" == "true" ]]; then
+ cp -r "$1" "$2"
+ else
+ mv -v "$1" "$2"
+ fi
+}
+
+CARCH="$1"
+case "$CARCH" in
+ x86_64)
+ _go_arch=amd64;;
+ *)
+ _go_arch="$CARCH";;
+esac
+
+"""
+ for path, (url, rev) in deps.items():
+ source_path, deduplicated = get_source_path(path, url, pkgname, reverse_map)
+ if deduplicated:
+ shortest = reverse_map[url][0][1]
+ script += f"place_subproject_into_tree {shortest} {path} true\n"
+ script += f"git -C {path} checkout --detach {rev}\n"
+ else:
+ script += f"place_subproject_into_tree {source_path} {path} false\n"
+ # Additional Commands
+ script += "\n".join(extra_cmds)
+ filename = "prepare-electron-source-tree.sh"
+ with open(filename, "w") as f:
+ f.write(script)
+ return filename
+
+
+def update_pkgbuild(real_deps, reverse_map, extra_sources):
+ with open("PKGBUILD", "r") as f:
+ pkgbuild = f.read()
+ res = re.search(
+ "([ \t]*)# BEGIN managed sources\n((.|\n)*)([ \t]*)# END managed sources",
+ pkgbuild,
+ re.MULTILINE,
+ )
+ if res is None:
+ raise Exception("managed sources not found")
+ indent = res.group(1)
+ span = res.span(2)
+ pkgbuild = (
+ pkgbuild[: span[0]]
+ + "\n".join(
+ generate_source_list(real_deps, indent, extra_sources, pkgname, reverse_map)
+ )
+ + "\n"
+ + indent
+ + pkgbuild[span[1] :]
+ )
+
+ with open("PKGBUILD", "w") as f:
+ f.write(pkgbuild)
+
+
+def pyobj_to_gn_arg(k, v):
+ if isinstance(v, Str):
+ return f'{k} = "{v.inner}"'
+ elif isinstance(v, str):
+ return f'{k} = "{v}"'
+ elif isinstance(v, bool):
+ return f"{k} = {'true' if v else 'false'}"
+ else:
+ raise Exception(f"Cannot convert {k}={v} ({type(v)})to gn arg")
+
+
+def generate_gclient_args(args):
+ """
+ Writes gclient_args.gni
+ Returns command to copy it
+ """
+ with open("gclient_args.gni", "w") as f:
+ f.writelines(pyobj_to_gn_arg(k, v) + "\n" for k, v in args.items())
+
+ return "cp gclient_args.gni src/build/config/gclient_args.gni"
+
+
+def cipd_path_substitute(cipd_path):
+ # Assume PKGBUILD provides _go_arch variable
+ return cipd_path.replace("${{platform}}", "linux-${_go_arch}").replace(
+ "${{arch}}", "${_go_arch}"
+ )
+
+
+def generate_cipd_cmds(cipd_deps, enabled_deps):
+ for dep, is_optional in enabled_deps:
+ packages = cipd_deps.get(dep)
+ if packages is None:
+ if is_optional:
+ continue
+ else:
+ raise f"cipd dependency {dep} not found"
+ for package in packages:
+ yield f"cipd install {cipd_path_substitute(package['package'])} {package['version']} -root {dep}"
+
+
+if __name__ == "__main__":
+ if len(sys.argv) != 4:
+ eprint(f"Usage: {sys.argv[0]} ACTION PATH_OR_ELECTRON_VERSION PKGNAME")
+ sys.exit(1)
+ action = sys.argv[1]
+ deps_path = sys.argv[2]
+ pkgname = sys.argv[3]
+ assert action in ("print", "update", "generate")
+ if not os.path.exists(deps_path):
+ # Get it from web
+ response = requests.get(
+ f"https://github.com/electron/electron/raw/{deps_path}/DEPS"
+ )
+ response.raise_for_status()
+ deps_text = response.text
+ with NamedTemporaryFile(mode="w", delete=True) as f:
+ f.write(deps_text)
+ f.flush()
+ git_deps, gargs, cipd_deps, reverse_map = parse_deps(f.name)
+ else:
+ git_deps, gargs, cipd_deps, reverse_map = parse_deps(deps_path)
+ if action == "print":
+ for name, value in git_deps.items():
+ print(f"git: {name} = {value}")
+ for name, value in cipd_deps.items():
+ print(f"cipd: {name} = {value}")
+ elif action == "update":
+ update_pkgbuild(git_deps, reverse_map, [])
+ elif action == "generate":
+ garg_cmd = generate_gclient_args(gargs)
+ # cipd dependencies are usually binary blobs. Only add the necessary parts.
+ cipd_cmds = generate_cipd_cmds(
+ cipd_deps,
+ [
+ # (dependency path, is_optional)
+ (
+ "src/third_party/screen-ai/linux",
+ True,
+ ), # only for new electron versions (probably >= 29)
+ # The esbuild version 0.14.13 is not compatible with the system one
+ ("src/third_party/devtools-frontend/src/third_party/esbuild", False),
+ ],
+ )
+ managed_script = generate_managed_scripts(
+ git_deps, [garg_cmd] + list(cipd_cmds), pkgname, reverse_map
+ )
+ print("Done")