Author: Bernhard M. Wiedemann 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 @@ -14,16 +14,17 @@ import argparse import datetime import io import json import logging import os import re 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 @@ -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;