mozilla-bmo1568145.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Tue, 07 Mar 2023 11:48:25 +0100
branchfirefox110
changeset 1184 1c3d3217d679
parent 1183 e69790650e3c
child 1188 a2caa2a2494f
permissions -rw-r--r--
110.0.1

Author: Bernhard M. Wiedemann <bwiedemann suse de>
Date: 2019-07-22

Allow to override build date with SOURCE_DATE_EPOCH
in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.

diff --git a/python/mozbuild/mozbuild/action/langpack_manifest.py b/python/mozbuild/mozbuild/action/langpack_manifest.py
--- a/python/mozbuild/mozbuild/action/langpack_manifest.py
+++ b/python/mozbuild/mozbuild/action/langpack_manifest.py
@@ -13,16 +13,17 @@
 
 import argparse
 import datetime
 import io
 import json
 import logging
 import os
 import sys
+import time
 
 import fluent.syntax.ast as FTL
 import mozpack.path as mozpath
 import mozversioncontrol
 import requests
 from fluent.syntax.parser import FluentParser
 from mozpack.chrome.manifest import Manifest, ManifestLocale, parse_manifest
 
@@ -101,17 +102,17 @@ def get_dt_from_hg(path):
 #    ts == "20170914215617"
 ###
 def get_timestamp_for_locale(path):
     dt = None
     if os.path.isdir(os.path.join(path, ".hg")):
         dt = get_dt_from_hg(path)
 
     if dt is None:
-        dt = datetime.datetime.utcnow()
+        dt = datetime.datetime.utcfromtimestamp(int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))
 
     dt = dt.replace(microsecond=0)
     return dt.strftime("%Y%m%d%H%M%S")
 
 
 ###
 # Parses an FTL file into a key-value pair object.
 # Does not support attributes, terms, variables, functions or selectors;