Compare commits

..

1 commit

Author SHA1 Message Date
Adam Williamson
e4c48ff630 Backport patch to bring back AnsiRenderer 2021-12-13 21:24:01 -08:00
11 changed files with 598 additions and 257 deletions

View file

@ -1 +0,0 @@
1

4
.gitignore vendored
View file

@ -9,7 +9,3 @@
/jansi-project-1.17.1.tar.gz
/jansi-project-1.18.tar.gz
/jansi-2.1.1.tar.gz
/jansi-2.3.3.tar.gz
/jansi-2.4.0.tar.gz
/jansi-2.4.1.tar.gz
/jansi-2.4.2.tar.gz

View file

@ -0,0 +1,436 @@
From faf93318be3cda0b3a3894ae9d2032835601bc73 Mon Sep 17 00:00:00 2001
From: Guillaume Nodet <gnodet@gmail.com>
Date: Wed, 20 Jan 2021 12:08:59 +0100
Subject: [PATCH] Bring back the AnsiRenderer, fixes #184
---
src/main/java/org/fusesource/jansi/Ansi.java | 27 ++
.../org/fusesource/jansi/AnsiRenderer.java | 253 ++++++++++++++++++
.../fusesource/jansi/AnsiRendererTest.java | 115 ++++++++
3 files changed, 395 insertions(+)
create mode 100644 src/main/java/org/fusesource/jansi/AnsiRenderer.java
create mode 100644 src/test/java/org/fusesource/jansi/AnsiRendererTest.java
diff --git a/src/main/java/org/fusesource/jansi/Ansi.java b/src/main/java/org/fusesource/jansi/Ansi.java
index 84976e0..a882705 100644
--- a/src/main/java/org/fusesource/jansi/Ansi.java
+++ b/src/main/java/org/fusesource/jansi/Ansi.java
@@ -818,6 +818,33 @@ public class Ansi implements Appendable {
return this;
}
+ /**
+ * Uses the {@link AnsiRenderer}
+ * to generate the ANSI escape sequences for the supplied text.
+ *
+ * @param text text
+ * @return this
+ * @since 2.2
+ */
+ public Ansi render(final String text) {
+ a(AnsiRenderer.render(text));
+ return this;
+ }
+
+ /**
+ * String formats and renders the supplied arguments. Uses the {@link AnsiRenderer}
+ * to generate the ANSI escape sequences.
+ *
+ * @param text format
+ * @param args arguments
+ * @return this
+ * @since 2.2
+ */
+ public Ansi render(final String text, Object... args) {
+ a(String.format(AnsiRenderer.render(text), args));
+ return this;
+ }
+
@Override
public String toString() {
flushAttributes();
diff --git a/src/main/java/org/fusesource/jansi/AnsiRenderer.java b/src/main/java/org/fusesource/jansi/AnsiRenderer.java
new file mode 100644
index 0000000..7565ae4
--- /dev/null
+++ b/src/main/java/org/fusesource/jansi/AnsiRenderer.java
@@ -0,0 +1,253 @@
+/*
+ * Copyright (C) 2009-2021 the original author(s).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.fusesource.jansi;
+
+import java.io.IOException;
+import java.util.Locale;
+
+import org.fusesource.jansi.Ansi.Attribute;
+import org.fusesource.jansi.Ansi.Color;
+
+/**
+ * Renders ANSI color escape-codes in strings by parsing out some special syntax to pick up the correct fluff to use.
+ *
+ * The syntax for embedded ANSI codes is:
+ *
+ * <pre>
+ * &#64;|<em>code</em>(,<em>code</em>)* <em>text</em>|&#64;
+ * </pre>
+ *
+ * Examples:
+ *
+ * <pre>
+ * &#64;|bold Hello|&#64;
+ * </pre>
+ *
+ * <pre>
+ * &#64;|bold,red Warning!|&#64;
+ * </pre>
+ *
+ * @since 2.2
+ */
+public class AnsiRenderer {
+
+ public static final String BEGIN_TOKEN = "@|";
+
+ public static final String END_TOKEN = "|@";
+
+ public static final String CODE_TEXT_SEPARATOR = " ";
+
+ public static final String CODE_LIST_SEPARATOR = ",";
+
+ private static final int BEGIN_TOKEN_LEN = 2;
+
+ private static final int END_TOKEN_LEN = 2;
+
+ public static String render(final String input) throws IllegalArgumentException {
+ try {
+ return render(input, new StringBuilder()).toString();
+ } catch (IOException e) {
+ // Cannot happen because StringBuilder does not throw IOException
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ /**
+ * Renders the given input to the target Appendable.
+ *
+ * @param input
+ * source to render
+ * @param target
+ * render onto this target Appendable.
+ * @return the given Appendable
+ * @throws IOException
+ * If an I/O error occurs
+ */
+ public static Appendable render(final String input, Appendable target) throws IOException {
+
+ int i = 0;
+ int j, k;
+
+ while (true) {
+ j = input.indexOf(BEGIN_TOKEN, i);
+ if (j == -1) {
+ if (i == 0) {
+ target.append(input);
+ return target;
+ }
+ target.append(input.substring(i));
+ return target;
+ }
+ target.append(input.substring(i, j));
+ k = input.indexOf(END_TOKEN, j);
+
+ if (k == -1) {
+ target.append(input);
+ return target;
+ }
+ j += BEGIN_TOKEN_LEN;
+ String spec = input.substring(j, k);
+
+ String[] items = spec.split(CODE_TEXT_SEPARATOR, 2);
+ if (items.length == 1) {
+ target.append(input);
+ return target;
+ }
+ String replacement = render(items[1], items[0].split(CODE_LIST_SEPARATOR));
+
+ target.append(replacement);
+
+ i = k + END_TOKEN_LEN;
+ }
+ }
+
+ public static String render(final String text, final String... codes) {
+ return render(Ansi.ansi(), codes)
+ .a(text).reset().toString();
+ }
+
+ /**
+ * Renders {@link Code} names as an ANSI escape string.
+ * @param codes The code names to render
+ * @return an ANSI escape string.
+ */
+ public static String renderCodes(final String... codes) {
+ return render(Ansi.ansi(), codes).toString();
+ }
+
+ /**
+ * Renders {@link Code} names as an ANSI escape string.
+ * @param codes A space separated list of code names to render
+ * @return an ANSI escape string.
+ */
+ public static String renderCodes(final String codes) {
+ return renderCodes(codes.split("\\s"));
+ }
+
+ private static Ansi render(Ansi ansi, String... names) {
+ for (String name : names) {
+ Code code = Code.valueOf(name.toUpperCase(Locale.ENGLISH));
+ if (code.isColor()) {
+ if (code.isBackground()) {
+ ansi.bg(code.getColor());
+ } else {
+ ansi.fg(code.getColor());
+ }
+ } else if (code.isAttribute()) {
+ ansi.a(code.getAttribute());
+ }
+ }
+ return ansi;
+ }
+
+ public static boolean test(final String text) {
+ return text != null && text.contains(BEGIN_TOKEN);
+ }
+
+ @SuppressWarnings("unused")
+ public enum Code {
+ //
+ // TODO: Find a better way to keep Code in sync with Color/Attribute/Erase
+ //
+
+ // Colors
+ BLACK(Color.BLACK),
+ RED(Color.RED),
+ GREEN(Color.GREEN),
+ YELLOW(Color.YELLOW),
+ BLUE(Color.BLUE),
+ MAGENTA(Color.MAGENTA),
+ CYAN(Color.CYAN),
+ WHITE(Color.WHITE),
+
+ // Foreground Colors
+ FG_BLACK(Color.BLACK, false),
+ FG_RED(Color.RED, false),
+ FG_GREEN(Color.GREEN, false),
+ FG_YELLOW(Color.YELLOW, false),
+ FG_BLUE(Color.BLUE, false),
+ FG_MAGENTA(Color.MAGENTA, false),
+ FG_CYAN(Color.CYAN, false),
+ FG_WHITE(Color.WHITE, false),
+
+ // Background Colors
+ BG_BLACK(Color.BLACK, true),
+ BG_RED(Color.RED, true),
+ BG_GREEN(Color.GREEN, true),
+ BG_YELLOW(Color.YELLOW, true),
+ BG_BLUE(Color.BLUE, true),
+ BG_MAGENTA(Color.MAGENTA, true),
+ BG_CYAN(Color.CYAN, true),
+ BG_WHITE(Color.WHITE, true),
+
+ // Attributes
+ RESET(Attribute.RESET),
+ INTENSITY_BOLD(Attribute.INTENSITY_BOLD),
+ INTENSITY_FAINT(Attribute.INTENSITY_FAINT),
+ ITALIC(Attribute.ITALIC),
+ UNDERLINE(Attribute.UNDERLINE),
+ BLINK_SLOW(Attribute.BLINK_SLOW),
+ BLINK_FAST(Attribute.BLINK_FAST),
+ BLINK_OFF(Attribute.BLINK_OFF),
+ NEGATIVE_ON(Attribute.NEGATIVE_ON),
+ NEGATIVE_OFF(Attribute.NEGATIVE_OFF),
+ CONCEAL_ON(Attribute.CONCEAL_ON),
+ CONCEAL_OFF(Attribute.CONCEAL_OFF),
+ UNDERLINE_DOUBLE(Attribute.UNDERLINE_DOUBLE),
+ UNDERLINE_OFF(Attribute.UNDERLINE_OFF),
+
+ // Aliases
+ BOLD(Attribute.INTENSITY_BOLD),
+ FAINT(Attribute.INTENSITY_FAINT),;
+
+ private final Enum<?> n;
+
+ private final boolean background;
+
+ Code(final Enum<?> n, boolean background) {
+ this.n = n;
+ this.background = background;
+ }
+
+ Code(final Enum<?> n) {
+ this(n, false);
+ }
+
+ public boolean isColor() {
+ return n instanceof Ansi.Color;
+ }
+
+ public Ansi.Color getColor() {
+ return (Ansi.Color) n;
+ }
+
+ public boolean isAttribute() {
+ return n instanceof Attribute;
+ }
+
+ public Attribute getAttribute() {
+ return (Attribute) n;
+ }
+
+ public boolean isBackground() {
+ return background;
+ }
+ }
+
+ private AnsiRenderer() {
+ }
+
+}
\ No newline at end of file
diff --git a/src/test/java/org/fusesource/jansi/AnsiRendererTest.java b/src/test/java/org/fusesource/jansi/AnsiRendererTest.java
new file mode 100644
index 0000000..590a96b
--- /dev/null
+++ b/src/test/java/org/fusesource/jansi/AnsiRendererTest.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2009-2021 the original author(s).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.fusesource.jansi;
+
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static org.fusesource.jansi.Ansi.*;
+import static org.fusesource.jansi.Ansi.Attribute.*;
+import static org.fusesource.jansi.Ansi.Color.*;
+import static org.fusesource.jansi.AnsiRenderer.*;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * Tests for the {@link AnsiRenderer} class.
+ *
+ * @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
+ */
+public class AnsiRendererTest {
+
+ @BeforeAll
+ static void setUp() {
+ Ansi.setEnabled(true);
+ }
+
+ @Test
+ public void testTest() throws Exception {
+ assertFalse(test("foo"));
+ assertTrue(test("@|foo|"));
+ assertTrue(test("@|foo"));
+ }
+
+ @Test
+ public void testRender() {
+ String str = render("@|bold foo|@");
+ System.out.println(str);
+ assertEquals(ansi().a(INTENSITY_BOLD).a("foo").reset().toString(), str);
+ assertEquals(ansi().bold().a("foo").reset().toString(), str);
+ }
+
+ @Test
+ public void testRenderCodes() {
+ String str = renderCodes("bold red");
+ System.out.println(str);
+ assertEquals(ansi().bold().fg(Color.RED).toString(), str);
+ }
+
+ @Test
+ public void testRender2() {
+ String str = render("@|bold,red foo|@");
+ System.out.println(str);
+ assertEquals(Ansi.ansi().a(INTENSITY_BOLD).fg(RED).a("foo").reset().toString(), str);
+ assertEquals(Ansi.ansi().bold().fgRed().a("foo").reset().toString(), str);
+ }
+
+ @Test
+ public void testRender3() {
+ String str = render("@|bold,red foo bar baz|@");
+ System.out.println(str);
+ assertEquals(ansi().a(INTENSITY_BOLD).fg(RED).a("foo bar baz").reset().toString(), str);
+ assertEquals(ansi().bold().fgRed().a("foo bar baz").reset().toString(), str);
+ }
+
+ @Test
+ public void testRender4() {
+ String str = render("@|bold,red foo bar baz|@ ick @|bold,red foo bar baz|@");
+ System.out.println(str);
+ assertEquals(ansi()
+ .a(INTENSITY_BOLD).fg(RED).a("foo bar baz").reset()
+ .a(" ick ")
+ .a(INTENSITY_BOLD).fg(RED).a("foo bar baz").reset()
+ .toString(), str);
+ }
+
+ @Test
+ public void testRender5() {
+ // Check the ansi() render method.
+ String str = ansi().render("@|bold Hello|@").toString();
+ System.out.println(str);
+ assertEquals(ansi().a(INTENSITY_BOLD).a("Hello").reset().toString(), str);
+ }
+
+
+ @Test
+ public void testRenderNothing() {
+ assertEquals("foo", render("foo"));
+ }
+
+ @Test
+ public void testRenderInvalidMissingEnd() {
+ String str = render("@|bold foo");
+ assertEquals("@|bold foo", str);
+ }
+
+ @Test
+ public void testRenderInvalidMissingText() {
+ String str = render("@|bold|@");
+ assertEquals("@|bold|@", str);
+ }
+}
\ No newline at end of file
--
2.33.1

176
changelog
View file

@ -1,176 +0,0 @@
* Thu Jul 18 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Tue Feb 27 2024 Jiri Vanek <jvanek@redhat.com> - 2.4.1-3
- Rebuilt for java-21-openjdk as system jdk
* Fri Feb 23 2024 Jiri Vanek <jvanek@redhat.com> - 2.4.1-2
- bump of release for for java-21-openjdk as system jdk
* Thu Feb 01 2024 Mikolaj Izdebski <mizdebsk@redhat.com> - 2.4.1-1
- Update to upstream version 2.4.1
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.0-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sat Jan 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.0-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Wed Sep 20 2023 Mikolaj Izdebski <mizdebsk@redhat.com> - 2.4.0-10
- Rebuild to regenerate auto-Requires on java
* Fri Sep 01 2023 Mikolaj Izdebski <mizdebsk@redhat.com> - 2.4.0-9
- Convert License tag to SPDX format
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.0-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Mon Jul 18 2022 Mikolaj Izdebski <mizdebsk@redhat.com> - 2.4.0-5
- Ensure CC env variable is set during build
* Thu Jul 14 2022 Marian Koncek <mkoncek@redhat.com> - 2.4.0-4
- Make javadoc subpackage noarch
* Sat Feb 05 2022 Jiri Vanek <jvanek@redhat.com> - 2.4.0-3
- Rebuilt for java-17-openjdk as system jdk
* 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
* Mon Feb 26 2018 Michael Simacek <msimacek@redhat.com> - 1.17-1
- Update to upstream version 1.17
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.16-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.16-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Wed Jun 14 2017 Michael Simacek <msimacek@redhat.com> - 1.16-1
- Update to upstream version 1.16
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.11-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Wed Feb 01 2017 Michael Simacek <msimacek@redhat.com> - 1.11-11
- Remove BR on maven-site-plugin
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.11-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.11-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Thu May 14 2015 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.11-8
- Remove maven-javadoc-plugin execution
* Tue Jan 27 2015 Mat Booth <mat.booth@redhat.com> - 1.11-7
- Add/remove BRs to fix FTBFS bug
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.11-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Mon May 26 2014 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.11-5
- Migrate BuildRequires from junit4 to junit
* Mon May 26 2014 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.11-4
- Remove BuildRequires on maven-surefire-provider-junit4
* Wed Sep 11 2013 Marek Goldmann <mgoldman@redhat.com> - 1.11-3
- Using xmvn
- Remove the jboss-native deps with classifiers
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.11-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Tue May 21 2013 Marek Goldmann <mgoldman@redhat.com> - 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 <rel-eng@lists.fedoraproject.org> - 1.9-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Wed Feb 06 2013 Java SIG <java-devel@lists.fedoraproject.org> - 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 <mgoldman@redhat.com> - 1.9-1
- Upstream release 1.9, RHBZ#864490
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Fri May 04 2012 Tomas Radej <tradej@redhat.com> - 1.6-3
- Removed maven-license-plugin BR
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Thu Aug 25 2011 Marek Goldmann <mgoldman@redhat.com> 1.6-1
- Upstream release 1.6
- Spec file cleanup
* Fri May 27 2011 Marek Goldmann <mgoldman@redhat.com> 1.5-1
- Initial packaging

1
ci.fmf
View file

@ -1 +0,0 @@
resultsdb-testcase: separate

View file

@ -1,8 +0,0 @@
--- !Policy
product_versions:
- fedora-*
decision_contexts:
- bodhi_update_push_testing
- bodhi_update_push_stable
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build./plans/javapackages.functional}

View file

@ -1,20 +0,0 @@
#!/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/resources/org/fusesource/jansi/internal/native/*
tar -czf "../${name}-${version}.tar.gz" *
popd
rm -r tarball-tmp "${name}-${version}.orig.tar.gz"

View file

@ -6,7 +6,7 @@
}
+ } else {
+ if (loadNativeLibrary(new File("@LIBDIR@/jansi", jansiNativeLibraryName))) {
+ loaded = true;
+ extracted = true;
+ return;
+ }
}

View file

@ -1,35 +1,25 @@
%bcond_with bootstrap
Name: jansi
Version: 2.4.2
Release: %autorelease
Summary: Generate and interpret ANSI escape sequences in Java
License: Apache-2.0
URL: https://fusesource.github.io/jansi/
ExclusiveArch: %{java_arches}
# ./generate-tarball.sh
Source0: %{name}-%{version}.tar.gz
# Remove bundled binaries which cannot be easily verified for licensing
Source1: generate-tarball.sh
Name: jansi
Version: 2.1.1
Release: 4%{?dist}
Summary: Generate and interpret ANSI escape sequences in Java
License: ASL 2.0
URL: http://fusesource.github.io/jansi/
Source0: https://github.com/fusesource/jansi/archive/jansi-%{version}.tar.gz
# Change the location of the native artifact to where Fedora wants it
Patch: %{name}-jni.patch
Patch0: %{name}-jni.patch
# Bring back AnsiRenderer
# https://github.com/fusesource/jansi/commit/faf9331
# Needed to build newer log4j
Patch1: 0001-Bring-back-the-AnsiRenderer-fixes-184.patch
BuildRequires: gcc
%if %{with bootstrap}
BuildRequires: javapackages-bootstrap
%else
BuildRequires: maven-local-openjdk25
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-source-plugin)
BuildRequires: mvn(org.fusesource:fusesource-pom:pom:)
BuildRequires: mvn(org.junit.jupiter:junit-jupiter)
BuildRequires: mvn(org.junit.jupiter:junit-jupiter-params)
BuildRequires: mvn(org.moditect:moditect-maven-plugin)
%endif
# TODO Remove in Fedora 46
Obsoletes: %{name}-javadoc < 2.4.1-16
BuildRequires: gcc
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)
%description
Jansi is a small java library that allows you to use ANSI escape sequences
@ -37,8 +27,14 @@ 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.
%package javadoc
Summary: Javadocs for %{name}
%description javadoc
This package contains the API documentation for %{name}.
%prep
%autosetup -p1 -C
%autosetup -n jansi-jansi-%{version} -p1
# We don't need the Fuse JXR skin
%pom_xpath_remove "pom:build/pom:extensions"
@ -47,19 +43,29 @@ when output is being sent to output devices which cannot support ANSI sequences.
%pom_remove_plugin :maven-gpg-plugin
%pom_remove_plugin :maven-javadoc-plugin
%pom_remove_plugin :nexus-staging-maven-plugin
%pom_remove_plugin :spotless-maven-plugin
# We don't want GraalVM support in Fedora
%pom_remove_plugin :exec-maven-plugin
%pom_remove_dep :picocli-codegen
# Build for JDK 1.8 at a minimum
%pom_xpath_set "//pom:plugin[pom:artifactId='maven-compiler-plugin']//pom:source" 1.8
%pom_xpath_set "//pom:plugin[pom:artifactId='maven-compiler-plugin']//pom:target" 1.8
# Remove prebuilt shared objects
rm -fr src/main/resources/org/fusesource/jansi/internal
# 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,' \
sed -i 's,@LIBDIR@,%{libdir},' \
src/main/java/org/fusesource/jansi/internal/JansiLoader.java
%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
@ -71,12 +77,12 @@ $CC $CFLAGS $LDFLAGS -shared -o libjansi.so *.o -lutil
cd -
# Build the Java artifacts
%mvn_build -j -- -Dlibrary.jansi.path=$PWD/src/main/native
%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}
mkdir -p %{buildroot}%{_libdir}/%{name}
cp -p src/main/native/libjansi.so %{buildroot}%{_libdir}/%{name}
# Install the Java artifacts
%mvn_install
@ -84,7 +90,123 @@ cp -p src/main/native/libjansi.so %{buildroot}%{_prefix}/lib/%{name}
%files -f .mfiles
%license license.txt
%doc readme.md changelog.md
%{_prefix}/lib/%{name}/
%{_libdir}/%{name}/
%files javadoc -f .mfiles-javadoc
%license license.txt
%changelog
%autochangelog
* Mon Dec 13 2021 Adam Williamson <awilliam@redhat.com> - 2.1.1-4
- Backport patch to bring back AnsiRenderer
* 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
* Mon Feb 26 2018 Michael Simacek <msimacek@redhat.com> - 1.17-1
- Update to upstream version 1.17
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.16-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.16-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Wed Jun 14 2017 Michael Simacek <msimacek@redhat.com> - 1.16-1
- Update to upstream version 1.16
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.11-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Wed Feb 01 2017 Michael Simacek <msimacek@redhat.com> - 1.11-11
- Remove BR on maven-site-plugin
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.11-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.11-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Thu May 14 2015 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.11-8
- Remove maven-javadoc-plugin execution
* Tue Jan 27 2015 Mat Booth <mat.booth@redhat.com> - 1.11-7
- Add/remove BRs to fix FTBFS bug
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.11-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Mon May 26 2014 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.11-5
- Migrate BuildRequires from junit4 to junit
* Mon May 26 2014 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.11-4
- Remove BuildRequires on maven-surefire-provider-junit4
* Wed Sep 11 2013 Marek Goldmann <mgoldman@redhat.com> - 1.11-3
- Using xmvn
- Remove the jboss-native deps with classifiers
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.11-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Tue May 21 2013 Marek Goldmann <mgoldman@redhat.com> - 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 <rel-eng@lists.fedoraproject.org> - 1.9-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Wed Feb 06 2013 Java SIG <java-devel@lists.fedoraproject.org> - 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 <mgoldman@redhat.com> - 1.9-1
- Upstream release 1.9, RHBZ#864490
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Fri May 04 2012 Tomas Radej <tradej@redhat.com> - 1.6-3
- Removed maven-license-plugin BR
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Thu Aug 25 2011 Marek Goldmann <mgoldman@redhat.com> 1.6-1
- Upstream release 1.6
- Spec file cleanup
* Fri May 27 2011 Marek Goldmann <mgoldman@redhat.com> 1.5-1
- Initial packaging

View file

@ -1,7 +0,0 @@
summary: Run javapackages-specific tests
discover:
how: fmf
url: https://gitlab.com/redhat/centos-stream/tests/javapackages.git
ref: f43
execute:
how: tmt

View file

@ -1 +1 @@
SHA512 (jansi-2.4.2.tar.gz) = a2e1e7d120a474cdaa942d3ea03055b88f5fc5f404af445c422b5d0c365810b824bc529c3c1619e8378541e7138ddb826a92160c945ddbdd8daccf0705437a0f
SHA512 (jansi-2.1.1.tar.gz) = ccdb7b13da6715398b0b1d53bb1272ac445774dea7f643882c7df0182e17350b41dd1c782161f5350028209c82ac3588c22ceaaacd4930ec78645230b335bc4a