mozilla-bmo1568145.patch
branchfirefox113
changeset 1189 ba0c97b018a6
parent 1188 a2caa2a2494f
child 1190 2a24a948b5cf
equal deleted inserted replaced
1188:a2caa2a2494f 1189:ba0c97b018a6
     1 Author: Bernhard M. Wiedemann <bwiedemann suse de>
       
     2 Date: 2019-07-22
       
     3 
       
     4 Allow to override build date with SOURCE_DATE_EPOCH
       
     5 in order to make builds reproducible.
       
     6 See https://reproducible-builds.org/ for why this is good
       
     7 and https://reproducible-builds.org/specs/source-date-epoch/
       
     8 for the definition of this variable.
       
     9 
       
    10 diff --git a/python/mozbuild/mozbuild/action/langpack_manifest.py b/python/mozbuild/mozbuild/action/langpack_manifest.py
       
    11 --- a/python/mozbuild/mozbuild/action/langpack_manifest.py
       
    12 +++ b/python/mozbuild/mozbuild/action/langpack_manifest.py
       
    13 @@ -14,16 +14,17 @@
       
    14  import argparse
       
    15  import datetime
       
    16  import io
       
    17  import json
       
    18  import logging
       
    19  import os
       
    20  import re
       
    21  import sys
       
    22 +import time
       
    23  
       
    24  import fluent.syntax.ast as FTL
       
    25  import mozpack.path as mozpath
       
    26  import mozversioncontrol
       
    27  import requests
       
    28  from fluent.syntax.parser import FluentParser
       
    29  from mozpack.chrome.manifest import Manifest, ManifestLocale, parse_manifest
       
    30  
       
    31 @@ -102,17 +103,17 @@ def get_dt_from_hg(path):
       
    32  #    ts == "20170914215617"
       
    33  ###
       
    34  def get_timestamp_for_locale(path):
       
    35      dt = None
       
    36      if os.path.isdir(os.path.join(path, ".hg")):
       
    37          dt = get_dt_from_hg(path)
       
    38  
       
    39      if dt is None:
       
    40 -        dt = datetime.datetime.utcnow()
       
    41 +        dt = datetime.datetime.utcfromtimestamp(int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))
       
    42  
       
    43      dt = dt.replace(microsecond=0)
       
    44      return dt.strftime("%Y%m%d%H%M%S")
       
    45  
       
    46  
       
    47  ###
       
    48  # Parses an FTL file into a key-value pair object.
       
    49  # Does not support attributes, terms, variables, functions or selectors;