From c6cb018707b0c7a081374e6674a1c10679fc389a Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Apr 23 2015 08:11:02 +0000 Subject: import rh-java-common-hawtjni-1.6-9.12.el7 --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f502e7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/hawtjni-1.6.tar.xz diff --git a/.rh-java-common-hawtjni.metadata b/.rh-java-common-hawtjni.metadata new file mode 100644 index 0000000..b328c30 --- /dev/null +++ b/.rh-java-common-hawtjni.metadata @@ -0,0 +1 @@ +f780f4b12f1f37e217dc69a99b86b950569dd2dc SOURCES/hawtjni-1.6.tar.xz diff --git a/README.md b/README.md deleted file mode 100644 index 98f42b4..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/0001-Fix-shading-and-remove-unneeded-modules.patch b/SOURCES/0001-Fix-shading-and-remove-unneeded-modules.patch new file mode 100644 index 0000000..1a08e02 --- /dev/null +++ b/SOURCES/0001-Fix-shading-and-remove-unneeded-modules.patch @@ -0,0 +1,85 @@ +From 226e8614bd078479c3f99712f63f6dfbf1c46b0c Mon Sep 17 00:00:00 2001 +From: Stanislav Ochotnicky +Date: Thu, 19 Jan 2012 17:12:16 +0100 +Subject: [PATCH 1/3] Fix shading and remove unneeded modules + +--- + hawtjni-generator/pom.xml | 28 ---------------------------- + maven-hawtjni-plugin/pom.xml | 7 +++++++ + pom.xml | 2 -- + 3 files changed, 7 insertions(+), 30 deletions(-) + +diff --git a/hawtjni-generator/pom.xml b/hawtjni-generator/pom.xml +index fac8cc2..35b8aaa 100644 +--- a/hawtjni-generator/pom.xml ++++ b/hawtjni-generator/pom.xml +@@ -68,32 +68,4 @@ + + + +- +- +- +- +- +- org.apache.maven.plugins +- maven-shade-plugin +- 1.3 +- +- +- package +- +- shade +- +- +- +- +- junit:junit +- +- +- +- +- +- +- +- +- +- + +diff --git a/maven-hawtjni-plugin/pom.xml b/maven-hawtjni-plugin/pom.xml +index 8ef99be..c0f4109 100644 +--- a/maven-hawtjni-plugin/pom.xml ++++ b/maven-hawtjni-plugin/pom.xml +@@ -74,9 +74,16 @@ + + + org.apache.maven ++ maven-compat ++ 3.0.3 ++ ++ ++ ++ org.apache.maven + maven-artifact-manager + 2.0 + ++ + + org.apache.maven + maven-artifact +diff --git a/pom.xml b/pom.xml +index fe2e17b..dfad938 100644 +--- a/pom.xml ++++ b/pom.xml +@@ -210,8 +210,6 @@ + hawtjni-runtime + hawtjni-generator + maven-hawtjni-plugin +- hawtjni-example +- hawtjni-website + + + +-- +1.7.7.4 + diff --git a/SOURCES/0002-Fix-xbean-compatibility.patch b/SOURCES/0002-Fix-xbean-compatibility.patch new file mode 100644 index 0000000..e0286d0 --- /dev/null +++ b/SOURCES/0002-Fix-xbean-compatibility.patch @@ -0,0 +1,25 @@ +From 6ffdfd242299afb283d619c8ff9d5ce96853f160 Mon Sep 17 00:00:00 2001 +From: Stanislav Ochotnicky +Date: Thu, 19 Jan 2012 17:12:42 +0100 +Subject: [PATCH 2/3] Fix xbean compatibility + +--- + .../org/fusesource/hawtjni/generator/HawtJNI.java | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/hawtjni-generator/src/main/java/org/fusesource/hawtjni/generator/HawtJNI.java b/hawtjni-generator/src/main/java/org/fusesource/hawtjni/generator/HawtJNI.java +index b4727c2..bf710eb 100755 +--- a/hawtjni-generator/src/main/java/org/fusesource/hawtjni/generator/HawtJNI.java ++++ b/hawtjni-generator/src/main/java/org/fusesource/hawtjni/generator/HawtJNI.java +@@ -402,7 +402,7 @@ public class HawtJNI { + + @SuppressWarnings("unchecked") + private void collectMatchingClasses(ClassFinder finder, Class annotation, LinkedHashSet> collector) { +- List annotated = finder.findAnnotatedClasses(annotation); ++ List> annotated = finder.findAnnotatedClasses(annotation); + for (Class clazz : annotated) { + if( packages.isEmpty() ) { + collector.add(clazz); +-- +1.7.7.4 + diff --git a/SOURCES/0003-Remove-plexus-maven-plugin-dependency.patch b/SOURCES/0003-Remove-plexus-maven-plugin-dependency.patch new file mode 100644 index 0000000..bdf6336 --- /dev/null +++ b/SOURCES/0003-Remove-plexus-maven-plugin-dependency.patch @@ -0,0 +1,32 @@ +From 61963f6f7827459c551a03985e273d5feb65e55c Mon Sep 17 00:00:00 2001 +From: Stanislav Ochotnicky +Date: Thu, 19 Jan 2012 17:13:50 +0100 +Subject: [PATCH 3/3] Remove plexus-maven-plugin dependency + +--- + maven-hawtjni-plugin/pom.xml | 6 +++--- + 1 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/maven-hawtjni-plugin/pom.xml b/maven-hawtjni-plugin/pom.xml +index c0f4109..efdd192 100644 +--- a/maven-hawtjni-plugin/pom.xml ++++ b/maven-hawtjni-plugin/pom.xml +@@ -139,12 +139,12 @@ + + + org.codehaus.plexus +- plexus-maven-plugin +- 1.3.8 ++ plexus-component-metadata ++ 1.5.5 + + + +- descriptor ++ generate-metadata + + + +-- +1.7.7.4 + diff --git a/SOURCES/0004-Remove-eclipse-plugin.patch b/SOURCES/0004-Remove-eclipse-plugin.patch new file mode 100644 index 0000000..5cd63a9 --- /dev/null +++ b/SOURCES/0004-Remove-eclipse-plugin.patch @@ -0,0 +1,33 @@ +From 2d5b5a47b8b4eccaa053261728b438966bf6c44f Mon Sep 17 00:00:00 2001 +From: Stanislav Ochotnicky +Date: Wed, 18 Apr 2012 18:24:31 +0200 +Subject: [PATCH 4/4] Remove eclipse plugin + +--- + pom.xml | 10 ---------- + 1 files changed, 0 insertions(+), 10 deletions(-) + +diff --git a/pom.xml b/pom.xml +index dfad938..40cab61 100644 +--- a/pom.xml ++++ b/pom.xml +@@ -132,16 +132,6 @@ + + + org.apache.maven.plugins +- maven-eclipse-plugin +- 2.5.1 +- +- true +- true +- +- +- +- +- org.apache.maven.plugins + maven-surefire-plugin + 2.4.3 + +-- +1.7.7.6 + diff --git a/SOURCES/0005-Should-fix-issue-7.-We-now-do-a-write-barrier-before.patch b/SOURCES/0005-Should-fix-issue-7.-We-now-do-a-write-barrier-before.patch new file mode 100644 index 0000000..82dc7e8 --- /dev/null +++ b/SOURCES/0005-Should-fix-issue-7.-We-now-do-a-write-barrier-before.patch @@ -0,0 +1,58 @@ +From 7c6b1e1f5ed08361d3926e672a5a5129ee51c6d3 Mon Sep 17 00:00:00 2001 +From: Hiram Chirino +Date: Mon, 9 Sep 2013 11:31:08 -0400 +Subject: [PATCH 5/5] Should fix issue #7. We now do a write barrier before + setting the 'cached' field to 1 so that reader don't see this get re-ordered + before all the fields are readable. + +--- + .../hawtjni/generator/StructsGenerator.java | 2 ++ + hawtjni-generator/src/main/resources/hawtjni.h | 19 +++++++++++++++++++ + 2 files changed, 21 insertions(+) + +diff --git a/hawtjni-generator/src/main/java/org/fusesource/hawtjni/generator/StructsGenerator.java b/hawtjni-generator/src/main/java/org/fusesource/hawtjni/generator/StructsGenerator.java +index d8d591e..c12063c 100755 +--- a/hawtjni-generator/src/main/java/org/fusesource/hawtjni/generator/StructsGenerator.java ++++ b/hawtjni-generator/src/main/java/org/fusesource/hawtjni/generator/StructsGenerator.java +@@ -240,6 +240,8 @@ public class StructsGenerator extends JNIGenerator { + output("\""); + outputln(");"); + } ++ // Makes sure compiler/cpu does not reorder the following write before the previous updates are done. ++ outputln("\thawtjni_w_barrier();"); + output("\t"); + output(simpleName); + outputln("Fc.cached = 1;"); +diff --git a/hawtjni-generator/src/main/resources/hawtjni.h b/hawtjni-generator/src/main/resources/hawtjni.h +index 79ae703..c8ba601 100755 +--- a/hawtjni-generator/src/main/resources/hawtjni.h ++++ b/hawtjni-generator/src/main/resources/hawtjni.h +@@ -168,6 +168,25 @@ void throwOutOfMemory(JNIEnv *env); + #endif + #endif /* JNI64 */ + ++#ifdef __GNUC__ ++ #define hawtjni_w_barrier() __sync_synchronize() ++#elif defined(SOLARIS2) && SOLARIS2 >= 10 ++ #include ++ #define hawtjni_w_barrier() __machine_w_barrier() ++#elif defined(__APPLE__) ++ #include ++ #define hawtjni_w_barrier() OSMemoryBarrier() ++#elif defined(_WIN32) || defined(_WIN64) ++ #include ++ #define hawtjni_w_barrier() _mm_sfence(); _WriteBarrier() ++#else ++ #pragma message ( "Don't know how to do a memory barrier on this platform" ) ++ #define hawtjni_w_barrier() ++#endif ++ ++void hawtjni_atomic_set(jlong *target, jlong value); ++jlong hawtjni_atomic_get(jlong *target); ++ + #ifdef __cplusplus + } + #endif +-- +1.8.1.4 + diff --git a/SOURCES/0006-Simplify-shared-lib-extraction.patch b/SOURCES/0006-Simplify-shared-lib-extraction.patch new file mode 100644 index 0000000..8e0d66a --- /dev/null +++ b/SOURCES/0006-Simplify-shared-lib-extraction.patch @@ -0,0 +1,153 @@ +From 3ea58b7374f5451e693f09f9295e210006d1e7ff Mon Sep 17 00:00:00 2001 +From: Hiram Chirino +Date: Mon, 6 May 2013 09:49:55 -0400 +Subject: [PATCH 6/6] Simplify shared lib extraction. + +--- + .../org/fusesource/hawtjni/runtime/Library.java | 79 ++++++++-------------- + 1 file changed, 29 insertions(+), 50 deletions(-) + +diff --git a/hawtjni-runtime/src/main/java/org/fusesource/hawtjni/runtime/Library.java b/hawtjni-runtime/src/main/java/org/fusesource/hawtjni/runtime/Library.java +index c23081d..422bd2f 100755 +--- a/hawtjni-runtime/src/main/java/org/fusesource/hawtjni/runtime/Library.java ++++ b/hawtjni-runtime/src/main/java/org/fusesource/hawtjni/runtime/Library.java +@@ -9,13 +9,11 @@ + *******************************************************************************/ + package org.fusesource.hawtjni.runtime; + +-import java.io.File; +-import java.io.FileOutputStream; +-import java.io.IOException; +-import java.io.InputStream; ++import java.io.*; + import java.net.MalformedURLException; + import java.net.URL; + import java.util.ArrayList; ++import java.util.Random; + import java.util.regex.Pattern; + + /** +@@ -206,16 +204,19 @@ public class Library { + private boolean exractAndLoad(ArrayList errors, String version, String customPath, String resourcePath) { + URL resource = classLoader.getResource(resourcePath); + if( resource !=null ) { +- ++ + String libName = name + "-" + getBitModel(); + if( version !=null) { + libName += "-" + version; + } +- ++ String []libNameParts = map(libName).split("\\."); ++ String prefix = libNameParts[0]+"-"; ++ String suffix = "."+libNameParts[1]; ++ + if( customPath!=null ) { + // Try to extract it to the custom path... +- File target = file(customPath, map(libName)); +- if( extract(errors, resource, target) ) { ++ File target = extract(errors, resource, prefix, suffix, file(customPath)); ++ if( target!=null ) { + if( load(errors, target) ) { + return true; + } +@@ -224,8 +225,8 @@ public class Library { + + // Fall back to extracting to the tmp dir + customPath = System.getProperty("java.io.tmpdir"); +- File target = file(customPath, map(libName)); +- if( extract(errors, resource, target) ) { ++ File target = extract(errors, resource, prefix, suffix, file(customPath)); ++ if( target!=null ) { + if( load(errors, target) ) { + return true; + } +@@ -259,67 +260,45 @@ public class Library { + return libName; + } + +- private boolean extract(ArrayList errors, URL source, File target) { +- FileOutputStream os = null; +- InputStream is = null; +- boolean extracting = false; ++ private File extract(ArrayList errors, URL source, String prefix, String suffix, File directory) { ++ File target = null; + try { +- if (!target.exists() || isStale(source, target) ) { ++ FileOutputStream os = null; ++ InputStream is = null; ++ try { ++ target = File.createTempFile(prefix, suffix, directory); + is = source.openStream(); + if (is != null) { + byte[] buffer = new byte[4096]; + os = new FileOutputStream(target); +- extracting = true; + int read; + while ((read = is.read(buffer)) != -1) { + os.write(buffer, 0, read); + } +- os.close(); +- is.close(); + chmod("755", target); + } ++ target.deleteOnExit(); ++ return target; ++ } finally { ++ close(os); ++ close(is); + } + } catch (Throwable e) { +- try { +- if (os != null) +- os.close(); +- } catch (IOException e1) { +- } +- try { +- if (is != null) +- is.close(); +- } catch (IOException e1) { +- } +- if (extracting && target.exists()) ++ if( target!=null ) { + target.delete(); ++ } + errors.add(e.getMessage()); +- return false; + } +- return true; ++ return null; + } + +- private boolean isStale(URL source, File target) { +- +- if( source.getProtocol().equals("jar") ) { +- // unwrap the jar protocol... ++ static private void close(Closeable file) { ++ if(file!=null) { + try { +- String parts[] = source.getFile().split(Pattern.quote("!")); +- source = new URL(parts[0]); +- } catch (MalformedURLException e) { +- return false; +- } +- } +- +- File sourceFile=null; +- if( source.getProtocol().equals("file") ) { +- sourceFile = new File(source.getFile()); +- } +- if( sourceFile!=null && sourceFile.exists() ) { +- if( sourceFile.lastModified() > target.lastModified() ) { +- return true; ++ file.close(); ++ } catch (Exception ignore) { + } + } +- return false; + } + + private void chmod(String permision, File path) { +-- +1.8.1.4 + diff --git a/SPECS/hawtjni.spec b/SPECS/hawtjni.spec new file mode 100644 index 0000000..9eb5152 --- /dev/null +++ b/SPECS/hawtjni.spec @@ -0,0 +1,192 @@ +%global pkg_name hawtjni +%{?scl:%scl_package %{pkg_name}} +%{?java_common_find_provides_and_requires} + +Name: %{?scl_prefix}%{pkg_name} +Version: 1.6 +Release: 9.12%{?dist} +Summary: Code generator that produces the JNI code +License: ASL 2.0 and EPL and BSD +URL: http://hawtjni.fusesource.org/ +BuildArch: noarch + +# git clone git://github.com/fusesource/hawtjni.git +# cd hawtjni && git archive --format=tar --prefix=hawtjni-1.6/ hawtjni-project-1.6 | xz > hawtjni-1.6.tar.xz +Source0: %{pkg_name}-%{version}.tar.xz +Patch0: 0001-Fix-shading-and-remove-unneeded-modules.patch +Patch1: 0002-Fix-xbean-compatibility.patch +Patch2: 0003-Remove-plexus-maven-plugin-dependency.patch +Patch3: 0004-Remove-eclipse-plugin.patch +# From upstream commit d9cd0ab +Patch4: 0005-Should-fix-issue-7.-We-now-do-a-write-barrier-before.patch +# From upstream commit 92c2661 +Patch5: 0006-Simplify-shared-lib-extraction.patch + +BuildRequires: %{?scl_prefix}maven-local +BuildRequires: %{?scl_prefix_maven}maven-plugin-plugin +BuildRequires: %{?scl_prefix_maven}maven-surefire-report-plugin +BuildRequires: %{?scl_prefix_maven}maven-project-info-reports-plugin +BuildRequires: %{?scl_prefix_maven}maven-plugin-jxr +BuildRequires: %{?scl_prefix_maven}plexus-containers-component-metadata +BuildRequires: %{?scl_prefix}log4j +BuildRequires: %{?scl_prefix_maven}fusesource-pom +BuildRequires: %{?scl_prefix_maven}felix-parent +BuildRequires: %{?scl_prefix}xbean + +%description +HawtJNI is a code generator that produces the JNI code needed to +implement java native methods. It is based on the jnigen code generator +that is part of the SWT Tools project which is used to generate all the +JNI code which powers the eclipse platform. + +%package javadoc +Summary: Javadocs for %{pkg_name} + +%description javadoc +This package contains the API documentation for %{pkg_name}. + +%package -n %{?scl_prefix}maven-%{pkg_name}-plugin +Summary: Use HawtJNI from a maven plugin + +%description -n %{?scl_prefix}maven-%{pkg_name}-plugin +This package allows to use HawtJNI from a maven plugin. + +%prep +%setup -q -n %{pkg_name}-%{version} +%{?scl:scl enable %{scl_maven} %{scl} - <<"EOF"} +set -e -x +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%mvn_file ":{*}" @1 +%mvn_package ":*{plugin}" @1 +%{?scl:EOF} + +%build +%{?scl:scl enable %{scl_maven} %{scl} - <<"EOF"} +set -e -x +%mvn_build +%{?scl:EOF} + +%install +%{?scl:scl enable %{scl_maven} %{scl} - <<"EOF"} +set -e -x +%mvn_install +%{?scl:EOF} + +%files -f .mfiles +%doc readme.md license.txt changelog.md + +%files javadoc -f .mfiles-javadoc +%doc license.txt + +%files -n %{?scl_prefix}maven-%{pkg_name}-plugin -f .mfiles-plugin +%doc license.txt + +%changelog +* Tue Jan 13 2015 Michael Simacek - 1.6-9.12 +- Mass rebuild 2015-01-13 + +* Mon Jan 12 2015 Michael Simacek - 1.6-9.11 +- Rebuild to regenerate requires + +* Fri Jan 09 2015 Michal Srb - 1.6-9.10 +- Mass rebuild 2015-01-09 + +* Tue Dec 16 2014 Mikolaj Izdebski - 1.6-9.9 +- Migrate requires and build-requires to rh-java-common + +* Mon Dec 15 2014 Mikolaj Izdebski - 1.6-9.8 +- Mass rebuild 2014-12-15 + +* Mon Dec 15 2014 Mikolaj Izdebski - 1.6-9.7 +- Rebuild for rh-java-common collection + +* Mon May 26 2014 Mikolaj Izdebski - 1.6-9.6 +- Mass rebuild 2014-05-26 + +* Wed Feb 19 2014 Mikolaj Izdebski - 1.6-9.5 +- Mass rebuild 2014-02-19 + +* Tue Feb 18 2014 Mikolaj Izdebski - 1.6-9.4 +- Mass rebuild 2014-02-18 + +* Fri Feb 14 2014 Michael Simacek - 1.6-9.3 +- SCL-ize maven-plugin subpackage + +* Thu Feb 13 2014 Mikolaj Izdebski - 1.6-9.2 +- Rebuild to regenerate auto-requires + +* Tue Feb 11 2014 Mikolaj Izdebski - 1.6-9.1 +- First maven30 software collection build + +* Fri Dec 27 2013 Daniel Mach - 1.6-9 +- Mass rebuild 2013-12-27 + +* Wed Sep 25 2013 Mikolaj Izdebski - 1.6-8 +- Add missing barriers in cache initialization +- Simplify shared lib extraction, resolves: CVE-2013-2035 + +* Tue Aug 27 2013 Mikolaj Izdebski - 1.6-7 +- Migrate away from mvn-rpmbuild + +* Fri Jun 28 2013 Mikolaj Izdebski - 1.6-6 +- Rebuild to regenerate API documentation +- Resolves: CVE-2013-1571 + +* Mon Apr 29 2013 Mikolaj Izdebski - 1.6-5 +- Remove unneeded BR: maven-idea-plugin + +* Thu Feb 14 2013 Fedora Release Engineering - 1.6-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Wed Feb 06 2013 Java SIG - 1.6-3 +- Update for https://fedoraproject.org/wiki/Fedora_19_Maven_Rebuild +- Replace maven BuildRequires with maven-local + +* Tue Jan 22 2013 Mikolaj Izdebski - 1.6-2 +- Replace asm2 requires with objectweb-asm +- Resolves: rhbz#902674 + +* Fri Sep 07 2012 gil cattaneo 1.6-1 +- Upstream release 1.6 + +* Thu Jul 19 2012 Fedora Release Engineering - 1.5-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Wed Apr 18 2012 Stanislav Ochotnicky - 1.5-3 +- Remove eclipse plugin from BuildRequires + +* Thu Jan 19 2012 Stanislav Ochotnicky - 1.5-2 +- Replace plexus-maven-plugin with plexus-containers implementation + +* Sun Jan 15 2012 Marek Goldmann 1.5-1 +- Upstream release 1.5 + +* Fri Jan 13 2012 Fedora Release Engineering - 1.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Wed Aug 10 2011 Marek Goldmann 1.3-1 +- Upstream release 1.3 + +* Fri Jul 29 2011 Marek Goldmann 1.2-1 +- Upstream release 1.2 +- Moved to new depmap macro + +* Mon May 30 2011 Marek Goldmann 1.1-4 +- Removed maven-shade-plugin dependency + +* Mon May 30 2011 Marek Goldmann 1.1-3 +- Split maven-hawtjni-plugin into new package +- Fixed license +- Fixed summary +- Using xz to compress source code + +* Sun May 29 2011 Marek Goldmann 1.1-2 +- Added maven-hawtjni-plugin + +* Fri May 27 2011 Marek Goldmann 1.1-1 +- Initial packaging