Disable Mach telemetry with an environment variable + machrc config file instead of using a patch

Signed-off-by: celenity <celenity@celenity.dev>
This commit is contained in:
celenity
2025-07-26 01:00:31 -04:00
parent 3a4535b006
commit d839b9e42e
4 changed files with 15 additions and 49 deletions

View File

@@ -1,42 +0,0 @@
diff --git a/python/mach/mach/sentry.py b/python/mach/mach/sentry.py
index b1a2513596..5c32785c99 100644
--- a/python/mach/mach/sentry.py
+++ b/python/mach/mach/sentry.py
@@ -21,7 +21,7 @@ from mach.util import get_state_dir
# https://sentry.io/organizations/mozilla/projects/mach/
_SENTRY_DSN = (
- "https://5cfe351fb3a24e8d82c751252b48722b@o1069899.ingest.sentry.io/6250014"
+ ""
)
@@ -223,5 +223,5 @@ def _is_unmodified_mach_core(topsrcdir: Path):
_is_unmodified_mach_core_result = False
-_is_unmodified_mach_core_result = None
-_is_unmodified_mach_core_thread = None
+_is_unmodified_mach_core_result = False
+_is_unmodified_mach_core_thread = False
diff --git a/python/mach/mach/telemetry.py b/python/mach/mach/telemetry.py
index ab5c3d7ba4..76800926f0 100644
--- a/python/mach/mach/telemetry.py
+++ b/python/mach/mach/telemetry.py
@@ -88,14 +88,14 @@ def is_applicable_telemetry_environment():
# we don't want to collect telemetry again down here.
return False
- return True
+ return False
def is_telemetry_enabled(settings):
if os.environ.get("DISABLE_TELEMETRY") == "1":
return False
- return settings.mach_telemetry.is_enabled
+ return False
def arcrc_path():

8
patches/machrc Normal file
View File

@@ -0,0 +1,8 @@
# https://firefox-source-docs.mozilla.org/mach/usage.html#user-settings
[build]
telemetry = false
[mach_telemetry]
is_enabled = false
is_set_up = true

View File

@@ -3,6 +3,13 @@
# Caution: Should not be sourced directly!
# Use 'env_local.sh' or 'env_fdroid.sh' instead.
# Configure Mach
## https://firefox-source-docs.mozilla.org/mach/usage.html#user-settings
## https://searchfox.org/mozilla-central/rev/f008b9aa/python/mach/mach/telemetry.py#95
## https://searchfox.org/mozilla-central/rev/f008b9aa/python/mach/mach/telemetry.py#284
export DISABLE_TELEMETRY=1
export MACHRC="$patches/machrc"
IRONFOX_LOCALES=$(<"$patches/locales")
export IRONFOX_LOCALES

View File

@@ -115,13 +115,6 @@ patches:
effect: "Improves user privacy by preventing the collection and transmission of telemetry data."
category: "Privacy"
- file: "mach-disable-telemetry.patch"
name: "Disable Telemetry (Mach)"
description: "Disables data collection and submission mechanisms within Mozilla's Mach build system."
reason: "To prevent any usage data, diagnostics, or technical metrics from being sent to Mozilla during the build process."
effect: "Improves privacy for developers by preventing the collection and transmission of telemetry data."
category: "Privacy"
- file: "fenix-disable-crash-reporting.patch"
name: "Disable Crash Reporting (Fenix)"
description: "Disables the collection and submission of crash reports within Firefox for Android."