public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Conrad Kostecki" <conikost@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lua/luaexpat/files/, dev-lua/luaexpat/
Date: Thu,  8 Oct 2020 19:14:03 +0000 (UTC)	[thread overview]
Message-ID: <1602184421.f8051ee00cc653d5e43febbf00b05dc24959ee8c.conikost@gentoo> (raw)

commit:     f8051ee00cc653d5e43febbf00b05dc24959ee8c
Author:     Azamat H. Hackimov <azamat.hackimov <AT> gmail <DOT> com>
AuthorDate: Mon Oct  5 22:05:59 2020 +0000
Commit:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
CommitDate: Thu Oct  8 19:13:41 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f8051ee0

dev-lua/luaexpat: restore more functionality

Restore more features that sill missed in forked 1.3.3

See: https://github.com/tomasguisasola/luaexpat/pull/5
Closes: https://github.com/gentoo/gentoo/pull/17813
Package-Manager: Portage-3.0.4, Repoman-3.0.1
Signed-off-by: Azamat H. Hackimov <azamat.hackimov <AT> gmail.com>
Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>

 .../luaexpat/files/luaexpat-1.3.3_makefile.patch   |  10 +-
 .../luaexpat-1.3.3_restore_functionality.patch     | 109 +++++++++++++++++++++
 dev-lua/luaexpat/luaexpat-1.3.3-r2.ebuild          |  49 +++++++++
 3 files changed, 167 insertions(+), 1 deletion(-)

diff --git a/dev-lua/luaexpat/files/luaexpat-1.3.3_makefile.patch b/dev-lua/luaexpat/files/luaexpat-1.3.3_makefile.patch
index 95de7be6069..a780dddea83 100644
--- a/dev-lua/luaexpat/files/luaexpat-1.3.3_makefile.patch
+++ b/dev-lua/luaexpat/files/luaexpat-1.3.3_makefile.patch
@@ -1,5 +1,5 @@
 diff --git a/makefile b/makefile
-index 1a5a145..df09239 100644
+index 1a5a145..50912f0 100644
 --- a/makefile
 +++ b/makefile
 @@ -45,7 +45,7 @@ OBJS= src/lxplib.o
@@ -11,3 +11,11 @@ index 1a5a145..df09239 100644
  
  install:
  	mkdir -p $(LUA_LIBDIR)
+@@ -53,6 +53,7 @@ install:
+ 	cd $(LUA_LIBDIR); ln -f -s $(LIBNAME) $T.so
+ 	mkdir -p $(LUA_DIR)/$T
+ 	cp src/$T/lom.lua $(LUA_DIR)/$T
++	cp src/$T/totable.lua $(LUA_DIR)/$T
+ 
+ clean:
+ 	rm -f src/$(LIBNAME) $(OBJS)

diff --git a/dev-lua/luaexpat/files/luaexpat-1.3.3_restore_functionality.patch b/dev-lua/luaexpat/files/luaexpat-1.3.3_restore_functionality.patch
new file mode 100644
index 00000000000..c0bc8c1a7b4
--- /dev/null
+++ b/dev-lua/luaexpat/files/luaexpat-1.3.3_restore_functionality.patch
@@ -0,0 +1,109 @@
+From 4ef48128bd9a725daca1d5a4aabe0c1665d78742 Mon Sep 17 00:00:00 2001
+From: Matthew Wild <mwild1@gmail.com>
+Date: Wed, 2 Apr 2014 21:02:29 +0100
+Subject: [PATCH] Make merging of CharacterData events optional, controlled by
+ the 3rd parameter of lxp.new()
+
+---
+ src/lxplib.c | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/src/lxplib.c b/src/lxplib.c
+index a7d6c42..794f6e3 100644
+--- a/src/lxplib.c
++++ b/src/lxplib.c
+@@ -57,6 +57,7 @@ struct lxp_userdata {
+   int tableref;  /* table with callbacks for this parser */
+   enum XPState state;
+   luaL_Buffer *b;  /* to concatenate sequences of cdata pieces */
++  int bufferCharData; /* whether to buffer cdata pieces */
+ };
+ 
+ typedef struct lxp_userdata lxp_userdata;
+@@ -171,8 +172,13 @@ static void f_CharData (void *ud, const char *s, int len) {
+   lxp_userdata *xpu = (lxp_userdata *)ud;
+   if (xpu->state == XPSok) {
+     if (getHandle(xpu, CharDataKey) == 0) return;  /* no handle */
+-    xpu->state = XPSstring;
+-    luaL_buffinit(xpu->L, xpu->b);
++    if(xpu->bufferCharData != 0) {
++      xpu->state = XPSstring;
++      luaL_buffinit(xpu->L, xpu->b);
++    } else {
++      lua_pushlstring(xpu->L, s, len);
++      docall(xpu, 1, 0);
++    }
+   }
+   if (xpu->state == XPSstring)
+     luaL_addlstring(xpu->b, s, len);
+@@ -393,8 +399,10 @@ static void checkcallbacks (lua_State *L) {
+ 
+ static int lxp_make_parser (lua_State *L) {
+   XML_Parser p;
++  int bufferCharData = (lua_type(L, 3) != LUA_TBOOLEAN) || (lua_toboolean(L, 3) != 0);
+   char sep = *luaL_optstring(L, 2, "");
+   lxp_userdata *xpu = createlxp(L);
++  xpu->bufferCharData = bufferCharData;
+   p = xpu->parser = (sep == '\0') ? XML_ParserCreate(NULL) :
+                                     XML_ParserCreateNS(NULL, sep);
+   if (!p)
+From cbaf85740f6032cfc025c7bde3f9861d15825928 Mon Sep 17 00:00:00 2001
+From: Matthew Wild <mwild1@gmail.com>
+Date: Wed, 2 Apr 2014 20:56:58 +0100
+Subject: [PATCH] Add support for XmlDecl handlers
+
+---
+ src/lxplib.c | 14 +++++++++++++-
+ src/lxplib.h |  1 +
+ 2 files changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/src/lxplib.c b/src/lxplib.c
+index 35bec3c..a7d6c42 100644
+--- a/src/lxplib.c
++++ b/src/lxplib.c
+@@ -345,6 +345,16 @@ static void f_StartDoctypeDecl (void *ud, const XML_Char *doctypeName,
+   docall(xpu, 4, 0);
+ }
+ 
++static void f_XmlDecl (void *ud, const XML_Char *version,
++                                 const XML_Char *encoding,
++                                 int standalone) {
++  lxp_userdata *xpu = (lxp_userdata *)ud;
++  if (getHandle(xpu, XmlDeclKey) == 0) return;  /* no handle */
++  lua_pushstring(xpu->L, version);
++  lua_pushstring(xpu->L, encoding);
++  lua_pushboolean(xpu->L, standalone);
++  docall(xpu, 3, 0);
++}
+ /* }====================================================== */
+ 
+ 
+@@ -365,7 +375,7 @@ static void checkcallbacks (lua_State *L) {
+     "Default", "DefaultExpand", "StartElement", "EndElement",
+     "ExternalEntityRef", "StartNamespaceDecl", "EndNamespaceDecl",
+     "NotationDecl", "NotStandalone", "ProcessingInstruction",
+-    "UnparsedEntityDecl", "StartDoctypeDecl", NULL};
++    "UnparsedEntityDecl", "StartDoctypeDecl", "XmlDecl", NULL};
+   if (hasfield(L, "_nonstrict")) return;
+   lua_pushnil(L);
+   while (lua_next(L, 1)) {
+@@ -420,6 +430,8 @@ static int lxp_make_parser (lua_State *L) {
+     XML_SetUnparsedEntityDeclHandler(p, f_UnparsedEntityDecl);
+   if (hasfield(L, StartDoctypeDeclKey))
+     XML_SetStartDoctypeDeclHandler(p, f_StartDoctypeDecl);
++  if (hasfield(L, XmlDeclKey))
++    XML_SetXmlDeclHandler(p, f_XmlDecl);
+   return 1;
+ }
+ 
+diff --git a/src/lxplib.h b/src/lxplib.h
+index 9c0be4f..4c7084c 100644
+--- a/src/lxplib.h
++++ b/src/lxplib.h
+@@ -20,5 +20,6 @@
+ #define ProcessingInstructionKey	"ProcessingInstruction"
+ #define UnparsedEntityDeclKey		"UnparsedEntityDecl"
+ #define StartDoctypeDeclKey		"StartDoctypeDecl"
++#define XmlDeclKey			"XmlDecl"
+ 
+ int luaopen_lxp (lua_State *L);

diff --git a/dev-lua/luaexpat/luaexpat-1.3.3-r2.ebuild b/dev-lua/luaexpat/luaexpat-1.3.3-r2.ebuild
new file mode 100644
index 00000000000..5b99b5d96ba
--- /dev/null
+++ b/dev-lua/luaexpat/luaexpat-1.3.3-r2.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit multilib-minimal toolchain-funcs
+
+DESCRIPTION="LuaExpat is a SAX XML parser based on the Expat library"
+HOMEPAGE="https://matthewwild.co.uk/projects/luaexpat/ https://github.com/tomasguisasola/luaexpat"
+SRC_URI="https://github.com/tomasguisasola/luaexpat/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~mips ~ppc ~ppc64 ~sparc ~x86"
+
+RDEPEND=">=dev-lang/lua-5.1.5-r2:0[${MULTILIB_USEDEP}]
+	>=dev-libs/expat-2.1.0-r3[${MULTILIB_USEDEP}]"
+DEPEND="${RDEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=(
+	"${FILESDIR}/${P}_makefile.patch"
+	"${FILESDIR}/${P}_getcurrentbytecount.patch"
+	"${FILESDIR}/${P}_restore_functionality.patch"
+)
+
+src_prepare() {
+	default
+	multilib_copy_sources
+}
+
+multilib_src_compile() {
+	emake \
+		CFLAGS="${CFLAGS}" \
+		LDFLAGS="${LDFLAGS}" \
+		CC="$(tc-getCC)" \
+		LUA_INC="$($(tc-getPKG_CONFIG) --variable INSTALL_INC lua)"
+}
+
+multilib_src_install() {
+	emake \
+		LUA_DIR="${D}/$($(tc-getPKG_CONFIG) --variable INSTALL_LMOD lua)" \
+		LUA_LIBDIR="${D}/$($(tc-getPKG_CONFIG) --variable INSTALL_CMOD lua)" \
+		install
+}
+
+multilib_src_install_all() {
+	dodoc -r README.md doc/*
+}


             reply	other threads:[~2020-10-08 19:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-08 19:14 Conrad Kostecki [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-10-05 21:34 [gentoo-commits] repo/gentoo:master commit in: dev-lua/luaexpat/files/, dev-lua/luaexpat/ Conrad Kostecki
2020-08-24 14:39 Joonas Niilola

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1602184421.f8051ee00cc653d5e43febbf00b05dc24959ee8c.conikost@gentoo \
    --to=conikost@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox