add files

This commit is contained in:
Mahno 2025-02-04 18:54:19 +08:00
commit bb584da0c1
9 changed files with 2074 additions and 0 deletions

7
baselibs.conf Normal file
View File

@ -0,0 +1,7 @@
libxslt1
obsoletes "libxslt-<targettype>"
libxslt-devel
requires -libxslt-<targettype>
requires "libxslt1-<targettype> = <version>"
obsoletes "libxslt-devel-<targettype> < <version>"
provides "libxslt-devel-<targettype> = <version>"

View File

@ -0,0 +1,11 @@
--- a/xsltproc/xsltproc.c
+++ b/xsltproc/xsltproc.c
@@ -544,7 +544,7 @@
sec = xsltNewSecurityPrefs();
xsltSetDefaultSecurityPrefs(sec);
- defaultEntityLoader = xmlGetExternalEntityLoader();
+ defaultEntityLoader = getenv("RPM_PACKAGE_NAME") ? xmlNoNetExternalEntityLoader : xmlGetExternalEntityLoader();
xmlSetExternalEntityLoader(xsltprocExternalEntityLoader);
for (i = 1; i < argc; i++) {

BIN
libxslt-1.1.42.tar.xz Normal file

Binary file not shown.

44
libxslt-random-seed.patch Normal file
View File

@ -0,0 +1,44 @@
commit 047a0fd99e64c554c4edf44cc67ee765b09af017
Author: Marcus Meissner <meissner@suse.de>
Date: Tue Apr 4 16:27:39 2017 +0200
initialize the random seed
Index: libxslt-v1.1.36/libexslt/math.c
===================================================================
--- libxslt-v1.1.36.orig/libexslt/math.c
+++ libxslt-v1.1.36/libexslt/math.c
@@ -12,6 +12,12 @@
#include <math.h>
#include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <fcntl.h>
+#include <time.h>
+
#include "exslt.h"
/**
@@ -460,6 +468,20 @@ static double
exsltMathRandom (void) {
double ret;
int num;
+ long seed;
+ static int randinit = 0;
+
+ if (!randinit) {
+ int fd = open("/dev/urandom",O_RDONLY);
+
+ seed = time(NULL); /* just in case /dev/urandom is not there */
+ if (fd != -1) {
+ read (fd, &seed, sizeof(seed));
+ close (fd);
+ }
+ srand(seed);
+ randinit = 1;
+ }
num = rand();
ret = (double)num / (double)RAND_MAX;

View File

@ -0,0 +1,75 @@
https://gitlab.gnome.org/GNOME/libxslt/-/issues/123
From c45ed81aeb50a7fb6799a166270d6ccc9ffa63b2 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Thu, 19 Sep 2024 21:49:46 +0200
Subject: [PATCH] variables: Fix non-deterministic generated IDs
Evaluate global variables in deterministic order. Otherwise, generated
IDs could be non-deterministic if generate-id() is called.
Fixes #123.
---
libxslt/variables.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)
diff --git a/libxslt/variables.c b/libxslt/variables.c
index 93cb0747..09069aa3 100644
--- a/libxslt/variables.c
+++ b/libxslt/variables.c
@@ -1259,13 +1259,6 @@ error:
return(result);
}
-static void
-xsltEvalGlobalVariableWrapper(void *payload, void *data,
- const xmlChar *name ATTRIBUTE_UNUSED) {
- xsltEvalGlobalVariable((xsltStackElemPtr) payload,
- (xsltTransformContextPtr) data);
-}
-
/**
* xsltEvalGlobalVariables:
* @ctxt: the XSLT transformation context
@@ -1278,6 +1271,7 @@ xsltEvalGlobalVariableWrapper(void *payload, void *data,
int
xsltEvalGlobalVariables(xsltTransformContextPtr ctxt) {
xsltStackElemPtr elem;
+ xsltStackElemPtr head = NULL;
xsltStylesheetPtr style;
if ((ctxt == NULL) || (ctxt->document == NULL))
@@ -1321,6 +1315,8 @@ xsltEvalGlobalVariables(xsltTransformContextPtr ctxt) {
xsltFreeStackElem(def);
return(-1);
}
+ def->next = head;
+ head = def;
} else if ((elem->comp != NULL) &&
(elem->comp->type == XSLT_FUNC_VARIABLE)) {
/*
@@ -1343,9 +1339,19 @@ xsltEvalGlobalVariables(xsltTransformContextPtr ctxt) {
}
/*
- * This part does the actual evaluation
+ * This part does the actual evaluation. Note that scanning the hash
+ * table would result in a non-deterministic order, leading to
+ * non-deterministic generated IDs.
*/
- xmlHashScan(ctxt->globalVars, xsltEvalGlobalVariableWrapper, ctxt);
+ elem = head;
+ while (elem != NULL) {
+ xsltStackElemPtr next;
+
+ xsltEvalGlobalVariable(elem, ctxt);
+ next = elem->next;
+ elem->next = NULL;
+ elem = next;
+ }
return(0);
}
--
GitLab

View File

@ -0,0 +1,275 @@
From bf59c338121b8b45d66ba6ecea69ad498015c396 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Tue, 12 Nov 2024 13:28:55 +0100
Subject: [PATCH] tests: Make runtest compile with older libxml2 versions
This partly reverts commit ce3ad4f93c7637a454ad7db501158110a0813f05.
Fixes #125.
---
tests/runtest.c | 244 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 244 insertions(+)
diff --git a/tests/runtest.c b/tests/runtest.c
index be6ccb0e..7360615d 100644
--- a/tests/runtest.c
+++ b/tests/runtest.c
@@ -190,11 +190,255 @@ testErrorHandler(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
testErrors[testErrorsSize] = 0;
}
+#if LIBXML_VERSION < 21300
+
+/**
+ * xmlParserPrintFileContext:
+ * @input: an xmlParserInputPtr input
+ *
+ * Displays current context within the input content for error tracking
+ */
+
+static void
+xmlParserPrintFileContextInternal(xmlParserInputPtr input ,
+ xmlGenericErrorFunc chanl, void *data ) {
+ const xmlChar *cur, *base;
+ unsigned int n, col; /* GCC warns if signed, because compared with sizeof() */
+ xmlChar content[81]; /* space for 80 chars + line terminator */
+ xmlChar *ctnt;
+
+ if (input == NULL) return;
+ cur = input->cur;
+ base = input->base;
+ /* skip backwards over any end-of-lines */
+ while ((cur > base) && ((*(cur) == '\n') || (*(cur) == '\r'))) {
+ cur--;
+ }
+ n = 0;
+ /* search backwards for beginning-of-line (to max buff size) */
+ while ((n++ < (sizeof(content)-1)) && (cur > base) &&
+ (*(cur) != '\n') && (*(cur) != '\r'))
+ cur--;
+ if ((*(cur) == '\n') || (*(cur) == '\r')) cur++;
+ /* calculate the error position in terms of the current position */
+ col = input->cur - cur;
+ /* search forward for end-of-line (to max buff size) */
+ n = 0;
+ ctnt = content;
+ /* copy selected text to our buffer */
+ while ((*cur != 0) && (*(cur) != '\n') &&
+ (*(cur) != '\r') && (n < sizeof(content)-1)) {
+ *ctnt++ = *cur++;
+ n++;
+ }
+ *ctnt = 0;
+ /* print out the selected text */
+ chanl(data ,"%s\n", content);
+ /* create blank line with problem pointer */
+ n = 0;
+ ctnt = content;
+ /* (leave buffer space for pointer + line terminator) */
+ while ((n<col) && (n++ < sizeof(content)-2) && (*ctnt != 0)) {
+ if (*(ctnt) != '\t')
+ *(ctnt) = ' ';
+ ctnt++;
+ }
+ *ctnt++ = '^';
+ *ctnt = 0;
+ chanl(data ,"%s\n", content);
+}
+
+static void
+testStructuredErrorHandler(void *ctx ATTRIBUTE_UNUSED, const xmlError *err) {
+ char *file = NULL;
+ int line = 0;
+ int code = -1;
+ int domain;
+ void *data = NULL;
+ const char *str;
+ const xmlChar *name = NULL;
+ xmlNodePtr node;
+ xmlErrorLevel level;
+ xmlParserInputPtr input = NULL;
+ xmlParserInputPtr cur = NULL;
+ xmlParserCtxtPtr ctxt = NULL;
+
+ if (err == NULL)
+ return;
+
+ file = err->file;
+ line = err->line;
+ code = err->code;
+ domain = err->domain;
+ level = err->level;
+ node = err->node;
+ if ((domain == XML_FROM_PARSER) || (domain == XML_FROM_HTML) ||
+ (domain == XML_FROM_DTD) || (domain == XML_FROM_NAMESPACE) ||
+ (domain == XML_FROM_IO) || (domain == XML_FROM_VALID)) {
+ ctxt = err->ctxt;
+ }
+ str = err->message;
+
+ if (code == XML_ERR_OK)
+ return;
+
+ if ((node != NULL) && (node->type == XML_ELEMENT_NODE))
+ name = node->name;
+
+ /*
+ * Maintain the compatibility with the legacy error handling
+ */
+ if (ctxt != NULL) {
+ input = ctxt->input;
+ if ((input != NULL) && (input->filename == NULL) &&
+ (ctxt->inputNr > 1)) {
+ cur = input;
+ input = ctxt->inputTab[ctxt->inputNr - 2];
+ }
+ if (input != NULL) {
+ if (input->filename)
+ testErrorHandler(data, "%s:%d: ", input->filename, input->line);
+ else if ((line != 0) && (domain == XML_FROM_PARSER))
+ testErrorHandler(data, "Entity: line %d: ", input->line);
+ }
+ } else {
+ if (file != NULL)
+ testErrorHandler(data, "%s:%d: ", file, line);
+ else if ((line != 0) && (domain == XML_FROM_PARSER))
+ testErrorHandler(data, "Entity: line %d: ", line);
+ }
+ if (name != NULL) {
+ testErrorHandler(data, "element %s: ", name);
+ }
+ if (code == XML_ERR_OK)
+ return;
+ switch (domain) {
+ case XML_FROM_PARSER:
+ testErrorHandler(data, "parser ");
+ break;
+ case XML_FROM_NAMESPACE:
+ testErrorHandler(data, "namespace ");
+ break;
+ case XML_FROM_DTD:
+ case XML_FROM_VALID:
+ testErrorHandler(data, "validity ");
+ break;
+ case XML_FROM_HTML:
+ testErrorHandler(data, "HTML parser ");
+ break;
+ case XML_FROM_MEMORY:
+ testErrorHandler(data, "memory ");
+ break;
+ case XML_FROM_OUTPUT:
+ testErrorHandler(data, "output ");
+ break;
+ case XML_FROM_IO:
+ testErrorHandler(data, "I/O ");
+ break;
+ case XML_FROM_XINCLUDE:
+ testErrorHandler(data, "XInclude ");
+ break;
+ case XML_FROM_XPATH:
+ testErrorHandler(data, "XPath ");
+ break;
+ case XML_FROM_XPOINTER:
+ testErrorHandler(data, "parser ");
+ break;
+ case XML_FROM_REGEXP:
+ testErrorHandler(data, "regexp ");
+ break;
+ case XML_FROM_MODULE:
+ testErrorHandler(data, "module ");
+ break;
+ case XML_FROM_SCHEMASV:
+ testErrorHandler(data, "Schemas validity ");
+ break;
+ case XML_FROM_SCHEMASP:
+ testErrorHandler(data, "Schemas parser ");
+ break;
+ case XML_FROM_RELAXNGP:
+ testErrorHandler(data, "Relax-NG parser ");
+ break;
+ case XML_FROM_RELAXNGV:
+ testErrorHandler(data, "Relax-NG validity ");
+ break;
+ case XML_FROM_CATALOG:
+ testErrorHandler(data, "Catalog ");
+ break;
+ case XML_FROM_C14N:
+ testErrorHandler(data, "C14N ");
+ break;
+ case XML_FROM_XSLT:
+ testErrorHandler(data, "XSLT ");
+ break;
+ default:
+ break;
+ }
+ if (code == XML_ERR_OK)
+ return;
+ switch (level) {
+ case XML_ERR_NONE:
+ testErrorHandler(data, ": ");
+ break;
+ case XML_ERR_WARNING:
+ testErrorHandler(data, "warning : ");
+ break;
+ case XML_ERR_ERROR:
+ testErrorHandler(data, "error : ");
+ break;
+ case XML_ERR_FATAL:
+ testErrorHandler(data, "error : ");
+ break;
+ }
+ if (code == XML_ERR_OK)
+ return;
+ if (str != NULL) {
+ int len;
+ len = xmlStrlen((const xmlChar *)str);
+ if ((len > 0) && (str[len - 1] != '\n'))
+ testErrorHandler(data, "%s\n", str);
+ else
+ testErrorHandler(data, "%s", str);
+ } else {
+ testErrorHandler(data, "%s\n", "out of memory error");
+ }
+ if (code == XML_ERR_OK)
+ return;
+
+ if (ctxt != NULL) {
+ xmlParserPrintFileContextInternal(input, testErrorHandler, data);
+ if (cur != NULL) {
+ if (cur->filename)
+ testErrorHandler(data, "%s:%d: \n", cur->filename, cur->line);
+ else if ((line != 0) && (domain == XML_FROM_PARSER))
+ testErrorHandler(data, "Entity: line %d: \n", cur->line);
+ xmlParserPrintFileContextInternal(cur, testErrorHandler, data);
+ }
+ }
+ if ((domain == XML_FROM_XPATH) && (err->str1 != NULL) &&
+ (err->int1 < 100) &&
+ (err->int1 < xmlStrlen((const xmlChar *)err->str1))) {
+ xmlChar buf[150];
+ int i;
+
+ testErrorHandler(data, "%s\n", err->str1);
+ for (i=0;i < err->int1;i++)
+ buf[i] = ' ';
+ buf[i++] = '^';
+ buf[i] = 0;
+ testErrorHandler(data, "%s\n", buf);
+ }
+}
+
+#else /* LIBXML_VERSION */
+
static void
testStructuredErrorHandler(void *ctx ATTRIBUTE_UNUSED, const xmlError *err) {
xmlFormatError(err, testErrorHandler, NULL);
}
+#endif /* LIBXML_VERSION */
+
static void
initializeLibxml2(void) {
xmlInitParser();
--
GitLab

1427
libxslt.changes Normal file

File diff suppressed because it is too large Load Diff

188
libxslt.spec Normal file
View File

@ -0,0 +1,188 @@
#
# spec file for package libxslt
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define libver 1
%define libexver 0
Name: libxslt
Version: 1.1.42
Release: 0
Summary: XSL Transformation Library
License: GPL-2.0-or-later AND MIT
Group: Development/Libraries/C and C++
URL: https://gitlab.gnome.org/GNOME/libxslt
Source0: https://download.gnome.org/sources/%{name}/1.1/%{name}-%{version}.tar.xz
Source1: baselibs.conf
Source2: xslt-config.1
# PATCH-FIX-OPENSUSE -- libxslt-1.1.24-no-net-autobuild.patch
# The xmlGetExternalEntityLoader() tries to fetch/parse some information via
# internet, which OBS's build environment does not allow it.
Patch0: libxslt-1.1.24-no-net-autobuild.patch
# PATCH-FIX-UPSTREAM -- libxslt-random-seed.patch
# https://bugzilla.suse.com/show_bug.cgi?id=934119
# https://bugzilla.gnome.org/show_bug.cgi?id=758400
# Initialize the random seed to ensure libxslt's math.random() function
# produces unpredictable outputs.
Patch1: libxslt-random-seed.patch
Patch2: libxslt-reproducible.patch
# PATCH-FIX-UPSTREAM -- libxslt-test-compile-with-older-libxml2-versions.patch
# https://gitlab.gnome.org/GNOME/libxslt/-/issues/125
Patch3: libxslt-test-compile-with-older-libxml2-versions.patch
#
### SUSE patches starts on 1000
# PATCH-FIX-SUSE
#Patch1000:
#
BuildRequires: fdupes
BuildRequires: gcc
BuildRequires: libgcrypt-devel
BuildRequires: pkgconfig
BuildRequires: pkgconfig(libxml-2.0) >= 2.9.12
Obsoletes: libxslt-python
%description
This C library allows you to transform XML files into other XML files
(or HTML, text, and more) using the standard XSLT stylesheet
transformation mechanism.
It is based on libxml (version 2) for XML parsing, tree manipulation,
and XPath support. It is written in plain C, making as few assumptions
as possible and sticks closely to ANSI C/POSIX for easy embedding.
It includes support for the EXSLT set of extension functions as well
as some common extensions present in other XSLT engines.
%package -n libxslt%{libver}
Summary: XSL Transformation Library
License: LGPL-2.1-or-later
Group: System/Libraries
%description -n libxslt%{libver}
This C library allows you to transform XML files into other XML files
(or HTML, text, and more) using the standard XSLT stylesheet
transformation mechanism.
It is based on libxml (version 2) for XML parsing, tree manipulation,
and XPath support. It is written in plain C, making as few assumptions
as possible and sticks closely to ANSI C/POSIX for easy embedding.
It includes support for the EXSLT set of extension functions as well
as some common extensions present in other XSLT engines.
%package -n libexslt%{libexver}
Summary: EXSLT Library
License: LGPL-2.1-or-later
Group: System/Libraries
%description -n libexslt%{libexver}
This is the EXSLT C library developed for libxslt.
EXSLT is a community initiative to provide extensions to XSLT.
%package devel
Summary: Development files for libxslt
License: LGPL-2.1-or-later
Group: Development/Libraries/C and C++
Requires: %{name}-tools = %{version}
Requires: glibc-devel
Requires: libexslt%{libexver} = %{version}
Requires: libgcrypt-devel
Requires: libxslt%{libver} = %{version}
%description devel
libxslt allows you to transform XML files into other XML files
(or HTML, text, and more) using the standard XSLT stylesheet
transformation mechanism.
This subpackage contains the header files for developing
applications that want to make use of the XSLT libraries.
%package tools
Summary: Extended Stylesheet Language (XSL) Transformation utilities
License: GPL-2.0-or-later AND MIT
Group: Development/Tools/Other
Provides: %{name} = %{version}
Provides: xsltproc = %{version}
%description tools
This package contains xsltproc, a command line interface to the XSLT engine.
xtend the
%prep
%autosetup -p1
%build
%configure \
--disable-static \
--without-python \
--disable-silent-rules
%make_build
%check
find -type f -name "test_bad*" -delete -print
%make_build check
%install
%make_install
# Unwanted doc stuff
rm -fr %{buildroot}%{_datadir}/doc
# Install the manual page for xslt-config
install -D -m0644 %{SOURCE2} %{buildroot}%{_mandir}/man1/xslt-config.1
#kill all "la" files
find %{buildroot} -type f -name "*.la" -delete -print
# Hardlink same-content files
%fdupes %{buildroot}%{_datadir}
%ldconfig_scriptlets -n libxslt%{libver}
%ldconfig_scriptlets -n libexslt%{libexver}
%files -n libxslt%{libver}
%license COPYING* Copyright
%{_libdir}/libxslt.so.%{libver}*
%files -n libexslt%{libexver}
%license COPYING* Copyright
%{_libdir}/libexslt.so.%{libexver}*
%files tools
%license COPYING* Copyright
%doc AUTHORS NEWS TODO FEATURES
%{_bindir}/xsltproc
%{_mandir}/man1/xsltproc.1%{?ext_man}
%files devel
%license COPYING* Copyright
%{_libdir}/libxslt.so
%{_libdir}/libexslt.so
%{_libdir}/*.sh
%{_libdir}/pkgconfig/libxslt.pc
%{_libdir}/pkgconfig/libexslt.pc
%dir %{_libdir}/cmake/libxslt/
%{_libdir}/cmake/libxslt/FindGcrypt.cmake
%{_libdir}/cmake/libxslt/libxslt-config.cmake
%{_includedir}/*
%{_bindir}/xslt-config
%{_mandir}/man1/xslt-config.1%{?ext_man}
%{_mandir}/man3/*
%dir %{_datadir}/gtk-doc/
%dir %{_datadir}/gtk-doc/html/
%{_datadir}/gtk-doc/html/libexslt/
%{_datadir}/gtk-doc/html/libxslt/
%doc doc/*.html doc/tutorial doc/tutorial2
%changelog

47
xslt-config.1 Normal file
View File

@ -0,0 +1,47 @@
.mso www.tmac
.TH XSLT-CONFIG 1 2011-06-24 GNOME "The XSLT C library for GNOME"
.SH NAME
xslt-config \- provides compilation or linking flags for programs using libxslt
.SH SYNOPSIS
.B xslt-config --cflags
.br
.B xslt-config --libs
.SH DESCRIPTION
.B xslt-config
is a small shell script which is installed as part of
.B libxslt
usual install process which provides compilation or linking flags for programs using it.
Use
.IP
.B xslt-config --cflags
.PP
to get the compilation flags and
.IP
.B xslt-config --libs
.PP
to get the linker flags. Usually this is done directly from the Makefile as:
.IP
.B CFLAGS=`xslt-config --cflags`
.br
.B LIBS=`xslt-config --libs`
.SH NOTES
If you use the
.SM EXSLT
extensions from the program then you should prepend
.B -lexslt
to the
.B LIBS
options
.SH SEE ALSO
.URL http://xmlsoft.org/XSLT/ "The XSLT C library for GNOME"