From 3450d6c3ded7f17c4599d79d3532a06261a275d137b027fdb8af58a72502f77a Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Wed, 23 Aug 2023 18:54:07 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/Java:packages/dom4j?expand=0&rev=45 --- 0001-no-jaxen-dom4.patch | 713 +++++++++++++++++++++++++++++++++++++++ _multibuild | 3 + dom4j.spec | 73 ++-- 3 files changed, 767 insertions(+), 22 deletions(-) create mode 100644 0001-no-jaxen-dom4.patch create mode 100644 _multibuild diff --git a/0001-no-jaxen-dom4.patch b/0001-no-jaxen-dom4.patch new file mode 100644 index 0000000..553a7f7 --- /dev/null +++ b/0001-no-jaxen-dom4.patch @@ -0,0 +1,713 @@ +From b494798add23c21d68b1dd54e8929095396516bb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Fridrich=20=C5=A0trba?= +Date: Wed, 23 Aug 2023 20:33:23 +0200 +Subject: [PATCH] no-jaxen-dom4 + +--- + src/main/java/org/dom4j/DocumentFactory.java | 22 +- + src/main/java/org/dom4j/DocumentHelper.java | 16 - + .../java/org/dom4j/tree/AbstractNode.java | 4 - + .../org/dom4j/util/ProxyDocumentFactory.java | 4 - + .../java/org/dom4j/xpath/DefaultXPath.java | 409 ------------------ + .../java/org/dom4j/xpath/XPathPattern.java | 164 ------- + 6 files changed, 2 insertions(+), 617 deletions(-) + delete mode 100644 src/main/java/org/dom4j/xpath/DefaultXPath.java + delete mode 100644 src/main/java/org/dom4j/xpath/XPathPattern.java + +diff --git a/src/main/java/org/dom4j/DocumentFactory.java b/src/main/java/org/dom4j/DocumentFactory.java +index 9aaaa11..fa2bbb8 100644 +--- a/src/main/java/org/dom4j/DocumentFactory.java ++++ b/src/main/java/org/dom4j/DocumentFactory.java +@@ -27,8 +27,6 @@ import org.dom4j.tree.DefaultText; + import org.dom4j.tree.QNameCache; + import org.dom4j.util.SimpleSingleton; + import org.dom4j.util.SingletonStrategy; +-import org.dom4j.xpath.DefaultXPath; +-import org.dom4j.xpath.XPathPattern; + import org.jaxen.VariableContext; + + /** +@@ -219,7 +217,7 @@ public class DocumentFactory implements Serializable { + */ + public XPath createXPath(String xpathExpression) + throws InvalidXPathException { +- DefaultXPath xpath = new DefaultXPath(xpathExpression); ++ XPath xpath = createXPath(xpathExpression); + + if (xpathNamespaceURIs != null) { + xpath.setNamespaceURIs(xpathNamespaceURIs); +@@ -291,22 +289,6 @@ public class DocumentFactory implements Serializable { + // return new DefaultXPath( xpathFilterExpression ); + } + +- /** +- *

+- * createPattern parses the given XPath expression to create +- * an XSLT style {@link Pattern}instance which can then be used in an XSLT +- * processing model. +- *

+- * +- * @param xpathPattern +- * is the XPath pattern expression to create +- * +- * @return a new Pattern instance +- */ +- public Pattern createPattern(String xpathPattern) { +- return new XPathPattern(xpathPattern); +- } +- + // Properties + // ------------------------------------------------------------------------- + +@@ -445,4 +427,4 @@ public class DocumentFactory implements Serializable { + * POSSIBILITY OF SUCH DAMAGE. + * + * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved. +- */ +\ No newline at end of file ++ */ +diff --git a/src/main/java/org/dom4j/DocumentHelper.java b/src/main/java/org/dom4j/DocumentHelper.java +index 865a51a..040770c 100644 +--- a/src/main/java/org/dom4j/DocumentHelper.java ++++ b/src/main/java/org/dom4j/DocumentHelper.java +@@ -160,22 +160,6 @@ public final class DocumentHelper { + return getDocumentFactory().createXPathFilter(xpathFilterExpression); + } + +- /** +- *

+- * createPattern parses the given XPath expression to create +- * an XSLT style {@link Pattern}instance which can then be used in an XSLT +- * processing model. +- *

+- * +- * @param xpathPattern +- * is the XPath pattern expression to create +- * +- * @return a new Pattern instance +- */ +- public static Pattern createPattern(String xpathPattern) { +- return getDocumentFactory().createPattern(xpathPattern); +- } +- + /** + *

+ * selectNodes performs the given XPath expression on the +diff --git a/src/main/java/org/dom4j/tree/AbstractNode.java b/src/main/java/org/dom4j/tree/AbstractNode.java +index 3957c29..e8b14c7 100644 +--- a/src/main/java/org/dom4j/tree/AbstractNode.java ++++ b/src/main/java/org/dom4j/tree/AbstractNode.java +@@ -206,10 +206,6 @@ public abstract class AbstractNode implements Node, Cloneable, Serializable { + return getDocumentFactory().createXPathFilter(patternText); + } + +- public Pattern createPattern(String patternText) { +- return getDocumentFactory().createPattern(patternText); +- } +- + public Node asXPathResult(Element parent) { + if (supportsParent()) { + return this; +diff --git a/src/main/java/org/dom4j/util/ProxyDocumentFactory.java b/src/main/java/org/dom4j/util/ProxyDocumentFactory.java +index 65624be..8bf7e57 100644 +--- a/src/main/java/org/dom4j/util/ProxyDocumentFactory.java ++++ b/src/main/java/org/dom4j/util/ProxyDocumentFactory.java +@@ -146,10 +146,6 @@ public abstract class ProxyDocumentFactory { + return proxy.createXPathFilter(xpathFilterExpression); + } + +- public Pattern createPattern(String xpathPattern) { +- return proxy.createPattern(xpathPattern); +- } +- + // Implementation methods + // ------------------------------------------------------------------------- + protected DocumentFactory getProxy() { +diff --git a/src/main/java/org/dom4j/xpath/DefaultXPath.java b/src/main/java/org/dom4j/xpath/DefaultXPath.java +deleted file mode 100644 +index f81eec5..0000000 +--- a/src/main/java/org/dom4j/xpath/DefaultXPath.java ++++ /dev/null +@@ -1,409 +0,0 @@ +-/* +- * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved. +- * +- * This software is open source. +- * See the bottom of this file for the licence. +- */ +- +-package org.dom4j.xpath; +- +-import java.io.Serializable; +-import java.util.Collections; +-import java.util.Comparator; +-import java.util.HashMap; +-import java.util.HashSet; +-import java.util.Iterator; +-import java.util.List; +-import java.util.Map; +- +-import org.dom4j.InvalidXPathException; +-import org.dom4j.Node; +-import org.dom4j.NodeFilter; +-import org.dom4j.XPathException; +- +-import org.jaxen.FunctionContext; +-import org.jaxen.JaxenException; +-import org.jaxen.NamespaceContext; +-import org.jaxen.SimpleNamespaceContext; +-import org.jaxen.VariableContext; +-import org.jaxen.XPath; +-import org.jaxen.dom4j.Dom4jXPath; +- +-/** +- *

+- * Default implementation of {@link org.dom4j.XPath}which uses the Jaxen project. +- *

+- * +- * @author bob mcwhirter +- * @author James Strachan +- */ +-public class DefaultXPath implements org.dom4j.XPath, NodeFilter, Serializable { +- private String text; +- +- private XPath xpath; +- +- private NamespaceContext namespaceContext; +- +- /** +- * Construct an XPath +- * +- * @param text +- * DOCUMENT ME! +- * +- * @throws InvalidXPathException +- * DOCUMENT ME! +- */ +- public DefaultXPath(String text) throws InvalidXPathException { +- this.text = text; +- this.xpath = parse(text); +- } +- +- public String toString() { +- return "[XPath: " + xpath + "]"; +- } +- +- // XPath interface +- +- /** +- * Retrieve the textual XPath string used to initialize this Object +- * +- * @return The XPath string +- */ +- public String getText() { +- return text; +- } +- +- public FunctionContext getFunctionContext() { +- return xpath.getFunctionContext(); +- } +- +- public void setFunctionContext(FunctionContext functionContext) { +- xpath.setFunctionContext(functionContext); +- } +- +- public NamespaceContext getNamespaceContext() { +- return namespaceContext; +- } +- +- public void setNamespaceURIs(Map map) { +- setNamespaceContext(new SimpleNamespaceContext(map)); +- } +- +- public void setNamespaceContext(NamespaceContext namespaceContext) { +- this.namespaceContext = namespaceContext; +- xpath.setNamespaceContext(namespaceContext); +- } +- +- public VariableContext getVariableContext() { +- return xpath.getVariableContext(); +- } +- +- public void setVariableContext(VariableContext variableContext) { +- xpath.setVariableContext(variableContext); +- } +- +- public Object evaluate(Object context) { +- try { +- setNSContext(context); +- +- List answer = xpath.selectNodes(context); +- +- if ((answer != null) && (answer.size() == 1)) { +- return answer.get(0); +- } +- +- return answer; +- } catch (JaxenException e) { +- handleJaxenException(e); +- +- return null; +- } +- } +- +- public Object selectObject(Object context) { +- return evaluate(context); +- } +- +- public List selectNodes(Object context) { +- try { +- setNSContext(context); +- +- return (List) xpath.selectNodes(context); +- } catch (JaxenException e) { +- handleJaxenException(e); +- +- return Collections.emptyList(); +- } +- } +- +- public List selectNodes(Object context, org.dom4j.XPath sortXPath) { +- List answer = selectNodes(context); +- sortXPath.sort(answer); +- +- return answer; +- } +- +- public List selectNodes(Object context, org.dom4j.XPath sortXPath, +- boolean distinct) { +- List answer = selectNodes(context); +- sortXPath.sort(answer, distinct); +- +- return answer; +- } +- +- public Node selectSingleNode(Object context) { +- try { +- setNSContext(context); +- +- Object answer = xpath.selectSingleNode(context); +- +- if (answer instanceof Node) { +- return (Node) answer; +- } +- +- if (answer == null) { +- return null; +- } +- +- throw new XPathException("The result of the XPath expression is " +- + "not a Node. It was: " + answer + " of type: " +- + answer.getClass().getName()); +- } catch (JaxenException e) { +- handleJaxenException(e); +- +- return null; +- } +- } +- +- public String valueOf(Object context) { +- try { +- setNSContext(context); +- +- return xpath.stringValueOf(context); +- } catch (JaxenException e) { +- handleJaxenException(e); +- +- return ""; +- } +- } +- +- public Number numberValueOf(Object context) { +- try { +- setNSContext(context); +- +- return xpath.numberValueOf(context); +- } catch (JaxenException e) { +- handleJaxenException(e); +- +- return null; +- } +- } +- +- public boolean booleanValueOf(Object context) { +- try { +- setNSContext(context); +- +- return xpath.booleanValueOf(context); +- } catch (JaxenException e) { +- handleJaxenException(e); +- +- return false; +- } +- } +- +- /** +- *

+- * sort sorts the given List of Nodes using this XPath +- * expression as a {@link Comparator}. +- *

+- * +- * @param list +- * is the list of Nodes to sort +- */ +- public void sort(List list) { +- sort(list, false); +- } +- +- /** +- *

+- * sort sorts the given List of Nodes using this XPath +- * expression as a {@link Comparator}and optionally removing duplicates. +- *

+- * +- * @param list +- * is the list of Nodes to sort +- * @param distinct +- * if true then duplicate values (using the sortXPath for +- * comparisions) will be removed from the List +- */ +- public void sort(List list, boolean distinct) { +- if ((list != null) && !list.isEmpty()) { +- int size = list.size(); +- HashMap sortValues = new HashMap(size); +- +- for (Node node : list) { +- Object expression = getCompareValue(node); +- sortValues.put(node, expression); +- } +- +- sort(list, sortValues); +- +- if (distinct) { +- removeDuplicates(list, sortValues); +- } +- } +- } +- +- public boolean matches(Node node) { +- try { +- setNSContext(node); +- +- List answer = xpath.selectNodes(node); +- +- if ((answer != null) && (answer.size() > 0)) { +- Object item = answer.get(0); +- +- if (item instanceof Boolean) { +- return (Boolean) item; +- } +- +- return answer.contains(node); +- } +- +- return false; +- } catch (JaxenException e) { +- handleJaxenException(e); +- +- return false; +- } +- } +- +- /** +- * Sorts the list based on the sortValues for each node +- * +- * @param list +- * DOCUMENT ME! +- * @param sortValues +- * DOCUMENT ME! +- */ +- protected void sort(List list, final Map sortValues) { +- Collections.sort(list, new Comparator() { +- public int compare(Node n1, Node n2) { +- Object o1 = sortValues.get(n1); +- Object o2 = sortValues.get(n2); +- +- if (o1 == o2) { +- return 0; +- } else if (o1 instanceof Comparable) { +- Comparable c1 = (Comparable) o1; +- +- return c1.compareTo(o2); +- } else if (o1 == null) { +- return 1; +- } else if (o2 == null) { +- return -1; +- } else { +- return o1.equals(o2) ? 0 : (-1); +- } +- } +- }); +- } +- +- // Implementation methods +- +- /** +- * Removes items from the list which have duplicate values +- * +- * @param list +- * DOCUMENT ME! +- * @param sortValues +- * DOCUMENT ME! +- */ +- protected void removeDuplicates(List list, Map sortValues) { +- // remove distinct +- HashSet distinctValues = new HashSet(); +- +- for (Iterator iter = list.iterator(); iter.hasNext();) { +- Node node = iter.next(); +- Object value = sortValues.get(node); +- +- if (distinctValues.contains(value)) { +- iter.remove(); +- } else { +- distinctValues.add(value); +- } +- } +- } +- +- /** +- * DOCUMENT ME! +- * +- * @param node +- * DOCUMENT ME! +- * +- * @return the node expression used for sorting comparisons +- */ +- protected Object getCompareValue(Node node) { +- return valueOf(node); +- } +- +- protected static XPath parse(String text) { +- try { +- return new Dom4jXPath(text); +- } catch (JaxenException e) { +- throw new InvalidXPathException(text, e.getMessage()); +- } catch (RuntimeException e) { +- } +- +- throw new InvalidXPathException(text); +- } +- +- protected void setNSContext(Object context) { +- if (namespaceContext == null) { +- xpath.setNamespaceContext(DefaultNamespaceContext.create(context)); +- } +- } +- +- protected void handleJaxenException(JaxenException exception) +- throws XPathException { +- throw new XPathException(text, exception); +- } +-} +- +-/* +- * Redistribution and use of this software and associated documentation +- * ("Software"), with or without modification, are permitted provided that the +- * following conditions are met: +- * +- * 1. Redistributions of source code must retain copyright statements and +- * notices. Redistributions must also contain a copy of this document. +- * +- * 2. Redistributions in binary form must reproduce the above copyright notice, +- * this list of conditions and the following disclaimer in the documentation +- * and/or other materials provided with the distribution. +- * +- * 3. The name "DOM4J" must not be used to endorse or promote products derived +- * from this Software without prior written permission of MetaStuff, Ltd. For +- * written permission, please contact dom4j-info@metastuff.com. +- * +- * 4. Products derived from this Software may not be called "DOM4J" nor may +- * "DOM4J" appear in their names without prior written permission of MetaStuff, +- * Ltd. DOM4J is a registered trademark of MetaStuff, Ltd. +- * +- * 5. Due credit should be given to the DOM4J Project - http://www.dom4j.org +- * +- * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS ``AS IS'' AND +- * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +- * ARE DISCLAIMED. IN NO EVENT SHALL METASTUFF, LTD. OR ITS CONTRIBUTORS BE +- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +- * POSSIBILITY OF SUCH DAMAGE. +- * +- * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved. +- */ +diff --git a/src/main/java/org/dom4j/xpath/XPathPattern.java b/src/main/java/org/dom4j/xpath/XPathPattern.java +deleted file mode 100644 +index 65d656b..0000000 +--- a/src/main/java/org/dom4j/xpath/XPathPattern.java ++++ /dev/null +@@ -1,164 +0,0 @@ +-/* +- * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved. +- * +- * This software is open source. +- * See the bottom of this file for the licence. +- */ +- +-package org.dom4j.xpath; +- +-import java.util.ArrayList; +-import java.util.Collections; +- +-import org.dom4j.InvalidXPathException; +-import org.dom4j.Node; +-import org.dom4j.XPathException; +- +-import org.jaxen.Context; +-import org.jaxen.ContextSupport; +-import org.jaxen.JaxenException; +-import org.jaxen.SimpleNamespaceContext; +-import org.jaxen.SimpleVariableContext; +-import org.jaxen.VariableContext; +-import org.jaxen.XPathFunctionContext; +-import org.jaxen.dom4j.DocumentNavigator; +-import org.jaxen.pattern.Pattern; +-import org.jaxen.pattern.PatternParser; +-import org.jaxen.saxpath.SAXPathException; +- +-/** +- *

+- * XPathPattern is an implementation of Pattern which uses an +- * XPath xpath. +- *

+- * +- * @author James Strachan +- * @version $Revision: 1.18 $ +- */ +-public class XPathPattern implements org.dom4j.rule.Pattern { +- private String text; +- +- private Pattern pattern; +- +- private Context context; +- +- public XPathPattern(Pattern pattern) { +- this.pattern = pattern; +- this.text = pattern.getText(); +- this.context = new Context(getContextSupport()); +- } +- +- public XPathPattern(String text) { +- this.text = text; +- this.context = new Context(getContextSupport()); +- +- try { +- this.pattern = PatternParser.parse(text); +- } catch (SAXPathException e) { +- throw new InvalidXPathException(text, e.getMessage()); +- } catch (RuntimeException e) { +- throw new InvalidXPathException(text); +- } +- } +- +- public boolean matches(Node node) { +- try { +- context.setNodeSet(Collections.singletonList(node)); +- +- return pattern.matches(node, context); +- } catch (JaxenException e) { +- handleJaxenException(e); +- +- return false; +- } +- } +- +- public String getText() { +- return text; +- } +- +- public double getPriority() { +- return pattern.getPriority(); +- } +- +- public org.dom4j.rule.Pattern[] getUnionPatterns() { +- Pattern[] patterns = pattern.getUnionPatterns(); +- +- if (patterns != null) { +- int size = patterns.length; +- XPathPattern[] answer = new XPathPattern[size]; +- +- for (int i = 0; i < size; i++) { +- answer[i] = new XPathPattern(patterns[i]); +- } +- +- return answer; +- } +- +- return null; +- } +- +- public short getMatchType() { +- return pattern.getMatchType(); +- } +- +- public String getMatchesNodeName() { +- return pattern.getMatchesNodeName(); +- } +- +- public void setVariableContext(VariableContext variableContext) { +- context.getContextSupport().setVariableContext(variableContext); +- } +- +- public String toString() { +- return "[XPathPattern: text: " + text + " Pattern: " + pattern + "]"; +- } +- +- protected ContextSupport getContextSupport() { +- return new ContextSupport(new SimpleNamespaceContext(), +- XPathFunctionContext.getInstance(), +- new SimpleVariableContext(), DocumentNavigator.getInstance()); +- } +- +- protected void handleJaxenException(JaxenException exception) +- throws XPathException { +- throw new XPathException(text, exception); +- } +-} +- +-/* +- * Redistribution and use of this software and associated documentation +- * ("Software"), with or without modification, are permitted provided that the +- * following conditions are met: +- * +- * 1. Redistributions of source code must retain copyright statements and +- * notices. Redistributions must also contain a copy of this document. +- * +- * 2. Redistributions in binary form must reproduce the above copyright notice, +- * this list of conditions and the following disclaimer in the documentation +- * and/or other materials provided with the distribution. +- * +- * 3. The name "DOM4J" must not be used to endorse or promote products derived +- * from this Software without prior written permission of MetaStuff, Ltd. For +- * written permission, please contact dom4j-info@metastuff.com. +- * +- * 4. Products derived from this Software may not be called "DOM4J" nor may +- * "DOM4J" appear in their names without prior written permission of MetaStuff, +- * Ltd. DOM4J is a registered trademark of MetaStuff, Ltd. +- * +- * 5. Due credit should be given to the DOM4J Project - http://www.dom4j.org +- * +- * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS ``AS IS'' AND +- * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +- * ARE DISCLAIMED. IN NO EVENT SHALL METASTUFF, LTD. OR ITS CONTRIBUTORS BE +- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +- * POSSIBILITY OF SUCH DAMAGE. +- * +- * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved. +- */ +-- +2.41.0 + diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..655ec81 --- /dev/null +++ b/_multibuild @@ -0,0 +1,3 @@ + + bootstrap + diff --git a/dom4j.spec b/dom4j.spec index 60b278f..ed1b1db 100644 --- a/dom4j.spec +++ b/dom4j.spec @@ -1,5 +1,5 @@ # -# spec file for package dom4j +# spec file # # Copyright (c) 2023 SUSE LLC # Copyright (c) 2000-2007, JPackage Project @@ -17,32 +17,53 @@ # -Name: dom4j +%global base_name dom4j +%global flavor @BUILD_FLAVOR@%{nil} +%if "%{flavor}" == "bootstrap" +%bcond_without bootstrap +%else +%bcond_with bootstrap +%endif Version: 2.1.4 Release: 0 Summary: Open Source XML framework for Java License: BSD-3-Clause URL: https://dom4j.github.io/ -Source0: %{name}-%{version}.tar.xz -Source1: https://repo1.maven.org/maven2/org/%{name}/%{name}/%{version}/%{name}-%{version}.pom -Source2: %{name}-build.xml +Source0: %{base_name}-%{version}.tar.xz +Source1: https://repo1.maven.org/maven2/org/%{base_name}/%{base_name}/%{version}/%{base_name}-%{version}.pom +Source2: %{base_name}-build.xml +Patch0: 0001-no-jaxen-dom4.patch BuildRequires: ant BuildRequires: fdupes BuildRequires: glassfish-jaxb-api BuildRequires: javapackages-local >= 6 -BuildRequires: jaxen-bootstrap -Obsoletes: %{name}-manual < %{version} +Obsoletes: %{base_name}-manual < %{version} BuildArch: noarch +%if %{with bootstrap} +Name: %{base_name}-bootstrap +%else +Name: %{base_name} +%endif +%if %{without bootstrap} +BuildRequires: fdupes +BuildRequires: jaxen +Conflicts: %{base_name}-bootstrap +Obsoletes: %{base_name}-bootstrap +%else +BuildRequires: jaxen-bootstrap +Conflicts: %{base_name} +%endif %description dom4j is an Open Source XML framework for Java. dom4j allows you to read, write, navigate, create and modify XML documents. dom4j integrates with DOM and SAX and is seamlessly integrated with full XPath support. +%if %{without bootstrap} %package demo Summary: Open Source XML framework for Java - demo Group: Development/Libraries/Java -Requires: %{name} = %{version} +Requires: %{base_name} = %{version} %description demo dom4j is an Open Source XML framework for Java. dom4j allows you to read, @@ -50,13 +71,17 @@ write, navigate, create and modify XML documents. dom4j integrates with DOM and SAX and is seamlessly integrated with full XPath support. %package javadoc -Summary: Javadoc for %{name} +Summary: Javadoc for %{base_name} %description javadoc -Javadoc for %{name}. +Javadoc for %{base_name}. +%endif %prep -%autosetup -p1 +%setup -q -n %{base_name}-%{version} +%if %{with bootstrap} +%patch0 -p1 +%endif cp %{SOURCE1} pom.xml cp %{SOURCE2} build.xml @@ -84,33 +109,37 @@ build-jar-repository -s lib jaxen glassfish-jaxb-api # jar install -dm 0755 %{buildroot}%{_javadir} -install -pm 0644 target/%{name}-%{version}.jar %{buildroot}%{_javadir}/%{name}.jar +install -pm 0644 target/%{base_name}-%{version}.jar %{buildroot}%{_javadir}/%{base_name}.jar # pom install -dm 0755 %{buildroot}%{_mavenpomdir} -%{mvn_install_pom} pom.xml %{buildroot}%{_mavenpomdir}/%{name}.pom -%add_maven_depmap %{name}.pom %{name}.jar -a %{name}:%{name} +%{mvn_install_pom} pom.xml %{buildroot}%{_mavenpomdir}/%{base_name}.pom +%add_maven_depmap %{base_name}.pom %{base_name}.jar -a %{base_name}:%{base_name} +%if %{without bootstrap} # javadoc -install -dm 0755 %{buildroot}%{_javadocdir}/%{name} -cp -r target/site/apidocs %{buildroot}%{_javadocdir}/%{name} +install -dm 0755 %{buildroot}%{_javadocdir}/%{base_name} +cp -r target/site/apidocs %{buildroot}%{_javadocdir}/%{base_name} %fdupes -s %{buildroot}%{_javadocdir} # demo -install -dm 0755 %{buildroot}%{_datadir}/%{name}/src -cp -pr xml %{buildroot}%{_datadir}/%{name} -cp -pr src/example %{buildroot}%{_datadir}/%{name}/src -%fdupes -s %{buildroot}%{_datadir}/%{name} +install -dm 0755 %{buildroot}%{_datadir}/%{base_name}/src +cp -pr xml %{buildroot}%{_datadir}/%{base_name} +cp -pr src/example %{buildroot}%{_datadir}/%{base_name}/src +%fdupes -s %{buildroot}%{_datadir}/%{base_name} +%endif %files -f .mfiles %license LICENSE %doc README.md +%if %{without bootstrap} %files demo -%{_datadir}/%{name} +%{_datadir}/%{base_name} %files javadoc %license LICENSE -%{_javadocdir}/%{name} +%{_javadocdir}/%{base_name} +%endif %changelog