Merged update from upstream sources

This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/jline.git#31c39916a13277f81293b047ee105c166e16822c
This commit is contained in:
DistroBaker 2021-01-12 05:28:37 +00:00
parent 70a05ba0e1
commit 40fd771bcd
4 changed files with 283 additions and 54 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ jline-1.0.zip
/jline-2.12.1.tar.xz
/jline-2.13.tar.xz
/jline-2.14.6.tar.gz
/jline-parent-3.18.0.tar.gz

129
jline-apache-sshd.patch Normal file
View File

@ -0,0 +1,129 @@
--- remote-ssh/src/main/java/org/jline/builtins/ssh/ShellCommand.java.orig 2020-12-11 02:25:01.000000000 -0700
+++ remote-ssh/src/main/java/org/jline/builtins/ssh/ShellCommand.java 2020-12-13 21:00:45.364500609 -0700
@@ -18,6 +18,7 @@ import java.util.logging.Logger;
import org.apache.sshd.server.Environment;
import org.apache.sshd.server.ExitCallback;
import org.apache.sshd.server.SessionAware;
+import org.apache.sshd.server.channel.ChannelSession;
import org.apache.sshd.server.command.Command;
import org.apache.sshd.server.session.ServerSession;
@@ -59,7 +60,7 @@ public class ShellCommand implements Com
this.session = session;
}
- public void start(final Environment env) throws IOException {
+ public void start(ChannelSession channel, final Environment env) throws IOException {
this.env = env;
new Thread(this::run).start();
}
@@ -84,7 +85,7 @@ public class ShellCommand implements Com
}
}
- public void destroy() {
+ public void destroy(ChannelSession session) {
}
}
--- remote-ssh/src/main/java/org/jline/builtins/ssh/ShellFactoryImpl.java.orig 2020-12-11 02:25:01.000000000 -0700
+++ remote-ssh/src/main/java/org/jline/builtins/ssh/ShellFactoryImpl.java 2020-12-13 21:00:45.365500608 -0700
@@ -15,14 +15,15 @@ import java.io.OutputStream;
import java.util.Map;
import java.util.function.Consumer;
-import org.apache.sshd.common.Factory;
import org.apache.sshd.common.channel.PtyMode;
import org.apache.sshd.server.Environment;
import org.apache.sshd.server.ExitCallback;
import org.apache.sshd.server.SessionAware;
import org.apache.sshd.server.Signal;
+import org.apache.sshd.server.channel.ChannelSession;
import org.apache.sshd.server.command.Command;
import org.apache.sshd.server.session.ServerSession;
+import org.apache.sshd.server.shell.ShellFactory;
import org.jline.terminal.Attributes;
import org.jline.terminal.Attributes.ControlChar;
import org.jline.terminal.Attributes.InputFlag;
@@ -36,7 +37,7 @@ import org.jline.terminal.TerminalBuilde
* SSHD {@link org.apache.sshd.server.command.Command} factory which provides access to
* Shell.
*/
-public class ShellFactoryImpl implements Factory<Command> {
+public class ShellFactoryImpl implements ShellFactory {
private final Consumer<Ssh.ShellParams> shell;
public ShellFactoryImpl(Consumer<Ssh.ShellParams> shell) {
@@ -63,7 +64,7 @@ public class ShellFactoryImpl implements
}
}
- public Command create() {
+ public Command createShell(ChannelSession channel) throws IOException {
return new ShellImpl();
}
@@ -100,7 +101,7 @@ public class ShellFactoryImpl implements
this.session = session;
}
- public void start(final Environment env) throws IOException {
+ public void start(ChannelSession channel, final Environment env) throws IOException {
try {
new Thread(() -> {
try {
@@ -216,7 +217,7 @@ public class ShellFactoryImpl implements
}
}
terminal.setAttributes(attr);
- env.addSignalListener(signals -> {
+ env.addSignalListener((channel, signal) -> {
terminal.setSize(new Size(Integer.parseInt(env.getEnv().get("COLUMNS")),
Integer.parseInt(env.getEnv().get("LINES"))));
terminal.raise(Terminal.Signal.WINCH);
@@ -229,6 +230,10 @@ public class ShellFactoryImpl implements
}
public void destroy() {
+ this.destroy(null);
+ }
+
+ public void destroy(ChannelSession session) {
if (!closed) {
closed = true;
flush(out, err);
--- remote-ssh/src/main/java/org/jline/builtins/ssh/Ssh.java.orig 2020-12-11 02:25:01.000000000 -0700
+++ remote-ssh/src/main/java/org/jline/builtins/ssh/Ssh.java 2020-12-13 21:00:45.366500608 -0700
@@ -20,8 +20,10 @@ import org.apache.sshd.client.channel.Cl
import org.apache.sshd.client.channel.ClientChannelEvent;
import org.apache.sshd.client.future.ConnectFuture;
import org.apache.sshd.client.session.ClientSession;
+import org.apache.sshd.common.NamedResource;
import org.apache.sshd.common.channel.PtyMode;
import org.apache.sshd.common.config.keys.FilePasswordProvider;
+import org.apache.sshd.common.session.SessionContext;
import org.apache.sshd.common.util.io.NoCloseInputStream;
import org.apache.sshd.common.util.io.NoCloseOutputStream;
import org.apache.sshd.server.SshServer;
@@ -362,7 +364,7 @@ public class Ssh {
server.setHost(ip);
server.setShellFactory(new ShellFactoryImpl(shell));
server.setCommandFactory(new ScpCommandFactory.Builder()
- .withDelegate(command -> new ShellCommand(execute, command)).build());
+ .withDelegate((channel, command) -> new ShellCommand(execute, command)).build());
server.setSubsystemFactories(Collections.singletonList(
new SftpSubsystemFactory.Builder().build()
));
@@ -390,8 +392,10 @@ public class Ssh {
}
@Override
- public String getPassword(String resourceKey) throws IOException {
- return readLine("Enter password for " + resourceKey + ":", false);
+ public String getPassword(SessionContext session, NamedResource resourceKey, int retryIndex) throws IOException {
+ if (retryIndex == 0)
+ return readLine("Enter password for " + resourceKey.getName() + ":", false);
+ return readLine("Enter password again for " + resourceKey.getName() + ":", false);
}
@Override

View File

@ -1,92 +1,191 @@
Name: jline
Version: 2.14.6
Release: 10%{?dist}
Summary: JLine is a Java library for handling console input
Version: 3.18.0
Release: 1%{?dist}
Summary: Java library for handling console input
License: BSD
URL: https://github.com/jline/jline2
URL: https://github.com/jline/jline3
BuildArch: noarch
Source0: https://github.com/jline/jline2/archive/jline-%{version}.tar.gz
Source0: %{url}/archive/jline-parent-%{version}.tar.gz
# Adapt to newer versions of apache-sshd
Patch0: %{name}-apache-sshd.patch
BuildRequires: maven-local
BuildRequires: mvn(com.googlecode.juniversalchardet:juniversalchardet)
BuildRequires: mvn(junit:junit)
BuildRequires: mvn(net.java.dev.jna:jna)
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-dependency-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-source-plugin)
BuildRequires: mvn(org.apache.sshd:sshd-core)
BuildRequires: mvn(org.apache.sshd:sshd-scp)
BuildRequires: mvn(org.apache.sshd:sshd-sftp)
BuildRequires: mvn(org.codehaus.mojo:build-helper-maven-plugin)
BuildRequires: mvn(org.easymock:easymock)
BuildRequires: mvn(org.fusesource.jansi:jansi)
Obsoletes: jline2 < %{version}-%{release}
Provides: jline2 = %{version}-%{release}
%global _desc %{expand:
JLine is a Java library for handling console input. It is similar in
functionality to BSD editline and GNU readline but with additional
features that bring it in par with the ZSH line editor. Those familiar
with the readline/editline capabilities for modern shells (such as bash
and tcsh) will find most of the command editing features of JLine to be
familiar.}
%description
JLine is a Java library for handling console input. It is similar
in functionality to BSD editline and GNU readline. People familiar
with the readline/editline capabilities for modern shells (such as
bash and tcsh) will find most of the command editing features of
JLine to be familiar.
%description %_desc
This package contains the parent POM for the jline project
%package javadoc
Summary: Javadocs for %{name}
Obsoletes: jline2-javadoc < %{version}-%{release}
Provides: jline2-javadoc = %{version}-%{release}
%description javadoc
%description javadoc %_desc
This package contains the API documentation for %{name}.
%package terminal
Summary: JLine terminal
%description terminal %_desc
This package contains the basic terminal support for JLine.
%package terminal-jansi
Summary: JLine terminal with JANSI
Requires: %{name}-terminal = %{version}-%{release}
%description terminal-jansi %_desc
This package contains a functioning terminal based on JANSI.
%package terminal-jna
Summary: JLine terminal with JNA
Requires: %{name}-terminal = %{version}-%{release}
%description terminal-jna %_desc
This package contains a functioning terminal based on JNA.
%package reader
Summary: JLine reader
Requires: %{name}-terminal = %{version}-%{release}
%description reader %_desc
This package supports reading lines from a console with customizable key
bindings and input editing.
%package style
Summary: JLine style
Requires: %{name}-terminal = %{version}-%{release}
%description style %_desc
This package contains a style processor for JLine, which can apply
colors to strings, for example.
%package builtins
Summary: JLine builtins
Requires: %{name}-reader = %{version}-%{release}
Requires: %{name}-style = %{version}-%{release}
Recommends: mvn(com.googlecode.juniversalchardet:juniversalchardet)
%description builtins %_desc
This package contains keybindings to emulate popular tools such as nano
and less.
%package console
Summary: JLine console
Requires: %{name}-builtins = %{version}-%{release}
%description console %_desc
This package contains a console with command and script execution
support, and tab completion.
%package remote-ssh
Summary: JLine remote SSH
Requires: %{name}-builtins = %{version}-%{release}
Recommends: mvn(org.apache.sshd:sshd-core)
Recommends: mvn(org.apache.sshd:sshd-scp)
Recommends: mvn(org.apache.sshd:sshd-sftp)
%description remote-ssh %_desc
This package contains an ssh client.
%package remote-telnet
Summary: JLine remote telnet
Requires: %{name}-builtins = %{version}-%{release}
Recommends: mvn(org.apache.sshd:sshd-core)
%description remote-telnet %_desc
This package contains a telnet client.
%prep
%setup -q -n jline2-jline-%{version}
%autosetup -n jline3-jline-parent-%{version} -p0
# remove unnecessary dependency on parent POM
%pom_remove_parent
# 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"
# We don't need the bundle
%pom_disable_module jline
# Remove unavailable and unneeded deps
%pom_xpath_remove "pom:build/pom:extensions"
%pom_remove_plugin :maven-site-plugin
%pom_remove_plugin :maven-enforcer-plugin
# Missing dependencies in Fedora
%pom_disable_module demo
%pom_disable_module groovy
%pom_disable_module graal
%pom_remove_plugin :gmavenplus-plugin
%pom_remove_dep :graal-sdk
# Unnecessary plugins for an rpm build
%pom_remove_plugin :maven-javadoc-plugin
# Makes the build fail on deprecation warnings from jansi
%pom_xpath_remove 'pom:arg[text()="-Werror"]'
# Do not import non-existing internal package
%pom_xpath_remove "pom:build/pom:plugins/pom:plugin[pom:artifactId = 'maven-bundle-plugin']/pom:executions/pom:execution/pom:configuration/pom:instructions/pom:Import-Package"
%pom_xpath_inject "pom:build/pom:plugins/pom:plugin[pom:artifactId = 'maven-bundle-plugin']/pom:executions/pom:execution/pom:configuration/pom:instructions" "<Import-Package>javax.swing;resolution:=optional,org.fusesource.jansi,!org.fusesource.jansi.internal</Import-Package>"
# Be sure to export jline.internal, but not org.fusesource.jansi.
# See https://bugzilla.redhat.com/show_bug.cgi?id=1317551
%pom_xpath_set "pom:build/pom:plugins/pom:plugin[pom:artifactId = 'maven-bundle-plugin']/pom:executions/pom:execution/pom:configuration/pom:instructions/pom:Export-Package" "jline.*;-noimport:=true"
# For some reason these directories do not exist, failing compilation due to -Werror
mkdir -p target/generated-sources/annotations
mkdir -p target/generated-test-sources/test-annotations
# drop a nondeterministic test
find -name TerminalFactoryTest.java -delete
# it's also the only test that uses powermock, so drop the powermock dependency
%pom_remove_dep org.powermock:
# Fix javadoc generation on java 11
%pom_xpath_inject pom:build/pom:plugins "<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration><source>1.8</source></configuration>
</plugin>"
%pom_remove_plugin :maven-release-plugin
%pom_remove_plugin :native-image-maven-plugin
%build
%mvn_build --xmvn-javadoc -- -Dmaven.compiler.source=1.8 -Dmaven.compiler.target=1.8
%mvn_build -s
%install
%mvn_install
%files -f .mfiles
%files -f .mfiles-jline-parent
%doc changelog.md README.md
%license LICENSE.txt
%files javadoc -f .mfiles-javadoc
%doc changelog.md README.md
%license LICENSE.txt
%files terminal -f .mfiles-jline-terminal
%doc changelog.md README.md
%license LICENSE.txt
%files terminal-jansi -f .mfiles-jline-terminal-jansi
%files terminal-jna -f .mfiles-jline-terminal-jna
%files reader -f .mfiles-jline-reader
%files style -f .mfiles-jline-style
%files builtins -f .mfiles-jline-builtins
%files console -f .mfiles-jline-console
%files remote-ssh -f .mfiles-jline-remote-ssh
%files remote-telnet -f .mfiles-jline-remote-telnet
%changelog
* Mon Dec 14 2020 Jerry James <loganjerry@gmail.com> - 3.18.0-1
- Version 3.18.0
- Remove package name from Summary
- Add patch to adapt to recent versions of apache-sshd
- Break up into subpackages to control dependencies
* Sun Aug 09 2020 Fabio Valentini <decathorpe@gmail.com> - 2.14.6-10
- Drop useless parent POM and powermock build dependencies.

View File

@ -1 +1 @@
SHA512 (jline-2.14.6.tar.gz) = 9e141c9a112dcb4850db95a7c2cec9b84f11be1f6740a3a33c99ec2ed5f900f4dae7474058e14319ef79476121997afbdb248ca22559a82a905c31690afa1d51
SHA512 (jline-parent-3.18.0.tar.gz) = 53bfa20d568b096e0cbb08c2af2b4de6a190853c0b458ab3ce6073e5cfac96b2af119dc8310ce825c81ad7448df3fe8a4f374678260d6f6b38c8083bd604934d