Compare commits

..

No commits in common. "c8s-stream-3.6" and "c8-beta-stream-202201" have entirely different histories.

5 changed files with 155 additions and 184 deletions

1
.gitignore vendored
View File

@ -1 +0,0 @@
SOURCES/jansi-project-1.18.tar.gz

View File

@ -1 +1,2 @@
9351d9d21aeef3a8db731718dca8a64e79addb63 SOURCES/jansi-project-1.18.tar.gz
f1a617ff40c5366878d35eadf3247e81124d989f SOURCES/jansi-2.4.0.tar.gz
5a3d8c8584834cd035d308d963a90a075a13f696 SOURCES/generate-tarball.sh

View File

@ -1,132 +0,0 @@
From 9267e184753020dbe436868ac4c6377f58e4500f Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Tue, 5 Nov 2019 15:41:45 +0100
Subject: [PATCH] Drop dependency on native library
---
.../org/fusesource/jansi/AnsiConsole.java | 64 ++-----------------
1 file changed, 6 insertions(+), 58 deletions(-)
diff --git a/jansi/src/main/java/org/fusesource/jansi/AnsiConsole.java b/jansi/src/main/java/org/fusesource/jansi/AnsiConsole.java
index d7a37b0..6e0d316 100644
--- a/jansi/src/main/java/org/fusesource/jansi/AnsiConsole.java
+++ b/jansi/src/main/java/org/fusesource/jansi/AnsiConsole.java
@@ -15,10 +15,6 @@
*/
package org.fusesource.jansi;
-import static org.fusesource.jansi.internal.CLibrary.STDERR_FILENO;
-import static org.fusesource.jansi.internal.CLibrary.STDOUT_FILENO;
-import static org.fusesource.jansi.internal.CLibrary.isatty;
-
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@@ -75,36 +71,20 @@ public class AnsiConsole {
@Deprecated
public static OutputStream wrapOutputStream(final OutputStream stream) {
- try {
- return wrapOutputStream(stream, STDOUT_FILENO);
- } catch (Throwable ignore) {
- return wrapOutputStream(stream, 1);
- }
+ return wrapOutputStream(stream, 1);
}
public static PrintStream wrapSystemOut(final PrintStream ps) {
- try {
- return wrapPrintStream(ps, STDOUT_FILENO);
- } catch (Throwable ignore) {
- return wrapPrintStream(ps, 1);
- }
+ return wrapPrintStream(ps, 1);
}
@Deprecated
public static OutputStream wrapErrorOutputStream(final OutputStream stream) {
- try {
- return wrapOutputStream(stream, STDERR_FILENO);
- } catch (Throwable ignore) {
- return wrapOutputStream(stream, 2);
- }
+ return wrapOutputStream(stream, 2);
}
public static PrintStream wrapSystemErr(final PrintStream ps) {
- try {
- return wrapPrintStream(ps, STDERR_FILENO);
- } catch (Throwable ignore) {
- return wrapPrintStream(ps, 2);
- }
+ return wrapPrintStream(ps, 2);
}
@Deprecated
@@ -124,22 +104,6 @@ public class AnsiConsole {
return new AnsiOutputStream(stream);
}
- if (IS_WINDOWS && !IS_CYGWIN && !IS_MINGW_XTERM) {
-
- // On windows we know the console does not interpret ANSI codes..
- try {
- jansiOutputType = JansiOutputType.WINDOWS;
- return new WindowsAnsiOutputStream(stream, fileno == STDOUT_FILENO);
- } 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.
- jansiOutputType = JansiOutputType.STRIP_ANSI;
- return new AnsiOutputStream(stream);
- }
-
// We must be on some Unix variant, including Cygwin or MSYS(2) on Windows...
try {
// If the jansi.force property is set, then we force to output
@@ -147,7 +111,7 @@ public class AnsiConsole {
boolean forceColored = Boolean.getBoolean("jansi.force");
// If we can detect that stdout is not a tty.. then setup
// to strip the ANSI sequences..
- if (!forceColored && isatty(fileno) == 0) {
+ if (!forceColored && System.console() == null) {
jansiOutputType = JansiOutputType.STRIP_ANSI;
return new AnsiOutputStream(stream);
}
@@ -202,22 +166,6 @@ public class AnsiConsole {
return new AnsiPrintStream(ps);
}
- if (IS_WINDOWS && !IS_CYGWIN && !IS_MINGW_XTERM) {
-
- // On windows we know the console does not interpret ANSI codes..
- try {
- jansiOutputType = JansiOutputType.WINDOWS;
- return new WindowsAnsiPrintStream(ps, fileno == STDOUT_FILENO);
- } 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 AnsiPrintStream to strip out the ANSI escape sequences.
- jansiOutputType = JansiOutputType.STRIP_ANSI;
- return new AnsiPrintStream(ps);
- }
-
// We must be on some Unix variant, including Cygwin or MSYS(2) on Windows...
try {
// If the jansi.force property is set, then we force to output
@@ -225,7 +173,7 @@ public class AnsiConsole {
boolean forceColored = Boolean.getBoolean("jansi.force");
// If we can detect that stdout is not a tty.. then setup
// to strip the ANSI sequences..
- if (!forceColored && isatty(fileno) == 0) {
+ if (!forceColored && System.console() == null) {
jansiOutputType = JansiOutputType.STRIP_ANSI;
return new AnsiPrintStream(ps);
}
--
2.21.0

14
SOURCES/jansi-jni.patch Normal file
View File

@ -0,0 +1,14 @@
--- a/src/main/java/org/fusesource/jansi/internal/JansiLoader.java 2020-12-15 03:03:00.000000000 -0700
+++ b/src/main/java/org/fusesource/jansi/internal/JansiLoader.java 2020-12-15 07:57:30.238720226 -0700
@@ -295,6 +295,11 @@ public class JansiLoader {
} else {
triedPaths.add(jansiNativeLibraryPath);
}
+ } else {
+ if (loadNativeLibrary(new File("@LIBDIR@/jansi", jansiNativeLibraryName))) {
+ loaded = true;
+ return;
+ }
}
// Load the os-dependent library from the jar file

View File

@ -1,19 +1,32 @@
%bcond_with bootstrap
Name: jansi
Version: 1.18
Release: 4%{?dist}
Summary: Jansi is a java library for generating and interpreting ANSI escape sequences
Version: 2.4.0
Release: 6%{?dist}
Summary: Generate and interpret ANSI escape sequences in Java
License: ASL 2.0
URL: http://fusesource.github.io/jansi/
BuildArch: noarch
ExclusiveArch: %{java_arches}
Source0: https://github.com/fusesource/jansi/archive/jansi-project-%{version}.tar.gz
# ./generate-tarball.sh
Source0: %{name}-%{version}.tar.gz
# Remove bundled binaries which cannot be easily verified for licensing
Source1: generate-tarball.sh
Patch0: 0001-Drop-dependency-on-native-library.patch
# Change the location of the native artifact to where Fedora wants it
Patch0: %{name}-jni.patch
BuildRequires: maven-local-openjdk8
BuildRequires: mvn(junit:junit)
BuildRequires: gcc
%if %{with bootstrap}
BuildRequires: javapackages-bootstrap
%else
BuildRequires: maven-local
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-source-plugin)
BuildRequires: mvn(org.apache.maven.surefire:surefire-junit-platform)
BuildRequires: mvn(org.fusesource:fusesource-pom:pom:)
BuildRequires: mvn(org.junit.jupiter:junit-jupiter-engine)
%endif
%description
Jansi is a small java library that allows you to use ANSI escape sequences
@ -21,67 +34,143 @@ in your Java console applications. It implements ANSI support on platforms
which don't support it like Windows and provides graceful degradation for
when output is being sent to output devices which cannot support ANSI sequences.
%{?module_package}
%{?javadoc_package}
%package javadoc
BuildArch: noarch
Summary: Javadocs for %{name}
%description javadoc
This package contains the API documentation for %{name}.
%prep
%setup -q -n jansi-jansi-project-%{version}
%patch0 -p1
%autosetup -n jansi-jansi-%{version} -p1
%pom_disable_module example
# We don't need the Fuse JXR skin
%pom_xpath_remove "pom:build/pom:extensions"
%pom_remove_plugin -r :maven-site-plugin
# Plugins not needed for an RPM build
%pom_remove_plugin :maven-gpg-plugin
%pom_remove_plugin :maven-javadoc-plugin
%pom_remove_plugin :nexus-staging-maven-plugin
# No maven-uberize-plugin
%pom_remove_plugin -r :maven-uberize-plugin
# We don't want GraalVM support in Fedora
%pom_remove_plugin :exec-maven-plugin
%pom_remove_dep :picocli-codegen
# Remove unnecessary deps for jansi-native builds
pushd jansi
%pom_remove_dep :jansi-windows32
%pom_remove_dep :jansi-windows64
%pom_remove_dep :jansi-osx
%pom_remove_dep :jansi-freebsd32
%pom_remove_dep :jansi-freebsd64
# it's there only to be bundled in uberjar and we disable uberjar generation
%pom_remove_dep :jansi-linux32
%pom_remove_dep :jansi-linux64
#
%pom_remove_dep :jansi-native
%pom_remove_dep :hawtjni-runtime
popd
# Build for JDK 1.8 at a minimum
%pom_xpath_set "//pom:properties/pom:jdkTarget" 1.8
# javadoc generation fails due to strict doclint in JDK 8
%pom_remove_plugin -r :maven-javadoc-plugin
# Remove prebuilt shared objects
rm -fr src/main/resources/org/fusesource/jansi/internal
rm -f jansi/src/{main,test}/java/org/fusesource/jansi/{WindowsSupport,WindowsAnsiOutputStream,WindowsAnsiPrintStream,WindowsSupportTest,AnsiMain}.java
# Unbundle the JNI headers
rm src/main/native/inc_linux/*.h
ln -s %{java_home}/include/jni.h src/main/native/inc_linux
ln -s %{java_home}/include/linux/jni_md.h src/main/native/inc_linux
# Set the JNI path
sed -i 's,@LIBDIR@,%{_prefix}/lib,' \
src/main/java/org/fusesource/jansi/internal/JansiLoader.java
%build
%mvn_build
%set_build_flags
CC="${CC:-gcc}"
# Build the native artifact
CFLAGS="$CFLAGS -I. -I%{java_home}/include -I%{java_home}/include/linux -fPIC -fvisibility=hidden"
cd src/main/native
$CC $CFLAGS -c jansi.c
$CC $CFLAGS -c jansi_isatty.c
$CC $CFLAGS -c jansi_structs.c
$CC $CFLAGS -c jansi_ttyname.c
$CC $CFLAGS $LDFLAGS -shared -o libjansi.so *.o -lutil
cd -
# Build the Java artifacts
%mvn_build -- -Dlibrary.jansi.path=$PWD/src/main/native
%install
# Install the native artifact
mkdir -p %{buildroot}%{_prefix}/lib/%{name}
cp -p src/main/native/libjansi.so %{buildroot}%{_prefix}/lib/%{name}
# Install the Java artifacts
%mvn_install
%files -n %{?module_prefix}%{name} -f .mfiles
%files -f .mfiles
%license license.txt
%doc readme.md changelog.md
%{_prefix}/lib/%{name}/
%files javadoc -f .mfiles-javadoc
%license license.txt
%changelog
* Sat Jan 25 2020 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.18-4
- Build with OpenJDK 8
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Tue Nov 05 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.18-3
- Mass rebuild for javapackages-tools 201902
* Mon Jul 18 2022 Mikolaj Izdebski <mizdebsk@redhat.com> - 2.4.0-5
- Ensure CC env variable is set during build
* Tue Nov 05 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.18-2
- Remove dependency on jansi-native and hawtjni
* Thu Jul 14 2022 Marian Koncek <mkoncek@redhat.com> - 2.4.0-4
- Make javadoc subpackage noarch
* Mon Jul 22 2019 Marian Koncek <mkoncek@redhat.com> - 1.18-1
- Update to upstream version 1.18
* Sat Feb 05 2022 Jiri Vanek <jvanek@redhat.com> - 2.4.0-3
- Rebuilt for java-17-openjdk as system jdk
* Fri May 24 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.17.1-2
- Mass rebuild for javapackages-tools 201901
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Mon Nov 01 2021 Marian Koncek <mkoncek@redhat.com> - 2.4.0-1
- Update to upstream version 2.4.0
* Fri Sep 24 2021 Marian Koncek <mkoncek@redhat.com> - 2.3.3-3
- Install native artifact into a fixed location
- Related: rhbz#1994935
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Wed Jun 23 2021 Jerry James <loganjerry@gmail.com> - 2.3.3-1
- Version 2.3.3
* Fri Jun 18 2021 Mikolaj Izdebski <mizdebsk@redhat.com> - 2.1.1-5
- Clean tarball from content with questionable licensing
- Resolves: rhbz#1973738
* Mon May 17 2021 Mikolaj Izdebski <mizdebsk@redhat.com> - 2.1.1-4
- Bootstrap build
- Non-bootstrap build
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Thu Jan 14 2021 Timm Bäder <tbaeder@redhat.com> - 2.1.1-2
- Use standard variables when compiling native artifact
* Tue Dec 15 2020 Jerry James <loganjerry@gmail.com> - 2.1.1-1
- Version 2.1.1
- Remove package name from Summary
- Add patch to change the location of the JNI shared object
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.18-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Jul 10 2020 Jiri Vanek <jvanek@redhat.com> - 1.18-4
- Rebuilt for JDK-11, see https://fedoraproject.org/wiki/Changes/Java11
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.18-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.18-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sat Jun 08 2019 Fabio Valentini <decathorpe@gmail.com> - 1.18-1
- Update to version 1.18.
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.17.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.17.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue Jun 05 2018 Michael Simacek <msimacek@redhat.com> - 1.17.1-1
- Update to upstream version 1.17.1