From a205c5d0dbfb914b443c97b500414b37cccb653b5db57237b7a14221b95a8d72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Fri, 3 May 2024 14:03:58 +0200 Subject: [PATCH] Sync from SUSE:SLFO:Main jline revision b1d913699ff3c60d6248fce9b67879dc --- .gitattributes | 23 ++++++ jline-2.14.6.tar.gz | 3 + jline-build.xml | 133 +++++++++++++++++++++++++++++++++ jline-jansi2.patch | 162 ++++++++++++++++++++++++++++++++++++++++ jline-java8compat.patch | 67 +++++++++++++++++ jline.changes | 105 ++++++++++++++++++++++++++ jline.spec | 94 +++++++++++++++++++++++ 7 files changed, 587 insertions(+) create mode 100644 .gitattributes create mode 100644 jline-2.14.6.tar.gz create mode 100644 jline-build.xml create mode 100644 jline-jansi2.patch create mode 100644 jline-java8compat.patch create mode 100644 jline.changes create mode 100644 jline.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/jline-2.14.6.tar.gz b/jline-2.14.6.tar.gz new file mode 100644 index 0000000..67340b0 --- /dev/null +++ b/jline-2.14.6.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c6205afb214288cd8ef53f1ea1243ba9388c84b55c929f0b9e6cee7757c6efac +size 116599 diff --git a/jline-build.xml b/jline-build.xml new file mode 100644 index 0000000..374483b --- /dev/null +++ b/jline-build.xml @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jline-jansi2.patch b/jline-jansi2.patch new file mode 100644 index 0000000..12c5d1e --- /dev/null +++ b/jline-jansi2.patch @@ -0,0 +1,162 @@ +--- jline2-jline-2.14.6/src/main/java/jline/AnsiWindowsTerminal.java 2022-05-13 06:20:11.713726341 +0200 ++++ jline2-jline-2.14.6/src/main/java/jline/AnsiWindowsTerminal.java 2022-05-13 07:21:11.191259791 +0200 +@@ -9,12 +9,17 @@ + package jline; + + import jline.internal.Configuration; ++import org.fusesource.jansi.AnsiColors; + import org.fusesource.jansi.AnsiConsole; +-import org.fusesource.jansi.AnsiOutputStream; +-import org.fusesource.jansi.WindowsAnsiOutputStream; ++import org.fusesource.jansi.AnsiMode; ++import org.fusesource.jansi.AnsiType; ++ ++import org.fusesource.jansi.io.AnsiOutputStream; ++import org.fusesource.jansi.io.WindowsAnsiProcessor; + + import java.io.ByteArrayOutputStream; + import java.io.OutputStream; ++import java.nio.charset.Charset; + + /** + * ANSI-supported {@link WindowsTerminal}. +@@ -42,26 +47,26 @@ + if (Configuration.isWindows()) { + // On windows we know the console does not interpret ANSI codes.. + try { +- return new WindowsAnsiOutputStream(stream); ++ return new AnsiOutputStream(stream, null, AnsiMode.Default, new WindowsAnsiProcessor(stream), AnsiType.Emulation, AnsiColors.Colors16, Charset.defaultCharset(), null, null, false ); + } catch (Throwable ignore) { + // this happens when JNA is not in the path.. or + // this happens when the stdout is being redirected to a file. + } + // Use the ANSIOutputStream to strip out the ANSI escape sequences. +- return new AnsiOutputStream(stream); ++ return new AnsiOutputStream(stream, null, AnsiMode.Strip, null, AnsiType.Unsupported, AnsiColors.TrueColor, Charset.defaultCharset(), null, null, false); + } + return stream; + } + + private static boolean detectAnsiSupport() { +- OutputStream out = AnsiConsole.wrapOutputStream(new ByteArrayOutputStream()); + try { +- out.close(); ++ new WindowsAnsiProcessor(new ByteArrayOutputStream()); ++ return true; + } + catch (Exception e) { + // ignore; + } +- return out instanceof WindowsAnsiOutputStream; ++ return false; + } + + public AnsiWindowsTerminal() throws Exception { +--- jline2-jline-2.14.6/src/main/java/jline/internal/Ansi.java 2022-05-13 06:20:11.749726581 +0200 ++++ jline2-jline-2.14.6/src/main/java/jline/internal/Ansi.java 2022-05-13 06:20:28.793840511 +0200 +@@ -10,8 +10,12 @@ + + import java.io.ByteArrayOutputStream; + import java.io.IOException; ++import java.nio.charset.Charset; + +-import org.fusesource.jansi.AnsiOutputStream; ++import org.fusesource.jansi.io.AnsiOutputStream; ++import org.fusesource.jansi.AnsiColors; ++import org.fusesource.jansi.AnsiMode; ++import org.fusesource.jansi.AnsiType; + + /** + * Ansi support. +@@ -25,7 +29,18 @@ + if (str == null) return ""; + try { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); +- AnsiOutputStream aos = new AnsiOutputStream(baos); ++ AnsiOutputStream aos = new AnsiOutputStream( ++ baos, ++ null, ++ AnsiMode.Strip, ++ null, ++ AnsiType.Emulation, ++ AnsiColors.TrueColor, ++ Charset.defaultCharset(), ++ null, ++ null, ++ false ++ ); + aos.write(str.getBytes()); + aos.close(); + return baos.toString(); +--- jline2-jline-2.14.6/src/main/java/jline/WindowsTerminal.java 2022-05-13 06:20:11.717726368 +0200 ++++ jline2-jline-2.14.6/src/main/java/jline/WindowsTerminal.java 2022-05-13 06:34:46.083425194 +0200 +@@ -15,9 +15,10 @@ + + import jline.internal.Configuration; + import jline.internal.Log; +-import org.fusesource.jansi.internal.WindowsSupport; ++ + import org.fusesource.jansi.internal.Kernel32; + import static org.fusesource.jansi.internal.Kernel32.*; ++import org.fusesource.jansi.internal.Kernel32.CONSOLE_SCREEN_BUFFER_INFO; + + import static jline.WindowsTerminal.ConsoleMode.ENABLE_ECHO_INPUT; + import static jline.WindowsTerminal.ConsoleMode.ENABLE_LINE_INPUT; +@@ -208,18 +209,34 @@ + // Native Bits + // + private static int getConsoleMode() { +- return WindowsSupport.getConsoleMode(); ++ long hConsole = GetStdHandle (STD_INPUT_HANDLE); ++ if (hConsole == INVALID_HANDLE_VALUE) ++ return -1; ++ int mode[] = new int[1]; ++ if (GetConsoleMode (hConsole, mode)==0) ++ return -1; ++ return mode[0]; + } + + private static void setConsoleMode(int mode) { +- WindowsSupport.setConsoleMode(mode); ++ long hConsole = GetStdHandle (STD_INPUT_HANDLE); ++ if (hConsole == INVALID_HANDLE_VALUE) ++ return; ++ SetConsoleMode (hConsole, mode); ++ } ++ ++ private static INPUT_RECORD[] readConsoleInput(int count) throws IOException { ++ long hConsole = GetStdHandle (STD_INPUT_HANDLE); ++ if (hConsole == INVALID_HANDLE_VALUE) ++ return null; ++ return readConsoleKeyInput(hConsole, count, false); + } + + private byte[] readConsoleInput() { + // XXX does how many events to read in one call matter? + INPUT_RECORD[] events = null; + try { +- events = WindowsSupport.readConsoleInput(1); ++ events = readConsoleInput(1); + } catch (IOException e) { + Log.debug("read Windows console input error: ", e); + } +@@ -304,11 +321,17 @@ + } + + private static int getWindowsTerminalWidth() { +- return WindowsSupport.getWindowsTerminalWidth(); ++ long outputHandle = GetStdHandle (STD_OUTPUT_HANDLE); ++ CONSOLE_SCREEN_BUFFER_INFO info = new CONSOLE_SCREEN_BUFFER_INFO(); ++ GetConsoleScreenBufferInfo (outputHandle, info); ++ return info.windowWidth(); + } + + private static int getWindowsTerminalHeight() { +- return WindowsSupport.getWindowsTerminalHeight(); ++ long outputHandle = GetStdHandle (STD_OUTPUT_HANDLE); ++ CONSOLE_SCREEN_BUFFER_INFO info = new CONSOLE_SCREEN_BUFFER_INFO(); ++ GetConsoleScreenBufferInfo (outputHandle, info); ++ return info.windowHeight(); + } + + /** diff --git a/jline-java8compat.patch b/jline-java8compat.patch new file mode 100644 index 0000000..bc3a6b3 --- /dev/null +++ b/jline-java8compat.patch @@ -0,0 +1,67 @@ +diff -urEbwB jline2-jline-2.14.6/src/main/java/jline/internal/InputStreamReader.java jline2-jline-2.14.6.new/src/main/java/jline/internal/InputStreamReader.java +--- jline2-jline-2.14.6/src/main/java/jline/internal/InputStreamReader.java 2018-03-26 11:14:37.000000000 +0200 ++++ jline2-jline-2.14.6.new/src/main/java/jline/internal/InputStreamReader.java 2019-09-27 09:31:17.518979605 +0200 +@@ -13,6 +13,7 @@ + import java.io.OutputStreamWriter; + import java.io.Reader; + import java.io.UnsupportedEncodingException; ++import java.nio.Buffer; + import java.nio.ByteBuffer; + import java.nio.CharBuffer; + import java.nio.charset.Charset; +@@ -68,7 +69,7 @@ + decoder = Charset.defaultCharset().newDecoder().onMalformedInput( + CodingErrorAction.REPLACE).onUnmappableCharacter( + CodingErrorAction.REPLACE); +- bytes.limit(0); ++ ((Buffer)bytes).limit(0); + } + + /** +@@ -101,7 +102,7 @@ + throw (UnsupportedEncodingException) + new UnsupportedEncodingException(enc).initCause(e); + } +- bytes.limit(0); ++ ((Buffer)bytes).limit(0); + } + + /** +@@ -118,7 +119,7 @@ + dec.averageCharsPerByte(); + this.in = in; + decoder = dec; +- bytes.limit(0); ++ ((Buffer)bytes).limit(0); + } + + /** +@@ -136,7 +137,7 @@ + decoder = charset.newDecoder().onMalformedInput( + CodingErrorAction.REPLACE).onUnmappableCharacter( + CodingErrorAction.REPLACE); +- bytes.limit(0); ++ ((Buffer)bytes).limit(0); + } + + /** +@@ -262,7 +263,7 @@ + } else if (was_red == 0) { + break; + } +- bytes.limit(bytes.limit() + was_red); ++ ((Buffer)bytes).limit(bytes.limit() + was_red); + needInput = false; + } + +@@ -273,8 +274,8 @@ + // compact the buffer if no space left + if (bytes.limit() == bytes.capacity()) { + bytes.compact(); +- bytes.limit(bytes.position()); +- bytes.position(0); ++ ((Buffer)bytes).limit(bytes.position()); ++ ((Buffer)bytes).position(0); + } + needInput = true; + } else { diff --git a/jline.changes b/jline.changes new file mode 100644 index 0000000..2daa10b --- /dev/null +++ b/jline.changes @@ -0,0 +1,105 @@ +------------------------------------------------------------------- +Mon May 16 11:09:38 UTC 2022 - Fridrich Strba + +- Added patch: + * jline-jansi2.patch + + fix jline build against jansi 2.4.x +- Remove dependency on jansi-native and hawtjni-runtime + +------------------------------------------------------------------- +Sun Mar 20 13:12:08 UTC 2022 - Fridrich Strba + +- Build with source and target levels 8 + +------------------------------------------------------------------- +Fri Sep 27 07:34:45 UTC 2019 - Fridrich Strba + +- Added patch: + * jline-java8compat.patch + + build binaries compatible with Java 8 + +------------------------------------------------------------------- +Thu Jun 27 09:06:19 UTC 2019 - Fridrich Strba + +- Work around a problem with dependency resolution, where variables + are not resolved + +------------------------------------------------------------------- +Tue Mar 5 15:08:16 UTC 2019 - Fridrich Strba + +- Upgrade to version 2.14.6 + * NOT backward compatible with jline 1.x + * Depend on jansi 2.9+ + * #277: Allow setting max history-size. 'FileHistory' allows + delayed init (to allow setMaxSize to take effect) and + 'ConsoleReader' exposes ability to read inputrc settings. + * Ability to control terminal encoding + * Backward history searching + * Handle EOF / Ctrl-D on unsupported terminals + * Distinguish carriage return from newline + * Correcting Manifest to make jline work as a bundle in OSGi + * Handle TERM=dumb as an UnsupportedTerminal + * Updated license headers to be consistent BSD version + * Added support for vi keymap. Most major vi features should work. + * The "jline.esc.timeout" configuration option (in your + $HOME/.jline.rc) controls the number of millisesconds that + jline will wait after seeing an ESC key to see if another + character arrives. + * The JVM shutdown hook that restores the terminal settings when + the JVM exits (jline.shutdownhook) is now turned on by default. +- Generate and customize the ant build file in order to be able + to build without maven. + +------------------------------------------------------------------- +Wed Sep 27 16:55:31 UTC 2017 - fstrba@suse.com + +- Don't require java-1_5_0-gcj-compat, but build with any + java-devel provider +- Specify java source and target level 1.6: fixes build with + jdk9 + +------------------------------------------------------------------- +Fri Jun 9 09:35:59 UTC 2017 - tchvatal@suse.com + +- Reduce depgraph and drop maven fragment to allow bootstrap + +------------------------------------------------------------------- +Fri May 19 09:23:12 UTC 2017 - mpluskal@suse.com + +- Update dependencies + +------------------------------------------------------------------- +Wed Mar 18 09:46:13 UTC 2015 - tchvatal@suse.com + +- Fix build with new javapackages-tools + +------------------------------------------------------------------- +Mon Sep 9 11:06:04 UTC 2013 - tchvatal@suse.com + +- Move from jpackage-utils to javapackage-tools + +------------------------------------------------------------------- +Mon Aug 26 07:57:51 UTC 2013 - mvyskocil@suse.com + +- use new add_maven_depmap from javapackages-utils + +------------------------------------------------------------------- +Thu Apr 25 09:21:43 UTC 2013 - mvyskocil@suse.com + +- add findutils dependency (bnc#816314) + +------------------------------------------------------------------- +Thu Sep 2 12:32:48 UTC 2010 - mvyskocil@suse.cz + +- ignore antlr(-java) to reduce build cycles + +------------------------------------------------------------------- +Wed Nov 18 12:27:34 UTC 2009 - mvyskocil@suse.cz + +- Build using gcj - needed by rhino 1.7R2 - bnc#554532 + +------------------------------------------------------------------- +Thu May 7 11:04:53 CEST 2009 - mvyskocil@suse.cz + +- Initial SUSE packaging 0.9.94 from jpp 5.0 + diff --git a/jline.spec b/jline.spec new file mode 100644 index 0000000..35b5531 --- /dev/null +++ b/jline.spec @@ -0,0 +1,94 @@ +# +# spec file for package jline +# +# Copyright (c) 2022 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +Name: jline +Version: 2.14.6 +Release: 0 +Summary: Java library for reading and editing user input in console applications +License: BSD-3-Clause +Group: Development/Libraries/Java +URL: https://github.com/jline/jline2 +Source0: https://github.com/jline/jline2/archive/jline-%{version}.tar.gz +Source1: %{name}-build.xml +Patch0: jline-java8compat.patch +Patch1: jline-jansi2.patch +BuildRequires: ant +BuildRequires: fdupes +BuildRequires: jansi +BuildRequires: javapackages-local +#!BuildIgnore: ant-antlr +Requires: mvn(org.fusesource.jansi:jansi) +BuildArch: noarch + +%description +JLine is a java library for reading and editing user input in console +applications. It features tab-completion, command history, password +masking, customizable keybindings, and pass-through handlers to use to +chain to other console applications. + +%package javadoc +Summary: Javadocs for %{name} +Group: Documentation/HTML + +%description javadoc +This package contains the API documentation for %{name}. + +%prep +%setup -q -n jline2-jline-%{version} +%patch0 -p1 +%patch1 -p1 +%pom_change_dep org.fusesource.jansi:jansi org.fusesource.jansi:jansi:1.12 +cp %{SOURCE1} build.xml +mkdir -p lib + +# Remove maven-shade-plugin usage +%pom_remove_plugin "org.apache.maven.plugins:maven-shade-plugin" +# Remove animal sniffer plugin in order to reduce deps +%pom_remove_plugin "org.codehaus.mojo:animal-sniffer-maven-plugin" + +# Remove unavailable and unneeded deps +%pom_xpath_remove "pom:build/pom:extensions" +%pom_remove_plugin :maven-site-plugin +%pom_remove_plugin :maven-enforcer-plugin +%pom_remove_plugin :maven-javadoc-plugin + +%pom_remove_parent + +%build +build-jar-repository -s lib jansi +%{ant} package javadoc + +%install +# jar +install -dm 0755 %{buildroot}%{_javadir}/%{name} +install -pm 0644 target/%{name}-%{version}.jar %{buildroot}%{_javadir}/%{name}/%{name}.jar +# pom +install -dm 0755 %{buildroot}%{_mavenpomdir}/%{name} +install -pm 0644 pom.xml %{buildroot}%{_mavenpomdir}/%{name}/%{name}.pom +%add_maven_depmap %{name}/%{name}.pom %{name}/%{name}.jar +# javadoc +install -dm 0755 %{buildroot}%{_javadocdir}/%{name} +cp -pr target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}/ +%fdupes -s %{buildroot}%{_javadocdir} + +%files -f .mfiles + +%files javadoc +%{_javadocdir}/%{name} + +%changelog