From c208db6317662dc04e90b60257af6674566b040a918741e66e06da5e6cf78aec Mon Sep 17 00:00:00 2001 From: Tristan Miller Date: Sun, 1 Oct 2023 12:57:32 +0000 Subject: [PATCH] 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 --- reproducible.patch | 63 ++++++++++++++++++++++++++++++++++++++++++++++ seamonkey.changes | 5 ++++ seamonkey.spec | 2 ++ 3 files changed, 70 insertions(+) create mode 100644 reproducible.patch diff --git a/reproducible.patch b/reproducible.patch new file mode 100644 index 0000000..4c85be1 --- /dev/null +++ b/reproducible.patch @@ -0,0 +1,63 @@ +https://github.com/mozilla/gecko-dev/commit/025982b6714051c747dcb9600d6e5c92d2dcaf7b + +From 025982b6714051c747dcb9600d6e5c92d2dcaf7b Mon Sep 17 00:00:00 2001 +From: Maxim Cournoyer +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") diff --git a/seamonkey.changes b/seamonkey.changes index 187ab85..43f120f 100644 --- a/seamonkey.changes +++ b/seamonkey.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Sep 28 20:29:03 UTC 2023 - Bernhard Wiedemann + +- Add reproducible.patch to override build date (boo#1047218) + ------------------------------------------------------------------- Thu Sep 21 15:58:45 UTC 2023 - Tristan Miller diff --git a/seamonkey.spec b/seamonkey.spec index 32cdf3b..c9fedc9 100644 --- a/seamonkey.spec +++ b/seamonkey.spec @@ -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