commit:     a020c595903fd11dedc3d33bc3f898651fc8eb36
Author:     Zoltan Puskas <zoltan <AT> sinustrom <DOT> info>
AuthorDate: Wed Jun 29 04:52:27 2022 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Wed Sep 14 14:01:11 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a020c595

app-text/aha: new package, add 0.5.1

Signed-off-by: Zoltan Puskas <zoltan <AT> sinustrom.info>
Closes: https://github.com/gentoo/gentoo/pull/26131
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 app-text/aha/Manifest                              |   1 +
 app-text/aha/aha-0.5.1.ebuild                      |  20 ++++
 .../files/aha-0.5.1-null-ptr-dereference-fix.patch | 105 +++++++++++++++++++++
 app-text/aha/metadata.xml                          |  20 ++++
 4 files changed, 146 insertions(+)

diff --git a/app-text/aha/Manifest b/app-text/aha/Manifest
new file mode 100644
index 000000000000..35f1276e19ca
--- /dev/null
+++ b/app-text/aha/Manifest
@@ -0,0 +1 @@
+DIST aha-0.5.1.tar.gz 394410 BLAKE2B 
7276219068a8e496b41a953f4cdfc130b85778b44d194fedb63b0f0d921db0efcf0f62fae52ec580ac1462e3b03edd6ad97dab7d7ff2c138ef300824efbad111
 SHA512 
0eb88e681208c0956e344d6574f9d7ba155d38bfb386d0a9f17022c5e925fb16d0efb6aa04804191b4cac1697a87a0f16ba51bcd97b6135cc7606046eaf89288

diff --git a/app-text/aha/aha-0.5.1.ebuild b/app-text/aha/aha-0.5.1.ebuild
new file mode 100644
index 000000000000..2cb556e1e882
--- /dev/null
+++ b/app-text/aha/aha-0.5.1.ebuild
@@ -0,0 +1,20 @@
+# Copyright 2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DESCRIPTION="Converts ANSI escape sequences of a unix terminal to HTML code"
+HOMEPAGE="https://github.com/theZiz/aha";
+SRC_URI="https://github.com/theZiz/aha/archive/refs/tags/${PV}.tar.gz -> 
${P}.tar.gz"
+
+LICENSE="LGPL-2+ MPL-1.1"
+SLOT="0"
+KEYWORDS="~amd64"
+
+PATCHES=(
+       "${FILESDIR}/${P}-null-ptr-dereference-fix.patch"
+)
+
+src_install() {
+       emake PREFIX="${D}/usr" install
+}

diff --git a/app-text/aha/files/aha-0.5.1-null-ptr-dereference-fix.patch 
b/app-text/aha/files/aha-0.5.1-null-ptr-dereference-fix.patch
new file mode 100644
index 000000000000..6ec2ca9cae1d
--- /dev/null
+++ b/app-text/aha/files/aha-0.5.1-null-ptr-dereference-fix.patch
@@ -0,0 +1,105 @@
+diff --git a/aha.c b/aha.c
+index 46e43c0..2bfebb7 100644
+--- a/aha.c
++++ b/aha.c
+@@ -138,6 +138,15 @@ pelem parseInsert(char* s)
+       return firstelem;
+ }
+ 
++int parseDepthAtLeast(pelem elem, unsigned int wanted) {
++      while (elem != NULL) {
++              if (wanted == 0) return 1;
++              elem = elem->next;
++              --wanted;
++      }
++      return 0;
++}
++
+ void deleteParse(pelem elem)
+ {
+       while (elem!=NULL)
+@@ -831,27 +840,20 @@ int main(int argc,char* args[])
+                                                                               
}
+                                                                               
else
+                                                                               
if (momelem->value == 38 &&
+-                                                                              
        momelem->next &&
+-                                                                              
        momelem->next->value == 2 &&
+-                                                                              
        momelem->next->next)// 38;2;<n> -> 24 Bit
++                                                                              
        parseDepthAtLeast(momelem, 4) &&
++                                                                              
        momelem->next->value == 2)// 38;2;<r>;<g>;<b> -> 24 Bit
+                                                                               
{
+-                                                                              
        momelem = momelem->next->next;
+-                                                                              
        pelem r,g,b;
+-                                                                              
        r = momelem;
+-                                                                              
        momelem = momelem->next;
+-                                                                              
        g = momelem;
+-                                                                              
        if ( momelem )
+-                                                                              
                momelem = momelem->next;
+-                                                                              
        b = momelem;
+-                                                                              
        if ( r && g && b )
+-                                                                              
        {
+-                                                                              
                state.highlighted = 0;
+-                                                                              
                state.fc_colormode = MODE_24BIT;
+-                                                                              
                *dest =
+-                                                                              
                        (r->value & 255) * 65536 +
+-                                                                              
                        (g->value & 255) * 256 +
+-                                                                              
                        (b->value & 255);
+-                                                                              
        }
++                                                                              
        pelem r = momelem->next->next;
++                                                                              
        pelem g = r->next;
++                                                                              
        pelem b = g->next;
++                                                                              
        momelem = b;
++
++                                                                              
        state.highlighted = 0;
++                                                                              
        state.fc_colormode = MODE_24BIT;
++                                                                              
        *dest =
++                                                                              
                (r->value & 255) * 65536 +
++                                                                              
                (g->value & 255) * 256 +
++                                                                              
                (b->value & 255);
+                                                                               
}
+                                                                               
else
+                                                                               
{
+@@ -899,27 +901,20 @@ int main(int argc,char* args[])
+                                                                               
}
+                                                                               
else
+                                                                               
if (momelem->value == 48 &&
+-                                                                              
        momelem->next &&
+-                                                                              
        momelem->next->value == 2 &&
+-                                                                              
        momelem->next->next)// 48;2;<n> -> 24 Bit
++                                                                              
        parseDepthAtLeast(momelem, 4) &&
++                                                                              
        momelem->next->value == 2)// 48;2;<r>;<g>;<b> -> 24 Bit
+                                                                               
{
+-                                                                              
        momelem = momelem->next->next;
+-                                                                              
        pelem r,g,b;
+-                                                                              
        r = momelem;
+-                                                                              
        momelem = momelem->next;
+-                                                                              
        g = momelem;
+-                                                                              
        if ( momelem )
+-                                                                              
                momelem = momelem->next;
+-                                                                              
        b = momelem;
+-                                                                              
        if ( r && g && b )
+-                                                                              
        {
+-                                                                              
                state.bc_colormode = MODE_24BIT;
+-                                                                              
                state.highlighted = 0;
+-                                                                              
                *dest =
+-                                                                              
                        (r->value & 255) * 65536 +
+-                                                                              
                        (g->value & 255) * 256 +
+-                                                                              
                        (b->value & 255);
+-                                                                              
        }
++                                                                              
        pelem r = momelem->next->next;
++                                                                              
        pelem g = r->next;
++                                                                              
        pelem b = g->next;
++                                                                              
        momelem = b;
++
++                                                                              
        state.bc_colormode = MODE_24BIT;
++                                                                              
        state.highlighted = 0;
++                                                                              
        *dest =
++                                                                              
                (r->value & 255) * 65536 +
++                                                                              
                (g->value & 255) * 256 +
++                                                                              
                (b->value & 255);
+                                                                               
}
+                                                                               
else
+                                                                               
{
+-- 
+2.35.1
+

diff --git a/app-text/aha/metadata.xml b/app-text/aha/metadata.xml
new file mode 100644
index 000000000000..16118a3d4fa8
--- /dev/null
+++ b/app-text/aha/metadata.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person" proxied="yes">
+               <email>[email protected]</email>
+               <name>Zoltan Puskas</name>
+       </maintainer>
+       <maintainer type="project" proxied="proxy">
+               <email>[email protected]</email>
+               <name>Proxy Maintainers</name>
+       </maintainer>
+       <longdescription>
+               aha (ANSI HTML Adapter) converts ANSI colors to HTML, e.g. if 
you want
+               to publish the output of ls --color=yes, git diff, ccal or htop 
as
+               static HTML somewhere.
+       </longdescription>
+       <upstream>
+               <remote-id type="github">theZiz/aha</remote-id>
+       </upstream>
+</pkgmetadata>

Reply via email to