From 5391bc49d5e742ea4454a0a0588374c205b96ac08581fcb234fb5decbbac274e Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Wed, 28 Jun 2023 13:01:56 +0000 Subject: [PATCH] Accepting request 1095802 from home:pmonrealgonzalez:branches:Java:packages - Update to 2.3.7: [bsc#1186065] * See full changelog in the NEWS file. * Add jython-fix-tty-detection.patch * Rebase patches: - jython-dont-validate-pom.patch - jython-build.patch - jython-cachedir.patch * Remove patches fixed upstream: - jython-makeCompiledFilename.patch - jython-module.patch - jython-nofullbuildpath.patch - jython-cacheperms.patch - jython-compareto.patch - jython-sourcetarget.patch - jython-cached-classes.patch OBS-URL: https://build.opensuse.org/request/show/1095802 OBS-URL: https://build.opensuse.org/package/show/Java:packages/jython?expand=0&rev=38 --- jython-cached-classes.patch | 68 ------------------------------- jython-cacheperms.patch | 31 -------------- jython-compareto.patch | 14 ------- jython-fix-tty-detection.patch | 4 +- jython-makeCompiledFilename.patch | 34 ---------------- jython-module.patch | 11 ----- jython-nofullbuildpath.patch | 40 ------------------ jython-sourcetarget.patch | 13 ------ jython.changes | 19 +++++++++ jython.spec | 14 +++++-- 10 files changed, 32 insertions(+), 216 deletions(-) delete mode 100644 jython-cached-classes.patch delete mode 100644 jython-cacheperms.patch delete mode 100644 jython-compareto.patch delete mode 100644 jython-makeCompiledFilename.patch delete mode 100644 jython-module.patch delete mode 100644 jython-nofullbuildpath.patch delete mode 100644 jython-sourcetarget.patch diff --git a/jython-cached-classes.patch b/jython-cached-classes.patch deleted file mode 100644 index 3dd8045..0000000 --- a/jython-cached-classes.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 85a88bcffe2d61d143b4f8c545bd28b152d8d05b Mon Sep 17 00:00:00 2001 -From: Lubomir Rintel -Date: Wed, 3 Apr 2013 18:31:40 +0200 -Subject: [PATCH 3/3] Use cache dir for classes too - -Instead of attempting to write them next to source files. -Java 6 API does not allow for setting sane permissions (i.e. same as -those of a source file) and relying on defaults is a security hazard -which can lead to information disclosure, or, in case of a too relaxed -umask, arbitrary code execution. - -Also, this will likely improve performance for non-privileged users -which can not write to their distribution's packaged jython tree. ---- - src/org/python/core/PySystemState.java | 6 ++++++ - src/org/python/core/imp.java | 12 ++++++++++-- - 2 files changed, 16 insertions(+), 2 deletions(-) - -diff --git a/src/org/python/core/PySystemState.java b/src/org/python/core/PySystemState.java -index 9de34e3..a124228 100644 ---- a/src/org/python/core/PySystemState.java -+++ b/src/org/python/core/PySystemState.java -@@ -539,6 +539,12 @@ public class PySystemState extends PyObject - public static PackageManager packageManager; - public static File cachedir; - -+ public static File classCache() { -+ if (cachedir == null) -+ return null; -+ return new File(cachedir, "classes"); -+ } -+ - public static boolean isPackageCacheEnabled() { - return cachedir != null; - } -diff --git a/src/org/python/core/imp.java b/src/org/python/core/imp.java -index a9868dd..67c33d6 100644 ---- a/src/org/python/core/imp.java -+++ b/src/org/python/core/imp.java -@@ -117,8 +117,15 @@ public class imp { - } - - private static String makeCompiledFilename(String filename) { -- return filename.substring(0, filename.length() - 3) -- + "$py.class"; -+ String basename = filename.substring(0, filename.length() - 3) -+ + "$py.class"; -+ File cache = Py.getSystemState().classCache(); -+ -+ if (cache == null) { -+ return basename; -+ } else { -+ return new File(cache, basename).getPath(); -+ } - } - - /** -@@ -144,6 +151,7 @@ public class imp { - } - FileOutputStream fop = null; - try { -+ new File(compiledFilename).getParentFile().mkdirs(); - fop = new FileOutputStream(compiledFilename); - fop.write(compiledSource); - fop.close(); --- -1.8.3.1 - diff --git a/jython-cacheperms.patch b/jython-cacheperms.patch deleted file mode 100644 index ee0865a..0000000 --- a/jython-cacheperms.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 517883617472d53c3346ad419f0af42a7dd83705 Mon Sep 17 00:00:00 2001 -From: Lubomir Rintel -Date: Wed, 3 Apr 2013 18:24:46 +0200 -Subject: [PATCH 1/3] Make cache not accessible by anyone else - -Sensitive information might be being cached or umask can be too relaxed, -allowing writes. ---- - src/org/python/core/CachedJarsPackageManager.java | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/src/org/python/core/CachedJarsPackageManager.java b/src/org/python/core/CachedJarsPackageManager.java -index 6953136..764f2f3 100644 ---- a/src/org/python/core/CachedJarsPackageManager.java -+++ b/src/org/python/core/CachedJarsPackageManager.java -@@ -587,6 +587,12 @@ public abstract class CachedJarsPackageManager extends PackageManager { - return false; - } - -+ aCachedir1.setReadable(false, false); -+ aCachedir1.setWritable(false, false); -+ aCachedir1.setExecutable(false, false); -+ aCachedir1.setReadable(true, true); -+ aCachedir1.setWritable(true, true); -+ aCachedir1.setExecutable(true, true); - this.cachedir = aCachedir1; - - return true; --- -1.8.3.1 - diff --git a/jython-compareto.patch b/jython-compareto.patch deleted file mode 100644 index 4e11ec6..0000000 --- a/jython-compareto.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- jython-svn-Release_2_2_1/Lib/test/javatests/AnonInner.java 2006-04-09 18:14:16.000000000 +0200 -+++ jython-svn-Release_2_2_1/Lib/test/javatests/AnonInner.java 2017-09-08 11:14:45.116655838 +0200 -@@ -9,11 +9,6 @@ - public int hashCode() { - return 2000; - } -- //XXX: stuck compareTo to make the compiler happier. -- // hopefully this doesn't mess up the test. -- public int compareTo(Object x) { -- return 0; -- } - }; - return d.hashCode(); - } diff --git a/jython-fix-tty-detection.patch b/jython-fix-tty-detection.patch index 2572aa3..f4ebb23 100644 --- a/jython-fix-tty-detection.patch +++ b/jython-fix-tty-detection.patch @@ -1,5 +1,5 @@ ---- src/shell/jython.orig 2017-08-11 16:24:32.831309328 +0100 -+++ src/shell/jython 2017-08-11 16:23:55.346726416 +0100 +--- jython-2.7.3/src/shell/jython.orig 2017-08-11 16:24:32.831309328 +0100 ++++ jython-2.7.3/src/shell/jython 2017-08-11 16:23:55.346726416 +0100 @@ -242,6 +242,11 @@ fi fi diff --git a/jython-makeCompiledFilename.patch b/jython-makeCompiledFilename.patch deleted file mode 100644 index d0b5215..0000000 --- a/jython-makeCompiledFilename.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 9adf26828ecf5650a86885b344b93242f6617220 Mon Sep 17 00:00:00 2001 -From: Lubomir Rintel -Date: Wed, 3 Apr 2013 18:32:14 +0200 -Subject: [PATCH 2/3] Avoid code duplication with makeCompiledFilename() - ---- - src/org/python/core/imp.java | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/org/python/core/imp.java b/src/org/python/core/imp.java -index a902079..a9868dd 100644 ---- a/src/org/python/core/imp.java -+++ b/src/org/python/core/imp.java -@@ -424,7 +424,7 @@ public class imp { - - int nlen = name.length(); - String sourceName = "__init__.py"; -- String compiledName = "__init__$py.class"; -+ String compiledName = makeCompiledFilename(sourceName); - String directoryName = defaultEmptyPathDirectory(entry.toString()); - - // First check for packages -@@ -437,7 +437,7 @@ public class imp { - if (!pkg) { - Py.writeDebug(IMPORT_LOG, "trying source " + dir.getPath()); - sourceName = name + ".py"; -- compiledName = name + "$py.class"; -+ compiledName = makeCompiledFilename(sourceName); - sourceFile = new File(directoryName, sourceName); - compiledFile = new File(directoryName, compiledName); - } else { --- -1.8.3.1 - diff --git a/jython-module.patch b/jython-module.patch deleted file mode 100644 index 9d6eb3a..0000000 --- a/jython-module.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- jython-svn-Release_2_2_1/src/org/python/parser/TreeBuilder.java 2007-06-30 10:57:09.000000000 +0200 -+++ jython-svn-Release_2_2_1/src/org/python/parser/TreeBuilder.java 2017-09-08 11:05:27.462211440 +0200 -@@ -111,7 +111,7 @@ - case JJTSINGLE_INPUT: - return new Interactive(makeStmts(arity)); - case JJTFILE_INPUT: -- return new Module(makeStmts(arity)); -+ return new org.python.parser.ast.Module(makeStmts(arity)); - case JJTEVAL_INPUT: - return new Expression(makeExpr()); - diff --git a/jython-nofullbuildpath.patch b/jython-nofullbuildpath.patch deleted file mode 100644 index 4ac1ef2..0000000 --- a/jython-nofullbuildpath.patch +++ /dev/null @@ -1,40 +0,0 @@ -Index: jython-svn-Release_2_2_1/build.xml -=================================================================== ---- jython-svn-Release_2_2_1.orig/build.xml 2007-10-13 20:44:01.000000000 +0200 -+++ jython-svn-Release_2_2_1/build.xml 2011-03-11 13:44:32.516562588 +0100 -@@ -551,7 +551,7 @@ - - - -- -+ - - - -@@ -572,7 +572,7 @@ - - - -- -+ - -- -+ - - copy misc files from ${jython.base.dir} - -@@ -599,7 +599,7 @@ - - - copy CPython LICENSE from ${svn.checkout.dir}/python -- -+ - - - copy sources from ${jython.base.dir} diff --git a/jython-sourcetarget.patch b/jython-sourcetarget.patch deleted file mode 100644 index 5b4e1a0..0000000 --- a/jython-sourcetarget.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- jython-svn-Release_2_2_1/build.xml 2007-10-13 20:44:01.000000000 +0200 -+++ jython-svn-Release_2_2_1/build.xml 2017-09-08 11:01:08.947884132 +0200 -@@ -174,8 +174,8 @@ - - - -- -- -+ -+ - - - diff --git a/jython.changes b/jython.changes index 465d444..42856ab 100644 --- a/jython.changes +++ b/jython.changes @@ -1,3 +1,22 @@ +------------------------------------------------------------------- +Wed Jun 28 10:40:43 UTC 2023 - Pedro Monreal + +- Update to 2.3.7: [bsc#1186065] + * See full changelog in the NEWS file. + * Add jython-fix-tty-detection.patch + * Rebase patches: + - jython-dont-validate-pom.patch + - jython-build.patch + - jython-cachedir.patch + * Remove patches fixed upstream: + - jython-makeCompiledFilename.patch + - jython-module.patch + - jython-nofullbuildpath.patch + - jython-cacheperms.patch + - jython-compareto.patch + - jython-sourcetarget.patch + - jython-cached-classes.patch + ------------------------------------------------------------------- Sun Mar 20 12:20:10 UTC 2022 - Fridrich Strba diff --git a/jython.spec b/jython.spec index 7b958f4..b2edb85 100644 --- a/jython.spec +++ b/jython.spec @@ -30,6 +30,8 @@ URL: https://www.jython.org/ Source0: %{name}-%{version}.tar.xz Patch0: %{name}-build.patch Patch1: %{name}-dont-validate-pom.patch +Patch2: %{name}-cachedir.patch +Patch3: %{name}-fix-tty-detection.patch BuildRequires: ant BuildRequires: ant-junit BuildRequires: antlr3-java @@ -92,6 +94,8 @@ development and in shipping products. %package javadoc Summary: Javadoc for jython Group: Development/Libraries/Java +Provides: jython-manual = %{version} +Obsoletes: jython-manual < %{version} BuildArch: noarch %description javadoc @@ -107,9 +111,7 @@ BuildArch: noarch Demonstrations and samples for %{name}. %prep -%setup -q -%patch0 -p1 -%patch1 -p1 +%autosetup -p1 %build build-jar-repository -s -p extlibs \ @@ -160,6 +162,12 @@ build-jar-repository -s -p dist/javalib \ objectweb-asm/asm-util \ stringtemplate4/ST4 +# remove shebangs from python files +find dist -type f -name '*.py' | xargs sed -i "s:#!\s*/usr.*::" + +# fix env-script-interpreter +sed -i 's/env bash/bash/' dist/bin/%{name}{,.py} + %install # jar install -d -m 755 %{buildroot}%{_javadir}