From 9214c6ae80105dffb90aa594494a1522e1526be55fd2102e116f23cde6a2849a Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Tue, 19 Sep 2023 13:40:30 +0000 Subject: [PATCH 1/6] OBS-URL: https://build.opensuse.org/package/show/Java:packages/jython?expand=0&rev=41 --- jython-reproducible-now.patch | 59 +++++++++++++++++++++++++++++++++++ jython.spec | 1 + 2 files changed, 60 insertions(+) create mode 100644 jython-reproducible-now.patch diff --git a/jython-reproducible-now.patch b/jython-reproducible-now.patch new file mode 100644 index 0000000..ee8e2b9 --- /dev/null +++ b/jython-reproducible-now.patch @@ -0,0 +1,59 @@ +diff --git a/src/org/python/core/PySystemState.java b/src/org/python/core/PySystemState.java +index 1fb701d..ee9b38f 100644 +--- a/src/org/python/core/PySystemState.java ++++ b/src/org/python/core/PySystemState.java +@@ -1278,9 +1278,11 @@ public class PySystemState extends PyObject + } + cachedir = new File(props.getProperty(PYTHON_CACHEDIR, CACHEDIR_DEFAULT_NAME)); + if (!cachedir.isAbsolute()) { +- String prefixString = props.getProperty("user.dir", ""); +- cachedir = new File(prefixString, cachedir.getPath()); +- cachedir = cachedir.getAbsoluteFile(); ++ File jythondir = new File(System.getProperty("user.home"), ".jython-cache"); ++ if (!jythondir.isDirectory()) { ++ jythondir.mkdirs(); ++ } ++ cachedir = new File(jythondir, cachedir.getPath()); + } + logger.log(Level.CONFIG, "cache at {0}", cachedir); + } +diff --git a/src/org/python/modules/posix/PosixModule.java b/src/org/python/modules/posix/PosixModule.java +index e3a8dd9..07d4b43 100644 +--- a/src/org/python/modules/posix/PosixModule.java ++++ b/src/org/python/modules/posix/PosixModule.java +@@ -1144,7 +1144,7 @@ public class PosixModule implements ClassDictInit { + if (times == Py.None) { + // FIXME dynamically bind to java.time.Instant, available in Java 8, + // to potentially get higher resolution (nanosecond) time +- atime = mtime = FileTime.from( ++ atime = mtime = FileTime.from(System.getenv("SOURCE_DATE_EPOCH") != null ? 1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH")) : + System.currentTimeMillis(), TimeUnit.MILLISECONDS); + } else if (times instanceof PyTuple && times.__len__() == 2) { + atime = getFileTime(times.__getitem__(0)); +diff --git a/src/org/python/modules/random/PyRandom.java b/src/org/python/modules/random/PyRandom.java +index f5ea8d9..0dc4881 100644 +--- a/src/org/python/modules/random/PyRandom.java ++++ b/src/org/python/modules/random/PyRandom.java +@@ -45,7 +45,7 @@ public class PyRandom extends PyObject { + final void Random_seed(PyObject seed) { + long n; + if (seed == null) { +- seed = new PyLong(System.currentTimeMillis()); ++ seed = new PyLong(System.getenv("SOURCE_DATE_EPOCH") != null ? 1000 * Long.parseLong(System.getenv("SOURCE_DATE_EPOCH")) : System.currentTimeMillis()); + } + if (seed instanceof PyLong) { + PyLong max = new PyLong(Long.MAX_VALUE); +diff --git a/src/org/python/modules/time/Time.java b/src/org/python/modules/time/Time.java +index ebd9871..cf2218d 100644 +--- a/src/org/python/modules/time/Time.java ++++ b/src/org/python/modules/time/Time.java +@@ -131,6 +131,9 @@ public class Time implements ClassDictInit + } + + public static double time() { ++ if (System.getenv("SOURCE_DATE_EPOCH") != null) { ++ return Long.parseLong(System.getenv("SOURCE_DATE_EPOCH")).doubleValue(); ++ } + return System.currentTimeMillis()/1000.0; + } + diff --git a/jython.spec b/jython.spec index b2edb85..0c2829c 100644 --- a/jython.spec +++ b/jython.spec @@ -32,6 +32,7 @@ Patch0: %{name}-build.patch Patch1: %{name}-dont-validate-pom.patch Patch2: %{name}-cachedir.patch Patch3: %{name}-fix-tty-detection.patch +Patch4: %{name}-reproducible-now.patch BuildRequires: ant BuildRequires: ant-junit BuildRequires: antlr3-java From c50ffbc5d18fb5cfb40fe5b6b8eca9a790c0c4dc0a36891f5902905bb80c9ed6 Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Tue, 19 Sep 2023 13:42:19 +0000 Subject: [PATCH 2/6] OBS-URL: https://build.opensuse.org/package/show/Java:packages/jython?expand=0&rev=42 --- jython-reproducible-now.patch | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/jython-reproducible-now.patch b/jython-reproducible-now.patch index ee8e2b9..a4722c9 100644 --- a/jython-reproducible-now.patch +++ b/jython-reproducible-now.patch @@ -1,22 +1,3 @@ -diff --git a/src/org/python/core/PySystemState.java b/src/org/python/core/PySystemState.java -index 1fb701d..ee9b38f 100644 ---- a/src/org/python/core/PySystemState.java -+++ b/src/org/python/core/PySystemState.java -@@ -1278,9 +1278,11 @@ public class PySystemState extends PyObject - } - cachedir = new File(props.getProperty(PYTHON_CACHEDIR, CACHEDIR_DEFAULT_NAME)); - if (!cachedir.isAbsolute()) { -- String prefixString = props.getProperty("user.dir", ""); -- cachedir = new File(prefixString, cachedir.getPath()); -- cachedir = cachedir.getAbsoluteFile(); -+ File jythondir = new File(System.getProperty("user.home"), ".jython-cache"); -+ if (!jythondir.isDirectory()) { -+ jythondir.mkdirs(); -+ } -+ cachedir = new File(jythondir, cachedir.getPath()); - } - logger.log(Level.CONFIG, "cache at {0}", cachedir); - } diff --git a/src/org/python/modules/posix/PosixModule.java b/src/org/python/modules/posix/PosixModule.java index e3a8dd9..07d4b43 100644 --- a/src/org/python/modules/posix/PosixModule.java From 1eb93780866918fbad6972ab8da0c6ce5942431eefd92c17c2e690735b780427 Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Tue, 19 Sep 2023 13:44:28 +0000 Subject: [PATCH 3/6] OBS-URL: https://build.opensuse.org/package/show/Java:packages/jython?expand=0&rev=43 --- jython-reproducible-now.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jython-reproducible-now.patch b/jython-reproducible-now.patch index a4722c9..d785277 100644 --- a/jython-reproducible-now.patch +++ b/jython-reproducible-now.patch @@ -33,7 +33,7 @@ index ebd9871..cf2218d 100644 public static double time() { + if (System.getenv("SOURCE_DATE_EPOCH") != null) { -+ return Long.parseLong(System.getenv("SOURCE_DATE_EPOCH")).doubleValue(); ++ return Long.parseLong(System.getenv("SOURCE_DATE_EPOCH")); + } return System.currentTimeMillis()/1000.0; } From 57ac56c3781c760846c3cc36f150caebaf4ff90f253490ca74ce6dafa790fa0e Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Mon, 25 Sep 2023 16:32:41 +0000 Subject: [PATCH 4/6] OBS-URL: https://build.opensuse.org/package/show/Java:packages/jython?expand=0&rev=44 --- jython-reproducible-builds.patch | 43 ++++++++++++++++++++++++++++++++ jython.spec | 1 + 2 files changed, 44 insertions(+) create mode 100644 jython-reproducible-builds.patch diff --git a/jython-reproducible-builds.patch b/jython-reproducible-builds.patch new file mode 100644 index 0000000..452821b --- /dev/null +++ b/jython-reproducible-builds.patch @@ -0,0 +1,43 @@ +diff --git a/build.xml b/build.xml +index 52dfe71..0d41bdf 100644 +--- a/build.xml ++++ b/build.xml +@@ -721,8 +721,12 @@ The text for an official release would continue like ... + + + +- +- ++ ++ ++ + + + +@@ -1151,7 +1155,10 @@ The text for an official release would continue like ... + + + +- ++ ++ + + + +@@ -1175,7 +1182,10 @@ The text for an official release would continue like ... + +- ++ ++ + + + diff --git a/jython.spec b/jython.spec index 0c2829c..1cd7f99 100644 --- a/jython.spec +++ b/jython.spec @@ -33,6 +33,7 @@ Patch1: %{name}-dont-validate-pom.patch Patch2: %{name}-cachedir.patch Patch3: %{name}-fix-tty-detection.patch Patch4: %{name}-reproducible-now.patch +Patch5: %{name}-reproducible-builds.patch BuildRequires: ant BuildRequires: ant-junit BuildRequires: antlr3-java From 38c6f22417d2c97ba07fefa796351bf294e3ef322fc8dcabe84ece161988ede5 Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Mon, 25 Sep 2023 16:48:43 +0000 Subject: [PATCH 5/6] OBS-URL: https://build.opensuse.org/package/show/Java:packages/jython?expand=0&rev=45 --- jython-java8compat.patch | 55 ++++++++++++++++++++++++++++++++++++++++ jython.spec | 1 + 2 files changed, 56 insertions(+) create mode 100644 jython-java8compat.patch diff --git a/jython-java8compat.patch b/jython-java8compat.patch new file mode 100644 index 0000000..f6585c1 --- /dev/null +++ b/jython-java8compat.patch @@ -0,0 +1,55 @@ +diff --git a/build.xml b/build.xml +index 52dfe71..43d7649 100644 +--- a/build.xml ++++ b/build.xml +@@ -91,8 +91,8 @@ informix.jar = ../support/jdbc-4.10.12.jar + + + +- +- ++ ++ + +