update deb-libs/libxml2 to the latest version

BUG=b:31324064
TEST=emerge libxml2

Change-Id: Ic8187e7b673feedbac0d0b7d2f8800a86d10a25a
Reviewed-on: https://chromium-review.googlesource.com/382373
Commit-Ready: Andrey Ulanov <andreyu@google.com>
Tested-by: Andrey Ulanov <andreyu@google.com>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/dev-libs/libxml2/Manifest b/dev-libs/libxml2/Manifest
index bc57e91..78dfb10 100644
--- a/dev-libs/libxml2/Manifest
+++ b/dev-libs/libxml2/Manifest
@@ -1,4 +1,4 @@
-DIST libxml2-2.9.2.tar.gz 5444991 SHA256 5178c30b151d044aefb1b08bf54c3003a0ac55c59c866763997529d60770d5bc SHA512 a4e3b20e2efceed39c20379b32b746d4a1cf65c0cf7719d26c9bf7483c1f04a4e5a442ae2f36dc4ae8a4d011b67cfb58d9f6d0be034fa3e897a49059c9289565 WHIRLPOOL d7a77cb6ad49533cf62f6a759668e297a60dd7f70c9e13b29f682c64dfb25ae46eb9db552500130f40e3f969897bda996001d18236a4630e3713f6dd5acbe686
+DIST libxml2-2.9.4.tar.gz 5374830 SHA256 ffb911191e509b966deb55de705387f14156e1a56b21824357cdf0053233633c SHA512 f5174ab1a3a0ec0037a47f47aa47def36674e02bfb42b57f609563f84c6247c585dbbb133c056953a5adb968d328f18cbc102eb0d00d48eb7c95478389e5daf9 WHIRLPOOL 268d3364a3d293810dff060b3ab92042c5550e50dbe9038c4d5b54ea6a22ed77f9572575517ae3bacfe518d634047eb9d5345e903b125e56a3d32ad1ba96dabf
 DIST xmlts20080827.tar.gz 638940 SHA256 96151685cec997e1f9f3387e3626d61e6284d4d6e66e0e440c209286c03e9cc7 SHA512 7325d0977c4427fc4944b291ccf896a665f654cc24399e5565c12a849c2bc3aef4fa3ee42a09ac115abcb6570c51a8fbd052c38d64d164279ecdecad5a4e884d WHIRLPOOL 50835380c3ea208df0bf9ce032ed2df69c4c6cb5a53ffdd39a08fb4f1d166f311b2ef2fe0d9911ae1ebff92aeb42f6ea55e727dfe0b7a3b95e6c7240315b3eda
 DIST xsts-2002-01-16.tar.gz 6894439 SHA256 55e5c08db29946a91ea8e70e8f2418d3fd30d8b6777941dfba7f54726ffd9914 SHA512 43300af6d39c1e2221b0ed7318fe14c7464eeb6eb030ed1e22eb29b4ab17f014e2a4c8887c3a46ae5d243e3072da27f00f4e285498ae6f1288177d38d1108288 WHIRLPOOL 84dd51959460a4f8aa582d57ad39229c546ca7fe155012c57c368b59f5d31400d8b940a343a7320058330ca611303139cacdffed514783f96406ac5366026b11
 DIST xsts-2004-01-14.tar.gz 2761085 SHA256 09bdf9f81f381ebf9bc158a9472e498e896f7a02eb7461146e9abe1b9493ca17 SHA512 32854388d7e720ad67156baf50bf2bae7bd878ca3e35fd7e44e57cad3f434f69d56bbbedd61509f8a1faf01c9eae74a078df8fe130780b182c05c05cb1c39ebe WHIRLPOOL c46a3bf7d6dd771757f4304995cc177cf51c6cdd0e9778851fc13d3809c7b984690b4f273b3e075abe018110968eb7fc78f5b83170d3e18bacf00a4ed64b213d
diff --git a/dev-libs/libxml2/files/libxml2-2.7.1-catalog_path.patch b/dev-libs/libxml2/files/libxml2-2.7.1-catalog_path.patch
index 25ea478..3f69ec2 100644
--- a/dev-libs/libxml2/files/libxml2-2.7.1-catalog_path.patch
+++ b/dev-libs/libxml2/files/libxml2-2.7.1-catalog_path.patch
@@ -1,5 +1,5 @@
---- catalog.c
-+++ catalog.c
+--- a/catalog.c
++++ b/catalog.c
 @@ -68,10 +68,10 @@
  #define XML_URN_PUBID "urn:publicid:"
  #define XML_CATAL_BREAK ((xmlChar *) -1)
@@ -22,8 +22,8 @@
  #if defined(_WIN32_WCE)
  /* Windows CE don't have a A variant */
  #define GetModuleHandleA GetModuleHandle
---- xmlcatalog.c
-+++ xmlcatalog.c
+--- a/xmlcatalog.c
++++ b/xmlcatalog.c
 @@ -43,7 +43,7 @@
  
  
@@ -33,8 +33,8 @@
  #endif
  
  /************************************************************************
---- runtest.c
-+++ runtest.c
+--- a/runtest.c
++++ b/runtest.c
 @@ -2747,7 +2747,7 @@
   */
  static int
@@ -53,8 +53,8 @@
          return(NULL);
      /* Verify we received the escaped URL */
      if (strcmp(urip_rcvsURLs[urip_current], URI))
---- xmllint.c
-+++ xmllint.c
+--- a/xmllint.c
++++ b/xmllint.c
 @@ -103,7 +103,7 @@
  #endif
  
diff --git a/dev-libs/libxml2/files/libxml2-2.9.2-constant-memory.patch b/dev-libs/libxml2/files/libxml2-2.9.2-constant-memory.patch
deleted file mode 100644
index dc944b6..0000000
--- a/dev-libs/libxml2/files/libxml2-2.9.2-constant-memory.patch
+++ /dev/null
@@ -1,176 +0,0 @@
-From 213f1fe0d76d30eaed6e5853057defc43e6df2c9 Mon Sep 17 00:00:00 2001
-From: Daniel Veillard <veillard@redhat.com>
-Date: Tue, 14 Apr 2015 17:41:48 +0800
-Subject: [PATCH] CVE-2015-1819 Enforce the reader to run in constant memory
-
-One of the operation on the reader could resolve entities
-leading to the classic expansion issue. Make sure the
-buffer used for xmlreader operation is bounded.
-Introduce a new allocation type for the buffers for this effect.
----
- buf.c                 | 43 ++++++++++++++++++++++++++++++++++++++++++-
- include/libxml/tree.h |  3 ++-
- xmlreader.c           | 20 +++++++++++++++++++-
- 3 files changed, 63 insertions(+), 3 deletions(-)
-
-diff --git a/buf.c b/buf.c
-index 6efc7b6..07922ff 100644
---- a/buf.c
-+++ b/buf.c
-@@ -27,6 +27,7 @@
- #include <libxml/tree.h>
- #include <libxml/globals.h>
- #include <libxml/tree.h>
-+#include <libxml/parserInternals.h> /* for XML_MAX_TEXT_LENGTH */
- #include "buf.h"
- 
- #define WITH_BUFFER_COMPAT
-@@ -299,7 +300,8 @@ xmlBufSetAllocationScheme(xmlBufPtr buf,
-     if ((scheme == XML_BUFFER_ALLOC_DOUBLEIT) ||
-         (scheme == XML_BUFFER_ALLOC_EXACT) ||
-         (scheme == XML_BUFFER_ALLOC_HYBRID) ||
--        (scheme == XML_BUFFER_ALLOC_IMMUTABLE)) {
-+        (scheme == XML_BUFFER_ALLOC_IMMUTABLE) ||
-+	(scheme == XML_BUFFER_ALLOC_BOUNDED)) {
- 	buf->alloc = scheme;
-         if (buf->buffer)
-             buf->buffer->alloc = scheme;
-@@ -458,6 +460,18 @@ xmlBufGrowInternal(xmlBufPtr buf, size_t len) {
-     size = buf->use + len + 100;
- #endif
- 
-+    if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
-+        /*
-+	 * Used to provide parsing limits
-+	 */
-+        if ((buf->use + len >= XML_MAX_TEXT_LENGTH) ||
-+	    (buf->size >= XML_MAX_TEXT_LENGTH)) {
-+	    xmlBufMemoryError(buf, "buffer error: text too long\n");
-+	    return(0);
-+	}
-+	if (size >= XML_MAX_TEXT_LENGTH)
-+	    size = XML_MAX_TEXT_LENGTH;
-+    }
-     if ((buf->alloc == XML_BUFFER_ALLOC_IO) && (buf->contentIO != NULL)) {
-         size_t start_buf = buf->content - buf->contentIO;
- 
-@@ -739,6 +753,15 @@ xmlBufResize(xmlBufPtr buf, size_t size)
-     CHECK_COMPAT(buf)
- 
-     if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0);
-+    if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
-+        /*
-+	 * Used to provide parsing limits
-+	 */
-+        if (size >= XML_MAX_TEXT_LENGTH) {
-+	    xmlBufMemoryError(buf, "buffer error: text too long\n");
-+	    return(0);
-+	}
-+    }
- 
-     /* Don't resize if we don't have to */
-     if (size < buf->size)
-@@ -867,6 +890,15 @@ xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len) {
- 
-     needSize = buf->use + len + 2;
-     if (needSize > buf->size){
-+	if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
-+	    /*
-+	     * Used to provide parsing limits
-+	     */
-+	    if (needSize >= XML_MAX_TEXT_LENGTH) {
-+		xmlBufMemoryError(buf, "buffer error: text too long\n");
-+		return(-1);
-+	    }
-+	}
-         if (!xmlBufResize(buf, needSize)){
- 	    xmlBufMemoryError(buf, "growing buffer");
-             return XML_ERR_NO_MEMORY;
-@@ -938,6 +970,15 @@ xmlBufAddHead(xmlBufPtr buf, const xmlChar *str, int len) {
-     }
-     needSize = buf->use + len + 2;
-     if (needSize > buf->size){
-+	if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) {
-+	    /*
-+	     * Used to provide parsing limits
-+	     */
-+	    if (needSize >= XML_MAX_TEXT_LENGTH) {
-+		xmlBufMemoryError(buf, "buffer error: text too long\n");
-+		return(-1);
-+	    }
-+	}
-         if (!xmlBufResize(buf, needSize)){
- 	    xmlBufMemoryError(buf, "growing buffer");
-             return XML_ERR_NO_MEMORY;
-diff --git a/include/libxml/tree.h b/include/libxml/tree.h
-index 2f90717..4a9b3bc 100644
---- a/include/libxml/tree.h
-+++ b/include/libxml/tree.h
-@@ -76,7 +76,8 @@ typedef enum {
-     XML_BUFFER_ALLOC_EXACT,	/* grow only to the minimal size */
-     XML_BUFFER_ALLOC_IMMUTABLE, /* immutable buffer */
-     XML_BUFFER_ALLOC_IO,	/* special allocation scheme used for I/O */
--    XML_BUFFER_ALLOC_HYBRID	/* exact up to a threshold, and doubleit thereafter */
-+    XML_BUFFER_ALLOC_HYBRID,	/* exact up to a threshold, and doubleit thereafter */
-+    XML_BUFFER_ALLOC_BOUNDED	/* limit the upper size of the buffer */
- } xmlBufferAllocationScheme;
- 
- /**
-diff --git a/xmlreader.c b/xmlreader.c
-index f19e123..471e7e2 100644
---- a/xmlreader.c
-+++ b/xmlreader.c
-@@ -2091,6 +2091,9 @@ xmlNewTextReader(xmlParserInputBufferPtr input, const char *URI) {
- 		"xmlNewTextReader : malloc failed\n");
- 	return(NULL);
-     }
-+    /* no operation on a reader should require a huge buffer */
-+    xmlBufSetAllocationScheme(ret->buffer,
-+			      XML_BUFFER_ALLOC_BOUNDED);
-     ret->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
-     if (ret->sax == NULL) {
- 	xmlBufFree(ret->buffer);
-@@ -3616,6 +3619,7 @@ xmlTextReaderConstValue(xmlTextReaderPtr reader) {
- 	    return(((xmlNsPtr) node)->href);
-         case XML_ATTRIBUTE_NODE:{
- 	    xmlAttrPtr attr = (xmlAttrPtr) node;
-+	    const xmlChar *ret;
- 
- 	    if ((attr->children != NULL) &&
- 	        (attr->children->type == XML_TEXT_NODE) &&
-@@ -3629,10 +3633,21 @@ xmlTextReaderConstValue(xmlTextReaderPtr reader) {
-                                         "xmlTextReaderSetup : malloc failed\n");
-                         return (NULL);
-                     }
-+		    xmlBufSetAllocationScheme(reader->buffer,
-+		                              XML_BUFFER_ALLOC_BOUNDED);
-                 } else
-                     xmlBufEmpty(reader->buffer);
- 	        xmlBufGetNodeContent(reader->buffer, node);
--		return(xmlBufContent(reader->buffer));
-+		ret = xmlBufContent(reader->buffer);
-+		if (ret == NULL) {
-+		    /* error on the buffer best to reallocate */
-+		    xmlBufFree(reader->buffer);
-+		    reader->buffer = xmlBufCreateSize(100);
-+		    xmlBufSetAllocationScheme(reader->buffer,
-+		                              XML_BUFFER_ALLOC_BOUNDED);
-+		    ret = BAD_CAST "";
-+		}
-+		return(ret);
- 	    }
- 	    break;
- 	}
-@@ -5131,6 +5146,9 @@ xmlTextReaderSetup(xmlTextReaderPtr reader,
-                         "xmlTextReaderSetup : malloc failed\n");
-         return (-1);
-     }
-+    /* no operation on a reader should require a huge buffer */
-+    xmlBufSetAllocationScheme(reader->buffer,
-+			      XML_BUFFER_ALLOC_BOUNDED);
-     if (reader->sax == NULL)
- 	reader->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
-     if (reader->sax == NULL) {
--- 
-2.3.5
-
diff --git a/dev-libs/libxml2/files/libxml2-2.9.2-cross-compile.patch b/dev-libs/libxml2/files/libxml2-2.9.2-cross-compile.patch
deleted file mode 100644
index 447222e..0000000
--- a/dev-libs/libxml2/files/libxml2-2.9.2-cross-compile.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-https://bugzilla.gnome.org/show_bug.cgi?id=749416
-
-do not use -L$Z_DIR/lib when Z_DIR isn't actually set
-
---- a/configure.ac
-+++ b/configure.ac
-@@ -392,7 +392,9 @@ if test "$with_zlib" = "no"; then
- else
-     AC_CHECK_HEADERS(zlib.h,
-         [SAVE_LDFLAGS="${LDFLAGS}"
--	 LDFLAGS="-L${Z_DIR}/lib"
-+	if test "x${Z_DIR}" != "x"; then
-+	    LDFLAGS="${LDFLAGS} -L${Z_DIR}/lib"
-+	fi
- 	AC_CHECK_LIB(z, gzread,[
- 	    AC_DEFINE([HAVE_LIBZ], [1], [Have compression library])
- 	    WITH_ZLIB=1
diff --git a/dev-libs/libxml2/files/libxml2-2.9.2-disable-tests.patch b/dev-libs/libxml2/files/libxml2-2.9.2-disable-tests.patch
new file mode 100644
index 0000000..a996bf6
--- /dev/null
+++ b/dev-libs/libxml2/files/libxml2-2.9.2-disable-tests.patch
@@ -0,0 +1,68 @@
+do not build test programs as we don't install them
+
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -10,7 +10,7 @@
+ 
+ AM_CFLAGS = $(THREAD_CFLAGS) $(Z_CFLAGS) $(LZMA_CFLAGS)
+ 
+-noinst_PROGRAMS=testSchemas testRelax testSAX testHTML testXPath testURI \
++check_PROGRAMS=testSchemas testRelax testSAX testHTML testXPath testURI \
+                 testThreads testC14N testAutomata testRegexp \
+                 testReader testapi testModule runtest runsuite testchar \
+ 		testdict runxmlconf testrecurse testlimits
+@@ -170,7 +170,7 @@
+ testModule_DEPENDENCIES = $(DEPS)
+ testModule_LDADD= $(LDADDS)
+ 
+-noinst_LTLIBRARIES = testdso.la
++check_LTLIBRARIES = testdso.la
+ testdso_la_SOURCES = testdso.c
+ testdso_la_LDFLAGS = -module -no-undefined -avoid-version -rpath $(libdir)
+ 
+@@ -202,7 +202,7 @@ runxmlconf_LDADD= $(LDADDS)
+ #testOOM_DEPENDENCIES = $(DEPS)
+ #testOOM_LDADD= $(LDADDS)
+ 
+-runtests:
++runtests: check_PROGRAMS
+ 	[ -d test   ] || $(LN_S) $(srcdir)/test   .
+ 	[ -d result ] || $(LN_S) $(srcdir)/result .
+ 	$(CHECKER) ./runtest$(EXEEXT) && $(CHECKER) ./testrecurse$(EXEEXT) &&$(CHECKER) ./testapi$(EXEEXT) && $(CHECKER) ./testchar$(EXEEXT)&& $(CHECKER) ./testdict$(EXEEXT) && $(CHECKER) ./runxmlconf$(EXEEXT)
+--- a/doc/examples/Makefile.am
++++ b/doc/examples/Makefile.am
+@@ -13,7 +13,7 @@
+ rebuild: examples.xml index.html
+ .PHONY: rebuild
+ 
+-examples.xml: index.py $(noinst_PROGRAMS:=.c)
++examples.xml: index.py $(check_PROGRAMS:=.c)
+ 	cd $(srcdir) && $(PYTHON) index.py
+ 	$(MAKE) Makefile
+ 
+@@ -49,7 +49,7 @@
+ 	xpath1.res \
+ 	xpath2.res
+ 
+-noinst_PROGRAMS = \
++check_PROGRAMS = \
+ 	io1 \
+ 	io2 \
+ 	parse1 \
+@@ -99,7 +99,7 @@
+ valgrind: 
+ 	$(MAKE) CHECKER='valgrind' tests
+ 
+-tests: $(noinst_PROGRAMS)
++tests: $(check_PROGRAMS)
+ 	test -f Makefile.am || test -f test1.xml || $(LN_S) $(srcdir)/test?.xml .
+ 	@(echo '## examples regression tests')
+ 	@(echo > .memdump)
+--- a/example/Makefile.am
++++ b/example/Makefile.am
+@@ -1,4 +1,4 @@
+-noinst_PROGRAMS	= gjobread
++check_PROGRAMS	= gjobread
+ 
+ AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir)/include
+ AM_CFLAGS = $(THREAD_CFLAGS) $(Z_CFLAGS)
diff --git a/dev-libs/libxml2/files/libxml2-2.9.2-icu-pkgconfig.patch b/dev-libs/libxml2/files/libxml2-2.9.2-icu-pkgconfig.patch
deleted file mode 100644
index 7a84fac..0000000
--- a/dev-libs/libxml2/files/libxml2-2.9.2-icu-pkgconfig.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-diff --git a/configure.in b/configure.in
-index 7374564..13c8d4e 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -1444,19 +1444,11 @@ XML_LIBTOOLLIBS="libxml2.la"
- AC_SUBST(WITH_ICONV)
- 
- WITH_ICU=0
--ICU_LIBS=""
- if test "$with_icu" != "yes" ; then
-     echo Disabling ICU support
- else
--    ICU_CONFIG=icu-config
--    if ${ICU_CONFIG} --cflags >/dev/null 2>&1
--    then
--        ICU_LIBS=`${ICU_CONFIG} --ldflags`
--        WITH_ICU=1
--        echo Enabling ICU support
--    else
--        AC_MSG_ERROR([libicu config program icu-config not found])
--    fi
-+    PKG_CHECK_MODULES(ICU, icu-i18n)
-+    WITH_ICU=1
- fi
- AC_SUBST(WITH_ICU)
- AC_SUBST(ICU_LIBS)
diff --git a/dev-libs/libxml2/files/libxml2-2.9.2-missing-entities.patch b/dev-libs/libxml2/files/libxml2-2.9.2-missing-entities.patch
deleted file mode 100644
index 7a10e20..0000000
--- a/dev-libs/libxml2/files/libxml2-2.9.2-missing-entities.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 72a46a519ce7326d9a00f0b6a7f2a8e958cd1675 Mon Sep 17 00:00:00 2001
-From: Daniel Veillard <veillard@redhat.com>
-Date: Thu, 23 Oct 2014 11:35:36 +0800
-Subject: [PATCH] Fix missing entities after CVE-2014-3660 fix
-
-For https://bugzilla.gnome.org/show_bug.cgi?id=738805
-
-The fix for CVE-2014-3660 introduced a regression in some case
-where entity substitution is required and the entity is used
-first in anotther entity referenced from an attribute value
----
- parser.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/parser.c b/parser.c
-index 67c9dfd..a8d1b67 100644
---- a/parser.c
-+++ b/parser.c
-@@ -7235,7 +7235,8 @@ xmlParseReference(xmlParserCtxtPtr ctxt) {
-      * far more secure as the parser will only process data coming from
-      * the document entity by default.
-      */
--    if ((ent->checked == 0) &&
-+    if (((ent->checked == 0) ||
-+         ((ent->children == NULL) && (ctxt->options & XML_PARSE_NOENT))) &&
-         ((ent->etype != XML_EXTERNAL_GENERAL_PARSED_ENTITY) ||
-          (ctxt->options & (XML_PARSE_NOENT | XML_PARSE_DTDVALID)))) {
- 	unsigned long oldnbent = ctxt->nbentities;
--- 
-2.3.5
-
diff --git a/dev-libs/libxml2/files/libxml2-2.9.2-python-ABIFLAG.patch b/dev-libs/libxml2/files/libxml2-2.9.2-python-ABIFLAG.patch
new file mode 100644
index 0000000..14dd5bc
--- /dev/null
+++ b/dev-libs/libxml2/files/libxml2-2.9.2-python-ABIFLAG.patch
@@ -0,0 +1,16 @@
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 14ac0a8..f787b12 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -844,7 +844,7 @@ if test "$with_python" != "no" ; then
+     fi
+     if test "$PYTHON" != ""
+     then
+-        PYTHON_VERSION=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_version())"`
++        PYTHON_VERSION=`$PYTHON -c "import sysconfig; print(sysconfig.get_config_var('LDVERSION') or sysconfig.get_config_var('py_version_short'))"`
+ 	PYTHON_INCLUDES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_inc())"`
+ # does not work as it produce a /usr/lib/python path instead of/usr/lib64/python
+ #
diff --git a/dev-libs/libxml2/files/libxml2-2.9.2-revert-missing-initialization.patch b/dev-libs/libxml2/files/libxml2-2.9.2-revert-missing-initialization.patch
deleted file mode 100644
index d98b382..0000000
--- a/dev-libs/libxml2/files/libxml2-2.9.2-revert-missing-initialization.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From f65128f38289d77ff322d63aef2858cc0a819c34 Mon Sep 17 00:00:00 2001
-From: Daniel Veillard <veillard@redhat.com>
-Date: Fri, 17 Oct 2014 17:13:41 +0800
-Subject: Revert "Missing initialization for the catalog module"
-
-This reverts commit 054c716ea1bf001544127a4ab4f4346d1b9947e7.
-As this break xmlcatalog command
-https://bugzilla.redhat.com/show_bug.cgi?id=1153753
-
-diff --git a/parser.c b/parser.c
-index 1d93967..67c9dfd 100644
---- a/parser.c
-+++ b/parser.c
-@@ -14830,9 +14830,6 @@ xmlInitParser(void) {
- #ifdef LIBXML_XPATH_ENABLED
- 	xmlXPathInit();
- #endif
--#ifdef LIBXML_CATALOG_ENABLED
--        xmlInitializeCatalog();
--#endif
- 	xmlParserInitialized = 1;
- #ifdef LIBXML_THREAD_ENABLED
-     }
--- 
-cgit v0.10.1
-
diff --git a/dev-libs/libxml2/files/libxml2-2.9.2-threads-declarations.patch b/dev-libs/libxml2/files/libxml2-2.9.2-threads-declarations.patch
deleted file mode 100644
index 1236f62..0000000
--- a/dev-libs/libxml2/files/libxml2-2.9.2-threads-declarations.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From fff8a6b87e05200a0ad0af6f86c2e859c7de9172 Mon Sep 17 00:00:00 2001
-From: Michael Heimpold <mhei@heimpold.de>
-Date: Mon, 22 Dec 2014 11:12:12 +0800
-Subject: [PATCH] threads: use forward declarations only for glibc
-
-Fixes bug #704908
-
-The declarations of pthread functions, used to generate weak references
-to them, fail to suppress macros. Thus, if any pthread function has
-been provided as a macro, compiling threads.c will fail.
-This breaks on musl libc, which defines pthread_equal as a macro (in
-addition to providing the function, as required).
-
-Prevent the declarations for e.g. musl libc by refining the condition.
-
-The idea for this solution was borrowed from the alpine linux guys, see
-http://git.alpinelinux.org/cgit/aports/tree/main/libxml2/libxml2-pthread.patch
-
-Signed-off-by: Michael Heimpold <mhei@heimpold.de>
----
- threads.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/threads.c b/threads.c
-index 8921204..78006a2 100644
---- a/threads.c
-+++ b/threads.c
-@@ -47,7 +47,7 @@
- #ifdef HAVE_PTHREAD_H
- 
- static int libxml_is_threaded = -1;
--#ifdef __GNUC__
-+#if defined(__GNUC__) && defined(__GLIBC__)
- #ifdef linux
- #if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || (__GNUC__ > 3)
- extern int pthread_once (pthread_once_t *__once_control,
-@@ -89,7 +89,7 @@ extern int pthread_cond_signal ()
- 	   __attribute((weak));
- #endif
- #endif /* linux */
--#endif /* __GNUC__ */
-+#endif /* defined(__GNUC__) && defined(__GLIBC__) */
- #endif /* HAVE_PTHREAD_H */
- 
- /*
--- 
-2.3.5
-
diff --git a/dev-libs/libxml2/files/libxml2-2.9.2-timsort.patch b/dev-libs/libxml2/files/libxml2-2.9.2-timsort.patch
deleted file mode 100644
index c179d47..0000000
--- a/dev-libs/libxml2/files/libxml2-2.9.2-timsort.patch
+++ /dev/null
@@ -1,128 +0,0 @@
-From 9b987f8c98763ee569bde90b5268b43474ca106c Mon Sep 17 00:00:00 2001
-From: Christopher Swenson <chris@caswenson.com>
-Date: Fri, 27 Feb 2015 14:55:49 +0800
-Subject: [PATCH] Fix timsort invariant loop re: Envisage article
-
-See http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm-is-broken-and-how-to-fix-it/
-
-We use a "runLen" array of size 128, so it should be nearly impossible
-to have our implementation overflow.
-
-But in any case, the fix is relatively simple -- checking two extra
-conditions in the invariant calculation.
-
-I also took this opportunity to remove some redundancy in the
-left/right merge logic in the invariant loop.
----
- timsort.h | 74 +++++++++++++++++++++++++++++++++------------------------------
- 1 file changed, 39 insertions(+), 35 deletions(-)
-
-diff --git a/timsort.h b/timsort.h
-index efa3aab..795f272 100644
---- a/timsort.h
-+++ b/timsort.h
-@@ -392,62 +392,66 @@ static void TIM_SORT_MERGE(SORT_TYPE *dst, const TIM_SORT_RUN_T *stack, const in
- 
- static int TIM_SORT_COLLAPSE(SORT_TYPE *dst, TIM_SORT_RUN_T *stack, int stack_curr, TEMP_STORAGE_T *store, const size_t size)
- {
--  while (1)
--  {
--    int64_t A, B, C;
-+  while (1) {
-+    int64_t A, B, C, D;
-+    int ABC, BCD, BD, CD;
-+
-     /* if the stack only has one thing on it, we are done with the collapse */
--    if (stack_curr <= 1) break;
-+    if (stack_curr <= 1) {
-+      break;
-+    }
-+
-     /* if this is the last merge, just do it */
--    if ((stack_curr == 2) &&
--        (stack[0].length + stack[1].length == (int64_t) size))
--    {
-+    if ((stack_curr == 2) && (stack[0].length + stack[1].length == size)) {
-       TIM_SORT_MERGE(dst, stack, stack_curr, store);
-       stack[0].length += stack[1].length;
-       stack_curr--;
-       break;
-     }
-     /* check if the invariant is off for a stack of 2 elements */
--    else if ((stack_curr == 2) && (stack[0].length <= stack[1].length))
--    {
-+    else if ((stack_curr == 2) && (stack[0].length <= stack[1].length)) {
-       TIM_SORT_MERGE(dst, stack, stack_curr, store);
-       stack[0].length += stack[1].length;
-       stack_curr--;
-       break;
--    }
--    else if (stack_curr == 2)
-+    } else if (stack_curr == 2) {
-       break;
-+    }
- 
--    A = stack[stack_curr - 3].length;
--    B = stack[stack_curr - 2].length;
--    C = stack[stack_curr - 1].length;
-+    B = stack[stack_curr - 3].length;
-+    C = stack[stack_curr - 2].length;
-+    D = stack[stack_curr - 1].length;
- 
--    /* check first invariant */
--    if (A <= B + C)
--    {
--      if (A < C)
--      {
--        TIM_SORT_MERGE(dst, stack, stack_curr - 1, store);
--        stack[stack_curr - 3].length += stack[stack_curr - 2].length;
--        stack[stack_curr - 2] = stack[stack_curr - 1];
--        stack_curr--;
--      }
--      else
--      {
--        TIM_SORT_MERGE(dst, stack, stack_curr, store);
--        stack[stack_curr - 2].length += stack[stack_curr - 1].length;
--        stack_curr--;
--      }
-+    if (stack_curr >= 4) {
-+      A = stack[stack_curr - 4].length;
-+      ABC = (A <= B + C);
-+    } else {
-+      ABC = 0;
-     }
--    /* check second invariant */
--    else if (B <= C)
--    {
-+
-+    BCD = (B <= C + D) || ABC;
-+    CD = (C <= D);
-+    BD = (B < D);
-+
-+    /* Both invariants are good */
-+    if (!BCD && !CD) {
-+      break;
-+    }
-+
-+    /* left merge */
-+    if (BCD && !CD) {
-+      TIM_SORT_MERGE(dst, stack, stack_curr - 1, store);
-+      stack[stack_curr - 3].length += stack[stack_curr - 2].length;
-+      stack[stack_curr - 2] = stack[stack_curr - 1];
-+      stack_curr--;
-+    } else {
-+      /* right merge */
-       TIM_SORT_MERGE(dst, stack, stack_curr, store);
-       stack[stack_curr - 2].length += stack[stack_curr - 1].length;
-       stack_curr--;
-     }
--    else
--      break;
-   }
-+
-   return stack_curr;
- }
- 
--- 
-2.3.5
-
diff --git a/dev-libs/libxml2/libxml2-2.9.2-r1.ebuild b/dev-libs/libxml2/libxml2-2.9.4.ebuild
similarity index 77%
rename from dev-libs/libxml2/libxml2-2.9.2-r1.ebuild
rename to dev-libs/libxml2/libxml2-2.9.4.ebuild
index 1802930..75e6b8f 100644
--- a/dev-libs/libxml2/libxml2-2.9.2-r1.ebuild
+++ b/dev-libs/libxml2/libxml2-2.9.4.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-libs/libxml2/libxml2-2.9.2-r1.ebuild,v 1.9 2015/04/28 07:28:58 ago Exp $
+# $Id$
 
-EAPI="5"
-PYTHON_COMPAT=( python{2_7,3_3,3_4} )
+EAPI=5
+PYTHON_COMPAT=( python2_7 python3_{3,4,5} )
 PYTHON_REQ_USE="xml"
 
 inherit libtool flag-o-matic eutils python-r1 autotools prefix multilib-minimal
@@ -29,18 +29,14 @@
 		${XSTS_HOME}/${XSTS_NAME_2}/${XSTS_TARBALL_2}
 		http://www.w3.org/XML/Test/${XMLCONF_TARBALL} )"
 
-COMMON_DEPEND="
+RDEPEND="
 	>=sys-libs/zlib-1.2.8-r1:=[${MULTILIB_USEDEP}]
 	icu? ( >=dev-libs/icu-51.2-r1:=[${MULTILIB_USEDEP}] )
 	lzma? ( >=app-arch/xz-utils-5.0.5-r1:=[${MULTILIB_USEDEP}] )
 	python? ( ${PYTHON_DEPS} )
 	readline? ( sys-libs/readline:= )
 "
-RDEPEND="${COMMON_DEPEND}
-	abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20131008-r6
-		!app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )
-"
-DEPEND="${COMMON_DEPEND}
+DEPEND="${EDEPEND}
 	dev-util/gtk-doc-am
 	virtual/pkgconfig
 	hppa? ( >=sys-devel/binutils-2.15.92.0.2 )
@@ -68,33 +64,37 @@
 }
 
 src_prepare() {
+	default
+
 	DOCS=( AUTHORS ChangeLog NEWS README* TODO* )
 
 	# Patches needed for prefix support
-	epatch "${FILESDIR}"/${PN}-2.7.1-catalog_path.patch
-	epatch "${FILESDIR}"/${PN}-2.8.0_rc1-winnt.patch
+	eapply "${FILESDIR}"/${PN}-2.7.1-catalog_path.patch
 
 	eprefixify catalog.c xmlcatalog.c runtest.c xmllint.c
 
-#	epunt_cxx # if we don't eautoreconf
+	# Fix build for Windows platform
+	# https://bugzilla.gnome.org/show_bug.cgi?id=760456
+	eapply "${FILESDIR}"/${PN}-2.8.0_rc1-winnt.patch
 
-	epatch "${FILESDIR}"/${PN}-2.9.2-cross-compile.patch
+	# Disable programs that we don't actually install.
+	# https://bugzilla.gnome.org/show_bug.cgi?id=760457
+	eapply "${FILESDIR}"/${PN}-2.9.2-disable-tests.patch
 
-	# Important patches from master
-	epatch \
-		"${FILESDIR}/${PN}-2.9.2-revert-missing-initialization.patch" \
-		"${FILESDIR}/${PN}-2.9.2-missing-entities.patch" \
-		"${FILESDIR}/${PN}-2.9.2-threads-declarations.patch" \
-		"${FILESDIR}/${PN}-2.9.2-timsort.patch" \
-		"${FILESDIR}/${PN}-2.9.2-constant-memory.patch"
+	# Fix python detection, bug #567066
+	# https://bugzilla.gnome.org/show_bug.cgi?id=760458
+	eapply "${FILESDIR}"/${PN}-2.9.2-python-ABIFLAG.patch
+
+	# Avoid final linking arguments for python modules
+	if [[ ${CHOST} == *-darwin* ]] ; then
+		sed -i -e '/PYTHON_LIBS/s/ldflags/libs/' configure.ac || die
+	fi
 
 	# Please do not remove, as else we get references to PORTAGE_TMPDIR
 	# in /usr/lib/python?.?/site-packages/libxml2mod.la among things.
 	# We now need to run eautoreconf at the end to prevent maintainer mode.
 #	elibtoolize
-
-	# Use pkgconfig to find icu to properly support multilib, upstream bug #738751
-	epatch "${FILESDIR}/${PN}-2.9.2-icu-pkgconfig.patch"
+#	epunt_cxx # if we don't eautoreconf
 
 	eautoreconf
 }
@@ -115,7 +115,6 @@
 	libxml2_configure() {
 		ECONF_SOURCE="${S}" econf \
 			--with-html-subdir=${PF}/html \
-			--docdir="${EPREFIX}/usr/share/doc/${PF}" \
 			$(use_with debug run-debug) \
 			$(use_with icu) \
 			$(use_with lzma) \
@@ -128,7 +127,7 @@
 
 	libxml2_py_configure() {
 		mkdir -p "${BUILD_DIR}" || die # ensure python build dirs exist
-		run_in_build_dir libxml2_configure "--with-python=${PYTHON}" # odd build system
+		run_in_build_dir libxml2_configure "--with-python=${ROOT%/}${PYTHON}" # odd build system, also see bug #582130
 	}
 
 	libxml2_configure --without-python # build python bindings separately
@@ -156,7 +155,11 @@
 		EXAMPLES_DIR="${EPREFIX}"/usr/share/doc/${PF}/examples install
 
 	if multilib_is_native_abi && use python; then
-		python_foreach_impl libxml2_py_emake DESTDIR="${D}" install
+		python_foreach_impl libxml2_py_emake \
+			DESTDIR="${D}" \
+			docsdir="${EPREFIX}"/usr/share/doc/${PF}/python \
+			exampledir="${EPREFIX}"/usr/share/doc/${PF}/python/examples \
+			install
 		python_foreach_impl python_optimize
 	fi
 }
@@ -174,14 +177,9 @@
 	rm -rf "${ED}"/usr/share/doc/${P}
 	einstalldocs
 
-	if ! use python; then
-		rm -rf "${ED}"/usr/share/doc/${PF}/python
-		rm -rf "${ED}"/usr/share/doc/${PN}-python-${PV}
-	fi
-
 	if ! use examples; then
-		rm -rf "${ED}/usr/share/doc/${PF}/examples"
-		rm -rf "${ED}/usr/share/doc/${PF}/python/examples"
+		rm -rf "${ED}"/usr/share/doc/${PF}/examples
+		rm -rf "${ED}"/usr/share/doc/${PF}/python/examples
 	fi
 
 	prune_libtool_files --modules