mozilla-bmo1568145.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Mon, 13 Feb 2023 22:24:53 +0100
branchfirefox109
changeset 1183 e69790650e3c
parent 1152 4cfe46c9a944
child 1184 1c3d3217d679
permissions -rw-r--r--
Firefox 109.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
@@ -15,16 +15,17 @@ from __future__ import absolute_import, 
 
 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 mozbuild.configure.util import Version
 from mozpack.chrome.manifest import Manifest, ManifestLocale, parse_manifest
@@ -102,17 +103,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;