Accepting request 1114150 from home:bmwiedemann:branches:mozilla:Factory

Add reproducible.patch to override build date (boo#1047218)

OBS-URL: https://build.opensuse.org/request/show/1114150
OBS-URL: https://build.opensuse.org/package/show/mozilla:Factory/seamonkey?expand=0&rev=43
This commit is contained in:
Tristan Miller 2023-10-01 12:57:32 +00:00 committed by Git OBS Bridge
parent f86dd33d2a
commit c208db6317
3 changed files with 70 additions and 0 deletions

63
reproducible.patch Normal file
View File

@ -0,0 +1,63 @@
https://github.com/mozilla/gecko-dev/commit/025982b6714051c747dcb9600d6e5c92d2dcaf7b
From 025982b6714051c747dcb9600d6e5c92d2dcaf7b Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Thu, 16 Mar 2023 14:01:58 +0000
Subject: [PATCH] Bug 1817032 - Honor SOURCE_DATE_EPOCH to build langpacks
reproducibly. r=eemeli@mozilla.com
Differential Revision: https://phabricator.services.mozilla.com/D169979
---
.../mozbuild/action/langpack_manifest.py | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/python/mozbuild/mozbuild/action/langpack_manifest.py b/python/mozbuild/mozbuild/action/langpack_manifest.py
index f82a329cc..10e42fe99 100644
--- a/python/mozbuild/mozbuild/action/langpack_manifest.py
+++ b/python/mozbuild/mozbuild/action/langpack_manifest.py
@@ -16,6 +16,7 @@ import os
import json
import io
import datetime
+import time
import requests
import mozversioncontrol
import mozpack.path as mozpath
@@ -36,9 +37,17 @@ def write_file(path, content):
pushlog_api_url = "{0}/json-rev/{1}"
+def get_build_date():
+ """Return the current date or SOURCE_DATE_EPOCH, if set."""
+ return datetime.datetime.utcfromtimestamp(
+ int(os.environ.get("SOURCE_DATE_EPOCH", time.time()))
+ )
+
+
###
-# Retrievers a UTC datetime of the push for the current commit
-# from a mercurial clone directory.
+# Retrieves a UTC datetime of the push for the current commit from a
+# mercurial clone directory. The SOURCE_DATE_EPOCH environment
+# variable is honored, for reproducibility.
#
# Args:
# path (str) - path to a directory
@@ -54,7 +63,7 @@ def get_dt_from_hg(path):
with mozversioncontrol.get_repository_object(path=path) as repo:
phase = repo._run("log", "-r", ".", "-T" "{phase}")
if phase.strip() != "public":
- return datetime.datetime.utcnow()
+ return get_build_date()
repo_url = repo._run("paths", "default")
repo_url = repo_url.strip().replace("ssh://", "https://")
repo_url = repo_url.replace("hg://", "https://")
@@ -99,7 +108,7 @@ def get_timestamp_for_locale(path):
dt = get_dt_from_hg(path)
if dt is None:
- dt = datetime.datetime.utcnow()
+ dt = get_build_date()
dt = dt.replace(microsecond=0)
return dt.strftime("%Y%m%d%H%M%S")

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Sep 28 20:29:03 UTC 2023 - Bernhard Wiedemann <bwiedemann@suse.com>
- Add reproducible.patch to override build date (boo#1047218)
-------------------------------------------------------------------
Thu Sep 21 15:58:45 UTC 2023 - Tristan Miller <psychonaut@nothingisreal.com>

View File

@ -92,6 +92,7 @@ Patch1: mozilla-nongnome-proxies.patch
Patch3: mozilla-ntlm-full-path.patch
Patch4: seamonkey-lto.patch
Patch5: seamonkey-man-page.patch
Patch6: reproducible.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
PreReq: /bin/sh coreutils
Provides: seamonkey-mail = %{version}
@ -223,6 +224,7 @@ cp %{SOURCE12} GNUmakefile
%patch3 -p2
%patch4 -p1
%patch5 -p0
%patch6 -p1
cat << EOF > .mozconfig
mk_add_options MOZILLA_OFFICIAL=1