From d839b9e42e6e4ade5f992b7833eb29200d402bbb Mon Sep 17 00:00:00 2001 From: celenity Date: Sat, 26 Jul 2025 01:00:31 -0400 Subject: [PATCH] Disable Mach telemetry with an environment variable + machrc config file instead of using a patch Signed-off-by: celenity --- patches/mach-disable-telemetry.patch | 42 ---------------------------- patches/machrc | 8 ++++++ scripts/env_common.sh | 7 +++++ scripts/patches.yaml | 7 ----- 4 files changed, 15 insertions(+), 49 deletions(-) delete mode 100644 patches/mach-disable-telemetry.patch create mode 100644 patches/machrc diff --git a/patches/mach-disable-telemetry.patch b/patches/mach-disable-telemetry.patch deleted file mode 100644 index c9b8865c..00000000 --- a/patches/mach-disable-telemetry.patch +++ /dev/null @@ -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(): diff --git a/patches/machrc b/patches/machrc new file mode 100644 index 00000000..3e651a59 --- /dev/null +++ b/patches/machrc @@ -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 diff --git a/scripts/env_common.sh b/scripts/env_common.sh index 95138690..78a65a14 100644 --- a/scripts/env_common.sh +++ b/scripts/env_common.sh @@ -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 diff --git a/scripts/patches.yaml b/scripts/patches.yaml index c0c5c880..378fa49e 100644 --- a/scripts/patches.yaml +++ b/scripts/patches.yaml @@ -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."