Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
7f2790bf55
!12 riscv64: update jdk version to 11
From: @zke-012020 
Reviewed-by: @caodongxia 
Signed-off-by: @caodongxia
2024-02-27 01:43:52 +00:00
zke
f84a4829b4 riscv64: update jdk to version 11 2024-02-26 16:24:22 +08:00
openeuler-ci-bot
6eb11a9fbf
!10 Upgrade version to 1.8.0
From: @chen-jan 
Reviewed-by: @Lostwayzxc, @caodongxia 
Signed-off-by: @caodongxia
2023-07-31 03:28:49 +00:00
chen-jan
fdf7c5339f Upgrade version to 1.8.0 2023-07-27 19:38:18 +08:00
openeuler-ci-bot
121d805c0a
!9 [sync] PR-7: Fix not stripped problem
From: @openeuler-sync-bot 
Reviewed-by: @cherry530 
Signed-off-by: @cherry530
2023-03-03 09:17:53 +00:00
caodongxia
1241ec61f8 Fix not stripped problem
(cherry picked from commit 1cbf2351263ce0cdaad9723f4dccc8cdb7a903ba)
2023-03-03 16:41:40 +08:00
openeuler-ci-bot
1bd5aaf2fd
!6 License compliance rectification
From: @wk333 
Reviewed-by: @wangchong1995924 
Signed-off-by: @wangchong1995924
2022-05-11 01:52:15 +00:00
wk333
250f57273e License compliance rectification 2022-05-10 19:46:28 +08:00
openeuler-ci-bot
6dee27cd3b
!5 [sync] PR-3: openEuler-22.03-LTS-Next upgrade lz4-java to 1.7.1
From: @openeuler-sync-bot 
Reviewed-by: @wangchong1995924 
Signed-off-by: @wangchong1995924
2022-04-19 07:21:30 +00:00
cherry530
d3eecd3790 upgrade 1.7.1
Signed-off-by: cherry530 <xuping33@huawei.com>
(cherry picked from commit 3430f5e169444a4fff5846589a3dae144e6f4fba)
2022-04-12 15:27:14 +08:00
7 changed files with 445 additions and 460 deletions

View File

@ -0,0 +1,311 @@
diff --git a/src/build/source_templates/compress.template b/src/build/source_templates/compress.template
index 32008e9..09a5df4 100644
--- a/src/build/source_templates/compress.template
+++ b/src/build/source_templates/compress.template
@@ -31,7 +31,6 @@
main:
while (true) {
- // find a match
int forwardOff = sOff;
int ref;
@@ -51,15 +50,12 @@
${type}Utils.writeShort(hashTable, h, sOff - srcOff);
} while (!LZ4${utils}.readIntEquals(src, ref, sOff));
- // catch up
final int excess = LZ4${utils}.commonBytesBackward(src, ref, sOff, srcOff, anchor);
sOff -= excess;
ref -= excess;
- // sequence == refsequence
final int runLen = sOff - anchor;
- // encode literal length
int tokenOff = dOff++;
if (dOff + runLen + (2 + 1 + LAST_LITERALS) + (runLen >>> 8) > destEnd) {
@@ -73,16 +69,13 @@
${utils}.writeByte(dest, tokenOff, runLen << ML_BITS);
}
- // copy literals
LZ4${utils}.wildArraycopy(src, anchor, dest, dOff, runLen);
dOff += runLen;
while (true) {
- // encode offset
${utils}.writeShortLE(dest, dOff, (short) (sOff - ref));
dOff += 2;
- // count nb matches
sOff += MIN_MATCH;
ref += MIN_MATCH;
final int matchLen = LZ4${utils}.commonBytes(src, ref, sOff, srcLimit);
@@ -91,7 +84,6 @@
}
sOff += matchLen;
- // encode match len
if (matchLen >= ML_MASK) {
${utils}.writeByte(dest, tokenOff, ${utils}.readByte(dest, tokenOff) | ML_MASK);
dOff = LZ4${utils}.writeLen(matchLen - ML_MASK, dest, dOff);
@@ -99,16 +91,13 @@
${utils}.writeByte(dest, tokenOff, ${utils}.readByte(dest, tokenOff) | matchLen);
}
- // test end of chunk
if (sOff > mflimit) {
anchor = sOff;
break main;
}
- // fill table
${type}Utils.writeShort(hashTable, hash64k(${utils}.readInt(src, sOff - 2)), sOff - 2 - srcOff);
- // test next position
final int h = hash64k(${utils}.readInt(src, sOff));
ref = srcOff + ${type}Utils.readShort(hashTable, h);
${type}Utils.writeShort(hashTable, h, sOff - srcOff);
@@ -121,7 +110,6 @@
${utils}.writeByte(dest, tokenOff, 0);
}
- // prepare next loop
anchor = sOff++;
}
}
@@ -160,7 +148,6 @@
main:
while (true) {
- // find a match
int forwardOff = sOff;
int ref;
@@ -187,10 +174,8 @@
sOff -= excess;
ref -= excess;
- // sequence == refsequence
final int runLen = sOff - anchor;
- // encode literal length
int tokenOff = dOff++;
if (dOff + runLen + (2 + 1 + LAST_LITERALS) + (runLen >>> 8) > destEnd) {
@@ -204,16 +189,13 @@
${utils}.writeByte(dest, tokenOff, runLen << ML_BITS);
}
- // copy literals
LZ4${utils}.wildArraycopy(src, anchor, dest, dOff, runLen);
dOff += runLen;
while (true) {
- // encode offset
${utils}.writeShortLE(dest, dOff, back);
dOff += 2;
- // count nb matches
sOff += MIN_MATCH;
final int matchLen = LZ4${utils}.commonBytes(src, ref + MIN_MATCH, sOff, srcLimit);
if (dOff + (1 + LAST_LITERALS) + (matchLen >>> 8) > destEnd) {
@@ -221,7 +203,6 @@
}
sOff += matchLen;
- // encode match len
if (matchLen >= ML_MASK) {
${utils}.writeByte(dest, tokenOff, ${utils}.readByte(dest, tokenOff) | ML_MASK);
dOff = LZ4${utils}.writeLen(matchLen - ML_MASK, dest, dOff);
@@ -229,16 +210,13 @@
${utils}.writeByte(dest, tokenOff, ${utils}.readByte(dest, tokenOff) | matchLen);
}
- // test end of chunk
if (sOff > mflimit) {
anchor = sOff;
break main;
}
- // fill table
${type}Utils.writeInt(hashTable, hash(${utils}.readInt(src, sOff - 2)), sOff - 2);
- // test next position
final int h = hash(${utils}.readInt(src, sOff));
ref = ${type}Utils.readInt(hashTable, h);
${type}Utils.writeInt(hashTable, h, sOff);
@@ -252,7 +230,6 @@
${utils}.writeByte(dest, tokenOff, 0);
}
- // prepare next loop
anchor = sOff++;
}
diff --git a/src/build/source_templates/compress_hc.template b/src/build/source_templates/compress_hc.template
index 7179db3..7976ad1 100644
--- a/src/build/source_templates/compress_hc.template
+++ b/src/build/source_templates/compress_hc.template
@@ -47,7 +47,6 @@
continue;
}
- // saved, in case we would skip too much
copyTo(match1, match0);
search2:
@@ -55,20 +54,19 @@
assert match1.start >= anchor;
if (match1.end() >= mfLimit
|| !ht.insertAndFindWiderMatch(src, match1.end() - 2, match1.start + 1, matchLimit, match1.len, match2)) {
- // no better match
dOff = LZ4${utils}.encodeSequence(src, anchor, match1.start, match1.ref, match1.len, dest, dOff, destEnd);
anchor = sOff = match1.end();
continue main;
}
if (match0.start < match1.start) {
- if (match2.start < match1.start + match0.len) { // empirical
+ if (match2.start < match1.start + match0.len) {
copyTo(match0, match1);
}
}
assert match2.start > match1.start;
- if (match2.start - match1.start < 3) { // First Match too small : removed
+ if (match2.start - match1.start < 3) {
copyTo(match2, match1);
continue search2;
}
@@ -91,21 +89,18 @@
if (match2.start + match2.len >= mfLimit
|| !ht.insertAndFindWiderMatch(src, match2.end() - 3, match2.start, matchLimit, match2.len, match3)) {
- // no better match -> 2 sequences to encode
if (match2.start < match1.end()) {
match1.len = match2.start - match1.start;
}
- // encode seq 1
dOff = LZ4${utils}.encodeSequence(src, anchor, match1.start, match1.ref, match1.len, dest, dOff, destEnd);
anchor = sOff = match1.end();
- // encode seq 2
dOff = LZ4${utils}.encodeSequence(src, anchor, match2.start, match2.ref, match2.len, dest, dOff, destEnd);
anchor = sOff = match2.end();
continue main;
}
- if (match3.start < match1.end() + 3) { // Not enough space for match 2 : remove it
- if (match3.start >= match1.end()) { // // can write Seq1 immediately ==> Seq2 is removed, so Seq3 becomes Seq1
+ if (match3.start < match1.end() + 3) {
+ if (match3.start >= match1.end()) {
if (match2.start < match1.end()) {
final int correction = match1.end() - match2.start;
match2.fix(correction);
@@ -127,7 +122,6 @@
continue search3;
}
- // OK, now we have 3 ascending matches; let's write at least the first one
if (match2.start < match1.end()) {
if (match2.start - match1.start < ML_MASK) {
if (match1.len > OPTIMAL_ML) {
diff --git a/src/build/source_templates/decompress.template b/src/build/source_templates/decompress.template
index f1c2890..1e2aa23 100644
--- a/src/build/source_templates/decompress.template
+++ b/src/build/source_templates/decompress.template
@@ -55,7 +55,6 @@
final int token = ${utils}.readByte(src, sOff) & 0xFF;
++sOff;
- // literals
int literalLen = token >>> ML_BITS;
if (literalLen == RUN_MASK) {
byte len = (byte) 0xFF;
@@ -81,7 +80,7 @@
LZ4${utils}.safeArraycopy(src, sOff, dest, dOff, literalLen);
sOff += literalLen;
dOff = literalCopyEnd;
- break; // EOF
+ break;
}
}
@@ -89,7 +88,6 @@
sOff += literalLen;
dOff = literalCopyEnd;
- // matchs
final int matchDec = ${utils}.readShortLE(src, sOff);
sOff += 2;
int matchOff = dOff - matchDec;
diff --git a/src/build/source_templates/hashtable.template b/src/build/source_templates/hashtable.template
index 174f8e8..91935f5 100644
--- a/src/build/source_templates/hashtable.template
+++ b/src/build/source_templates/hashtable.template
@@ -92,8 +92,8 @@
int ref = hashPointer(buf, off);
- if (ref >= off - 4 && ref <= off && ref >= base) { // potential repetition
- if (LZ4${utils}.readIntEquals(buf, ref, off)) { // confirmed
+ if (ref >= off - 4 && ref <= off && ref >= base) {
+ if (LZ4${utils}.readIntEquals(buf, ref, off)) {
delta = off - ref;
repl = match.len = MIN_MATCH + LZ4${utils}.commonBytes(buf, ref + MIN_MATCH, off + MIN_MATCH, matchLimit);
match.ref = ref;
@@ -119,7 +119,7 @@
int ptr = off;
final int end = off + repl - (MIN_MATCH - 1);
while (ptr < end - delta) {
- chainTable[ptr & MASK] = (short) delta; // pre load
+ chainTable[ptr & MASK] = (short) delta;
++ptr;
}
do {
diff --git a/src/build/source_templates/xxhash32_streaming.template b/src/build/source_templates/xxhash32_streaming.template
index 6166758..9fa55e8 100644
--- a/src/build/source_templates/xxhash32_streaming.template
+++ b/src/build/source_templates/xxhash32_streaming.template
@@ -66,7 +66,7 @@ final class StreamingXXHash32Java${type} extends AbstractStreamingXXHash32Java {
totalLen += len;
- if (memSize + len < 16) { // fill in tmp buffer
+ if (memSize + len < 16) {
System.arraycopy(buf, off, memory, memSize, len);
memSize += len;
return;
@@ -74,7 +74,7 @@ final class StreamingXXHash32Java${type} extends AbstractStreamingXXHash32Java {
final int end = off + len;
- if (memSize > 0) { // data left from previous update
+ if (memSize > 0) {
System.arraycopy(buf, off, memory, memSize, 16 - memSize);
v1 += readIntLE(memory, 0) * PRIME2;
diff --git a/src/build/source_templates/xxhash64_streaming.template b/src/build/source_templates/xxhash64_streaming.template
index 2789ae0..e781746 100644
--- a/src/build/source_templates/xxhash64_streaming.template
+++ b/src/build/source_templates/xxhash64_streaming.template
@@ -90,7 +90,7 @@ final class StreamingXXHash64Java${type} extends AbstractStreamingXXHash64Java {
totalLen += len;
- if (memSize + len < 32) { // fill in tmp buffer
+ if (memSize + len < 32) {
System.arraycopy(buf, off, memory, memSize, len);
memSize += len;
return;
@@ -98,7 +98,7 @@ final class StreamingXXHash64Java${type} extends AbstractStreamingXXHash64Java {
final int end = off + len;
- if (memSize > 0) { // data left from previous update
+ if (memSize > 0) {
System.arraycopy(buf, off, memory, memSize, 32 - memSize);
v1 += readLongLE(memory, 0) * PRIME64_2;

Binary file not shown.

BIN
1.8.0.tar.gz Normal file

Binary file not shown.

98
2-remove-cpptasks.patch Normal file
View File

@ -0,0 +1,98 @@
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..01934f1
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,33 @@
+CC = gcc
+
+BUILD_DIR = build
+OBJECTS_DIR = $(BUILD_DIR)/objects
+JNI_HEADERS_DIR = $(BUILD_DIR)/jni-headers
+JNI_SOURCES_DIR = src/jni
+INCLUDE = -I $(JAVA_HOME)/include -I $(JAVA_HOME)/include/linux
+
+LIBS = -llz4 -lxxhash
+JNI_PREFIX = net_jpountz_
+
+default: all move_objects generate_so
+
+all:
+ $(CC) -fPIC -I $(JNI_HEADERS_DIR) \
+ $(INCLUDE) \
+ $(LIBS) \
+ -c $(JNI_SOURCES_DIR)/$(JNI_PREFIX)lz4_LZ4JNI.c
+
+ $(CC) -fPIC -I $(JNI_HEADERS_DIR) \
+ $(INCLUDE) \
+ $(LIBS) \
+ -c $(JNI_SOURCES_DIR)/$(JNI_PREFIX)xxhash_XXHashJNI.c
+
+move_objects:
+ mv *.o $(OBJECTS_DIR)
+
+generate_so:
+ gcc -fPIC -shared \
+ $(OBJECTS_DIR)/*.o \
+ $(LIB_DIR)/liblz4.so \
+ $(LIB_DIR)/libxxhash.so \
+ -o $(BUILD_DIR)/jni/net/jpountz/util/$(PLATFORM)/$(ARCH)/liblz4-java.so
diff --git a/build.xml b/build.xml
index 1d4cff5..13d8ce3 100644
--- a/build.xml
+++ b/build.xml
@@ -13,7 +13,6 @@
-->
<project name="lz4" default="dist" basedir="."
- xmlns:cpptasks="antlib:net.sf.antcontrib.cpptasks"
xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:junit4="antlib:com.carrotsearch.junit4"
xmlns:mvn="antlib:org.apache.maven.artifact.ant">
@@ -78,13 +77,6 @@
<get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.jar.version}/${ivy.jar.name}" dest="${user.home}/.ant/lib/${ivy.jar.name}"/>
</target>
- <target name="install-cpptasks" unless="cpptasks.available">
- <ivy:cachepath organisation="ant-contrib" module="cpptasks" revision="1.0b5"
- inline="true" conf="default" transitive="true" pathid="cpptasks.classpath"/>
- <taskdef uri="antlib:net.sf.antcontrib.cpptasks" resource="net/sf/antcontrib/cpptasks/antlib.xml" classpathref="cpptasks.classpath"/>
- <property name="cpptasks.available" value="true"/>
- </target>
-
<target name="install-maven-ant-tasks" unless="maven-ant-tasks.available">
<ivy:cachepath organisation="org.apache.maven" module="maven-ant-tasks" revision="2.1.3"
inline="true" conf="default" transitive="true" pathid="maven-ant-tasks.classpath"/>
@@ -184,27 +176,13 @@
</javah>
</target>
- <target name="compile-jni" depends="install-cpptasks,generate-headers" unless="${skip.jni}">
+ <target name="compile-jni" depends="generate-headers" unless="${skip.jni}">
<mkdir dir="${build}/objects" />
<mkdir dir="${build}/jni/net/jpountz/util/${platform}/${os.arch}" />
- <cpptasks:cc
- debug="false"
- optimize="extreme"
- objdir="${build}/objects"
- outfile="${build}/jni/net/jpountz/util/${platform}/${os.arch}/lz4-java"
- outtype="shared">
- <includepath path="${src}/lz4/lib" />
- <includepath path="${java.home}/../include" />
- <includepath path="${java.home}/../include/${platform}/" />
- <!-- In Java 9, java.home points not to jre/ but to the top directory -->
- <includepath path="${java.home}/include" />
- <includepath path="${java.home}/include/${platform}/" />
- <includepath path="${build}/jni-headers" />
- <fileset dir="${src}/lz4/lib" includes="lz4.c, lz4hc.c, xxhash.c" />
- <fileset dir="${src}/jni" includes="*.c" />
- <linker />
- <compilerarg value="-mmacosx-version-min=10.9" if="isMacOS"/>
- </cpptasks:cc>
+ <exec executable="make" failonerror="true">
+ <env key="ARCH" value="${os.arch}"/>
+ <env key="PLATFORM" value="${platform}"/>
+ </exec>
</target>
<target name="compile" depends="compile-java, compile-jni" />

View File

@ -1,135 +0,0 @@
--- lz4-java-1.3.0/build.xml 2014-11-26 20:04:10.000000000 +0100
+++ lz4-java-1.3.0/build.xml.build 2015-07-21 15:15:49.041845748 +0200
@@ -15,8 +15,7 @@
<project name="lz4" default="dist" basedir="."
xmlns:cpptasks="antlib:net.sf.antcontrib.cpptasks"
xmlns:ivy="antlib:org.apache.ivy.ant"
- xmlns:junit4="antlib:com.carrotsearch.junit4"
- xmlns:mvn="antlib:org.apache.maven.artifact.ant">
+ xmlns:junit4="antlib:com.carrotsearch.junit4">
<property name="src" location="src"/>
<property name="build" location="build"/>
@@ -56,8 +55,6 @@
</target>
<target name="-ivy-install" unless="ivy.available">
- <mkdir dir="${user.home}/.ant/lib" />
- <get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.jar.version}/${ivy.jar.name}" dest="${user.home}/.ant/lib/${ivy.jar.name}"/>
</target>
<target name="install-cpptasks" unless="cpptasks.available">
@@ -68,10 +65,6 @@
</target>
<target name="install-maven-ant-tasks" unless="maven-ant-tasks.available">
- <ivy:cachepath organisation="org.apache.maven" module="maven-ant-tasks" revision="2.1.3"
- inline="true" conf="default" transitive="true" pathid="maven-ant-tasks.classpath"/>
- <taskdef uri="antlib:org.apache.maven.artifact.ant" resource="org/apache/maven/artifact/ant/antlib.xml" classpathref="maven-ant-tasks.classpath"/>
- <property name="maven-ant-tasks.available" value="true"/>
</target>
<target name="install-forbidden-apis" unless="forbidden-apis.available">
@@ -83,10 +76,6 @@
<target name="install-bnd" unless="bnd.available">
<!-- using bnd 1.50.0 because more recent versions have broken JAR wrapping -->
- <ivy:cachepath organisation="biz.aQute" module="bnd" revision="1.50.0"
- inline="true" conf="default" transitive="true" pathid="bnd.classpath"/>
- <taskdef resource="aQute/bnd/ant/taskdef.properties" classpathref="bnd.classpath"/>
- <property name="bnd.available" value="true"/>
</target>
<target name="init">
@@ -104,9 +93,15 @@
<property name="junit4.available" value="true" />
</target>
+ <path id="mvel.classpath">
+ <fileset dir="/usr/share/java">
+ <include name="mvel.jar"/>
+ <include name="objectweb-asm/asm.jar"/>
+ <include name="objectweb-asm/asm-util.jar"/>
+ </fileset>
+ </path>
+
<target name="generate-sources" depends="init">
- <ivy:cachepath organisation="org.mvel" module="mvel2" revision="2.1.5.Final"
- inline="true" conf="default" transitive="true" pathid="mvel.classpath"/>
<mkdir dir="${build}/java" />
<java
fork="true"
@@ -263,7 +258,9 @@
overview="${src}/java/overview.html"
packagenames="net.jpountz.lz4,net.jpountz.xxhash"
windowtitle="lz4 / xxhash - Java API ${ivy.revision}"
- destDir="${build}/docs">
+ destDir="${build}/docs"
+ encoding="UTF-8"
+ additionalparam="-Xdoclint:none">
<link href="http://download.oracle.com/javase/6/docs/api/" />
<sourcepath>
<pathelement location="${src}/java"/>
@@ -288,8 +285,12 @@
</jar>
</target>
- <target name="bundle" description="makes the JAR a valid OSGi bundle" depends="install-bnd, jar">
- <taskdef resource="aQute/bnd/ant/taskdef.properties" classpathref="bnd.classpath"/>
+ <target name="bundle" description="makes the JAR a valid OSGi bundle" depends="jar">
+ <taskdef resource="aQute/bnd/ant/taskdef.properties" >
+ <classpath>
+ <fileset dir="/usr/share/java/aqute-bnd"/>
+ </classpath>
+ </taskdef>
<property name="packages.version" value="${ivy.revision}"/>
<!-- We need to remove potential -SNAPSHOT qualifiers as package versions... -->
<script language="javascript">
@@ -319,7 +320,7 @@
<target name="dist" description="package" depends="bundle,docs,sources,makepom" />
- <target name="forbidden-apis" description="check API usage" depends="install-forbidden-apis,compile">
+ <target name="forbidden-apis" description="check API usage" depends="compile">
<forbidden-apis internalRuntimeForbidden="true" classpathref="forbidden-apis.classpath">
<bundledSignatures name="jdk-unsafe-${javac.target}"/>
<bundledSignatures name="jdk-deprecated-${javac.target}"/>
@@ -337,37 +338,21 @@
<attribute name="repositoryid" />
<attribute name="repositoryurl" />
<sequential>
- <mvn:mvn>
- <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.4:sign-and-deploy-file" />
- <arg value="-Durl=@{repositoryurl}" />
- <arg value="-DrepositoryId=@{repositoryid}" />
- <arg value="-DpomFile=${dist}/${ivy.module}-${ivy.revision}.pom" />
- <arg value="-Dfile=${dist}/${ivy.module}-${ivy.revision}.jar" />
- <arg value="-Dfiles=${dist}/${ivy.module}-${ivy.revision}-sources.jar,${dist}/${ivy.module}-${ivy.revision}-javadoc.jar" />
- <arg value="-Dclassifiers=sources,javadoc" />
- <arg value="-Dtypes=jar,jar" />
- <arg value="-Pgpg" />
- </mvn:mvn>
</sequential>
</macrodef>
<target name="deploy" description="deploy snapshot to snapshot repo" depends="install-maven-ant-tasks">
- <property name="skip.jni" value="true" />
- <antcall target="-deploy" />
</target>
<target name="-deploy" depends="clean,dist">
- <deploy repositoryid="sonatype-nexus-snapshots" repositoryurl="https://oss.sonatype.org/content/repositories/snapshots" />
</target>
<!-- before this, update project version from SNAPSHOT to RELEASE -->
<target name="stage" description="deploy to release repo" depends="install-maven-ant-tasks,test,forbidden-apis">
- <property name="skip.jni" value="true" />
- <antcall target="-stage" />
+
</target>
<target name="-stage" depends="clean,dist">
- <deploy repositoryid="sonatype-nexus-staging" repositoryurl="https://oss.sonatype.org/service/local/staging/deploy/maven2" />
</target>
</project>

View File

@ -1,301 +0,0 @@
diff -Nru lz4-java-1.3.0/src/test/net/jpountz/lz4/LZ4BlockStreamingTest.java lz4-java-1.3.0.junit.Assert/src/test/net/jpountz/lz4/LZ4BlockStreamingTest.java
--- lz4-java-1.3.0/src/test/net/jpountz/lz4/LZ4BlockStreamingTest.java 2014-11-26 20:04:10.000000000 +0100
+++ lz4-java-1.3.0.junit.Assert/src/test/net/jpountz/lz4/LZ4BlockStreamingTest.java 2016-05-03 17:08:40.285741530 +0200
@@ -207,11 +207,11 @@
final LZ4FastDecompressor decompressor = LZ4Factory.fastestInstance().fastDecompressor();
InputStream is = new LZ4BlockInputStream(open(compressed.toByteArray()), decompressor, checksum);
- assertFalse(is.markSupported());
+ org.junit.Assert.assertFalse(is.markSupported());
try {
is.mark(1);
is.reset();
- assertFalse(true);
+ org.junit.Assert.assertFalse(true);
} catch (IOException e) {
// OK
}
@@ -235,8 +235,8 @@
}
}
is.close();
- assertEquals(data.length, read);
- assertArrayEquals(data, Arrays.copyOf(restored, read));
+ org.junit.Assert.assertEquals(data.length, read);
+ org.junit.Assert.assertArrayEquals(data, Arrays.copyOf(restored, read));
// test skip
final int offset = data.length <= 1 ? 0 : randomInt(data.length - 1);
@@ -246,17 +246,17 @@
read = 0;
while (read < offset) {
final long skipped = is.skip(offset - read);
- assertTrue(skipped >= 0);
+ org.junit.Assert.assertTrue(skipped >= 0);
read += skipped;
}
read = 0;
while (read < length) {
final int r = is.read(restored, read, length - read);
- assertTrue(r >= 0);
+ org.junit.Assert.assertTrue(r >= 0);
read += r;
}
is.close();
- assertArrayEquals(Arrays.copyOfRange(data, offset, offset + length), Arrays.copyOfRange(restored, 0, length));
+ org.junit.Assert.assertArrayEquals(Arrays.copyOfRange(data, offset, offset + length), Arrays.copyOfRange(restored, 0, length));
}
@Test
@@ -288,7 +288,7 @@
byte[] actual = new byte[testBytes.length];
in.read(actual);
- assertArrayEquals(testBytes, actual);
+ org.junit.Assert.assertArrayEquals(testBytes, actual);
in.close();
in.close();
diff -Nru lz4-java-1.3.0/src/test/net/jpountz/lz4/LZ4Test.java lz4-java-1.3.0.junit.Assert/src/test/net/jpountz/lz4/LZ4Test.java
--- lz4-java-1.3.0/src/test/net/jpountz/lz4/LZ4Test.java 2014-11-26 20:04:10.000000000 +0100
+++ lz4-java-1.3.0.junit.Assert/src/test/net/jpountz/lz4/LZ4Test.java 2016-05-03 17:08:40.290743645 +0200
@@ -39,7 +39,7 @@
public void testMaxCompressedLength() {
final int len = randomBoolean() ? randomInt(16) : randomInt(1 << 30);
for (LZ4Compressor compressor : COMPRESSORS) {
- assertEquals(LZ4JNI.LZ4_compressBound(len), compressor.maxCompressedLength(len));
+ org.junit.Assert.assertEquals(LZ4JNI.LZ4_compressBound(len), compressor.maxCompressedLength(len));
}
}
@@ -75,8 +75,8 @@
byte[] compressed = getCompressedWorstCase(decompressed);
byte[] restored = new byte[decompressed.length];
int cpLen = decompressor.decompress(compressed, 0, restored, 0, decompressed.length);
- assertEquals(compressed.length, cpLen);
- assertArrayEquals(decompressed, restored);
+ org.junit.Assert.assertEquals(compressed.length, cpLen);
+ org.junit.Assert.assertArrayEquals(decompressed, restored);
}
@Test
@@ -93,8 +93,8 @@
byte[] compressed = getCompressedWorstCase(decompressed);
byte[] restored = new byte[decompressed.length];
int uncpLen = decompressor.decompress(compressed, 0, compressed.length, restored, 0);
- assertEquals(decompressed.length, uncpLen);
- assertArrayEquals(decompressed, restored);
+ org.junit.Assert.assertEquals(decompressed.length, uncpLen);
+ org.junit.Assert.assertArrayEquals(decompressed, restored);
}
@Test
@@ -130,8 +130,8 @@
final int compressedLen2 = tester.compress(compressor,
tester.copyOf(data), off, len,
compressed2, 0, compressedLen);
- assertEquals(compressedLen, compressedLen2);
- assertArrayEquals(
+ org.junit.Assert.assertEquals(compressedLen, compressedLen2);
+ org.junit.Assert.assertArrayEquals(
tester.copyOf(compressed, 0, compressedLen),
tester.copyOf(compressed2, 0, compressedLen));
@@ -141,21 +141,21 @@
tester.compress(compressor,
tester.copyOf(data), off, len,
compressed3, 0, compressedLen - 1);
- fail();
+ org.junit.Assert.fail();
} catch (LZ4Exception e) {
// OK
}
// test decompression
final T restored = tester.allocate(len);
- assertEquals(compressedLen, tester.decompress(decompressor, compressed, 0, restored, 0, len));
- assertArrayEquals(Arrays.copyOfRange(data, off, off + len), tester.copyOf(restored, 0, len));
+ org.junit.Assert.assertEquals(compressedLen, tester.decompress(decompressor, compressed, 0, restored, 0, len));
+ org.junit.Assert.assertArrayEquals(Arrays.copyOfRange(data, off, off + len), tester.copyOf(restored, 0, len));
if (len > 0) {
// dest is too small
try {
tester.decompress(decompressor, compressed, 0, restored, 0, len - 1);
- fail();
+ org.junit.Assert.fail();
} catch (LZ4Exception e) {
// OK
}
@@ -165,7 +165,7 @@
final T restored2 = tester.allocate(len+1);
try {
final int cpLen = tester.decompress(decompressor, compressed, 0, restored2, 0, len + 1);
- fail("compressedLen=" + cpLen);
+ org.junit.Assert.fail("compressedLen=" + cpLen);
} catch (LZ4Exception e) {
// OK
}
@@ -173,16 +173,16 @@
// try decompression when only the size of the compressed buffer is known
if (len > 0) {
tester.fill(restored, randomByte());
- assertEquals(len, tester.decompress(decompressor2, compressed, 0, compressedLen, restored, 0, len));
+ org.junit.Assert.assertEquals(len, tester.decompress(decompressor2, compressed, 0, compressedLen, restored, 0, len));
tester.fill(restored, randomByte());
} else {
- assertEquals(0, tester.decompress(decompressor2, compressed, 0, compressedLen, tester.allocate(1), 0, 1));
+ org.junit.Assert.assertEquals(0, tester.decompress(decompressor2, compressed, 0, compressedLen, tester.allocate(1), 0, 1));
}
// over-estimated compressed length
try {
final int decompressedLen = tester.decompress(decompressor2, compressed, 0, compressedLen + 1, tester.allocate(len + 100), 0, len + 100);
- fail("decompressedLen=" + decompressedLen);
+ org.junit.Assert.fail("decompressedLen=" + decompressedLen);
} catch (LZ4Exception e) {
// OK
}
@@ -191,7 +191,7 @@
try {
final int decompressedLen = tester.decompress(decompressor2, compressed, 0, compressedLen - 1, tester.allocate(len + 100), 0, len + 100);
if (!(decompressor2 instanceof LZ4JNISafeDecompressor)) {
- fail("decompressedLen=" + decompressedLen);
+ org.junit.Assert.fail("decompressedLen=" + decompressedLen);
}
} catch (LZ4Exception e) {
// OK
@@ -278,7 +278,7 @@
try {
// it is invalid to end with a match, should be at least 5 literals
decompressor.decompress(invalid, 0, new byte[decompressedLength], 0, decompressedLength);
- assertTrue(decompressor.toString(), false);
+ org.junit.Assert.assertTrue(decompressor.toString(), false);
} catch (LZ4Exception e) {
// OK
}
@@ -288,7 +288,7 @@
try {
// it is invalid to end with a match, should be at least 5 literals
decompressor.decompress(invalid, 0, invalid.length, new byte[20], 0);
- assertTrue(false);
+ org.junit.Assert.assertTrue(false);
} catch (LZ4Exception e) {
// OK
}
@@ -308,7 +308,7 @@
try {
// it is invalid to end with a match, should be at least 5 literals
decompressor.decompress(invalid, 0, new byte[20], 0, 20);
- assertTrue(decompressor.toString(), false);
+ org.junit.Assert.assertTrue(decompressor.toString(), false);
} catch (LZ4Exception e) {
// OK
}
@@ -318,7 +318,7 @@
try {
// it is invalid to end with a match, should be at least 5 literals
decompressor.decompress(invalid, 0, invalid.length, new byte[20], 0);
- assertTrue(false);
+ org.junit.Assert.assertTrue(false);
} catch (LZ4Exception e) {
// OK
}
@@ -333,7 +333,7 @@
ByteBuffer out = Tester.BYTE_BUFFER.allocate(100).asReadOnlyBuffer();
try {
compressor.compress(in, out);
- fail();
+ org.junit.Assert.fail();
} catch (ReadOnlyBufferException e) {
// ok
}
@@ -343,7 +343,7 @@
ByteBuffer out = Tester.BYTE_BUFFER.allocate(100).asReadOnlyBuffer();
try {
decompressor.decompress(in, out);
- fail();
+ org.junit.Assert.fail();
} catch (ReadOnlyBufferException e) {
// ok
}
@@ -354,7 +354,7 @@
out.limit(2);
try {
decompressor.decompress(in, out);
- fail();
+ org.junit.Assert.fail();
} catch (ReadOnlyBufferException e) {
// ok
}
@@ -457,7 +457,7 @@
}
final Sequence sequence1 = readSequence(expected, off);
final Sequence sequence2 = readSequence(actual, off);
- assertEquals(message + ", off=" + off + ", decompressedOff=" + decompressedOff, sequence1, sequence2);
+ org.junit.Assert.assertEquals(message + ", off=" + off + ", decompressedOff=" + decompressedOff, sequence1, sequence2);
off += sequence1.length;
decompressedOff += sequence1.literalLen + sequence1.matchLen;
}
diff -Nru lz4-java-1.3.0/src/test/net/jpountz/xxhash/XXHash32Test.java lz4-java-1.3.0.junit.Assert/src/test/net/jpountz/xxhash/XXHash32Test.java
--- lz4-java-1.3.0/src/test/net/jpountz/xxhash/XXHash32Test.java 2014-11-26 20:04:10.000000000 +0100
+++ lz4-java-1.3.0.junit.Assert/src/test/net/jpountz/xxhash/XXHash32Test.java 2016-05-03 17:08:40.278738569 +0200
@@ -129,12 +129,12 @@
final int ref = XXHashFactory.nativeInstance().hash32().hash(buf, off, len, seed);
for (XXHash32 hash : INSTANCES) {
final int h = hash.hash(buf, off, len, seed);
- assertEquals(hash.toString(), ref, h);
+ org.junit.Assert.assertEquals(hash.toString(), ref, h);
final ByteBuffer copy = copyOf(buf, off, len);
final int h2 = hash.hash(copy, off, len, seed);
- assertEquals(off, copy.position());
- assertEquals(len, copy.remaining());
- assertEquals(hash.toString(), ref, h2);
+ org.junit.Assert.assertEquals(off, copy.position());
+ org.junit.Assert.assertEquals(len, copy.remaining());
+ org.junit.Assert.assertEquals(hash.toString(), ref, h2);
}
}
@@ -155,8 +155,8 @@
hash1.update(bytes, off, len);
hash2.update(bytes, off, len);
hash3.update(bytes, off, len);
- assertEquals(hash2.toString() + " " + totalLen, hash1.getValue(), hash2.getValue());
- assertEquals(hash3.toString() + " " + totalLen, hash1.getValue(), hash3.getValue());
+ org.junit.Assert.assertEquals(hash2.toString() + " " + totalLen, hash1.getValue(), hash2.getValue());
+ org.junit.Assert.assertEquals(hash3.toString() + " " + totalLen, hash1.getValue(), hash3.getValue());
totalLen += len;
}
}
diff -Nru lz4-java-1.3.0/src/test/net/jpountz/xxhash/XXHash64Test.java lz4-java-1.3.0.junit.Assert/src/test/net/jpountz/xxhash/XXHash64Test.java
--- lz4-java-1.3.0/src/test/net/jpountz/xxhash/XXHash64Test.java 2014-11-26 20:04:10.000000000 +0100
+++ lz4-java-1.3.0.junit.Assert/src/test/net/jpountz/xxhash/XXHash64Test.java 2016-05-03 17:08:40.278738569 +0200
@@ -134,12 +134,12 @@
final long ref = XXHashFactory.nativeInstance().hash64().hash(buf, off, len, seed);
for (XXHash64 hash : INSTANCES) {
final long h = hash.hash(buf, off, len, seed);
- assertEquals(hash.toString(), ref, h);
+ org.junit.Assert.assertEquals(hash.toString(), ref, h);
final ByteBuffer copy = copyOf(buf, off, len);
final long h2 = hash.hash(copy, off, len, seed);
- assertEquals(off, copy.position());
- assertEquals(len, copy.remaining());
- assertEquals(hash.toString(), ref, h2);
+ org.junit.Assert.assertEquals(off, copy.position());
+ org.junit.Assert.assertEquals(len, copy.remaining());
+ org.junit.Assert.assertEquals(hash.toString(), ref, h2);
}
}
@@ -160,8 +160,8 @@
hash1.update(bytes, off, len);
hash2.update(bytes, off, len);
hash3.update(bytes, off, len);
- assertEquals(hash2.toString() + " " + totalLen, hash1.getValue(), hash2.getValue());
- assertEquals(hash3.toString() + " " + totalLen, hash1.getValue(), hash3.getValue());
+ org.junit.Assert.assertEquals(hash2.toString() + " " + totalLen, hash1.getValue(), hash2.getValue());
+ org.junit.Assert.assertEquals(hash3.toString() + " " + totalLen, hash1.getValue(), hash3.getValue());
totalLen += len;
}
}

View File

@ -1,16 +1,18 @@
%global debug_package %nil
%global build_opts -Doffline=true -Divy.mode=local -Divysettings.xml=/etc/ivy/ivysettings.xml -Divy.revision=%{version}
Name: lz4-java
Version: 1.3.0
Version: 1.8.0
Release: 2
Summary: LZ4 compression for Java
License: ASL 2.0 and (BSD and GPLv2+)
License: Apache-2.0
URL: https://github.com/jpountz/lz4-java
Source0: https://github.com/jpountz/lz4-java/archive/%{version}.tar.gz
Patch0: lz4-java-1.3.0-build.patch
Patch1: lz4-java-1.3.0-junit_Assert.patch
BuildRequires: ant ant-junit aqute-bnd cpptasks ivy-local java-devel javapackages-local mvel gcc
BuildRequires: objectweb-asm randomizedtesting-junit4-ant bea-stax-api xerces-j2 apache-parent
Patch1: 1-remove-comments-from-templates.patch
Patch2: 2-remove-cpptasks.patch
BuildRequires: java-devel >= 1:11.0.0
BuildRequires: ant ant-junit aqute-bnd cpptasks ivy-local javapackages-local mvel gcc xxhash-devel
BuildRequires: objectweb-asm randomizedtesting-junit4-ant bea-stax-api xerces-j2 apache-parent lz4 lz4-devel
Requires: javapackages-tools
Provides: bundled(lz4) = r122
Provides: bundled(libxxhash) = r37
%description
@ -39,38 +41,48 @@ BuildArch: noarch
This package contains javadoc for %{name}.
%prep
%setup -q -n %{name}-%{version}
%autosetup -n %{name}-%{version} -p1
find -name '*.dylib' -print -delete
find -name '*.so' -print -delete
%patch0 -p1
%patch1 -p1
cp -p src/xxhash/LICENSE LICENSE.xxhash
cp -p src/lz4/LICENSE lz4_LICENSE
echo "Export-Package: net.jpountz.*,!linux.*" >> lz4.bnd
sed -i '/packages.version/d' lz4.bnd
%build
ant %build_opts -Divy.pom.version=%{version} jar docs makepom
bnd wrap -p lz4.bnd -o dist/lz4-%{version}.jar --version %{version} dist/lz4.jar
pushd /usr/lib/jvm
dirname=`ls | grep java-11-openjdk-`
javapath=/usr/lib/jvm/$dirname
popd
export JAVA_HOME=$javapath
export LIB_DIR=/usr/lib64/
sed -i '$a\ strip $(BUILD_DIR)/jni/net/jpountz/util/$(PLATFORM)/$(ARCH)/liblz4-java.so' Makefile
ant -Divy.mode=local -Divy.revision=%{version} -Divy.pom.version=%{version} jar test docs makepom
bnd wrap -p lz4-java.bnd -o dist/lz4-java-%{version}.jar --version %{version} dist/lz4-java.jar
%install
%mvn_file net.jpountz.lz4:lz4 lz4
%mvn_artifact dist/lz4-%{version}.pom dist/lz4-%{version}.jar
%mvn_artifact dist/lz4-java-%{version}.pom dist/lz4-java-%{version}.jar
%mvn_install -J build/docs
%ifnarch %{arm} aarch64 ppc64
%check
ant %build_opts test
%endif
%files -f .mfiles
%doc CHANGES.md README.md
%license LICENSE.txt LICENSE.xxhash lz4_LICENSE
%license LICENSE.txt
%files javadoc -f .mfiles-javadoc
%license LICENSE.txt
%changelog
* Thu Feb 22 2024 zke_012020 <keer.oerv@isrc.iscas.ac.cn> - 1.8.0-2
- Upgrade JDK version to 11
* Thu Jul 27 2023 chenchen <chen_aka_jan@163.com> - 1.8.0-1
- Upgrade version to 1.8.0
* Fri Mar 3 2023 caodongxia <caodongxia@h-partners.com> - 1.7.1-3
- Fix not stripped problem
* Tue May 10 2022 wangkai <wangkai385@h-partners.com> - 1.7.1-2
- License compliance rectification
* Tue Jan 18 2022 SimpleUpdate Robot <tc@openeuler.org> - 1.7.1-1
- Upgrade to version 1.7.1
* Wed Jun 09 2021 wulei <wulei80@huawei.com> - 1.3.0-2
- fixes failed: Could not launch gcc