package init

This commit is contained in:
lyn1001 2020-08-19 14:08:14 +08:00
parent 16ad9adfaf
commit 29f0b5cdf5
9 changed files with 375 additions and 0 deletions

81
enable-jdom.patch Normal file
View File

@ -0,0 +1,81 @@
--- src/main/java/freemarker/ext/jdom/NodeListModel.java.orig 2017-10-16 02:17:50.000000000 +0100
+++ src/main/java/freemarker/ext/jdom/NodeListModel.java 2017-12-06 18:53:07.877967201 +0000
@@ -661,7 +661,7 @@
else if ("data".equals(localName))
attr = new Attribute("data", pi.getData());
else
- attr = new Attribute(localName, pi.getValue(localName));
+ attr = new Attribute(localName, pi.getPseudoAttributeValue(localName));
} else if (node instanceof DocType) {
DocType doctype = (DocType) node;
if ("publicId".equals(localName))
@@ -762,17 +762,17 @@
private static final Element getParent(Object node) {
if (node instanceof Element)
- return((Element) node).getParent();
+ return((Element) node).getParentElement();
else if (node instanceof Attribute)
return((Attribute) node).getParent();
else if (node instanceof Text)
- return((Text) node).getParent();
+ return((Text) node).getParentElement();
else if (node instanceof ProcessingInstruction)
- return((ProcessingInstruction) node).getParent();
+ return((ProcessingInstruction) node).getParentElement();
else if (node instanceof Comment)
- return((Comment) node).getParent();
+ return((Comment) node).getParentElement();
else if (node instanceof EntityRef)
- return((EntityRef) node).getParent();
+ return((EntityRef) node).getParentElement();
else
// With 2.1 semantics it makes more sense to just return a null and let the core
// throw an InvalidReferenceException and the template writer can use ?exists etcetera. (JR)
@@ -794,7 +794,7 @@
LinkedList list = new LinkedList();
do {
list.addFirst(parent);
- parent = parent.getParent();
+ parent = parent.getParentElement();
} while (parent != null);
return list;
}
@@ -808,7 +808,7 @@
list.addFirst(node);
do {
list.addFirst(parent);
- parent = parent.getParent();
+ parent = parent.getParentElement();
} while (parent != null);
return list;
}
@@ -861,7 +861,7 @@
Element parent = ((Attribute) node).getParent();
doc = parent == null ? null : parent.getDocument();
} else if (node instanceof Text) {
- Element parent = ((Text) node).getParent();
+ Element parent = ((Text) node).getParentElement();
doc = parent == null ? null : parent.getDocument();
} else if (node instanceof Document)
doc = (Document) node;
--- src/main/java/freemarker/ext/xml/_JdomNavigator.java.orig 2012-03-01 01:56:25.000000000 +0100
+++ src/main/java/freemarker/ext/xml/_JdomNavigator.java 2012-05-16 13:32:06.328559677 +0200
@@ -122,7 +122,7 @@
} else if ("data".equals(localName)) {
result.add(new Attribute("data", pi.getData()));
} else {
- result.add(new Attribute(localName, pi.getValue(localName)));
+ result.add(new Attribute(localName, pi.getPseudoAttributeValue(localName)));
}
} else if (node instanceof DocType) {
DocType doctype = (DocType) node;
@@ -186,7 +186,7 @@
Element parent = ((Attribute) node).getParent();
return parent == null ? null : parent.getDocument();
} else if (node instanceof Text) {
- Element parent = ((Text) node).getParent();
+ Element parent = ((Text) node).getParentElement();
return parent == null ? null : parent.getDocument();
} else if (node instanceof Document)
return node;

View File

@ -0,0 +1,11 @@
--- src/main/java/freemarker/template/LocalizedString.java.orig 2017-10-16 02:17:50.000000000 +0100
+++ src/main/java/freemarker/template/LocalizedString.java 2017-12-06 19:43:10.783714300 +0000
@@ -33,7 +33,7 @@
* if "fr".equals(lang)
* return "oui";
* else if "de".equals(lang)
- * return "sí";
+ * return "s\u00ED";
* else
* return "yes";
* }

BIN
freemarker-2.3.28.tar.gz Normal file

Binary file not shown.

64
freemarker.spec Normal file
View File

@ -0,0 +1,64 @@
Name: freemarker
Version: 2.3.28
Release: 1
Summary: The Apache FreeMarker Template Engine
License: ASL 2.0
URL: https://freemarker.apache.org/
Source0: https://github.com/apache/incubator-freemarker/archive/v%{version}/%{name}-%{version}.tar.gz
Patch1: jsp-api.patch
Patch2: jython-compatibility.patch
Patch3: fix-javadoc-encoding.patch
Patch5: no-javarebel.patch
Patch6: enable-jdom.patch
Patch7: javacc-7.patch
BuildArch: noarch
BuildRequires: ant apache-parent apache-commons-logging aqute-bnd dom4j >= 1.6.1 hamcrest
BuildRequires: ivy-local glassfish-jsp-api glassfish-servlet-api javacc >= 7.0 jaxen >= 1.1
BuildRequires: jcl-over-slf4j jdom >= 1.0 junit jython log4j-over-slf4j rhino >= 1.6 slf4j
BuildRequires: xalan-j2 >= 2.7.0
%description
Apache FreeMarker is a template engine: a Java library to generate text output
(HTML web pages, e-mails, configuration files, source code, etc.) based on
templates and changing data. Templates are written in the FreeMarker Template
Language (FTL), which is a simple, specialized language (not a full-blown
programming language like PHP).
%package javadoc
Summary: Javadoc for %{name}
%description javadoc
This package contains the API documentation for %{name}.
%prep
%setup -q
find -type f -name "*.jar" -delete
find -type f -name "*.class" -delete
%patch1
%patch2
%patch3
%patch5
%patch6
%patch7 -p1
rm ivysettings.xml
sed -i 's/cachepath conf="IDE"/cachepath conf="javadoc"/' build.xml
sed -i '/conf name="IDE"/i<conf name="javadoc" extends="build.jython2.5,build.jsp2.1" />' ivy.xml
sed -i -e '/saxpath/d' -e '/avalon-logkit/d' ivy.xml
rm src/main/java/freemarker/log/_AvalonLoggerFactory.java
%mvn_file org.%{name}:%{name} %{name}
%build
ant -Divy.mode=local -Ddeps.available=true javacc jar javadoc maven-pom
%install
%mvn_artifact build/pom.xml build/%{name}.jar
%mvn_install -J build/api
%files -f .mfiles
%doc README.md RELEASE-NOTES
%license LICENSE NOTICE
%files javadoc -f .mfiles-javadoc
%license LICENSE NOTICE
%changelog
* Mon Aug 3 2020 yanan li <liyanan032@huawei.com> - 2.3.28-1
- Package init

5
freemarker.yaml Normal file
View File

@ -0,0 +1,5 @@
git_url: https://github.com/apache/incubator-freemarker.git
version_control: github
src_repo: apache/incubator-freemarker
tag_prefix: "^v"
seperator: "."

46
javacc-7.patch Normal file
View File

@ -0,0 +1,46 @@
From c119c7d20b46c91f2c661e4f3789194041c4ba16 Mon Sep 17 00:00:00 2001
From: Michael Simacek <msimacek@redhat.com>
Date: Tue, 4 Apr 2017 16:56:33 +0200
Subject: [PATCH] Fix compatibility with javacc 7
---
build.xml | 16 +++++++++++++++-
src/main/java/freemarker/core/TokenMgrError.java | 5 +++++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/build.xml b/build.xml
index 6542da9..20d1d56 100644
--- a/build.xml
+++ b/build.xml
@@ -160,13 +160,26 @@
<mkdir dir="${_javaccOutputDir}" />
<ivy:retrieve conf="parser" pattern="build/javacc-home.tmp/[artifact].[ext]" />
+ <!-- avoid usage of word template which is now a keyword in javacc -->
+ <copy file="src/main/javacc/FTL.jj" tofile="${_javaccOutputDir}/FTL.jj"/>
+ <replace
+ file="${_javaccOutputDir}/FTL.jj"
+ token="template"
+ value="xtemplate"
+ />
<javacc:generate
- target="src/main/javacc/FTL.jj"
+ target="${_javaccOutputDir}/FTL.jj"
outputdirectory="${_javaccOutputDir}"
javacchome="build/javacc-home.tmp"
/>
<delete dir="build/javacc-home.tmp" />
-
+ <!-- undo template keyword replacement -->
+ <replace
+ dir="${_javaccOutputDir}"
+ token="xtemplate"
+ value="template"
+ />
+
<replace
file="${_javaccOutputDir}/FMParser.java"
token="private final LookaheadSuccess"
--
2.9.3

75
jsp-api.patch Normal file
View File

@ -0,0 +1,75 @@
--- build.xmlorig 2017-10-16 02:17:50.000000000 +0100
+++ build.xml 2017-12-06 20:05:59.056142612 +0000
@@ -303,36 +303,21 @@
verify="yes" stubversion="1.2"
/>
- <ivy:cachepath conf="build.jsp2.0" pathid="ivy.dep.jsp2.0" />
+ <ivy:cachepath conf="build.jsp2.1" pathid="ivy.dep.jsp2.1" />
<javac srcdir="build/src-main-java-filtered" destdir="build/classes" deprecation="off"
debug="on" optimize="off" target="1.5" source="1.5" encoding="utf-8"
includeantruntime="false"
- classpathref="ivy.dep.jsp2.0"
+ classpathref="ivy.dep.jsp2.1"
bootclasspath="${boot.classpath.j2se1.5}"
includes="
freemarker/ext/jsp/**,
freemarker/ext/servlet/**,
freemarker/cache/WebappTemplateLoader.java"
excludes="
- freemarker/ext/jsp/_FreeMarkerPageContext21.java,
- freemarker/ext/jsp/FreeMarkerJspFactory21.java,
- freemarker/ext/jsp/FreeMarkerJspApplicationContext.java"
+ freemarker/ext/jsp/_FreeMarkerPageContext2.java,
+ freemarker/ext/jsp/FreeMarkerJspFactory2.java"
/>
- <!-- There's no build.jsp2.0, as those classes are part of the common build subset. -->
-
- <ivy:cachepath conf="build.jsp2.1" pathid="ivy.dep.jsp2.1" />
- <javac srcdir="build/src-main-java-filtered" destdir="build/classes" deprecation="off"
- debug="on" optimize="off" target="1.5" source="1.5" encoding="utf-8"
- includeantruntime="false"
- classpathref="ivy.dep.jsp2.1"
- bootclasspath="${boot.classpath.j2se1.5}"
- includes="
- freemarker/ext/jsp/_FreeMarkerPageContext21.java,
- freemarker/ext/jsp/FreeMarkerJspFactory21.java,
- freemarker/ext/jsp/FreeMarkerJspApplicationContext.java"
- />
-
<ivy:cachepath conf="build.jython2.0" pathid="ivy.dep.jython2.0" />
<javac srcdir="build/src-main-java-filtered" destdir="build/classes" deprecation="off"
debug="on" optimize="off" target="1.5" source="1.5" encoding="utf-8"
--- ivy.xml.orig 2018-03-30 22:03:42.000000000 +0100
+++ ivy.xml 2018-08-22 08:53:03.369873853 +0100
@@ -45,9 +45,6 @@
description="for building FreeMarker without dependencies that optinal dependencies"
/>
- <conf name="build.jsp2.0" extends="build.base"
- description="for building FreeMarker with JSP 2.0 support"
- />
<conf name="build.jsp2.1" extends="build.base"
description="for building FreeMarker with JSP 2.1 support"
/>
@@ -104,9 +101,7 @@
<exclude org="xml-apis" module="xml-apis" />
</dependency>
- <dependency org="javax.servlet.jsp" name="jsp-api" rev="2.0" conf="build.jsp2.0->default" />
- <dependency org="javax.servlet" name="servlet-api" rev="2.4" conf="build.jsp2.0->default" />
- <dependency org="javax.servlet.jsp" name="jsp-api" rev="2.1" conf="build.jsp2.1->default" />
+ <dependency org="javax.servlet" name="jsp-api" rev="2.1" conf="build.jsp2.1->default" />
<dependency org="javax.servlet" name="servlet-api" rev="2.5" conf="build.jsp2.1->default" />
<dependency org="rhino" name="js" rev="1.6R1" conf="build.base->default" />
@@ -183,7 +178,7 @@
<!-- Ensure that JSP versions don't accidentally hide each-other -->
- <conflict org="javax.servlet.jsp" module="jsp-api" manager="strict" />
+ <conflict org="javax.servlet" module="jsp-api" manager="strict" />
</dependencies>
</ivy-module>

View File

@ -0,0 +1,72 @@
--- ivy.xml.orig 2017-12-06 19:20:16.456335648 +0000
+++ ivy.xml 2017-12-06 19:20:59.320159647 +0000
@@ -49,12 +49,6 @@
description="for building FreeMarker with JSP 2.1 support"
/>
- <conf name="build.jython2.0" extends="build.base"
- description="for building FreeMarker with Jython 2.0 support"
- />
- <conf name="build.jython2.2" extends="build.base"
- description="for building FreeMarker with Jython 2.2 support"
- />
<conf name="build.jython2.5" extends="build.base"
description="for building FreeMarker with Jython 2.5 support"
/>
@@ -106,9 +100,6 @@
<dependency org="rhino" name="js" rev="1.6R1" conf="build.base->default" />
- <!-- We use Jython 2.1 because there was no 2.0 in central; the relevant methods are the same. -->
- <dependency org="jython" name="jython" rev="2.1" conf="build.jython2.0->default" />
- <dependency org="org.python" name="jython" rev="2.2.1" conf="build.jython2.2->default" />
<dependency org="org.python" name="jython" rev="2.5.0" conf="build.jython2.5->default" />
<dependency org="avalon-logkit" name="avalon-logkit" rev="2.0" conf="build.base->default" />
--- build.xml 2017-12-06 19:19:56.790416398 +0000
+++ build.xml.orig 2017-12-06 19:25:06.163149500 +0000
@@ -318,41 +318,21 @@
freemarker/ext/jsp/FreeMarkerJspFactory2.java"
/>
- <ivy:cachepath conf="build.jython2.0" pathid="ivy.dep.jython2.0" />
+ <ivy:cachepath conf="build.jython2.5" pathid="ivy.dep.jython2.5" />
<javac srcdir="build/src-main-java-filtered" destdir="build/classes" deprecation="off"
debug="on" optimize="off" target="1.5" source="1.5" encoding="utf-8"
includeantruntime="false"
- classpathref="ivy.dep.jython2.0"
+ classpathref="ivy.dep.jython2.5"
bootclasspath="${boot.classpath.j2se1.5}"
includes="
freemarker/ext/ant/**,
freemarker/template/utility/JythonRuntime.java,
freemarker/ext/jython/**"
excludes="
- freemarker/ext/jython/_Jython22VersionAdapter.java,
- freemarker/ext/jython/_Jython25VersionAdapter.java"
- />
-
- <ivy:cachepath conf="build.jython2.2" pathid="ivy.dep.jython2.2" />
- <javac srcdir="build/src-main-java-filtered" destdir="build/classes" deprecation="off"
- debug="on" optimize="off" target="1.5" source="1.5" encoding="utf-8"
- includeantruntime="false"
- classpathref="ivy.dep.jython2.2"
- bootclasspath="${boot.classpath.j2se1.5}"
- includes="
+ freemarker/ext/jython/_Jython20And21VersionAdapter.java,
freemarker/ext/jython/_Jython22VersionAdapter.java"
/>
- <ivy:cachepath conf="build.jython2.5" pathid="ivy.dep.jython2.5" />
- <javac srcdir="build/src-main-java-filtered" destdir="build/classes" deprecation="off"
- debug="on" optimize="off" target="1.5" source="1.5" encoding="utf-8"
- includeantruntime="false"
- classpathref="ivy.dep.jython2.5"
- bootclasspath="${boot.classpath.j2se1.5}"
- includes="
- freemarker/ext/jython/_Jython25VersionAdapter.java"
- />
-
<rmic base="build/classes" classpathref="ivy.dep"
includes="build/src-main-java-filtered/freemarker/debug/impl/Rmi*Impl.class"
verify="yes" stubversion="1.2"

21
no-javarebel.patch Normal file
View File

@ -0,0 +1,21 @@
--- build.xml.orig 2017-12-06 18:32:24.827024991 +0000
+++ build.xml 2017-12-06 18:32:55.974897827 +0000
@@ -264,6 +264,7 @@
classpathref="ivy.dep"
bootclasspath="${boot.classpath.j2se1.5}"
excludes="
+ freemarker/ext/beans/JRebelClassChangeNotifier.java
freemarker/core/_Java?*Impl.java,
freemarker/ext/jsp/**,
freemarker/ext/servlet/**,
--- ivy.xml.orig 2017-12-06 18:24:27.374972063 +0000
+++ ivy.xml 2017-12-06 18:24:41.745913477 +0000
@@ -122,8 +122,6 @@
<dependency org="org.slf4j" name="jcl-over-slf4j" rev="&slf4j.version;" conf="build.base->default" />
<dependency org="commons-logging" name="commons-logging" rev="1.1.1" conf="build.base->default" />
- <dependency org="org.zeroturnaround" name="javarebel-sdk" rev="1.2.2" conf="build.base->default" />
-
<!-- Not for build.base, as @SuppressFBWarnings causes compilation warnings in dependent Gradle projects -->
<dependency org="com.google.code.findbugs" name="annotations" rev="3.0.0" conf="IDE->default; test->default" />