commit 83906db8442754e72cc99ebfa0d6fa9791f09c2b Author: James Antill Date: Mon Feb 20 01:59:06 2023 -0500 Import rpm: 01dcd0aac964b17fdbbbb0d3de142a8a27cceeec diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..29c061c --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/jansi-project-1.18.tar.gz diff --git a/0001-Avoid-NPE.patch b/0001-Avoid-NPE.patch new file mode 100644 index 0000000..1aaa967 --- /dev/null +++ b/0001-Avoid-NPE.patch @@ -0,0 +1,26 @@ +From d94c5832e14504d44abeba47866dfa7dac5992b5 Mon Sep 17 00:00:00 2001 +From: Guillaume Nodet +Date: Fri, 23 Jul 2021 09:22:19 +0200 +Subject: [PATCH] Avoid possible NPE, fixes #214 + +--- + src/main/java/org/fusesource/jansi/AnsiPrintStream.java | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/main/java/org/fusesource/jansi/AnsiPrintStream.java b/src/main/java/org/fusesource/jansi/AnsiPrintStream.java +index e153c43..df6e5a6 100644 +--- a/src/main/java/org/fusesource/jansi/AnsiPrintStream.java ++++ b/src/main/java/org/fusesource/jansi/AnsiPrintStream.java +@@ -76,7 +76,11 @@ public void install() throws IOException { + } + + public void uninstall() throws IOException { +- getOut().uninstall(); ++ // If the system output stream has been closed, out should be null, so avoid a NPE ++ AnsiOutputStream out = getOut(); ++ if (out != null) { ++ out.uninstall(); ++ } + } + + @Override diff --git a/0001-Drop-dependency-on-native-library.patch b/0001-Drop-dependency-on-native-library.patch new file mode 100644 index 0000000..d2badca --- /dev/null +++ b/0001-Drop-dependency-on-native-library.patch @@ -0,0 +1,132 @@ +From 9267e184753020dbe436868ac4c6377f58e4500f Mon Sep 17 00:00:00 2001 +From: Mikolaj Izdebski +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 + diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..9214b2f --- /dev/null +++ b/gating.yaml @@ -0,0 +1,9 @@ +--- !Policy +product_versions: + - rhel-9 +decision_contexts: + - osci_compose_gate +rules: + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} + # https://docs.engineering.redhat.com/display/RHELPLAN/Maven+Bootstrap+manual+gating+test + - !PassingTestCaseRule {test_case_name: manual.sst_cs_apps.maven.bootstrap} diff --git a/generate-tarball.sh b/generate-tarball.sh new file mode 100755 index 0000000..0d2f36c --- /dev/null +++ b/generate-tarball.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +name=jansi +version="$(sed -n 's/Version:\s*//p' *.spec)" + +# RETRIEVE +wget "https://github.com/fusesource/jansi/archive/jansi-${version}.tar.gz" -O "${name}-${version}.orig.tar.gz" + +rm -rf tarball-tmp +mkdir tarball-tmp +pushd tarball-tmp +tar xf "../${name}-${version}.orig.tar.gz" + +# CLEAN TARBALL +rm -r */src/main/native/inc_{mac,win}/ + +tar -czf "../${name}-${version}.tar.gz" * +popd +rm -r tarball-tmp "${name}-${version}.orig.tar.gz" diff --git a/jansi-jni.patch b/jansi-jni.patch new file mode 100644 index 0000000..e9e106f --- /dev/null +++ b/jansi-jni.patch @@ -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))) { ++ extracted = true; ++ return; ++ } + } + + // Load the os-dependent library from the jar file diff --git a/jansi.spec b/jansi.spec new file mode 100644 index 0000000..8e39123 --- /dev/null +++ b/jansi.spec @@ -0,0 +1,164 @@ +Name: jansi +Version: 1.18 +Release: 4%{?dist} +Summary: Jansi is a java library for generating and interpreting ANSI escape sequences +License: ASL 2.0 +URL: http://fusesource.github.io/jansi/ +BuildArch: noarch + +Source0: https://github.com/fusesource/jansi/archive/jansi-project-%{version}.tar.gz + +Patch0: 0001-Drop-dependency-on-native-library.patch + +BuildRequires: maven-local-openjdk8 +BuildRequires: mvn(junit:junit) +BuildRequires: mvn(org.apache.felix:maven-bundle-plugin) +BuildRequires: mvn(org.fusesource:fusesource-pom:pom:) + +%description +Jansi is a small java library that allows you to use ANSI escape sequences +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} + +%prep +%setup -q -n jansi-jansi-project-%{version} +%patch0 -p1 + +%pom_disable_module example +%pom_xpath_remove "pom:build/pom:extensions" + +%pom_remove_plugin -r :maven-site-plugin + +# No maven-uberize-plugin +%pom_remove_plugin -r :maven-uberize-plugin + +# 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 + +# javadoc generation fails due to strict doclint in JDK 8 +%pom_remove_plugin -r :maven-javadoc-plugin + +rm -f jansi/src/{main,test}/java/org/fusesource/jansi/{WindowsSupport,WindowsAnsiOutputStream,WindowsAnsiPrintStream,WindowsSupportTest,AnsiMain}.java + + +%build +%mvn_build + +%install +%mvn_install + +%files -n %{?module_prefix}%{name} -f .mfiles +%license license.txt +%doc readme.md changelog.md + +%changelog +* Sat Jan 25 2020 Mikolaj Izdebski - 1.18-4 +- Build with OpenJDK 8 + +* Tue Nov 05 2019 Mikolaj Izdebski - 1.18-3 +- Mass rebuild for javapackages-tools 201902 + +* Tue Nov 05 2019 Mikolaj Izdebski - 1.18-2 +- Remove dependency on jansi-native and hawtjni + +* Mon Jul 22 2019 Marian Koncek - 1.18-1 +- Update to upstream version 1.18 + +* Fri May 24 2019 Mikolaj Izdebski - 1.17.1-2 +- Mass rebuild for javapackages-tools 201901 + +* Tue Jun 05 2018 Michael Simacek - 1.17.1-1 +- Update to upstream version 1.17.1 + +* Mon Feb 26 2018 Michael Simacek - 1.17-1 +- Update to upstream version 1.17 + +* Wed Feb 07 2018 Fedora Release Engineering - 1.16-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 1.16-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Wed Jun 14 2017 Michael Simacek - 1.16-1 +- Update to upstream version 1.16 + +* Fri Feb 10 2017 Fedora Release Engineering - 1.11-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Wed Feb 01 2017 Michael Simacek - 1.11-11 +- Remove BR on maven-site-plugin + +* Thu Feb 04 2016 Fedora Release Engineering - 1.11-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Wed Jun 17 2015 Fedora Release Engineering - 1.11-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Thu May 14 2015 Mikolaj Izdebski - 1.11-8 +- Remove maven-javadoc-plugin execution + +* Tue Jan 27 2015 Mat Booth - 1.11-7 +- Add/remove BRs to fix FTBFS bug + +* Sat Jun 07 2014 Fedora Release Engineering - 1.11-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Mon May 26 2014 Mikolaj Izdebski - 1.11-5 +- Migrate BuildRequires from junit4 to junit + +* Mon May 26 2014 Mikolaj Izdebski - 1.11-4 +- Remove BuildRequires on maven-surefire-provider-junit4 + +* Wed Sep 11 2013 Marek Goldmann - 1.11-3 +- Using xmvn +- Remove the jboss-native deps with classifiers + +* Sat Aug 03 2013 Fedora Release Engineering - 1.11-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Tue May 21 2013 Marek Goldmann - 1.11-1 +- Upstream release 1.11 RHBZ#962761 +- CVE-2013-2035 HawtJNI: predictable temporary file name leading to local arbitrary code execution RHBZ#962614 + +* Thu Feb 14 2013 Fedora Release Engineering - 1.9-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Wed Feb 06 2013 Java SIG - 1.9-2 +- Update for https://fedoraproject.org/wiki/Fedora_19_Maven_Rebuild +- Replace maven BuildRequires with maven-local + +* Tue Oct 09 2012 Marek Goldmann - 1.9-1 +- Upstream release 1.9, RHBZ#864490 + +* Thu Jul 19 2012 Fedora Release Engineering - 1.6-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Fri May 04 2012 Tomas Radej - 1.6-3 +- Removed maven-license-plugin BR + +* Fri Jan 13 2012 Fedora Release Engineering - 1.6-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Thu Aug 25 2011 Marek Goldmann 1.6-1 +- Upstream release 1.6 +- Spec file cleanup + +* Fri May 27 2011 Marek Goldmann 1.5-1 +- Initial packaging + diff --git a/plans/JansiLoadLibrary.class b/plans/JansiLoadLibrary.class new file mode 100644 index 0000000..57babc6 Binary files /dev/null and b/plans/JansiLoadLibrary.class differ diff --git a/plans/JansiLoadLibrary.java b/plans/JansiLoadLibrary.java new file mode 100644 index 0000000..1b05101 --- /dev/null +++ b/plans/JansiLoadLibrary.java @@ -0,0 +1,8 @@ +// Compile with: +// $ javac -cp /usr/lib/java/jansi/jansi.jar JansiLoadLibrary.java + +class JansiLoadLibrary { + public static void main(String[] args) { + org.fusesource.jansi.internal.JansiLoader.initialize(); + } +} diff --git a/plans/smoke.fmf b/plans/smoke.fmf new file mode 100644 index 0000000..140921c --- /dev/null +++ b/plans/smoke.fmf @@ -0,0 +1,5 @@ +summary: Basic smoke test +execute: + script: + - dnf -y install java-11-openjdk-headless + - /usr/lib/jvm/jre-11-openjdk/bin/java -cp /usr/lib/java/jansi/jansi.jar:plans JansiLoadLibrary diff --git a/sources b/sources new file mode 100644 index 0000000..a40719b --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA1 (jansi-project-1.18.tar.gz) = 9351d9d21aeef3a8db731718dca8a64e79addb63