From 20dc69db114b0179ccaf8e79a2d3e0b3df1fb000 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Wed, 7 Nov 2012 08:54:37 -0800 Subject: [PATCH] fix perl --- SAX2.c | 52 +----------- packaging/baselibs.conf | 2 +- packaging/bigendian64.patch | 18 ---- packaging/fix-perl.diff | 187 ++++++++++++++++++++---------------------- packaging/libxml2.spec | 153 ++++++++++++++++++++++++++++++++++ packaging/python-libxml2.spec | 66 +++++++++++++++ result/namespaces/err_7.xml | 2 +- result/xmlid/id_tst2.xml | 2 +- result/xmlid/id_tst3.xml | 2 +- 9 files changed, 313 insertions(+), 171 deletions(-) delete mode 100644 packaging/bigendian64.patch create mode 100644 packaging/libxml2.spec create mode 100644 packaging/python-libxml2.spec diff --git a/SAX2.c b/SAX2.c index 126a79f..c5676b3 100644 --- a/SAX2.c +++ b/SAX2.c @@ -2162,7 +2162,6 @@ xmlSAX2StartElementNs(void *ctx, xmlNodePtr parent; xmlNsPtr last = NULL, ns; const xmlChar *uri, *pref; - xmlChar *lname = NULL; int i, j; if (ctx == NULL) return; @@ -2182,20 +2181,6 @@ xmlSAX2StartElementNs(void *ctx, } /* - * Take care of the rare case of an undefined namespace prefix - */ - if ((prefix != NULL) && (URI == NULL)) { - if (ctxt->dictNames) { - const xmlChar *fullname; - - fullname = xmlDictQLookup(ctxt->dict, prefix, localname); - if (fullname != NULL) - localname = fullname; - } else { - lname = xmlBuildQName(localname, prefix, NULL, 0); - } - } - /* * allocate the node */ if (ctxt->freeElems != NULL) { @@ -2208,10 +2193,7 @@ xmlSAX2StartElementNs(void *ctx, if (ctxt->dictNames) ret->name = localname; else { - if (lname == NULL) - ret->name = xmlStrdup(localname); - else - ret->name = lname; + ret->name = xmlStrdup(localname); if (ret->name == NULL) { xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs"); return; @@ -2223,11 +2205,8 @@ xmlSAX2StartElementNs(void *ctx, if (ctxt->dictNames) ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, (xmlChar *) localname, NULL); - else if (lname == NULL) - ret = xmlNewDocNode(ctxt->myDoc, NULL, localname, NULL); else - ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, - (xmlChar *) lname, NULL); + ret = xmlNewDocNode(ctxt->myDoc, NULL, localname, NULL); if (ret == NULL) { xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs"); return; @@ -2334,33 +2313,8 @@ xmlSAX2StartElementNs(void *ctx, */ if (nb_attributes > 0) { for (j = 0,i = 0;i < nb_attributes;i++,j+=5) { - /* - * Handle the rare case of an undefined atribute prefix - */ - if ((attributes[j+1] != NULL) && (attributes[j+2] == NULL)) { - if (ctxt->dictNames) { - const xmlChar *fullname; - - fullname = xmlDictQLookup(ctxt->dict, attributes[j+1], - attributes[j]); - if (fullname != NULL) { - xmlSAX2AttributeNs(ctxt, fullname, NULL, - attributes[j+3], attributes[j+4]); - continue; - } - } else { - lname = xmlBuildQName(attributes[j], attributes[j+1], - NULL, 0); - if (lname != NULL) { - xmlSAX2AttributeNs(ctxt, lname, NULL, - attributes[j+3], attributes[j+4]); - xmlFree(lname); - continue; - } - } - } xmlSAX2AttributeNs(ctxt, attributes[j], attributes[j+1], - attributes[j+3], attributes[j+4]); + attributes[j+3], attributes[j+4]); } } diff --git a/packaging/baselibs.conf b/packaging/baselibs.conf index f52b372..92f3e74 100644 --- a/packaging/baselibs.conf +++ b/packaging/baselibs.conf @@ -1,4 +1,4 @@ -libxml2 +libxml2-2 libxml2-devel requires -libxml2- requires "libxml2-2- = " diff --git a/packaging/bigendian64.patch b/packaging/bigendian64.patch deleted file mode 100644 index e25075d..0000000 --- a/packaging/bigendian64.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- xzlib.c.xx 2012-03-01 17:23:54.000000000 +0000 -+++ xzlib.c 2012-03-01 17:24:48.000000000 +0000 -@@ -228,9 +228,14 @@ - if (state->err != LZMA_OK) - return -1; - if (state->eof == 0) { -+ /* avail_in is size_t, which is not necessary sizeof(unsigned) */ -+ unsigned tmp = strm->avail_in; - if (xz_load(state, state->in, state->size, -- (unsigned *) &(strm->avail_in)) == -1) -+ &tmp) == -1) { -+ strm->avail_in = tmp; - return -1; -+ } -+ strm->avail_in = tmp; - strm->next_in = state->in; - } - return 0; diff --git a/packaging/fix-perl.diff b/packaging/fix-perl.diff index c1997d6..600b259 100644 --- a/packaging/fix-perl.diff +++ b/packaging/fix-perl.diff @@ -9,141 +9,128 @@ Date: Thu Jan 26 19:11:02 2012 +0800 Also fix 3 cases in the regression tests where the prefix: was erroneously dropped in such case -diff --git a/SAX2.c b/SAX2.c -index c0482c0..0c48d65 100644 ---- a/SAX2.c -+++ b/SAX2.c -@@ -2163,6 +2163,7 @@ xmlSAX2StartElementNs(void *ctx, +Index: SAX2.c +=================================================================== +--- SAX2.c.orig ++++ SAX2.c +@@ -2162,7 +2162,6 @@ xmlSAX2StartElementNs(void *ctx, xmlNodePtr parent; xmlNsPtr last = NULL, ns; const xmlChar *uri, *pref; -+ xmlChar *lname = NULL; +- xmlChar *lname = NULL; int i, j; if (ctx == NULL) return; -@@ -2182,6 +2183,20 @@ xmlSAX2StartElementNs(void *ctx, +@@ -2182,20 +2181,6 @@ xmlSAX2StartElementNs(void *ctx, } /* -+ * Take care of the rare case of an undefined namespace prefix -+ */ -+ if ((prefix != NULL) && (URI == NULL)) { -+ if (ctxt->dictNames) { -+ const xmlChar *fullname; -+ -+ fullname = xmlDictQLookup(ctxt->dict, prefix, localname); -+ if (fullname != NULL) -+ localname = fullname; -+ } else { -+ lname = xmlBuildQName(localname, prefix, NULL, 0); -+ } -+ } -+ /* +- * Take care of the rare case of an undefined namespace prefix +- */ +- if ((prefix != NULL) && (URI == NULL)) { +- if (ctxt->dictNames) { +- const xmlChar *fullname; +- +- fullname = xmlDictQLookup(ctxt->dict, prefix, localname); +- if (fullname != NULL) +- localname = fullname; +- } else { +- lname = xmlBuildQName(localname, prefix, NULL, 0); +- } +- } +- /* * allocate the node */ if (ctxt->freeElems != NULL) { -@@ -2194,7 +2209,10 @@ xmlSAX2StartElementNs(void *ctx, +@@ -2208,10 +2193,7 @@ xmlSAX2StartElementNs(void *ctx, if (ctxt->dictNames) ret->name = localname; else { -- ret->name = xmlStrdup(localname); -+ if (lname == NULL) -+ ret->name = xmlStrdup(localname); -+ else -+ ret->name = lname; +- if (lname == NULL) +- ret->name = xmlStrdup(localname); +- else +- ret->name = lname; ++ ret->name = xmlStrdup(localname); if (ret->name == NULL) { xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs"); return; -@@ -2206,8 +2224,11 @@ xmlSAX2StartElementNs(void *ctx, +@@ -2223,11 +2205,8 @@ xmlSAX2StartElementNs(void *ctx, if (ctxt->dictNames) ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, (xmlChar *) localname, NULL); -- else -+ else if (lname == NULL) - ret = xmlNewDocNode(ctxt->myDoc, NULL, localname, NULL); -+ else -+ ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, -+ (xmlChar *) lname, NULL); +- else if (lname == NULL) +- ret = xmlNewDocNode(ctxt->myDoc, NULL, localname, NULL); + else +- ret = xmlNewDocNodeEatName(ctxt->myDoc, NULL, +- (xmlChar *) lname, NULL); ++ ret = xmlNewDocNode(ctxt->myDoc, NULL, localname, NULL); if (ret == NULL) { xmlSAX2ErrMemory(ctxt, "xmlSAX2StartElementNs"); return; -diff --git a/result/namespaces/err_7.xml b/result/namespaces/err_7.xml -index f4e5164..4b4c662 100644 ---- a/result/namespaces/err_7.xml -+++ b/result/namespaces/err_7.xml +@@ -2334,33 +2313,8 @@ xmlSAX2StartElementNs(void *ctx, + */ + if (nb_attributes > 0) { + for (j = 0,i = 0;i < nb_attributes;i++,j+=5) { +- /* +- * Handle the rare case of an undefined atribute prefix +- */ +- if ((attributes[j+1] != NULL) && (attributes[j+2] == NULL)) { +- if (ctxt->dictNames) { +- const xmlChar *fullname; +- +- fullname = xmlDictQLookup(ctxt->dict, attributes[j+1], +- attributes[j]); +- if (fullname != NULL) { +- xmlSAX2AttributeNs(ctxt, fullname, NULL, +- attributes[j+3], attributes[j+4]); +- continue; +- } +- } else { +- lname = xmlBuildQName(attributes[j], attributes[j+1], +- NULL, 0); +- if (lname != NULL) { +- xmlSAX2AttributeNs(ctxt, lname, NULL, +- attributes[j+3], attributes[j+4]); +- xmlFree(lname); +- continue; +- } +- } +- } + xmlSAX2AttributeNs(ctxt, attributes[j], attributes[j+1], +- attributes[j+3], attributes[j+4]); ++ attributes[j+3], attributes[j+4]); + } + } + +Index: result/namespaces/err_7.xml +=================================================================== +--- result/namespaces/err_7.xml.orig ++++ result/namespaces/err_7.xml @@ -1,2 +1,2 @@ -- -+ -diff --git a/result/xmlid/id_tst2.xml b/result/xmlid/id_tst2.xml -index 33ee896..856a320 100644 ---- a/result/xmlid/id_tst2.xml -+++ b/result/xmlid/id_tst2.xml +- ++ +Index: result/xmlid/id_tst2.xml +=================================================================== +--- result/xmlid/id_tst2.xml.orig ++++ result/xmlid/id_tst2.xml @@ -1,6 +1,6 @@ Object is a Node Set : Set contains 1 nodes: --1 ELEMENT foo -+1 ELEMENT n:foo +-1 ELEMENT n:foo ++1 ELEMENT foo ATTRIBUTE id TEXT content=bar -diff --git a/result/xmlid/id_tst3.xml b/result/xmlid/id_tst3.xml -index e2f8228..6d8865c 100644 ---- a/result/xmlid/id_tst3.xml -+++ b/result/xmlid/id_tst3.xml +Index: result/xmlid/id_tst3.xml +=================================================================== +--- result/xmlid/id_tst3.xml.orig ++++ result/xmlid/id_tst3.xml @@ -1,6 +1,6 @@ Object is a Node Set : Set contains 1 nodes: --1 ELEMENT o:o -+1 ELEMENT f:o:o +-1 ELEMENT f:o:o ++1 ELEMENT o:o ATTRIBUTE id TEXT content=bar -commit 1c989278d9650daafc79e55750bec5a5a224a553 -Author: Daniel Veillard -Date: Thu Jan 26 19:43:06 2012 +0800 - - Fix SAX2 builder in case of undefined attributes namespace - - To follow the early XML-1.0 REC, the new localname is "prefix:localname" - and there is obviously now namespace. - -diff --git a/SAX2.c b/SAX2.c -index 0c48d65..e230cea 100644 ---- a/SAX2.c -+++ b/SAX2.c -@@ -2335,8 +2335,33 @@ xmlSAX2StartElementNs(void *ctx, - */ - if (nb_attributes > 0) { - for (j = 0,i = 0;i < nb_attributes;i++,j+=5) { -+ /* -+ * Handle the rare case of an undefined atribute prefix -+ */ -+ if ((attributes[j+1] != NULL) && (attributes[j+2] == NULL)) { -+ if (ctxt->dictNames) { -+ const xmlChar *fullname; -+ -+ fullname = xmlDictQLookup(ctxt->dict, attributes[j+1], -+ attributes[j]); -+ if (fullname != NULL) { -+ xmlSAX2AttributeNs(ctxt, fullname, NULL, -+ attributes[j+3], attributes[j+4]); -+ continue; -+ } -+ } else { -+ lname = xmlBuildQName(attributes[j], attributes[j+1], -+ NULL, 0); -+ if (lname != NULL) { -+ xmlSAX2AttributeNs(ctxt, lname, NULL, -+ attributes[j+3], attributes[j+4]); -+ xmlFree(lname); -+ continue; -+ } -+ } -+ } - xmlSAX2AttributeNs(ctxt, attributes[j], attributes[j+1], -- attributes[j+3], attributes[j+4]); -+ attributes[j+3], attributes[j+4]); - } - } - diff --git a/packaging/libxml2.spec b/packaging/libxml2.spec new file mode 100644 index 0000000..ea441b8 --- /dev/null +++ b/packaging/libxml2.spec @@ -0,0 +1,153 @@ +%define lname libxml2 + +Name: libxml2 +Version: 2.8.0 +Release: 0 +Summary: A Library to Manipulate XML Files +License: MIT +Group: System/Libraries +Url: http://xmlsoft.org +# Source ftp://xmlsoft.org/libxml2/libxml2-git-snapshot.tar.gz changes every day +Source: ftp://xmlsoft.org/libxml2/%{name}-%{version}.tar.gz +Source2: baselibs.conf +Patch0: fix-perl.diff +BuildRequires: pkg-config +BuildRequires: readline-devel +BuildRequires: xz-devel +BuildRequires: zlib-devel + +%description +The XML C library was initially developed for the GNOME project. It is +now used by many programs to load and save extensible data structures +or manipulate any kind of XML files. + +This library implements a number of existing standards related to +markup languages, including the XML standard, name spaces in XML, XML +Base, RFC 2396, XPath, XPointer, HTML4, XInclude, SGML catalogs, and +XML catalogs. In most cases, libxml tries to implement the +specification in a rather strict way. To some extent, it provides +support for the following specifications, but does not claim to +implement them: DOM, FTP client, HTTP client, and SAX. + +The library also supports RelaxNG. Support for W3C XML Schemas is in +progress. + + +%package tools +Summary: Tools using libxml +Group: System/Libraries + +%description tools +This package contains xmllint, a very useful tool proving libxml's power. + +%package devel +Summary: Include Files and Libraries mandatory for Development +Group: Development/Libraries/C and C++ +Requires: %{lname} = %{version} +Requires: %{name}-tools = %{version} +Requires: glibc-devel +Requires: readline-devel +Requires: xz-devel +Requires: zlib-devel + +%description devel +This package contains all necessary include files and libraries needed +to develop applications that require these. + +%package doc +Summary: A Library to Manipulate XML Files +Group: System/Libraries +Requires: %{lname} = %{version} +BuildArch: noarch + +%description doc +The XML C library was initially developed for the GNOME project. It is +now used by many programs to load and save extensible data structures +or manipulate any kind of XML files. + +This library implements a number of existing standards related to +markup languages, including the XML standard, name spaces in XML, XML +Base, RFC 2396, XPath, XPointer, HTML4, XInclude, SGML catalogs, and +XML catalogs. In most cases, libxml tries to implement the +specification in a rather strict way. To some extent, it provides +support for the following specifications, but does not claim to +implement them: DOM, FTP client, HTTP client, and SAX. + +The library also supports RelaxNG. Support for W3C XML Schemas is in +progress. + +%prep +%setup -q +%patch0 + +%build +%configure --disable-static \ + --docdir=%_docdir/%name \ + --with-html-dir=%_docdir/%name/html \ + --with-fexceptions \ + --with-history \ + --without-python \ + --enable-ipv6 \ + --with-sax1 \ + --with-regexps \ + --with-threads \ + --with-reader \ + --with-http + +make %{?_smp_mflags} BASE_DIR="%_docdir" DOC_MODULE="%name" + +%check +# qemu-arm can't keep up atm, disabling check for arm +%ifnarch %arm +make check +%endif + +%install +make install DESTDIR="%buildroot" BASE_DIR="%_docdir" DOC_MODULE="%name" +mkdir -p "%buildroot/%_docdir/%name" +cp -a AUTHORS NEWS README COPYING* Copyright TODO* %{buildroot}%{_docdir}/%{name}/ +ln -s libxml2/libxml %{buildroot}%{_includedir}/libxml + + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%defattr(-, root, root) +%{_libdir}/lib*.so.* +%doc %dir %{_docdir}/%{name} +%doc %{_docdir}/%{name}/[ANRCT]* + +%files tools +%defattr(-, root, root) +%{_bindir}/xmllint +%{_bindir}/xmlcatalog +%doc %{_mandir}/man1/xmllint.1* +%doc %{_mandir}/man1/xmlcatalog.1* + +%files devel +%defattr(-, root, root) +%{_bindir}/xml2-config +%dir %{_datadir}/aclocal +%{_datadir}/aclocal/libxml.m4 +%{_includedir}/libxml +%{_includedir}/libxml2 +%{_libdir}/lib*.so +# libxml2.la is needed for the python-libxml2 build. Deleting it breaks build of python-libxml2. +%{_libdir}/libxml2.la +%{_libdir}/*.sh +%{_libdir}/pkgconfig/*.pc +%doc %{_mandir}/man1/xml2-config.1* +%doc %{_mandir}/man3/libxml.3* + +%files doc +%defattr(-, root, root) +%{_datadir}/gtk-doc/html/* +%doc %{_docdir}/%{name}/examples +%doc %{_docdir}/%{name}/html +# owning these directories prevents gtk-doc <-> libxml2 build loop: +%dir %{_datadir}/gtk-doc +%dir %{_datadir}/gtk-doc/html + +%changelog diff --git a/packaging/python-libxml2.spec b/packaging/python-libxml2.spec new file mode 100644 index 0000000..2dc7dec --- /dev/null +++ b/packaging/python-libxml2.spec @@ -0,0 +1,66 @@ +Name: python-libxml2 +Version: 2.8.0 +Release: 0 +Summary: Python Bindings for libxml2 +License: MIT +Group: Development/Libraries/Python +Url: http://xmlsoft.org +Source: ftp://xmlsoft.org/libxml2/libxml2-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-build +BuildRequires: libxml2-devel +BuildRequires: python-devel +BuildRequires: python-xml +Requires: libxml2-2 = %{version} +Obsoletes: libxml2-python < %{version} +Provides: libxml2-python = %{version} + +%description +The libxml2-python package contains a module that permits applications +written in the Python programming language to use the interface +supplied by the libxml2 library to manipulate XML files. + +This library allows manipulation of XML files. It includes support for +reading, modifying, and writing XML and HTML files. There is DTD +support that includes parsing and validation even with complex DTDs, +either at parse time or later once the document has been modified. + +%prep +%setup -q -n libxml2-%{version} + +%build +export CFLAGS="%{optflags} -fno-strict-aliasing" +%configure \ + --with-fexceptions \ + --with-history \ + --enable-ipv6 \ + --with-sax1 \ + --with-regexps \ + --with-threads \ + --with-reader \ + --with-http + +# use libxml2 as built by libxml2 source package +mkdir .libs +cp -v %{_libdir}/libxml2.la . +make -C python %{?_smp_mflags} + +%install +make -C python install \ + DESTDIR=%{buildroot} \ + pythondir=%{py_sitedir} \ + PYTHON_SITE_PACKAGES=%{py_sitedir} +chmod a-x python/tests/*.py +# Unwanted doc stuff +rm -fr %{buildroot}%{_datadir}/doc +rm -f python/tests/Makefile* +# #223696 +rm -f %{buildroot}%{py_sitedir}/*.{la,a} + +%files +%defattr(-, root, root) +%doc python/TODO +%doc python/libxml2class.txt +%doc python/tests +%{py_sitedir}/* + +%changelog diff --git a/result/namespaces/err_7.xml b/result/namespaces/err_7.xml index 4b4c662..f4e5164 100644 --- a/result/namespaces/err_7.xml +++ b/result/namespaces/err_7.xml @@ -1,2 +1,2 @@ - + diff --git a/result/xmlid/id_tst2.xml b/result/xmlid/id_tst2.xml index 856a320..33ee896 100644 --- a/result/xmlid/id_tst2.xml +++ b/result/xmlid/id_tst2.xml @@ -1,6 +1,6 @@ Object is a Node Set : Set contains 1 nodes: -1 ELEMENT n:foo +1 ELEMENT foo ATTRIBUTE id TEXT content=bar diff --git a/result/xmlid/id_tst3.xml b/result/xmlid/id_tst3.xml index 6d8865c..e2f8228 100644 --- a/result/xmlid/id_tst3.xml +++ b/result/xmlid/id_tst3.xml @@ -1,6 +1,6 @@ Object is a Node Set : Set contains 1 nodes: -1 ELEMENT f:o:o +1 ELEMENT o:o ATTRIBUTE id TEXT content=bar -- 2.7.4